	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function goya_config_etf
_goya_config_etf:                       ## @goya_config_etf
	.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	%rsi, %r12
	movq	%rdi, %r13
	movq	(%rsi), %rbx
	movq	_debug_etf_regs@GOTPCREL(%rip), %r14
	movq	(%r14), %rdi
	callq	_ARRAY_SIZE
	cmpq	%rax, %rbx
	jae	LBB0_4
## %bb.1:
	movq	(%r14), %rax
	movq	(%r12), %rcx
	movq	(%rax,%rcx,8), %r14
	movq	_CFG_BASE@GOTPCREL(%rip), %rax
	subq	(%rax), %r14
	leaq	4016(%r14), %rdi
	movq	_CORESIGHT_UNLOCK@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_WREG32
	leaq	772(%r14), %r15
	movq	%r15, %rdi
	callq	_RREG32
	movl	%eax, %ebx
	movl	%eax, %esi
	orl	$4096, %esi                     ## imm = 0x1000
	movq	%r15, %rdi
	callq	_WREG32
	orl	$4160, %ebx                     ## imm = 0x1040
	movq	%r15, %rdi
	movl	%ebx, %esi
	callq	_WREG32
	movq	%r13, %rdi
	movq	%r15, %rsi
	movl	$6, %edx
	xorl	%ecx, %ecx
	callq	_goya_coresight_timeout
	testl	%eax, %eax
	jne	LBB0_3
## %bb.2:
	leaq	12(%r14), %rsi
	movq	%r13, %rdi
	movl	$2, %edx
	movl	$1, %ecx
	callq	_goya_coresight_timeout
	testl	%eax, %eax
	je	LBB0_7
LBB0_3:
	movl	%eax, %ebx
	movl	(%r13), %edi
	cmpq	$0, 16(%r12)
	leaq	L_.str.3(%rip), %rax
	leaq	L_.str.2(%rip), %rdx
	cmoveq	%rax, %rdx
	leaq	L_.str.1(%rip), %rsi
	movl	%ebx, %ecx
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_6
LBB0_4:
	movl	(%r13), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_dev_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_5:
	subl	(%rax), %ebx
LBB0_6:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	leaq	32(%r14), %r13
	xorl	%ebx, %ebx
	movq	%r13, %rdi
	xorl	%esi, %esi
	callq	_WREG32
	cmpq	$0, 16(%r12)
	je	LBB0_10
## %bb.8:
	movq	8(%r12), %rbx
	testq	%rbx, %rbx
	je	LBB0_11
## %bb.9:
	leaq	52(%r14), %rdi
	movl	$16380, %esi                    ## imm = 0x3FFC
	callq	_WREG32
	leaq	40(%r14), %rdi
	movl	(%rbx), %esi
	callq	_WREG32
	movq	%r15, %rdi
	movl	$16385, %esi                    ## imm = 0x4001
	callq	_WREG32
	addq	$776, %r14                      ## imm = 0x308
	movq	%r14, %rdi
	movl	$10, %esi
	callq	_WREG32
	movq	%r13, %rdi
	movl	$1, %esi
	callq	_WREG32
	xorl	%ebx, %ebx
	jmp	LBB0_6
LBB0_10:
	leaq	52(%r14), %rdi
	xorl	%esi, %esi
	callq	_WREG32
	addq	$40, %r14
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	_WREG32
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	_WREG32
	jmp	LBB0_6
LBB0_11:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	jmp	LBB0_5
	.cfi_endproc
                                        ## -- End function
	.comm	_debug_etf_regs,8,3             ## @debug_etf_regs
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Invalid register index in ETF\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 %s ETF on timeout, error %d\n"

L_.str.2:                               ## @.str.2
	.asciz	"enable"

L_.str.3:                               ## @.str.3
	.asciz	"disable"

	.no_dead_strip	_goya_config_etf
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function goya_config_etf
_goya_config_etf:                       ; @goya_config_etf
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.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
	mov	x20, x1
	mov	x21, x0
	ldr	x22, [x1]
Lloh0:
	adrp	x19, _debug_etf_regs@GOTPAGE
Lloh1:
	ldr	x19, [x19, _debug_etf_regs@GOTPAGEOFF]
	ldr	x0, [x19]
	bl	_ARRAY_SIZE
	cmp	x22, x0
	b.hs	LBB0_3
