	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_gdImageColorClosestAlpha       ## -- Begin function gdImageColorClosestAlpha
	.p2align	4, 0x90
_gdImageColorClosestAlpha:              ## @gdImageColorClosestAlpha
	.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
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	cmpq	$0, 48(%rdi)
	je	LBB0_1
## %bb.3:
	movl	%esi, %edi
	movl	%edx, %esi
	movl	%ecx, %edx
	movl	%r8d, %ecx
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_gdTrueColorAlpha               ## TAILCALL
LBB0_1:
	movl	(%rdi), %r9d
	testl	%r9d, %r9d
	jle	LBB0_2
## %bb.4:
	movq	40(%rdi), %r10
	movl	$-1, %eax
	movl	$1, %r15d
	xorl	%r11d, %r11d
	movslq	%esi, %rsi
	movq	%rsi, -56(%rbp)                 ## 8-byte Spill
	movslq	%edx, %rdx
	movq	%rdx, -48(%rbp)                 ## 8-byte Spill
	movslq	%ecx, %r13
	movslq	%r8d, %r8
	xorl	%r12d, %r12d
	jmp	LBB0_5
	.p2align	4, 0x90
LBB0_8:                                 ##   in Loop: Header=BB0_5 Depth=1
	xorl	%r15d, %r15d
	movl	%ecx, %eax
	movq	%rbx, %r12
LBB0_9:                                 ##   in Loop: Header=BB0_5 Depth=1
	incq	%r11
	cmpq	%r11, %r9
	je	LBB0_10
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	cmpq	$0, (%r10,%r11,8)
	jne	LBB0_9
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	movq	8(%rdi), %rcx
	movq	16(%rdi), %rbx
	movslq	(%rcx,%r11,4), %rcx
	subq	-56(%rbp), %rcx                 ## 8-byte Folded Reload
	movslq	(%rbx,%r11,4), %rsi
	subq	-48(%rbp), %rsi                 ## 8-byte Folded Reload
	movq	24(%rdi), %rbx
	movslq	(%rbx,%r11,4), %r14
	subq	%r13, %r14
	movq	32(%rdi), %rbx
	movslq	(%rbx,%r11,4), %rbx
	subq	%r8, %rbx
	imulq	%rcx, %rcx
	imulq	%rsi, %rsi
	addq	%rcx, %rsi
	imulq	%r14, %r14
	addq	%rsi, %r14
	imulq	%rbx, %rbx
	addq	%r14, %rbx
	testl	%r15d, %r15d
	setne	%cl
	cmpq	%r12, %rbx
	setl	%dl
	orb	%cl, %dl
	movl	%r11d, %ecx
	jne	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_5 Depth=1
	movl	%eax, %ecx
	movq	%r12, %rbx
	jmp	LBB0_8
LBB0_2:
	movl	$-1, %eax
LBB0_10:
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_gdImageColorClosestAlpha       ; -- Begin function gdImageColorClosestAlpha
	.p2align	2
_gdImageColorClosestAlpha:              ; @gdImageColorClosestAlpha
	.cfi_startproc
; %bb.0:
	ldr	x8, [x0, #48]
	cbz	x8, LBB0_2
; %bb.1:
	mov	x0, x1
	mov	x1, x2
	mov	x2, x3
	mov	x3, x4
	b	_gdTrueColorAlpha
LBB0_2:
	ldr	w9, [x0]
	cmp	w9, #1
	b.lt	LBB0_8
; %bb.3:
	mov	x10, #0
	mov	x11, #0
	ldr	x12, [x0, #40]
	mov	w8, #-1
	mov	w13, #1
	b	LBB0_5
LBB0_4:                                 ;   in Loop: Header=BB0_5 Depth=1
	add	x10, x10, #1
	cmp	x9, x10
	b.eq	LBB0_7
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x14, [x12, x10, lsl #3]
	cbnz	x14, LBB0_4
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	lsl	x14, x10, #2
	ldp	x15, x16, [x0, #8]
	ldrsw	x15, [x15, x14]
	sub	x15, x15, w1, sxtw
	ldrsw	x16, [x16, x14]
	sub	x16, x16, w2, sxtw
	ldp	x17, x5, [x0, #24]
	ldrsw	x17, [x17, x14]
	sub	x17, x17, w3, sxtw
	ldrsw	x14, [x5, x14]
	sub	x14, x14, w4, sxtw
	mul	x15, x15, x15
	madd	x15, x16, x16, x15
	madd	x15, x17, x17, x15
	madd	x14, x14, x14, x15
	cmp	w13, #0
	ccmp	x14, x11, #8, eq
	cset	w13, lt
	cmp	w13, #0
	csel	w8, w10, w8, ne
	csel	x11, x14, x11, ne
	mov	w13, #0
	b	LBB0_4
LBB0_7:
	mov	x0, x8
	ret
LBB0_8:
	mov	w0, #-1
	ret
	.cfi_endproc
                                        ; -- End function
.subsections_via_symbols
