	.file	"849903.c"
	.intel_syntax noprefix
	.text
	.section	.rodata
.LC0:
	.string	"usage: %s <pathname>\n"
.LC1:
	.string	"r"
.LC2:
	.string	"Can't open %s\n"
.LC3:
	.string	"pipe error"
.LC4:
	.string	"fork error"
.LC5:
	.string	"write error"
.LC6:
	.string	"fgets error"
.LC7:
	.string	"wait error"
.LC8:
	.string	"dup2 error to stdin"
.LC9:
	.string	"PAGER"
.LC10:
	.string	"/bin/more"
.LC11:
	.string	"execl error for %s"
	.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, 80
	mov	DWORD PTR -4164[rbp], edi
	mov	QWORD PTR -4176[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	cmp	DWORD PTR -4164[rbp], 2
	je	.L2
	mov	rax, QWORD PTR -4176[rbp]
	mov	rax, QWORD PTR [rax]
	mov	rsi, rax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, 1
	call	exit@PLT
.L2:
	mov	rax, QWORD PTR -4176[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	lea	rsi, .LC1[rip]
	mov	rdi, rax
	call	fopen@PLT
	mov	QWORD PTR -4128[rbp], rax
	cmp	QWORD PTR -4128[rbp], 0
	jne	.L3
	mov	rax, QWORD PTR -4176[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	mov	rsi, rax
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, 1
	call	exit@PLT
.L3:
	lea	rax, -4120[rbp]
	mov	rdi, rax
	call	pipe@PLT
	test	eax, eax
	jns	.L4
	lea	rdi, .LC3[rip]
	call	puts@PLT
	mov	edi, 1
	call	exit@PLT
.L4:
	call	fork@PLT
	mov	DWORD PTR -4152[rbp], eax
	cmp	DWORD PTR -4152[rbp], 0
	jns	.L5
	lea	rdi, .LC4[rip]
	call	puts@PLT
	mov	edi, 1
	call	exit@PLT
.L5:
	cmp	DWORD PTR -4152[rbp], 0
	jle	.L6
	mov	eax, DWORD PTR -4120[rbp]
	mov	edi, eax
	call	close@PLT
	jmp	.L7
.L8:
	lea	rax, -4112[rbp]
	mov	rdi, rax
	call	strlen@PLT
	mov	DWORD PTR -4148[rbp], eax
	mov	eax, DWORD PTR -4148[rbp]
	movsx	rdx, eax
	mov	eax, DWORD PTR -4116[rbp]
	lea	rcx, -4112[rbp]
	mov	rsi, rcx
	mov	edi, eax
	call	write@PLT
	mov	edx, DWORD PTR -4148[rbp]
	movsx	rdx, edx
	cmp	rax, rdx
	je	.L7
	lea	rdi, .LC5[rip]
	call	puts@PLT
	mov	edi, 1
	call	exit@PLT
.L7:
	mov	rdx, QWORD PTR -4128[rbp]
	lea	rax, -4112[rbp]
	mov	esi, 4096
	mov	rdi, rax
	call	fgets@PLT
	test	rax, rax
	jne	.L8
	mov	rax, QWORD PTR -4128[rbp]
	mov	rdi, rax
	call	ferror@PLT
	test	eax, eax
	je	.L9
	lea	rdi, .LC6[rip]
	call	puts@PLT
	mov	edi, 1
	call	exit@PLT
.L9:
	mov	eax, DWORD PTR -4116[rbp]
	mov	edi, eax
	call	close@PLT
	mov	eax, DWORD PTR -4152[rbp]
	mov	edx, 0
	mov	esi, 0
	mov	edi, eax
	call	waitpid@PLT
	test	eax, eax
	jns	.L10
	lea	rdi, .LC7[rip]
	call	puts@PLT
	mov	edi, 1
	call	exit@PLT
.L10:
	mov	edi, 0
	call	exit@PLT
.L6:
	mov	eax, DWORD PTR -4116[rbp]
	mov	edi, eax
	call	close@PLT
	mov	eax, DWORD PTR -4120[rbp]
	test	eax, eax
	je	.L11
	mov	eax, DWORD PTR -4120[rbp]
	mov	esi, 0
	mov	edi, eax
	call	dup2@PLT
	test	eax, eax
	je	.L12
	lea	rdi, .LC8[rip]
	call	puts@PLT
	mov	edi, 1
	call	exit@PLT
.L12:
	mov	eax, DWORD PTR -4120[rbp]
	mov	edi, eax
	call	close@PLT
.L11:
	lea	rdi, .LC9[rip]
	call	getenv@PLT
	mov	QWORD PTR -4144[rbp], rax
	cmp	QWORD PTR -4144[rbp], 0
	jne	.L13
	lea	rax, .LC10[rip]
	mov	QWORD PTR -4144[rbp], rax
.L13:
	mov	rax, QWORD PTR -4144[rbp]
	mov	esi, 47
	mov	rdi, rax
	call	strchr@PLT
	mov	QWORD PTR -4136[rbp], rax
	cmp	QWORD PTR -4136[rbp], 0
	je	.L14
	add	QWORD PTR -4136[rbp], 1
	jmp	.L15
.L14:
	mov	rax, QWORD PTR -4144[rbp]
	mov	QWORD PTR -4136[rbp], rax
.L15:
	mov	rcx, QWORD PTR -4136[rbp]
	mov	rax, QWORD PTR -4144[rbp]
	mov	edx, 0
	mov	rsi, rcx
	mov	rdi, rax
	mov	eax, 0
	call	execl@PLT
	test	eax, eax
	jns	.L16
	mov	rax, QWORD PTR -4144[rbp]
	mov	rsi, rax
	lea	rdi, .LC11[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, 1
	call	exit@PLT
.L16:
	mov	edi, 0
	call	exit@PLT
	.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	"849903.c"
	.text
	.section	.rodata
	.align	2
.LC0:
	.ascii	"usage: %s <pathname>\012\000"
	.align	2
.LC1:
	.ascii	"r\000"
	.align	2
.LC2:
	.ascii	"Can't open %s\012\000"
	.align	2
.LC3:
	.ascii	"pipe error\000"
	.align	2
.LC4:
	.ascii	"fork error\000"
	.align	2
.LC5:
	.ascii	"write error\000"
	.align	2
.LC6:
	.ascii	"fgets error\000"
	.align	2
.LC7:
	.ascii	"wait error\000"
	.align	2
.LC8:
	.ascii	"dup2 error to stdin\000"
	.align	2
.LC9:
	.ascii	"PAGER\000"
	.align	2
.LC10:
	.ascii	"/bin/more\000"
	.align	2
.LC11:
	.ascii	"execl error for %s\000"
	.align	2
.LC12:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 4136
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, fp, lr}
	add	fp, sp, #8
	sub	sp, sp, #4096
	sub	sp, sp, #44
	sub	r3, fp, #4096
	sub	r3, r3, #12
	str	r0, [r3, #-36]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	str	r1, [r3, #-40]
	ldr	r3, .L18
	ldr	r3, [r3]
	str	r3, [fp, #-16]
	mov	r3,#0
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-36]
	cmp	r3, #2
	beq	.L2
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-40]
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L18+4
	bl	printf
	mov	r0, #1
	bl	exit
.L2:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-40]
	add	r3, r3, #4
	ldr	r3, [r3]
	sub	r2, fp, #4096
	sub	r2, r2, #12
	mov	r4, r2
	ldr	r1, .L18+8
	mov	r0, r3
	bl	fopen
	str	r0, [r4, #-24]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-24]
	cmp	r3, #0
	bne	.L3
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-40]
	add	r3, r3, #4
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L18+12
	bl	printf
	mov	r0, #1
	bl	exit
.L3:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	sub	r3, r3, #12
	mov	r0, r3
	bl	pipe
	mov	r3, r0
	cmp	r3, #0
	bge	.L4
	ldr	r0, .L18+16
	bl	puts
	mov	r0, #1
	bl	exit
.L4:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r4, r3
	bl	fork
	mov	r3, r0
	str	r3, [r4, #-20]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-20]
	cmp	r3, #0
	bge	.L5
	ldr	r0, .L18+20
	bl	puts
	mov	r0, #1
	bl	exit
.L5:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-20]
	cmp	r3, #0
	ble	.L6
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-12]
	mov	r0, r3
	bl	close
	b	.L7
.L8:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	sub	r3, r3, #4
	mov	r0, r3
	bl	strlen
	mov	r3, r0
	sub	r2, fp, #4096
	sub	r2, r2, #12
	str	r3, [r2, #-16]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r0, [r3, #-8]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r2, [r3, #-16]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	sub	r3, r3, #4
	mov	r1, r3
	bl	write
	mov	r2, r0
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-16]
	cmp	r3, r2
	beq	.L7
	ldr	r0, .L18+24
	bl	puts
	mov	r0, #1
	bl	exit
.L7:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r2, r3
	sub	r3, fp, #4096
	sub	r3, r3, #12
	sub	r3, r3, #4
	ldr	r2, [r2, #-24]
	mov	r1, #4096
	mov	r0, r3
	bl	fgets
	mov	r3, r0
	cmp	r3, #0
	bne	.L8
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r0, [r3, #-24]
	bl	ferror
	mov	r3, r0
	cmp	r3, #0
	beq	.L9
	ldr	r0, .L18+28
	bl	puts
	mov	r0, #1
	bl	exit
.L9:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-8]
	mov	r0, r3
	bl	close
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r2, #0
	mov	r1, #0
	ldr	r0, [r3, #-20]
	bl	waitpid
	mov	r3, r0
	cmp	r3, #0
	bge	.L10
	ldr	r0, .L18+32
	bl	puts
	mov	r0, #1
	bl	exit
.L10:
	mov	r0, #0
	bl	exit
.L6:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-8]
	mov	r0, r3
	bl	close
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-12]
	cmp	r3, #0
	beq	.L11
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-12]
	mov	r1, #0
	mov	r0, r3
	bl	dup2
	mov	r3, r0
	cmp	r3, #0
	beq	.L12
	ldr	r0, .L18+36
	bl	puts
	mov	r0, #1
	bl	exit
