	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function telemetry_setup
_telemetry_setup:                       ## @telemetry_setup
	.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	$104, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movq	_PMC_IPC_PMC_TELEMTRY@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_IOSS_TELEM_INFO_READ@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_IOSS_TELEM_READ_WORD@GOTPCREL(%rip), %rax
	movl	(%rax), %r9d
	leaq	-44(%rbp), %r8
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	callq	_intel_pmc_ipc_command
	testl	%eax, %eax
	je	LBB0_2
## %bb.1:
	movl	%eax, %r15d
	leaq	L_.str(%rip), %rsi
LBB0_14:
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_15
LBB0_2:
	movl	-44(%rbp), %edi
	movq	_TELEM_INFO_SRAMEVTS_MASK@GOTPCREL(%rip), %rdx
	movl	(%rdx), %ebx
	andl	%edi, %ebx
	movq	_TELEM_INFO_SRAMEVTS_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	sarl	%cl, %ebx
	movq	_TELEM_INFO_NENABLES_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	andl	%edi, %r12d
	movq	_TELEM_MAX_EVENTS_SRAM@GOTPCREL(%rip), %r13
	movl	(%r13), %eax
	cmpl	%eax, %ebx
	jl	LBB0_4
## %bb.3:
	cmpl	%eax, %r12d
	jl	LBB0_4
## %bb.6:
	movq	%rdx, %r12
	callq	_TELEM_MIN_PERIOD
	movq	_telm_conf@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rcx
	movq	%rax, 24(%rcx)
	movl	-44(%rbp), %edi
	callq	_TELEM_MAX_PERIOD
	movq	(%rbx), %rcx
	movq	%rax, 16(%rcx)
	movq	_IPC_PUNIT_BIOS_READ_TELE_INFO@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	-44(%rbp), %r8
	xorl	%esi, %esi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	callq	_intel_punit_ipc_command
	testl	%eax, %eax
	je	LBB0_8
## %bb.7:
	movl	%eax, %r15d
	leaq	L_.str.3(%rip), %rsi
	jmp	LBB0_14
LBB0_4:
	leaq	L_.str.1(%rip), %rsi
	xorl	%r15d, %r15d
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	_dev_err
	leaq	L_.str.2(%rip), %rsi
	movq	%r14, %rdi
	movl	%ebx, %edx
	movl	%r12d, %ecx
LBB0_5:
	xorl	%eax, %eax
	callq	_dev_err
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	subl	(%rax), %r15d
LBB0_15:
	movl	%r15d, %eax
	addq	$104, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	movq	%rbx, %r15
	movl	-44(%rbp), %edi
	movl	(%r12), %ebx
	andl	%edi, %ebx
	movq	_TELEM_INFO_SRAMEVTS_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	movl	%ebx, %r12d
	sarl	%cl, %r12d
	movl	(%r13), %eax
	cmpl	%eax, %r12d
	jl	LBB0_10
## %bb.9:
	cmpl	%eax, %ebx
	jl	LBB0_10
## %bb.11:
	callq	_TELEM_MIN_PERIOD
	movq	(%r15), %rcx
	movq	%rax, 8(%rcx)
	movl	-44(%rbp), %edi
	callq	_TELEM_MAX_PERIOD
	movq	(%r15), %rcx
	movq	%rax, (%rcx)
	movq	$0, -80(%rbp)
	movq	_TELEM_MAX_OS_ALLOCATED_EVENTS@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -88(%rbp)
	movq	_TELEM_SAMPLING_DEFAULT_PERIOD@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	%rcx, -96(%rbp)
	movq	$0, -56(%rbp)
	movq	%rax, -64(%rbp)
	movq	%rcx, -72(%rbp)
	movq	_TELEM_RESET@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	-56(%rbp), %rax
	movq	%rax, 40(%rsp)
	movups	-72(%rbp), %xmm0
	movups	%xmm0, 24(%rsp)
	movq	-80(%rbp), %rax
	movq	%rax, 16(%rsp)
	movups	-96(%rbp), %xmm0
	movups	%xmm0, (%rsp)
	callq	_telemetry_setup_evtconfig
	testl	%eax, %eax
	je	LBB0_12
