	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function EmuScanPrepare
_EmuScanPrepare:                        ## @EmuScanPrepare
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -24
	movq	_VRAM_CACHED_STUFF@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	leaq	8(%rax), %rdx
	movq	_HighCol@GOTPCREL(%rip), %rcx
	movq	%rdx, (%rcx)
	movq	_Pico@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rdx
	testb	$8, 4(%rdx)
	jne	LBB0_2
## %bb.1:
	addq	$4104, %rax                     ## imm = 0x1008
	movq	%rax, (%rcx)
LBB0_2:
	movq	_dynamic_palette@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	testq	%rcx, %rcx
	jle	LBB0_4
## %bb.3:
	decq	%rcx
	movq	%rcx, (%rax)
LBB0_4:
	cmpq	$0, 8(%rbx)
	je	LBB0_6
## %bb.5:
	movl	$1, %edi
	movl	$1, %esi
	callq	_do_pal_update
LBB0_6:
	movq	_rendstatus@GOTPCREL(%rip), %rax
	movq	_PDRAW_SPR_LO_ON_HI@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%ecx, (%rax)
	je	LBB0_9
## %bb.7:
	movq	(%rbx), %rax
	testb	$8, 48(%rax)
	jne	LBB0_9
## %bb.8:
	movq	_amips_clut_6bit@GOTPCREL(%rip), %rax
	jmp	LBB0_10
LBB0_9:
	movq	_amips_clut@GOTPCREL(%rip), %rax
LBB0_10:
	movl	(%rax), %eax
	movq	_amips_clut_f@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_VRAM_CACHED_STUFF,8,3          ## @VRAM_CACHED_STUFF
	.comm	_HighCol,8,3                    ## @HighCol
	.comm	_Pico,16,3                      ## @Pico
	.comm	_dynamic_palette,8,3            ## @dynamic_palette
	.comm	_rendstatus,4,2                 ## @rendstatus
	.comm	_PDRAW_SPR_LO_ON_HI,4,2         ## @PDRAW_SPR_LO_ON_HI
	.comm	_amips_clut_6bit,4,2            ## @amips_clut_6bit
	.comm	_amips_clut_f,4,2               ## @amips_clut_f
	.comm	_amips_clut,4,2                 ## @amips_clut
	.no_dead_strip	_EmuScanPrepare
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function EmuScanPrepare
_EmuScanPrepare:                        ; @EmuScanPrepare
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
Lloh0:
	adrp	x8, _VRAM_CACHED_STUFF@GOTPAGE
Lloh1:
	ldr	x8, [x8, _VRAM_CACHED_STUFF@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
Lloh3:
	adrp	x9, _HighCol@GOTPAGE
Lloh4:
	ldr	x9, [x9, _HighCol@GOTPAGEOFF]
	add	x10, x8, #8
	str	x10, [x9]
Lloh5:
	adrp	x19, _Pico@GOTPAGE
Lloh6:
	ldr	x19, [x19, _Pico@GOTPAGEOFF]
	ldr	x10, [x19]
	ldrb	w10, [x10, #4]
	tbnz	w10, #3, LBB0_2
; %bb.1:
	mov	w10, #4104
	add	x8, x8, x10
	str	x8, [x9]
LBB0_2:
Lloh7:
	adrp	x8, _dynamic_palette@GOTPAGE
Lloh8:
	ldr	x8, [x8, _dynamic_palette@GOTPAGEOFF]
	ldr	x9, [x8]
	subs	x9, x9, #1
	b.lt	LBB0_4
; %bb.3:
	str	x9, [x8]
LBB0_4:
	ldr	x8, [x19, #8]
	cbz	x8, LBB0_6
; %bb.5:
	mov	w0, #1
	mov	w1, #1
	bl	_do_pal_update
LBB0_6:
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_9
; %bb.7:
	ldr	x8, [x19]
	ldrb	w8, [x8, #48]
	tbnz	w8, #3, LBB0_9
; %bb.8:
Lloh15:
	adrp	x8, _amips_clut_6bit@GOTPAGE
Lloh16:
	ldr	x8, [x8, _amips_clut_6bit@GOTPAGEOFF]
	b	LBB0_10
LBB0_9:
Lloh17:
	adrp	x8, _amips_clut@GOTPAGE
Lloh18:
	ldr	x8, [x8, _amips_clut@GOTPAGEOFF]
LBB0_10:
	ldr	w8, [x8]
Lloh19:
	adrp	x9, _amips_clut_f@GOTPAGE
Lloh20:
	ldr	x9, [x9, _amips_clut_f@GOTPAGEOFF]
Lloh21:
	str	w8, [x9]
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGotStr	Lloh19, Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_VRAM_CACHED_STUFF,8,3          ; @VRAM_CACHED_STUFF
	.comm	_HighCol,8,3                    ; @HighCol
	.comm	_Pico,16,3                      ; @Pico
	.comm	_dynamic_palette,8,3            ; @dynamic_palette
	.comm	_rendstatus,4,2                 ; @rendstatus
	.comm	_PDRAW_SPR_LO_ON_HI,4,2         ; @PDRAW_SPR_LO_ON_HI
	.comm	_amips_clut_6bit,4,2            ; @amips_clut_6bit
	.comm	_amips_clut_f,4,2               ; @amips_clut_f
	.comm	_amips_clut,4,2                 ; @amips_clut
	.no_dead_strip	_EmuScanPrepare
.subsections_via_symbols
