	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function analog_calibrate_timer
_analog_calibrate_timer:                ## @analog_calibrate_timer
	.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	$24, %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	8(%rdi), %r13
	movq	_use_ktime@GOTPCREL(%rip), %rax
	movl	$1000000, %ebx                  ## imm = 0xF4240
	cmpq	$0, (%rax)
	jne	LBB0_2
## %bb.1:
	callq	_local_irq_save
	xorl	%eax, %eax
	callq	_get_time
	movl	%eax, %ebx
	movl	$1, %edi
	callq	_mdelay
	xorl	%eax, %eax
	callq	_get_time
	movl	%eax, %r15d
	xorl	%eax, %eax
	callq	_get_time
	movl	%eax, %r12d
	callq	_local_irq_restore
	movl	%ebx, %edi
	movl	%r15d, %esi
	callq	_delta
	movq	%rax, %rbx
	movl	%r15d, %edi
	movl	%r12d, %esi
	callq	_delta
	subl	%eax, %ebx
LBB0_2:
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	movl	%ebx, (%r14)
	movl	$-1, %r14d
	xorl	%r15d, %r15d
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_4 Depth 2
	callq	_local_irq_save
	xorl	%eax, %eax
	callq	_get_time
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movl	$50, %r12d
	.p2align	4, 0x90
LBB0_4:                                 ##   Parent Loop BB0_3 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	%r13, %rdi
	callq	_gameport_read
	xorl	%eax, %eax
	callq	_get_time
	decl	%r12d
	jne	LBB0_4
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	%eax, %ebx
	xorl	%eax, %eax
	callq	_get_time
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	callq	_local_irq_restore
	movl	%r15d, %edi
	callq	_udelay
	movl	-48(%rbp), %edi                 ## 4-byte Reload
	movl	%ebx, %esi
	callq	_delta
	movq	%rax, %r12
	movl	%ebx, %edi
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	callq	_delta
	subl	%eax, %r12d
	cmpl	%r12d, %r14d
	cmovael	%r12d, %r14d
	incl	%r15d
	cmpl	$50, %r15d
	jne	LBB0_3
## %bb.6:
	movl	%r14d, %eax
	imulq	$1374389535, %rax, %rax         ## imm = 0x51EB851F
	shrq	$36, %rax
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	movl	%eax, 4(%rcx)
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_use_ktime,8,3                  ## @use_ktime
	.comm	_analog_faketime,4,2            ## @analog_faketime
	.no_dead_strip	_analog_calibrate_timer
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function analog_calibrate_timer
_analog_calibrate_timer:                ; @analog_calibrate_timer
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x19, x0
	ldr	x20, [x0, #8]
Lloh0:
	adrp	x8, _use_ktime@GOTPAGE
Lloh1:
	ldr	x8, [x8, _use_ktime@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cbz	x8, LBB0_2
; %bb.1:
	mov	w8, #16960
	movk	w8, #15, lsl #16
	b	LBB0_3
LBB0_2:
	bl	_local_irq_save
	bl	_get_time
	mov	x21, x0
	mov	w0, #1
	bl	_mdelay
	bl	_get_time
	mov	x22, x0
	bl	_get_time
	mov	x23, x0
	bl	_local_irq_restore
	mov	x0, x21
	mov	x1, x22
	bl	_delta
	mov	x21, x0
	mov	x0, x22
	mov	x1, x23
	bl	_delta
	sub	w8, w21, w0
LBB0_3:
	mov	w21, #0
	str	w8, [x19]
	mov	w25, #-1
LBB0_4:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_5 Depth 2
	bl	_local_irq_save
	mov	w24, #50
	bl	_get_time
	mov	x22, x0
LBB0_5:                                 ;   Parent Loop BB0_4 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	mov	x0, x20
	bl	_gameport_read
	bl	_get_time
	subs	w24, w24, #1
	b.ne	LBB0_5
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	x23, x0
	bl	_get_time
	mov	x24, x0
	bl	_local_irq_restore
	mov	x0, x21
	bl	_udelay
	mov	x0, x22
	mov	x1, x23
	bl	_delta
	mov	x22, x0
	mov	x0, x23
	mov	x1, x24
	bl	_delta
	sub	w8, w22, w0
	cmp	w25, w8
	csel	w25, w25, w8, lo
	add	w21, w21, #1
	cmp	w21, #50
	b.ne	LBB0_4
; %bb.7:
	mov	w8, #34079
	movk	w8, #20971, lsl #16
	umull	x8, w25, w8
	lsr	x8, x8, #36
	str	w8, [x19, #4]
	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
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_use_ktime,8,3                  ; @use_ktime
	.comm	_analog_faketime,4,2            ; @analog_faketime
	.no_dead_strip	_analog_calibrate_timer
.subsections_via_symbols
