	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function goya_config_etr
_goya_config_etr:                       ## @goya_config_etr
	.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	_mmPSOC_ETR_BASE@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	movq	_CFG_BASE@GOTPCREL(%rip), %rax
	subl	(%rax), %r15d
	movq	%rsi, %r12
	movq	%rdi, %r13
	leal	4016(%r15), %edi
	movq	_CORESIGHT_UNLOCK@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_WREG32
	leal	772(%r15), %r14d
	movl	%r14d, %edi
	callq	_RREG32
	movl	%eax, %ebx
	movl	%eax, %esi
	orl	$4096, %esi                     ## imm = 0x1000
	movl	%r14d, %edi
	callq	_WREG32
	orl	$4160, %ebx                     ## imm = 0x1040
	movl	%r14d, %edi
	movl	%ebx, %esi
	callq	_WREG32
	movq	%r13, %rdi
	movl	%r14d, %esi
	movl	$6, %edx
	xorl	%ecx, %ecx
	callq	_goya_coresight_timeout
	testl	%eax, %eax
	jne	LBB0_1
## %bb.2:
	leal	12(%r15), %esi
	movq	%r13, %rdi
	movl	$2, %edx
	movl	$1, %ecx
	callq	_goya_coresight_timeout
	testl	%eax, %eax
	je	LBB0_3
LBB0_1:
	movl	%eax, %ebx
	movl	(%r13), %edi
	cmpq	$0, 24(%r12)
	leaq	L_.str.2(%rip), %rax
	leaq	L_.str.1(%rip), %rdx
	cmoveq	%rax, %rdx
	leaq	L_.str(%rip), %rsi
	movl	%ebx, %ecx
	xorl	%eax, %eax
	callq	_dev_err
LBB0_14:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_3:
	leal	32(%r15), %edi
	xorl	%ebx, %ebx
	movl	%edi, -44(%rbp)                 ## 4-byte Spill
	xorl	%esi, %esi
	callq	_WREG32
	cmpq	$0, 24(%r12)
	je	LBB0_12
## %bb.4:
	movq	16(%r12), %rbx
	testq	%rbx, %rbx
	je	LBB0_5
## %bb.6:
	movl	(%rbx), %edx
	testl	%edx, %edx
	je	LBB0_7
## %bb.9:
	movl	8(%rbx), %esi
	movq	%r13, %rdi
	callq	_goya_etr_validate_address
	testl	%eax, %eax
	je	LBB0_10
## %bb.11:
	leal	52(%r15), %edi
	movl	$16380, %esi                    ## imm = 0x3FFC
	callq	_WREG32
	leal	4(%r15), %edi
	movl	(%rbx), %esi
	callq	_WREG32
	leal	40(%r15), %edi
	movl	4(%rbx), %esi
	callq	_WREG32
	leal	272(%r15), %edi
	movl	$1792, %esi                     ## imm = 0x700
	callq	_WREG32
	leal	280(%r15), %r12d
	movl	8(%rbx), %edi
	callq	_lower_32_bits
	movl	%r12d, %edi
	movl	%eax, %esi
	callq	_WREG32
	leal	284(%r15), %r12d
	movl	8(%rbx), %edi
	callq	_upper_32_bits
	movl	%r12d, %edi
	movl	%eax, %esi
	callq	_WREG32
	movl	%r14d, %edi
	movl	$3, %esi
	callq	_WREG32
	addl	$776, %r15d                     ## imm = 0x308
	movl	%r15d, %edi
	movl	$10, %esi
	callq	_WREG32
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	movl	$1, %esi
	callq	_WREG32
	xorl	%ebx, %ebx
	jmp	LBB0_14
