	.file	"extr_snd_dma.c_S_UpdateBackgroundTrack.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC2:
	.string	"StreamedRead failure on music track\n"
	.text
	.p2align 4
	.globl	S_UpdateBackgroundTrack
	.type	S_UpdateBackgroundTrack, @function
S_UpdateBackgroundTrack:
.LFB0:
	.cfi_startproc
	endbr64
	push	r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	push	r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	push	rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	push	rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	lea	r11, -118784[rsp]
	.cfi_def_cfa 11, 118824
.LPSRL0:
	sub	rsp, 4096
	or	DWORD PTR [rsp], 0
	cmp	rsp, r11
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	sub	rsp, 1240
	.cfi_def_cfa_offset 120064
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 120008[rsp], rax
	xor	eax, eax
	cmp	QWORD PTR s_backgroundFile[rip], 0
	je	.L1
	mov	rax, QWORD PTR s_musicVolume[rip]
	pxor	xmm0, xmm0
	pxor	xmm1, xmm1
	mov	eax, DWORD PTR [rax]
	add	eax, eax
	cvtsi2ss	xmm0, eax
	addss	xmm0, DWORD PTR musicVolume.1972[rip]
	mulss	xmm0, DWORD PTR .LC0[rip]
	comiss	xmm1, xmm0
	movss	DWORD PTR musicVolume.1972[rip], xmm0
	jnb	.L1
	mov	rcx, QWORD PTR s_rawend[rip]
	mov	rdx, QWORD PTR s_soundtime[rip]
	cmp	rcx, rdx
	jge	.L3
	mov	QWORD PTR s_rawend[rip], rdx
	mov	rcx, rdx
.L3:
	mov	ebx, 120000
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L12:
	add	eax, edx
	sub	eax, ecx
	imul	eax, DWORD PTR s_backgroundInfo[rip]
	mov	ecx, DWORD PTR s_backgroundInfo[rip+4]
	cdq
	idiv	DWORD PTR dma[rip]
	cmp	DWORD PTR s_backgroundSamples[rip], eax
	cmovle	eax, DWORD PTR s_backgroundSamples[rip]
	imul	ecx, DWORD PTR s_backgroundInfo[rip+8]
	mov	ebp, eax
	mov	r12d, eax
	imul	ebp, ecx
	cmp	ebp, 120000
	jbe	.L5
	mov	eax, ebx
	mov	ebp, 120000
	cdq
	idiv	ecx
	mov	r12d, eax
.L5:
	mov	r13, rsp
	mov	rcx, QWORD PTR s_backgroundFile[rip]
	mov	edx, ebp
	mov	esi, 1
	mov	rdi, r13
	call	Sys_StreamedRead@PLT
	cmp	ebp, eax
	jne	.L17
	mov	edx, DWORD PTR s_backgroundInfo[rip+8]
	mov	esi, DWORD PTR s_backgroundInfo[rip+4]
	mov	rcx, r13
	mov	edi, r12d
	call	S_ByteSwapRawSamples@PLT
	movss	xmm0, DWORD PTR musicVolume.1972[rip]
	mov	r8, r13
	mov	ecx, DWORD PTR s_backgroundInfo[rip+8]
	mov	edx, DWORD PTR s_backgroundInfo[rip+4]
	mov	esi, DWORD PTR s_backgroundInfo[rip]
	mov	edi, r12d
	call	S_RawSamples@PLT
	sub	DWORD PTR s_backgroundSamples[rip], r12d
	je	.L8
.L14:
	mov	rdx, QWORD PTR s_soundtime[rip]
	mov	rcx, QWORD PTR s_rawend[rip]
.L9:
	mov	rax, QWORD PTR MAX_RAW_SAMPLES[rip]
	lea	rsi, [rax+rdx]
	cmp	rsi, rcx
	jg	.L12
.L1:
	mov	rax, QWORD PTR 120008[rsp]
	xor	rax, QWORD PTR fs:40
	jne	.L18
	add	rsp, 120024
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	pop	rbx
	.cfi_def_cfa_offset 32
	pop	rbp
	.cfi_def_cfa_offset 24
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L17:
	.cfi_restore_state
	lea	rdi, .LC2[rip]
	call	Com_Printf@PLT
	xor	eax, eax
	call	S_StopBackgroundTrack@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L8:
	mov	rax, QWORD PTR s_backgroundLoop[rip]
	cmp	QWORD PTR [rax], 0
	je	.L10
	mov	rdi, QWORD PTR s_backgroundFile[rip]
	call	Sys_EndStreamedFile@PLT
	mov	rdi, QWORD PTR s_backgroundFile[rip]
	call	FS_FCloseFile@PLT
	mov	rdi, QWORD PTR s_backgroundLoop[rip]
	mov	QWORD PTR s_backgroundFile[rip], 0
	mov	rsi, rdi
	call	S_StartBackgroundTrack@PLT
	cmp	QWORD PTR s_backgroundFile[rip], 0
	jne	.L14
	jmp	.L1
.L10:
	mov	QWORD PTR s_backgroundFile[rip], 0
	jmp	.L1
.L18:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	S_UpdateBackgroundTrack, .-S_UpdateBackgroundTrack
	.data
	.align 4
	.type	musicVolume.1972, @object
	.size	musicVolume.1972, 4
musicVolume.1972:
	.long	1056964608
	.comm	s_soundtime,8,8
	.comm	s_rawend,8,8
	.comm	s_musicVolume,8,8
	.comm	s_backgroundSamples,4,4
	.comm	s_backgroundLoop,8,8
	.comm	s_backgroundInfo,12,8
	.comm	s_backgroundFile,8,8
	.comm	dma,4,4
	.comm	MAX_RAW_SAMPLES,8,8
	.section	.rodata.cst4,"aM",@progbits,4
	.align 4
