	.file	"799454.c"
	.intel_syntax noprefix
	.text
	.globl	correct_sig
	.data
	.type	correct_sig, @object
	.size	correct_sig, 4
correct_sig:
	.string	""
	.ascii	"PBP"
	.globl	filename
	.section	.rodata
.LC0:
	.string	"PARAM.SFO"
.LC1:
	.string	"ICON0.PNG"
.LC2:
	.string	"ICON1.PMF"
.LC3:
	.string	"PIC0.PNG"
.LC4:
	.string	"PIC1.PNG"
.LC5:
	.string	"SND0.AT3"
.LC6:
	.string	"DATA.PSP"
.LC7:
	.string	"DATA.PSAR"
	.section	.data.rel.local,"aw"
	.align 32
	.type	filename, @object
	.size	filename, 64
filename:
	.quad	.LC0
	.quad	.LC1
	.quad	.LC2
	.quad	.LC3
	.quad	.LC4
	.quad	.LC5
	.quad	.LC6
	.quad	.LC7
	.globl	maxbuffer
	.data
	.align 4
	.type	maxbuffer, @object
	.size	maxbuffer, 4
maxbuffer:
	.long	16777216
	.section	.rodata
.LC8:
	.string	"USAGE: %s <filename>\n"
.LC9:
	.string	"rb"
	.align 8
.LC10:
	.string	"ERROR: Could not open the input file. (%s)\n"
	.align 8
.LC11:
	.string	"ERROR: Could not get the input file size."
	.align 8
.LC12:
	.string	"ERROR: Input file is not a PBP file."
.LC13:
	.string	"[%d] %10d bytes | %s\n"
	.align 8
.LC14:
	.string	"ERROR: Could not seek in the input file."
.LC15:
	.string	"wb"
	.align 8
.LC16:
	.string	"ERROR: Could not open the output file. (%s)\n"
	.align 8
.LC17:
	.string	"ERROR: Could not allocate the section data buffer. (%d)\n"
	.align 8
.LC18:
	.string	"ERROR: Could not close the output file."
	.align 8
