	.file	"781016.c"
	.intel_syntax noprefix
	.text
	.section	.rodata
	.align 8
.LC0:
	.string	"Setting the close-on-exec flag of file-descriptor 0."
.LC1:
	.string	"fcntl(0, F_SETFD, 1)"
	.align 8
.LC2:
	.string	"Duplicating file-descriptor 0 to 3."
.LC3:
	.string	"dup2(0, 3)"
	.align 8
.LC4:
	.string	"Testing if the close-on-exec flag of file-descriptor 3 is set."
.LC5:
	.string	"(res = fcntl(3, F_GETFD, 0))"
	.align 8
.LC6:
	.string	"Yes, a newly dup2()ed file-descriptor has the close-on-exec flag cloned.\nTHIS VIOLATES Posix1003.1 section 6.2.1.2 or 6.5.2.2!\nYou should #define DUP2_DUPS_CLOSE_ON_EXEC in sys_defs.h for your OS."
	.align 8
.LC7:
	.string	"No, a newly dup2()ed file-descriptor has the close-on-exec flag cleared.\nThis complies with Posix1003.1 section 6.2.1.2 and 6.5.2.2!"
	.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, 32
	mov	DWORD PTR -20[rbp], edi
	mov	QWORD PTR -32[rbp], rsi
	lea	rdi, .LC0[rip]
	call	puts@PLT
	mov	edx, 1
	mov	esi, 2
	mov	edi, 0
	mov	eax, 0
	call	fcntl@PLT
	test	eax, eax
	jns	.L2
	lea	rdi, .LC1[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L2:
	lea	rdi, .LC2[rip]
	call	puts@PLT
	mov	esi, 3
	mov	edi, 0
	call	dup2@PLT
	test	eax, eax
	jns	.L3
	lea	rdi, .LC3[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L3:
	lea	rdi, .LC4[rip]
	call	puts@PLT
	mov	edx, 0
	mov	esi, 1
	mov	edi, 3
	mov	eax, 0
	call	fcntl@PLT
	mov	DWORD PTR -4[rbp], eax
	cmp	DWORD PTR -4[rbp], 0
	jns	.L4
	lea	rdi, .LC5[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L4:
	mov	eax, DWORD PTR -4[rbp]
	and	eax, 1
	test	eax, eax
	je	.L5
	lea	rdi, .LC6[rip]
	call	puts@PLT
	jmp	.L6
.L5:
	lea	rdi, .LC7[rip]
	call	puts@PLT
.L6:
	mov	eax, 0
	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	"781016.c"
	.text
	.section	.rodata
	.align	2
.LC0:
	.ascii	"Setting the close-on-exec flag of file-descriptor 0"
	.ascii	".\000"
	.align	2
.LC1:
	.ascii	"fcntl(0, F_SETFD, 1)\000"
	.align	2
.LC2:
	.ascii	"Duplicating file-descriptor 0 to 3.\000"
	.align	2
.LC3:
	.ascii	"dup2(0, 3)\000"
	.align	2
.LC4:
	.ascii	"Testing if the close-on-exec flag of file-descripto"
	.ascii	"r 3 is set.\000"
	.align	2
.LC5:
	.ascii	"(res = fcntl(3, F_GETFD, 0))\000"
	.align	2
.LC6:
	.ascii	"Yes, a newly dup2()ed file-descriptor has the close"
	.ascii	"-on-exec flag cloned.\012THIS VIOLATES Posix1003.1 "
	.ascii	"section 6.2.1.2 or 6.5.2.2!\012You should #define D"
	.ascii	"UP2_DUPS_CLOSE_ON_EXEC in sys_defs.h for your OS.\000"
	.align	2
.LC7:
	.ascii	"No, a newly dup2()ed file-descriptor has the close-"
	.ascii	"on-exec flag cleared.\012This complies with Posix10"
	.ascii	"03.1 section 6.2.1.2 and 6.5.2.2!\000"
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #16
	str	r0, [fp, #-16]
	str	r1, [fp, #-20]
	ldr	r0, .L8
	bl	puts
	mov	r2, #1
	mov	r1, #2
	mov	r0, #0
	bl	fcntl
	mov	r3, r0
	cmp	r3, #0
	bge	.L2
	ldr	r0, .L8+4
	bl	perror
	mov	r0, #1
	bl	exit
.L2:
	ldr	r0, .L8+8
	bl	puts
	mov	r1, #3
	mov	r0, #0
	bl	dup2
	mov	r3, r0
	cmp	r3, #0
	bge	.L3
	ldr	r0, .L8+12
	bl	perror
	mov	r0, #1
	bl	exit
.L3:
	ldr	r0, .L8+16
	bl	puts
	mov	r2, #0
	mov	r1, #1
	mov	r0, #3
	bl	fcntl
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	bge	.L4
	ldr	r0, .L8+20
	bl	perror
	mov	r0, #1
	bl	exit
.L4:
	ldr	r3, [fp, #-8]
	and	r3, r3, #1
	cmp	r3, #0
	beq	.L5
	ldr	r0, .L8+24
	bl	puts
	b	.L6
.L5:
	ldr	r0, .L8+28
	bl	puts
.L6:
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L9:
	.align	2
.L8:
	.word	.LC0
	.word	.LC1
	.word	.LC2
	.word	.LC3
	.word	.LC4
	.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