## %bb.13:
	movl	%eax, %r15d
	leaq	L_.str.5(%rip), %rsi
	jmp	LBB0_14
LBB0_10:
	leaq	L_.str.4(%rip), %rsi
	xorl	%r15d, %r15d
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	_dev_err
	leaq	L_.str.2(%rip), %rsi
	movq	%r14, %rdi
	movl	%r12d, %edx
	movl	%ebx, %ecx
	jmp	LBB0_5
LBB0_12:
	xorl	%r15d, %r15d
	jmp	LBB0_15
	.cfi_endproc
                                        ## -- End function
	.comm	_PMC_IPC_PMC_TELEMTRY,4,2       ## @PMC_IPC_PMC_TELEMTRY
	.comm	_IOSS_TELEM_INFO_READ,4,2       ## @IOSS_TELEM_INFO_READ
	.comm	_IOSS_TELEM_READ_WORD,4,2       ## @IOSS_TELEM_READ_WORD
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"IOSS TELEM_INFO Read Failed\n"

	.comm	_TELEM_INFO_SRAMEVTS_MASK,4,2   ## @TELEM_INFO_SRAMEVTS_MASK
	.comm	_TELEM_INFO_SRAMEVTS_SHIFT,4,2  ## @TELEM_INFO_SRAMEVTS_SHIFT
	.comm	_TELEM_INFO_NENABLES_MASK,4,2   ## @TELEM_INFO_NENABLES_MASK
	.comm	_TELEM_MAX_EVENTS_SRAM,4,2      ## @TELEM_MAX_EVENTS_SRAM
L_.str.1:                               ## @.str.1
	.asciz	"IOSS:Insufficient Space for SRAM Trace\n"

L_.str.2:                               ## @.str.2
	.asciz	"SRAM Events %d; Event Regs %d\n"

	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_telm_conf,8,3                  ## @telm_conf
	.comm	_IPC_PUNIT_BIOS_READ_TELE_INFO,4,2 ## @IPC_PUNIT_BIOS_READ_TELE_INFO
L_.str.3:                               ## @.str.3
	.asciz	"PSS TELEM_INFO Read Failed\n"

L_.str.4:                               ## @.str.4
	.asciz	"PSS:Insufficient Space for SRAM Trace\n"

	.comm	_TELEM_MAX_OS_ALLOCATED_EVENTS,8,3 ## @TELEM_MAX_OS_ALLOCATED_EVENTS
	.comm	_TELEM_SAMPLING_DEFAULT_PERIOD,8,3 ## @TELEM_SAMPLING_DEFAULT_PERIOD
	.comm	_TELEM_RESET,4,2                ## @TELEM_RESET
