	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	__gdGetColors                   ## -- Begin function _gdGetColors
	.p2align	4, 0x90
__gdGetColors:                          ## @_gdGetColors
	.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	%r13
	pushq	%r12
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r14d
	movq	%rsi, %rbx
	movq	%rdi, %r15
	testl	%edx, %edx
	je	LBB0_8
## %bb.1:
	leaq	-48(%rbp), %rdi
	movq	%r15, %rsi
	callq	_gdGetByte
	testl	%eax, %eax
	je	LBB0_23
## %bb.2:
	movl	-48(%rbp), %eax
	cmpl	(%rbx), %eax
	jne	LBB0_23
## %bb.3:
	testl	%eax, %eax
	je	LBB0_4
LBB0_6:
	leaq	8(%rbx), %r12
	movq	%r12, %rdi
	movq	%r15, %rsi
	callq	_gdGetInt
	testl	%eax, %eax
	je	LBB0_23
## %bb.7:
	movl	(%r12), %edx
	jmp	LBB0_12
LBB0_8:
	leaq	4(%rbx), %rdi
	movq	%r15, %rsi
	callq	_gdGetByte
	movq	_FALSE@GOTPCREL(%rip), %r13
	testl	%eax, %eax
	je	LBB0_24
## %bb.9:
	leaq	8(%rbx), %r12
	movq	%r12, %rdi
	movq	%r15, %rsi
	callq	_gdGetWord
	testl	%eax, %eax
	je	LBB0_24
## %bb.10:
	movl	(%r12), %edx
	cmpl	$257, %edx                      ## imm = 0x101
	jne	LBB0_12
## %bb.11:
	movl	$-1, (%r12)
	movl	$-1, %edx
LBB0_12:
	movl	4(%rbx), %esi
	leaq	L_.str(%rip), %rdi
	callq	_printf
	movl	%eax, %edi
	callq	_GD2_DBG
	movq	_TRUE@GOTPCREL(%rip), %r13
	cmpl	$0, (%rbx)
	jne	LBB0_24
## %bb.13:
	movl	%r14d, -44(%rbp)                ## 4-byte Spill
	movq	_gdMaxColors@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	jle	LBB0_20
## %bb.14:
	xorl	%r12d, %r12d
	xorl	%r14d, %r14d
	jmp	LBB0_15
	.p2align	4, 0x90
LBB0_19:                                ##   in Loop: Header=BB0_15 Depth=1
	incq	%r14
	movq	_gdMaxColors@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	addq	$4, %r12
	cmpq	%rax, %r14
	jge	LBB0_20
LBB0_15:                                ## =>This Inner Loop Header: Depth=1
	movq	16(%rbx), %rdi
	addq	%r12, %rdi
	movq	%r15, %rsi
	callq	_gdGetByte
	testl	%eax, %eax
	je	LBB0_23
## %bb.16:                              ##   in Loop: Header=BB0_15 Depth=1
	movq	24(%rbx), %rdi
	addq	%r12, %rdi
	movq	%r15, %rsi
	callq	_gdGetByte
	testl	%eax, %eax
	je	LBB0_23
## %bb.17:                              ##   in Loop: Header=BB0_15 Depth=1
	movq	32(%rbx), %rdi
	addq	%r12, %rdi
	movq	%r15, %rsi
	callq	_gdGetByte
	testl	%eax, %eax
	je	LBB0_23
## %bb.18:                              ##   in Loop: Header=BB0_15 Depth=1
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_19
## %bb.22:                              ##   in Loop: Header=BB0_15 Depth=1
	movq	40(%rbx), %rdi
	addq	%r12, %rdi
	movq	%r15, %rsi
	callq	_gdGetByte
	testl	%eax, %eax
	jne	LBB0_19
	jmp	LBB0_23
LBB0_4:
	leaq	4(%rbx), %r12
	movq	%r12, %rdi
	movq	%r15, %rsi
	callq	_gdGetWord
	testl	%eax, %eax
	je	LBB0_23
## %bb.5:
	movl	(%r12), %eax
	movq	_gdMaxColors@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jle	LBB0_6
LBB0_23:
	movq	_FALSE@GOTPCREL(%rip), %r13
LBB0_24:
	movl	(%r13), %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_20:
	movl	4(%rbx), %esi
	testl	%esi, %esi
	jle	LBB0_24
## %bb.21:
	movq	48(%rbx), %rdi
	shlq	$3, %rsi
	callq	___bzero
	jmp	LBB0_24
	.cfi_endproc
                                        ## -- End function
	.comm	_gdMaxColors,4,2                ## @gdMaxColors
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Pallette had %d colours (T=%d)\n"

	.comm	_TRUE,4,2                       ## @TRUE
	.comm	_FALSE,4,2                      ## @FALSE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	__gdGetColors                   ; -- Begin function _gdGetColors
	.p2align	2
