	.file	"377623.c"
	.intel_syntax noprefix
	.text
	.globl	perror_exit
	.type	perror_exit, @function
perror_exit:
.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, 16
	mov	QWORD PTR -8[rbp], rdi
	mov	rax, QWORD PTR -8[rbp]
	mov	rdi, rax
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
	.cfi_endproc
.LFE6:
	.size	perror_exit, .-perror_exit
	.section	.rodata
.LC0:
	.string	"fork 1"
.LC1:
	.string	"setsid"
.LC2:
	.string	"fork 2"
.LC3:
	.string	"/"
.LC4:
	.string	"/dev/null"
.LC5:
	.string	"dup2 in"
.LC6:
	.string	"dup2 out"
.LC7:
	.string	"dup2 err"
	.text
	.globl	become_daemon
	.type	become_daemon, @function
become_daemon:
.LFB7:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 16
	call	fork@PLT
	mov	DWORD PTR -4[rbp], eax
	cmp	DWORD PTR -4[rbp], -1
	jne	.L3
	lea	rdi, .LC0[rip]
	call	perror_exit
	jmp	.L4
.L3:
	cmp	DWORD PTR -4[rbp], 0
	jle	.L4
	mov	edi, 0
	call	exit@PLT
.L4:
	call	setsid@PLT
	cmp	eax, -1
	jne	.L5
	lea	rdi, .LC1[rip]
	call	perror_exit
.L5:
	call	fork@PLT
	mov	DWORD PTR -4[rbp], eax
	cmp	DWORD PTR -4[rbp], -1
	jne	.L6
	lea	rdi, .LC2[rip]
	call	perror_exit
	jmp	.L7
.L6:
	cmp	DWORD PTR -4[rbp], 0
	jle	.L7
	mov	edi, 0
	call	exit@PLT
.L7:
	mov	edi, 0
	call	umask@PLT
	lea	rdi, .LC3[rip]
	call	chdir@PLT
	mov	edi, 4
	call	sysconf@PLT
	mov	DWORD PTR -8[rbp], eax
	jmp	.L8
.L9:
	mov	eax, DWORD PTR -8[rbp]
	mov	edi, eax
	call	close@PLT
	sub	DWORD PTR -8[rbp], 1
.L8:
	cmp	DWORD PTR -8[rbp], 0
	jns	.L9
	mov	esi, 2
	lea	rdi, .LC4[rip]
	mov	eax, 0
	call	open@PLT
	mov	DWORD PTR -8[rbp], eax
	mov	eax, DWORD PTR -8[rbp]
	mov	esi, 0
	mov	edi, eax
	call	dup2@PLT
	test	eax, eax
	je	.L10
	lea	rdi, .LC5[rip]
	call	perror_exit
.L10:
	mov	eax, DWORD PTR -8[rbp]
	mov	esi, 1
	mov	edi, eax
	call	dup2@PLT
	cmp	eax, 1
	je	.L11
	lea	rdi, .LC6[rip]
	call	perror_exit
.L11:
	mov	eax, DWORD PTR -8[rbp]
	mov	esi, 2
	mov	edi, eax
	call	dup2@PLT
	cmp	eax, 2
	je	.L12
	lea	rdi, .LC7[rip]
	call	perror_exit
.L12:
	mov	eax, DWORD PTR -8[rbp]
	mov	edi, eax
	call	close@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	become_daemon, .-become_daemon
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	eax, 0
	call	become_daemon
	mov	edi, 20
	call	sleep@PLT
	mov	eax, 0
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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	"377623.c"
	.text
	.align	2
	.global	perror_exit
	.syntax unified
	.arm
	.fpu softvfp
	.type	perror_exit, %function
perror_exit:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	str	r0, [fp, #-8]
	ldr	r0, [fp, #-8]
	bl	perror
	mov	r0, #1
	bl	exit
	.size	perror_exit, .-perror_exit
	.section	.rodata
	.align	2
.LC0:
	.ascii	"fork 1\000"
	.align	2
.LC1:
	.ascii	"setsid\000"
	.align	2
.LC2:
	.ascii	"fork 2\000"
	.align	2
.LC3:
	.ascii	"/\000"
	.align	2
.LC4:
	.ascii	"/dev/null\000"
	.align	2
.LC5:
	.ascii	"dup2 in\000"
	.align	2
.LC6:
	.ascii	"dup2 out\000"
	.align	2
.LC7:
	.ascii	"dup2 err\000"
	.text
	.align	2
	.global	become_daemon
	.syntax unified
	.arm
	.fpu softvfp
	.type	become_daemon, %function
become_daemon:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	bl	fork
	mov	r3, r0
	str	r3, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmn	r3, #1
	bne	.L3
	ldr	r0, .L13
	bl	perror_exit
	b	.L4
.L3:
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	ble	.L4
	mov	r0, #0
	bl	exit
.L4:
	bl	setsid
	mov	r3, r0
	cmn	r3, #1
	bne	.L5
	ldr	r0, .L13+4
	bl	perror_exit
.L5:
	bl	fork
	mov	r3, r0
	str	r3, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmn	r3, #1
	bne	.L6
	ldr	r0, .L13+8
	bl	perror_exit
	b	.L7
.L6:
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	ble	.L7
	mov	r0, #0
	bl	exit
.L7:
	mov	r0, #0
	bl	umask
	ldr	r0, .L13+12
	bl	chdir
	mov	r0, #4
	bl	sysconf
	str	r0, [fp, #-12]
	b	.L8
.L9:
	ldr	r0, [fp, #-12]
	bl	close
	ldr	r3, [fp, #-12]
	sub	r3, r3, #1
	str	r3, [fp, #-12]
.L8:
	ldr	r3, [fp, #-12]
	cmp	r3, #0
	bge	.L9
	mov	r1, #2
	ldr	r0, .L13+16
	bl	open
	str	r0, [fp, #-12]
	mov	r1, #0
	ldr	r0, [fp, #-12]
	bl	dup2
	mov	r3, r0
	cmp	r3, #0
	beq	.L10
	ldr	r0, .L13+20
	bl	perror_exit
.L10:
	mov	r1, #1
	ldr	r0, [fp, #-12]
	bl	dup2
	mov	r3, r0
	cmp	r3, #1
	beq	.L11
	ldr	r0, .L13+24
	bl	perror_exit
.L11:
	mov	r1, #2
	ldr	r0, [fp, #-12]
	bl	dup2
	mov	r3, r0
	cmp	r3, #2
	beq	.L12
	ldr	r0, .L13+28
	bl	perror_exit
.L12:
	ldr	r0, [fp, #-12]
	bl	close
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L14:
	.align	2
.L13:
	.word	.LC0
	.word	.LC1
	.word	.LC2
	.word	.LC3
	.word	.LC4
	.word	.LC5
	.word	.LC6
	.word	.LC7
	.size	become_daemon, .-become_daemon
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	bl	become_daemon
	mov	r0, #20
	bl	sleep
	mov	r3, #0
	mov	r0, r3
	pop	{fp, pc}
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
