	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function pcspkr_event
_pcspkr_event:                          ## @pcspkr_event
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -24
                                        ## kill: def $ecx killed $ecx def $rcx
	movq	_EV_SND@GOTPCREL(%rip), %rax
	cmpl	%esi, (%rax)
	jne	LBB0_1
## %bb.2:
	cmpl	$128, %edx
	je	LBB0_5
## %bb.3:
	cmpl	$129, %edx
	jne	LBB0_1
## %bb.4:
	testl	%ecx, %ecx
	movl	$1000, %eax                     ## imm = 0x3E8
	cmovel	%ecx, %eax
	movl	%eax, %ecx
LBB0_5:
	leal	-21(%rcx), %eax
	cmpl	$32746, %eax                    ## imm = 0x7FEA
	jae	LBB0_6
## %bb.8:
	movq	_PIT_TICK_RATE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	cltd
	idivl	%ecx
	movl	%eax, %ebx
	movq	_i8253_lock@GOTPCREL(%rip), %rdi
	callq	_raw_spin_lock_irqsave
	testl	%ebx, %ebx
	je	LBB0_7
## %bb.9:
	movl	$182, %edi
	movl	$67, %esi
	callq	_outb_p
	movzbl	%bl, %edi
	movl	$66, %esi
	callq	_outb_p
	movzbl	%bh, %edi
	movl	$66, %esi
	callq	_outb
	movl	$97, %edi
	callq	_inb_p
	orl	$3, %eax
	movl	%eax, %edi
	movl	$97, %esi
	callq	_outb_p
	jmp	LBB0_10
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_11
LBB0_6:
	movq	_i8253_lock@GOTPCREL(%rip), %rdi
	callq	_raw_spin_lock_irqsave
LBB0_7:
	movl	$97, %edi
	callq	_inb_p
	andl	$252, %eax
	movl	%eax, %edi
	movl	$97, %esi
	callq	_outb
LBB0_10:
	movq	_i8253_lock@GOTPCREL(%rip), %rdi
	callq	_raw_spin_unlock_irqrestore
	xorl	%eax, %eax
LBB0_11:
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EV_SND,4,2                     ## @EV_SND
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_PIT_TICK_RATE,4,2              ## @PIT_TICK_RATE
	.comm	_i8253_lock,4,2                 ## @i8253_lock
	.no_dead_strip	_pcspkr_event
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function pcspkr_event
_pcspkr_event:                          ; @pcspkr_event
	.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
Lloh0:
	adrp	x8, _EV_SND@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EV_SND@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w1
	b.ne	LBB0_7
; %bb.1:
	cmp	w2, #128
	b.eq	LBB0_4
; %bb.2:
	cmp	w2, #129
	b.ne	LBB0_7
; %bb.3:
	mov	w8, #1000
	cmp	w3, #0
	csel	w3, wzr, w8, eq
LBB0_4:
	sub	w8, w3, #21
	mov	w9, #32746
	cmp	w8, w9
	b.hs	LBB0_8
; %bb.5:
Lloh3:
	adrp	x8, _PIT_TICK_RATE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _PIT_TICK_RATE@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	sdiv	w19, w8, w3
Lloh6:
	adrp	x0, _i8253_lock@GOTPAGE
Lloh7:
	ldr	x0, [x0, _i8253_lock@GOTPAGEOFF]
	bl	_raw_spin_lock_irqsave
	cbz	w19, LBB0_9
; %bb.6:
	mov	w0, #182
	mov	w1, #67
	bl	_outb_p
	and	w0, w19, #0xff
	mov	w1, #66
	bl	_outb_p
	ubfx	w0, w19, #8, #8
	mov	w1, #66
	bl	_outb
	mov	w0, #97
	bl	_inb_p
	orr	w0, w0, #0x3
	mov	w1, #97
	bl	_outb_p
	b	LBB0_10
LBB0_7:
Lloh8:
	adrp	x8, _EINVAL@GOTPAGE
Lloh9:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_11
LBB0_8:
Lloh11:
	adrp	x0, _i8253_lock@GOTPAGE
Lloh12:
	ldr	x0, [x0, _i8253_lock@GOTPAGEOFF]
	bl	_raw_spin_lock_irqsave
LBB0_9:
	mov	w0, #97
	bl	_inb_p
	and	w0, w0, #0xfc
	mov	w1, #97
	bl	_outb
LBB0_10:
Lloh13:
	adrp	x0, _i8253_lock@GOTPAGE
Lloh14:
	ldr	x0, [x0, _i8253_lock@GOTPAGEOFF]
	bl	_raw_spin_unlock_irqrestore
	mov	w0, #0
LBB0_11:
	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	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_EV_SND,4,2                     ; @EV_SND
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_PIT_TICK_RATE,4,2              ; @PIT_TICK_RATE
	.comm	_i8253_lock,4,2                 ; @i8253_lock
	.no_dead_strip	_pcspkr_event
.subsections_via_symbols
