	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_S_UpdateBackgroundTrack        ## -- Begin function 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_backgroundStream@GOTPCREL(%rip), %r12
	movq	(%r12), %rdi
	testq	%rdi, %rdi
	je	LBB0_18
## %bb.1:
	movq	_s_musicVolume@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	$0, (%rax)
	jle	LBB0_18
## %bb.2:
	movq	_s_rawend@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	(%rax), %rsi
	movq	_s_soundtime@GOTPCREL(%rip), %r13
	movq	(%r13), %rcx
	cmpq	%rcx, %rsi
	jge	LBB0_3
## %bb.4:
	movq	%rcx, (%rax)
	movq	(%r13), %rdx
	jmp	LBB0_5
LBB0_3:
	movq	%rcx, %rdx
	movq	%rsi, %rcx
LBB0_5:
	movq	_MAX_RAW_SAMPLES@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	leaq	(%rax,%rdx), %rsi
	cmpq	%rsi, %rcx
	jge	LBB0_18
## %bb.6:
	subl	%ecx, %edx
	addl	%edx, %eax
	imull	(%rdi), %eax
	movq	_dma@GOTPCREL(%rip), %rcx
                                        ## kill: def $eax killed $eax killed $rax
	cltd
	idivl	(%rcx)
	testl	%eax, %eax
	je	LBB0_18
## %bb.7:
	movl	%eax, %r15d
	leaq	-120048(%rbp), %r14
	.p2align	4, 0x90
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	movl	8(%rdi), %ecx
	imull	4(%rdi), %ecx
	movl	%ecx, %ebx
	imull	%r15d, %ebx
	cmpl	$120001, %ebx                   ## imm = 0x1D4C1
	jb	LBB0_10
## %bb.9:                               ##   in Loop: Header=BB0_8 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_8 Depth=1
	movl	%ebx, %esi
	movq	%r14, %rdx
	callq	_S_CodecReadStream
	movl	%eax, %ecx
	cmpl	%ebx, %eax
	jge	LBB0_12
## %bb.11:                              ##   in Loop: Header=BB0_8 Depth=1
	movq	(%r12), %rax
	movl	8(%rax), %esi
	imull	4(%rax), %esi
	movl	%ecx, %eax
	cltd
	idivl	%esi
	movl	%eax, %r15d
LBB0_12:                                ##   in Loop: Header=BB0_8 Depth=1
	testl	%ecx, %ecx
	jle	LBB0_14
## %bb.13:                              ##   in Loop: Header=BB0_8 Depth=1
	movq	(%r12), %rax
	movl	(%rax), %edx
	movl	4(%rax), %ecx
	movl	8(%rax), %r8d
	movq	_s_musicVolume@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	xorl	%edi, %edi
	movl	%r15d, %esi
	movq	%r14, %r9
	pushq	$-1
	pushq	(%rax)
	callq	_S_Base_RawSamples
	addq	$16, %rsp
	jmp	LBB0_16
	.p2align	4, 0x90
LBB0_14:                                ##   in Loop: Header=BB0_8 Depth=1
	movq	_s_backgroundLoop@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	cmpq	$0, (%rdi)
	je	LBB0_20
## %bb.15:                              ##   in Loop: Header=BB0_8 Depth=1
	callq	_S_OpenBackgroundStream
	cmpq	$0, (%r12)
	je	LBB0_18
LBB0_16:                                ##   in Loop: Header=BB0_8 Depth=1
	movq	_s_rawend@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	(%rax), %rdx
	movq	(%r13), %rcx
	movq	_MAX_RAW_SAMPLES@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	leaq	(%rax,%rcx), %rsi
	cmpq	%rsi, %rdx
	jge	LBB0_18
## %bb.17:                              ##   in Loop: Header=BB0_8 Depth=1
	movq	(%r12), %rdi
	subl	%edx, %ecx
	addl	%ecx, %eax
	imull	(%rdi), %eax
                                        ## kill: def $eax killed $eax killed $rax
	cltd
	movq	_dma@GOTPCREL(%rip), %rcx
	idivl	(%rcx)
	movl	%eax, %r15d
	testl	%eax, %eax
	jne	LBB0_8
	jmp	LBB0_18
LBB0_20:
	xorl	%eax, %eax
	callq	_S_Base_StopBackgroundTrack
LBB0_18:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_21
## %bb.19:
	addq	$120008, %rsp                   ## imm = 0x1D4C8
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_21:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_s_backgroundStream,8,3         ## @s_backgroundStream
	.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	_dma,4,2                        ## @dma
	.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_backgroundStream@GOTPAGE
Lloh6:
	ldr	x21, [x21, _s_backgroundStream@GOTPAGEOFF]
	ldr	x0, [x21]
	cbz	x0, LBB0_17
