	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function goya_config_spmu
_goya_config_spmu:                      ## @goya_config_spmu
	.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
	movq	%rsi, %rbx
	movq	%rdi, %r15
	movq	(%rsi), %r12
	movq	_debug_spmu_regs@GOTPCREL(%rip), %r14
	movq	(%r14), %rdi
	callq	_ARRAY_SIZE
	cmpq	%rax, %r12
	jae	LBB0_5
## %bb.1:
	movq	(%r14), %rax
	movq	(%rbx), %rcx
	movl	(%rax,%rcx,4), %r14d
	movq	_CFG_BASE@GOTPCREL(%rip), %rax
	subl	(%rax), %r14d
	cmpq	$0, 32(%rbx)
	je	LBB0_9
## %bb.2:
	movq	24(%rbx), %r12
	testq	%r12, %r12
	je	LBB0_7
## %bb.3:
	movl	(%r12), %eax
	cmpl	$2, %eax
	jg	LBB0_12
## %bb.4:
	movl	(%r15), %edi
	leaq	L_.str.1(%rip), %rsi
	jmp	LBB0_6
LBB0_5:
	movl	(%r15), %edi
	leaq	L_.str(%rip), %rsi
LBB0_6:
	callq	_dev_err
LBB0_7:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_8:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_9:
	movq	8(%rbx), %r12
	movl	16(%rbx), %eax
	leal	7(%rax), %ecx
	testl	%eax, %eax
	cmovnsl	%eax, %ecx
	testq	%r12, %r12
	je	LBB0_7
## %bb.10:
	cmpl	$23, %eax
	jg	LBB0_14
## %bb.11:
	movl	(%r15), %edi
	leaq	L_.str.3(%rip), %rsi
	jmp	LBB0_6
LBB0_12:
	movq	_SPMU_MAX_COUNTERS@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jle	LBB0_16
## %bb.13:
	movl	(%r15), %edi
	leaq	L_.str.2(%rip), %rsi
	jmp	LBB0_6
LBB0_14:
	sarl	$3, %ecx
	leal	-2(%rcx), %ebx
	movq	_SPMU_MAX_COUNTERS@GOTPCREL(%rip), %rax
	cmpl	(%rax), %ebx
	jle	LBB0_20
## %bb.15:
	movl	(%r15), %edi
	leaq	L_.str.4(%rip), %rsi
	jmp	LBB0_6
LBB0_16:
	leal	3588(%r14), %ebx
	movl	%ebx, %edi
	movl	$1090596934, %esi               ## imm = 0x41013046
	callq	_WREG32
	movl	%ebx, -48(%rbp)                 ## 4-byte Spill
	movl	%ebx, %edi
	movl	$1090596928, %esi               ## imm = 0x41013040
	callq	_WREG32
	cmpl	$0, (%r12)
	jle	LBB0_19
## %bb.17:
	xorl	%ebx, %ebx
	movq	_SPMU_EVENT_TYPES_OFFSET@GOTPCREL(%rip), %r13
	movl	%r14d, %r15d
	.p2align	4, 0x90
LBB0_18:                                ## =>This Inner Loop Header: Depth=1
	movl	(%r13), %edi
	addl	%r15d, %edi
	movq	8(%r12), %rax
	movl	(%rax,%rbx,4), %esi
	callq	_WREG32
	incq	%rbx
	movslq	(%r12), %rax
	addl	$4, %r15d
	cmpq	%rax, %rbx
	jl	LBB0_18
LBB0_19:
	movl	-48(%rbp), %edi                 ## 4-byte Reload
	movl	$1090596929, %esi               ## imm = 0x41013041
	callq	_WREG32
	addl	$3072, %r14d                    ## imm = 0xC00
	movl	%r14d, %edi
	movl	$-2147483585, %esi              ## imm = 0x8000003F
	callq	_WREG32
	xorl	%ebx, %ebx
	jmp	LBB0_8
LBB0_20:
	decl	%ecx
	movq	%rcx, -48(%rbp)                 ## 8-byte Spill
	leal	3588(%r14), %edi
	movl	$1090596928, %esi               ## imm = 0x41013040
	callq	_WREG32
	cmpl	$2, %ebx
	movl	$1, %r15d
	movl	%ebx, -52(%rbp)                 ## 4-byte Spill
	cmovgel	%ebx, %r15d
	xorl	%r13d, %r13d
	movl	%r14d, %ebx
	.p2align	4, 0x90
