	.file	"327930.c"
	.intel_syntax noprefix
	.text
	.section	.rodata
	.align 8
.LC0:
	.string	"[+] Usage: %s [boot|recovery] [in.lok]\n"
.LC1:
	.string	"1.1"
.LC2:
	.string	"[+] loki_flash v%s\n"
.LC3:
	.string	"boot"
.LC4:
	.string	"recovery"
	.align 8
.LC5:
	.string	"[+] First argument must be \"boot\" or \"recovery\"."
	.align 8
.LC6:
	.string	"/dev/block/platform/msm_sdcc.1/by-name/aboot"
	.align 8
.LC7:
	.string	"[-] Failed to open aboot for reading."
	.align 8
.LC8:
	.string	"[-] Failed to open %s for reading.\n"
.LC9:
	.string	"[-] fstat() failed."
	.align 8
.LC10:
	.string	"[-] Failed to mmap Loki image."
.LC11:
	.string	"LOKI"
	.align 8
.LC12:
	.string	"[-] Input file is not a Loki image."
	.align 8
.LC13:
	.string	"[-] Loki image is not a %s image.\n"
.LC14:
	.string	"[-] Failed to mmap aboot."
.LC15:
	.string	"\360\265\217\260\006F\360\367"
	.align 8
.LC16:
	.string	"[-] Loki aboot version does not match device."
	.align 8
.LC17:
	.string	"[+] Loki validation passed, flashing image."
	.align 8
.LC18:
	.string	"/dev/block/platform/msm_sdcc.1/by-name/%s"
	.align 8
.LC19:
	.string	"[-] Failed to open output block device."
	.align 8
.LC20:
	.string	"[-] Failed to write to block device."
