	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function hpet_open
_hpet_open:                             ## @hpet_open
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	_FMODE_WRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%rsi)
	je	LBB0_2
## %bb.1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
	jmp	LBB0_11
LBB0_2:
	movq	%rsi, %r14
	xorl	%r15d, %r15d
	xorl	%eax, %eax
	callq	_lock_kernel
	movq	_hpet_lock@GOTPCREL(%rip), %rdi
	callq	_spin_lock_irq
	movq	_hpets@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	testq	%rax, %rax
	je	LBB0_10
## %bb.3:
	movq	_HPET_OPEN@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	jmp	LBB0_4
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_4 Depth=1
	movq	16(%rax), %rax
	testq	%rax, %rax
	je	LBB0_10
LBB0_4:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_7 Depth 2
	movl	(%rax), %esi
	testl	%esi, %esi
	jle	LBB0_9
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=1
	movq	8(%rax), %rbx
	.p2align	4, 0x90
LBB0_7:                                 ##   Parent Loop BB0_4 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	testl	%edx, (%rbx)
	je	LBB0_8
## %bb.6:                               ##   in Loop: Header=BB0_7 Depth=2
	addq	$16, %rbx
	decq	%rsi
	jne	LBB0_7
	jmp	LBB0_9
LBB0_8:
	movq	%rbx, 8(%r14)
	movq	$0, 8(%rbx)
	movl	(%rcx), %eax
	orl	%eax, (%rbx)
	movq	_hpet_lock@GOTPCREL(%rip), %rdi
	callq	_spin_unlock_irq
	xorl	%r15d, %r15d
	xorl	%eax, %eax
	callq	_unlock_kernel
	movq	%rbx, %rdi
	callq	_hpet_timer_set_irq
	jmp	LBB0_12
LBB0_10:
	movq	_hpet_lock@GOTPCREL(%rip), %rdi
	callq	_spin_unlock_irq
	xorl	%eax, %eax
	callq	_unlock_kernel
	movq	_EBUSY@GOTPCREL(%rip), %rax
LBB0_11:
	subl	(%rax), %r15d
LBB0_12:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_FMODE_WRITE,4,2                ## @FMODE_WRITE
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_hpet_lock,4,2                  ## @hpet_lock
	.comm	_hpets,8,3                      ## @hpets
	.comm	_HPET_OPEN,4,2                  ## @HPET_OPEN
	.comm	_EBUSY,4,2                      ## @EBUSY
	.no_dead_strip	_hpet_open
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function hpet_open
_hpet_open:                             ; @hpet_open
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	ldr	w8, [x1]
Lloh0:
	adrp	x9, _FMODE_WRITE@GOTPAGE
Lloh1:
	ldr	x9, [x9, _FMODE_WRITE@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_2
; %bb.1:
Lloh3:
	adrp	x8, _EINVAL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_11
LBB0_2:
	mov	x19, x1
	bl	_lock_kernel
Lloh5:
	adrp	x0, _hpet_lock@GOTPAGE
Lloh6:
	ldr	x0, [x0, _hpet_lock@GOTPAGEOFF]
	bl	_spin_lock_irq
Lloh7:
	adrp	x8, _hpets@GOTPAGE
Lloh8:
	ldr	x8, [x8, _hpets@GOTPAGEOFF]
Lloh9:
	ldr	x8, [x8]
	cbz	x8, LBB0_10
; %bb.3:
Lloh10:
	adrp	x9, _HPET_OPEN@GOTPAGE
Lloh11:
	ldr	x9, [x9, _HPET_OPEN@GOTPAGEOFF]
	ldr	w10, [x9]
	b	LBB0_5
LBB0_4:                                 ;   in Loop: Header=BB0_5 Depth=1
	ldr	x8, [x8, #16]
	cbz	x8, LBB0_10
LBB0_5:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_7 Depth 2
	ldr	w11, [x8]
	cmp	w11, #1
	b.lt	LBB0_4
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	x20, [x8, #8]
LBB0_7:                                 ;   Parent Loop BB0_5 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w12, [x20]
	tst	w10, w12
	b.eq	LBB0_9
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=2
	add	x20, x20, #16
	subs	x11, x11, #1
	b.ne	LBB0_7
	b	LBB0_4
LBB0_9:
	str	x20, [x19, #8]
	str	xzr, [x20, #8]
	ldr	w8, [x9]
	ldr	w9, [x20]
	orr	w8, w9, w8
	str	w8, [x20]
Lloh12:
	adrp	x0, _hpet_lock@GOTPAGE
Lloh13:
	ldr	x0, [x0, _hpet_lock@GOTPAGEOFF]
	bl	_spin_unlock_irq
	bl	_unlock_kernel
	mov	x0, x20
	bl	_hpet_timer_set_irq
	mov	w0, #0
	b	LBB0_12
LBB0_10:
Lloh14:
	adrp	x0, _hpet_lock@GOTPAGE
Lloh15:
	ldr	x0, [x0, _hpet_lock@GOTPAGEOFF]
	bl	_spin_unlock_irq
	bl	_unlock_kernel
Lloh16:
	adrp	x8, _EBUSY@GOTPAGE
Lloh17:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
LBB0_11:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_12:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_FMODE_WRITE,4,2                ; @FMODE_WRITE
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_hpet_lock,4,2                  ; @hpet_lock
	.comm	_hpets,8,3                      ; @hpets
	.comm	_HPET_OPEN,4,2                  ; @HPET_OPEN
	.comm	_EBUSY,4,2                      ; @EBUSY
	.no_dead_strip	_hpet_open
.subsections_via_symbols