.LC0:
	.long	1048576000
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_snd_dma.c_S_UpdateBackgroundTrack.c"
	.text
	.global	__aeabi_i2f
	.global	__aeabi_fadd
	.global	__aeabi_fmul
	.global	__aeabi_fcmple
	.global	__aeabi_idiv
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"StreamedRead failure on music track\012\000"
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC1:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	S_UpdateBackgroundTrack
	.syntax unified
	.arm
	.fpu softvfp
	.type	S_UpdateBackgroundTrack, %function
S_UpdateBackgroundTrack:
	@ args = 0, pretend = 0, frame = 120008
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	sub	sp, sp, #119808
	sub	sp, sp, #212
	add	r3, sp, #119808
	ldr	r7, .L25
	ldr	r2, .L25+4
	add	r3, r3, #204
	ldr	r2, [r2]
	str	r2, [r3]
	mov	r2,#0
	ldr	r3, [r7]
	cmp	r3, #0
	beq	.L1
	ldr	r3, .L25+8
	ldr	r8, .L25+12
	ldr	r3, [r3]
	ldr	r0, [r3]
	lsl	r0, r0, #1
	bl	__aeabi_i2f
	ldr	r1, [r8]	@ float
	bl	__aeabi_fadd
	mov	r1, #1048576000
	bl	__aeabi_fmul
	mov	r1, #0
	str	r0, [r8]	@ float
	bl	__aeabi_fcmple
	cmp	r0, #0
	bne	.L1
	ldr	r9, .L25+16
	ldr	r2, .L25+20
	ldr	r3, [r9]
	ldr	r0, [r2]
	ldr	r10, .L25+24
	cmp	r3, r0
	movlt	r3, r0
	ldr	r5, .L25+28
	ldr	r6, .L25+32
	strlt	r0, [r9]
	b	.L9
.L12:
	sub	r3, r3, r0
	sub	r2, r2, r3
	ldr	r0, [r5]
	ldr	r3, .L25+36
	mul	r0, r2, r0
	ldr	r1, [r3]
	bl	__aeabi_idiv
	ldr	r3, [r6]
	ldr	r1, [r5, #4]
	cmp	r0, r3
	movge	r4, r3
	movlt	r4, r0
	ldr	r2, [r5, #8]
	ldr	r3, .L25+40
	mul	r1, r2, r1
	mul	fp, r1, r4
	cmp	fp, r3
	bls	.L5
	mov	r0, r3
	bl	__aeabi_idiv
	ldr	r3, .L25+40
	mov	r4, r0
	mov	fp, r3
.L5:
	mov	r2, fp
	mov	r1, #1
	ldr	r3, [r7]
	add	r0, sp, #12
	bl	Sys_StreamedRead
	cmp	fp, r0
	bne	.L23
	ldmib	r5, {r1, r2}
	mov	r0, r4
	add	r3, sp, #12
	bl	S_ByteSwapRawSamples
	ldr	r3, [r8]	@ float
	add	r2, sp, #12
	mov	r0, r4
	str	r2, [sp]
	str	r3, [sp, #4]	@ float
	ldm	r5, {r1, r2, r3}
	bl	S_RawSamples
	ldr	r0, [r6]
	sub	r4, r0, r4
	cmp	r4, #0
	str	r4, [r6]
	beq	.L8
.L20:
	ldr	r3, .L25+20
	ldr	r0, [r3]
	ldr	r3, [r9]
.L9:
	ldr	r2, [r10]
	add	r1, r2, r0
	cmp	r1, r3
	bgt	.L12
.L1:
	add	r3, sp, #119808
	ldr	r2, .L25+4
	add	r3, r3, #204
	ldr	r1, [r2]
	ldr	r2, [r3]
	eors	r1, r2, r1
	mov	r2, #0
	bne	.L24
	add	sp, sp, #119808
	add	sp, sp, #212
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L23:
	ldr	r0, .L25+44
	bl	Com_Printf
	bl	S_StopBackgroundTrack
	b	.L1
.L8:
	ldr	fp, .L25+48
	ldr	r3, [fp]
	ldr	r3, [r3]
	cmp	r3, #0
	beq	.L10
	ldr	r0, [r7]
	bl	Sys_EndStreamedFile
	ldr	r0, [r7]
	bl	FS_FCloseFile
	ldr	r1, [fp]
	str	r4, [r7]
	mov	r0, r1
	bl	S_StartBackgroundTrack
	ldr	r3, [r7]
	cmp	r3, #0
	bne	.L20
	b	.L1
.L10:
	str	r3, [r7]
	b	.L1
.L24:
	bl	__stack_chk_fail
.L26:
	.align	2
.L25:
	.word	s_backgroundFile
	.word	.LC1
	.word	s_musicVolume
	.word	.LANCHOR0
	.word	s_rawend
	.word	s_soundtime
	.word	MAX_RAW_SAMPLES
	.word	s_backgroundInfo
	.word	s_backgroundSamples
	.word	dma
	.word	120000
	.word	.LC0
	.word	s_backgroundLoop
	.size	S_UpdateBackgroundTrack, .-S_UpdateBackgroundTrack
	.comm	s_soundtime,4,4
	.comm	s_rawend,4,4
	.comm	s_musicVolume,4,4
	.comm	s_backgroundSamples,4,4
	.comm	s_backgroundLoop,4,4
	.comm	s_backgroundInfo,12,4
	.comm	s_backgroundFile,4,4
	.comm	dma,4,4
	.comm	MAX_RAW_SAMPLES,4,4
	.data
	.align	2
	.set	.LANCHOR0,. + 0
	.type	musicVolume.4256, %object
	.size	musicVolume.4256, 4
musicVolume.4256:
	.word	1056964608
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
