	.file	"241182.c"
	.intel_syntax noprefix
	.text
	.globl	bigbuf1
	.bss
	.align 32
	.type	bigbuf1, @object
	.size	bigbuf1, 4096
bigbuf1:
	.zero	4096
	.globl	bigbuf2
	.align 32
	.type	bigbuf2, @object
	.size	bigbuf2, 4096
bigbuf2:
	.zero	4096
	.globl	bigbufnum
	.data
	.align 4
	.type	bigbufnum, @object
	.size	bigbufnum, 4
bigbufnum:
	.long	1024
	.section	.rodata
.LC0:
	.string	"creating %s...\n"
.LC1:
	.string	"...passed (fd = %d)\n"
.LC2:
	.string	"...failed (%d)\n"
	.text
	.globl	do_creat
	.type	do_creat, @function
do_creat:
.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	QWORD PTR -24[rbp], rdi
	mov	rax, QWORD PTR -24[rbp]
	mov	rsi, rax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR -24[rbp]
	mov	rdi, rax
	mov	eax, 0
	call	creat@PLT
	mov	DWORD PTR -4[rbp], eax
	cmp	DWORD PTR -4[rbp], 0
	js	.L2
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L5
.L2:
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, -1
	call	exit@PLT
.L5:
	mov	eax, DWORD PTR -4[rbp]
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	do_creat, .-do_creat
	.section	.rodata
.LC3:
	.string	"opening %s...\n"
	.text
	.globl	do_open
	.type	do_open, @function
do_open:
.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, 32
	mov	QWORD PTR -24[rbp], rdi
	mov	rax, QWORD PTR -24[rbp]
	mov	rsi, rax
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR -24[rbp]
	mov	rdi, rax
	mov	eax, 0
	call	open@PLT
	mov	DWORD PTR -4[rbp], eax
	cmp	DWORD PTR -4[rbp], 0
	js	.L7
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L10
.L7:
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, -1
	call	exit@PLT
.L10:
	mov	eax, DWORD PTR -4[rbp]
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	do_open, .-do_open
	.section	.rodata
.LC4:
	.string	"closing %d...\n"
.LC5:
	.string	"...failed (r = %d)\n"
	.text
	.globl	do_close
	.type	do_close, @function
