	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_png_do_expand_palette          ## -- Begin function png_do_expand_palette
	.p2align	4, 0x90
_png_do_expand_palette:                 ## @png_do_expand_palette
	.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	%r8d, %r12d
	movq	%rcx, -48(%rbp)                 ## 8-byte Spill
	movq	%rdx, %r15
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movl	(%rdi), %r13d
	leaq	L_.str(%rip), %rsi
	movl	$1, %edi
	callq	_png_debug
	movq	8(%r14), %rax
	movq	_PNG_COLOR_TYPE_PALETTE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_41
## %bb.1:
	movl	16(%r14), %eax
	cmpl	$7, %eax
	jg	LBB0_27
## %bb.2:
	cmpl	$4, %eax
	je	LBB0_19
## %bb.3:
	cmpl	$2, %eax
	je	LBB0_12
## %bb.4:
	cmpl	$1, %eax
	jne	LBB0_26
## %bb.5:
	testl	%r13d, %r13d
	jle	LBB0_26
## %bb.6:
	movl	%r13d, %ecx
	negl	%ecx
	andl	$7, %ecx
	leaq	(%rbx,%r13,4), %rdi
	leal	-1(%r13), %eax
	movl	%eax, %edx
	shrl	$3, %edx
	leaq	(%rbx,%rdx,4), %r11
	testl	%eax, %eax
	je	LBB0_7
## %bb.8:
	movl	%r13d, %r10d
	andl	$-2, %r10d
	xorl	%r8d, %r8d
	movq	%r11, %rax
	.p2align	4, 0x90
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r11), %edx
	xorl	%esi, %esi
	btl	%ecx, %edx
	setb	%sil
	movl	%esi, -4(%rdi)
	leal	1(%rcx), %edx
	xorl	%esi, %esi
	cmpl	$7, %ecx
	sete	%sil
	cmovel	%r8d, %edx
	shlq	$2, %rsi
	subq	%rsi, %rax
	negq	%rsi
	leaq	-8(%rdi), %r9
	movl	(%r11,%rsi), %ecx
	xorl	%esi, %esi
	btl	%edx, %ecx
	setb	%sil
	movl	%esi, -8(%rdi)
	leal	1(%rdx), %ecx
	xorl	%esi, %esi
	cmpl	$7, %edx
	cmovel	%r8d, %ecx
	sete	%sil
	shlq	$2, %rsi
	subq	%rsi, %rax
	movq	%r9, %rdi
	movq	%rax, %r11
	addl	$-2, %r10d
	jne	LBB0_9
	jmp	LBB0_10
LBB0_27:
	cmpl	$8, %eax
	je	LBB0_28
	jmp	LBB0_41
LBB0_19:
	testl	%r13d, %r13d
	jle	LBB0_26
## %bb.20:
	leal	(,%r13,4), %ecx
	andl	$4, %ecx
	leaq	(%rbx,%r13,4), %r10
	leal	-1(%r13), %eax
	movl	%eax, %esi
	shrl	%esi
	leaq	(%rbx,%rsi,4), %rdi
	testl	%eax, %eax
	je	LBB0_21
## %bb.22:
	movl	%r13d, %r9d
	andl	$-2, %r9d
	xorl	%r8d, %r8d
	movq	%rdi, %rsi
	.p2align	4, 0x90
LBB0_23:                                ## =>This Inner Loop Header: Depth=1
	movl	(%rdi), %eax
	sarl	%cl, %eax
	andl	$15, %eax
	movl	%eax, -4(%r10)
	leal	4(%rcx), %eax
	xorl	%edx, %edx
	cmpl	$4, %ecx
	cmovel	%r8d, %eax
	sete	%dl
	shlq	$2, %rdx
	subq	%rdx, %rsi
	negq	%rdx
	movl	(%rdi,%rdx), %edx
	movl	%eax, %ecx
	sarl	%cl, %edx
	andl	$15, %edx
	movl	%edx, -8(%r10)
	addq	$-8, %r10
	leal	4(%rax), %ecx
	xorl	%edx, %edx
	cmpl	$4, %eax
	cmovel	%r8d, %ecx
	sete	%dl
	shlq	$2, %rdx
	subq	%rdx, %rsi
	movq	%rsi, %rdi
	addl	$-2, %r9d
	jne	LBB0_23
	jmp	LBB0_24
LBB0_12:
	testl	%r13d, %r13d
	jle	LBB0_26
## %bb.13:
	leal	6(%r13,%r13), %ecx
	notl	%ecx
	andl	$6, %ecx
	leaq	(%rbx,%r13,4), %r9
	leal	-1(%r13), %eax
	movl	%eax, %edx
	andl	$-4, %edx
	addq	%rbx, %rdx
	testl	%eax, %eax
	je	LBB0_14