__gdGetColors:                          ; @_gdGetColors
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x20, x2
	mov	x19, x1
	mov	x21, x0
	cbz	w2, LBB0_6
; %bb.1:
	add	x0, sp, #12
	mov	x1, x21
	bl	_gdGetByte
	cbz	w0, LBB0_22
; %bb.2:
	ldr	w8, [sp, #12]
	ldr	w9, [x19]
	cmp	w8, w9
	b.ne	LBB0_22
; %bb.3:
	cbz	w8, LBB0_20
LBB0_4:
	add	x22, x19, #8
	mov	x0, x22
	mov	x1, x21
	bl	_gdGetInt
	cbz	w0, LBB0_22
; %bb.5:
	ldr	w2, [x22]
	b	LBB0_10
LBB0_6:
	add	x0, x19, #4
	mov	x1, x21
	bl	_gdGetByte
	cbz	w0, LBB0_22
; %bb.7:
	add	x22, x19, #8
	mov	x0, x22
	mov	x1, x21
	bl	_gdGetWord
	cbz	w0, LBB0_22
; %bb.8:
	ldr	w2, [x22]
	cmp	w2, #257
	b.ne	LBB0_10
; %bb.9:
	mov	w2, #-1
	str	w2, [x22]
LBB0_10:
	ldr	w1, [x19, #4]
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_printf
	bl	_GD2_DBG
	ldr	w8, [x19]
	cbz	w8, LBB0_12
LBB0_11:
Lloh2:
	adrp	x22, _TRUE@GOTPAGE
Lloh3:
	ldr	x22, [x22, _TRUE@GOTPAGEOFF]
	b	LBB0_23
LBB0_12:
Lloh4:
	adrp	x23, _gdMaxColors@GOTPAGE
Lloh5:
	ldr	x23, [x23, _gdMaxColors@GOTPAGEOFF]
	ldr	w8, [x23]
	cmp	w8, #1
	b.lt	LBB0_24
; %bb.13:
	mov	x24, #0
	mov	x25, #0
Lloh6:
	adrp	x22, _FALSE@GOTPAGE
Lloh7:
	ldr	x22, [x22, _FALSE@GOTPAGEOFF]
	b	LBB0_15
LBB0_14:                                ;   in Loop: Header=BB0_15 Depth=1
	add	x25, x25, #1
	ldrsw	x8, [x23]
	add	x24, x24, #4
	cmp	x25, x8
	b.ge	LBB0_24
LBB0_15:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x19, #16]
	add	x0, x8, x24
	mov	x1, x21
	bl	_gdGetByte
	cbz	w0, LBB0_23
; %bb.16:                               ;   in Loop: Header=BB0_15 Depth=1
	ldr	x8, [x19, #24]
	add	x0, x8, x24
	mov	x1, x21
	bl	_gdGetByte
	cbz	w0, LBB0_23
; %bb.17:                               ;   in Loop: Header=BB0_15 Depth=1
	ldr	x8, [x19, #32]
	add	x0, x8, x24
	mov	x1, x21
	bl	_gdGetByte
	cbz	w0, LBB0_23
; %bb.18:                               ;   in Loop: Header=BB0_15 Depth=1
	cbz	w20, LBB0_14
; %bb.19:                               ;   in Loop: Header=BB0_15 Depth=1
	ldr	x8, [x19, #40]
	add	x0, x8, x24
	mov	x1, x21
	bl	_gdGetByte
	cbnz	w0, LBB0_14
	b	LBB0_23
LBB0_20:
	add	x22, x19, #4
	mov	x0, x22
	mov	x1, x21
	bl	_gdGetWord
	cbz	w0, LBB0_22
; %bb.21:
	ldr	w8, [x22]
Lloh8:
	adrp	x9, _gdMaxColors@GOTPAGE
Lloh9:
	ldr	x9, [x9, _gdMaxColors@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	cmp	w8, w9
	b.le	LBB0_4
LBB0_22:
Lloh11:
	adrp	x22, _FALSE@GOTPAGE
Lloh12:
	ldr	x22, [x22, _FALSE@GOTPAGEOFF]
LBB0_23:
	ldr	w0, [x22]
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
LBB0_24:
	ldr	w8, [x19, #4]
	cmp	w8, #1
	b.lt	LBB0_11
; %bb.25:
	ldr	x0, [x19, #48]
	lsl	x1, x8, #3
	bl	_bzero
	b	LBB0_11
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_gdMaxColors,4,2                ; @gdMaxColors
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Pallette had %d colours (T=%d)\n"

	.comm	_TRUE,4,2                       ; @TRUE
	.comm	_FALSE,4,2                      ; @FALSE
.subsections_via_symbols
