	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function goya_config_stm
_goya_config_stm:                       ## @goya_config_stm
	.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, %r13
	movq	%rdi, %r15
	movq	(%rsi), %rbx
	movq	_debug_stm_regs@GOTPCREL(%rip), %r14
	movq	(%r14), %rdi
	callq	_ARRAY_SIZE
	cmpq	%rax, %rbx
	jae	LBB0_1
## %bb.2:
	movq	(%r14), %rax
	movq	(%r13), %rcx
	movq	(%rax,%rcx,8), %r12
	movq	_CFG_BASE@GOTPCREL(%rip), %rax
	subq	(%rax), %r12
	leaq	4016(%r12), %rdi
	movq	_CORESIGHT_UNLOCK@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_WREG32
	cmpq	$0, 16(%r13)
	je	LBB0_6
## %bb.3:
	movq	8(%r13), %r13
	testq	%r13, %r13
	je	LBB0_4
## %bb.5:
	leaq	3712(%r12), %rdi
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	movl	$524292, %esi                   ## imm = 0x80004
	callq	_WREG32
	leaq	3428(%r12), %rdi
	movl	$7, %esi
	callq	_WREG32
	leaq	3424(%r12), %r15
	xorl	%r14d, %r14d
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	_WREG32
	leaq	3328(%r12), %rbx
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	movl	12(%r13), %edi
	callq	_lower_32_bits
	movq	%rbx, %rdi
	movl	%eax, %esi
	callq	_WREG32
	leaq	3360(%r12), %rbx
	movl	8(%r13), %edi
	callq	_lower_32_bits
	movq	%rbx, %rdi
	movl	%eax, %esi
	callq	_WREG32
	movq	%r15, %rdi
	movl	$1, %esi
	callq	_WREG32
	movl	12(%r13), %edi
	callq	_upper_32_bits
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movl	%eax, %esi
	callq	_WREG32
	movl	8(%r13), %edi
	callq	_upper_32_bits
	movq	%rbx, %rdi
	movl	%eax, %esi
	callq	_WREG32
	leaq	3696(%r12), %rdi
	movl	$16, %esi
	callq	_WREG32
	leaq	3680(%r12), %rdi
	xorl	%esi, %esi
	callq	_WREG32
	leaq	3684(%r12), %rdi
	movl	$4325376, %esi                  ## imm = 0x420000
	callq	_WREG32
	leaq	3584(%r12), %rdi
	movl	$-1, %esi
	callq	_WREG32
	leaq	3616(%r12), %rdi
	movl	$-1, %esi
	callq	_WREG32
	leaq	3828(%r12), %rdi
	movl	(%r13), %esi
	callq	_WREG32
	leaq	3572(%r12), %rdi
	movl	$128, %esi
	callq	_WREG32
	leaq	3724(%r12), %rdi
	movl	4(%r13), %esi
	callq	_WREG32
	addq	$3728, %r12                     ## imm = 0xE90
	movq	%r12, %rdi
	movl	$2047, %esi                     ## imm = 0x7FF
	callq	_WREG32
	movl	(%r13), %esi
	shll	$16, %esi
	orl	$7, %esi
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	jmp	LBB0_9
LBB0_1:
	movl	(%r15), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	callq	_dev_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %r14d
	jmp	LBB0_10
LBB0_6:
	leaq	3712(%r12), %r13
	movq	%r13, %rdi
	movl	$4, %esi
	callq	_WREG32
	leaq	3428(%r12), %rdi
	xorl	%r14d, %r14d
	xorl	%esi, %esi
	callq	_WREG32
	leaq	3424(%r12), %rbx
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_WREG32
	leaq	3328(%r12), %rdi
	xorl	%esi, %esi
	callq	_WREG32
	leaq	3360(%r12), %rdi
	xorl	%esi, %esi
	callq	_WREG32
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_WREG32
	leaq	3616(%r12), %rdi
	xorl	%esi, %esi
	callq	_WREG32
	leaq	3584(%r12), %rdi
	xorl	%esi, %esi
	callq	_WREG32
	leaq	3572(%r12), %rdi
	movl	$128, %esi
	callq	_WREG32
	leaq	3696(%r12), %rdi
	xorl	%esi, %esi
	callq	_WREG32
	leaq	3680(%r12), %rdi
	xorl	%esi, %esi
	callq	_WREG32
	leaq	3684(%r12), %rdi
	xorl	%esi, %esi
	callq	_WREG32
	addq	$3724, %r12                     ## imm = 0xE8C
	movq	%r12, %rdi
	xorl	%esi, %esi
	callq	_WREG32
	movq	%r15, %rdi
	movq	%r13, %rsi
	movl	$23, %edx
	xorl	%ecx, %ecx
	callq	_goya_coresight_timeout
	testl	%eax, %eax
	je	LBB0_8
## %bb.7:
	movl	%eax, %ebx
	movl	(%r15), %edi
	leaq	L_.str.1(%rip), %rsi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_dev_err
	movl	%ebx, %r14d
	jmp	LBB0_10
LBB0_4:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	jmp	LBB0_10
LBB0_8:
	movq	%r13, %rdi
	movl	$4, %esi
LBB0_9:
	callq	_WREG32
LBB0_10:
	movl	%r14d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_debug_stm_regs,8,3             ## @debug_stm_regs
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Invalid register index in STM\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_CFG_BASE,8,3                   ## @CFG_BASE
	.comm	_CORESIGHT_UNLOCK,4,2           ## @CORESIGHT_UNLOCK