LBB0_12:
	leal	52(%r15), %edi
	xorl	%esi, %esi
	callq	_WREG32
	leal	4(%r15), %edi
	movl	$1024, %esi                     ## imm = 0x400
	callq	_WREG32
	leal	280(%r15), %edi
	xorl	%esi, %esi
	callq	_WREG32
	leal	284(%r15), %edi
	xorl	%esi, %esi
	callq	_WREG32
	leal	776(%r15), %edi
	xorl	%esi, %esi
	callq	_WREG32
	leal	40(%r15), %edi
	xorl	%esi, %esi
	callq	_WREG32
	movl	%r14d, %edi
	xorl	%esi, %esi
	callq	_WREG32
	cmpl	$4, (%r12)
	jb	LBB0_14
## %bb.13:
	leal	24(%r15), %edi
	callq	_RREG32
	addl	$60, %r15d
	movl	%r15d, %edi
	callq	_RREG32
	jmp	LBB0_14
LBB0_5:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_14
LBB0_7:
	movl	(%r13), %edi
	leaq	L_.str.3(%rip), %rsi
	jmp	LBB0_8
LBB0_10:
	movl	(%r13), %edi
	leaq	L_.str.4(%rip), %rsi
LBB0_8:
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_dev_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	jmp	LBB0_14
	.cfi_endproc
                                        ## -- End function
	.comm	_mmPSOC_ETR_BASE,4,2            ## @mmPSOC_ETR_BASE
	.comm	_CFG_BASE,4,2                   ## @CFG_BASE
	.comm	_CORESIGHT_UNLOCK,4,2           ## @CORESIGHT_UNLOCK
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to %s ETR on timeout, error %d\n"

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

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

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.3:                               ## @.str.3
	.asciz	"ETR buffer size should be bigger than 0\n"

L_.str.4:                               ## @.str.4
	.asciz	"buffer address is not valid\n"

	.no_dead_strip	_goya_config_etr
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function goya_config_etr
_goya_config_etr:                       ; @goya_config_etr
	.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	x22, x0
Lloh0:
	adrp	x8, _mmPSOC_ETR_BASE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _mmPSOC_ETR_BASE@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x9, _CFG_BASE@GOTPAGE
