	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function blitscreen_clut
_blitscreen_clut:                       ## @blitscreen_clut
	.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
	movq	_fbimg_offs@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movq	_psp_screen@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_VRAM_FB0@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_1
## %bb.2:
	movq	_VRAMOFFS_FB0@GOTPCREL(%rip), %rax
	jmp	LBB0_3
LBB0_1:
	movq	_VRAMOFFS_FB1@GOTPCREL(%rip), %rax
LBB0_3:
	addl	(%rax), %ebx
	xorl	%edi, %edi
	xorl	%esi, %esi
	callq	_sceGuSync
	movq	_GU_DIRECT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_guCmdList@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_sceGuStart
	movq	_GU_PSM_5650@GOTPCREL(%rip), %r14
	movl	(%r14), %edi
	movslq	%ebx, %rsi
	movl	$512, %edx                      ## imm = 0x200
	callq	_sceGuDrawBuffer
	movq	_dynamic_palette@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	movq	_blit_16bit_mode@GOTPCREL(%rip), %rbx
	movl	(%rbx), %eax
	je	LBB0_6
## %bb.4:
	testl	%eax, %eax
	jne	LBB0_13
## %bb.5:
	movl	(%r14), %edi
	xorl	%esi, %esi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	callq	_sceGuTexMode
	movq	_VRAM_STUFF@GOTPCREL(%rip), %rax
	movl	$122880, %r8d                   ## imm = 0x1E000
	addq	(%rax), %r8
	xorl	%edi, %edi
	movl	$512, %esi                      ## imm = 0x200
	movl	$512, %edx                      ## imm = 0x200
	movl	$512, %ecx                      ## imm = 0x200
	callq	_sceGuTexImage
	movl	$1, (%rbx)
	jmp	LBB0_13
LBB0_6:
	testl	%eax, %eax
	je	LBB0_8
## %bb.7:
	movl	(%r14), %edi
	xorl	%esi, %esi
	movl	$255, %edx
	xorl	%ecx, %ecx
	callq	_sceGuClutMode
	movq	_GU_PSM_T8@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	xorl	%esi, %esi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	callq	_sceGuTexMode
	movq	_VRAM_STUFF@GOTPCREL(%rip), %rax
	movq	(%rax), %r8
	addq	$16, %r8
	xorl	%edi, %edi
	movl	$512, %esi                      ## imm = 0x200
	movl	$512, %edx                      ## imm = 0x200
	movl	$512, %ecx                      ## imm = 0x200
	callq	_sceGuTexImage
	movl	$0, (%rbx)
LBB0_8:
	movq	_PicoOpt@GOTPCREL(%rip), %rax
	testb	$16, (%rax)
	je	LBB0_11
## %bb.9:
	movq	_Pico@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_11
## %bb.10:
	xorl	%edi, %edi
	xorl	%esi, %esi
	callq	_do_pal_update
LBB0_11:
	xorl	%eax, %eax
	callq	_sceKernelDcacheWritebackAll
	movq	_need_pal_upload@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_13
## %bb.12:
	movq	$0, (%rax)
	movq	_localPal@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$32, %edi
	callq	_sceGuClutLoad
LBB0_13:
	movq	_g_vertices@GOTPCREL(%rip), %r14
	movq	(%r14), %r8
	cmpq	$0, (%r8)
	jne	LBB0_18
## %bb.14:
	movq	16(%r8), %rax
	cmpq	24(%r8), %rax
	jne	LBB0_18
## %bb.15:
	testq	%rax, %rax
	jle	LBB0_19
## %bb.16:
	xorl	%ebx, %ebx
	movq	_GU_VERTEX_16BIT@GOTPCREL(%rip), %r12
	movq	_GU_TRANSFORM_2D@GOTPCREL(%rip), %r13
	.p2align	4, 0x90
LBB0_17:                                ## =>This Inner Loop Header: Depth=1
	movl	$32, %edi
	callq	_sceGuGetMemory
	movq	%rax, %r15
	movq	(%r14), %rsi
	movq	%rax, %rdi
	movl	$32, %edx
	callq	_memcpy
	movq	%rbx, 8(%r15)
	movq	%rbx, (%r15)
	addq	$32, %rbx
	movq	%rbx, 24(%r15)
	movq	%rbx, 16(%r15)
	movq	_GU_SPRITES@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	(%r12), %esi
	movq	_GU_TEXTURE_16BIT@GOTPCREL(%rip), %rax
	orl	(%rax), %esi
	orl	(%r13), %esi
	movl	$2, %edx
	xorl	%ecx, %ecx
	movq	%r15, %r8
	callq	_sceGuDrawArray
	movq	(%r14), %rax
	cmpq	%rbx, 24(%rax)
	jg	LBB0_17
	jmp	LBB0_19
