	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function do_pal_update
_do_pal_update:                         ## @do_pal_update
	.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	%esi, %r14d
	movl	%edi, %r15d
	movq	_localPal@GOTPCREL(%rip), %r12
	movq	(%r12), %rbx
	movq	_Pico@GOTPCREL(%rip), %r13
	movl	16(%r13), %esi
	movq	_currentConfig@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	4(%rax), %edx
	movq	%rbx, %rdi
	callq	_do_pal_convert
	movq	$0, 8(%r13)
	movq	_need_pal_upload@GOTPCREL(%rip), %rax
	movl	$1, (%rax)
	testl	%r15d, %r15d
	je	LBB0_7
## %bb.1:
	movq	(%r13), %rax
	testb	$8, 48(%rax)
	jne	LBB0_2
LBB0_7:
	testl	%r14d, %r14d
	je	LBB0_9
## %bb.8:
	movq	_rendstatus@GOTPCREL(%rip), %rax
	movq	_PDRAW_SPR_LO_ON_HI@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%ecx, (%rax)
	je	LBB0_9
## %bb.10:
	addq	$256, %rbx                      ## imm = 0x100
	movq	(%r12), %rsi
	movq	%rbx, %rdi
	movl	$32, %edx
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_memcpy32                       ## TAILCALL
LBB0_2:
	movl	$31, %eax
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	leaq	(,%rax,4), %rcx
	movl	(%rbx,%rax,4), %edx
	shrl	%edx
	andl	$2077195215, %edx               ## imm = 0x7BCF7BCF
	movq	%rcx, %rsi
	orq	$384, %rsi                      ## imm = 0x180
	movl	%edx, (%rbx,%rsi)
	orq	$128, %rcx
	movl	%edx, (%rbx,%rcx)
	movl	-4(%rbx,%rax,4), %ecx
	shrl	%ecx
	andl	$2077195215, %ecx               ## imm = 0x7BCF7BCF
	leaq	-4(,%rax,4), %rdx
	decq	%rax
	movq	%rdx, %rsi
	orq	$384, %rsi                      ## imm = 0x180
	movl	%ecx, (%rbx,%rsi)
	orq	$128, %rdx
	movl	%ecx, (%rbx,%rdx)
	subq	$1, %rax
	jae	LBB0_3
## %bb.4:
	movq	(%r12), %rax
	movl	$63, %ecx
	movl	$63390, %edx                    ## imm = 0xF79E
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	leaq	(,%rcx,4), %rsi
	movl	(%rax,%rcx,4), %ebx
	andl	%edx, %ebx
	addl	$16904, %ebx                    ## imm = 0x4208
	movl	%ebx, %edi
	orl	$30, %edi
	testb	$32, %bl
	cmovel	%ebx, %edi
	movl	%edi, %ebx
	orl	$1920, %ebx                     ## imm = 0x780
	testl	$2048, %edi                     ## imm = 0x800
	cmovel	%edi, %ebx
	movl	%ebx, %edi
	orl	$61440, %edi                    ## imm = 0xF000
	testl	$65536, %ebx                    ## imm = 0x10000
	cmovel	%ebx, %edi
	andl	$63390, %edi                    ## imm = 0xF79E
	orq	$512, %rsi                      ## imm = 0x200
	movl	%edi, (%rax,%rsi)
	addq	$-1, %rcx
	jb	LBB0_5
## %bb.6:
	movl	$0, 896(%rax)
	movl	$31, 960(%rax)
LBB0_9:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_localPal,8,3                   ## @localPal
	.comm	_Pico,24,3                      ## @Pico
	.comm	_currentConfig,8,2              ## @currentConfig
	.comm	_need_pal_upload,4,2            ## @need_pal_upload
	.comm	_rendstatus,4,2                 ## @rendstatus
	.comm	_PDRAW_SPR_LO_ON_HI,4,2         ## @PDRAW_SPR_LO_ON_HI
	.no_dead_strip	_do_pal_update
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function do_pal_update
_do_pal_update:                         ; @do_pal_update
	.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	x20, x1
	mov	x21, x0