Lloh4:
	ldr	x9, [x9, _CFG_BASE@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	sub	w23, w8, w9
	add	w0, w23, #4016
Lloh6:
	adrp	x8, _CORESIGHT_UNLOCK@GOTPAGE
Lloh7:
	ldr	x8, [x8, _CORESIGHT_UNLOCK@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	bl	_WREG32
	add	w19, w23, #772
	mov	x0, x19
	bl	_RREG32
	mov	x21, x0
	orr	w1, w0, #0x1000
	mov	x0, x19
	bl	_WREG32
	mov	w8, #4160
	orr	w1, w21, w8
	mov	x0, x19
	bl	_WREG32
	mov	x0, x22
	mov	x1, x19
	mov	w2, #6
	mov	w3, #0
	bl	_goya_coresight_timeout
	cbz	w0, LBB0_2
; %bb.1:
	mov	x21, x0
	ldr	w0, [x22]
	ldr	x8, [x20, #24]
Lloh9:
	adrp	x9, l_.str.1@PAGE
Lloh10:
	add	x9, x9, l_.str.1@PAGEOFF
Lloh11:
	adrp	x10, l_.str.2@PAGE
Lloh12:
	add	x10, x10, l_.str.2@PAGEOFF
	cmp	x8, #0
	csel	x8, x10, x9, eq
	stp	x8, x21, [sp]
Lloh13:
	adrp	x1, l_.str@PAGE
Lloh14:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	b	LBB0_16
LBB0_2:
	add	w1, w23, #12
	mov	x0, x22
	mov	w2, #2
	mov	w3, #1
	bl	_goya_coresight_timeout
	cbz	w0, LBB0_4
; %bb.3:
	mov	x21, x0
	ldr	w0, [x22]
	ldr	x8, [x20, #24]
Lloh15:
	adrp	x9, l_.str.1@PAGE
Lloh16:
	add	x9, x9, l_.str.1@PAGEOFF
Lloh17:
	adrp	x10, l_.str.2@PAGE
Lloh18:
	add	x10, x10, l_.str.2@PAGEOFF
	cmp	x8, #0
	csel	x8, x10, x9, eq
	stp	x8, x21, [sp]
Lloh19:
	adrp	x1, l_.str@PAGE
Lloh20:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
                                        ; kill: def $w21 killed $w21 killed $x21 def $x21
	b	LBB0_16
LBB0_4:
	add	w21, w23, #32
	mov	x0, x21
	mov	w1, #0
	bl	_WREG32
	ldr	x8, [x20, #24]
	cbz	x8, LBB0_9
; %bb.5:
	ldr	x24, [x20, #16]
	cbz	x24, LBB0_15
; %bb.6:
	ldr	w2, [x24]
	cbz	w2, LBB0_12
; %bb.7:
	ldr	w1, [x24, #8]
	mov	x0, x22
	bl	_goya_etr_validate_address
	cbz	w0, LBB0_13
; %bb.8:
	add	w0, w23, #52
	mov	w1, #16380
	bl	_WREG32
	add	w0, w23, #4
	ldr	w1, [x24]
	bl	_WREG32
	add	w0, w23, #40
	ldr	w1, [x24, #4]
	bl	_WREG32
	add	w0, w23, #272
	mov	w1, #1792
	bl	_WREG32
	add	w20, w23, #280
	ldr	w0, [x24, #8]
	bl	_lower_32_bits
	mov	x1, x0
	mov	x0, x20
	bl	_WREG32
	add	w20, w23, #284
	ldr	w0, [x24, #8]
	bl	_upper_32_bits
	mov	x1, x0
	mov	x0, x20
	bl	_WREG32
	mov	x0, x19
	mov	w1, #3
	bl	_WREG32
	add	w0, w23, #776
	mov	w1, #10
	bl	_WREG32
	mov	x0, x21
	mov	w1, #1
	bl	_WREG32
	b	LBB0_11
LBB0_9:
	add	w0, w23, #52
	mov	w1, #0
	bl	_WREG32
	add	w0, w23, #4
	mov	w1, #1024
	bl	_WREG32
	add	w0, w23, #280
	mov	w1, #0
	bl	_WREG32
	add	w0, w23, #284
	mov	w1, #0
	bl	_WREG32
	add	w0, w23, #776
	mov	w1, #0
	bl	_WREG32
	add	w0, w23, #40
	mov	w1, #0
	bl	_WREG32
	mov	x0, x19
	mov	w1, #0
	bl	_WREG32
	mov	w21, #0
	ldr	w8, [x20]
	cmp	w8, #4
	b.lo	LBB0_16
; %bb.10:
	add	w0, w23, #24
	bl	_RREG32
	add	w0, w23, #60
	bl	_RREG32
LBB0_11:
	mov	w21, #0
	b	LBB0_16
LBB0_12:
	ldr	w0, [x22]
Lloh21:
	adrp	x1, l_.str.3@PAGE
Lloh22:
	add	x1, x1, l_.str.3@PAGEOFF
	b	LBB0_14
LBB0_13:
	ldr	w0, [x22]
Lloh23:
	adrp	x1, l_.str.4@PAGE
Lloh24:
	add	x1, x1, l_.str.4@PAGEOFF
LBB0_14:
	bl	_dev_err
LBB0_15:
Lloh25:
	adrp	x8, _EINVAL@GOTPAGE
Lloh26:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh27:
	ldr	w8, [x8]
	neg	w21, w8
LBB0_16:
	mov	x0, x21
	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
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.cfi_endproc
                                        ; -- End function
	.comm	_mmPSOC_ETR_BASE,4,2            ; @mmPSOC_ETR_BASE
	.comm	_CFG_BASE,4,2                   ; @CFG_BASE
	.comm	_CORESIGHT_UNLOCK,4,2           ; @CORESIGHT_UNLOCK
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to %s ETR on timeout, error %d\n"

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

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

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.3:                               ; @.str.3
	.asciz	"ETR buffer size should be bigger than 0\n"

l_.str.4:                               ; @.str.4
	.asciz	"buffer address is not valid\n"

	.no_dead_strip	_goya_config_etr
.subsections_via_symbols
