	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_gdImageColorMatch              ## -- Begin function gdImageColorMatch
	.p2align	4, 0x90
_gdImageColorMatch:                     ## @gdImageColorMatch
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	cmpq	$0, 64(%rdi)
	je	LBB0_1
## %bb.2:
	movq	%rsi, %r15
	movl	$-2, %eax
	cmpq	$0, 64(%rsi)
	jne	LBB0_32
## %bb.3:
	movq	%rdi, %rbx
	movl	(%rdi), %ecx
	movl	$-3, %eax
	cmpl	(%r15), %ecx
	jne	LBB0_32
## %bb.4:
	movl	4(%rbx), %ecx
	cmpl	4(%r15), %ecx
	jne	LBB0_32
## %bb.5:
	cmpl	$0, 8(%r15)
	jle	LBB0_6
## %bb.7:
	movq	_gdMaxColors@GOTPCREL(%rip), %r14
	movl	(%r14), %eax
	leal	(%rax,%rax,4), %esi
	movl	$8, %edi
	xorl	%edx, %edx
	callq	_safe_emalloc
	movq	%rax, %r13
	movl	(%r14), %eax
	shll	$3, %eax
	leal	(%rax,%rax,4), %edx
	movq	%r13, %rdi
	xorl	%esi, %esi
	callq	_memset
	movl	(%rbx), %ecx
	testl	%ecx, %ecx
	jle	LBB0_14
## %bb.8:
	movl	4(%rbx), %eax
	xorl	%r12d, %r12d
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	movq	%r15, -48(%rbp)                 ## 8-byte Spill
	jmp	LBB0_9
	.p2align	4, 0x90
LBB0_13:                                ##   in Loop: Header=BB0_9 Depth=1
	incq	%r12
	movslq	%ecx, %rdx
	cmpq	%rdx, %r12
	jge	LBB0_14
LBB0_9:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_11 Depth 2
	testl	%eax, %eax
	jle	LBB0_13
## %bb.10:                              ##   in Loop: Header=BB0_9 Depth=1
	xorl	%r14d, %r14d
	.p2align	4, 0x90
LBB0_11:                                ##   Parent Loop BB0_9 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	16(%r15), %rax
	movq	(%rax,%r14,8), %rax
	movslq	(%rax,%r12,4), %rax
	movq	24(%rbx), %rcx
	movq	(%rcx,%r14,8), %rcx
	movl	(%rcx,%r12,4), %ebx
	leaq	(%rax,%rax,4), %r15
	incq	(%r13,%r15,8)
	movl	%ebx, %edi
	callq	_gdTrueColorGetRed
	addq	%rax, 8(%r13,%r15,8)
	movl	%ebx, %edi
	callq	_gdTrueColorGetGreen
	addq	%rax, 16(%r13,%r15,8)
	movl	%ebx, %edi
	callq	_gdTrueColorGetBlue
	addq	%rax, 24(%r13,%r15,8)
	movl	%ebx, %edi
	callq	_gdTrueColorGetAlpha
	addq	%rax, 32(%r13,%r15,8)
	movq	-48(%rbp), %r15                 ## 8-byte Reload
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	incq	%r14
	movslq	4(%rbx), %rax
	cmpq	%rax, %r14
	jl	LBB0_11
## %bb.12:                              ##   in Loop: Header=BB0_9 Depth=1
	movl	(%rbx), %ecx
	jmp	LBB0_13
LBB0_1:
	movl	$-1, %eax
LBB0_32:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_14:
	movl	8(%r15), %eax
	testl	%eax, %eax
	jle	LBB0_31
## %bb.15:
	movq	%r13, %rcx
	addq	$32, %rcx
	xorl	%edi, %edi
	jmp	LBB0_16
	.p2align	4, 0x90
LBB0_28:                                ##   in Loop: Header=BB0_16 Depth=1
	xorl	%edx, %edx
	divq	%rbx
LBB0_29:                                ##   in Loop: Header=BB0_16 Depth=1
	movq	56(%r15), %rdx
	movl	%eax, (%rdx,%rdi,4)
	movl	8(%r15), %eax
LBB0_30:                                ##   in Loop: Header=BB0_16 Depth=1
	incq	%rdi
	movslq	%eax, %rdx
	addq	$40, %rcx
	cmpq	%rdx, %rdi
	jge	LBB0_31
