	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_WriteSBSound                   ## -- Begin function WriteSBSound
	.p2align	4, 0x90
_WriteSBSound:                          ## @WriteSBSound
	.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
	.cfi_offset %rbx, -24
	movq	_format@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	je	LBB0_6
## %bb.1:
	testl	%esi, %esi
	jle	LBB0_13
## %bb.2:
	movq	_WritePtr@GOTPCREL(%rip), %r8
	movq	(%r8), %rcx
	movq	_ReadPtr@GOTPCREL(%rip), %rax
	movq	(%rax), %r9
	movq	_WaveBuffer@GOTPCREL(%rip), %rax
	movq	(%rax), %r10
	movl	%esi, %esi
	xorl	%eax, %eax
	movq	_fragtotal@GOTPCREL(%rip), %r11
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	cmpq	%r9, %rcx
	je	LBB0_4
## %bb.12:                              ##   in Loop: Header=BB0_3 Depth=1
	movl	(%rdi,%rax,4), %ebx
	movl	%ebx, (%r10,%rcx,4)
	incq	%rcx
	movslq	(%r11), %rbx
	decq	%rbx
	andq	%rbx, %rcx
	movq	%rcx, (%r8)
	incq	%rax
	cmpq	%rax, %rsi
	jne	LBB0_3
	jmp	LBB0_13
LBB0_6:
	testl	%esi, %esi
	jle	LBB0_13
## %bb.7:
	movq	_WritePtr@GOTPCREL(%rip), %r8
	movq	(%r8), %rcx
	movq	_ReadPtr@GOTPCREL(%rip), %rax
	movq	(%rax), %r9
	movq	_WaveBuffer@GOTPCREL(%rip), %rax
	movq	(%rax), %r10
	movl	%esi, %esi
	xorl	%eax, %eax
	movq	_fragtotal@GOTPCREL(%rip), %r11
	.p2align	4, 0x90
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	cmpq	%r9, %rcx
	je	LBB0_9
## %bb.11:                              ##   in Loop: Header=BB0_8 Depth=1
	movl	(%rdi,%rax,4), %ebx
	sarl	$8, %ebx
	xorl	$128, %ebx
	movl	%ebx, (%r10,%rcx,4)
	incq	%rcx
	movslq	(%r11), %rbx
	decq	%rbx
	andq	%rbx, %rcx
	movq	%rcx, (%r8)
	incq	%rax
	cmpq	%rax, %rsi
	jne	LBB0_8
	jmp	LBB0_13
LBB0_4:
	testl	%edx, %edx
	jne	LBB0_13
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	jmp	LBB0_5
LBB0_9:
	testl	%edx, %edx
	je	LBB0_10
LBB0_13:
	popq	%rbx
	popq	%rbp
	retq
	.p2align	4, 0x90
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	jmp	LBB0_10
	.cfi_endproc
                                        ## -- End function
	.comm	_format,4,2                     ## @format
	.comm	_WritePtr,8,3                   ## @WritePtr
	.comm	_ReadPtr,8,3                    ## @ReadPtr
	.comm	_WaveBuffer,8,3                 ## @WaveBuffer
	.comm	_fragtotal,4,2                  ## @fragtotal
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_WriteSBSound                   ; -- Begin function WriteSBSound
	.p2align	2
_WriteSBSound:                          ; @WriteSBSound
	.cfi_startproc
; %bb.0:
Lloh0:
	adrp	x8, _format@GOTPAGE
Lloh1:
	ldr	x8, [x8, _format@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cbz	w8, LBB0_5
; %bb.1:
	cmp	w1, #1
	b.lt	LBB0_12
; %bb.2:
Lloh3:
	adrp	x8, _WritePtr@GOTPAGE
Lloh4:
	ldr	x8, [x8, _WritePtr@GOTPAGEOFF]
	ldr	x10, [x8]
Lloh5:
	adrp	x9, _ReadPtr@GOTPAGE
Lloh6:
	ldr	x9, [x9, _ReadPtr@GOTPAGEOFF]
Lloh7:
	ldr	x9, [x9]
Lloh8:
	adrp	x11, _WaveBuffer@GOTPAGE
Lloh9:
	ldr	x11, [x11, _WaveBuffer@GOTPAGEOFF]
Lloh10:
	ldr	x11, [x11]
	mov	w12, w1
Lloh11:
	adrp	x13, _fragtotal@GOTPAGE
Lloh12:
	ldr	x13, [x13, _fragtotal@GOTPAGEOFF]
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	cmp	x10, x9
	b.eq	LBB0_9
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w14, [x0], #4
	str	w14, [x11, x10, lsl #2]
	add	x10, x10, #1
	ldrsw	x14, [x13]
	sub	x14, x14, #1
	and	x10, x10, x14
	str	x10, [x8]
	subs	x12, x12, #1
	b.ne	LBB0_3
	b	LBB0_12
LBB0_5:
	cmp	w1, #1
	b.lt	LBB0_12
; %bb.6:
Lloh13:
	adrp	x8, _WritePtr@GOTPAGE
Lloh14:
	ldr	x8, [x8, _WritePtr@GOTPAGEOFF]
	ldr	x10, [x8]
Lloh15:
	adrp	x9, _ReadPtr@GOTPAGE
Lloh16:
	ldr	x9, [x9, _ReadPtr@GOTPAGEOFF]
Lloh17:
	ldr	x9, [x9]
Lloh18:
	adrp	x11, _WaveBuffer@GOTPAGE
Lloh19:
	ldr	x11, [x11, _WaveBuffer@GOTPAGEOFF]
Lloh20:
	ldr	x11, [x11]
	mov	w12, w1
Lloh21:
	adrp	x13, _fragtotal@GOTPAGE
Lloh22:
	ldr	x13, [x13, _fragtotal@GOTPAGEOFF]
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	cmp	x10, x9
	b.eq	LBB0_11
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	ldr	w14, [x0], #4
	asr	w14, w14, #8
	eor	w14, w14, #0x80
	str	w14, [x11, x10, lsl #2]
	add	x10, x10, #1
	ldrsw	x14, [x13]
	sub	x14, x14, #1
	and	x10, x10, x14
	str	x10, [x8]
	subs	x12, x12, #1
	b.ne	LBB0_7
	b	LBB0_12
LBB0_9:
	cbnz	w2, LBB0_12
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	b	LBB0_10
LBB0_11:
	cbz	w2, LBB0_13
LBB0_12:
	ret
LBB0_13:                                ; =>This Inner Loop Header: Depth=1
	b	LBB0_13
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_format,4,2                     ; @format
	.comm	_WritePtr,8,3                   ; @WritePtr
	.comm	_ReadPtr,8,3                    ; @ReadPtr
	.comm	_WaveBuffer,8,3                 ; @WaveBuffer
	.comm	_fragtotal,4,2                  ; @fragtotal
.subsections_via_symbols