; %bb.1:
Lloh7:
	adrp	x22, _s_musicVolume@GOTPAGE
Lloh8:
	ldr	x22, [x22, _s_musicVolume@GOTPAGEOFF]
	ldr	x8, [x22]
	ldr	x8, [x8]
	cmp	x8, #1
	b.lt	LBB0_17
; %bb.2:
Lloh9:
	adrp	x23, _s_rawend@GOTPAGE
Lloh10:
	ldr	x23, [x23, _s_rawend@GOTPAGEOFF]
	ldr	x9, [x23]
	ldr	x10, [x9]
Lloh11:
	adrp	x24, _s_soundtime@GOTPAGE
Lloh12:
	ldr	x24, [x24, _s_soundtime@GOTPAGEOFF]
	ldr	x8, [x24]
	cmp	x10, x8
	b.ge	LBB0_4
; %bb.3:
	str	x8, [x9]
	ldr	x9, [x24]
	b	LBB0_5
LBB0_4:
	mov	x9, x8
	mov	x8, x10
LBB0_5:
Lloh13:
	adrp	x25, _MAX_RAW_SAMPLES@GOTPAGE
Lloh14:
	ldr	x25, [x25, _MAX_RAW_SAMPLES@GOTPAGEOFF]
	ldr	x10, [x25]
	add	x11, x10, x9
	cmp	x8, x11
	b.ge	LBB0_17
; %bb.6:
	sub	w8, w9, w8
	add	w8, w8, w10
	ldr	w9, [x0]
	mul	w8, w9, w8
Lloh15:
	adrp	x26, _dma@GOTPAGE
Lloh16:
	ldr	x26, [x26, _dma@GOTPAGEOFF]
	ldr	w9, [x26]
	sdiv	w8, w8, w9
	cbz	w8, LBB0_17
; %bb.7:
	mov	w27, #54464
	movk	w27, #1, lsl #16
Lloh17:
	adrp	x28, _s_backgroundLoop@GOTPAGE
Lloh18:
	ldr	x28, [x28, _s_backgroundLoop@GOTPAGEOFF]
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	ldp	w9, w10, [x0, #4]
	mul	w9, w10, w9
	mul	w10, w9, w8
	sdiv	w9, w27, w9
	cmp	w10, w27
	csel	w20, w10, w27, ls
	csel	w19, w8, w9, ls
	mov	x2, sp
	mov	x1, x20
	bl	_S_CodecReadStream
	cmp	w0, w20
	b.ge	LBB0_10
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=1
	ldr	x8, [x21]
	ldp	w9, w8, [x8, #4]
	mul	w8, w8, w9
	sdiv	w19, w0, w8
LBB0_10:                                ;   in Loop: Header=BB0_8 Depth=1
	cmp	w0, #1
	b.lt	LBB0_12
; %bb.11:                               ;   in Loop: Header=BB0_8 Depth=1
	ldr	x8, [x21]
	ldp	w2, w3, [x8]
	ldr	w4, [x8, #8]
	ldr	x8, [x22]
	ldr	x6, [x8]
	mov	x5, sp
	mov	w0, #0
	mov	x1, x19
	mov	w7, #-1
	bl	_S_Base_RawSamples
	b	LBB0_14
LBB0_12:                                ;   in Loop: Header=BB0_8 Depth=1
	ldr	x0, [x28]
	ldr	x8, [x0]
	cbz	x8, LBB0_16
; %bb.13:                               ;   in Loop: Header=BB0_8 Depth=1
	bl	_S_OpenBackgroundStream
	ldr	x8, [x21]
	cbz	x8, LBB0_17
LBB0_14:                                ;   in Loop: Header=BB0_8 Depth=1
	ldr	x8, [x23]
	ldr	x8, [x8]
	ldr	x10, [x24]
	ldr	x9, [x25]
	add	x11, x9, x10
	cmp	x8, x11
	b.ge	LBB0_17
; %bb.15:                               ;   in Loop: Header=BB0_8 Depth=1
	ldr	x0, [x21]
	sub	w8, w10, w8
	add	w8, w8, w9
	ldr	w9, [x0]
	mul	w8, w9, w8
	ldr	w9, [x26]
	sdiv	w8, w8, w9
	cbnz	w8, LBB0_8
	b	LBB0_17
LBB0_16:
	bl	_S_Base_StopBackgroundTrack
LBB0_17:
	ldur	x8, [x29, #-96]
Lloh19:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh20:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh21:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_19
; %bb.18:
	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_19:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_s_backgroundStream,8,3         ; @s_backgroundStream
	.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	_dma,4,2                        ; @dma
	.comm	_s_backgroundLoop,8,3           ; @s_backgroundLoop
.subsections_via_symbols