LBB0_18:
	movq	_GU_SPRITES@GOTPCREL(%rip), %rax
	movq	_GU_TEXTURE_16BIT@GOTPCREL(%rip), %rcx
	movq	_GU_VERTEX_16BIT@GOTPCREL(%rip), %rdx
	movl	(%rdx), %esi
	orl	(%rcx), %esi
	movl	(%rax), %edi
	movq	_GU_TRANSFORM_2D@GOTPCREL(%rip), %rax
	orl	(%rax), %esi
	movl	$2, %edx
	xorl	%ecx, %ecx
	callq	_sceGuDrawArray
LBB0_19:
	xorl	%eax, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_sceGuFinish                    ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_fbimg_offs,4,2                 ## @fbimg_offs
	.comm	_psp_screen,8,3                 ## @psp_screen
	.comm	_VRAM_FB0,8,3                   ## @VRAM_FB0
	.comm	_VRAMOFFS_FB0,8,3               ## @VRAMOFFS_FB0
	.comm	_VRAMOFFS_FB1,8,3               ## @VRAMOFFS_FB1
	.comm	_GU_DIRECT,4,2                  ## @GU_DIRECT
	.comm	_guCmdList,4,2                  ## @guCmdList
	.comm	_GU_PSM_5650,4,2                ## @GU_PSM_5650
	.comm	_dynamic_palette,8,3            ## @dynamic_palette
	.comm	_blit_16bit_mode,4,2            ## @blit_16bit_mode
	.comm	_VRAM_STUFF,8,3                 ## @VRAM_STUFF
	.comm	_GU_PSM_T8,4,2                  ## @GU_PSM_T8
	.comm	_PicoOpt,4,2                    ## @PicoOpt
	.comm	_Pico,8,3                       ## @Pico
	.comm	_need_pal_upload,8,3            ## @need_pal_upload
	.comm	_localPal,4,2                   ## @localPal
	.comm	_g_vertices,8,3                 ## @g_vertices
	.comm	_GU_SPRITES,4,2                 ## @GU_SPRITES
	.comm	_GU_TEXTURE_16BIT,4,2           ## @GU_TEXTURE_16BIT
	.comm	_GU_VERTEX_16BIT,4,2            ## @GU_VERTEX_16BIT
	.comm	_GU_TRANSFORM_2D,4,2            ## @GU_TRANSFORM_2D
	.comm	_SLICE_WIDTH,4,2                ## @SLICE_WIDTH
	.no_dead_strip	_blitscreen_clut
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function blitscreen_clut
_blitscreen_clut:                       ; @blitscreen_clut
	.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
Lloh0:
	adrp	x8, _fbimg_offs@GOTPAGE
