	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_goya_context_switch            ## -- Begin function goya_context_switch
	.p2align	4, 0x90
_goya_context_switch:                   ## @goya_context_switch
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r12d
	movq	%rdi, %r14
	movl	16(%rdi), %esi
	movl	$65536, %edx                    ## imm = 0x10000
	cmpq	$0, 8(%rdi)
	jne	LBB0_2
## %bb.1:
	movl	20(%r14), %edx
LBB0_2:
	movq	_mmDMA_CH_1_WR_COMP_ADDR_LO@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movq	_mmDMA_CH_0_WR_COMP_ADDR_LO@GOTPCREL(%rip), %r13
	subl	(%r13), %ebx
	movq	%r14, %rdi
	movl	$2004318071, %ecx               ## imm = 0x77777777
	xorl	%r8d, %r8d
	callq	_goya_memset_device_memory
	testl	%eax, %eax
	je	LBB0_4
## %bb.3:
	movl	%eax, %r15d
	movl	(%r14), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_err
	jmp	LBB0_8
LBB0_4:
	movl	%r12d, -44(%rbp)                ## 4-byte Spill
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	movq	_CFG_BASE@GOTPCREL(%rip), %rcx
	movq	_mmSYNC_MNGR_SOB_OBJ_1007@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	addl	(%rcx), %edi
	movl	(%r13), %r14d
	callq	_lower_32_bits
	movl	%r14d, %edi
	movl	%eax, %esi
	callq	_WREG32
	movq	_NUMBER_OF_EXT_HW_QUEUES@GOTPCREL(%rip), %rax
	cmpl	$2, (%rax)
	jl	LBB0_7
## %bb.5:
	movq	%r13, %r14
	movl	$1, %r13d
	xorl	%r15d, %r15d
	movl	%ebx, %r12d
	movl	%ebx, -48(%rbp)                 ## 4-byte Spill
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movq	_mmSYNC_MNGR_SOB_OBJ_1000@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_CFG_BASE@GOTPCREL(%rip), %rax
	addl	(%rax), %edi
	addl	%r15d, %edi
	movl	(%r14), %ebx
	addl	%r12d, %ebx
	callq	_lower_32_bits
	movl	%ebx, %edi
	movl	%eax, %esi
	callq	_WREG32
	movq	_NUMBER_OF_EXT_HW_QUEUES@GOTPCREL(%rip), %rax
	movl	-48(%rbp), %ebx                 ## 4-byte Reload
	incl	%r13d
	addl	$4, %r15d
	addl	%ebx, %r12d
	cmpl	(%rax), %r13d
	jl	LBB0_6
LBB0_7:
	movq	_mmTPC_PLL_CLK_RLX_0@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	$2097184, %esi                  ## imm = 0x200020
	callq	_WREG32
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	callq	_goya_mmu_prepare
	movq	%rbx, %rdi
	callq	_goya_clear_sm_regs
	xorl	%r15d, %r15d
LBB0_8:
	movl	%r15d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_mmDMA_CH_1_WR_COMP_ADDR_LO,4,2 ## @mmDMA_CH_1_WR_COMP_ADDR_LO
	.comm	_mmDMA_CH_0_WR_COMP_ADDR_LO,4,2 ## @mmDMA_CH_0_WR_COMP_ADDR_LO
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to clear SRAM in context switch\n"

	.comm	_CFG_BASE,4,2                   ## @CFG_BASE
	.comm	_mmSYNC_MNGR_SOB_OBJ_1007,4,2   ## @mmSYNC_MNGR_SOB_OBJ_1007
	.comm	_NUMBER_OF_EXT_HW_QUEUES,4,2    ## @NUMBER_OF_EXT_HW_QUEUES
	.comm	_mmSYNC_MNGR_SOB_OBJ_1000,4,2   ## @mmSYNC_MNGR_SOB_OBJ_1000
	.comm	_mmTPC_PLL_CLK_RLX_0,4,2        ## @mmTPC_PLL_CLK_RLX_0
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_goya_context_switch            ; -- Begin function goya_context_switch
	.p2align	2
