	.file	"710678.c"
	.intel_syntax noprefix
	.text
	.section	.rodata
.LC0:
	.string	"/bin/bash"
.LC1:
	.string	"openpty"
.LC2:
	.string	"fork"
.LC3:
	.string	"ioctl"
.LC4:
	.string	"read"
	.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, 4096
	or	QWORD PTR [rsp], 0
	sub	rsp, 80
	mov	DWORD PTR -8260[rbp], edi
	mov	QWORD PTR -8272[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	cmp	DWORD PTR -8260[rbp], 1
	jle	.L2
	mov	rax, QWORD PTR -8272[rbp]
	mov	rax, QWORD PTR 8[rax]
	mov	QWORD PTR -8248[rbp], rax
	jmp	.L3
.L2:
	lea	rax, .LC0[rip]
	mov	QWORD PTR -8248[rbp], rax
.L3:
	lea	rsi, -8252[rbp]
	lea	rax, -8256[rbp]
	mov	r8d, 0
	mov	ecx, 0
	mov	edx, 0
	mov	rdi, rax
	call	openpty@PLT
	test	eax, eax
	jns	.L4
	lea	rsi, .LC1[rip]
	mov	edi, 1
	mov	eax, 0
	call	err@PLT
.L4:
	call	fork@PLT
	cmp	eax, -1
	je	.L5
	test	eax, eax
	je	.L6
	jmp	.L14
.L5:
	lea	rsi, .LC2[rip]
	mov	edi, 1
	mov	eax, 0
	call	err@PLT
.L6:
	call	setsid@PLT
	mov	eax, DWORD PTR -8252[rbp]
	mov	esi, 0
	mov	edi, eax
	call	dup2@PLT
	mov	eax, DWORD PTR -8252[rbp]
	mov	esi, 1
	mov	edi, eax
	call	dup2@PLT
	mov	eax, DWORD PTR -8252[rbp]
	mov	esi, 2
	mov	edi, eax
	call	dup2@PLT
	mov	eax, DWORD PTR -8252[rbp]
	mov	edx, 0
	mov	esi, 21518
	mov	edi, eax
	mov	eax, 0
	call	ioctl@PLT
	test	eax, eax
	jns	.L8
	lea	rsi, .LC3[rip]
	mov	edi, 1
	mov	eax, 0
	call	err@PLT
.L8:
	mov	eax, DWORD PTR -8256[rbp]
	mov	edi, eax
	call	close@PLT
	mov	eax, DWORD PTR -8252[rbp]
	mov	edi, eax
	call	close@PLT
	mov	rax, QWORD PTR -8248[rbp]
	mov	QWORD PTR -8224[rbp], rax
	mov	QWORD PTR -8216[rbp], 0
	lea	rdx, -8224[rbp]
	mov	rax, QWORD PTR -8248[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	call	execvp@PLT
	mov	edi, 1
	call	_exit@PLT
.L14:
	mov	eax, DWORD PTR -8252[rbp]
	mov	edi, eax
	call	close@PLT
	nop
	mov	eax, DWORD PTR -8256[rbp]
	lea	rcx, -8208[rbp]
	mov	edx, 8192
	mov	rsi, rcx
	mov	edi, eax
	call	read@PLT
	mov	QWORD PTR -8232[rbp], rax
	cmp	QWORD PTR -8232[rbp], 0
	jns	.L9
	lea	rsi, .LC4[rip]
	mov	edi, 1
	mov	eax, 0
	call	err@PLT
.L9:
	mov	QWORD PTR -8240[rbp], 0
	jmp	.L10
.L11:
	lea	rdx, -8208[rbp]
	mov	rax, QWORD PTR -8240[rbp]
	add	rax, rdx
	movzx	eax, BYTE PTR [rax]
	movsx	eax, al
	mov	edi, eax
	call	putchar@PLT
	add	QWORD PTR -8240[rbp], 1
.L10:
	mov	rax, QWORD PTR -8240[rbp]
	cmp	rax, QWORD PTR -8232[rbp]
	jl	.L11
	mov	edi, 10
	call	putchar@PLT
	mov	eax, 0
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	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	"710678.c"
	.text
	.section	.rodata
	.align	2
.LC0:
	.ascii	"/bin/bash\000"
	.align	2
.LC1:
	.ascii	"openpty\000"
	.align	2
.LC2:
	.ascii	"fork\000"
	.align	2
.LC3:
	.ascii	"ioctl\000"
	.align	2
.LC4:
	.ascii	"read\000"
	.align	2
.LC5:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 8232
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, fp, lr}
	add	fp, sp, #8
	sub	sp, sp, #8192
	sub	sp, sp, #52
	sub	r3, fp, #8192
	sub	r3, r3, #12
	str	r0, [r3, #-36]
	sub	r3, fp, #8192
	sub	r3, r3, #12
	str	r1, [r3, #-40]
	ldr	r3, .L15
	ldr	r3, [r3]
	str	r3, [fp, #-16]
	mov	r3,#0
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-36]
	cmp	r3, #1
	ble	.L2
	sub	r3, fp, #8192
	sub	r3, r3, #12
	mov	r2, r3
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-40]
	ldr	r3, [r3, #4]
	str	r3, [r2, #-24]
	b	.L3
.L2:
	sub	r3, fp, #8192
	sub	r3, r3, #12
	mov	r2, r3
	ldr	r3, .L15+4
	str	r3, [r2, #-24]
.L3:
	sub	r1, fp, #8192
	sub	r1, r1, #12
	sub	r1, r1, #28
	sub	r0, fp, #8192
	sub	r0, r0, #12
	sub	r0, r0, #32
	mov	r3, #0
	str	r3, [sp]
	mov	r3, #0
	mov	r2, #0
	bl	openpty
	mov	r3, r0
	cmp	r3, #0
	bge	.L4
	ldr	r1, .L15+8
	mov	r0, #1
	bl	err
.L4:
	bl	fork
	mov	r3, r0
	cmn	r3, #1
	beq	.L5
	cmp	r3, #0
	beq	.L6
	b	.L14
.L5:
	ldr	r1, .L15+12
	mov	r0, #1
	bl	err
.L6:
	bl	setsid
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-28]
	mov	r1, #0
	mov	r0, r3
	bl	dup2
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-28]
	mov	r1, #1
	mov	r0, r3
	bl	dup2
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-28]
	mov	r1, #2
	mov	r0, r3
	bl	dup2
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-28]
	mov	r2, #0
	ldr	r1, .L15+16
	mov	r0, r3
	bl	ioctl
	mov	r3, r0
	cmp	r3, #0
	bge	.L8
	ldr	r1, .L15+20
	mov	r0, #1
	bl	err
.L8:
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-32]
	mov	r0, r3
	bl	close
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-28]
	mov	r0, r3
	bl	close
	sub	r3, fp, #8192
	sub	r3, r3, #12
	mov	r2, r3
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-24]
	str	r3, [r2, #-12]
	sub	r3, fp, #8192
	sub	r3, r3, #12
	mov	r2, r3
	mov	r3, #0
	str	r3, [r2, #-8]
	sub	r3, fp, #8192
	sub	r3, r3, #12
	sub	r3, r3, #12
	sub	r2, fp, #8192
	sub	r2, r2, #12
	mov	r1, r3
	ldr	r0, [r2, #-24]
	bl	execvp
	mov	r0, #1
	bl	_exit
.L14:
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-28]
	mov	r0, r3
	bl	close
	nop
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r0, [r3, #-32]
	sub	r3, fp, #8192
	sub	r3, r3, #12
	mov	r4, r3
	sub	r3, fp, #8192
	sub	r3, r3, #12
	sub	r3, r3, #4
	mov	r2, #8192
	mov	r1, r3
	bl	read
	str	r0, [r4, #-16]
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-16]
	cmp	r3, #0
	bge	.L9
	ldr	r1, .L15+24
	mov	r0, #1
	bl	err
.L9:
	sub	r3, fp, #8192
	sub	r3, r3, #12
	mov	r2, r3
	mov	r3, #0
	str	r3, [r2, #-20]
	b	.L10
.L11:
	sub	r3, fp, #8192
	sub	r3, r3, #12
	mov	r2, r3
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-20]
	add	r3, r2, r3
	sub	r3, r3, #4
	ldrb	r3, [r3]	@ zero_extendqisi2
	mov	r0, r3
	bl	putchar
	sub	r3, fp, #8192
	sub	r3, r3, #12
	mov	r2, r3
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r3, [r3, #-20]
	add	r3, r3, #1
	str	r3, [r2, #-20]
.L10:
	sub	r3, fp, #8192
	sub	r3, r3, #12
	mov	r2, r3
	sub	r3, fp, #8192
	sub	r3, r3, #12
	ldr	r2, [r2, #-20]
	ldr	r3, [r3, #-16]
	cmp	r2, r3
	blt	.L11
	mov	r0, #10
	bl	putchar
	mov	r3, #0
	ldr	r2, .L15
	ldr	r1, [r2]
	ldr	r2, [fp, #-16]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L13
	bl	__stack_chk_fail
.L13:
	mov	r0, r3
	sub	sp, fp, #8
	@ sp needed
	pop	{r4, fp, pc}
.L16:
	.align	2
.L15:
	.word	.LC5
	.word	.LC0
	.word	.LC1
	.word	.LC2
	.word	21518
	.word	.LC3
	.word	.LC4
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