; %bb.1:
	ldr	x8, [x19]
	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	x23, x8, x9
	add	x0, x23, #4016
Lloh5:
	adrp	x8, _CORESIGHT_UNLOCK@GOTPAGE
Lloh6:
	ldr	x8, [x8, _CORESIGHT_UNLOCK@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
	bl	_WREG32
	add	x19, x23, #772
	mov	x0, x19
	bl	_RREG32
	mov	x22, x0
	orr	w1, w0, #0x1000
	mov	x0, x19
	bl	_WREG32
	mov	w8, #4160
	orr	w1, w22, w8
	mov	x0, x19
	bl	_WREG32
	mov	x0, x21
	mov	x1, x19
	mov	w2, #6
	mov	w3, #0
	bl	_goya_coresight_timeout
	cbz	w0, LBB0_6
; %bb.2:
	mov	x22, x0
	ldr	w0, [x21]
	ldr	x8, [x20, #16]
Lloh8:
	adrp	x9, l_.str.2@PAGE
Lloh9:
	add	x9, x9, l_.str.2@PAGEOFF
Lloh10:
	adrp	x10, l_.str.3@PAGE
Lloh11:
	add	x10, x10, l_.str.3@PAGEOFF
	cmp	x8, #0
	csel	x8, x10, x9, eq
	stp	x8, x22, [sp]
Lloh12:
	adrp	x1, l_.str.1@PAGE
Lloh13:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
	b	LBB0_5
LBB0_3:
	ldr	w0, [x21]
Lloh14:
	adrp	x1, l_.str@PAGE
Lloh15:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
LBB0_4:
Lloh16:
	adrp	x8, _EINVAL@GOTPAGE
Lloh17:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_5:
	mov	x0, x22
	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
	add	sp, sp, #80
	ret
LBB0_6:
	add	x1, x23, #12
	mov	x0, x21
	mov	w2, #2
	mov	w3, #1
	bl	_goya_coresight_timeout
	cbz	w0, LBB0_8
; %bb.7:
	mov	x22, x0
	ldr	w0, [x21]
	ldr	x8, [x20, #16]
Lloh19:
	adrp	x9, l_.str.2@PAGE
Lloh20:
	add	x9, x9, l_.str.2@PAGEOFF
Lloh21:
	adrp	x10, l_.str.3@PAGE
Lloh22:
	add	x10, x10, l_.str.3@PAGEOFF
	cmp	x8, #0
	csel	x8, x10, x9, eq
	stp	x8, x22, [sp]
Lloh23:
	adrp	x1, l_.str.1@PAGE
Lloh24:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
                                        ; kill: def $w22 killed $w22 killed $x22 def $x22
	b	LBB0_5
LBB0_8:
	add	x21, x23, #32
	mov	x0, x21
	mov	w1, #0
	bl	_WREG32
	ldr	x8, [x20, #16]
	cbz	x8, LBB0_11
; %bb.9:
	ldr	x20, [x20, #8]
	cbz	x20, LBB0_4
; %bb.10:
	add	x0, x23, #52
	mov	w1, #16380
	bl	_WREG32
	add	x0, x23, #40
	ldr	w1, [x20]
	bl	_WREG32
	mov	x0, x19
	mov	w1, #16385
	bl	_WREG32
	add	x0, x23, #776
	mov	w1, #10
	bl	_WREG32
	mov	x0, x21
	mov	w1, #1
	b	LBB0_12
LBB0_11:
	add	x0, x23, #52
	mov	w1, #0
	bl	_WREG32
	add	x0, x23, #40
	mov	w1, #0
	bl	_WREG32
	mov	x0, x19
	mov	w1, #0
LBB0_12:
	bl	_WREG32
	mov	w22, #0
	b	LBB0_5
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpAdd	Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_debug_etf_regs,8,3             ; @debug_etf_regs
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Invalid register index in ETF\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 %s ETF on timeout, error %d\n"

l_.str.2:                               ; @.str.2
	.asciz	"enable"

l_.str.3:                               ; @.str.3
	.asciz	"disable"

	.no_dead_strip	_goya_config_etf
.subsections_via_symbols
