	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal4,4byte_literals
	.p2align	2                               ## -- Begin function S_UpdateBackgroundTrack
LCPI0_0:
	.long	0x3e800000                      ## float 0.25
	.section	__TEXT,__text,regular,pure_instructions
	.globl	_S_UpdateBackgroundTrack
	.p2align	4, 0x90
_S_UpdateBackgroundTrack:               ## @S_UpdateBackgroundTrack
	.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
	movl	$120008, %eax                   ## imm = 0x1D4C8
	callq	____chkstk_darwin
	subq	%rax, %rsp
	popq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	_s_backgroundFile@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_16
## %bb.1:
	movq	_s_musicVolume@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	(%rax), %eax
	addl	%eax, %eax
	cvtsi2ss	%eax, %xmm0
	addss	_S_UpdateBackgroundTrack.musicVolume(%rip), %xmm0
	mulss	LCPI0_0(%rip), %xmm0
	movss	%xmm0, _S_UpdateBackgroundTrack.musicVolume(%rip)
	xorps	%xmm1, %xmm1
	ucomiss	%xmm0, %xmm1
	jae	LBB0_16
## %bb.2:
	movq	_s_rawend@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	movq	_s_soundtime@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	cmpq	%rcx, %rdx
	jge	LBB0_4
## %bb.3:
	movq	_s_rawend@GOTPCREL(%rip), %rax
	movq	%rcx, (%rax)
	movq	%rcx, %rdx
LBB0_4:
	movq	_MAX_RAW_SAMPLES@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	leaq	(%rax,%rcx), %rsi
	cmpq	%rsi, %rdx
	jge	LBB0_16
## %bb.5:
	movq	_s_backgroundInfo@GOTPCREL(%rip), %r13
	movq	_s_backgroundSamples@GOTPCREL(%rip), %rbx
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_15:                                ##   in Loop: Header=BB0_6 Depth=1
	movq	_s_rawend@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	movq	_s_soundtime@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	movq	_MAX_RAW_SAMPLES@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	leaq	(%rax,%rcx), %rsi
	cmpq	%rsi, %rdx
	jge	LBB0_16
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	subl	%edx, %ecx
	addl	%ecx, %eax
	imull	(%r13), %eax
                                        ## kill: def $eax killed $eax killed $rax
	cltd
	movq	_dma@GOTPCREL(%rip), %rcx
	idivl	(%rcx)
	movl	%eax, %r15d
	movq	%rbx, %r14
	movl	(%rbx), %eax
	cmpl	%eax, %r15d
	jl	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	movl	%eax, %r15d
LBB0_8:                                 ##   in Loop: Header=BB0_6 Depth=1
	movl	8(%r13), %ecx
	imull	4(%r13), %ecx
	movl	%ecx, %ebx
	imull	%r15d, %ebx
	cmpl	$120001, %ebx                   ## imm = 0x1D4C1
	leaq	-120048(%rbp), %r12
	jb	LBB0_10
## %bb.9:                               ##   in Loop: Header=BB0_6 Depth=1
	movl	$120000, %ebx                   ## imm = 0x1D4C0
	movl	$120000, %eax                   ## imm = 0x1D4C0
	xorl	%edx, %edx
	idivl	%ecx
	movl	%eax, %r15d
LBB0_10:                                ##   in Loop: Header=BB0_6 Depth=1
	movq	_s_backgroundFile@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	movq	%r12, %rdi
	movl	$1, %esi
	movl	%ebx, %edx
	callq	_Sys_StreamedRead
	cmpl	%ebx, %eax
	jne	LBB0_11
## %bb.12:                              ##   in Loop: Header=BB0_6 Depth=1
	movl	4(%r13), %esi
	movl	8(%r13), %edx
	movl	%r15d, %edi
	movq	%r12, %rcx
	callq	_S_ByteSwapRawSamples
	movl	(%r13), %esi
	movl	4(%r13), %edx
	movl	8(%r13), %ecx
	movss	_S_UpdateBackgroundTrack.musicVolume(%rip), %xmm0 ## xmm0 = mem[0],zero,zero,zero
	movl	%r15d, %edi
	movq	%r12, %r8
	callq	_S_RawSamples
	movq	%r14, %rbx
	subl	%r15d, (%r14)
	jne	LBB0_15
## %bb.13:                              ##   in Loop: Header=BB0_6 Depth=1
	movq	_s_backgroundLoop@GOTPCREL(%rip), %r15
	movq	(%r15), %rax
	cmpq	$0, (%rax)
	je	LBB0_18