.L12:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-12]
	mov	r0, r3
	bl	close
.L11:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r4, r3
	ldr	r0, .L18+40
	bl	getenv
	str	r0, [r4, #-32]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-32]
	cmp	r3, #0
	bne	.L13
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r2, r3
	ldr	r3, .L18+44
	str	r3, [r2, #-32]
.L13:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r4, r3
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r1, #47
	ldr	r0, [r3, #-32]
	bl	strchr
	str	r0, [r4, #-28]
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-28]
	cmp	r3, #0
	beq	.L14
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r2, r3
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-28]
	add	r3, r3, #1
	str	r3, [r2, #-28]
	b	.L15
.L14:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r2, r3
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r3, [r3, #-32]
	str	r3, [r2, #-28]
.L15:
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r1, r3
	sub	r3, fp, #4096
	sub	r3, r3, #12
	mov	r2, #0
	ldr	r1, [r1, #-28]
	ldr	r0, [r3, #-32]
	bl	execl
	mov	r3, r0
	cmp	r3, #0
	bge	.L16
	sub	r3, fp, #4096
	sub	r3, r3, #12
	ldr	r1, [r3, #-32]
	ldr	r0, .L18+48
	bl	printf
	mov	r0, #1
	bl	exit
.L16:
	mov	r0, #0
	bl	exit
.L19:
	.align	2
.L18:
	.word	.LC12
	.word	.LC0
	.word	.LC1
	.word	.LC2
	.word	.LC3
	.word	.LC4
	.word	.LC5
	.word	.LC6
	.word	.LC7
	.word	.LC8
	.word	.LC9
	.word	.LC10
	.word	.LC11
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
