	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function snd_pmac_beep_event
_snd_pmac_beep_event:                   ## @snd_pmac_beep_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	%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	_EV_SND@GOTPCREL(%rip), %rax
	movl	$-1, %ebx
	cmpl	%esi, (%rax)
	jne	LBB0_24
## %bb.1:
	movl	%ecx, %r14d
	cmpl	$128, %edx
	je	LBB0_4
## %bb.2:
	cmpl	$129, %edx
	jne	LBB0_24
## %bb.3:
	testl	%r14d, %r14d
	movl	$1000, %eax                     ## imm = 0x3E8
	cmovnel	%eax, %r14d
LBB0_4:
	callq	_input_get_drvdata
	testq	%rax, %rax
	je	LBB0_24
## %bb.5:
	movq	%rax, %r12
	movq	32(%rax), %r15
	testq	%r15, %r15
	je	LBB0_24
## %bb.6:
	testl	%r14d, %r14d
	je	LBB0_7
## %bb.9:
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	leaq	24(%r12), %rsi
	movq	_BEEP_SRATE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r12, %rdi
	callq	_snd_pmac_rate_index
	movl	%eax, %ebx
	movq	(%r12), %rax
	movslq	%ebx, %rcx
	movl	(%rax,%rcx,4), %r13d
	movq	_BEEP_BUFLEN@GOTPCREL(%rip), %rcx
	movl	%r13d, %eax
	cltd
	idivl	(%rcx)
	movl	%r13d, %ecx
	shrl	$31, %ecx
	addl	%r13d, %ecx
	sarl	%ecx
	cmpl	%eax, %r14d
	movl	$1000, %eax                     ## imm = 0x3E8
	movl	%r14d, %r15d
	cmovlel	%eax, %r15d
	cmpl	%ecx, %r14d
	cmovgl	%eax, %r15d
	movq	%r12, %r14
	addq	$8, %r14
	movq	%r14, %rdi
	callq	_spin_lock_irqsave
	cmpq	$0, 24(%r12)
	jne	LBB0_23
## %bb.10:
	movl	%ebx, -44(%rbp)                 ## 4-byte Spill
	cmpq	$0, 16(%r12)
	jne	LBB0_23
## %bb.11:
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	cmpl	$0, (%rbx)
	jne	LBB0_23
## %bb.12:
	movl	$1, (%rbx)
	movq	%r14, %rdi
	callq	_spin_unlock_irqrestore
	cmpl	4(%rbx), %r15d
	jne	LBB0_14
## %bb.13:
	movzwl	8(%rbx), %eax
	cmpw	10(%rbx), %ax
	je	LBB0_22
LBB0_14:
	shll	$8, %r13d
	movl	%r13d, %eax
	cltd
	idivl	%r15d
	movl	%eax, %esi
	movq	_BEEP_BUFLEN@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	shll	$8, %eax
	cltd
	idivl	%esi
	imull	%eax, %esi
	movl	%esi, %r8d
	sarl	$8, %r8d
	shll	$16, %eax
	cltd
	idivl	%r8d
	cmpl	$256, %esi                      ## imm = 0x100
	jl	LBB0_21
## %bb.15:
	movq	16(%rbx), %rdx
	movq	_beep_wform@GOTPCREL(%rip), %rcx
	movq	(%rcx), %r10
	cmpl	$2, %r8d
	movl	$1, %r9d
	cmovgel	%r8d, %r9d
	xorl	%ecx, %ecx
	cmpl	$512, %esi                      ## imm = 0x200
	jl	LBB0_19
## %bb.16:
	movl	%r9d, %r11d
	andl	$2147483646, %r11d              ## imm = 0x7FFFFFFE
LBB0_17:                                ## =>This Inner Loop Header: Depth=1
	movl	%ecx, %edi
	shrl	$8, %edi
	movzwl	8(%rbx), %esi
	imulw	(%r10,%rdi,2), %si
	movw	%si, 2(%rdx)
	movw	%si, (%rdx)
	addl	%eax, %ecx
	movzbl	%ch, %esi
	movzwl	8(%rbx), %edi
	imulw	(%r10,%rsi,2), %di
	movw	%di, 6(%rdx)
	movw	%di, 4(%rdx)
	addl	%eax, %ecx
	movzwl	%cx, %ecx
	addq	$8, %rdx
	addl	$-2, %r11d
	jne	LBB0_17
## %bb.18:
	shrl	$8, %ecx
LBB0_19:
	testb	$1, %r9b
	je	LBB0_21
## %bb.20:
	movzwl	8(%rbx), %eax
	imulw	(%r10,%rcx,2), %ax
	movw	%ax, 2(%rdx)
	movw	%ax, (%rdx)
LBB0_21:
	movl	%r15d, 4(%rbx)
	movzwl	8(%rbx), %eax
	movw	%ax, 10(%rbx)
	movl	%r8d, 12(%rbx)
LBB0_22:
	movq	%r14, %rdi
	callq	_spin_lock_irqsave
	movl	12(%rbx), %esi
	movl	24(%rbx), %edx
	shll	$2, %esi
	movq	%r12, %rdi
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	callq	_snd_pmac_beep_dma_start
	jmp	LBB0_23
LBB0_7:
	movq	%r12, %r14
	addq	$8, %r14
	movq	%r14, %rdi
	callq	_spin_lock_irqsave
	cmpl	$0, (%r15)
	je	LBB0_23
## %bb.8:
	movq	%r12, %rdi
	callq	_snd_pmac_beep_stop
