	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ps2_texture_upload
_ps2_texture_upload:                    ## @ps2_texture_upload
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movl	%edx, %r14d
	movq	%rsi, %rbx
	movq	%rsi, %rdi
	callq	_gsKit_setup_tbw
	movq	(%rbx), %r8
	movq	_GS_PSM_T8@GOTPCREL(%rip), %rax
	cmpq	(%rax), %r8
	jne	LBB0_6
## %bb.1:
	movl	36(%rbx), %edi
	movl	8(%rbx), %esi
	movl	12(%rbx), %edx
	movl	32(%rbx), %ecx
	movl	16(%rbx), %r9d
	movq	_GS_CLUT_TEXTURE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%rsp)
	callq	_gsKit_texture_send
	testl	%r14d, %r14d
	je	LBB0_5
## %bb.2:
	movl	44(%rbx), %edi
	movl	40(%rbx), %ecx
	movq	24(%rbx), %r8
	movq	_GS_CLUT_PALLETE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%rsp)
	movl	$16, %esi
	movl	$16, %edx
	jmp	LBB0_3
LBB0_6:
	movq	_GS_PSM_T4@GOTPCREL(%rip), %rax
	movl	36(%rbx), %edi
	movl	8(%rbx), %esi
	movl	12(%rbx), %edx
	movl	32(%rbx), %ecx
	movl	16(%rbx), %r9d
	cmpq	(%rax), %r8
	jne	LBB0_9
## %bb.7:
	movq	_GS_CLUT_TEXTURE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%rsp)
	callq	_gsKit_texture_send
	testl	%r14d, %r14d
	je	LBB0_5
## %bb.8:
	movl	44(%rbx), %edi
	movl	40(%rbx), %ecx
	movq	24(%rbx), %r8
	movq	_GS_CLUT_PALLETE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%rsp)
	movl	$8, %esi
	movl	$2, %edx
LBB0_3:
	movl	$1, %r9d
	jmp	LBB0_4
LBB0_9:
	movq	_GS_CLUT_NONE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%rsp)
LBB0_4:
	callq	_gsKit_texture_send
LBB0_5:
	addq	$16, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_GS_PSM_T8,8,3                  ## @GS_PSM_T8
	.comm	_GS_CLUT_TEXTURE,4,2            ## @GS_CLUT_TEXTURE
	.comm	_GS_CLUT_PALLETE,4,2            ## @GS_CLUT_PALLETE
	.comm	_GS_PSM_T4,8,3                  ## @GS_PSM_T4
	.comm	_GS_CLUT_NONE,4,2               ## @GS_CLUT_NONE
	.no_dead_strip	_ps2_texture_upload
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ps2_texture_upload
_ps2_texture_upload:                    ; @ps2_texture_upload
	.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
	mov	x20, x2
	mov	x19, x1
	mov	x0, x1
	bl	_gsKit_setup_tbw
	ldr	x4, [x19]
Lloh0:
	adrp	x8, _GS_PSM_T8@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GS_PSM_T8@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cmp	x4, x8
	b.ne	LBB0_3
; %bb.1:
	ldp	w1, w2, [x19, #8]
	ldp	w3, w0, [x19, #32]
	ldr	w5, [x19, #16]
Lloh3:
	adrp	x8, _GS_CLUT_TEXTURE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _GS_CLUT_TEXTURE@GOTPAGEOFF]
Lloh5:
	ldr	w6, [x8]
	bl	_gsKit_texture_send
	cbz	w20, LBB0_7
; %bb.2:
	ldp	w3, w0, [x19, #40]
	ldr	x4, [x19, #24]
Lloh6:
	adrp	x8, _GS_CLUT_PALLETE@GOTPAGE
Lloh7:
	ldr	x8, [x8, _GS_CLUT_PALLETE@GOTPAGEOFF]
Lloh8:
	ldr	w6, [x8]
	mov	w1, #16
	mov	w2, #16
	b	LBB0_6
LBB0_3:
Lloh9:
	adrp	x8, _GS_PSM_T4@GOTPAGE
Lloh10:
	ldr	x8, [x8, _GS_PSM_T4@GOTPAGEOFF]
Lloh11:
	ldr	x8, [x8]
	ldp	w1, w2, [x19, #8]
	ldp	w3, w0, [x19, #32]
	ldr	w5, [x19, #16]
	cmp	x4, x8
	b.ne	LBB0_8
; %bb.4:
Lloh12:
	adrp	x8, _GS_CLUT_TEXTURE@GOTPAGE
Lloh13:
	ldr	x8, [x8, _GS_CLUT_TEXTURE@GOTPAGEOFF]
Lloh14:
	ldr	w6, [x8]
	bl	_gsKit_texture_send
	cbz	w20, LBB0_7
; %bb.5:
	ldp	w3, w0, [x19, #40]
	ldr	x4, [x19, #24]
Lloh15:
	adrp	x8, _GS_CLUT_PALLETE@GOTPAGE
Lloh16:
	ldr	x8, [x8, _GS_CLUT_PALLETE@GOTPAGEOFF]
Lloh17:
	ldr	w6, [x8]
	mov	w1, #8
	mov	w2, #2
LBB0_6:
	mov	w5, #1
	b	LBB0_9
LBB0_7:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
LBB0_8:
Lloh18:
	adrp	x8, _GS_CLUT_NONE@GOTPAGE
Lloh19:
	ldr	x8, [x8, _GS_CLUT_NONE@GOTPAGEOFF]
Lloh20:
	ldr	w6, [x8]
LBB0_9:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	b	_gsKit_texture_send
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_GS_PSM_T8,8,3                  ; @GS_PSM_T8
	.comm	_GS_CLUT_TEXTURE,4,2            ; @GS_CLUT_TEXTURE
	.comm	_GS_CLUT_PALLETE,4,2            ; @GS_CLUT_PALLETE
	.comm	_GS_PSM_T4,8,3                  ; @GS_PSM_T4
	.comm	_GS_CLUT_NONE,4,2               ; @GS_CLUT_NONE
	.no_dead_strip	_ps2_texture_upload
.subsections_via_symbols