## %bb.15:
	movl	%r13d, %r10d
	andl	$-2, %r10d
	xorl	%r8d, %r8d
	movq	%rdx, %rsi
	.p2align	4, 0x90
LBB0_16:                                ## =>This Inner Loop Header: Depth=1
	movl	(%rdx), %eax
	sarl	%cl, %eax
	andl	$3, %eax
	movl	%eax, -4(%r9)
	leal	2(%rcx), %eax
	xorl	%edi, %edi
	cmpl	$6, %ecx
	cmovel	%r8d, %eax
	sete	%dil
	shlq	$2, %rdi
	subq	%rdi, %rsi
	negq	%rdi
	movl	(%rdx,%rdi), %edx
	movl	%eax, %ecx
	sarl	%cl, %edx
	andl	$3, %edx
	movl	%edx, -8(%r9)
	addq	$-8, %r9
	leal	2(%rax), %ecx
	xorl	%edx, %edx
	cmpl	$6, %eax
	cmovel	%r8d, %ecx
	sete	%dl
	shlq	$2, %rdx
	subq	%rdx, %rsi
	movq	%rsi, %rdx
	addl	$-2, %r10d
	jne	LBB0_16
	jmp	LBB0_17
LBB0_7:
	movq	%rdi, %r9
	movq	%r11, %rax
LBB0_10:
	testb	$1, %r13b
	je	LBB0_26
## %bb.11:
	movl	(%rax), %eax
	xorl	%edx, %edx
	btl	%ecx, %eax
	setb	%dl
	movl	%edx, -4(%r9)
	jmp	LBB0_26
LBB0_21:
	movq	%rdi, %rsi
LBB0_24:
	testb	$1, %r13b
	je	LBB0_26
## %bb.25:
	movl	(%rsi), %eax
                                        ## kill: def $cl killed $cl killed $rcx
	sarl	%cl, %eax
	andl	$15, %eax
	movl	%eax, -4(%r10)
	jmp	LBB0_26
LBB0_14:
	movq	%rdx, %rsi
LBB0_17:
	testb	$1, %r13b
	je	LBB0_26
## %bb.18:
	movl	(%rsi), %eax
                                        ## kill: def $cl killed $cl killed $rcx
	sarl	%cl, %eax
	andl	$3, %eax
	movl	%eax, -4(%r9)
LBB0_26:
	movabsq	$34359738376, %rax              ## imm = 0x800000008
	movq	%rax, 16(%r14)
	movl	%r13d, 24(%r14)
LBB0_28:
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	testq	%rsi, %rsi
	je	LBB0_34
## %bb.29:
	leal	(,%r13,4), %eax
	movl	$4, %r8d
	movl	$6, %r9d
	movl	$32, %r10d
	testl	%r13d, %r13d
	jle	LBB0_40
## %bb.30:
	movslq	%eax, %rcx
	jmp	LBB0_31
	.p2align	4, 0x90
LBB0_33:                                ##   in Loop: Header=BB0_31 Depth=1
	movl	%edi, -4(%rbx,%rcx,4)
	movslq	-4(%rbx,%r13,4), %rdx
	leaq	(%rdx,%rdx,2), %rdx
	movl	8(%r15,%rdx,4), %edx
	movl	%edx, -8(%rbx,%rcx,4)
	movslq	-4(%rbx,%r13,4), %rdx
	leaq	(%rdx,%rdx,2), %rdx
	movl	4(%r15,%rdx,4), %edx
	movl	%edx, -12(%rbx,%rcx,4)
	movslq	-4(%rbx,%r13,4), %rdx
	leaq	(%rdx,%rdx,2), %rdx
	movl	(%r15,%rdx,4), %edx
	movl	%edx, -16(%rbx,%rcx,4)
	decq	%r13
	addq	$-4, %rcx
	testl	%r13d, %r13d
	je	LBB0_40
LBB0_31:                                ## =>This Inner Loop Header: Depth=1
	movslq	-4(%rbx,%r13,4), %rdx
	movl	$255, %edi
	cmpl	%r12d, %edx
	jge	LBB0_33
## %bb.32:                              ##   in Loop: Header=BB0_31 Depth=1
	movl	(%rsi,%rdx,4), %edi
	jmp	LBB0_33
LBB0_34:
	movslq	%r13d, %rax
	leaq	(%rax,%rax,2), %rax
	movl	$3, %r8d
	movl	$2, %r9d
	movl	$24, %r10d
	testl	%r13d, %r13d
	jle	LBB0_40
## %bb.35:
	leaq	(%rbx,%rax,4), %rdi
	addq	$-4, %rdi
	leaq	(%rbx,%r13,4), %rbx
	cmpl	$1, %r13d
	je	LBB0_38
## %bb.36:
	movl	%r13d, %ecx
	andl	$-2, %ecx
	.p2align	4, 0x90
