	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_main                           ## -- Begin function main
	.p2align	4, 0x90
_main:                                  ## @main
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	cmpl	$5, %edi
	jne	LBB0_1
## %bb.2:
	movq	%rsi, %r15
	movq	8(%rsi), %rdi
	leaq	L_.str.3(%rip), %rsi
	callq	_fopen
	testq	%rax, %rax
	je	LBB0_3
## %bb.5:
	movq	%rax, %rbx
	movq	%rax, %rdi
	callq	_gdImageCreateFromPng
	movl	%eax, %r14d
	movq	%rbx, %rdi
	callq	_fclose
	testl	%r14d, %r14d
	je	LBB0_6
## %bb.7:
	movq	16(%r15), %rdi
	leaq	L_.str.6(%rip), %rsi
	callq	_fopen
	testq	%rax, %rax
	je	LBB0_9
## %bb.8:
	movq	%rax, %rbx
	movq	24(%r15), %rdi
	callq	_atoi
	movl	%eax, %r12d
	movq	32(%r15), %rdi
	callq	_atoi
	movl	%r14d, %edi
	movq	%rbx, %rsi
	movl	%r12d, %edx
	movl	%eax, %ecx
	callq	_gdImageGd2
	movq	%rbx, %rdi
	callq	_fclose
	movl	%r14d, %edi
	callq	_gdImageDestroy
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_1:
	movq	_stderr@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edi
	leaq	L_.str(%rip), %rsi
	callq	_fprintf
	movl	(%rbx), %edi
	leaq	L_.str.1(%rip), %rsi
	callq	_fprintf
	movl	(%rbx), %edi
	leaq	L_.str.2(%rip), %rsi
	jmp	LBB0_4
LBB0_3:
	movq	_stderr@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.4(%rip), %rsi
	jmp	LBB0_4
LBB0_6:
	movq	_stderr@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.5(%rip), %rsi
LBB0_4:
	callq	_fprintf
	movl	$1, %edi
	callq	_exit
LBB0_9:
	movq	_stderr@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.7(%rip), %rsi
	callq	_fprintf
	movl	%r14d, %edi
	callq	_gdImageDestroy
	movl	$1, %edi
	callq	_exit
	.cfi_endproc
                                        ## -- End function
	.comm	_stderr,4,2                     ## @stderr
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Usage: pngtogd2 filename.png filename.gd2 cs fmt\n"

L_.str.1:                               ## @.str.1
	.asciz	"    where cs is the chunk size\n"

L_.str.2:                               ## @.str.2
	.asciz	"          fmt is 1 for raw, 2 for compressed\n"

L_.str.3:                               ## @.str.3
	.asciz	"rb"

L_.str.4:                               ## @.str.4
	.asciz	"Input file does not exist!\n"

L_.str.5:                               ## @.str.5
	.asciz	"Input is not in PNG format!\n"

L_.str.6:                               ## @.str.6
	.asciz	"wb"

L_.str.7:                               ## @.str.7
	.asciz	"Output file cannot be written to!\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_main                           ; -- Begin function main
	.p2align	2
_main:                                  ; @main
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	cmp	w0, #5
	b.ne	LBB0_5
; %bb.1:
	mov	x20, x1
	ldr	x0, [x1, #8]
Lloh0:
	adrp	x1, l_.str.3@PAGE
Lloh1:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_fopen
	cbz	x0, LBB0_6
; %bb.2:
	mov	x21, x0
	bl	_gdImageCreateFromPng
	mov	x19, x0
	mov	x0, x21
	bl	_fclose
	cbz	w19, LBB0_7
; %bb.3:
	ldr	x0, [x20, #16]
Lloh2:
	adrp	x1, l_.str.6@PAGE
Lloh3:
	add	x1, x1, l_.str.6@PAGEOFF
	bl	_fopen
	cbz	x0, LBB0_9
; %bb.4:
	mov	x21, x0
	ldr	x0, [x20, #24]
	bl	_atoi
	mov	x22, x0
	ldr	x0, [x20, #32]
	bl	_atoi
	mov	x3, x0
	mov	x0, x19
	mov	x1, x21
	mov	x2, x22
	bl	_gdImageGd2
	mov	x0, x21
	bl	_fclose
	mov	x0, x19
	bl	_gdImageDestroy
	mov	w0, #0
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
LBB0_5:
Lloh4:
	adrp	x19, _stderr@GOTPAGE
Lloh5:
	ldr	x19, [x19, _stderr@GOTPAGEOFF]
	ldr	w0, [x19]
Lloh6:
	adrp	x1, l_.str@PAGE
Lloh7:
	add	x1, x1, l_.str@PAGEOFF
	bl	_fprintf
	ldr	w0, [x19]
Lloh8:
	adrp	x1, l_.str.1@PAGE
Lloh9:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_fprintf
	ldr	w0, [x19]
Lloh10:
	adrp	x1, l_.str.2@PAGE
Lloh11:
	add	x1, x1, l_.str.2@PAGEOFF
	b	LBB0_8
LBB0_6:
Lloh12:
	adrp	x8, _stderr@GOTPAGE
Lloh13:
	ldr	x8, [x8, _stderr@GOTPAGEOFF]
Lloh14:
	ldr	w0, [x8]
Lloh15:
	adrp	x1, l_.str.4@PAGE
Lloh16:
	add	x1, x1, l_.str.4@PAGEOFF
	b	LBB0_8
LBB0_7:
Lloh17:
	adrp	x8, _stderr@GOTPAGE
Lloh18:
	ldr	x8, [x8, _stderr@GOTPAGEOFF]
Lloh19:
	ldr	w0, [x8]
Lloh20:
	adrp	x1, l_.str.5@PAGE
Lloh21:
	add	x1, x1, l_.str.5@PAGEOFF
LBB0_8:
	bl	_fprintf
	mov	w0, #1
	bl	_exit
LBB0_9:
Lloh22:
	adrp	x8, _stderr@GOTPAGE
Lloh23:
	ldr	x8, [x8, _stderr@GOTPAGEOFF]
Lloh24:
	ldr	w0, [x8]
Lloh25:
	adrp	x1, l_.str.7@PAGE
Lloh26:
	add	x1, x1, l_.str.7@PAGEOFF
	bl	_fprintf
	mov	x0, x19
	bl	_gdImageDestroy
	mov	w0, #1
	bl	_exit
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.comm	_stderr,4,2                     ; @stderr
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Usage: pngtogd2 filename.png filename.gd2 cs fmt\n"

l_.str.1:                               ; @.str.1
	.asciz	"    where cs is the chunk size\n"

l_.str.2:                               ; @.str.2
	.asciz	"          fmt is 1 for raw, 2 for compressed\n"

l_.str.3:                               ; @.str.3
	.asciz	"rb"

l_.str.4:                               ; @.str.4
	.asciz	"Input file does not exist!\n"

l_.str.5:                               ; @.str.5
	.asciz	"Input is not in PNG format!\n"

l_.str.6:                               ; @.str.6
	.asciz	"wb"

l_.str.7:                               ; @.str.7
	.asciz	"Output file cannot be written to!\n"

.subsections_via_symbols