LBB0_23:
	movq	%r14, %rdi
	callq	_spin_unlock_irqrestore
	xorl	%ebx, %ebx
LBB0_24:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EV_SND,4,2                     ## @EV_SND
	.comm	_BEEP_SRATE,4,2                 ## @BEEP_SRATE
	.comm	_BEEP_BUFLEN,4,2                ## @BEEP_BUFLEN
	.comm	_beep_wform,8,3                 ## @beep_wform
	.no_dead_strip	_snd_pmac_beep_event
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function snd_pmac_beep_event
_snd_pmac_beep_event:                   ; @snd_pmac_beep_event
	.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
Lloh0:
	adrp	x8, _EV_SND@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EV_SND@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w1
	b.ne	LBB0_17
; %bb.1:
	mov	x20, x3
	cmp	w2, #128
	b.eq	LBB0_4
; %bb.2:
	cmp	w2, #129
	b.ne	LBB0_17
; %bb.3:
	mov	w8, #1000
	cmp	w20, #0
	csel	w20, wzr, w8, eq
LBB0_4:
	bl	_input_get_drvdata
	cbz	x0, LBB0_17
; %bb.5:
	mov	x19, x0
	ldr	x22, [x0, #32]
	cbz	x22, LBB0_17
; %bb.6:
	cbz	w20, LBB0_19
; %bb.7:
	add	x1, x19, #24
Lloh3:
	adrp	x8, _BEEP_SRATE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _BEEP_SRATE@GOTPAGEOFF]
Lloh5:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_snd_pmac_rate_index
	mov	x21, x0
	ldr	x8, [x19]
	ldr	w25, [x8, w0, sxtw #2]
Lloh6:
	adrp	x24, _BEEP_BUFLEN@GOTPAGE
Lloh7:
	ldr	x24, [x24, _BEEP_BUFLEN@GOTPAGEOFF]
	ldr	w8, [x24]
	sdiv	w8, w25, w8
	cmp	w25, #0
	cinc	w9, w25, lt
	cmp	w20, w8
	asr	w8, w9, #1
	ccmp	w20, w8, #0, gt
	mov	w8, #1000
	csel	w23, w8, w20, gt
	add	x20, x19, #8
	mov	x0, x20
	bl	_spin_lock_irqsave
	ldr	x8, [x19, #24]
	cbnz	x8, LBB0_21
; %bb.8:
	ldr	x8, [x19, #16]
	cbnz	x8, LBB0_21
; %bb.9:
	ldr	w8, [x22]
	cbnz	w8, LBB0_21
; %bb.10:
	mov	w8, #1
	str	w8, [x22]
	mov	x0, x20
	bl	_spin_unlock_irqrestore
	ldr	w8, [x22, #4]
	cmp	w23, w8
	b.ne	LBB0_12
; %bb.11:
	ldrh	w8, [x22, #8]
	ldrh	w9, [x22, #10]
	cmp	w8, w9
	b.eq	LBB0_16
LBB0_12:
	lsl	w8, w25, #8
	sdiv	w8, w8, w23
	ldr	w9, [x24]
	lsl	w9, w9, #8
	sdiv	w10, w9, w8
	mul	w9, w10, w8
	asr	w8, w9, #8
	cmp	w9, #256
	b.lt	LBB0_15
; %bb.13:
	mov	w9, #0
	lsl	w13, w10, #16
Lloh8:
	adrp	x10, _beep_wform@GOTPAGE
Lloh9:
	ldr	x10, [x10, _beep_wform@GOTPAGEOFF]
	ldr	x12, [x22, #16]
Lloh10:
	ldr	x10, [x10]
	cmp	w8, #1
	csinc	w11, w8, wzr, gt
	add	x12, x12, #2
	sdiv	w13, w13, w8
LBB0_14:                                ; =>This Inner Loop Header: Depth=1
	lsr	w14, w9, #8
	ldrh	w14, [x10, w14, uxtw #1]
	ldrh	w15, [x22, #8]
	mul	w14, w15, w14
	strh	w14, [x12]
	sturh	w14, [x12, #-2]
	add	w9, w9, w13
	and	w9, w9, #0xffff
	add	x12, x12, #4
	subs	w11, w11, #1
	b.ne	LBB0_14
LBB0_15:
	str	w23, [x22, #4]
	ldrh	w9, [x22, #8]
	strh	w9, [x22, #10]
	str	w8, [x22, #12]
LBB0_16:
	mov	x0, x20
	bl	_spin_lock_irqsave
	ldr	w8, [x22, #12]
	lsl	w1, w8, #2
	ldr	w2, [x22, #24]
	mov	x0, x19
	mov	x3, x21
	bl	_snd_pmac_beep_dma_start
	b	LBB0_21
LBB0_17:
	mov	w0, #-1
LBB0_18:
	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
LBB0_19:
	add	x20, x19, #8
	mov	x0, x20
	bl	_spin_lock_irqsave
	ldr	w8, [x22]
	cbz	w8, LBB0_21
; %bb.20:
	mov	x0, x19
	bl	_snd_pmac_beep_stop
LBB0_21:
	mov	x0, x20
	bl	_spin_unlock_irqrestore
	mov	w0, #0
	b	LBB0_18
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_EV_SND,4,2                     ; @EV_SND
	.comm	_BEEP_SRATE,4,2                 ; @BEEP_SRATE
	.comm	_BEEP_BUFLEN,4,2                ; @BEEP_BUFLEN
	.comm	_beep_wform,8,3                 ; @beep_wform
	.no_dead_strip	_snd_pmac_beep_event
.subsections_via_symbols
