	.file	"extr_utils.c_open_file.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s: cannot open %s: %m\n"
.LC1:
	.string	"%s: cannot seek %s: %m\n"
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC2:
	.string	"opened file %s, fd=%d, size=%lld\n"
	.text
	.p2align 4
	.globl	open_file
	.type	open_file, @function
open_file:
.LFB0:
	.cfi_startproc
	endbr64
	push	r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	push	r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	push	r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	mov	r12, rsi
	push	rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	mov	ebp, edx
	push	rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	movsx	rbx, edi
	mov	edi, DWORD PTR f_inited[rip]
	call	assert@PLT
	xor	edi, edi
	test	ebx, ebx
	js	.L2
	xor	edi, edi
	cmp	DWORD PTR f_inited[rip], ebx
	setg	dil
.L2:
	call	assert@PLT
	mov	rax, QWORD PTR fnames[rip]
	lea	r13, 0[0+rbx*8]
	mov	QWORD PTR [rax+rbx*8], r12
	lea	rax, 0[0+rbx*4]
	test	ebp, ebp
	jle	.L3
	mov	esi, DWORD PTR O_RDWR[rip]
	or	esi, DWORD PTR O_CREAT[rip]
	cmp	ebp, 2
	je	.L17
.L4:
	add	rax, QWORD PTR fd[rip]
	mov	edx, 384
	mov	rdi, r12
	mov	rbp, rax
	call	open@PLT
	mov	DWORD PTR 0[rbp], eax
.L5:
	mov	rax, QWORD PTR fd[rip]
	mov	edi, DWORD PTR [rax+rbx*4]
	test	edi, edi
	js	.L18
.L6:
	mov	edx, DWORD PTR SEEK_END[rip]
	xor	esi, esi
	add	r13, QWORD PTR fsize[rip]
	call	lseek@PLT
	mov	QWORD PTR 0[r13], rax
	mov	rax, QWORD PTR fsize[rip]
	cmp	QWORD PTR [rax+rbx*8], 0
	js	.L19
.L8:
	mov	rax, QWORD PTR fd[rip]
	mov	edx, DWORD PTR SEEK_SET[rip]
	xor	esi, esi
	mov	edi, DWORD PTR [rax+rbx*4]
	call	lseek@PLT
	cmp	QWORD PTR verbosity[rip], 0
	jne	.L20
.L9:
	mov	rax, QWORD PTR fd[rip]
	mov	eax, DWORD PTR [rax+rbx*4]
.L1:
	pop	rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	pop	rbp
	.cfi_def_cfa_offset 32
	pop	r12
	.cfi_def_cfa_offset 24
	pop	r13
	.cfi_def_cfa_offset 16
	pop	r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L18:
	.cfi_restore_state
	mov	rdx, QWORD PTR progname[rip]
	mov	edi, DWORD PTR stderr[rip]
	mov	rcx, r12
	xor	eax, eax
	lea	rsi, .LC0[rip]
	call	fprintf@PLT
	mov	edi, 1
	call	exit@PLT
	mov	rax, QWORD PTR fd[rip]
	mov	edi, DWORD PTR [rax+rbx*4]
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L17:
	or	esi, DWORD PTR O_TRUNC[rip]
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L3:
	mov	esi, DWORD PTR O_RDONLY[rip]
	add	rax, QWORD PTR fd[rip]
	mov	edx, 384
	mov	rdi, r12
	mov	r14, rax
	call	open@PLT
	mov	DWORD PTR [r14], eax
	test	ebp, ebp
	je	.L5
	mov	rax, QWORD PTR fd[rip]
	mov	edi, DWORD PTR [rax+rbx*4]
	test	edi, edi
	jns	.L6
	mov	rdx, QWORD PTR progname[rip]
	mov	edi, DWORD PTR stderr[rip]
	mov	rcx, r12
	xor	eax, eax
	lea	rsi, .LC0[rip]
	call	fprintf@PLT
	mov	eax, -1
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L20:
	mov	rax, QWORD PTR fd[rip]
	mov	edi, DWORD PTR stderr[rip]
	mov	rdx, r12
	lea	rsi, .LC2[rip]
	mov	ecx, DWORD PTR [rax+rbx*4]
	mov	rax, QWORD PTR fsize[rip]
	mov	r8, QWORD PTR [rax+rbx*8]
	xor	eax, eax
	call	fprintf@PLT
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L19:
	mov	rdx, QWORD PTR progname[rip]
	mov	edi, DWORD PTR stderr[rip]
	mov	rcx, r12
	xor	eax, eax
	lea	rsi, .LC1[rip]
	call	fprintf@PLT
	mov	edi, 2
	call	exit@PLT
	jmp	.L8
	.cfi_endproc
.LFE0:
	.size	open_file, .-open_file
	.comm	verbosity,8,8
	.comm	stderr,4,4
	.comm	progname,8,8
	.comm	fsize,8,8
	.comm	fnames,8,8
	.comm	fd,8,8
	.comm	f_inited,4,4
	.comm	SEEK_SET,4,4
	.comm	SEEK_END,4,4
	.comm	O_TRUNC,4,4
	.comm	O_RDWR,4,4
	.comm	O_RDONLY,4,4
	.comm	O_CREAT,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.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, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_utils.c_open_file.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"%s: cannot open %s: %m\012\000"
	.align	2