_goya_context_switch:                   ; @goya_context_switch
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x20, x1
	mov	x19, x0
	ldr	w1, [x0, #16]
	ldr	x8, [x0, #8]
	cbz	x8, LBB0_2
; %bb.1:
	mov	w2, #65536
	b	LBB0_3
LBB0_2:
	ldr	w2, [x19, #20]
LBB0_3:
Lloh0:
	adrp	x8, _mmDMA_CH_1_WR_COMP_ADDR_LO@GOTPAGE
Lloh1:
	ldr	x8, [x8, _mmDMA_CH_1_WR_COMP_ADDR_LO@GOTPAGEOFF]
Lloh2:
	ldr	w26, [x8]
Lloh3:
	adrp	x22, _mmDMA_CH_0_WR_COMP_ADDR_LO@GOTPAGE
Lloh4:
	ldr	x22, [x22, _mmDMA_CH_0_WR_COMP_ADDR_LO@GOTPAGEOFF]
	ldr	w27, [x22]
	mov	x0, x19
	mov	w3, #2004318071
	mov	w4, #0
	bl	_goya_memset_device_memory
	cbz	w0, LBB0_5
; %bb.4:
	mov	x21, x0
	ldr	w0, [x19]
Lloh5:
	adrp	x1, l_.str@PAGE
Lloh6:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	b	LBB0_9
LBB0_5:
	str	w20, [sp, #12]                  ; 4-byte Folded Spill
Lloh7:
	adrp	x23, _CFG_BASE@GOTPAGE
Lloh8:
	ldr	x23, [x23, _CFG_BASE@GOTPAGEOFF]
	ldr	w8, [x23]
Lloh9:
	adrp	x9, _mmSYNC_MNGR_SOB_OBJ_1007@GOTPAGE
Lloh10:
	ldr	x9, [x9, _mmSYNC_MNGR_SOB_OBJ_1007@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	add	w0, w9, w8
	ldr	w21, [x22]
	bl	_lower_32_bits
	mov	x1, x0
	mov	x0, x21
	bl	_WREG32
Lloh12:
	adrp	x24, _NUMBER_OF_EXT_HW_QUEUES@GOTPAGE
Lloh13:
	ldr	x24, [x24, _NUMBER_OF_EXT_HW_QUEUES@GOTPAGEOFF]
	ldr	w8, [x24]
	cmp	w8, #2
	b.lt	LBB0_8
; %bb.6:
	mov	w25, #0
	sub	w20, w26, w27
	mov	w27, #1
Lloh14:
	adrp	x28, _mmSYNC_MNGR_SOB_OBJ_1000@GOTPAGE
Lloh15:
	ldr	x28, [x28, _mmSYNC_MNGR_SOB_OBJ_1000@GOTPAGEOFF]
	mov	x26, x20
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w8, [x23]
	ldr	w9, [x28]
	add	w8, w9, w8
	add	w0, w25, w8
	ldr	w8, [x22]
	add	w21, w26, w8
	bl	_lower_32_bits
	mov	x1, x0
	mov	x0, x21
	bl	_WREG32
	add	w27, w27, #1
	ldr	w8, [x24]
	add	w25, w25, #4
	add	w26, w26, w20
	cmp	w27, w8
	b.lt	LBB0_7
LBB0_8:
Lloh16:
	adrp	x8, _mmTPC_PLL_CLK_RLX_0@GOTPAGE
Lloh17:
	ldr	x8, [x8, _mmTPC_PLL_CLK_RLX_0@GOTPAGEOFF]
Lloh18:
	ldr	w0, [x8]
	mov	w1, #2097184
	bl	_WREG32
	mov	x0, x19
	ldr	w1, [sp, #12]                   ; 4-byte Folded Reload
	bl	_goya_mmu_prepare
	mov	x0, x19
	bl	_goya_clear_sm_regs
	mov	w21, #0
LBB0_9:
	mov	x0, x21
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.comm	_mmDMA_CH_1_WR_COMP_ADDR_LO,4,2 ; @mmDMA_CH_1_WR_COMP_ADDR_LO
	.comm	_mmDMA_CH_0_WR_COMP_ADDR_LO,4,2 ; @mmDMA_CH_0_WR_COMP_ADDR_LO
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to clear SRAM in context switch\n"

	.comm	_CFG_BASE,4,2                   ; @CFG_BASE
	.comm	_mmSYNC_MNGR_SOB_OBJ_1007,4,2   ; @mmSYNC_MNGR_SOB_OBJ_1007
	.comm	_NUMBER_OF_EXT_HW_QUEUES,4,2    ; @NUMBER_OF_EXT_HW_QUEUES
	.comm	_mmSYNC_MNGR_SOB_OBJ_1000,4,2   ; @mmSYNC_MNGR_SOB_OBJ_1000
	.comm	_mmTPC_PLL_CLK_RLX_0,4,2        ; @mmTPC_PLL_CLK_RLX_0
.subsections_via_symbols
