	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function op_amd_setup_ctrs
_op_amd_setup_ctrs:                     ## @op_amd_setup_ctrs
	.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, %r15
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	movq	_OP_MAX_COUNTER@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	jle	LBB0_8
## %bb.1:
	xorl	%ebx, %ebx
	movq	_counter_config@GOTPCREL(%rip), %r14
	xorl	%r13d, %r13d
	jmp	LBB0_4
	.p2align	4, 0x90
LBB0_2:                                 ##   in Loop: Header=BB0_4 Depth=1
	xorl	%eax, %eax
LBB0_3:                                 ##   in Loop: Header=BB0_4 Depth=1
	movq	_reset_value@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	%rax, (%rcx,%rbx)
	incq	%r13
	movq	_OP_MAX_COUNTER@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	addq	$8, %rbx
	cmpq	%rax, %r13
	jge	LBB0_8
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r14), %rax
	cmpq	$0, 8(%rax,%rbx,2)
	je	LBB0_2
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=1
	movq	8(%r15), %r12
	movl	%r13d, %edi
	callq	_op_x86_virt_to_phys
	cmpq	$0, (%r12,%rax,8)
	je	LBB0_2
## %bb.6:                               ##   in Loop: Header=BB0_4 Depth=1
	movq	(%r14), %rax
	movq	(%rax,%rbx,2), %rax
	jmp	LBB0_3
LBB0_8:
	movq	_num_counters@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	jle	LBB0_20
## %bb.9:
	xorl	%ebx, %ebx
	movq	_ARCH_PERFMON_EVENTSEL_ENABLE@GOTPCREL(%rip), %r13
                                        ## implicit-def: $r12d
	jmp	LBB0_12
	.p2align	4, 0x90
LBB0_10:                                ##   in Loop: Header=BB0_12 Depth=1
	andl	(%r14), %r12d
	movq	(%r15), %rax
	movq	(%rax,%rbx,8), %rdi
	movl	%r12d, %esi
	callq	_wrmsrl
	movq	8(%r15), %rax
	movq	(%rax,%rbx,8), %rdi
	movl	$-1, %esi
	callq	_wrmsrl
	movq	_num_counters@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
LBB0_11:                                ##   in Loop: Header=BB0_12 Depth=1
	incq	%rbx
	movslq	%eax, %rcx
	cmpq	%rcx, %rbx
	jge	LBB0_15
LBB0_12:                                ## =>This Inner Loop Header: Depth=1
	movq	(%r15), %rcx
	movq	(%rcx,%rbx,8), %rdi
	testq	%rdi, %rdi
	je	LBB0_11
## %bb.13:                              ##   in Loop: Header=BB0_12 Depth=1
	movl	%r12d, %esi
	callq	_rdmsrl
	testl	%r12d, (%r13)
	je	LBB0_10
## %bb.14:                              ##   in Loop: Header=BB0_12 Depth=1
	movl	%ebx, %edi
	callq	_op_x86_warn_in_use
	jmp	LBB0_10
LBB0_15:
	testl	%eax, %eax
	jle	LBB0_20
## %bb.16:
	xorl	%ebx, %ebx
	jmp	LBB0_18
	.p2align	4, 0x90
LBB0_17:                                ##   in Loop: Header=BB0_18 Depth=1
	incq	%rbx
	movq	_num_counters@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	cmpq	%rax, %rbx
	jge	LBB0_20
LBB0_18:                                ## =>This Inner Loop Header: Depth=1
	movl	%ebx, %edi
	callq	_op_x86_phys_to_virt
	movq	_reset_value@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movslq	%eax, %r13
	movq	(%rcx,%r13,8), %rsi
	testq	%rsi, %rsi
	je	LBB0_17
## %bb.19:                              ##   in Loop: Header=BB0_18 Depth=1
	movq	8(%r15), %rax
	movq	(%rax,%rbx,8), %rdi
	negl	%esi
                                        ## kill: def $esi killed $esi killed $rsi
	callq	_wrmsrl
	movq	(%r15), %rax
	movq	(%rax,%rbx,8), %rdi
	movl	%r12d, %esi
	callq	_rdmsrl
	andl	(%r14), %r12d
	shlq	$4, %r13
	movq	_counter_config@GOTPCREL(%rip), %rax
	addq	(%rax), %r13
	movq	%r14, %rdi
	movq	%r13, %rsi
	callq	_op_x86_get_ctrl
	orl	%eax, %r12d
	movq	(%r15), %rax
	movq	(%rax,%rbx,8), %rdi
	movl	%r12d, %esi
	callq	_wrmsrl
	jmp	LBB0_17
LBB0_20:
	movq	_ibs_caps@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_22
## %bb.21:
	xorl	%eax, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_setup_APIC_ibs                 ## TAILCALL
LBB0_22:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_OP_MAX_COUNTER,4,2             ## @OP_MAX_COUNTER
	.comm	_counter_config,8,3             ## @counter_config
	.comm	_reset_value,8,3                ## @reset_value
	.comm	_num_counters,4,2               ## @num_counters
	.comm	_ARCH_PERFMON_EVENTSEL_ENABLE,4,2 ## @ARCH_PERFMON_EVENTSEL_ENABLE
	.comm	_ibs_caps,8,3                   ## @ibs_caps
	.no_dead_strip	_op_amd_setup_ctrs
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function op_amd_setup_ctrs
_op_amd_setup_ctrs:                     ; @op_amd_setup_ctrs
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x1
	mov	x20, x0