Lloh1:
	ldr	x8, [x8, _fbimg_offs@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x9, _psp_screen@GOTPAGE
Lloh4:
	ldr	x9, [x9, _psp_screen@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
Lloh6:
	adrp	x10, _VRAM_FB0@GOTPAGE
Lloh7:
	ldr	x10, [x10, _VRAM_FB0@GOTPAGEOFF]
Lloh8:
	ldr	x10, [x10]
Lloh9:
	adrp	x11, _VRAMOFFS_FB0@GOTPAGE
Lloh10:
	ldr	x11, [x11, _VRAMOFFS_FB0@GOTPAGEOFF]
Lloh11:
	adrp	x12, _VRAMOFFS_FB1@GOTPAGE
Lloh12:
	ldr	x12, [x12, _VRAMOFFS_FB1@GOTPAGEOFF]
	cmp	x9, x10
	csel	x9, x11, x12, eq
	ldr	w9, [x9]
	add	w19, w8, w9
	mov	w0, #0
	mov	w1, #0
	bl	_sceGuSync
Lloh13:
	adrp	x8, _GU_DIRECT@GOTPAGE
Lloh14:
	ldr	x8, [x8, _GU_DIRECT@GOTPAGEOFF]
Lloh15:
	ldr	w0, [x8]
Lloh16:
	adrp	x8, _guCmdList@GOTPAGE
Lloh17:
	ldr	x8, [x8, _guCmdList@GOTPAGEOFF]
Lloh18:
	ldr	w1, [x8]
	bl	_sceGuStart
Lloh19:
	adrp	x20, _GU_PSM_5650@GOTPAGE
Lloh20:
	ldr	x20, [x20, _GU_PSM_5650@GOTPAGEOFF]
	ldr	w0, [x20]
	sxtw	x1, w19
	mov	w2, #512
	bl	_sceGuDrawBuffer
Lloh21:
	adrp	x8, _dynamic_palette@GOTPAGE
Lloh22:
	ldr	x8, [x8, _dynamic_palette@GOTPAGEOFF]
Lloh23:
	ldr	x9, [x8]
Lloh24:
	adrp	x19, _blit_16bit_mode@GOTPAGE
Lloh25:
	ldr	x19, [x19, _blit_16bit_mode@GOTPAGEOFF]
	ldr	w8, [x19]
	cbz	x9, LBB0_3
; %bb.1:
	cbnz	w8, LBB0_10
; %bb.2:
	ldr	w0, [x20]
	mov	w1, #0
	mov	w2, #0
	mov	w3, #0
	bl	_sceGuTexMode
Lloh26:
	adrp	x8, _VRAM_STUFF@GOTPAGE
Lloh27:
	ldr	x8, [x8, _VRAM_STUFF@GOTPAGEOFF]
Lloh28:
	ldr	x8, [x8]
	add	x4, x8, #30, lsl #12            ; =122880
	mov	w0, #0
	mov	w1, #512
	mov	w2, #512
	mov	w3, #512
	bl	_sceGuTexImage
	mov	w8, #1
	str	w8, [x19]
	b	LBB0_10
LBB0_3:
	cbz	w8, LBB0_5
; %bb.4:
	ldr	w0, [x20]
	mov	w1, #0
	mov	w2, #255
	mov	w3, #0
	bl	_sceGuClutMode
Lloh29:
	adrp	x8, _GU_PSM_T8@GOTPAGE
Lloh30:
	ldr	x8, [x8, _GU_PSM_T8@GOTPAGEOFF]
Lloh31:
	ldr	w0, [x8]
	mov	w1, #0
	mov	w2, #0
	mov	w3, #0
	bl	_sceGuTexMode
Lloh32:
	adrp	x8, _VRAM_STUFF@GOTPAGE
Lloh33:
	ldr	x8, [x8, _VRAM_STUFF@GOTPAGEOFF]
Lloh34:
	ldr	x8, [x8]
	add	x4, x8, #16
	mov	w0, #0
	mov	w1, #512
	mov	w2, #512
	mov	w3, #512
	bl	_sceGuTexImage
	str	wzr, [x19]
LBB0_5:
Lloh35:
	adrp	x8, _PicoOpt@GOTPAGE
Lloh36:
	ldr	x8, [x8, _PicoOpt@GOTPAGEOFF]
	ldrb	w8, [x8]
	tbz	w8, #4, LBB0_8
; %bb.6:
Lloh37:
	adrp	x8, _Pico@GOTPAGE
Lloh38:
	ldr	x8, [x8, _Pico@GOTPAGEOFF]
Lloh39:
	ldr	x8, [x8]
	cbz	x8, LBB0_8
; %bb.7:
	mov	w0, #0
	mov	w1, #0
	bl	_do_pal_update
LBB0_8:
	bl	_sceKernelDcacheWritebackAll
Lloh40:
	adrp	x8, _need_pal_upload@GOTPAGE
Lloh41:
	ldr	x8, [x8, _need_pal_upload@GOTPAGEOFF]
	ldr	x9, [x8]
	cbz	x9, LBB0_10
; %bb.9:
	str	xzr, [x8]
Lloh42:
	adrp	x8, _localPal@GOTPAGE
Lloh43:
	ldr	x8, [x8, _localPal@GOTPAGEOFF]
Lloh44:
	ldr	w1, [x8]
	mov	w0, #32
	bl	_sceGuClutLoad
LBB0_10:
Lloh45:
	adrp	x20, _g_vertices@GOTPAGE
Lloh46:
	ldr	x20, [x20, _g_vertices@GOTPAGEOFF]
	ldr	x4, [x20]
	ldr	x8, [x4]
	cbnz	x8, LBB0_15
; %bb.11:
	ldp	x8, x9, [x4, #16]
	cmp	x8, x9
	b.ne	LBB0_15
; %bb.12:
	cmp	x8, #1
	b.lt	LBB0_16
; %bb.13:
	mov	x21, #0
Lloh47:
	adrp	x22, _GU_SPRITES@GOTPAGE
Lloh48:
	ldr	x22, [x22, _GU_SPRITES@GOTPAGEOFF]
Lloh49:
	adrp	x23, _GU_TEXTURE_16BIT@GOTPAGE
Lloh50:
	ldr	x23, [x23, _GU_TEXTURE_16BIT@GOTPAGEOFF]
Lloh51:
	adrp	x24, _GU_VERTEX_16BIT@GOTPAGE
Lloh52:
	ldr	x24, [x24, _GU_VERTEX_16BIT@GOTPAGEOFF]
Lloh53:
	adrp	x25, _GU_TRANSFORM_2D@GOTPAGE
Lloh54:
	ldr	x25, [x25, _GU_TRANSFORM_2D@GOTPAGEOFF]
LBB0_14:                                ; =>This Inner Loop Header: Depth=1
	mov	w0, #32
	bl	_sceGuGetMemory
	mov	x19, x0
	ldr	x1, [x20]
	mov	w2, #32
	bl	_memcpy
	stp	x21, x21, [x19]
	add	x21, x21, #32
	stp	x21, x21, [x19, #16]
	ldr	w0, [x22]
	ldr	w8, [x23]
	ldr	w9, [x24]
	orr	w8, w9, w8
	ldr	w9, [x25]
	orr	w1, w8, w9
	mov	w2, #2
	mov	w3, #0
	mov	x4, x19
	bl	_sceGuDrawArray
	ldr	x8, [x20]
	ldr	x8, [x8, #24]
	cmp	x8, x21
	b.gt	LBB0_14
	b	LBB0_16
LBB0_15:
Lloh55:
	adrp	x8, _GU_SPRITES@GOTPAGE
Lloh56:
	ldr	x8, [x8, _GU_SPRITES@GOTPAGEOFF]
Lloh57:
	ldr	w0, [x8]
Lloh58:
	adrp	x8, _GU_TEXTURE_16BIT@GOTPAGE
Lloh59:
	ldr	x8, [x8, _GU_TEXTURE_16BIT@GOTPAGEOFF]
Lloh60:
	ldr	w8, [x8]
Lloh61:
	adrp	x9, _GU_VERTEX_16BIT@GOTPAGE
Lloh62:
	ldr	x9, [x9, _GU_VERTEX_16BIT@GOTPAGEOFF]
Lloh63:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh64:
	adrp	x9, _GU_TRANSFORM_2D@GOTPAGE
Lloh65:
	ldr	x9, [x9, _GU_TRANSFORM_2D@GOTPAGEOFF]
Lloh66:
	ldr	w9, [x9]
	orr	w1, w8, w9
	mov	w2, #2
	mov	w3, #0
	bl	_sceGuDrawArray
LBB0_16:
	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
	b	_sceGuFinish
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGot	Lloh35, Lloh36
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.loh AdrpLdrGot	Lloh40, Lloh41
	.loh AdrpLdrGotLdr	Lloh42, Lloh43, Lloh44
	.loh AdrpLdrGot	Lloh45, Lloh46
	.loh AdrpLdrGot	Lloh53, Lloh54
	.loh AdrpLdrGot	Lloh51, Lloh52
	.loh AdrpLdrGot	Lloh49, Lloh50
	.loh AdrpLdrGot	Lloh47, Lloh48
	.loh AdrpLdrGotLdr	Lloh64, Lloh65, Lloh66
	.loh AdrpLdrGotLdr	Lloh61, Lloh62, Lloh63
	.loh AdrpLdrGotLdr	Lloh58, Lloh59, Lloh60
	.loh AdrpLdrGotLdr	Lloh55, Lloh56, Lloh57
	.cfi_endproc
                                        ; -- End function
	.comm	_fbimg_offs,4,2                 ; @fbimg_offs
	.comm	_psp_screen,8,3                 ; @psp_screen
	.comm	_VRAM_FB0,8,3                   ; @VRAM_FB0
	.comm	_VRAMOFFS_FB0,8,3               ; @VRAMOFFS_FB0
	.comm	_VRAMOFFS_FB1,8,3               ; @VRAMOFFS_FB1
	.comm	_GU_DIRECT,4,2                  ; @GU_DIRECT
	.comm	_guCmdList,4,2                  ; @guCmdList
	.comm	_GU_PSM_5650,4,2                ; @GU_PSM_5650
	.comm	_dynamic_palette,8,3            ; @dynamic_palette
	.comm	_blit_16bit_mode,4,2            ; @blit_16bit_mode
	.comm	_VRAM_STUFF,8,3                 ; @VRAM_STUFF
	.comm	_GU_PSM_T8,4,2                  ; @GU_PSM_T8
	.comm	_PicoOpt,4,2                    ; @PicoOpt
	.comm	_Pico,8,3                       ; @Pico
	.comm	_need_pal_upload,8,3            ; @need_pal_upload
	.comm	_localPal,4,2                   ; @localPal
	.comm	_g_vertices,8,3                 ; @g_vertices
	.comm	_GU_SPRITES,4,2                 ; @GU_SPRITES
	.comm	_GU_TEXTURE_16BIT,4,2           ; @GU_TEXTURE_16BIT
	.comm	_GU_VERTEX_16BIT,4,2            ; @GU_VERTEX_16BIT
	.comm	_GU_TRANSFORM_2D,4,2            ; @GU_TRANSFORM_2D
	.comm	_SLICE_WIDTH,4,2                ; @SLICE_WIDTH
	.no_dead_strip	_blitscreen_clut
.subsections_via_symbols
