	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function gameport_measure_speed
_gameport_measure_speed:                ## @gameport_measure_speed
	.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	%rdi, %r13
	movq	_GAMEPORT_MODE_RAW@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	xorl	%r14d, %r14d
	xorl	%esi, %esi
	callq	_gameport_open
	testq	%rax, %rax
	jne	LBB0_8
## %bb.1:
	movl	$-1, %ebx
	xorl	%r14d, %r14d
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_3 Depth 2
	movl	%ebx, -48(%rbp)                 ## 4-byte Spill
	callq	_local_irq_save
	xorl	%eax, %eax
	callq	_ktime_get_ns
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movl	$50, %ebx
	.p2align	4, 0x90
LBB0_3:                                 ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	%r13, %rdi
	callq	_gameport_read
	decl	%ebx
	jne	LBB0_3
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	xorl	%eax, %eax
	callq	_ktime_get_ns
	movl	%eax, %r15d
	xorl	%eax, %eax
	callq	_ktime_get_ns
	movl	%eax, %r12d
	callq	_local_irq_restore
	leal	(%r14,%r14), %eax
	leal	(%rax,%rax,4), %edi
	callq	_udelay
	addl	%r15d, %r15d
	addl	-44(%rbp), %r12d                ## 4-byte Folded Reload
	subl	%r12d, %r15d
	movl	-48(%rbp), %ebx                 ## 4-byte Reload
	cmpl	%ebx, %r15d
	cmovbl	%r15d, %ebx
	incl	%r14d
	cmpl	$50, %r14d
	jne	LBB0_2
## %bb.5:
	movq	%r13, %rdi
	callq	_gameport_close
	testl	%ebx, %ebx
	je	LBB0_6
## %bb.7:
	movl	$50000000, %eax                 ## imm = 0x2FAF080
	xorl	%edx, %edx
	divl	%ebx
	movl	%eax, %r14d
	jmp	LBB0_8
LBB0_6:
	movl	$50000000, %r14d                ## imm = 0x2FAF080
LBB0_8:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_GAMEPORT_MODE_RAW,4,2          ## @GAMEPORT_MODE_RAW
	.no_dead_strip	_gameport_measure_speed
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function gameport_measure_speed
_gameport_measure_speed:                ; @gameport_measure_speed
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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, _GAMEPORT_MODE_RAW@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GAMEPORT_MODE_RAW@GOTPAGEOFF]
Lloh2:
	ldr	w2, [x8]
	mov	x1, #0
	bl	_gameport_open
	cbz	x0, LBB0_2
; %bb.1:
	mov	w20, #0
	b	LBB0_8
LBB0_2:
	mov	w24, #0
	mov	w23, #-1
LBB0_3:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_4 Depth 2
	bl	_local_irq_save
	mov	w21, #50
	bl	_ktime_get_ns
	mov	x20, x0
LBB0_4:                                 ;   Parent Loop BB0_3 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	mov	x0, x19
	bl	_gameport_read
	subs	w21, w21, #1
	b.ne	LBB0_4
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	bl	_ktime_get_ns
	mov	x21, x0
	bl	_ktime_get_ns
	mov	x22, x0
	bl	_local_irq_restore
	add	w8, w24, w24, lsl #2
	lsl	w0, w8, #1
	bl	_udelay
	lsl	w8, w21, #1
	add	w9, w22, w20
	sub	w8, w8, w9
	cmp	w8, w23
	csel	w23, w8, w23, lo
	add	w24, w24, #1
	cmp	w24, #50
	b.ne	LBB0_3
; %bb.6:
	mov	w20, #61568
	movk	w20, #762, lsl #16
	mov	x0, x19
	bl	_gameport_close
	cbz	w23, LBB0_8
; %bb.7:
	udiv	w20, w20, w23
LBB0_8:
	mov	x0, x20
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_GAMEPORT_MODE_RAW,4,2          ; @GAMEPORT_MODE_RAW
	.no_dead_strip	_gameport_measure_speed
.subsections_via_symbols