LBB0_21:                                ## =>This Inner Loop Header: Depth=1
	movl	%ebx, %edi
	callq	_RREG32
	movl	%eax, (%r12,%r13,4)
	incq	%r13
	addl	$8, %ebx
	cmpq	%r13, %r15
	jne	LBB0_21
## %bb.22:
	leal	3264(%r14), %r15d
	movl	%r15d, %edi
	callq	_RREG32
	movslq	-52(%rbp), %rcx                 ## 4-byte Folded Reload
	movl	%eax, (%r12,%rcx,4)
	leal	252(%r14), %edi
	callq	_RREG32
	movslq	-48(%rbp), %rbx                 ## 4-byte Folded Reload
	addl	$248, %r14d
	movl	%r14d, %edi
	callq	_RREG32
	orl	%eax, (%r12,%rbx,4)
	xorl	%ebx, %ebx
	movl	%r15d, %edi
	xorl	%esi, %esi
	callq	_WREG32
	jmp	LBB0_8
	.cfi_endproc
                                        ## -- End function
	.comm	_debug_spmu_regs,8,3            ## @debug_spmu_regs
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Invalid register index in SPMU\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_CFG_BASE,4,2                   ## @CFG_BASE
L_.str.1:                               ## @.str.1
	.asciz	"not enough event types values for SPMU enable\n"

	.comm	_SPMU_MAX_COUNTERS,4,2          ## @SPMU_MAX_COUNTERS
L_.str.2:                               ## @.str.2
	.asciz	"too many event types values for SPMU enable\n"

	.comm	_SPMU_EVENT_TYPES_OFFSET,4,2    ## @SPMU_EVENT_TYPES_OFFSET
L_.str.3:                               ## @.str.3
	.asciz	"not enough values for SPMU disable\n"

L_.str.4:                               ## @.str.4
	.asciz	"too many events values for SPMU disable\n"

	.no_dead_strip	_goya_config_spmu
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function goya_config_spmu
_goya_config_spmu:                      ; @goya_config_spmu
	.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
	mov	x20, x1
	mov	x19, x0
	ldr	x22, [x1]
Lloh0:
	adrp	x21, _debug_spmu_regs@GOTPAGE
Lloh1:
	ldr	x21, [x21, _debug_spmu_regs@GOTPAGEOFF]
	ldr	x0, [x21]
	bl	_ARRAY_SIZE
	cmp	x22, x0
	b.hs	LBB0_5
