	.file	"930628.c"
	.intel_syntax noprefix
	.text
	.section	.rodata
.LC0:
	.string	"/"
.LC1:
	.string	"/dev/null"
.LC2:
	.string	"daemond"
	.align 8
.LC3:
	.string	"unexpected file descriptors %d %d %d"
	.text
	.globl	daemonize
	.type	daemonize, @function
daemonize:
.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, 208
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	edi, 0
	call	umask@PLT
	lea	rax, -192[rbp]
	mov	rsi, rax
	mov	edi, 7
	call	getrlimit@PLT
	cmp	eax, -1
	jne	.L2
	mov	eax, -1
	jmp	.L1
.L2:
	mov	QWORD PTR -160[rbp], 1
	lea	rax, -160[rbp]
	add	rax, 8
	mov	rdi, rax
	call	sigemptyset@PLT
	lea	rax, -160[rbp]
	mov	edx, 0
	mov	rsi, rax
	mov	edi, 1
	call	sigaction@PLT
	cmp	eax, -1
	jne	.L4
	mov	eax, -1
	jmp	.L1
.L4:
	call	fork@PLT
	mov	DWORD PTR -204[rbp], eax
	cmp	DWORD PTR -204[rbp], -1
	jne	.L5
	mov	eax, -1
	jmp	.L1
.L5:
	cmp	DWORD PTR -204[rbp], 0
	je	.L6
	mov	edi, 0
	call	exit@PLT
.L6:
	lea	rdi, .LC0[rip]
	call	chdir@PLT
	cmp	eax, -1
	jne	.L7
	mov	eax, -1
	jmp	.L1
.L7:
	mov	rax, QWORD PTR -184[rbp]
	cmp	rax, -1
	jne	.L8
	mov	QWORD PTR -184[rbp], 1024
.L8:
	mov	QWORD PTR -200[rbp], 0
	jmp	.L9
.L10:
	mov	rax, QWORD PTR -200[rbp]
	mov	edi, eax
	call	close@PLT
	add	QWORD PTR -200[rbp], 1
.L9:
	mov	rax, QWORD PTR -184[rbp]
	cmp	QWORD PTR -200[rbp], rax
	jb	.L10
	call	setsid@PLT
	cmp	eax, -1
	jne	.L11
	mov	eax, -1
	jmp	.L1
.L11:
	call	fork@PLT
	mov	DWORD PTR -204[rbp], eax
	cmp	DWORD PTR -204[rbp], -1
	jne	.L12
	mov	eax, -1
	jmp	.L1
.L12:
	cmp	DWORD PTR -204[rbp], 0
	je	.L13
	mov	edi, 0
	call	exit@PLT
.L13:
	mov	esi, 0
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	open@PLT
	mov	DWORD PTR -172[rbp], eax
	mov	eax, DWORD PTR -172[rbp]
	cmp	eax, -1
	jne	.L14
	mov	eax, -1
	jmp	.L1
.L14:
	mov	eax, DWORD PTR -172[rbp]
	mov	edi, eax
	call	dup@PLT
	mov	DWORD PTR -168[rbp], eax
	mov	eax, DWORD PTR -172[rbp]
	mov	edi, eax
	call	dup@PLT
	mov	DWORD PTR -164[rbp], eax
	mov	edx, 24
	mov	esi, 8
	lea	rdi, .LC2[rip]
	call	openlog@PLT
	mov	eax, DWORD PTR -172[rbp]
	test	eax, eax
	jne	.L15
	mov	eax, DWORD PTR -168[rbp]
	cmp	eax, 1
	jne	.L15
	mov	eax, DWORD PTR -164[rbp]
	cmp	eax, 2
	je	.L16
.L15:
	mov	ecx, DWORD PTR -164[rbp]
	mov	edx, DWORD PTR -168[rbp]
	mov	eax, DWORD PTR -172[rbp]
	mov	r8d, ecx
	mov	ecx, edx
	mov	edx, eax
	lea	rsi, .LC3[rip]
	mov	edi, 3
	mov	eax, 0
	call	syslog@PLT
	mov	edi, 1
	call	exit@PLT
.L16:
.L1:
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	daemonize, .-daemonize
	.section	.rodata
.LC4:
	.string	"Daemonizing..."
.LC5:
	.string	"I am now a daemon!"
.LC6:
	.string	"Exiting..."
	.text
	.globl	main
	.type	main, @function
main:
.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
	mov	DWORD PTR -4[rbp], edi
	mov	QWORD PTR -16[rbp], rsi
	lea	rdi, .LC4[rip]
	call	puts@PLT
	mov	eax, 0
	call	daemonize
	lea	rsi, .LC5[rip]
	mov	edi, 6
	mov	eax, 0
	call	syslog@PLT
	mov	edi, 5
	call	sleep@PLT
	lea	rsi, .LC6[rip]
	mov	edi, 6
	mov	eax, 0
	call	syslog@PLT
	mov	eax, 0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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	"930628.c"
	.text
	.section	.rodata
	.align	2
.LC0:
	.ascii	"/\000"
	.align	2