## %bb.14:                              ##   in Loop: Header=BB0_6 Depth=1
	movq	_s_backgroundFile@GOTPCREL(%rip), %r14
	movq	(%r14), %rdi
	callq	_Sys_EndStreamedFile
	movq	(%r14), %rdi
	callq	_FS_FCloseFile
	movq	$0, (%r14)
	movq	(%r15), %rdi
	movq	%rdi, %rsi
	callq	_S_StartBackgroundTrack
	cmpq	$0, (%r14)
	jne	LBB0_15
	jmp	LBB0_16
LBB0_11:
	leaq	L_.str(%rip), %rdi
	callq	_Com_Printf
	xorl	%eax, %eax
	callq	_S_StopBackgroundTrack
	jmp	LBB0_16
LBB0_18:
	movq	_s_backgroundFile@GOTPCREL(%rip), %rax
	movq	$0, (%rax)
LBB0_16:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_19
## %bb.17:
	addq	$120008, %rsp                   ## imm = 0x1D4C8
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_19:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.section	__DATA,__data
	.p2align	2                               ## @S_UpdateBackgroundTrack.musicVolume
_S_UpdateBackgroundTrack.musicVolume:
	.long	0x3f000000                      ## float 0.5

	.comm	_s_backgroundFile,8,3           ## @s_backgroundFile
	.comm	_s_musicVolume,8,3              ## @s_musicVolume
	.comm	_s_rawend,8,3                   ## @s_rawend
	.comm	_s_soundtime,8,3                ## @s_soundtime
	.comm	_MAX_RAW_SAMPLES,8,3            ## @MAX_RAW_SAMPLES
	.comm	_s_backgroundInfo,12,2          ## @s_backgroundInfo
	.comm	_dma,4,2                        ## @dma
	.comm	_s_backgroundSamples,4,2        ## @s_backgroundSamples
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"StreamedRead failure on music track\n"

	.comm	_s_backgroundLoop,8,3           ## @s_backgroundLoop
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_S_UpdateBackgroundTrack        ; -- Begin function S_UpdateBackgroundTrack
	.p2align	2
_S_UpdateBackgroundTrack:               ; @S_UpdateBackgroundTrack
	.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	w9, #54480
	movk	w9, #1, lsl #16
Lloh0:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh1:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	sub	sp, sp, #29, lsl #12            ; =118784
	sub	sp, sp, #1232