LBB0_16:                                ## =>This Inner Loop Header: Depth=1
	movq	-32(%rcx), %r8
	testl	%r8d, %r8d
	jle	LBB0_30
## %bb.17:                              ##   in Loop: Header=BB0_16 Depth=1
	movq	-24(%rcx), %rax
	movslq	%r8d, %rbx
	movq	%rax, %rdx
	orq	%rbx, %rdx
	shrq	$32, %rdx
	je	LBB0_18
## %bb.19:                              ##   in Loop: Header=BB0_16 Depth=1
	xorl	%edx, %edx
	divq	%rbx
	jmp	LBB0_20
LBB0_18:                                ##   in Loop: Header=BB0_16 Depth=1
                                        ## kill: def $eax killed $eax killed $rax
	xorl	%edx, %edx
	divl	%r8d
                                        ## kill: def $eax killed $eax def $rax
LBB0_20:                                ##   in Loop: Header=BB0_16 Depth=1
	movq	32(%r15), %rdx
	movl	%eax, (%rdx,%rdi,4)
	movq	-16(%rcx), %rax
	movq	%rax, %rdx
	orq	%rbx, %rdx
	shrq	$32, %rdx
	je	LBB0_21
## %bb.22:                              ##   in Loop: Header=BB0_16 Depth=1
	xorl	%edx, %edx
	divq	%rbx
	jmp	LBB0_23
LBB0_21:                                ##   in Loop: Header=BB0_16 Depth=1
                                        ## kill: def $eax killed $eax killed $rax
	xorl	%edx, %edx
	divl	%r8d
                                        ## kill: def $eax killed $eax def $rax
LBB0_23:                                ##   in Loop: Header=BB0_16 Depth=1
	movq	40(%r15), %rdx
	movl	%eax, (%rdx,%rdi,4)
	movq	-8(%rcx), %rax
	movq	%rax, %rdx
	orq	%rbx, %rdx
	shrq	$32, %rdx
	je	LBB0_24
## %bb.25:                              ##   in Loop: Header=BB0_16 Depth=1
	xorl	%edx, %edx
	divq	%rbx
	jmp	LBB0_26
LBB0_24:                                ##   in Loop: Header=BB0_16 Depth=1
                                        ## kill: def $eax killed $eax killed $rax
	xorl	%edx, %edx
	divl	%r8d
                                        ## kill: def $eax killed $eax def $rax
LBB0_26:                                ##   in Loop: Header=BB0_16 Depth=1
	movq	48(%r15), %rdx
	movl	%eax, (%rdx,%rdi,4)
	movq	(%rcx), %rax
	movq	%rax, %rdx
	orq	%rbx, %rdx
	shrq	$32, %rdx
	jne	LBB0_28
## %bb.27:                              ##   in Loop: Header=BB0_16 Depth=1
                                        ## kill: def $eax killed $eax killed $rax
	xorl	%edx, %edx
	divl	%r8d
                                        ## kill: def $eax killed $eax def $rax
	jmp	LBB0_29
LBB0_31:
	movq	%r13, %rdi
	callq	_gdFree
	xorl	%eax, %eax
	jmp	LBB0_32
LBB0_6:
	movl	$-4, %eax
	jmp	LBB0_32
	.cfi_endproc
                                        ## -- End function
	.comm	_gdMaxColors,4,2                ## @gdMaxColors
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_gdImageColorMatch              ; -- Begin function gdImageColorMatch
	.p2align	2
