	.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	$3, %edi
	jne	LBB0_1
## %bb.3:
	movq	%rsi, %r15
	movq	8(%rsi), %rdi
	leaq	L_.str.1(%rip), %rsi
	callq	_fopen
	testq	%rax, %rax
	je	LBB0_4
## %bb.5:
	movq	%rax, %rbx
	movq	%rax, %rdi
	callq	_gdImageCreateFromGd2
	movl	%eax, %r14d
	movq	%rbx, %rdi
	callq	_fclose
	testl	%r14d, %r14d
	je	LBB0_6
## %bb.7:
	movq	16(%r15), %rdi
	leaq	L_.str.1(%rip), %rsi
	callq	_fopen
	testq	%rax, %rax
	je	LBB0_8
## %bb.9:
	movq	%rax, %rbx
	movq	%rax, %rdi
	callq	_gdImageCreateFromGd2
	movl	%eax, %r12d
	movq	%rbx, %rdi
	callq	_fclose
	testl	%r12d, %r12d
	je	LBB0_10
## %bb.11:
	movl	%r12d, %edi
	movl	%r14d, %esi
	callq	_gdImagePaletteCopy
	movq	16(%r15), %rdi
	leaq	L_.str.6(%rip), %rsi
	callq	_fopen
	testq	%rax, %rax
	je	LBB0_13
## %bb.12:
	movq	%rax, %rbx
	movl	%r12d, %edi
	movq	%rax, %rsi
	movl	$128, %edx
	movl	$2, %ecx
	callq	_gdImageGd2
	movq	%rbx, %rdi
	callq	_fclose
	movl	%r14d, %edi
	callq	_gdImageDestroy
	movl	%r12d, %edi
	callq	_gdImageDestroy
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_1:
	movq	_stderr@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	jmp	LBB0_2
LBB0_4:
	movq	_stderr@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.2(%rip), %rsi
	jmp	LBB0_2
LBB0_6:
	movq	_stderr@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.3(%rip), %rsi
	jmp	LBB0_2
LBB0_8:
	movq	_stderr@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.4(%rip), %rsi
	jmp	LBB0_2
LBB0_10:
	movq	_stderr@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.5(%rip), %rsi
LBB0_2:
	callq	_fprintf
	movl	$1, %edi
	callq	_exit
LBB0_13:
	movq	_stderr@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.7(%rip), %rsi
	callq	_fprintf
	movl	%r12d, %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: gd2copypal palettefile.gd2 filename.gd2\n"

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

L_.str.2:                               ## @.str.2
	.asciz	"Palette file does not exist!\n"

L_.str.3:                               ## @.str.3
	.asciz	"Palette is not in GD2 format!\n"

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

L_.str.5:                               ## @.str.5
	.asciz	"Input is not in GD2 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, #3
	b.ne	LBB0_7
; %bb.1:
	mov	x20, x1
	ldr	x0, [x1, #8]
Lloh0:
	adrp	x1, l_.str.1@PAGE
Lloh1:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_fopen
	cbz	x0, LBB0_8
; %bb.2:
	mov	x21, x0
	bl	_gdImageCreateFromGd2
	mov	x19, x0
	mov	x0, x21
	bl	_fclose
	cbz	w19, LBB0_9
; %bb.3:
	ldr	x0, [x20, #16]
Lloh2:
	adrp	x1, l_.str.1@PAGE
Lloh3:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_fopen
	cbz	x0, LBB0_10
; %bb.4:
	mov	x22, x0
	bl	_gdImageCreateFromGd2
	mov	x21, x0
	mov	x0, x22
	bl	_fclose
	cbz	w21, LBB0_11
; %bb.5:
	mov	x0, x21
	mov	x1, x19
	bl	_gdImagePaletteCopy
	ldr	x0, [x20, #16]
Lloh4:
	adrp	x1, l_.str.6@PAGE
Lloh5:
	add	x1, x1, l_.str.6@PAGEOFF
	bl	_fopen
	cbz	x0, LBB0_13
; %bb.6:
	mov	x20, x0
	mov	x0, x21
	mov	x1, x20
	mov	w2, #128
	mov	w3, #2
	bl	_gdImageGd2
	mov	x0, x20
	bl	_fclose
	mov	x0, x19
	bl	_gdImageDestroy
	mov	x0, x21
	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_7:
Lloh6:
	adrp	x8, _stderr@GOTPAGE
Lloh7:
	ldr	x8, [x8, _stderr@GOTPAGEOFF]
Lloh8:
	ldr	w0, [x8]
Lloh9:
	adrp	x1, l_.str@PAGE
Lloh10:
	add	x1, x1, l_.str@PAGEOFF
	b	LBB0_12
LBB0_8:
Lloh11:
	adrp	x8, _stderr@GOTPAGE
Lloh12:
	ldr	x8, [x8, _stderr@GOTPAGEOFF]
Lloh13:
	ldr	w0, [x8]
Lloh14:
	adrp	x1, l_.str.2@PAGE
Lloh15:
	add	x1, x1, l_.str.2@PAGEOFF
	b	LBB0_12
LBB0_9:
Lloh16:
	adrp	x8, _stderr@GOTPAGE
Lloh17:
	ldr	x8, [x8, _stderr@GOTPAGEOFF]
Lloh18:
	ldr	w0, [x8]
Lloh19:
	adrp	x1, l_.str.3@PAGE
Lloh20:
	add	x1, x1, l_.str.3@PAGEOFF
	b	LBB0_12
LBB0_10:
Lloh21:
	adrp	x8, _stderr@GOTPAGE
Lloh22:
	ldr	x8, [x8, _stderr@GOTPAGEOFF]
Lloh23:
	ldr	w0, [x8]
Lloh24:
	adrp	x1, l_.str.4@PAGE
Lloh25:
	add	x1, x1, l_.str.4@PAGEOFF
	b	LBB0_12
LBB0_11:
Lloh26:
	adrp	x8, _stderr@GOTPAGE
Lloh27:
	ldr	x8, [x8, _stderr@GOTPAGEOFF]
Lloh28:
	ldr	w0, [x8]
Lloh29:
	adrp	x1, l_.str.5@PAGE
Lloh30:
	add	x1, x1, l_.str.5@PAGEOFF
LBB0_12:
	bl	_fprintf
	mov	w0, #1
	bl	_exit
LBB0_13:
Lloh31:
	adrp	x8, _stderr@GOTPAGE
Lloh32:
	ldr	x8, [x8, _stderr@GOTPAGEOFF]
Lloh33:
	ldr	w0, [x8]
Lloh34:
	adrp	x1, l_.str.7@PAGE
Lloh35:
	add	x1, x1, l_.str.7@PAGEOFF
	bl	_fprintf
	mov	x0, x21
	bl	_gdImageDestroy
	mov	w0, #1
	bl	_exit
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpAdd	Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpAdd	Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.cfi_endproc
                                        ; -- End function
	.comm	_stderr,4,2                     ; @stderr
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Usage: gd2copypal palettefile.gd2 filename.gd2\n"

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

l_.str.2:                               ; @.str.2
	.asciz	"Palette file does not exist!\n"

l_.str.3:                               ; @.str.3
	.asciz	"Palette is not in GD2 format!\n"

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

l_.str.5:                               ; @.str.5
	.asciz	"Input is not in GD2 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