Lloh0:
	adrp	x22, _localPal@GOTPAGE
Lloh1:
	ldr	x22, [x22, _localPal@GOTPAGEOFF]
Lloh2:
	adrp	x23, _Pico@GOTPAGE
Lloh3:
	ldr	x23, [x23, _Pico@GOTPAGEOFF]
	ldr	x19, [x22]
	ldr	w1, [x23, #16]
Lloh4:
	adrp	x8, _currentConfig@GOTPAGE
Lloh5:
	ldr	x8, [x8, _currentConfig@GOTPAGEOFF]
	ldp	w3, w2, [x8]
	mov	x0, x19
	bl	_do_pal_convert
	str	xzr, [x23, #8]
Lloh6:
	adrp	x8, _need_pal_upload@GOTPAGE
Lloh7:
	ldr	x8, [x8, _need_pal_upload@GOTPAGEOFF]
	mov	w9, #1
Lloh8:
	str	w9, [x8]
	cbz	w21, LBB0_2
; %bb.1:
	ldr	x8, [x23]
	ldrb	w8, [x8, #48]
	tbnz	w8, #3, LBB0_5
LBB0_2:
	cbz	w20, LBB0_10
; %bb.3:
Lloh9:
	adrp	x8, _rendstatus@GOTPAGE
Lloh10:
	ldr	x8, [x8, _rendstatus@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
Lloh12:
	adrp	x9, _PDRAW_SPR_LO_ON_HI@GOTPAGE
Lloh13:
	ldr	x9, [x9, _PDRAW_SPR_LO_ON_HI@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_10
; %bb.4:
	add	x0, x19, #256
	ldr	x1, [x22]
	mov	w2, #32
	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
	b	_memcpy32
LBB0_5:
	mov	w8, #31
	mov	w9, #31695
	movk	w9, #31695, lsl #16
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	lsl	x10, x8, #2
	ldr	w11, [x19, x10]
	and	w11, w9, w11, lsr #1
	orr	x12, x10, #0x180
	str	w11, [x19, x12]
	orr	x10, x10, #0x80
	str	w11, [x19, x10]
	sub	x8, x8, #1
	cmn	x8, #1
	b.ne	LBB0_6
; %bb.7:
	ldr	x8, [x22]
	mov	w9, #63
	mov	w10, #63390
	mov	w11, #16904
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	lsl	x12, x9, #2
	ldr	w13, [x8, x12]
	and	w13, w13, w10
	add	w13, w13, w11
	orr	w14, w13, #0x1e
	tst	w13, #0x20
	csel	w13, w13, w14, eq
	orr	w14, w13, #0x780
	tst	w13, #0x800
	csel	w13, w13, w14, eq
	orr	w14, w13, #0xf000
	tst	w13, #0x10000
	csel	w13, w13, w14, eq
	and	w13, w13, w10
	orr	x12, x12, #0x200
	str	w13, [x8, x12]
	sub	x9, x9, #1
	cmn	x9, #1
	b.ne	LBB0_8
; %bb.9:
	str	wzr, [x8, #896]
	mov	w9, #31
	str	w9, [x8, #960]
LBB0_10:
	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 AdrpLdrGotStr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_localPal,8,3                   ; @localPal
	.comm	_Pico,24,3                      ; @Pico
	.comm	_currentConfig,8,2              ; @currentConfig
	.comm	_need_pal_upload,4,2            ; @need_pal_upload
	.comm	_rendstatus,4,2                 ; @rendstatus
	.comm	_PDRAW_SPR_LO_ON_HI,4,2         ; @PDRAW_SPR_LO_ON_HI
	.no_dead_strip	_do_pal_update
.subsections_via_symbols