Lloh0:
	adrp	x22, _OP_MAX_COUNTER@GOTPAGE
Lloh1:
	ldr	x22, [x22, _OP_MAX_COUNTER@GOTPAGEOFF]
	ldr	w8, [x22]
Lloh2:
	adrp	x23, _counter_config@GOTPAGE
Lloh3:
	ldr	x23, [x23, _counter_config@GOTPAGEOFF]
Lloh4:
	adrp	x24, _reset_value@GOTPAGE
Lloh5:
	ldr	x24, [x24, _reset_value@GOTPAGEOFF]
	cmp	w8, #1
	b.lt	LBB0_6
; %bb.1:
	mov	x25, #0
	mov	x21, #0
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	ldr	x9, [x24]
	str	x8, [x9, x21, lsl #3]
	add	x21, x21, #1
	ldrsw	x8, [x22]
	add	x25, x25, #16
	cmp	x21, x8
	b.ge	LBB0_6
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x23]
	add	x8, x8, x25
	ldr	x8, [x8, #8]
	cbz	x8, LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	x26, [x19, #8]
	mov	x0, x21
	bl	_op_x86_virt_to_phys
	ldr	x8, [x26, x0, lsl #3]
	cbz	x8, LBB0_2
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	x8, [x23]
	ldr	x8, [x8, x25]
	b	LBB0_2
LBB0_6:
Lloh6:
	adrp	x25, _num_counters@GOTPAGE
Lloh7:
	ldr	x25, [x25, _num_counters@GOTPAGEOFF]
	ldr	w8, [x25]
	cmp	w8, #1
	b.lt	LBB0_18
; %bb.7:
	mov	x22, #0
Lloh8:
	adrp	x26, _ARCH_PERFMON_EVENTSEL_ENABLE@GOTPAGE
Lloh9:
	ldr	x26, [x26, _ARCH_PERFMON_EVENTSEL_ENABLE@GOTPAGEOFF]
                                        ; implicit-def: $w21
	b	LBB0_10
LBB0_8:                                 ;   in Loop: Header=BB0_10 Depth=1
	ldr	w8, [x20]
	and	w21, w8, w21
	ldr	x8, [x19]
	lsl	x27, x22, #3
	ldr	x0, [x8, x27]
	mov	x1, x21
	bl	_wrmsrl
	ldr	x8, [x19, #8]
	ldr	x0, [x8, x27]
	mov	w1, #-1
	bl	_wrmsrl
	ldr	w8, [x25]
LBB0_9:                                 ;   in Loop: Header=BB0_10 Depth=1
	add	x22, x22, #1
	cmp	x22, w8, sxtw
	b.ge	LBB0_13
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	ldr	x9, [x19]
	ldr	x0, [x9, x22, lsl #3]
	cbz	x0, LBB0_9
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=1
	mov	x1, x21
	bl	_rdmsrl
	ldr	w8, [x26]
	tst	w8, w21
	b.eq	LBB0_8
; %bb.12:                               ;   in Loop: Header=BB0_10 Depth=1
	mov	x0, x22
	bl	_op_x86_warn_in_use
	b	LBB0_8
LBB0_13:
	cmp	w8, #1
	b.lt	LBB0_18
; %bb.14:
	mov	x22, #0
	b	LBB0_16
LBB0_15:                                ;   in Loop: Header=BB0_16 Depth=1
	add	x22, x22, #1
	ldrsw	x8, [x25]
	cmp	x22, x8
	b.ge	LBB0_18
LBB0_16:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x22
	bl	_op_x86_phys_to_virt
                                        ; kill: def $w0 killed $w0 def $x0
	ldr	x8, [x24]
	ldr	x8, [x8, w0, sxtw #3]
	cbz	x8, LBB0_15
; %bb.17:                               ;   in Loop: Header=BB0_16 Depth=1
	sxtw	x26, w0
	ldr	x9, [x19, #8]
	lsl	x27, x22, #3
	ldr	x0, [x9, x27]
	neg	w1, w8
	bl	_wrmsrl
	ldr	x8, [x19]
	ldr	x0, [x8, x27]
	mov	x1, x21
	bl	_rdmsrl
	ldr	w8, [x20]
	and	w21, w8, w21
	ldr	x8, [x23]
	add	x1, x8, x26, lsl #4
	mov	x0, x20
	bl	_op_x86_get_ctrl
	orr	w21, w0, w21
	ldr	x8, [x19]
	ldr	x0, [x8, x27]
	mov	x1, x21
	bl	_wrmsrl
	b	LBB0_15
LBB0_18:
Lloh10:
	adrp	x8, _ibs_caps@GOTPAGE
Lloh11:
	ldr	x8, [x8, _ibs_caps@GOTPAGEOFF]
Lloh12:
	ldr	x8, [x8]
	cbz	x8, LBB0_20
; %bb.19:
	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
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	b	_setup_APIC_ibs
LBB0_20:
	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
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_OP_MAX_COUNTER,4,2             ; @OP_MAX_COUNTER
	.comm	_counter_config,8,3             ; @counter_config
	.comm	_reset_value,8,3                ; @reset_value
	.comm	_num_counters,4,2               ; @num_counters
	.comm	_ARCH_PERFMON_EVENTSEL_ENABLE,4,2 ; @ARCH_PERFMON_EVENTSEL_ENABLE
	.comm	_ibs_caps,8,3                   ; @ibs_caps
	.no_dead_strip	_op_amd_setup_ctrs
.subsections_via_symbols