Lloh2:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh3:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh4:
	ldr	x8, [x8]
	stur	x8, [x29, #-96]
Lloh5:
	adrp	x21, _s_backgroundFile@GOTPAGE
Lloh6:
	ldr	x21, [x21, _s_backgroundFile@GOTPAGEOFF]
	ldr	x8, [x21]
	cbz	x8, LBB0_13
; %bb.1:
Lloh7:
	adrp	x8, _s_musicVolume@GOTPAGE
Lloh8:
	ldr	x8, [x8, _s_musicVolume@GOTPAGEOFF]
Lloh9:
	ldr	x8, [x8]
	ldr	w8, [x8]
	lsl	w8, w8, #1
	scvtf	s0, w8
	adrp	x22, _S_UpdateBackgroundTrack.musicVolume@PAGE
	ldr	s1, [x22, _S_UpdateBackgroundTrack.musicVolume@PAGEOFF]
	fadd	s0, s1, s0
	fmov	s1, #0.25000000
	fmul	s0, s0, s1
	str	s0, [x22, _S_UpdateBackgroundTrack.musicVolume@PAGEOFF]
	fcmp	s0, #0.0
	b.ls	LBB0_13
; %bb.2:
Lloh10:
	adrp	x23, _s_rawend@GOTPAGE
Lloh11:
	ldr	x23, [x23, _s_rawend@GOTPAGEOFF]
	ldr	x8, [x23]
Lloh12:
	adrp	x24, _s_soundtime@GOTPAGE
Lloh13:
	ldr	x24, [x24, _s_soundtime@GOTPAGEOFF]
	ldr	x9, [x24]
	cmp	x8, x9
	b.ge	LBB0_4
; %bb.3:
	str	x9, [x23]
	mov	x8, x9
LBB0_4:
Lloh14:
	adrp	x25, _MAX_RAW_SAMPLES@GOTPAGE
Lloh15:
	ldr	x25, [x25, _MAX_RAW_SAMPLES@GOTPAGEOFF]
	ldr	x10, [x25]
	add	x11, x10, x9
	cmp	x8, x11
	b.ge	LBB0_13
; %bb.5:
	mov	w26, #54464
	movk	w26, #1, lsl #16
Lloh16:
	adrp	x27, _s_backgroundInfo@GOTPAGE
Lloh17:
	ldr	x27, [x27, _s_backgroundInfo@GOTPAGEOFF]
Lloh18:
	adrp	x28, _s_backgroundSamples@GOTPAGE
Lloh19:
	ldr	x28, [x28, _s_backgroundSamples@GOTPAGEOFF]
	b	LBB0_7
LBB0_6:                                 ;   in Loop: Header=BB0_7 Depth=1
	ldr	x8, [x23]
	ldr	x9, [x24]
	ldr	x10, [x25]
	add	x11, x10, x9
	cmp	x8, x11
	b.ge	LBB0_13
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	sub	w8, w9, w8
	add	w8, w8, w10
	ldp	w9, w10, [x27]
	mul	w8, w9, w8
Lloh20:
	adrp	x9, _dma@GOTPAGE
Lloh21:
	ldr	x9, [x9, _dma@GOTPAGEOFF]
Lloh22:
	ldr	w9, [x9]
	sdiv	w8, w8, w9
	ldr	w9, [x28]
	cmp	w8, w9
	csel	w8, w8, w9, lt
	ldr	w9, [x27, #8]
	mul	w9, w9, w10
	mul	w10, w9, w8
	sdiv	w9, w26, w9
	cmp	w10, w26
	csel	w20, w10, w26, ls
	csel	w19, w8, w9, ls
	ldr	x3, [x21]
	mov	x0, sp
	mov	w1, #1
	mov	x2, x20
	bl	_Sys_StreamedRead
	cmp	w0, w20
	b.ne	LBB0_11
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	ldp	w1, w2, [x27, #4]
	mov	x3, sp
	mov	x0, x19
	bl	_S_ByteSwapRawSamples
	ldp	w1, w2, [x27]
	ldr	w3, [x27, #8]
	ldr	s0, [x22, _S_UpdateBackgroundTrack.musicVolume@PAGEOFF]
	mov	x4, sp
	mov	x0, x19
	bl	_S_RawSamples
	ldr	w8, [x28]
	subs	w8, w8, w19
	str	w8, [x28]
	b.ne	LBB0_6
; %bb.9:                                ;   in Loop: Header=BB0_7 Depth=1
Lloh23:
	adrp	x19, _s_backgroundLoop@GOTPAGE
Lloh24:
	ldr	x19, [x19, _s_backgroundLoop@GOTPAGEOFF]
	ldr	x8, [x19]
	ldr	x8, [x8]
	cbz	x8, LBB0_12
; %bb.10:                               ;   in Loop: Header=BB0_7 Depth=1
	ldr	x0, [x21]
	bl	_Sys_EndStreamedFile
	ldr	x0, [x21]
	bl	_FS_FCloseFile
	str	xzr, [x21]
	ldr	x0, [x19]
	mov	x1, x0
	bl	_S_StartBackgroundTrack
	ldr	x8, [x21]
	cbnz	x8, LBB0_6
	b	LBB0_13
LBB0_11:
Lloh25:
	adrp	x0, l_.str@PAGE
Lloh26:
	add	x0, x0, l_.str@PAGEOFF
	bl	_Com_Printf
	bl	_S_StopBackgroundTrack
	b	LBB0_13
LBB0_12:
	str	xzr, [x21]
LBB0_13:
	ldur	x8, [x29, #-96]
Lloh27:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh28:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh29:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_15
; %bb.14:
	add	sp, sp, #29, lsl #12            ; =118784
	add	sp, sp, #1232
	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
	ret
LBB0_15:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.section	__DATA,__data
	.p2align	2                               ; @S_UpdateBackgroundTrack.musicVolume
_S_UpdateBackgroundTrack.musicVolume:
	.long	0x3f000000                      ; float 0.5

	.comm	_s_backgroundFile,8,3           ; @s_backgroundFile
	.comm	_s_musicVolume,8,3              ; @s_musicVolume
	.comm	_s_rawend,8,3                   ; @s_rawend
	.comm	_s_soundtime,8,3                ; @s_soundtime
	.comm	_MAX_RAW_SAMPLES,8,3            ; @MAX_RAW_SAMPLES
	.comm	_s_backgroundInfo,12,2          ; @s_backgroundInfo
	.comm	_dma,4,2                        ; @dma
	.comm	_s_backgroundSamples,4,2        ; @s_backgroundSamples
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"StreamedRead failure on music track\n"

	.comm	_s_backgroundLoop,8,3           ; @s_backgroundLoop
.subsections_via_symbols
