	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function bcm2835_audio_worker
_bcm2835_audio_worker:                  ## @bcm2835_audio_worker
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r13
	movq	_PLAYBACK_IDLE@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 32(%rdi)
	movq	(%rdi), %rax
	movq	_WORKER_RUNNING@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_15
## %bb.1:
	leaq	32(%r13), %r14
	leaq	24(%r13), %r15
	leaq	72(%r13), %rbx
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	movq	%rbx, -72(%rbp)                 ## 8-byte Spill
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_12:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	%r14, %rdi
	callq	_bcm2835_audio_stop
	movq	%r13, %rdi
	callq	_BCM2835_AUDIO_LOCK
	movq	%r14, %rdi
	callq	_bcm2835_audio_reset_channel
	movq	_PLAYBACK_IDLE@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 32(%r13)
LBB0_13:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	%r13, %rdi
	callq	_BCM2835_AUDIO_UNLOCK
LBB0_14:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	(%r13), %rax
	movq	_WORKER_RUNNING@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	movq	-72(%rbp), %rbx                 ## 8-byte Reload
	jne	LBB0_15
LBB0_2:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_3 Depth 2
	movq	%r13, %rdi
	callq	_BCM2835_AUDIO_LOCK
	.p2align	4, 0x90
LBB0_3:                                 ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	8(%r13), %r12
	testq	%r12, %r12
	jne	LBB0_6
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=2
	movq	%r14, %rdi
	callq	_bcm2835_audio_buffer_should_sleep
	testq	%rax, %rax
	je	LBB0_5
## %bb.23:                              ##   in Loop: Header=BB0_3 Depth=2
	movq	%r15, %rdi
	movq	%rbx, %rsi
	callq	_cv_wait_sig
	jmp	LBB0_3
LBB0_5:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	8(%r13), %r12
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	$0, 8(%r13)
	movq	%r13, %rdi
	callq	_BCM2835_AUDIO_UNLOCK
	movq	_AUDIO_PARAMS@GOTPCREL(%rip), %rax
	testl	%r12d, (%rax)
	je	LBB0_10
## %bb.7:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	%r13, %rdi
	callq	_BCM2835_AUDIO_LOCK
	movl	40(%r13), %eax
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movl	44(%r13), %eax
	movl	%eax, -60(%rbp)                 ## 4-byte Spill
	movl	16(%r13), %ebx
	movl	20(%r13), %r15d
	movq	%r13, %rdi
	callq	_BCM2835_AUDIO_UNLOCK
	movq	32(%r13), %rax
	movq	_PLAYBACK_IDLE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	%r13, %rdi
	movl	-60(%rbp), %esi                 ## 4-byte Reload
	movl	-48(%rbp), %edx                 ## 4-byte Reload
	callq	_bcm2835_audio_update_params
LBB0_9:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	%r13, %rdi
	movl	%ebx, %esi
	movl	%r15d, %edx
	callq	_bcm2835_audio_update_controls
	movq	-56(%rbp), %r15                 ## 8-byte Reload
LBB0_10:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	_AUDIO_STOP@GOTPCREL(%rip), %rax
	testl	%r12d, (%rax)
	je	LBB0_16
## %bb.11:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	(%r14), %rax
	movq	_PLAYBACK_PLAYING@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_12
LBB0_16:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	_AUDIO_PLAY@GOTPCREL(%rip), %rax
	testl	%r12d, (%rax)
	je	LBB0_19
## %bb.17:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	(%r14), %rax
	movq	_PLAYBACK_IDLE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_19
## %bb.18:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	%r13, %rdi
	callq	_BCM2835_AUDIO_LOCK
	movq	_PLAYBACK_PLAYING@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 32(%r13)
	movq	%r13, %rdi
	callq	_BCM2835_AUDIO_UNLOCK
	movq	%r14, %rdi
	callq	_bcm2835_audio_start
LBB0_19:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	(%r14), %rax
	movq	_PLAYBACK_IDLE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_14
## %bb.20:                              ##   in Loop: Header=BB0_2 Depth=1
	movl	64(%r13), %edi
	callq	_sndbuf_getready
	testq	%rax, %rax
	je	LBB0_14
