	.file	"509669.c"
	.intel_syntax noprefix
	.text
	.globl	buffer
	.bss
	.align 32
	.type	buffer, @object
	.size	buffer, 32768
buffer:
	.zero	32768
	.section	.rodata
	.align 8
.LC0:
	.string	"Usage: %s <basic_programs.rom>\n"
	.align 8
.LC1:
	.string	"       Splits BASIC individual programs from ROM binary\n"
	.align 8
.LC2:
	.string	"Splitting BASIC programs out of \"%s\"...\n"
.LC3:
	.string	"r"
.LC4:
	.string	"program_%02d.bas"
	.align 8
.LC5:
	.string	"Saving slot %02d as \"%s\" size %d (0x%04x)\n"
.LC6:
	.string	"w"
.LC7:
	.string	"Error creating"
.LC8:
	.string	"Error writing"
.LC9:
	.string	"Done"
	.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, 96
	mov	DWORD PTR -84[rbp], edi
	mov	QWORD PTR -96[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	QWORD PTR -72[rbp], 0
	mov	QWORD PTR -64[rbp], 0
	mov	DWORD PTR -80[rbp], 0
	cmp	DWORD PTR -84[rbp], 2
	je	.L2
	mov	rax, QWORD PTR -96[rbp]
	mov	rax, QWORD PTR [rax]
	mov	rsi, rax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, .LC1[rip]
	call	puts@PLT
	mov	eax, 1
	jmp	.L3
.L2:
	mov	rax, QWORD PTR -96[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	mov	rsi, rax
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR -96[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	lea	rsi, .LC3[rip]
	mov	rdi, rax
	call	fopen@PLT
	mov	QWORD PTR -72[rbp], rax
	jmp	.L4
.L11:
	mov	edx, 32768
	mov	esi, 255
	lea	rdi, buffer[rip]
	call	memset@PLT
	mov	rax, QWORD PTR -72[rbp]
	mov	rcx, rax
	mov	edx, 32768
	mov	esi, 1
	lea	rdi, buffer[rip]
	call	fread@PLT
	mov	QWORD PTR -64[rbp], rax
	cmp	QWORD PTR -64[rbp], 0
	je	.L4
	movzx	eax, BYTE PTR buffer[rip]
	cmp	al, -1
	je	.L4
	mov	QWORD PTR -56[rbp], 0
	mov	QWORD PTR -48[rbp], 0
	mov	QWORD PTR -40[rbp], 0
	mov	QWORD PTR -32[rbp], 0
	mov	QWORD PTR -24[rbp], 0
	mov	DWORD PTR -76[rbp], 0
	jmp	.L5
.L8:
	mov	eax, DWORD PTR -76[rbp]
	cdqe
	lea	rdx, buffer[rip]
	movzx	eax, BYTE PTR [rax+rdx]
	cmp	al, -1
	je	.L13
	add	DWORD PTR -76[rbp], 1
.L5:
	mov	eax, DWORD PTR -76[rbp]
	cmp	eax, 32767
	jbe	.L8
	jmp	.L7
.L13:
	nop
.L7:
	mov	edx, DWORD PTR -80[rbp]
	lea	rax, -48[rbp]
	lea	rsi, .LC4[rip]
	mov	rdi, rax
	mov	eax, 0
	call	sprintf@PLT
	mov	esi, DWORD PTR -76[rbp]
	mov	ecx, DWORD PTR -76[rbp]
	lea	rdx, -48[rbp]
	mov	eax, DWORD PTR -80[rbp]
	mov	r8d, esi
	mov	esi, eax
	lea	rdi, .LC5[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rax, -48[rbp]
	lea	rsi, .LC6[rip]
	mov	rdi, rax
	call	fopen@PLT
	mov	QWORD PTR -56[rbp], rax
	cmp	QWORD PTR -56[rbp], 0
	jne	.L9
	lea	rdi, .LC7[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L9:
	mov	eax, DWORD PTR -76[rbp]
	cdqe
	mov	rdx, QWORD PTR -56[rbp]
	mov	rcx, rdx
	mov	edx, 1
	mov	rsi, rax
	lea	rdi, buffer[rip]
	call	fwrite@PLT
	cmp	rax, 1
	je	.L10
	lea	rdi, .LC8[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L10:
	mov	rax, QWORD PTR -56[rbp]
	mov	rdi, rax
	call	fclose@PLT
	add	DWORD PTR -80[rbp], 1
.L4:
	mov	rax, QWORD PTR -72[rbp]
	mov	rdi, rax
	call	feof@PLT
	test	eax, eax
	je	.L11
	mov	rax, QWORD PTR -72[rbp]
	mov	rdi, rax
	call	fclose@PLT
	lea	rdi, .LC9[rip]
	call	puts@PLT
	mov	eax, 0
.L3:
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L12
	call	__stack_chk_fail@PLT
.L12:
	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	"509669.c"
	.text
	.comm	buffer,32768,4
	.section	.rodata
	.align	2
.LC0:
	.ascii	"Usage: %s <basic_programs.rom>\012\000"
	.align	2
.LC1:
	.ascii	"       Splits BASIC individual programs from ROM bi"
	.ascii	"nary\012\000"
	.align	2
.LC2:
	.ascii	"Splitting BASIC programs out of \"%s\"...\012\000"
	.align	2
.LC3:
	.ascii	"r\000"
	.align	2
.LC4:
	.ascii	"program_%02d.bas\000"
	.align	2
.LC5:
	.ascii	"Saving slot %02d as \"%s\" size %d (0x%04x)\012\000"
	.align	2
.LC6:
	.ascii	"w\000"
	.align	2
.LC7:
	.ascii	"Error creating\000"
	.align	2
.LC8:
	.ascii	"Error writing\000"
	.align	2
.LC9:
	.ascii	"Done\000"
	.align	2
.LC10:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 64
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #72
	str	r0, [fp, #-64]
	str	r1, [fp, #-68]
	ldr	r3, .L14
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	mov	r3, #0
	str	r3, [fp, #-52]
	mov	r3, #0
	str	r3, [fp, #-48]
	mov	r3, #0
	str	r3, [fp, #-60]
	ldr	r3, [fp, #-64]
	cmp	r3, #2
	beq	.L2
	ldr	r3, [fp, #-68]
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L14+4
	bl	printf
	ldr	r0, .L14+8
	bl	puts
	mov	r3, #1
	b	.L3
.L2:
	ldr	r3, [fp, #-68]
	add	r3, r3, #4
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L14+12
	bl	printf
	ldr	r3, [fp, #-68]
	add	r3, r3, #4
	ldr	r3, [r3]
	ldr	r1, .L14+16
	mov	r0, r3
	bl	fopen
	str	r0, [fp, #-52]
	b	.L4
.L11:
	mov	r2, #32768
	mov	r1, #255
	ldr	r0, .L14+20
	bl	memset
	ldr	r3, [fp, #-52]
	mov	r2, #32768
	mov	r1, #1
	ldr	r0, .L14+20
	bl	fread
	str	r0, [fp, #-48]
	ldr	r3, [fp, #-48]
	cmp	r3, #0
	beq	.L4
	ldr	r3, .L14+20
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r3, #255
	beq	.L4
	mov	r3, #0
	str	r3, [fp, #-44]
	mov	r3, #0
	str	r3, [fp, #-40]
	sub	r3, fp, #36
	mov	r2, #0
	str	r2, [r3]
	str	r2, [r3, #4]
	str	r2, [r3, #8]
	str	r2, [r3, #12]
	str	r2, [r3, #16]
	str	r2, [r3, #20]
	str	r2, [r3, #24]
	mov	r3, #0
	str	r3, [fp, #-56]
	b	.L5
.L8:
	ldr	r2, .L14+20
	ldr	r3, [fp, #-56]
	add	r3, r2, r3
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r3, #255
	beq	.L13
	ldr	r3, [fp, #-56]
	add	r3, r3, #1
	str	r3, [fp, #-56]
.L5:
	ldr	r3, [fp, #-56]
	cmp	r3, #32768
	bcc	.L8
	b	.L7
.L13:
	nop
.L7:
	sub	r3, fp, #40
	ldr	r2, [fp, #-60]
	ldr	r1, .L14+24
	mov	r0, r3
	bl	sprintf
	sub	r2, fp, #40
	ldr	r3, [fp, #-56]
	str	r3, [sp]
	ldr	r3, [fp, #-56]
	ldr	r1, [fp, #-60]
	ldr	r0, .L14+28
	bl	printf
	sub	r3, fp, #40
	ldr	r1, .L14+32
	mov	r0, r3
	bl	fopen
	str	r0, [fp, #-44]
	ldr	r3, [fp, #-44]
	cmp	r3, #0
	bne	.L9
	ldr	r0, .L14+36
	bl	perror
	mov	r0, #1
	bl	exit
.L9:
	ldr	r1, [fp, #-56]
	ldr	r3, [fp, #-44]
	mov	r2, #1
	ldr	r0, .L14+20
	bl	fwrite
	mov	r3, r0
	cmp	r3, #1
	beq	.L10
	ldr	r0, .L14+40
	bl	perror
	mov	r0, #1
	bl	exit
.L10:
	ldr	r0, [fp, #-44]
	bl	fclose
	ldr	r3, [fp, #-60]
	add	r3, r3, #1
	str	r3, [fp, #-60]
.L4:
	ldr	r0, [fp, #-52]
	bl	feof
	mov	r3, r0
	cmp	r3, #0
	beq	.L11
	ldr	r0, [fp, #-52]
	bl	fclose
	ldr	r0, .L14+44
	bl	puts
	mov	r3, #0
.L3:
	ldr	r2, .L14
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L12
	bl	__stack_chk_fail
.L12:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L15:
	.align	2
.L14:
	.word	.LC10
	.word	.LC0
	.word	.LC1
	.word	.LC2
	.word	.LC3
	.word	buffer
	.word	.LC4
	.word	.LC5
	.word	.LC6
	.word	.LC7
	.word	.LC8
	.word	.LC9
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