.LC21:
	.string	"[+] Loki flashing complete!"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 4096
	or	QWORD PTR [rsp], 0
	sub	rsp, 240
	mov	DWORD PTR -4324[rbp], edi
	mov	QWORD PTR -4336[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	cmp	DWORD PTR -4324[rbp], 3
	je	.L2
	mov	rax, QWORD PTR -4336[rbp]
	mov	rax, QWORD PTR [rax]
	mov	rsi, rax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 1
	jmp	.L21
.L2:
	lea	rsi, .LC1[rip]
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR -4336[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	lea	rsi, .LC3[rip]
	mov	rdi, rax
	call	strcmp@PLT
	test	eax, eax
	jne	.L4
	mov	DWORD PTR -4312[rbp], 0
	jmp	.L5
.L4:
	mov	rax, QWORD PTR -4336[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	lea	rsi, .LC4[rip]
	mov	rdi, rax
	call	strcmp@PLT
	test	eax, eax
	jne	.L6
	mov	DWORD PTR -4312[rbp], 1
	jmp	.L5
.L6:
	lea	rdi, .LC5[rip]
	call	puts@PLT
	mov	eax, 1
	jmp	.L21
.L5:
	mov	esi, 0
	lea	rdi, .LC6[rip]
	mov	eax, 0
	call	open@PLT
	mov	DWORD PTR -4308[rbp], eax
	cmp	DWORD PTR -4308[rbp], 0
	jns	.L7
	lea	rdi, .LC7[rip]
	call	puts@PLT
	mov	eax, 1
	jmp	.L21
.L7:
	mov	rax, QWORD PTR -4336[rbp]
	add	rax, 16
	mov	rax, QWORD PTR [rax]
	mov	esi, 0
	mov	rdi, rax
	mov	eax, 0
	call	open@PLT
	mov	DWORD PTR -4304[rbp], eax
	cmp	DWORD PTR -4304[rbp], 0
	jns	.L8
	mov	rax, QWORD PTR -4336[rbp]
	add	rax, 16
	mov	rax, QWORD PTR [rax]
	mov	rsi, rax
	lea	rdi, .LC8[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 1
	jmp	.L21
.L8:
	lea	rdx, -4256[rbp]
	mov	eax, DWORD PTR -4304[rbp]
	mov	rsi, rdx
	mov	edi, eax
	call	fstat@PLT
	test	eax, eax
	je	.L9
	lea	rdi, .LC9[rip]
	call	puts@PLT
	mov	eax, 1
	jmp	.L21
.L9:
	mov	rax, QWORD PTR -4208[rbp]
	add	rax, 12287
	and	rax, -4096
	mov	edx, DWORD PTR -4304[rbp]
	mov	r9d, 0
	mov	r8d, edx
	mov	ecx, 2
	mov	edx, 1
	mov	rsi, rax
	mov	edi, 0
	call	mmap@PLT
	mov	QWORD PTR -4296[rbp], rax
	cmp	QWORD PTR -4296[rbp], -1
	jne	.L10
	lea	rdi, .LC10[rip]
	call	puts@PLT
	mov	eax, 1
	jmp	.L21
.L10:
	mov	rax, QWORD PTR -4296[rbp]
	mov	QWORD PTR -4288[rbp], rax
	mov	rax, QWORD PTR -4296[rbp]
	add	rax, 1024
	mov	QWORD PTR -4280[rbp], rax
	mov	rax, QWORD PTR -4280[rbp]
	mov	edx, 4
	lea	rsi, .LC11[rip]
	mov	rdi, rax
	call	memcmp@PLT
	test	eax, eax
	je	.L11
	lea	rdi, .LC12[rip]
	call	puts@PLT
	mov	eax, 1
	jmp	.L21
.L11:
	mov	rax, QWORD PTR -4280[rbp]
	mov	edx, DWORD PTR 4[rax]
	mov	eax, DWORD PTR -4312[rbp]
	cmp	edx, eax
	je	.L12
	cmp	DWORD PTR -4312[rbp], 0
	je	.L13
	lea	rax, .LC4[rip]
	jmp	.L14
.L13:
	lea	rax, .LC3[rip]
.L14:
	mov	rsi, rax
	lea	rdi, .LC13[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 1
	jmp	.L21
.L12:
	mov	eax, DWORD PTR -4308[rbp]
	mov	r9d, 0
	mov	r8d, eax
	mov	ecx, 2
	mov	edx, 1
	mov	esi, 65536
	mov	edi, 0
	call	mmap@PLT
	mov	QWORD PTR -4272[rbp], rax
	cmp	QWORD PTR -4272[rbp], -1
	jne	.L15
	lea	rdi, .LC14[rip]
	call	puts@PLT
	mov	eax, 1
	jmp	.L21
.L15:
	mov	rax, QWORD PTR -4288[rbp]
	mov	eax, DWORD PTR 20[rax]
	add	eax, 1998585896
	mov	eax, eax
	lea	rdx, 8[rax]
	mov	rax, QWORD PTR -4272[rbp]
	add	rax, rdx
	mov	QWORD PTR -4264[rbp], rax
	mov	rax, QWORD PTR -4264[rbp]
	mov	edx, 8
	lea	rsi, .LC15[rip]
	mov	rdi, rax
	call	memcmp@PLT
	test	eax, eax
	je	.L16
	lea	rdi, .LC16[rip]
	call	puts@PLT
	mov	eax, 1
	jmp	.L21
.L16:
	lea	rdi, .LC17[rip]
	call	puts@PLT
	cmp	DWORD PTR -4312[rbp], 0
	je	.L17
	lea	rax, .LC4[rip]
	jmp	.L18
.L17:
	lea	rax, .LC3[rip]
.L18:
	lea	rdi, -4112[rbp]
	mov	rcx, rax
	lea	rdx, .LC18[rip]
	mov	esi, 1024
	mov	eax, 0
	call	snprintf@PLT
	lea	rax, -4112[rbp]
	mov	esi, 1
	mov	rdi, rax
	mov	eax, 0
	call	open@PLT
	mov	DWORD PTR -4300[rbp], eax
	cmp	DWORD PTR -4300[rbp], 0
	jns	.L19
	lea	rdi, .LC19[rip]
	call	puts@PLT
	mov	eax, 1
	jmp	.L21
.L19:
	mov	rax, QWORD PTR -4208[rbp]
	mov	rdx, rax
	mov	rcx, QWORD PTR -4296[rbp]
	mov	eax, DWORD PTR -4300[rbp]
	mov	rsi, rcx
	mov	edi, eax
	call	write@PLT
	mov	rdx, QWORD PTR -4208[rbp]
	cmp	rax, rdx
	je	.L20
	lea	rdi, .LC20[rip]
	call	puts@PLT
	mov	eax, 1
	jmp	.L21
.L20:
	lea	rdi, .LC21[rip]
	call	puts@PLT
	mov	eax, DWORD PTR -4304[rbp]
	mov	edi, eax
	call	close@PLT
	mov	eax, DWORD PTR -4308[rbp]
	mov	edi, eax
	call	close@PLT
	mov	eax, DWORD PTR -4300[rbp]
	mov	edi, eax
	call	close@PLT
	mov	eax, 0
.L21:
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 10.5.0-1ubuntu1~20.04) 10.5.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 6
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"327930.c"
	.text
	.section	.rodata
	.align	2
.LC0:
	.ascii	"[+] Usage: %s [boot|recovery] [in.lok]\012\000"
	.align	2
.LC1:
	.ascii	"1.1\000"
	.align	2
.LC2:
	.ascii	"[+] loki_flash v%s\012\000"
	.align	2
.LC3:
	.ascii	"boot\000"
	.align	2
.LC4:
	.ascii	"recovery\000"
	.align	2
.LC5:
	.ascii	"[+] First argument must be \"boot\" or \"recovery\""
	.ascii	".\000"
	.align	2
.LC6:
	.ascii	"/dev/block/platform/msm_sdcc.1/by-name/aboot\000"
	.align	2
.LC7:
	.ascii	"[-] Failed to open aboot for reading.\000"
	.align	2
.LC8:
	.ascii	"[-] Failed to open %s for reading.\012\000"
	.align	2
.LC9:
	.ascii	"[-] fstat() failed.\000"
	.align	2
.LC10:
	.ascii	"[-] Failed to mmap Loki image.\000"
	.align	2
.LC11:
	.ascii	"LOKI\000"
	.align	2
.LC12:
	.ascii	"[-] Input file is not a Loki image.\000"
	.align	2
.LC13:
	.ascii	"[-] Loki image is not a %s image.\012\000"
	.align	2
.LC14:
	.ascii	"[-] Failed to mmap aboot.\000"
	.align	2
.LC15:
	.ascii	"\360\265\217\260\006F\360\367\000"
	.align	2
.LC16:
	.ascii	"[-] Loki aboot version does not match device.\000"
	.align	2
.LC17:
	.ascii	"[+] Loki validation passed, flashing image.\000"
	.align	2
.LC18:
	.ascii	"/dev/block/platform/msm_sdcc.1/by-name/%s\000"
	.align	2
.LC19:
	.ascii	"[-] Failed to open output block device.\000"
	.align	2
.LC20:
	.ascii	"[-] Failed to write to block device.\000"
	.align	2
.LC21:
	.ascii	"[+] Loki flashing complete!\000"
	.align	2
.LC22:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 4240
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, fp, lr}
	add	fp, sp, #8
	sub	sp, sp, #4224
	sub	sp, sp, #28
	sub	r3, fp, #4096
	sub	r3, r3, #12
	str	r0, [r3, #-140]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	str	r1, [r3, #-144]
	ldr	r3, .L23
	ldr	r3, [r3]
	str	r3, [fp, #-16]
	mov	r3,#0
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-140]
	cmp	r3, #3
	beq	.L2
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-144]
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L23+4
	bl	printf
	mov	r3, #1
	b	.L21
.L2:
	ldr	r1, .L23+8
	ldr	r0, .L23+12
	bl	printf
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-144]
	add	r3, r3, #4
	ldr	r3, [r3]
	ldr	r1, .L23+16
	mov	r0, r3
	bl	strcmp
	mov	r3, r0
	cmp	r3, #0
	bne	.L4
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r2, r3
	mov	r3, #0
	str	r3, [r2, #-132]
	b	.L5
.L4:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-144]
	add	r3, r3, #4
	ldr	r3, [r3]
	ldr	r1, .L23+20
	mov	r0, r3
	bl	strcmp
	mov	r3, r0
	cmp	r3, #0
	bne	.L6
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r2, r3
	mov	r3, #1
	str	r3, [r2, #-132]
	b	.L5
.L6:
	ldr	r0, .L23+24
	bl	puts
	mov	r3, #1
	b	.L21
.L5:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r4, r3
	mov	r1, #0
	ldr	r0, .L23+28
	bl	open
	str	r0, [r4, #-128]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-128]
	cmp	r3, #0
	bge	.L7
	ldr	r0, .L23+32
	bl	puts
	mov	r3, #1
	b	.L21
.L7:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-144]
	add	r3, r3, #8
	ldr	r3, [r3]
	sub	r2, fp, #4096
	sub	r2, r2, #12
	mov	r4, r2
	mov	r1, #0
	mov	r0, r3
	bl	open
	str	r0, [r4, #-124]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-124]
	cmp	r3, #0
	bge	.L8
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-144]
	add	r3, r3, #8
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L23+36
	bl	printf
	mov	r3, #1
	b	.L21
.L8:
	sub	r3, fp, #4160
	sub	r3, r3, #12
	sub	r3, r3, #32
	sub	r2, fp, #4096
	sub	r2, r2, #12
	mov	r1, r3
	ldr	r0, [r2, #-124]
	bl	fstat
	mov	r3, r0
	cmp	r3, #0
	beq	.L9
	ldr	r0, .L23+40
	bl	puts
	mov	r3, #1
	b	.L21
.L9:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-52]
	add	r3, r3, #12224
	add	r3, r3, #63
	bic	r1, r3, #4080
	bic	r1, r1, #15
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r4, r3
	mov	r3, #0
	str	r3, [sp, #4]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-124]
	str	r3, [sp]
	mov	r3, #2
	mov	r2, #1
	mov	r0, #0
	bl	mmap
	str	r0, [r4, #-120]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-120]
	cmn	r3, #1
	bne	.L10
	ldr	r0, .L23+44
	bl	puts
	mov	r3, #1
	b	.L21
.L10:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r2, r3
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-120]
	str	r3, [r2, #-116]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r2, r3
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-120]
	add	r3, r3, #1024
	str	r3, [r2, #-112]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-112]
	mov	r2, #4
	ldr	r1, .L23+48
	mov	r0, r3
	bl	memcmp
	mov	r3, r0
	cmp	r3, #0
	beq	.L11
	ldr	r0, .L23+52
	bl	puts
	mov	r3, #1
	b	.L21
.L11:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-112]
	ldr	r2, [r3, #4]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-132]
	cmp	r2, r3
	beq	.L12
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-132]
	cmp	r3, #0
	beq	.L13
	ldr	r3, .L23+20
	b	.L14
.L13:
	ldr	r3, .L23+16
.L14:
	mov	r1, r3
	ldr	r0, .L23+56
	bl	printf
	mov	r3, #1
	b	.L21
.L12:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r4, r3
	mov	r3, #0
	str	r3, [sp, #4]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-128]
	str	r3, [sp]
	mov	r3, #2
	mov	r2, #1
	mov	r1, #65536
	mov	r0, #0
	bl	mmap
	str	r0, [r4, #-108]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-108]
	cmn	r3, #1
	bne	.L15
	ldr	r0, .L23+60
	bl	puts
	mov	r3, #1
	b	.L21
.L15:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-116]
	ldr	r2, [r3, #20]
	ldr	r3, .L23+64
	add	r3, r2, r3
	sub	r2, fp, #4096
	sub	r2, r2, #12
	mov	r1, r2
	sub	r2, fp, #4096
	sub	r2, r2, #12
	ldr	r2, [r2, #-108]
	add	r3, r2, r3
	str	r3, [r1, #-104]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r2, #8
	ldr	r1, .L23+68
	ldr	r0, [r3, #-104]
	bl	memcmp
	mov	r3, r0
	cmp	r3, #0
	beq	.L16
	ldr	r0, .L23+72
	bl	puts
	mov	r3, #1
	b	.L21
.L16:
	ldr	r0, .L23+76
	bl	puts
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-132]
	cmp	r3, #0
	beq	.L17
	ldr	r3, .L23+20
	b	.L18
.L17:
	ldr	r3, .L23+16
.L18:
	sub	r0, fp, #4096
	sub	r0, r0, #12
	sub	r0, r0, #4
	ldr	r2, .L23+80
	mov	r1, #1024
	bl	snprintf
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r4, r3
	sub	r3, fp, #4096
	sub	r3, r3, #12
	sub	r3, r3, #4
	mov	r1, #1
	mov	r0, r3
	bl	open
	str	r0, [r4, #-100]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-100]
	cmp	r3, #0
	bge	.L19
	ldr	r0, .L23+84
	bl	puts
	mov	r3, #1
	b	.L21
.L19:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-52]
	mov	r2, r3
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r1, r3
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r1, [r1, #-120]
	ldr	r0, [r3, #-100]
	bl	write
	mov	r2, r0
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-52]
	cmp	r2, r3
	beq	.L20
	ldr	r0, .L23+88
	bl	puts
	mov	r3, #1
	b	.L21
.L20:
	ldr	r0, .L23+92
	bl	puts
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r0, [r3, #-124]
	bl	close
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r0, [r3, #-128]
	bl	close
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r0, [r3, #-100]
	bl	close
	mov	r3, #0
.L21:
	ldr	r2, .L23
	ldr	r1, [r2]
	ldr	r2, [fp, #-16]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L22
	bl	__stack_chk_fail
.L22:
	mov	r0, r3
	sub	sp, fp, #8
	@ sp needed
	pop	{r4, fp, pc}
.L24:
	.align	2
.L23:
	.word	.LC22
	.word	.LC0
	.word	.LC1
	.word	.LC2
	.word	.LC3
	.word	.LC4
	.word	.LC5
	.word	.LC6
	.word	.LC7
	.word	.LC8
	.word	.LC9
	.word	.LC10
	.word	.LC11
	.word	.LC12
	.word	.LC13
	.word	.LC14
	.word	1998585904
	.word	.LC15
	.word	.LC16
	.word	.LC17
	.word	.LC18
	.word	.LC19
	.word	.LC20
	.word	.LC21
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