.LC1:
	.ascii	"/dev/null\000"
	.align	2
.LC2:
	.ascii	"daemond\000"
	.align	2
.LC3:
	.ascii	"unexpected file descriptors %d %d %d\000"
	.align	2
.LC4:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	daemonize
	.syntax unified
	.arm
	.fpu softvfp
	.type	daemonize, %function
daemonize:
	@ args = 0, pretend = 0, frame = 176
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #184
	ldr	r3, .L19
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	mov	r0, #0
	bl	umask
	sub	r3, fp, #168
	mov	r1, r3
	mov	r0, #7
	bl	getrlimit
	mov	r3, r0
	cmn	r3, #1
	bne	.L2
	mvn	r3, #0
	b	.L1
.L2:
	mov	r3, #1
	str	r3, [fp, #-148]
	sub	r3, fp, #148
	add	r3, r3, #4
	mov	r0, r3
	bl	sigemptyset
	sub	r3, fp, #148
	mov	r2, #0
	mov	r1, r3
	mov	r0, #1
	bl	sigaction
	mov	r3, r0
	cmn	r3, #1
	bne	.L4
	mvn	r3, #0
	b	.L1
.L4:
	bl	fork
	mov	r3, r0
	str	r3, [fp, #-172]
	ldr	r3, [fp, #-172]
	cmn	r3, #1
	bne	.L5
	mvn	r3, #0
	b	.L1
.L5:
	ldr	r3, [fp, #-172]
	cmp	r3, #0
	beq	.L6
	mov	r0, #0
	bl	exit
.L6:
	ldr	r0, .L19+4
	bl	chdir
	mov	r3, r0
	cmn	r3, #1
	bne	.L7
	mvn	r3, #0
	b	.L1
.L7:
	ldr	r3, [fp, #-164]
	cmn	r3, #1
	bne	.L8
	mov	r3, #1024
	str	r3, [fp, #-164]
.L8:
	mov	r3, #0
	str	r3, [fp, #-176]
	b	.L9
.L10:
	ldr	r3, [fp, #-176]
	mov	r0, r3
	bl	close
	ldr	r3, [fp, #-176]
	add	r3, r3, #1
	str	r3, [fp, #-176]
.L9:
	ldr	r3, [fp, #-164]
	ldr	r2, [fp, #-176]
	cmp	r2, r3
	bcc	.L10
	bl	setsid
	mov	r3, r0
	cmn	r3, #1
	bne	.L11
	mvn	r3, #0
	b	.L1
.L11:
	bl	fork
	mov	r3, r0
	str	r3, [fp, #-172]
	ldr	r3, [fp, #-172]
	cmn	r3, #1
	bne	.L12
	mvn	r3, #0
	b	.L1
.L12:
	ldr	r3, [fp, #-172]
	cmp	r3, #0
	beq	.L13
	mov	r0, #0
	bl	exit
.L13:
	mov	r1, #0
	ldr	r0, .L19+8
	bl	open
	mov	r3, r0
	str	r3, [fp, #-160]
	ldr	r3, [fp, #-160]
	cmn	r3, #1
	bne	.L14
	mvn	r3, #0
	b	.L1
.L14:
	ldr	r3, [fp, #-160]
	mov	r0, r3
	bl	dup
	mov	r3, r0
	str	r3, [fp, #-156]
	ldr	r3, [fp, #-160]
	mov	r0, r3
	bl	dup
	mov	r3, r0
	str	r3, [fp, #-152]
	mov	r2, #24
	mov	r1, #8
	ldr	r0, .L19+12
	bl	openlog
	ldr	r3, [fp, #-160]
	cmp	r3, #0
	bne	.L15
	ldr	r3, [fp, #-156]
	cmp	r3, #1
	bne	.L15
	ldr	r3, [fp, #-152]
	cmp	r3, #2
	beq	.L16
.L15:
	ldr	r2, [fp, #-160]
	ldr	r1, [fp, #-156]
	ldr	r3, [fp, #-152]
	str	r3, [sp]
	mov	r3, r1
	ldr	r1, .L19+16
	mov	r0, #3
	bl	syslog
	mov	r0, #1
	bl	exit
.L16:
.L1:
	ldr	r2, .L19
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L18
	bl	__stack_chk_fail
.L18:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L20:
	.align	2
.L19:
	.word	.LC4
	.word	.LC0
	.word	.LC1
	.word	.LC2
	.word	.LC3
	.size	daemonize, .-daemonize
	.section	.rodata
	.align	2
.LC5:
	.ascii	"Daemonizing...\000"
	.align	2
.LC6:
	.ascii	"I am now a daemon!\000"
	.align	2
.LC7:
	.ascii	"Exiting...\000"
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ 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]
	str	r1, [fp, #-12]
	ldr	r0, .L23
	bl	puts
	bl	daemonize
	ldr	r1, .L23+4
	mov	r0, #6
	bl	syslog
	mov	r0, #5
	bl	sleep
	ldr	r1, .L23+8
	mov	r0, #6
	bl	syslog
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L24:
	.align	2
.L23:
	.word	.LC5
	.word	.LC6
	.word	.LC7
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