## %bb.21:                              ##   in Loop: Header=BB0_2 Depth=1
	movl	64(%r13), %edi
	callq	_sndbuf_getready
	movq	%rax, %r15
	movl	64(%r13), %edi
	callq	_sndbuf_getsize
	movl	%eax, %r12d
	movl	64(%r13), %edi
	callq	_sndbuf_getreadyptr
	movl	%eax, %ebx
	movq	%r13, %rdi
	callq	_BCM2835_AUDIO_LOCK
	leal	(%rbx,%r15), %eax
	movl	%r12d, %edi
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	subl	%ebx, %edi
	cmpl	%r12d, %eax
	cmovlel	%r15d, %edi
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	movq	48(%r13), %rsi
	callq	_min
	movl	%eax, %ebx
	cltd
	movq	_VCHIQ_AUDIO_PACKET_SIZE@GOTPCREL(%rip), %r12
	idivl	(%r12)
	subl	%edx, %ebx
	movq	%r13, %rdi
	callq	_BCM2835_AUDIO_UNLOCK
	cmpl	(%r12), %ebx
	jl	LBB0_14
## %bb.22:                              ##   in Loop: Header=BB0_2 Depth=1
	movl	64(%r13), %edi
	callq	_sndbuf_getbuf
	movslq	-48(%rbp), %rcx                 ## 4-byte Folded Reload
	leaq	(%rax,%rcx,4), %rsi
	movq	%r14, %rdi
	movl	%ebx, %edx
	callq	_bcm2835_audio_write_samples
	movq	%r13, %rdi
	callq	_BCM2835_AUDIO_LOCK
	movl	56(%r13), %r15d
	addl	%ebx, %r15d
	movl	64(%r13), %edi
	callq	_sndbuf_getsize
	movl	%eax, %ecx
	movl	%r15d, %eax
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	cltd
	idivl	%ecx
	movl	%edx, 56(%r13)
	movslq	%ebx, %rax
	movq	48(%r13), %rsi
	subq	%rax, %rsi
	movq	%rsi, 48(%r13)
	addl	%ebx, 60(%r13)
	movq	%rsi, %rdi
	shrq	$63, %rdi
	xorl	$1, %edi
                                        ## kill: def $edi killed $edi killed $rdi
	callq	_KASSERT
	jmp	LBB0_13
LBB0_15:
	movq	%r13, %rdi
	callq	_BCM2835_AUDIO_LOCK
	movq	_WORKER_STOPPED@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, (%r13)
	leaq	24(%r13), %rdi
	callq	_cv_signal
	movq	%r13, %rdi
	callq	_BCM2835_AUDIO_UNLOCK
	xorl	%edi, %edi
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_kproc_exit                     ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_PLAYBACK_IDLE,8,3              ## @PLAYBACK_IDLE
	.comm	_WORKER_RUNNING,8,3             ## @WORKER_RUNNING
	.comm	_AUDIO_PARAMS,4,2               ## @AUDIO_PARAMS
	.comm	_AUDIO_STOP,4,2                 ## @AUDIO_STOP
	.comm	_PLAYBACK_PLAYING,8,3           ## @PLAYBACK_PLAYING
	.comm	_AUDIO_PLAY,4,2                 ## @AUDIO_PLAY
	.comm	_VCHIQ_AUDIO_PACKET_SIZE,4,2    ## @VCHIQ_AUDIO_PACKET_SIZE
	.comm	_WORKER_STOPPED,8,3             ## @WORKER_STOPPED
	.no_dead_strip	_bcm2835_audio_worker
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function bcm2835_audio_worker
_bcm2835_audio_worker:                  ; @bcm2835_audio_worker
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x0
Lloh0:
	adrp	x27, _PLAYBACK_IDLE@GOTPAGE