.LC1:
	.ascii	"%s: cannot seek %s: %m\012\000"
	.align	2
.LC2:
	.ascii	"opened file %s, fd=%d, size=%lld\012\000"
	.text
	.align	2
	.global	open_file
	.syntax unified
	.arm
	.fpu softvfp
	.type	open_file, %function
open_file:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, lr}
	mov	r4, r0
	ldr	r6, .L23
	sub	sp, sp, #8
	ldr	r0, [r6]
	mov	r5, r1
	mov	r7, r2
	bl	assert
	cmp	r4, #0
	movlt	r0, #0
	blt	.L2
	ldr	r0, [r6]
	cmp	r0, r4
	movle	r0, #0
	movgt	r0, #1
.L2:
	bl	assert
	ldr	r3, .L23+4
	cmp	r7, #0
	ldr	r3, [r3]
	str	r5, [r3, r4, lsl #2]
	ble	.L3
	ldr	r2, .L23+8
	ldr	r3, .L23+12
	ldr	r1, [r2]
	ldr	r3, [r3]
	cmp	r7, #2
	orr	r1, r1, r3
	beq	.L19
.L4:
	ldr	r6, .L23+16
	mov	r2, #384
	mov	r0, r5
	ldr	r7, [r6]
	bl	open
	str	r0, [r7, r4, lsl #2]
.L5:
	ldr	r3, [r6]
	ldr	r0, [r3, r4, lsl #2]
	cmp	r0, #0
	blt	.L20
.L6:
	ldr	r3, .L23+20
	ldr	r7, .L23+24
	ldr	r2, [r3]
	mov	r1, #0
	ldr	r8, [r7]
	bl	lseek
	ldr	r3, [r7]
	str	r0, [r8, r4, lsl #2]
	ldr	r3, [r3, r4, lsl #2]
	cmp	r3, #0
	blt	.L21
.L8:
	ldr	r3, [r6]
	ldr	r2, .L23+28
	ldr	r0, [r3, r4, lsl #2]
	mov	r1, #0
	ldr	r2, [r2]
	bl	lseek
	ldr	r3, .L23+32
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L22
.L9:
	ldr	r3, [r6]
	ldr	r0, [r3, r4, lsl #2]
.L1:
	add	sp, sp, #8
	@ sp needed
	pop	{r4, r5, r6, r7, r8, pc}
.L20:
	ldr	r3, .L23+36
	ldr	r2, .L23+40
	ldr	r0, [r3]
	ldr	r2, [r2]
	mov	r3, r5
	ldr	r1, .L23+44
	bl	fprintf
	mov	r0, #1
	bl	exit
	ldr	r3, [r6]
	ldr	r0, [r3, r4, lsl #2]
	b	.L6
.L19:
	ldr	r3, .L23+48
	ldr	r3, [r3]
	orr	r1, r1, r3
	b	.L4
.L3:
	ldr	r3, .L23+52
	ldr	r6, .L23+16
	mov	r2, #384
	mov	r0, r5
	ldr	r1, [r3]
	ldr	r8, [r6]
	bl	open
	cmp	r7, #0
	str	r0, [r8, r4, lsl #2]
	beq	.L5
	ldr	r3, [r6]
	ldr	r0, [r3, r4, lsl #2]
	cmp	r0, #0
	bge	.L6
	ldr	r1, .L23+36
	ldr	r2, .L23+40
	ldr	r0, [r1]
	mov	r3, r5
	ldr	r2, [r2]
	ldr	r1, .L23+44
	bl	fprintf
	mvn	r0, #0
	b	.L1
.L22:
	ldr	r2, [r7]
	ldr	r3, [r6]
	ldr	r0, [r2, r4, lsl #2]
	ldr	r1, .L23+36
	ldr	r3, [r3, r4, lsl #2]
	str	r0, [sp]
	mov	r2, r5
	ldr	r0, [r1]
	ldr	r1, .L23+56
	bl	fprintf
	b	.L9
.L21:
	ldr	r3, .L23+36
	ldr	r2, .L23+40
	ldr	r0, [r3]
	ldr	r2, [r2]
	mov	r3, r5
	ldr	r1, .L23+60
	bl	fprintf
	mov	r0, #2
	bl	exit
	b	.L8
.L24:
	.align	2
.L23:
	.word	f_inited
	.word	fnames
	.word	O_RDWR
	.word	O_CREAT
	.word	fd
	.word	SEEK_END
	.word	fsize
	.word	SEEK_SET
	.word	verbosity
	.word	stderr
	.word	progname
	.word	.LC0
	.word	O_TRUNC
	.word	O_RDONLY
	.word	.LC2
	.word	.LC1
	.size	open_file, .-open_file
	.comm	verbosity,4,4
	.comm	stderr,4,4
	.comm	progname,4,4
	.comm	fsize,4,4
	.comm	fnames,4,4
	.comm	fd,4,4
	.comm	f_inited,4,4
	.comm	SEEK_SET,4,4
	.comm	SEEK_END,4,4
	.comm	O_TRUNC,4,4
	.comm	O_RDWR,4,4
	.comm	O_RDONLY,4,4
	.comm	O_CREAT,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
