	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function quick_pit_calibrate
_quick_pit_calibrate:                   ## @quick_pit_calibrate
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	$97, %edi
	callq	_inb
                                        ## kill: def $eax killed $eax def $rax
	andl	$-4, %eax
	leal	1(%rax), %edi
	movl	$97, %esi
	callq	_outb
	movl	$176, %edi
	movl	$67, %esi
	callq	_outb
	movl	$255, %edi
	movl	$66, %esi
	callq	_outb
	movl	$255, %edi
	movl	$66, %esi
	callq	_outb
	xorl	%edi, %edi
	callq	_pit_verify_msb
	leaq	-72(%rbp), %rsi
	leaq	-64(%rbp), %rdx
	movl	$255, %edi
	callq	_pit_expect_msb
	testq	%rax, %rax
	je	LBB0_8
## %bb.1:
	movq	_MAX_QUICK_PIT_ITERATIONS@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	jle	LBB0_8
## %bb.2:
	movl	$256000, %r14d                  ## imm = 0x3E800
	movl	$253, %ebx
	xorl	%r13d, %r13d
	leaq	-48(%rbp), %r15
	leaq	-56(%rbp), %r12
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	leal	1(%rbx), %edi
	movq	%r15, %rsi
	movq	%r12, %rdx
	callq	_pit_expect_msb
	testq	%rax, %rax
	je	LBB0_8
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	-48(%rbp), %rax
	subq	-72(%rbp), %rax
	movq	%rax, -48(%rbp)
	movq	-56(%rbp), %rcx
	addq	-64(%rbp), %rcx
	shrq	$11, %rax
	cmpq	%rax, %rcx
	jb	LBB0_5
## %bb.7:                               ##   in Loop: Header=BB0_3 Depth=1
	addl	$256000, %r14d                  ## imm = 0x3E800
	decl	%ebx
	incl	%r13d
	movq	_MAX_QUICK_PIT_ITERATIONS@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r13d
	jl	LBB0_3
	jmp	LBB0_8
LBB0_5:
	movl	%ebx, %edi
	callq	_pit_verify_msb
	testl	%eax, %eax
	je	LBB0_8
## %bb.6:
	movq	_PIT_TICK_RATE@GOTPCREL(%rip), %rax
	movq	-48(%rbp), %rdi
	imulq	(%rax), %rdi
	movq	%rdi, -48(%rbp)
	movl	%r14d, %esi
	callq	_do_div
	leaq	L_.str.1(%rip), %rdi
	callq	_printk
	movq	-48(%rbp), %rax
	jmp	LBB0_9
LBB0_8:
	leaq	L_.str(%rip), %rdi
	callq	_printk
	xorl	%eax, %eax
LBB0_9:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MAX_QUICK_PIT_ITERATIONS,4,2   ## @MAX_QUICK_PIT_ITERATIONS
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Fast TSC calibration failed\n"

	.comm	_PIT_TICK_RATE,8,3              ## @PIT_TICK_RATE
L_.str.1:                               ## @.str.1
	.asciz	"Fast TSC calibration using PIT\n"

	.no_dead_strip	_quick_pit_calibrate
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function quick_pit_calibrate
_quick_pit_calibrate:                   ; @quick_pit_calibrate
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	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
	mov	w0, #97
	bl	_inb
	and	w8, w0, #0xfffffffc
	orr	w0, w8, #0x1
	mov	w1, #97
	bl	_outb
	mov	w0, #176
	mov	w1, #67
	bl	_outb
	mov	w0, #255
	mov	w1, #66
	bl	_outb
	mov	w0, #255
	mov	w1, #66
	bl	_outb
	mov	w0, #0
	bl	_pit_verify_msb
	add	x1, sp, #24
	add	x2, sp, #8
	mov	w0, #255
	bl	_pit_expect_msb
	cbz	x0, LBB0_8
; %bb.1:
Lloh0:
	adrp	x21, _MAX_QUICK_PIT_ITERATIONS@GOTPAGE
Lloh1:
	ldr	x21, [x21, _MAX_QUICK_PIT_ITERATIONS@GOTPAGEOFF]
	ldr	w8, [x21]
	cmp	w8, #1
	b.lt	LBB0_8
; %bb.2:
	mov	w22, #0
	mov	w20, #253
	mov	w23, #59392
	movk	w23, #3, lsl #16
	mov	w19, #59392
	movk	w19, #3, lsl #16
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	add	w0, w20, #1
	add	x1, sp, #16
	mov	x2, sp
	bl	_pit_expect_msb
	cbz	x0, LBB0_8
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	ldp	x9, x8, [sp, #16]
	sub	x8, x9, x8
	str	x8, [sp, #16]
	ldp	x10, x9, [sp]
	add	x9, x10, x9
	cmp	x9, x8, lsr #11
	b.lo	LBB0_6
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w8, [x21]
	add	w19, w19, w23
	sub	w20, w20, #1
	add	w22, w22, #1
	cmp	w22, w8
	b.lt	LBB0_3
	b	LBB0_8
LBB0_6:
	mov	x0, x20
	bl	_pit_verify_msb
	cbz	w0, LBB0_8
; %bb.7:
Lloh2:
	adrp	x8, _PIT_TICK_RATE@GOTPAGE
Lloh3:
	ldr	x8, [x8, _PIT_TICK_RATE@GOTPAGEOFF]
Lloh4:
	ldr	x8, [x8]
	ldr	x9, [sp, #16]
	mul	x0, x9, x8
	str	x0, [sp, #16]
	mov	x1, x19
	bl	_do_div
Lloh5:
	adrp	x0, l_.str.1@PAGE
Lloh6:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_printk
	ldr	x0, [sp, #16]
	b	LBB0_9
LBB0_8:
Lloh7:
	adrp	x0, l_.str@PAGE
Lloh8:
	add	x0, x0, l_.str@PAGEOFF
	bl	_printk
	mov	x0, #0
LBB0_9:
	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
	add	sp, sp, #96
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_MAX_QUICK_PIT_ITERATIONS,4,2   ; @MAX_QUICK_PIT_ITERATIONS
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Fast TSC calibration failed\n"

	.comm	_PIT_TICK_RATE,8,3              ; @PIT_TICK_RATE
l_.str.1:                               ; @.str.1
	.asciz	"Fast TSC calibration using PIT\n"

	.no_dead_strip	_quick_pit_calibrate
.subsections_via_symbols