LBB0_37:                                ## =>This Inner Loop Header: Depth=1
	movslq	-4(%rbx), %rdx
	leaq	(%rdx,%rdx,2), %rdx
	movl	8(%r15,%rdx,4), %edx
	movl	%edx, (%rdi)
	movslq	-4(%rbx), %rdx
	leaq	(%rdx,%rdx,2), %rdx
	movl	4(%r15,%rdx,4), %edx
	movl	%edx, -4(%rdi)
	movslq	-4(%rbx), %rdx
	leaq	(%rdx,%rdx,2), %rdx
	movl	(%r15,%rdx,4), %edx
	movl	%edx, -8(%rdi)
	movslq	-8(%rbx), %rdx
	leaq	(%rdx,%rdx,2), %rdx
	movl	8(%r15,%rdx,4), %edx
	movl	%edx, -12(%rdi)
	movslq	-8(%rbx), %rdx
	leaq	(%rdx,%rdx,2), %rdx
	movl	4(%r15,%rdx,4), %edx
	movl	%edx, -16(%rdi)
	movslq	-8(%rbx), %rdx
	addq	$-8, %rbx
	leaq	(%rdx,%rdx,2), %rdx
	movl	(%r15,%rdx,4), %edx
	movl	%edx, -20(%rdi)
	addq	$-24, %rdi
	addl	$-2, %ecx
	jne	LBB0_37
LBB0_38:
	testb	$1, %r13b
	je	LBB0_40
## %bb.39:
	movslq	-4(%rbx), %rcx
	leaq	(%rcx,%rcx,2), %rcx
	movl	8(%r15,%rcx,4), %ecx
	movl	%ecx, (%rdi)
	movslq	-4(%rbx), %rcx
	leaq	(%rcx,%rcx,2), %rcx
	movl	4(%r15,%rcx,4), %ecx
	movl	%ecx, -4(%rdi)
	movslq	-4(%rbx), %rcx
	leaq	(%rcx,%rcx,2), %rcx
	movl	(%r15,%rcx,4), %ecx
	movl	%ecx, -8(%rdi)
LBB0_40:
	movl	$8, 16(%r14)
	movl	%r10d, 20(%r14)
	movl	%eax, 24(%r14)
	movq	%r9, 8(%r14)
	movl	%r8d, 28(%r14)
LBB0_41:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"in png_do_expand_palette\n"

	.comm	_PNG_COLOR_TYPE_PALETTE,8,3     ## @PNG_COLOR_TYPE_PALETTE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_png_do_expand_palette          ; -- Begin function png_do_expand_palette
	.p2align	2