.LC19:
	.string	"ERROR: Could not close the input file."
	.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, 112
	mov	DWORD PTR -100[rbp], edi
	mov	QWORD PTR -112[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	cmp	DWORD PTR -100[rbp], 2
	je	.L2
	mov	rax, QWORD PTR -112[rbp]
	mov	rax, QWORD PTR [rax]
	mov	rsi, rax
	lea	rdi, .LC8[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, -1
	jmp	.L21
.L2:
	mov	rax, QWORD PTR -112[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	lea	rsi, .LC9[rip]
	mov	rdi, rax
	call	fopen@PLT
	mov	QWORD PTR -72[rbp], rax
	cmp	QWORD PTR -72[rbp], 0
	jne	.L4
	mov	rax, QWORD PTR -112[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	mov	rsi, rax
	lea	rdi, .LC10[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, -1
	jmp	.L21
.L4:
	mov	rax, QWORD PTR -72[rbp]
	mov	edx, 2
	mov	esi, 0
	mov	rdi, rax
	call	fseek@PLT
	mov	rax, QWORD PTR -72[rbp]
	mov	rdi, rax
	call	ftell@PLT
	mov	DWORD PTR -76[rbp], eax
	mov	rax, QWORD PTR -72[rbp]
	mov	edx, 0
	mov	esi, 0
	mov	rdi, rax
	call	fseek@PLT
	cmp	DWORD PTR -76[rbp], 0
	jns	.L5
	lea	rdi, .LC11[rip]
	call	puts@PLT
	mov	eax, -1
	jmp	.L21
.L5:
	mov	rdx, QWORD PTR -72[rbp]
	lea	rax, -48[rbp]
	mov	rcx, rdx
	mov	edx, 1
	mov	esi, 40
	mov	rdi, rax
	call	fread@PLT
	mov	DWORD PTR -88[rbp], 0
	jmp	.L6
.L8:
	mov	eax, DWORD PTR -88[rbp]
	cdqe
	movzx	edx, BYTE PTR -48[rbp+rax]
	mov	eax, DWORD PTR -88[rbp]
	cdqe
	lea	rcx, correct_sig[rip]
	movzx	eax, BYTE PTR [rax+rcx]
	cmp	dl, al
	je	.L7
	lea	rdi, .LC12[rip]
	call	puts@PLT
	mov	eax, -1
	jmp	.L21
.L7:
	add	DWORD PTR -88[rbp], 1
.L6:
	mov	eax, DWORD PTR -88[rbp]
	cmp	eax, 3
	jbe	.L8
	mov	DWORD PTR -88[rbp], 0
	jmp	.L9
.L19:
	cmp	DWORD PTR -88[rbp], 7
	jne	.L10
	mov	eax, DWORD PTR -88[rbp]
	cdqe
	mov	edx, DWORD PTR -40[rbp+rax*4]
	mov	eax, DWORD PTR -76[rbp]
	sub	eax, edx
	mov	DWORD PTR -84[rbp], eax
	jmp	.L11
.L10:
	mov	eax, DWORD PTR -88[rbp]
	add	eax, 1
	cdqe
	mov	edx, DWORD PTR -40[rbp+rax*4]
	mov	eax, DWORD PTR -88[rbp]
	cdqe
	mov	ecx, DWORD PTR -40[rbp+rax*4]
	mov	eax, edx
	sub	eax, ecx
	mov	DWORD PTR -84[rbp], eax
.L11:
	mov	eax, DWORD PTR -88[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	lea	rax, filename[rip]
	mov	rcx, QWORD PTR [rdx+rax]
	mov	edx, DWORD PTR -84[rbp]
	mov	eax, DWORD PTR -88[rbp]
	mov	esi, eax
	lea	rdi, .LC13[rip]
	mov	eax, 0
	call	printf@PLT
	cmp	DWORD PTR -84[rbp], 0
	je	.L23
	mov	eax, DWORD PTR -88[rbp]
	cdqe
	mov	eax, DWORD PTR -40[rbp+rax*4]
	movsx	rcx, eax
	mov	rax, QWORD PTR -72[rbp]
	mov	edx, 0
	mov	rsi, rcx
	mov	rdi, rax
	call	fseek@PLT
	test	eax, eax
	je	.L14
	lea	rdi, .LC14[rip]
	call	puts@PLT
	mov	eax, -1
	jmp	.L21
.L14:
	mov	eax, DWORD PTR -88[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	lea	rax, filename[rip]
	mov	rax, QWORD PTR [rdx+rax]
	lea	rsi, .LC15[rip]
	mov	rdi, rax
	call	fopen@PLT
	mov	QWORD PTR -64[rbp], rax
	cmp	QWORD PTR -64[rbp], 0
	jne	.L15
	mov	eax, DWORD PTR -88[rbp]
	cdqe
	lea	rdx, 0[0+rax*8]
	lea	rax, filename[rip]
	mov	rax, QWORD PTR [rdx+rax]
	mov	rsi, rax
	lea	rdi, .LC16[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, -1
	jmp	.L21
.L15:
	mov	eax, DWORD PTR maxbuffer[rip]
	cmp	DWORD PTR -84[rbp], eax
	jle	.L16
	mov	eax, DWORD PTR maxbuffer[rip]
	mov	DWORD PTR -80[rbp], eax
	jmp	.L17
.L16:
	mov	eax, DWORD PTR -84[rbp]
	mov	DWORD PTR -80[rbp], eax
.L17:
	mov	eax, DWORD PTR -80[rbp]
	sub	DWORD PTR -84[rbp], eax
	mov	eax, DWORD PTR -80[rbp]
	cdqe
	mov	rdi, rax
	call	malloc@PLT
	mov	QWORD PTR -56[rbp], rax
	cmp	QWORD PTR -56[rbp], 0
	jne	.L18
	mov	eax, DWORD PTR -80[rbp]
	mov	esi, eax
	lea	rdi, .LC17[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, -1
	jmp	.L21
.L18:
	mov	eax, DWORD PTR -80[rbp]
	movsx	rsi, eax
	mov	rdx, QWORD PTR -72[rbp]
	mov	rax, QWORD PTR -56[rbp]
	mov	rcx, rdx
	mov	edx, 1
	mov	rdi, rax
	call	fread@PLT
	mov	eax, DWORD PTR -80[rbp]
	movsx	rsi, eax
	mov	rdx, QWORD PTR -64[rbp]
	mov	rax, QWORD PTR -56[rbp]
	mov	rcx, rdx
	mov	edx, 1
	mov	rdi, rax
	call	fwrite@PLT
	mov	rax, QWORD PTR -56[rbp]
	mov	rdi, rax
	call	free@PLT
	cmp	DWORD PTR -84[rbp], 0
	jne	.L15
	mov	rax, QWORD PTR -64[rbp]
	mov	rdi, rax
	call	fclose@PLT
	test	eax, eax
	jns	.L13
	lea	rdi, .LC18[rip]
	call	puts@PLT
	mov	eax, -1
	jmp	.L21
.L23:
	nop
.L13:
	add	DWORD PTR -88[rbp], 1
.L9:
	cmp	DWORD PTR -88[rbp], 7
	jle	.L19
	mov	rax, QWORD PTR -72[rbp]
	mov	rdi, rax
	call	fclose@PLT
	test	eax, eax
	jns	.L20
	lea	rdi, .LC19[rip]
	call	puts@PLT
	mov	eax, -1
	jmp	.L21
.L20:
	mov	eax, 0
.L21:
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	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	"799454.c"
	.text
	.global	correct_sig
	.data
	.align	2
	.type	correct_sig, %object
	.size	correct_sig, 4
correct_sig:
	.ascii	"\000PBP"
	.global	filename
	.section	.rodata
	.align	2
.LC0:
	.ascii	"PARAM.SFO\000"
	.align	2
.LC1:
	.ascii	"ICON0.PNG\000"
	.align	2
.LC2:
	.ascii	"ICON1.PMF\000"
	.align	2
.LC3:
	.ascii	"PIC0.PNG\000"
	.align	2
.LC4:
	.ascii	"PIC1.PNG\000"
	.align	2
.LC5:
	.ascii	"SND0.AT3\000"
	.align	2
.LC6:
	.ascii	"DATA.PSP\000"
	.align	2
.LC7:
	.ascii	"DATA.PSAR\000"
	.data
	.align	2
	.type	filename, %object
	.size	filename, 32
filename:
	.word	.LC0
	.word	.LC1
	.word	.LC2
	.word	.LC3
	.word	.LC4
	.word	.LC5
	.word	.LC6
	.word	.LC7
	.global	maxbuffer
	.align	2
	.type	maxbuffer, %object
	.size	maxbuffer, 4
maxbuffer:
	.word	16777216
	.section	.rodata
	.align	2
.LC8:
	.ascii	"USAGE: %s <filename>\012\000"
	.align	2
.LC9:
	.ascii	"rb\000"
	.align	2
.LC10:
	.ascii	"ERROR: Could not open the input file. (%s)\012\000"
	.align	2
.LC11:
	.ascii	"ERROR: Could not get the input file size.\000"
	.align	2
.LC12:
	.ascii	"ERROR: Input file is not a PBP file.\000"
	.align	2
.LC13:
	.ascii	"[%d] %10d bytes | %s\012\000"
	.align	2
.LC14:
	.ascii	"ERROR: Could not seek in the input file.\000"
	.align	2
.LC15:
	.ascii	"wb\000"
	.align	2
.LC16:
	.ascii	"ERROR: Could not open the output file. (%s)\012\000"
	.align	2
.LC17:
	.ascii	"ERROR: Could not allocate the section data buffer. "
	.ascii	"(%d)\012\000"
	.align	2
.LC18:
	.ascii	"ERROR: Could not close the output file.\000"
	.align	2
.LC19:
	.ascii	"ERROR: Could not close the input file.\000"
	.align	2
.LC20:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 80
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #80
	str	r0, [fp, #-80]
	str	r1, [fp, #-84]
	ldr	r3, .L24
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	ldr	r3, [fp, #-80]
	cmp	r3, #2
	beq	.L2
	ldr	r3, [fp, #-84]
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L24+4
	bl	printf
	mvn	r3, #0
	b	.L21
.L2:
	ldr	r3, [fp, #-84]
	add	r3, r3, #4
	ldr	r3, [r3]
	ldr	r1, .L24+8
	mov	r0, r3
	bl	fopen
	str	r0, [fp, #-64]
	ldr	r3, [fp, #-64]
	cmp	r3, #0
	bne	.L4
	ldr	r3, [fp, #-84]
	add	r3, r3, #4
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L24+12
	bl	printf
	mvn	r3, #0
	b	.L21
.L4:
	mov	r2, #2
	mov	r1, #0
	ldr	r0, [fp, #-64]
	bl	fseek
	ldr	r0, [fp, #-64]
	bl	ftell
	str	r0, [fp, #-60]
	mov	r2, #0
	mov	r1, #0
	ldr	r0, [fp, #-64]
	bl	fseek
	ldr	r3, [fp, #-60]
	cmp	r3, #0
	bge	.L5
	ldr	r0, .L24+16
	bl	puts
	mvn	r3, #0
	b	.L21
.L5:
	sub	r0, fp, #48
	ldr	r3, [fp, #-64]
	mov	r2, #1
	mov	r1, #40
	bl	fread
	mov	r3, #0
	str	r3, [fp, #-76]
	b	.L6
.L8:
	sub	r2, fp, #48
	ldr	r3, [fp, #-76]
	add	r3, r2, r3
	ldrb	r2, [r3]	@ zero_extendqisi2
	ldr	r1, .L24+20
	ldr	r3, [fp, #-76]
	add	r3, r1, r3
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r2, r3
	beq	.L7
	ldr	r0, .L24+24
	bl	puts
	mvn	r3, #0
	b	.L21
.L7:
	ldr	r3, [fp, #-76]
	add	r3, r3, #1
	str	r3, [fp, #-76]
.L6:
	ldr	r3, [fp, #-76]
	cmp	r3, #3
	bls	.L8
	mov	r3, #0
	str	r3, [fp, #-76]
	b	.L9
.L19:
	ldr	r3, [fp, #-76]
	cmp	r3, #7
	bne	.L10
	ldr	r3, [fp, #-76]
	add	r3, r3, #2
	lsl	r3, r3, #2
	sub	r2, fp, #4
	add	r3, r2, r3
	ldr	r3, [r3, #-44]
	ldr	r2, [fp, #-60]
	sub	r3, r2, r3
	str	r3, [fp, #-72]
	b	.L11
.L10:
	ldr	r3, [fp, #-76]
	add	r3, r3, #1
	add	r3, r3, #2
	lsl	r3, r3, #2
	sub	r2, fp, #4
	add	r3, r2, r3
	ldr	r2, [r3, #-44]
	ldr	r3, [fp, #-76]
	add	r3, r3, #2
	lsl	r3, r3, #2
	sub	r1, fp, #4
	add	r3, r1, r3
	ldr	r3, [r3, #-44]
	sub	r3, r2, r3
	str	r3, [fp, #-72]
.L11:
	ldr	r2, .L24+28
	ldr	r3, [fp, #-76]
	ldr	r3, [r2, r3, lsl #2]
	ldr	r2, [fp, #-72]
	ldr	r1, [fp, #-76]
	ldr	r0, .L24+32
	bl	printf
	ldr	r3, [fp, #-72]
	cmp	r3, #0
	beq	.L23
	ldr	r3, [fp, #-76]
	add	r3, r3, #2
	lsl	r3, r3, #2
	sub	r2, fp, #4
	add	r3, r2, r3
	ldr	r3, [r3, #-44]
	mov	r2, #0
	mov	r1, r3
	ldr	r0, [fp, #-64]
	bl	fseek
	mov	r3, r0
	cmp	r3, #0
	beq	.L14
	ldr	r0, .L24+36
	bl	puts
	mvn	r3, #0
	b	.L21
.L14:
	ldr	r2, .L24+28
	ldr	r3, [fp, #-76]
	ldr	r3, [r2, r3, lsl #2]
	ldr	r1, .L24+40
	mov	r0, r3
	bl	fopen
	str	r0, [fp, #-56]
	ldr	r3, [fp, #-56]
	cmp	r3, #0
	bne	.L15
	ldr	r2, .L24+28
	ldr	r3, [fp, #-76]
	ldr	r3, [r2, r3, lsl #2]
	mov	r1, r3
	ldr	r0, .L24+44
	bl	printf
	mvn	r3, #0
	b	.L21
.L15:
	ldr	r3, .L24+48
	ldr	r3, [r3]
	ldr	r2, [fp, #-72]
	cmp	r2, r3
	ble	.L16
	ldr	r3, .L24+48
	ldr	r3, [r3]
	str	r3, [fp, #-68]
	b	.L17
.L16:
	ldr	r3, [fp, #-72]
	str	r3, [fp, #-68]
.L17:
	ldr	r2, [fp, #-72]
	ldr	r3, [fp, #-68]
	sub	r3, r2, r3
	str	r3, [fp, #-72]
	ldr	r3, [fp, #-68]
	mov	r0, r3
	bl	malloc
	mov	r3, r0
	str	r3, [fp, #-52]
	ldr	r3, [fp, #-52]
	cmp	r3, #0
	bne	.L18
	ldr	r1, [fp, #-68]
	ldr	r0, .L24+52
	bl	printf
	mvn	r3, #0
	b	.L21
.L18:
	ldr	r1, [fp, #-68]
	ldr	r3, [fp, #-64]
	mov	r2, #1
	ldr	r0, [fp, #-52]
	bl	fread
	ldr	r1, [fp, #-68]
	ldr	r3, [fp, #-56]
	mov	r2, #1
	ldr	r0, [fp, #-52]
	bl	fwrite
	ldr	r0, [fp, #-52]
	bl	free
	ldr	r3, [fp, #-72]
	cmp	r3, #0
	bne	.L15
	ldr	r0, [fp, #-56]
	bl	fclose
	mov	r3, r0
	cmp	r3, #0
	bge	.L13
	ldr	r0, .L24+56
	bl	puts
	mvn	r3, #0
	b	.L21
.L23:
	nop
.L13:
	ldr	r3, [fp, #-76]
	add	r3, r3, #1
	str	r3, [fp, #-76]
.L9:
	ldr	r3, [fp, #-76]
	cmp	r3, #7
	ble	.L19
	ldr	r0, [fp, #-64]
	bl	fclose
	mov	r3, r0
	cmp	r3, #0
	bge	.L20
	ldr	r0, .L24+60
	bl	puts
	mvn	r3, #0
	b	.L21
.L20:
	mov	r3, #0
.L21:
	ldr	r2, .L24
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L22
	bl	__stack_chk_fail
.L22:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L25:
	.align	2
.L24:
	.word	.LC20
	.word	.LC8
	.word	.LC9
	.word	.LC10
	.word	.LC11
	.word	correct_sig
	.word	.LC12
	.word	filename
	.word	.LC13
	.word	.LC14
	.word	.LC15
	.word	.LC16
	.word	maxbuffer
	.word	.LC17
	.word	.LC18
	.word	.LC19
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