L_.str.5:                               ## @.str.5
	.asciz	"TELEMETRY Setup Failed\n"

	.no_dead_strip	_telemetry_setup
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function telemetry_setup
_telemetry_setup:                       ; @telemetry_setup
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x24, x23, [sp, #80]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #96]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #112]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #128]            ; 16-byte Folded Spill
	add	x29, sp, #128
	.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	x19, x0
Lloh0:
	adrp	x8, _PMC_IPC_PMC_TELEMTRY@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PMC_IPC_PMC_TELEMTRY@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
Lloh3:
	adrp	x8, _IOSS_TELEM_INFO_READ@GOTPAGE
Lloh4:
	ldr	x8, [x8, _IOSS_TELEM_INFO_READ@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
Lloh6:
	adrp	x8, _IOSS_TELEM_READ_WORD@GOTPAGE
Lloh7:
	ldr	x8, [x8, _IOSS_TELEM_READ_WORD@GOTPAGEOFF]
Lloh8:
	ldr	w5, [x8]
	sub	x4, x29, #52
	mov	x2, #0
	mov	w3, #0
	bl	_intel_pmc_ipc_command
	cbz	w0, LBB0_3
; %bb.1:
	mov	x20, x0
Lloh9:
	adrp	x1, l_.str@PAGE
Lloh10:
	add	x1, x1, l_.str@PAGEOFF
LBB0_2:
	mov	x0, x19
	bl	_dev_err
	b	LBB0_6
LBB0_3:
	ldur	w0, [x29, #-52]
Lloh11:
	adrp	x22, _TELEM_INFO_SRAMEVTS_MASK@GOTPAGE
Lloh12:
	ldr	x22, [x22, _TELEM_INFO_SRAMEVTS_MASK@GOTPAGEOFF]
	ldr	w8, [x22]
Lloh13:
	adrp	x23, _TELEM_INFO_SRAMEVTS_SHIFT@GOTPAGE
Lloh14:
	ldr	x23, [x23, _TELEM_INFO_SRAMEVTS_SHIFT@GOTPAGEOFF]
	and	w8, w8, w0
	ldr	w9, [x23]
	asr	w20, w8, w9
Lloh15:
	adrp	x8, _TELEM_INFO_NENABLES_MASK@GOTPAGE
Lloh16:
	ldr	x8, [x8, _TELEM_INFO_NENABLES_MASK@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
	and	w21, w8, w0
Lloh18:
	adrp	x24, _TELEM_MAX_EVENTS_SRAM@GOTPAGE
Lloh19:
	ldr	x24, [x24, _TELEM_MAX_EVENTS_SRAM@GOTPAGEOFF]
	ldr	w8, [x24]
	cmp	w20, w8
	ccmp	w21, w8, #8, ge
	b.ge	LBB0_7
; %bb.4:
Lloh20:
	adrp	x1, l_.str.1@PAGE
Lloh21:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x19
	bl	_dev_err
	stp	x20, x21, [sp]
LBB0_5:
Lloh22:
	adrp	x1, l_.str.2@PAGE
Lloh23:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x19
	bl	_dev_err
Lloh24:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh25:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh26:
	ldr	w8, [x8]
	neg	w20, w8
LBB0_6:
	mov	x0, x20
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	add	sp, sp, #144
	ret
LBB0_7:
	bl	_TELEM_MIN_PERIOD
Lloh27:
	adrp	x21, _telm_conf@GOTPAGE
Lloh28:
	ldr	x21, [x21, _telm_conf@GOTPAGEOFF]
	ldr	x8, [x21]
	str	x0, [x8, #24]
	ldur	w0, [x29, #-52]
	bl	_TELEM_MAX_PERIOD
	ldr	x8, [x21]
	str	x0, [x8, #16]
Lloh29:
	adrp	x8, _IPC_PUNIT_BIOS_READ_TELE_INFO@GOTPAGE
Lloh30:
	ldr	x8, [x8, _IPC_PUNIT_BIOS_READ_TELE_INFO@GOTPAGEOFF]
Lloh31:
	ldr	w0, [x8]
	sub	x4, x29, #52
	mov	w1, #0
	mov	w2, #0
	mov	x3, #0
	bl	_intel_punit_ipc_command
	cbz	w0, LBB0_9
; %bb.8:
	mov	x20, x0
Lloh32:
	adrp	x1, l_.str.3@PAGE
Lloh33:
	add	x1, x1, l_.str.3@PAGEOFF
	b	LBB0_2
LBB0_9:
	ldur	w0, [x29, #-52]
	ldr	w8, [x22]
	and	w20, w8, w0
	ldr	w8, [x23]
	asr	w22, w20, w8
	ldr	w8, [x24]
	cmp	w22, w8
	b.lt	LBB0_13
; %bb.10:
	cmp	w20, w8
	b.lt	LBB0_13
; %bb.11:
	bl	_TELEM_MIN_PERIOD
	ldr	x8, [x21]
	str	x0, [x8, #8]
	ldur	w0, [x29, #-52]
	bl	_TELEM_MAX_PERIOD
	ldr	x8, [x21]
	str	x0, [x8]
Lloh34:
	adrp	x8, _TELEM_MAX_OS_ALLOCATED_EVENTS@GOTPAGE
Lloh35:
	ldr	x8, [x8, _TELEM_MAX_OS_ALLOCATED_EVENTS@GOTPAGEOFF]
Lloh36:
	ldr	x8, [x8]
Lloh37:
	adrp	x9, _TELEM_SAMPLING_DEFAULT_PERIOD@GOTPAGE
Lloh38:
	ldr	x9, [x9, _TELEM_SAMPLING_DEFAULT_PERIOD@GOTPAGEOFF]
Lloh39:
	ldr	x9, [x9]
Lloh40:
	adrp	x10, _TELEM_RESET@GOTPAGE
Lloh41:
	ldr	x10, [x10, _TELEM_RESET@GOTPAGEOFF]
Lloh42:
	ldr	w2, [x10]
	stp	x9, x8, [sp, #48]
	str	xzr, [sp, #64]
	stp	x9, x8, [sp, #24]
	str	xzr, [sp, #40]
	add	x0, sp, #48
	add	x1, sp, #24
	bl	_telemetry_setup_evtconfig
	mov	x20, x0
	cbz	w0, LBB0_6
; %bb.12:
Lloh43:
	adrp	x1, l_.str.5@PAGE
Lloh44:
	add	x1, x1, l_.str.5@PAGEOFF
	b	LBB0_2
LBB0_13:
Lloh45:
	adrp	x1, l_.str.4@PAGE
Lloh46:
	add	x1, x1, l_.str.4@PAGEOFF
	mov	x0, x19
	bl	_dev_err
	stp	x22, x20, [sp]
	b	LBB0_5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGot	Lloh27, Lloh28
	.loh AdrpAdd	Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh40, Lloh41, Lloh42
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.loh AdrpAdd	Lloh43, Lloh44
	.loh AdrpAdd	Lloh45, Lloh46
	.cfi_endproc
                                        ; -- End function
	.comm	_PMC_IPC_PMC_TELEMTRY,4,2       ; @PMC_IPC_PMC_TELEMTRY
	.comm	_IOSS_TELEM_INFO_READ,4,2       ; @IOSS_TELEM_INFO_READ
	.comm	_IOSS_TELEM_READ_WORD,4,2       ; @IOSS_TELEM_READ_WORD
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"IOSS TELEM_INFO Read Failed\n"

	.comm	_TELEM_INFO_SRAMEVTS_MASK,4,2   ; @TELEM_INFO_SRAMEVTS_MASK
	.comm	_TELEM_INFO_SRAMEVTS_SHIFT,4,2  ; @TELEM_INFO_SRAMEVTS_SHIFT
	.comm	_TELEM_INFO_NENABLES_MASK,4,2   ; @TELEM_INFO_NENABLES_MASK
	.comm	_TELEM_MAX_EVENTS_SRAM,4,2      ; @TELEM_MAX_EVENTS_SRAM
l_.str.1:                               ; @.str.1
	.asciz	"IOSS:Insufficient Space for SRAM Trace\n"

l_.str.2:                               ; @.str.2
	.asciz	"SRAM Events %d; Event Regs %d\n"

	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_telm_conf,8,3                  ; @telm_conf
	.comm	_IPC_PUNIT_BIOS_READ_TELE_INFO,4,2 ; @IPC_PUNIT_BIOS_READ_TELE_INFO
l_.str.3:                               ; @.str.3
	.asciz	"PSS TELEM_INFO Read Failed\n"

l_.str.4:                               ; @.str.4
	.asciz	"PSS:Insufficient Space for SRAM Trace\n"

	.comm	_TELEM_MAX_OS_ALLOCATED_EVENTS,8,3 ; @TELEM_MAX_OS_ALLOCATED_EVENTS
	.comm	_TELEM_SAMPLING_DEFAULT_PERIOD,8,3 ; @TELEM_SAMPLING_DEFAULT_PERIOD
	.comm	_TELEM_RESET,4,2                ; @TELEM_RESET
l_.str.5:                               ; @.str.5
	.asciz	"TELEMETRY Setup Failed\n"

	.no_dead_strip	_telemetry_setup
.subsections_via_symbols