_png_do_expand_palette:                 ; @png_do_expand_palette
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x21, x4
	mov	x22, x3
	mov	x20, x2
	mov	x23, x1
	mov	x19, x0
	ldr	w24, [x0]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	w0, #1
	bl	_png_debug
	ldr	x8, [x19, #8]
Lloh2:
	adrp	x9, _PNG_COLOR_TYPE_PALETTE@GOTPAGE
Lloh3:
	ldr	x9, [x9, _PNG_COLOR_TYPE_PALETTE@GOTPAGEOFF]
Lloh4:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_31
; %bb.1:
	ldr	w8, [x19, #16]
	cmp	w8, #7
	b.gt	LBB0_8
; %bb.2:
	cmp	w8, #4
	b.eq	LBB0_18
; %bb.3:
	cmp	w8, #2
	b.eq	LBB0_21
; %bb.4:
	cmp	w8, #1
	b.ne	LBB0_24
; %bb.5:
	subs	w9, w24, #1
	b.lt	LBB0_24
; %bb.6:
	neg	w8, w24
	and	w8, w8, #0x7
	lsr	w9, w9, #3
	add	x9, x23, w9, uxtw #2
	sub	x10, x23, #4
	mov	x11, #-4
	mov	x12, x24
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w13, [x9]
	lsr	w13, w13, w8
	and	w13, w13, #0x1
	str	w13, [x10, x12, lsl #2]
	cmp	w8, #7
	csel	x13, x11, xzr, eq
	add	x9, x9, x13
	csinc	w8, wzr, w8, eq
	sub	x12, x12, #1
	cbnz	w12, LBB0_7
	b	LBB0_24
LBB0_8:
	cmp	w8, #8
	b.ne	LBB0_31
; %bb.9:
	cbz	x22, LBB0_25
LBB0_10:
	lsl	w8, w24, #2
	cmp	w24, #1
	b.lt	LBB0_17
; %bb.11:
	sub	x10, x23, #4
	sbfiz	x11, x8, #2, #32
	mov	w12, #12
	mov	w9, #6
	b	LBB0_14
LBB0_12:                                ;   in Loop: Header=BB0_14 Depth=1
	ldr	w13, [x22, x13, lsl #2]
LBB0_13:                                ;   in Loop: Header=BB0_14 Depth=1
	str	w13, [x10, x11]
	lsl	x13, x24, #2
	ldrsw	x14, [x10, x13]
	add	x15, x10, x11
	madd	x14, x14, x12, x20
	ldr	w14, [x14, #8]
	stur	w14, [x15, #-4]
	ldrsw	x14, [x10, x13]
	madd	x14, x14, x12, x20
	ldr	w14, [x14, #4]
	stur	w14, [x15, #-8]
	ldrsw	x13, [x10, x13]
	mul	x13, x13, x12
	ldr	w13, [x20, x13]
	stur	w13, [x15, #-12]
	sub	x11, x11, #16
	sub	x24, x24, #1
	cbz	w24, LBB0_16
LBB0_14:                                ; =>This Inner Loop Header: Depth=1
	ldrsw	x13, [x10, x24, lsl #2]
	cmp	w13, w21
	b.lt	LBB0_12
; %bb.15:                               ;   in Loop: Header=BB0_14 Depth=1
	mov	w13, #255
	b	LBB0_13
LBB0_16:
	mov	w10, #4
	mov	w11, #32
	b	LBB0_30
LBB0_17:
	mov	w10, #4
	mov	w11, #32
	mov	w9, #6
	b	LBB0_30
LBB0_18:
	subs	w8, w24, #1
	b.lt	LBB0_24
; %bb.19:
	ubfiz	w10, w24, #2, #1
	lsr	w8, w8, #1
	add	x8, x23, w8, uxtw #2
	sub	x9, x23, #4
	mov	x11, #-4
	mov	x12, x24
LBB0_20:                                ; =>This Inner Loop Header: Depth=1
	ldr	w13, [x8]
	asr	w13, w13, w10
	and	w13, w13, #0xf
	str	w13, [x9, x12, lsl #2]
	add	w13, w10, #4
	cmp	w10, #4
	csel	w10, wzr, w13, eq
	csel	x13, x11, xzr, eq
	add	x8, x8, x13
	sub	x12, x12, #1
	cbnz	w12, LBB0_20
	b	LBB0_24
LBB0_21:
	subs	w8, w24, #1
	b.lt	LBB0_24
; %bb.22:
	lsl	w9, w24, #1
	add	w9, w9, #6
	mvn	w9, w9
	and	w10, w9, #0x6
	and	w8, w8, #0xfffffffc
	add	x8, x23, x8
	sub	x9, x23, #4
	mov	x11, #-4
	mov	x12, x24
LBB0_23:                                ; =>This Inner Loop Header: Depth=1
	ldr	w13, [x8]
	asr	w13, w13, w10
	and	w13, w13, #0x3
	str	w13, [x9, x12, lsl #2]
	add	w13, w10, #2
	cmp	w10, #6
	csel	w10, wzr, w13, eq
	csel	x13, x11, xzr, eq
	add	x8, x8, x13
	sub	x12, x12, #1
	cbnz	w12, LBB0_23
LBB0_24:
	movi.2s	v0, #8
	str	d0, [x19, #16]
	str	w24, [x19, #24]
	cbnz	x22, LBB0_10
LBB0_25:
	add	w8, w24, w24, lsl #1
	cmp	w24, #1
	b.lt	LBB0_29
; %bb.26:
	sub	x10, x23, #4
	mov	x9, x8
	sbfiz	x11, x9, #2, #32
	mov	w12, #12
	mov	w9, #2
LBB0_27:                                ; =>This Inner Loop Header: Depth=1
	lsl	x13, x24, #2
	ldrsw	x14, [x10, x13]
	add	x15, x10, x11
	madd	x14, x14, x12, x20
	ldr	w14, [x14, #8]
	str	w14, [x15]
	ldrsw	x14, [x10, x13]
	madd	x14, x14, x12, x20
	ldr	w14, [x14, #4]
	stur	w14, [x15, #-4]
	ldrsw	x13, [x10, x13]
	mul	x13, x13, x12
	ldr	w13, [x20, x13]
	stur	w13, [x15, #-8]
	sub	x11, x11, #12
	sub	x24, x24, #1
	cbnz	w24, LBB0_27
; %bb.28:
	mov	w10, #3
	mov	w11, #24
	b	LBB0_30
LBB0_29:
	mov	w10, #3
	mov	w11, #24
	mov	w9, #2
LBB0_30:
	mov	w12, #8
	stp	w12, w11, [x19, #16]
	str	x9, [x19, #8]
	stp	w8, w10, [x19, #24]
LBB0_31:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"in png_do_expand_palette\n"

	.comm	_PNG_COLOR_TYPE_PALETTE,8,3     ; @PNG_COLOR_TYPE_PALETTE
.subsections_via_symbols