; %bb.1:
	ldr	x8, [x21]
	ldr	x9, [x20]
	ldr	w8, [x8, x9, lsl #2]
Lloh2:
	adrp	x9, _CFG_BASE@GOTPAGE
Lloh3:
	ldr	x9, [x9, _CFG_BASE@GOTPAGEOFF]
Lloh4:
	ldr	w9, [x9]
	sub	w21, w8, w9
	ldr	x8, [x20, #32]
	cbz	x8, LBB0_9
; %bb.2:
	ldr	x20, [x20, #24]
	cbz	x20, LBB0_7
; %bb.3:
	ldr	w8, [x20]
	cmp	w8, #2
	b.gt	LBB0_12
; %bb.4:
	ldr	w0, [x19]
Lloh5:
	adrp	x1, l_.str.1@PAGE
Lloh6:
	add	x1, x1, l_.str.1@PAGEOFF
	b	LBB0_6
LBB0_5:
	ldr	w0, [x19]
Lloh7:
	adrp	x1, l_.str@PAGE
Lloh8:
	add	x1, x1, l_.str@PAGEOFF
LBB0_6:
	bl	_dev_err
LBB0_7:
Lloh9:
	adrp	x8, _EINVAL@GOTPAGE
Lloh10:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_8:
	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
	ret
LBB0_9:
	ldr	x22, [x20, #8]
	ldr	w9, [x20, #16]
	add	w8, w9, #7
	cmp	w9, #0
	csel	w8, w8, w9, lt
	cbz	x22, LBB0_7
; %bb.10:
	cmp	w9, #23
	b.gt	LBB0_14
; %bb.11:
	ldr	w0, [x19]
Lloh12:
	adrp	x1, l_.str.3@PAGE
Lloh13:
	add	x1, x1, l_.str.3@PAGEOFF
	b	LBB0_6
LBB0_12:
Lloh14:
	adrp	x9, _SPMU_MAX_COUNTERS@GOTPAGE
Lloh15:
	ldr	x9, [x9, _SPMU_MAX_COUNTERS@GOTPAGEOFF]
Lloh16:
	ldr	w9, [x9]
	cmp	w8, w9
	b.le	LBB0_16
; %bb.13:
	ldr	w0, [x19]
Lloh17:
	adrp	x1, l_.str.2@PAGE
Lloh18:
	add	x1, x1, l_.str.2@PAGEOFF
	b	LBB0_6
LBB0_14:
	sbfx	x8, x8, #3, #29
	sub	x20, x8, #2
Lloh19:
	adrp	x9, _SPMU_MAX_COUNTERS@GOTPAGE
Lloh20:
	ldr	x9, [x9, _SPMU_MAX_COUNTERS@GOTPAGEOFF]
Lloh21:
	ldr	w9, [x9]
	cmp	w20, w9
	b.le	LBB0_20
; %bb.15:
	ldr	w0, [x19]
Lloh22:
	adrp	x1, l_.str.4@PAGE
Lloh23:
	add	x1, x1, l_.str.4@PAGEOFF
	b	LBB0_6
LBB0_16:
	mov	w22, #12352
	movk	w22, #16641, lsl #16
	add	w19, w21, #3588
	orr	w1, w22, #0x6
	mov	x0, x19
	bl	_WREG32
	mov	x0, x19
	mov	w1, #12352
	movk	w1, #16641, lsl #16
	bl	_WREG32
	ldr	w8, [x20]
	cmp	w8, #1
	b.lt	LBB0_19
; %bb.17:
	mov	x23, #0
Lloh24:
	adrp	x24, _SPMU_EVENT_TYPES_OFFSET@GOTPAGE
Lloh25:
	ldr	x24, [x24, _SPMU_EVENT_TYPES_OFFSET@GOTPAGEOFF]
	mov	x25, x21
LBB0_18:                                ; =>This Inner Loop Header: Depth=1
	ldr	w8, [x24]
	add	w0, w25, w8
	ldr	x8, [x20, #8]
	ldr	w1, [x8, x23, lsl #2]
	bl	_WREG32
	add	x23, x23, #1
	ldrsw	x8, [x20]
	add	w25, w25, #4
	cmp	x23, x8
	b.lt	LBB0_18
LBB0_19:
	add	w1, w22, #1
	mov	x0, x19
	bl	_WREG32
	add	w0, w21, #3072
	mov	w1, #-2147483585
	b	LBB0_23
LBB0_20:
	sub	x23, x8, #1
	add	w0, w21, #3588
	mov	w1, #12352
	movk	w1, #16641, lsl #16
	bl	_WREG32
	cmp	w20, #1
	csinc	w24, w20, wzr, gt
	mov	x25, x22
	mov	x19, x21
LBB0_21:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x19
	bl	_RREG32
	str	w0, [x25], #4
	add	w19, w19, #8
	subs	x24, x24, #1
	b.ne	LBB0_21
; %bb.22:
	add	w19, w21, #3264
	mov	x0, x19
	bl	_RREG32
	str	w0, [x22, x20, lsl #2]
	add	w0, w21, #252
	bl	_RREG32
	lsl	x20, x23, #2
	add	w0, w21, #248
	bl	_RREG32
	ldr	w8, [x22, x20]
	orr	w8, w8, w0
	str	w8, [x22, x20]
	mov	x0, x19
	mov	w1, #0
LBB0_23:
	bl	_WREG32
	mov	w0, #0
	b	LBB0_8
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.comm	_debug_spmu_regs,8,3            ; @debug_spmu_regs
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Invalid register index in SPMU\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_CFG_BASE,4,2                   ; @CFG_BASE
l_.str.1:                               ; @.str.1
	.asciz	"not enough event types values for SPMU enable\n"

	.comm	_SPMU_MAX_COUNTERS,4,2          ; @SPMU_MAX_COUNTERS
l_.str.2:                               ; @.str.2
	.asciz	"too many event types values for SPMU enable\n"

	.comm	_SPMU_EVENT_TYPES_OFFSET,4,2    ; @SPMU_EVENT_TYPES_OFFSET
l_.str.3:                               ; @.str.3
	.asciz	"not enough values for SPMU disable\n"

l_.str.4:                               ; @.str.4
	.asciz	"too many events values for SPMU disable\n"

	.no_dead_strip	_goya_config_spmu
.subsections_via_symbols
