	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function bbc_spkr_event
_bbc_spkr_event:                        ## @bbc_spkr_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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, %r12d
	movl	%edx, %r15d
	movl	%esi, %ebx
	movl	(%rdi), %edi
	callq	_dev_get_drvdata
	movq	%rax, %r14
	movq	_EV_SND@GOTPCREL(%rip), %rax
	movl	$-1, %r13d
	cmpl	%ebx, (%rax)
	jne	LBB0_9
## %bb.1:
	cmpl	$128, %r15d
	je	LBB0_4
## %bb.2:
	cmpl	$129, %r15d
	jne	LBB0_9
## %bb.3:
	testl	%r12d, %r12d
	movl	$1000, %eax                     ## imm = 0x3E8
	cmovel	%r12d, %eax
	movl	%eax, %r12d
LBB0_4:
	movq	%r14, %r15
	addq	$8, %r15
	leal	-21(%r12), %eax
	xorl	%esi, %esi
	cmpl	$32745, %eax                    ## imm = 0x7FE9
	ja	LBB0_6
## %bb.5:
	movl	$1193182, %eax                  ## imm = 0x1234DE
	xorl	%edx, %edx
	divl	%r12d
	movl	%eax, %esi
LBB0_6:
	movq	%r15, %rdi
	callq	_bbc_count_to_reg
	movl	%eax, %ebx
	movq	%r14, %rdi
	callq	_spin_lock_irqsave
	movq	8(%r14), %rsi
	testl	%ebx, %ebx
	je	LBB0_8
## %bb.7:
	movl	$1, %edi
	callq	_sbus_writeb
	movq	(%r15), %rsi
	addq	$2, %rsi
	xorl	%edi, %edi
	callq	_sbus_writeb
	movl	%ebx, %eax
	shrl	$16, %eax
	movzbl	%al, %edi
	movq	(%r15), %rsi
	addq	$3, %rsi
	callq	_sbus_writeb
	movzbl	%bh, %edi
	movq	(%r15), %rsi
	addq	$4, %rsi
	callq	_sbus_writeb
	movq	(%r15), %rsi
	addq	$5, %rsi
LBB0_8:
	xorl	%r13d, %r13d
	xorl	%edi, %edi
	callq	_sbus_writeb
	movq	%r14, %rdi
	callq	_spin_unlock_irqrestore
LBB0_9:
	movl	%r13d, %eax
	addq	$8, %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
	.no_dead_strip	_bbc_spkr_event
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function bbc_spkr_event
_bbc_spkr_event:                        ; @bbc_spkr_event
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x21, x3
	mov	x20, x2
	mov	x22, x1
	ldr	w0, [x0]
	bl	_dev_get_drvdata
Lloh0:
	adrp	x8, _EV_SND@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EV_SND@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w22
	b.ne	LBB0_7
; %bb.1:
	mov	x19, x0
	cmp	w20, #128
	b.eq	LBB0_4
; %bb.2:
	cmp	w20, #129
	b.ne	LBB0_7
; %bb.3:
	mov	w8, #1000
	cmp	w21, #0
	csel	w21, wzr, w8, eq
LBB0_4:
	add	x20, x19, #8
	sub	w8, w21, #21
	mov	w9, #32745
	mov	w10, #13534
	movk	w10, #18, lsl #16
	udiv	w10, w10, w21
	cmp	w8, w9
	csel	w1, wzr, w10, hi
	mov	x0, x20
	bl	_bbc_count_to_reg
	mov	x21, x0
	mov	x0, x19
	bl	_spin_lock_irqsave
	ldr	x1, [x19, #8]
	cbz	w21, LBB0_6
; %bb.5:
	mov	w0, #1
	bl	_sbus_writeb
	ldr	x8, [x20]
	add	x1, x8, #2
	mov	w0, #0
	bl	_sbus_writeb
	ubfx	w0, w21, #16, #8
	ldr	x8, [x20]
	add	x1, x8, #3
	bl	_sbus_writeb
	ubfx	w0, w21, #8, #8
	ldr	x8, [x20]
	add	x1, x8, #4
	bl	_sbus_writeb
	ldr	x8, [x20]
	add	x1, x8, #5
LBB0_6:
	mov	w0, #0
	bl	_sbus_writeb
	mov	x0, x19
	bl	_spin_unlock_irqrestore
	mov	w0, #0
	b	LBB0_8
LBB0_7:
	mov	w0, #-1
LBB0_8:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_EV_SND,4,2                     ; @EV_SND
	.no_dead_strip	_bbc_spkr_event
.subsections_via_symbols