Lloh1:
	ldr	x27, [x27, _PLAYBACK_IDLE@GOTPAGEOFF]
	ldr	x8, [x27]
	mov	x20, x0
	str	x8, [x20, #32]!
	ldr	x8, [x0]
Lloh2:
	adrp	x9, _WORKER_RUNNING@GOTPAGE
Lloh3:
	ldr	x9, [x9, _WORKER_RUNNING@GOTPAGEOFF]
Lloh4:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_22
; %bb.1:
	add	x21, x19, #24
	add	x22, x19, #72
	b	LBB0_5
LBB0_2:                                 ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x20
	bl	_bcm2835_audio_stop
	mov	x0, x19
	bl	_BCM2835_AUDIO_LOCK
	mov	x0, x20
	bl	_bcm2835_audio_reset_channel
	ldr	x8, [x27]
	str	x8, [x19, #32]
LBB0_3:                                 ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x19
	bl	_BCM2835_AUDIO_UNLOCK
LBB0_4:                                 ;   in Loop: Header=BB0_5 Depth=1
	ldr	x8, [x19]
Lloh5:
	adrp	x9, _WORKER_RUNNING@GOTPAGE
Lloh6:
	ldr	x9, [x9, _WORKER_RUNNING@GOTPAGEOFF]
Lloh7:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_22
LBB0_5:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_6 Depth 2
	mov	x0, x19
	bl	_BCM2835_AUDIO_LOCK
	ldr	x28, [x19, #8]
	cbnz	x28, LBB0_9
LBB0_6:                                 ;   Parent Loop BB0_5 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	mov	x0, x20
	bl	_bcm2835_audio_buffer_should_sleep
	cbz	x0, LBB0_8
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=2
	mov	x0, x21
	mov	x1, x22
	bl	_cv_wait_sig
	ldr	x28, [x19, #8]
	cbz	x28, LBB0_6
	b	LBB0_9
LBB0_8:                                 ;   in Loop: Header=BB0_5 Depth=1
	ldr	x28, [x19, #8]
LBB0_9:                                 ;   in Loop: Header=BB0_5 Depth=1
	str	xzr, [x19, #8]
	mov	x0, x19
	bl	_BCM2835_AUDIO_UNLOCK
Lloh8:
	adrp	x8, _AUDIO_PARAMS@GOTPAGE
Lloh9:
	ldr	x8, [x8, _AUDIO_PARAMS@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	tst	w8, w28
	b.eq	LBB0_13
; %bb.10:                               ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x19
	bl	_BCM2835_AUDIO_LOCK
	ldp	w25, w26, [x19, #40]
	ldp	w23, w24, [x19, #16]
	mov	x0, x19
	bl	_BCM2835_AUDIO_UNLOCK
	ldr	x8, [x19, #32]
	ldr	x9, [x27]
	cmp	x8, x9
	b.ne	LBB0_12
; %bb.11:                               ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x19
	mov	x1, x26
	mov	x2, x25
	bl	_bcm2835_audio_update_params
LBB0_12:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x19
	mov	x1, x23
	mov	x2, x24
	bl	_bcm2835_audio_update_controls
LBB0_13:                                ;   in Loop: Header=BB0_5 Depth=1
Lloh11:
	adrp	x8, _AUDIO_STOP@GOTPAGE
Lloh12:
	ldr	x8, [x8, _AUDIO_STOP@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	tst	w8, w28
	b.eq	LBB0_15
; %bb.14:                               ;   in Loop: Header=BB0_5 Depth=1
	ldr	x8, [x20]
Lloh14:
	adrp	x9, _PLAYBACK_PLAYING@GOTPAGE
Lloh15:
	ldr	x9, [x9, _PLAYBACK_PLAYING@GOTPAGEOFF]
Lloh16:
	ldr	x9, [x9]
	cmp	x8, x9
	b.eq	LBB0_2
LBB0_15:                                ;   in Loop: Header=BB0_5 Depth=1
Lloh17:
	adrp	x8, _AUDIO_PLAY@GOTPAGE
Lloh18:
	ldr	x8, [x8, _AUDIO_PLAY@GOTPAGEOFF]
Lloh19:
	ldr	w8, [x8]
	tst	w8, w28
	b.eq	LBB0_18
; %bb.16:                               ;   in Loop: Header=BB0_5 Depth=1
	ldr	x8, [x20]
	ldr	x9, [x27]
	cmp	x8, x9
	b.ne	LBB0_18
; %bb.17:                               ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x19
	bl	_BCM2835_AUDIO_LOCK
Lloh20:
	adrp	x8, _PLAYBACK_PLAYING@GOTPAGE
Lloh21:
	ldr	x8, [x8, _PLAYBACK_PLAYING@GOTPAGEOFF]
Lloh22:
	ldr	x8, [x8]
	str	x8, [x19, #32]
	mov	x0, x19
	bl	_BCM2835_AUDIO_UNLOCK
	mov	x0, x20
	bl	_bcm2835_audio_start
LBB0_18:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	x8, [x20]
	ldr	x9, [x27]
	cmp	x8, x9
	b.eq	LBB0_4
; %bb.19:                               ;   in Loop: Header=BB0_5 Depth=1
	ldr	w0, [x19, #64]
	bl	_sndbuf_getready
	cbz	x0, LBB0_4
; %bb.20:                               ;   in Loop: Header=BB0_5 Depth=1
	ldr	w0, [x19, #64]
	bl	_sndbuf_getready
	mov	x23, x0
	ldr	w0, [x19, #64]
	bl	_sndbuf_getsize
	mov	x25, x0
	ldr	w0, [x19, #64]
	bl	_sndbuf_getreadyptr
	mov	x24, x0
	mov	x0, x19
	bl	_BCM2835_AUDIO_LOCK
	sub	w8, w25, w24
	add	w9, w24, w23
	cmp	w9, w25
	csel	w0, w8, w23, gt
	ldr	x1, [x19, #48]
	bl	_min
Lloh23:
	adrp	x25, _VCHIQ_AUDIO_PACKET_SIZE@GOTPAGE
Lloh24:
	ldr	x25, [x25, _VCHIQ_AUDIO_PACKET_SIZE@GOTPAGEOFF]
	ldr	w8, [x25]
	sdiv	w9, w0, w8
	mul	w23, w9, w8
	mov	x0, x19
	bl	_BCM2835_AUDIO_UNLOCK
	ldr	w8, [x25]
	cmp	w23, w8
	b.lt	LBB0_4
; %bb.21:                               ;   in Loop: Header=BB0_5 Depth=1
	ldr	w0, [x19, #64]
	bl	_sndbuf_getbuf
	add	x1, x0, w24, sxtw #2
	mov	x0, x20
	mov	x2, x23
	bl	_bcm2835_audio_write_samples
	mov	x0, x19
	bl	_BCM2835_AUDIO_LOCK
	ldr	w8, [x19, #56]
	add	w24, w8, w23
	ldr	w0, [x19, #64]
	bl	_sndbuf_getsize
	sdiv	w8, w24, w0
	msub	w8, w8, w0, w24
	ldr	x9, [x19, #48]
	sub	x1, x9, w23, sxtw
	str	x1, [x19, #48]
	ldr	w9, [x19, #60]
	add	w9, w9, w23
	stp	w8, w9, [x19, #56]
	lsr	x8, x1, #63
	eor	w0, w8, #0x1
	bl	_KASSERT
	b	LBB0_3
LBB0_22:
	mov	x0, x19
	bl	_BCM2835_AUDIO_LOCK
Lloh25:
	adrp	x8, _WORKER_STOPPED@GOTPAGE
Lloh26:
	ldr	x8, [x8, _WORKER_STOPPED@GOTPAGEOFF]
Lloh27:
	ldr	x8, [x8]
	mov	x0, x19
	str	x8, [x0], #24
	bl	_cv_signal
	mov	x0, x19
	bl	_BCM2835_AUDIO_UNLOCK
	mov	w0, #0
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	b	_kproc_exit
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.cfi_endproc
                                        ; -- End function
	.comm	_PLAYBACK_IDLE,8,3              ; @PLAYBACK_IDLE
	.comm	_WORKER_RUNNING,8,3             ; @WORKER_RUNNING
	.comm	_AUDIO_PARAMS,4,2               ; @AUDIO_PARAMS
	.comm	_AUDIO_STOP,4,2                 ; @AUDIO_STOP
	.comm	_PLAYBACK_PLAYING,8,3           ; @PLAYBACK_PLAYING
	.comm	_AUDIO_PLAY,4,2                 ; @AUDIO_PLAY
	.comm	_VCHIQ_AUDIO_PACKET_SIZE,4,2    ; @VCHIQ_AUDIO_PACKET_SIZE
	.comm	_WORKER_STOPPED,8,3             ; @WORKER_STOPPED
	.no_dead_strip	_bcm2835_audio_worker
.subsections_via_symbols