do_close:
.LFB8:
	.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	eax, DWORD PTR -20[rbp]
	mov	esi, eax
	lea	rdi, .LC4[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR -20[rbp]
	mov	edi, eax
	mov	eax, 0
	call	close@PLT
	mov	DWORD PTR -4[rbp], eax
	cmp	DWORD PTR -4[rbp], 0
	jns	.L13
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC5[rip]
	mov	eax, 0
	call	printf@PLT
.L13:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	do_close, .-do_close
	.section	.rodata
	.align 8
.LC6:
	.string	"writing %d bytes to file, %d bytes at a time...\n"
	.align 8
.LC7:
	.string	"...failed (expected to write %d bytes, but wrote %d)\n"
.LC8:
	.string	"...passed (wrote %d bytes)\n"
	.text
	.globl	do_write
	.type	do_write, @function
do_write:
.LFB9:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 64
	mov	QWORD PTR -40[rbp], rdi
	mov	QWORD PTR -48[rbp], rsi
	mov	DWORD PTR -52[rbp], edx
	mov	DWORD PTR -56[rbp], ecx
	mov	rax, QWORD PTR -40[rbp]
	mov	rdi, rax
	call	do_creat
	mov	DWORD PTR -20[rbp], eax
	mov	rax, QWORD PTR -48[rbp]
	mov	QWORD PTR -8[rbp], rax
	mov	eax, DWORD PTR -52[rbp]
	mov	DWORD PTR -24[rbp], eax
	mov	edx, DWORD PTR -56[rbp]
	mov	eax, DWORD PTR -52[rbp]
	mov	esi, eax
	lea	rdi, .LC6[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L15
.L19:
	mov	eax, DWORD PTR -24[rbp]
	cmp	DWORD PTR -56[rbp], eax
	cmovle	eax, DWORD PTR -56[rbp]
	mov	DWORD PTR -16[rbp], eax
	mov	edx, DWORD PTR -16[rbp]
	mov	rcx, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR -20[rbp]
	mov	rsi, rcx
	mov	edi, eax
	mov	eax, 0
	call	write@PLT
	mov	DWORD PTR -12[rbp], eax
	cmp	DWORD PTR -12[rbp], 0
	jns	.L16
	mov	eax, DWORD PTR -12[rbp]
	mov	esi, eax
	lea	rdi, .LC5[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L17
.L16:
	mov	eax, DWORD PTR -12[rbp]
	cmp	eax, DWORD PTR -16[rbp]
	je	.L18
	mov	edx, DWORD PTR -12[rbp]
	mov	eax, DWORD PTR -16[rbp]
	mov	esi, eax
	lea	rdi, .LC7[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L17
.L18:
	mov	eax, DWORD PTR -12[rbp]
	mov	esi, eax
	lea	rdi, .LC8[rip]
	mov	eax, 0
	call	printf@PLT
.L17:
	mov	eax, DWORD PTR -56[rbp]
	cdqe
	add	QWORD PTR -8[rbp], rax
	mov	eax, DWORD PTR -56[rbp]
	sub	DWORD PTR -24[rbp], eax
.L15:
	cmp	DWORD PTR -24[rbp], 0
	jg	.L19
	mov	eax, DWORD PTR -20[rbp]
	mov	edi, eax
	call	do_close
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	do_write, .-do_write
	.section	.rodata
.LC9:
	.string	"reading %s into buffer...\n"
	.align 8
.LC10:
	.string	"...failed (expected to read %d bytes, but read %d)\n"
.LC11:
	.string	"...success"
.LC12:
	.string	"validating %s...\n"
	.align 8
.LC13:
	.string	"...failed (offset %d: expected %c, read %c)\n"
.LC14:
	.string	"...passed"
	.text
	.globl	do_validate
	.type	do_validate, @function
do_validate:
.LFB10:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 48
	mov	QWORD PTR -24[rbp], rdi
	mov	QWORD PTR -32[rbp], rsi
	mov	QWORD PTR -40[rbp], rdx
	mov	DWORD PTR -44[rbp], ecx
	mov	rax, QWORD PTR -24[rbp]
	mov	rdi, rax
	call	do_open
	mov	DWORD PTR -4[rbp], eax
	mov	rax, QWORD PTR -24[rbp]
	mov	rsi, rax
	lea	rdi, .LC9[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edx, DWORD PTR -44[rbp]
	mov	rcx, QWORD PTR -32[rbp]
	mov	eax, DWORD PTR -4[rbp]
	mov	rsi, rcx
	mov	edi, eax
	mov	eax, 0
	call	read@PLT
	mov	DWORD PTR -8[rbp], eax
	cmp	DWORD PTR -8[rbp], 0
	jns	.L21
	mov	eax, DWORD PTR -8[rbp]
	mov	esi, eax
	lea	rdi, .LC5[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR -4[rbp]
	mov	edi, eax
	call	do_close
	jmp	.L20
.L21:
	mov	eax, DWORD PTR -8[rbp]
	cmp	eax, DWORD PTR -44[rbp]
	je	.L23
	mov	edx, DWORD PTR -8[rbp]
	mov	eax, DWORD PTR -44[rbp]
	mov	esi, eax
	lea	rdi, .LC10[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR -4[rbp]
	mov	edi, eax
	call	do_close
	jmp	.L20
.L23:
	lea	rdi, .LC11[rip]
	call	puts@PLT
	mov	DWORD PTR -8[rbp], 0
	mov	rax, QWORD PTR -24[rbp]
	mov	rsi, rax
	lea	rdi, .LC12[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L24
.L27:
	mov	eax, DWORD PTR -8[rbp]
	movsx	rdx, eax
	mov	rax, QWORD PTR -32[rbp]
	add	rax, rdx
	movzx	edx, BYTE PTR [rax]
	mov	eax, DWORD PTR -8[rbp]
	movsx	rcx, eax
	mov	rax, QWORD PTR -40[rbp]
	add	rax, rcx
	movzx	eax, BYTE PTR [rax]
	cmp	dl, al
	je	.L25
	mov	eax, DWORD PTR -8[rbp]
	movsx	rdx, eax
	mov	rax, QWORD PTR -32[rbp]
	add	rax, rdx
	movzx	eax, BYTE PTR [rax]
	movsx	ecx, al
	mov	eax, DWORD PTR -8[rbp]
	movsx	rdx, eax
	mov	rax, QWORD PTR -40[rbp]
	add	rax, rdx
	movzx	eax, BYTE PTR [rax]
	movsx	edx, al
	mov	eax, DWORD PTR -8[rbp]
	mov	esi, eax
	lea	rdi, .LC13[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L26
.L25:
	add	DWORD PTR -8[rbp], 1
.L24:
	mov	eax, DWORD PTR -8[rbp]
	cmp	eax, DWORD PTR -44[rbp]
	jl	.L27
.L26:
	mov	eax, DWORD PTR -8[rbp]
	cmp	eax, DWORD PTR -44[rbp]
	jne	.L28
	lea	rdi, .LC14[rip]
	call	puts@PLT
.L28:
	mov	eax, DWORD PTR -4[rbp]
	mov	edi, eax
	call	do_close
.L20:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	do_validate, .-do_validate
	.section	.rodata
.LC15:
	.string	"write.out"
	.align 8
.LC16:
	.string	"roses are red\nviolets are blue\nI love Nachos\nand so do you\n"
.LC17:
	.string	"binary.out"
	.align 8
.LC18:
	.string	"writing to an invalid fd (%d)...\n"
.LC19:
	.string	"...passed (r = %d)\n"
	.align 8
.LC20:
	.string	"...failed (r = %d, should be -1)\n"
	.align 8
.LC21:
	.string	"writing to an unopened fd (%d)...\n"
.LC22:
	.string	"bad.out"
.LC23:
	.string	"writing count = 0 bytes..."
	.align 8
.LC24:
	.string	"writing with an invalid buffer (should not crash, only return an error)..."
	.align 8
.LC25:
	.string	"writing with an invalid count (should not crash, only return an error)..."
	.align 8
.LC26:
	.string	"writing with a buffer that extends beyond the end of the"
	.align 8
.LC27:
	.string	"address space.  either return -1 or truncate the operation"
	.align 8
.LC28:
	.string	"and stop at the end and return the number of bytes written."
	.align 8
.LC29:
	.string	"we will accept both behaviors."
	.align 8
.LC30:
	.string	"...likely passed, check r (r = %d)\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB11:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 192
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	DWORD PTR -176[rbp], 128
	lea	rax, .LC15[rip]
	mov	QWORD PTR -160[rbp], rax
	lea	rax, .LC16[rip]
	mov	QWORD PTR -152[rbp], rax
	mov	rax, QWORD PTR -152[rbp]
	mov	rdi, rax
	call	strlen@PLT
	mov	DWORD PTR -172[rbp], eax
	mov	ecx, DWORD PTR -172[rbp]
	mov	edx, DWORD PTR -172[rbp]
	mov	rsi, QWORD PTR -152[rbp]
	mov	rax, QWORD PTR -160[rbp]
	mov	rdi, rax
	call	do_write
	mov	ecx, DWORD PTR -172[rbp]
	mov	rdx, QWORD PTR -152[rbp]
	lea	rsi, -144[rbp]
	mov	rax, QWORD PTR -160[rbp]
	mov	rdi, rax
	call	do_validate
	mov	edx, DWORD PTR -172[rbp]
	mov	rsi, QWORD PTR -152[rbp]
	mov	rax, QWORD PTR -160[rbp]
	mov	ecx, 8
	mov	rdi, rax
	call	do_write
	mov	ecx, DWORD PTR -172[rbp]
	mov	rdx, QWORD PTR -152[rbp]
	lea	rsi, -144[rbp]
	mov	rax, QWORD PTR -160[rbp]
	mov	rdi, rax
	call	do_validate
	mov	edx, DWORD PTR -172[rbp]
	mov	rsi, QWORD PTR -152[rbp]
	mov	rax, QWORD PTR -160[rbp]
	mov	ecx, 1
	mov	rdi, rax
	call	do_write
	mov	ecx, DWORD PTR -172[rbp]
	mov	rdx, QWORD PTR -152[rbp]
	lea	rsi, -144[rbp]
	mov	rax, QWORD PTR -160[rbp]
	mov	rdi, rax
	call	do_validate
	lea	rax, .LC17[rip]
	mov	QWORD PTR -160[rbp], rax
	mov	DWORD PTR -172[rbp], 4096
	mov	DWORD PTR -180[rbp], 0
	jmp	.L30
.L31:
	mov	eax, DWORD PTR -180[rbp]
	cdqe
	lea	rcx, 0[0+rax*4]
	lea	rdx, bigbuf1[rip]
	mov	eax, DWORD PTR -180[rbp]
	mov	DWORD PTR [rcx+rdx], eax
	add	DWORD PTR -180[rbp], 1
.L30:
	mov	eax, DWORD PTR bigbufnum[rip]
	cmp	DWORD PTR -180[rbp], eax
	jl	.L31
	mov	ecx, DWORD PTR -172[rbp]
	mov	edx, DWORD PTR -172[rbp]
	mov	rax, QWORD PTR -160[rbp]
	lea	rsi, bigbuf1[rip]
	mov	rdi, rax
	call	do_write
	mov	edx, DWORD PTR -172[rbp]
	mov	rax, QWORD PTR -160[rbp]
	mov	ecx, edx
	lea	rdx, bigbuf1[rip]
	lea	rsi, bigbuf2[rip]
	mov	rdi, rax
	call	do_validate
	mov	edx, DWORD PTR -172[rbp]
	mov	rax, QWORD PTR -160[rbp]
	mov	ecx, 128
	lea	rsi, bigbuf1[rip]
	mov	rdi, rax
	call	do_write
	mov	edx, DWORD PTR -172[rbp]
	mov	rax, QWORD PTR -160[rbp]
	mov	ecx, edx
	lea	rdx, bigbuf1[rip]
	lea	rsi, bigbuf2[rip]
	mov	rdi, rax
	call	do_validate
	mov	DWORD PTR -168[rbp], -10
	mov	DWORD PTR -172[rbp], 10
	mov	eax, DWORD PTR -168[rbp]
	mov	esi, eax
	lea	rdi, .LC18[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edx, DWORD PTR -172[rbp]
	lea	rcx, -144[rbp]
	mov	eax, DWORD PTR -168[rbp]
	mov	rsi, rcx
	mov	edi, eax
	mov	eax, 0
	call	write@PLT
	mov	DWORD PTR -164[rbp], eax
	cmp	DWORD PTR -164[rbp], 0
	jns	.L32
	mov	eax, DWORD PTR -164[rbp]
	mov	esi, eax
	lea	rdi, .LC19[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L33
.L32:
	mov	eax, DWORD PTR -164[rbp]
	mov	esi, eax
	lea	rdi, .LC20[rip]
	mov	eax, 0
	call	printf@PLT
.L33:
	mov	DWORD PTR -168[rbp], 256
	mov	DWORD PTR -172[rbp], 10
	mov	eax, DWORD PTR -168[rbp]
	mov	esi, eax
	lea	rdi, .LC18[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edx, DWORD PTR -172[rbp]
	lea	rcx, -144[rbp]
	mov	eax, DWORD PTR -168[rbp]
	mov	rsi, rcx
	mov	edi, eax
	mov	eax, 0
	call	write@PLT
	mov	DWORD PTR -164[rbp], eax
	cmp	DWORD PTR -164[rbp], 0
	jns	.L34
	mov	eax, DWORD PTR -164[rbp]
	mov	esi, eax
	lea	rdi, .LC19[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L35
.L34:
	mov	eax, DWORD PTR -164[rbp]
	mov	esi, eax
	lea	rdi, .LC20[rip]
	mov	eax, 0
	call	printf@PLT
.L35:
	mov	DWORD PTR -168[rbp], 8
	mov	DWORD PTR -172[rbp], 10
	mov	eax, DWORD PTR -168[rbp]
	mov	esi, eax
	lea	rdi, .LC21[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edx, DWORD PTR -172[rbp]
	lea	rcx, -144[rbp]
	mov	eax, DWORD PTR -168[rbp]
	mov	rsi, rcx
	mov	edi, eax
	mov	eax, 0
	call	write@PLT
	mov	DWORD PTR -164[rbp], eax
	cmp	DWORD PTR -164[rbp], 0
	jns	.L36
	mov	eax, DWORD PTR -164[rbp]
	mov	esi, eax
	lea	rdi, .LC19[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L37
.L36:
	mov	eax, DWORD PTR -164[rbp]
	mov	esi, eax
	lea	rdi, .LC20[rip]
	mov	eax, 0
	call	printf@PLT
.L37:
	lea	rax, .LC22[rip]
	mov	QWORD PTR -160[rbp], rax
	mov	rax, QWORD PTR -160[rbp]
	mov	rdi, rax
	call	do_creat
	mov	DWORD PTR -168[rbp], eax
	lea	rdi, .LC23[rip]
	call	puts@PLT
	lea	rcx, -144[rbp]
	mov	eax, DWORD PTR -168[rbp]
	mov	edx, 0
	mov	rsi, rcx
	mov	edi, eax
	mov	eax, 0
	call	write@PLT
	mov	DWORD PTR -164[rbp], eax
	cmp	DWORD PTR -164[rbp], 0
	jne	.L38
	lea	rdi, .LC14[rip]
	call	puts@PLT
	jmp	.L39
.L38:
	mov	eax, DWORD PTR -164[rbp]
	mov	esi, eax
	lea	rdi, .LC5[rip]
	mov	eax, 0
	call	printf@PLT
.L39:
	lea	rdi, .LC24[rip]
	call	puts@PLT
	mov	eax, DWORD PTR -168[rbp]
	mov	edx, 10
	mov	esi, 12247039
	mov	edi, eax
	mov	eax, 0
	call	write@PLT
	mov	DWORD PTR -164[rbp], eax
	cmp	DWORD PTR -164[rbp], 0
	jns	.L40
	mov	eax, DWORD PTR -164[rbp]
	mov	esi, eax
	lea	rdi, .LC19[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L41
.L40:
	mov	eax, DWORD PTR -164[rbp]
	mov	esi, eax
	lea	rdi, .LC5[rip]
	mov	eax, 0
	call	printf@PLT
.L41:
	lea	rdi, .LC25[rip]
	call	puts@PLT
	mov	rcx, QWORD PTR -152[rbp]
	mov	eax, DWORD PTR -168[rbp]
	mov	edx, -1
	mov	rsi, rcx
	mov	edi, eax
	mov	eax, 0
	call	write@PLT
	mov	DWORD PTR -164[rbp], eax
	cmp	DWORD PTR -164[rbp], 0
	jns	.L42
	mov	eax, DWORD PTR -164[rbp]
	mov	esi, eax
	lea	rdi, .LC19[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L43
.L42:
	mov	eax, DWORD PTR -164[rbp]
	mov	esi, eax
	lea	rdi, .LC5[rip]
	mov	eax, 0
	call	printf@PLT
.L43:
	lea	rdi, .LC26[rip]
	call	puts@PLT
	lea	rdi, .LC27[rip]
	call	puts@PLT
	lea	rdi, .LC28[rip]
	call	puts@PLT
	lea	rdi, .LC29[rip]
	call	puts@PLT
	mov	eax, DWORD PTR -168[rbp]
	mov	edx, 81920
	mov	esi, 0
	mov	edi, eax
	mov	eax, 0
	call	write@PLT
	mov	DWORD PTR -164[rbp], eax
	cmp	DWORD PTR -164[rbp], 81920
	jne	.L44
	mov	eax, DWORD PTR -164[rbp]
	mov	esi, eax
	lea	rdi, .LC5[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L45
.L44:
	mov	eax, DWORD PTR -164[rbp]
	mov	esi, eax
	lea	rdi, .LC30[rip]
	mov	eax, 0
	call	printf@PLT
.L45:
	mov	eax, 0
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L47
	call	__stack_chk_fail@PLT
.L47:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.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	"241182.c"
	.text
	.comm	bigbuf1,4096,4
	.comm	bigbuf2,4096,4
	.global	bigbufnum
	.data
	.align	2
	.type	bigbufnum, %object
	.size	bigbufnum, 4
bigbufnum:
	.word	1024
	.section	.rodata
	.align	2
.LC0:
	.ascii	"creating %s...\012\000"
	.align	2
.LC1:
	.ascii	"...passed (fd = %d)\012\000"
	.align	2
.LC2:
	.ascii	"...failed (%d)\012\000"
	.text
	.align	2
	.global	do_creat
	.syntax unified
	.arm
	.fpu softvfp
	.type	do_creat, %function
do_creat:
	@ 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]
	ldr	r1, [fp, #-16]
	ldr	r0, .L6
	bl	printf
	ldr	r0, [fp, #-16]
	bl	creat
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	blt	.L2
	ldr	r1, [fp, #-8]
	ldr	r0, .L6+4
	bl	printf
	b	.L5
.L2:
	ldr	r1, [fp, #-8]
	ldr	r0, .L6+8
	bl	printf
	mvn	r0, #0
	bl	exit
.L5:
	ldr	r3, [fp, #-8]
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L7:
	.align	2
.L6:
	.word	.LC0
	.word	.LC1
	.word	.LC2
	.size	do_creat, .-do_creat
	.section	.rodata
	.align	2
.LC3:
	.ascii	"opening %s...\012\000"
	.text
	.align	2
	.global	do_open
	.syntax unified
	.arm
	.fpu softvfp
	.type	do_open, %function
do_open:
	@ 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]
	ldr	r1, [fp, #-16]
	ldr	r0, .L13
	bl	printf
	ldr	r0, [fp, #-16]
	bl	open
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	blt	.L9
	ldr	r1, [fp, #-8]
	ldr	r0, .L13+4
	bl	printf
	b	.L12
.L9:
	ldr	r1, [fp, #-8]
	ldr	r0, .L13+8
	bl	printf
	mvn	r0, #0
	bl	exit
.L12:
	ldr	r3, [fp, #-8]
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L14:
	.align	2
.L13:
	.word	.LC3
	.word	.LC1
	.word	.LC2
	.size	do_open, .-do_open
	.section	.rodata
	.align	2
.LC4:
	.ascii	"closing %d...\012\000"
	.align	2
.LC5:
	.ascii	"...failed (r = %d)\012\000"
	.text
	.align	2
	.global	do_close
	.syntax unified
	.arm
	.fpu softvfp
	.type	do_close, %function
do_close:
	@ 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]
	ldr	r1, [fp, #-16]
	ldr	r0, .L18
	bl	printf
	ldr	r0, [fp, #-16]
	bl	close
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	bge	.L17
	ldr	r1, [fp, #-8]
	ldr	r0, .L18+4
	bl	printf
.L17:
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L19:
	.align	2
.L18:
	.word	.LC4
	.word	.LC5
	.size	do_close, .-do_close
	.section	.rodata
	.align	2
.LC6:
	.ascii	"writing %d bytes to file, %d bytes at a time...\012"
	.ascii	"\000"
	.align	2
.LC7:
	.ascii	"...failed (expected to write %d bytes, but wrote %d"
	.ascii	")\012\000"
	.align	2
.LC8:
	.ascii	"...passed (wrote %d bytes)\012\000"
	.text
	.align	2
	.global	do_write
	.syntax unified
	.arm
	.fpu softvfp
	.type	do_write, %function
do_write:
	@ args = 0, pretend = 0, frame = 40
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #40
	str	r0, [fp, #-32]
	str	r1, [fp, #-36]
	str	r2, [fp, #-40]
	str	r3, [fp, #-44]
	ldr	r0, [fp, #-32]
	bl	do_creat
	str	r0, [fp, #-16]
	ldr	r3, [fp, #-36]
	str	r3, [fp, #-20]
	ldr	r3, [fp, #-40]
	str	r3, [fp, #-24]
	ldr	r2, [fp, #-44]
	ldr	r1, [fp, #-40]
	ldr	r0, .L26
	bl	printf
	b	.L21
.L25:
	ldr	r2, [fp, #-44]
	ldr	r3, [fp, #-24]
	cmp	r2, r3
	movlt	r3, r2
	movge	r3, r3
	str	r3, [fp, #-12]
	ldr	r2, [fp, #-12]
	ldr	r1, [fp, #-20]
	ldr	r0, [fp, #-16]
	bl	write
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	bge	.L22
	ldr	r1, [fp, #-8]
	ldr	r0, .L26+4
	bl	printf
	b	.L23
.L22:
	ldr	r2, [fp, #-8]
	ldr	r3, [fp, #-12]
	cmp	r2, r3
	beq	.L24
	ldr	r2, [fp, #-8]
	ldr	r1, [fp, #-12]
	ldr	r0, .L26+8
	bl	printf
	b	.L23
.L24:
	ldr	r1, [fp, #-8]
	ldr	r0, .L26+12
	bl	printf
.L23:
	ldr	r3, [fp, #-44]
	ldr	r2, [fp, #-20]
	add	r3, r2, r3
	str	r3, [fp, #-20]
	ldr	r2, [fp, #-24]
	ldr	r3, [fp, #-44]
	sub	r3, r2, r3
	str	r3, [fp, #-24]
.L21:
	ldr	r3, [fp, #-24]
	cmp	r3, #0
	bgt	.L25
	ldr	r0, [fp, #-16]
	bl	do_close
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L27:
	.align	2
.L26:
	.word	.LC6
	.word	.LC5
	.word	.LC7
	.word	.LC8
	.size	do_write, .-do_write
	.section	.rodata
	.align	2
.LC9:
	.ascii	"reading %s into buffer...\012\000"
	.align	2
.LC10:
	.ascii	"...failed (expected to read %d bytes, but read %d)\012"
	.ascii	"\000"
	.align	2
.LC11:
	.ascii	"...success\000"
	.align	2
.LC12:
	.ascii	"validating %s...\012\000"
	.align	2
.LC13:
	.ascii	"...failed (offset %d: expected %c, read %c)\012\000"
	.align	2
.LC14:
	.ascii	"...passed\000"
	.text
	.align	2
	.global	do_validate
	.syntax unified
	.arm
	.fpu softvfp
	.type	do_validate, %function
do_validate:
	@ args = 0, pretend = 0, frame = 24
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #24
	str	r0, [fp, #-16]
	str	r1, [fp, #-20]
	str	r2, [fp, #-24]
	str	r3, [fp, #-28]
	ldr	r0, [fp, #-16]
	bl	do_open
	str	r0, [fp, #-8]
	ldr	r1, [fp, #-16]
	ldr	r0, .L37
	bl	printf
	ldr	r2, [fp, #-28]
	ldr	r1, [fp, #-20]
	ldr	r0, [fp, #-8]
	bl	read
	str	r0, [fp, #-12]
	ldr	r3, [fp, #-12]
	cmp	r3, #0
	bge	.L29
	ldr	r1, [fp, #-12]
	ldr	r0, .L37+4
	bl	printf
	ldr	r0, [fp, #-8]
	bl	do_close
	b	.L28
.L29:
	ldr	r2, [fp, #-12]
	ldr	r3, [fp, #-28]
	cmp	r2, r3
	beq	.L31
	ldr	r2, [fp, #-12]
	ldr	r1, [fp, #-28]
	ldr	r0, .L37+8
	bl	printf
	ldr	r0, [fp, #-8]
	bl	do_close
	b	.L28
.L31:
	ldr	r0, .L37+12
	bl	puts
	mov	r3, #0
	str	r3, [fp, #-12]
	ldr	r1, [fp, #-16]
	ldr	r0, .L37+16
	bl	printf
	b	.L32
.L35:
	ldr	r3, [fp, #-12]
	ldr	r2, [fp, #-20]
	add	r3, r2, r3
	ldrb	r2, [r3]	@ zero_extendqisi2
	ldr	r3, [fp, #-12]
	ldr	r1, [fp, #-24]
	add	r3, r1, r3
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r2, r3
	beq	.L33
	ldr	r3, [fp, #-12]
	ldr	r2, [fp, #-24]
	add	r3, r2, r3
	ldrb	r3, [r3]	@ zero_extendqisi2
	mov	r1, r3
	ldr	r3, [fp, #-12]
	ldr	r2, [fp, #-20]
	add	r3, r2, r3
	ldrb	r3, [r3]	@ zero_extendqisi2
	mov	r2, r1
	ldr	r1, [fp, #-12]
	ldr	r0, .L37+20
	bl	printf
	b	.L34
.L33:
	ldr	r3, [fp, #-12]
	add	r3, r3, #1
	str	r3, [fp, #-12]
.L32:
	ldr	r2, [fp, #-12]
	ldr	r3, [fp, #-28]
	cmp	r2, r3
	blt	.L35
.L34:
	ldr	r2, [fp, #-12]
	ldr	r3, [fp, #-28]
	cmp	r2, r3
	bne	.L36
	ldr	r0, .L37+24
	bl	puts
.L36:
	ldr	r0, [fp, #-8]
	bl	do_close
.L28:
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L38:
	.align	2
.L37:
	.word	.LC9
	.word	.LC5
	.word	.LC10
	.word	.LC11
	.word	.LC12
	.word	.LC13
	.word	.LC14
	.size	do_validate, .-do_validate
	.section	.rodata
	.align	2
.LC15:
	.ascii	"write.out\000"
	.align	2
.LC16:
	.ascii	"roses are red\012violets are blue\012I love Nachos\012"
	.ascii	"and so do you\012\000"
	.align	2
.LC17:
	.ascii	"binary.out\000"
	.align	2
.LC18:
	.ascii	"writing to an invalid fd (%d)...\012\000"
	.align	2
.LC19:
	.ascii	"...passed (r = %d)\012\000"
	.align	2
.LC20:
	.ascii	"...failed (r = %d, should be -1)\012\000"
	.align	2
.LC21:
	.ascii	"writing to an unopened fd (%d)...\012\000"
	.align	2
.LC22:
	.ascii	"bad.out\000"
	.align	2
.LC23:
	.ascii	"writing count = 0 bytes...\000"
	.align	2
.LC24:
	.ascii	"writing with an invalid buffer (should not crash, o"
	.ascii	"nly return an error)...\000"
	.align	2
.LC25:
	.ascii	"writing with an invalid count (should not crash, on"
	.ascii	"ly return an error)...\000"
	.align	2
.LC26:
	.ascii	"writing with a buffer that extends beyond the end o"
	.ascii	"f the\000"
	.align	2
.LC27:
	.ascii	"address space.  either return -1 or truncate the op"
	.ascii	"eration\000"
	.align	2
.LC28:
	.ascii	"and stop at the end and return the number of bytes "
	.ascii	"written.\000"
	.align	2
.LC29:
	.ascii	"we will accept both behaviors.\000"
	.align	2
.LC30:
	.ascii	"...likely passed, check r (r = %d)\012\000"
	.align	2
.LC31:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 160
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #160
	ldr	r3, .L58
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	mov	r3, #128
	str	r3, [fp, #-160]
	ldr	r3, .L58+4
	str	r3, [fp, #-156]
	ldr	r3, .L58+8
	str	r3, [fp, #-152]
	ldr	r0, [fp, #-152]
	bl	strlen
	mov	r3, r0
	str	r3, [fp, #-148]
	ldr	r3, [fp, #-148]
	ldr	r2, [fp, #-148]
	ldr	r1, [fp, #-152]
	ldr	r0, [fp, #-156]
	bl	do_write
	sub	r1, fp, #136
	ldr	r3, [fp, #-148]
	ldr	r2, [fp, #-152]
	ldr	r0, [fp, #-156]
	bl	do_validate
	mov	r3, #8
	ldr	r2, [fp, #-148]
	ldr	r1, [fp, #-152]
	ldr	r0, [fp, #-156]
	bl	do_write
	sub	r1, fp, #136
	ldr	r3, [fp, #-148]
	ldr	r2, [fp, #-152]
	ldr	r0, [fp, #-156]
	bl	do_validate
	mov	r3, #1
	ldr	r2, [fp, #-148]
	ldr	r1, [fp, #-152]
	ldr	r0, [fp, #-156]
	bl	do_write
	sub	r1, fp, #136
	ldr	r3, [fp, #-148]
	ldr	r2, [fp, #-152]
	ldr	r0, [fp, #-156]
	bl	do_validate
	ldr	r3, .L58+12
	str	r3, [fp, #-156]
	mov	r3, #4096
	str	r3, [fp, #-148]
	mov	r3, #0
	str	r3, [fp, #-164]
	b	.L40
.L41:
	ldr	r1, .L58+16
	ldr	r3, [fp, #-164]
	ldr	r2, [fp, #-164]
	str	r2, [r1, r3, lsl #2]
	ldr	r3, [fp, #-164]
	add	r3, r3, #1
	str	r3, [fp, #-164]
.L40:
	ldr	r3, .L58+20
	ldr	r3, [r3]
	ldr	r2, [fp, #-164]
	cmp	r2, r3
	blt	.L41
	ldr	r3, [fp, #-148]
	ldr	r2, [fp, #-148]
	ldr	r1, .L58+16
	ldr	r0, [fp, #-156]
	bl	do_write
	ldr	r3, [fp, #-148]
	ldr	r2, .L58+16
	ldr	r1, .L58+24
	ldr	r0, [fp, #-156]
	bl	do_validate
	mov	r3, #128
	ldr	r2, [fp, #-148]
	ldr	r1, .L58+16
	ldr	r0, [fp, #-156]
	bl	do_write
	ldr	r3, [fp, #-148]
	ldr	r2, .L58+16
	ldr	r1, .L58+24
	ldr	r0, [fp, #-156]
	bl	do_validate
	mvn	r3, #9
	str	r3, [fp, #-144]
	mov	r3, #10
	str	r3, [fp, #-148]
	ldr	r1, [fp, #-144]
	ldr	r0, .L58+28
	bl	printf
	sub	r3, fp, #136
	ldr	r2, [fp, #-148]
	mov	r1, r3
	ldr	r0, [fp, #-144]
	bl	write
	str	r0, [fp, #-140]
	ldr	r3, [fp, #-140]
	cmp	r3, #0
	bge	.L42
	ldr	r1, [fp, #-140]
	ldr	r0, .L58+32
	bl	printf
	b	.L43
.L42:
	ldr	r1, [fp, #-140]
	ldr	r0, .L58+36
	bl	printf
.L43:
	mov	r3, #256
	str	r3, [fp, #-144]
	mov	r3, #10
	str	r3, [fp, #-148]
	ldr	r1, [fp, #-144]
	ldr	r0, .L58+28
	bl	printf
	sub	r3, fp, #136
	ldr	r2, [fp, #-148]
	mov	r1, r3
	ldr	r0, [fp, #-144]
	bl	write
	str	r0, [fp, #-140]
	ldr	r3, [fp, #-140]
	cmp	r3, #0
	bge	.L44
	ldr	r1, [fp, #-140]
	ldr	r0, .L58+32
	bl	printf
	b	.L45
.L44:
	ldr	r1, [fp, #-140]
	ldr	r0, .L58+36
	bl	printf
.L45:
	mov	r3, #8
	str	r3, [fp, #-144]
	mov	r3, #10
	str	r3, [fp, #-148]
	ldr	r1, [fp, #-144]
	ldr	r0, .L58+40
	bl	printf
	sub	r3, fp, #136
	ldr	r2, [fp, #-148]
	mov	r1, r3
	ldr	r0, [fp, #-144]
	bl	write
	str	r0, [fp, #-140]
	ldr	r3, [fp, #-140]
	cmp	r3, #0
	bge	.L46
	ldr	r1, [fp, #-140]
	ldr	r0, .L58+32
	bl	printf
	b	.L47
.L46:
	ldr	r1, [fp, #-140]
	ldr	r0, .L58+36
	bl	printf
.L47:
	ldr	r3, .L58+44
	str	r3, [fp, #-156]
	ldr	r0, [fp, #-156]
	bl	do_creat
	str	r0, [fp, #-144]
	ldr	r0, .L58+48
	bl	puts
	sub	r3, fp, #136
	mov	r2, #0
	mov	r1, r3
	ldr	r0, [fp, #-144]
	bl	write
	str	r0, [fp, #-140]
	ldr	r3, [fp, #-140]
	cmp	r3, #0
	bne	.L48
	ldr	r0, .L58+52
	bl	puts
	b	.L49
.L48:
	ldr	r1, [fp, #-140]
	ldr	r0, .L58+56
	bl	printf
.L49:
	ldr	r0, .L58+60
	bl	puts
	mov	r2, #10
	ldr	r1, .L58+64
	ldr	r0, [fp, #-144]
	bl	write
	str	r0, [fp, #-140]
	ldr	r3, [fp, #-140]
	cmp	r3, #0
	bge	.L50
	ldr	r1, [fp, #-140]
	ldr	r0, .L58+32
	bl	printf
	b	.L51
.L50:
	ldr	r1, [fp, #-140]
	ldr	r0, .L58+56
	bl	printf
.L51:
	ldr	r0, .L58+68
	bl	puts
	mvn	r2, #0
	ldr	r1, [fp, #-152]
	ldr	r0, [fp, #-144]
	bl	write
	str	r0, [fp, #-140]
	ldr	r3, [fp, #-140]
	cmp	r3, #0
	bge	.L52
	ldr	r1, [fp, #-140]
	ldr	r0, .L58+32
	bl	printf
	b	.L53
.L52:
	ldr	r1, [fp, #-140]
	ldr	r0, .L58+56
	bl	printf
.L53:
	ldr	r0, .L58+72
	bl	puts
	ldr	r0, .L58+76
	bl	puts
	ldr	r0, .L58+80
	bl	puts
	ldr	r0, .L58+84
	bl	puts
	mov	r2, #81920
	mov	r1, #0
	ldr	r0, [fp, #-144]
	bl	write
	str	r0, [fp, #-140]
	ldr	r3, [fp, #-140]
	cmp	r3, #81920
	bne	.L54
	ldr	r1, [fp, #-140]
	ldr	r0, .L58+56
	bl	printf
	b	.L55
.L54:
	ldr	r1, [fp, #-140]
	ldr	r0, .L58+88
	bl	printf
.L55:
	mov	r3, #0
	ldr	r2, .L58
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L57
	bl	__stack_chk_fail
.L57:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L59:
	.align	2
.L58:
	.word	.LC31
	.word	.LC15
	.word	.LC16
	.word	.LC17
	.word	bigbuf1
	.word	bigbufnum
	.word	bigbuf2
	.word	.LC18
	.word	.LC19
	.word	.LC20
	.word	.LC21
	.word	.LC22
	.word	.LC23
	.word	.LC14
	.word	.LC5
	.word	.LC24
	.word	12247039
	.word	.LC25
	.word	.LC26
	.word	.LC27
	.word	.LC28
	.word	.LC29
	.word	.LC30
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