L_.str.1:                               ## @.str.1
	.asciz	"Failed to disable STM on timeout, error %d\n"

	.no_dead_strip	_goya_config_stm
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function goya_config_stm
_goya_config_stm:                       ; @goya_config_stm
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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_stm_regs@GOTPAGE
Lloh1:
	ldr	x21, [x21, _debug_stm_regs@GOTPAGEOFF]
	ldr	x0, [x21]
	bl	_ARRAY_SIZE
	cmp	x22, x0
	b.hs	LBB0_4
; %bb.1:
	ldr	x8, [x21]
	ldr	x9, [x20]
	ldr	x8, [x8, x9, lsl #3]
Lloh2:
	adrp	x9, _CFG_BASE@GOTPAGE
Lloh3:
	ldr	x9, [x9, _CFG_BASE@GOTPAGEOFF]
Lloh4:
	ldr	x9, [x9]
	sub	x24, x8, x9
	add	x0, x24, #4016
Lloh5:
	adrp	x8, _CORESIGHT_UNLOCK@GOTPAGE
Lloh6:
	ldr	x8, [x8, _CORESIGHT_UNLOCK@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
	bl	_WREG32
	ldr	x8, [x20, #16]
	cbz	x8, LBB0_7
; %bb.2:
	ldr	x25, [x20, #8]
	cbz	x25, LBB0_5
; %bb.3:
	add	x19, x24, #3712
	mov	x0, x19
	mov	w1, #4
	movk	w1, #8, lsl #16
	bl	_WREG32
	add	x0, x24, #3428
	mov	w20, #7
	mov	w1, #7
	bl	_WREG32
	add	x21, x24, #3424
	mov	x0, x21
	mov	w1, #0
	bl	_WREG32
	add	x22, x24, #3328
	ldr	w0, [x25, #12]
	bl	_lower_32_bits
	mov	x1, x0
	mov	x0, x22
	bl	_WREG32
	add	x23, x24, #3360
	ldr	w0, [x25, #8]
	bl	_lower_32_bits
	mov	x1, x0
	mov	x0, x23
	bl	_WREG32
	mov	x0, x21
	mov	w1, #1
	bl	_WREG32
	ldr	w0, [x25, #12]
	bl	_upper_32_bits
	mov	x1, x0
	mov	x0, x22
	bl	_WREG32
	ldr	w0, [x25, #8]
	bl	_upper_32_bits
	mov	x1, x0
	mov	x0, x23
	bl	_WREG32
	add	x0, x24, #3696
	mov	w1, #16
	bl	_WREG32
	add	x0, x24, #3680
	mov	w1, #0
	bl	_WREG32
	add	x0, x24, #3684
	mov	w1, #4325376
	bl	_WREG32
	add	x0, x24, #3584
	mov	w1, #-1
	bl	_WREG32
	add	x0, x24, #3616
	mov	w1, #-1
	bl	_WREG32
	add	x0, x24, #3828
	ldr	w1, [x25]
	bl	_WREG32
	add	x0, x24, #3572
	mov	w1, #128
	bl	_WREG32
	add	x0, x24, #3724
	ldr	w1, [x25, #4]
	bl	_WREG32
	add	x0, x24, #3728
	mov	w1, #2047
	bl	_WREG32
	ldr	w8, [x25]
	bfi	w20, w8, #16, #16
	mov	x0, x19
	mov	x1, x20
	bl	_WREG32
	mov	w21, #0
	b	LBB0_6
LBB0_4:
	ldr	w0, [x19]
Lloh8:
	adrp	x1, l_.str@PAGE
Lloh9:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
LBB0_5:
Lloh10:
	adrp	x8, _EINVAL@GOTPAGE
Lloh11:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	neg	w21, w8
LBB0_6:
	mov	x0, x21
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
LBB0_7:
	add	x20, x24, #3712
	mov	x0, x20
	mov	w1, #4
	bl	_WREG32
	add	x0, x24, #3428
	mov	w1, #0
	bl	_WREG32
	add	x21, x24, #3424
	mov	x0, x21
	mov	w1, #1
	bl	_WREG32
	add	x0, x24, #3328
	mov	w1, #0
	bl	_WREG32
	add	x0, x24, #3360
	mov	w1, #0
	bl	_WREG32
	mov	x0, x21
	mov	w1, #0
	bl	_WREG32
	add	x0, x24, #3616
	mov	w1, #0
	bl	_WREG32
	add	x0, x24, #3584
	mov	w1, #0
	bl	_WREG32
	add	x0, x24, #3572
	mov	w1, #128
	bl	_WREG32
	add	x0, x24, #3696
	mov	w1, #0
	bl	_WREG32
	add	x0, x24, #3680
	mov	w1, #0
	bl	_WREG32
	add	x0, x24, #3684
	mov	w1, #0
	bl	_WREG32
	add	x0, x24, #3724
	mov	w1, #0
	bl	_WREG32
	mov	x0, x19
	mov	x1, x20
	mov	w2, #23
	mov	w3, #0
	bl	_goya_coresight_timeout
	mov	x21, x0
	cbz	w0, LBB0_9
; %bb.8:
	ldr	w0, [x19]
	str	x21, [sp]
Lloh13:
	adrp	x1, l_.str.1@PAGE
Lloh14:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
	b	LBB0_6
LBB0_9:
	mov	x0, x20
	mov	w1, #4
	bl	_WREG32
	b	LBB0_6
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_debug_stm_regs,8,3             ; @debug_stm_regs
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Invalid register index in STM\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_CFG_BASE,8,3                   ; @CFG_BASE
	.comm	_CORESIGHT_UNLOCK,4,2           ; @CORESIGHT_UNLOCK
l_.str.1:                               ; @.str.1
	.asciz	"Failed to disable STM on timeout, error %d\n"

	.no_dead_strip	_goya_config_stm
.subsections_via_symbols
