	.file	"48574187.c"
	.intel_syntax noprefix
	.text
	.section	.rodata
.LC0:
	.string	"test.txt"
.LC1:
	.string	"creat"
.LC2:
	.string	"EACCES"
.LC3:
	.string	"chmod"
.LC4:
	.string	"open"
.LC5:
	.string	"fstat"
.LC6:
	.string	"S_ISREG %d\n"
.LC7:
	.string	"."
.LC8:
	.string	"opendir"
.LC9:
	.string	"dirfd"
.LC10:
	.string	"S_ISDIR %d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 352
	mov	DWORD PTR -340[rbp], edi
	mov	QWORD PTR -352[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	esi, 64
	lea	rdi, .LC0[rip]
	call	creat@PLT
	mov	DWORD PTR -328[rbp], eax
	cmp	DWORD PTR -328[rbp], -1
	jne	.L2
	lea	rdi, .LC1[rip]
	call	perror@PLT
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	cmp	eax, 13
	jne	.L2
	lea	rdi, .LC2[rip]
	call	puts@PLT
	mov	esi, 256
	lea	rdi, .LC0[rip]
	call	chmod@PLT
	mov	DWORD PTR -324[rbp], eax
	cmp	DWORD PTR -324[rbp], -1
	jne	.L3
	lea	rdi, .LC3[rip]
	call	perror@PLT
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	jmp	.L9
.L3:
	mov	esi, 0
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	open@PLT
	mov	DWORD PTR -328[rbp], eax
	cmp	DWORD PTR -328[rbp], -1
	jne	.L2
	lea	rdi, .LC4[rip]
	call	perror@PLT
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	jmp	.L9
.L2:
	lea	rdx, -304[rbp]
	mov	eax, DWORD PTR -328[rbp]
	mov	rsi, rdx
	mov	edi, eax
	call	fstat@PLT
	mov	DWORD PTR -320[rbp], eax
	cmp	DWORD PTR -320[rbp], -1
	jne	.L5
	lea	rdi, .LC5[rip]
	call	perror@PLT
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	jmp	.L9
.L5:
	mov	eax, DWORD PTR -280[rbp]
	and	eax, 61440
	cmp	eax, 32768
	sete	al
	movzx	eax, al
	mov	esi, eax
	lea	rdi, .LC6[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, .LC7[rip]
	call	opendir@PLT
	mov	QWORD PTR -312[rbp], rax
	cmp	QWORD PTR -312[rbp], 0
	jne	.L6
	lea	rdi, .LC8[rip]
	call	perror@PLT
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	jmp	.L9
.L6:
	mov	rax, QWORD PTR -312[rbp]
	mov	rdi, rax
	call	dirfd@PLT
	mov	DWORD PTR -316[rbp], eax
	cmp	DWORD PTR -316[rbp], -1
	jne	.L7
	lea	rdi, .LC9[rip]
	call	perror@PLT
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	jmp	.L9
.L7:
	lea	rdx, -160[rbp]
	mov	eax, DWORD PTR -316[rbp]
	mov	rsi, rdx
	mov	edi, eax
	call	fstat@PLT
	mov	DWORD PTR -320[rbp], eax
	cmp	DWORD PTR -320[rbp], -1
	jne	.L8
	lea	rdi, .LC5[rip]
	call	perror@PLT
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	jmp	.L9
.L8:
	mov	eax, DWORD PTR -136[rbp]
	and	eax, 61440
	cmp	eax, 32768
	sete	al
	movzx	eax, al
	mov	esi, eax
	lea	rdi, .LC6[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR -136[rbp]
	and	eax, 61440
	cmp	eax, 16384
	sete	al
	movzx	eax, al
	mov	esi, eax
	lea	rdi, .LC10[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 0
.L9:
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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	"48574187.c"
	.text
	.section	.rodata
	.align	2
.LC0:
	.ascii	"test.txt\000"
	.align	2
.LC1:
	.ascii	"creat\000"
	.align	2
.LC2:
	.ascii	"EACCES\000"
	.align	2
.LC3:
	.ascii	"chmod\000"
	.align	2
.LC4:
	.ascii	"open\000"
	.align	2
.LC5:
	.ascii	"fstat\000"
	.align	2
.LC6:
	.ascii	"S_ISREG %d\012\000"
	.align	2
.LC7:
	.ascii	".\000"
	.align	2
.LC8:
	.ascii	"opendir\000"
	.align	2
.LC9:
	.ascii	"dirfd\000"
	.align	2
.LC10:
	.ascii	"S_ISDIR %d\012\000"
	.align	2
.LC11:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 216
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #216
	str	r0, [fp, #-216]
	str	r1, [fp, #-220]
	ldr	r3, .L11
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	mov	r1, #64
	ldr	r0, .L11+4
	bl	creat
	str	r0, [fp, #-208]
	ldr	r3, [fp, #-208]
	cmn	r3, #1
	bne	.L2
	ldr	r0, .L11+8
	bl	perror
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	cmp	r3, #13
	bne	.L2
	ldr	r0, .L11+12
	bl	puts
	mov	r1, #256
	ldr	r0, .L11+4
	bl	chmod
	str	r0, [fp, #-204]
	ldr	r3, [fp, #-204]
	cmn	r3, #1
	bne	.L3
	ldr	r0, .L11+16
	bl	perror
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	b	.L9
.L3:
	mov	r1, #0
	ldr	r0, .L11+4
	bl	open
	str	r0, [fp, #-208]
	ldr	r3, [fp, #-208]
	cmn	r3, #1
	bne	.L2
	ldr	r0, .L11+20
	bl	perror
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	b	.L9
.L2:
	sub	r3, fp, #188
	mov	r1, r3
	ldr	r0, [fp, #-208]
	bl	fstat
	str	r0, [fp, #-200]
	ldr	r3, [fp, #-200]
	cmn	r3, #1
	bne	.L5
	ldr	r0, .L11+24
	bl	perror
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	b	.L9
.L5:
	ldr	r3, [fp, #-172]
	and	r3, r3, #61440
	cmp	r3, #32768
	moveq	r3, #1
	movne	r3, #0
	and	r3, r3, #255
	mov	r1, r3
	ldr	r0, .L11+28
	bl	printf
	ldr	r0, .L11+32
	bl	opendir
	str	r0, [fp, #-196]
	ldr	r3, [fp, #-196]
	cmp	r3, #0
	bne	.L6
	ldr	r0, .L11+36
	bl	perror
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	b	.L9
.L6:
	ldr	r0, [fp, #-196]
	bl	dirfd
	str	r0, [fp, #-192]
	ldr	r3, [fp, #-192]
	cmn	r3, #1
	bne	.L7
	ldr	r0, .L11+40
	bl	perror
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	b	.L9
.L7:
	sub	r3, fp, #100
	mov	r1, r3
	ldr	r0, [fp, #-192]
	bl	fstat
	str	r0, [fp, #-200]
	ldr	r3, [fp, #-200]
	cmn	r3, #1
	bne	.L8
	ldr	r0, .L11+24
	bl	perror
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	b	.L9
.L8:
	ldr	r3, [fp, #-84]
	and	r3, r3, #61440
	cmp	r3, #32768
	moveq	r3, #1
	movne	r3, #0
	and	r3, r3, #255
	mov	r1, r3
	ldr	r0, .L11+28
	bl	printf
	ldr	r3, [fp, #-84]
	and	r3, r3, #61440
	cmp	r3, #16384
	moveq	r3, #1
	movne	r3, #0
	and	r3, r3, #255
	mov	r1, r3
	ldr	r0, .L11+44
	bl	printf
	mov	r3, #0
.L9:
	ldr	r2, .L11
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L10
	bl	__stack_chk_fail
.L10:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L12:
	.align	2
.L11:
	.word	.LC11
	.word	.LC0
	.word	.LC1
	.word	.LC2
	.word	.LC3
	.word	.LC4
	.word	.LC5
	.word	.LC6
	.word	.LC7
	.word	.LC8
	.word	.LC9
	.word	.LC10
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