_gdImageColorMatch:                     ; @gdImageColorMatch
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	ldr	x8, [x0, #64]
	cbz	x8, LBB0_3
; %bb.1:
	mov	x19, x1
	ldr	x8, [x1, #64]
	cbz	x8, LBB0_4
; %bb.2:
	mov	w0, #-2
	b	LBB0_15
LBB0_3:
	mov	w0, #-1
	b	LBB0_15
LBB0_4:
	mov	x21, x0
	ldr	w8, [x0]
	ldr	w9, [x19]
	cmp	w8, w9
	b.ne	LBB0_14
; %bb.5:
	ldr	w8, [x21, #4]
	ldr	w9, [x19, #4]
	cmp	w8, w9
	b.ne	LBB0_14
; %bb.6:
	ldr	w8, [x19, #8]
	cmp	w8, #1
	b.lt	LBB0_22
; %bb.7:
Lloh0:
	adrp	x22, _gdMaxColors@GOTPAGE
Lloh1:
	ldr	x22, [x22, _gdMaxColors@GOTPAGEOFF]
	ldr	w8, [x22]
	add	w1, w8, w8, lsl #2
	mov	w0, #8
	mov	w2, #0
	bl	_safe_emalloc
	mov	x20, x0
	ldr	w8, [x22]
	add	w8, w8, w8, lsl #2
	lsl	w2, w8, #3
	mov	w1, #0
	bl	_memset
	ldr	w9, [x21]
	cmp	w9, #1
	b.lt	LBB0_16
; %bb.8:
	mov	x23, #0
	ldr	w8, [x21, #4]
	mov	w24, #40
	b	LBB0_10
LBB0_9:                                 ;   in Loop: Header=BB0_10 Depth=1
	add	x23, x23, #1
	cmp	x23, w9, sxtw
	b.ge	LBB0_16
LBB0_10:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_12 Depth 2
	cmp	w8, #1
	b.lt	LBB0_9
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=1
	mov	x25, #0
LBB0_12:                                ;   Parent Loop BB0_10 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	x8, [x19, #16]
	lsl	x9, x25, #3
	ldr	x8, [x8, x9]
	lsl	x10, x23, #2
	ldrsw	x8, [x8, x10]
	ldr	x11, [x21, #24]
	ldr	x9, [x11, x9]
	ldr	w22, [x9, x10]
	madd	x26, x8, x24, x20
	ldr	x8, [x26]
	add	x8, x8, #1
	str	x8, [x26]
	mov	x0, x22
	bl	_gdTrueColorGetRed
	ldr	x8, [x26, #8]
	add	x8, x8, x0
	str	x8, [x26, #8]
	mov	x0, x22
	bl	_gdTrueColorGetGreen
	ldr	x8, [x26, #16]
	add	x8, x8, x0
	str	x8, [x26, #16]
	mov	x0, x22
	bl	_gdTrueColorGetBlue
	ldr	x8, [x26, #24]
	add	x8, x8, x0
	str	x8, [x26, #24]
	mov	x0, x22
	bl	_gdTrueColorGetAlpha
	ldr	x8, [x26, #32]
	add	x8, x8, x0
	str	x8, [x26, #32]
	add	x25, x25, #1
	ldrsw	x8, [x21, #4]
	cmp	x25, x8
	b.lt	LBB0_12
; %bb.13:                               ;   in Loop: Header=BB0_10 Depth=1
	ldr	w9, [x21]
	b	LBB0_9
LBB0_14:
	mov	w0, #-3
LBB0_15:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_16:
	ldr	w10, [x19, #8]
	cmp	w10, #1
	b.lt	LBB0_21
; %bb.17:
	mov	x8, #0
	add	x9, x20, #16
	b	LBB0_19
LBB0_18:                                ;   in Loop: Header=BB0_19 Depth=1
	add	x8, x8, #1
	add	x9, x9, #40
	cmp	x8, w10, sxtw
	b.ge	LBB0_21
LBB0_19:                                ; =>This Inner Loop Header: Depth=1
	ldur	x11, [x9, #-16]
	cmp	w11, #1
	b.lt	LBB0_18
; %bb.20:                               ;   in Loop: Header=BB0_19 Depth=1
	ldur	x10, [x9, #-8]
	sxtw	x11, w11
	udiv	x10, x10, x11
	lsl	x12, x8, #2
	ldp	x13, x14, [x19, #32]
	str	w10, [x13, x12]
	ldp	x10, x13, [x9]
	udiv	x10, x10, x11
	str	w10, [x14, x12]
	udiv	x10, x13, x11
	ldp	x13, x14, [x19, #48]
	str	w10, [x13, x12]
	ldr	x10, [x9, #16]
	udiv	x10, x10, x11
	str	w10, [x14, x12]
	ldr	w10, [x19, #8]
	b	LBB0_18
LBB0_21:
	mov	x0, x20
	bl	_gdFree
	mov	w0, #0
	b	LBB0_15
LBB0_22:
	mov	w0, #-4
	b	LBB0_15
	.loh AdrpLdrGot	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.comm	_gdMaxColors,4,2                ; @gdMaxColors
.subsections_via_symbols
