	.file	"extr_sound_falcon.c_Sound_Initialise.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"-sound"
.LC1:
	.string	"-nosound"
.LC2:
	.string	"-dsprate"
.LC3:
	.string	"-help"
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC4:
	.string	"\t-sound           Enable sound\n\t-nosound         Disable sound\n\t-dsprate <rate>  Set sample rate in Hz"
	.section	.rodata.str1.1
.LC5:
	.string	"Missing argument for '%s'"
.LC6:
	.string	"can't allocate sound buffer\n"
	.text
	.p2align 4
	.globl	Sound_Initialise
	.type	Sound_Initialise, @function
Sound_Initialise:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	sub	rsp, 56
	.cfi_def_cfa_offset 112
	mov	r13d, DWORD PTR FALSE[rip]
	mov	r12d, DWORD PTR [rdi]
	mov	QWORD PTR 16[rsp], rdi
	mov	QWORD PTR 8[rsp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 40[rsp], rax
	xor	eax, eax
	mov	DWORD PTR 28[rsp], r13d
	mov	DWORD PTR 24[rsp], 1
	cmp	r12d, 1
	jle	.L2
	mov	r14d, 1
	lea	r15, .LC0[rip]
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L35:
	mov	eax, DWORD PTR TRUE[rip]
	mov	DWORD PTR sound_enabled[rip], eax
.L4:
	test	r13d, r13d
	jne	.L34
.L11:
	mov	rax, QWORD PTR 16[rsp]
	add	r14d, 1
	mov	r12d, DWORD PTR [rax]
	cmp	r12d, r14d
	jle	.L2
	mov	r13d, DWORD PTR FALSE[rip]
.L13:
	mov	rax, QWORD PTR 8[rsp]
	movsx	rbx, r14d
	mov	rsi, r15
	sal	rbx, 3
	lea	rbp, [rax+rbx]
	mov	rdi, QWORD PTR 0[rbp]
	call	strcmp@PLT
	test	rax, rax
	je	.L35
	mov	rdi, QWORD PTR 0[rbp]
	lea	rsi, .LC1[rip]
	call	strcmp@PLT
	test	rax, rax
	jne	.L5
	mov	eax, DWORD PTR FALSE[rip]
	mov	DWORD PTR sound_enabled[rip], eax
	test	r13d, r13d
	je	.L11
.L34:
	mov	rax, QWORD PTR 8[rsp]
	movsx	rdx, r14d
	lea	rdi, .LC5[rip]
	mov	rsi, QWORD PTR [rax+rdx*8]
	xor	eax, eax
	call	Log_print@PLT
	mov	eax, DWORD PTR FALSE[rip]
	mov	DWORD PTR sound_enabled[rip], eax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L5:
	mov	rdi, QWORD PTR 0[rbp]
	lea	rsi, .LC2[rip]
	call	strcmp@PLT
	test	rax, rax
	jne	.L6
	lea	ebp, 1[r14]
	cmp	ebp, r12d
	jl	.L36
	mov	r13d, DWORD PTR TRUE[rip]
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L2:
	mov	rax, QWORD PTR 16[rsp]
	mov	ecx, DWORD PTR 24[rsp]
	mov	edx, DWORD PTR 28[rsp]
	mov	DWORD PTR [rax], ecx
	test	edx, edx
	jne	.L37
	mov	eax, DWORD PTR sound_enabled[rip]
	test	eax, eax
	jne	.L38
.L16:
	mov	eax, DWORD PTR TRUE[rip]
.L1:
	mov	rdx, QWORD PTR 40[rsp]
	xor	rdx, QWORD PTR fs:40
	jne	.L39
	add	rsp, 56
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L36:
	.cfi_restore_state
	mov	rax, QWORD PTR 8[rsp]
	mov	rdi, QWORD PTR 8[rax+rbx]
	call	Util_sscandec@PLT
	cmp	rax, QWORD PTR RATE50KHZ[rip]
	mov	QWORD PTR dsprate[rip], rax
	je	.L40
	cmp	rax, QWORD PTR RATE25KHZ[rip]
	mov	edx, DWORD PTR SNDBUFSIZE[rip]
	je	.L41
	mov	rax, QWORD PTR RATE12KHZ[rip]
	mov	DWORD PTR sndbufsize[rip], edx
	mov	r14d, ebp
	mov	QWORD PTR dsprate[rip], rax
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L6:
	mov	rdi, QWORD PTR 0[rbp]
	lea	rsi, .LC3[rip]
	call	strcmp@PLT
	test	rax, rax
	je	.L42
.L10:
	movsx	rax, DWORD PTR 24[rsp]
	mov	rcx, QWORD PTR 0[rbp]
	mov	rsi, QWORD PTR 8[rsp]
	mov	QWORD PTR [rsi+rax*8], rcx
	lea	eax, 1[rax]
	mov	DWORD PTR 24[rsp], eax
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L37:
	mov	eax, DWORD PTR FALSE[rip]
	mov	DWORD PTR sound_enabled[rip], eax
	mov	eax, DWORD PTR TRUE[rip]
	jmp	.L1
.L40:
	mov	eax, DWORD PTR SNDBUFSIZE[rip]
	mov	r14d, ebp
	sal	eax, 2
	mov	DWORD PTR sndbufsize[rip], eax
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L38:
	lea	rsi, 32[rsp]
	mov	edi, 68
	call	get_cookie@PLT
	test	rax, rax
	je	.L17
	mov	eax, DWORD PTR sound_enabled[rip]
	test	BYTE PTR 32[rsp], 2
	je	.L17
.L18:
	test	eax, eax
	je	.L16
	mov	eax, DWORD PTR sndbufsize[rip]
	xor	esi, esi
	lea	edi, [rax+rax]
	call	Mxalloc@PLT
	mov	QWORD PTR dsp_buffer1[rip], rax
	mov	rdi, rax
	test	rax, rax
	je	.L43
.L20:
	movsx	rcx, DWORD PTR sndbufsize[rip]
	xor	esi, esi
	lea	rax, [rdi+rcx]
	mov	rdx, rcx
	mov	QWORD PTR dsp_endbuf1[rip], rax
	mov	QWORD PTR dsp_buffer2[rip], rax
	add	rax, rcx
	mov	QWORD PTR dsp_endbuf2[rip], rax
	call	memset@PLT
	mov	edx, DWORD PTR sndbufsize[rip]
	mov	esi, 127
	mov	rdi, QWORD PTR dsp_buffer2[rip]
	call	memset@PLT
	mov	rsi, QWORD PTR dsprate[rip]
	mov	edi, DWORD PTR POKEYSND_FREQ_17_EXACT[rip]
	xor	ecx, ecx
	mov	edx, 1
	call	POKEYSND_Init@PLT
	mov	edi, DWORD PTR MFP_IRQ_on[rip]
	call	Supexec@PLT
	jmp	.L16
.L17:
	mov	eax, DWORD PTR FALSE[rip]
	mov	DWORD PTR sound_enabled[rip], eax
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L42:
	mov	eax, DWORD PTR TRUE[rip]
	lea	rdi, .LC4[rip]
	mov	DWORD PTR 28[rsp], eax
	xor	eax, eax
	call	Log_print@PLT
	jmp	.L10
.L41:
	add	edx, edx
	mov	r14d, ebp
	mov	DWORD PTR sndbufsize[rip], edx
	jmp	.L4
.L43:
	lea	rdi, .LC6[rip]
	call	printf@PLT
	mov	edi, 1
	call	exit@PLT
	mov	rdi, QWORD PTR dsp_buffer1[rip]
	jmp	.L20
.L39:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	Sound_Initialise, .-Sound_Initialise
	.comm	sound_enabled,4,4
	.comm	sndbufsize,4,4
	.comm	dsprate,8,8
	.comm	dsp_endbuf2,8,8
	.comm	dsp_endbuf1,8,8
	.comm	dsp_buffer2,8,8
	.comm	dsp_buffer1,8,8
	.comm	TRUE,4,4
	.comm	SNDBUFSIZE,4,4
	.comm	RATE50KHZ,8,8
	.comm	RATE25KHZ,8,8
	.comm	RATE12KHZ,8,8
	.comm	POKEYSND_FREQ_17_EXACT,4,4
	.comm	MFP_IRQ_on,4,4
	.comm	FALSE,4,4
	.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_sound_falcon.c_Sound_Initialise.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"-sound\000"
	.align	2
.LC1:
	.ascii	"-nosound\000"
	.align	2
.LC2:
	.ascii	"-dsprate\000"
	.align	2
.LC3:
	.ascii	"-help\000"
	.align	2
.LC4:
	.ascii	"\011-sound           Enable sound\012\011-nosound  "
	.ascii	"       Disable sound\012\011-dsprate <rate>  Set sa"
	.ascii	"mple rate in Hz\000"
	.align	2
.LC5:
	.ascii	"Missing argument for '%s'\000"
	.align	2
.LC6:
	.ascii	"can't allocate sound buffer\012\000"
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC7:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	Sound_Initialise
	.syntax unified
	.arm
	.fpu softvfp
	.type	Sound_Initialise, %function
Sound_Initialise:
	@ args = 0, pretend = 0, frame = 24
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	ldr	r3, .L44
	sub	sp, sp, #28
	ldr	r3, [r3]
	str	r3, [sp, #20]
	mov	r3,#0
	ldr	r3, .L44+4
	ldr	r6, [r0]
	ldr	r5, [r3]
	cmp	r6, #1
	mov	r7, r0
	str	r5, [sp, #12]
	ble	.L22
	mov	r10, #1
	ldr	r3, .L44+8
	mov	r7, r10
	str	r10, [sp, #8]
	mov	r4, r1
	mov	r10, r0
	ldr	r8, .L44+12
	ldr	fp, .L44+16
	str	r3, [sp, #4]
	b	.L13
.L36:
	ldr	r2, [fp]
	ldr	r3, [sp, #4]
	str	r2, [r3]
.L4:
	cmp	r5, #0
	bne	.L35
.L11:
	ldr	r6, [r10]
	add	r7, r7, #1
	cmp	r6, r7
	ble	.L32
	ldr	r3, .L44+4
	ldr	r5, [r3]
.L13:
	ldr	r9, [r4, r7, lsl #2]
	mov	r1, r8
	mov	r0, r9
	bl	strcmp
	add	r3, r4, r7, lsl #2
	cmp	r0, #0
	str	r3, [sp]
	beq	.L36
	mov	r0, r9
	ldr	r1, .L44+20
	bl	strcmp
	cmp	r0, #0
	bne	.L5
	ldr	r3, [sp, #4]
	cmp	r5, #0
	str	r5, [r3]
	beq	.L11
.L35:
	ldr	r1, [r4, r7, lsl #2]
	ldr	r0, .L44+24
	bl	Log_print
	ldr	r3, .L44+4
	ldr	r0, [r3]
	ldr	r3, [sp, #4]
	str	r0, [r3]
.L1:
	ldr	r3, .L44
	ldr	r2, [r3]
	ldr	r3, [sp, #20]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L37
	add	sp, sp, #28
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L5:
	mov	r0, r9
	ldr	r1, .L44+28
	bl	strcmp
	cmp	r0, #0
	bne	.L6
	add	r9, r7, #1
	cmp	r9, r6
	ldrge	r5, [fp]
	bge	.L4
	ldr	r3, [sp]
	ldr	r0, [r3, #4]
	bl	Util_sscandec
	ldr	r3, .L44+32
	ldr	r2, .L44+36
	ldr	r3, [r3]
	str	r0, [r2]
	cmp	r0, r3
	beq	.L38
	ldr	r3, .L44+40
	ldr	r1, .L44+44
	ldr	r3, [r3]
	ldr	r1, [r1]
	cmp	r0, r3
	ldrne	r3, .L44+48
	ldreq	r2, .L44+52
	ldrne	r0, .L44+52
	ldrne	ip, [r3]
	lsleq	r1, r1, #1
	moveq	r7, r9
	movne	r7, r9
	streq	r1, [r2]
	strne	ip, [r2]
	strne	r1, [r0]
	b	.L4
.L6:
	mov	r0, r9
	ldr	r1, .L44+56
	bl	strcmp
	cmp	r0, #0
	beq	.L39
.L10:
	ldr	r3, [sp, #8]
	str	r9, [r4, r3, lsl #2]
	add	r3, r3, #1
	str	r3, [sp, #8]
	b	.L4
.L32:
	mov	r7, r10
.L2:
	ldr	r3, [sp, #12]
	cmp	r3, #0
	ldr	r3, [sp, #8]
	str	r3, [r7]
	bne	.L40
	ldr	r3, [sp, #4]
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L41
.L16:
	ldr	r3, .L44+16
	ldr	r0, [r3]
	b	.L1
.L39:
	ldr	r3, [fp]
	ldr	r0, .L44+60
	str	r3, [sp, #12]
	bl	Log_print
	lsl	r3, r7, #2
	ldr	r9, [r4, r3]
	b	.L10
.L40:
	ldr	r3, .L44+4
	ldr	r1, [sp, #4]
	ldr	r2, [r3]
	ldr	r3, .L44+16
	str	r2, [r1]
	ldr	r0, [r3]
	b	.L1
.L38:
	ldr	r3, .L44+44
	ldr	r1, .L44+52
	ldr	r2, [r3]
	mov	r7, r9
	lsl	r2, r2, #2
	str	r2, [r1]
	b	.L4
.L41:
	mov	r0, #68
	add	r1, sp, #16
	bl	get_cookie
	cmp	r0, #0
	beq	.L17
	ldr	r3, [sp, #16]
	tst	r3, #2
	bne	.L42
.L17:
	ldr	r3, .L44+4
	ldr	r2, [sp, #4]
	ldr	r3, [r3]
	str	r3, [r2]
.L18:
	cmp	r3, #0
	beq	.L16
	ldr	r4, .L44+52
	mov	r1, #0
	ldr	r0, [r4]
	ldr	r5, .L44+64
	lsl	r0, r0, #1
	bl	Mxalloc
	cmp	r0, #0
	str	r0, [r5]
	beq	.L43
.L20:
	ldr	r2, [r4]
	ldr	ip, .L44+68
	add	r3, r0, r2
	ldr	r1, .L44+72
	str	r3, [ip]
	ldr	r5, .L44+76
	add	ip, r3, r2
	str	ip, [r1]
	mov	r1, #0
	str	r3, [r5]
	bl	memset
	ldr	r2, [r4]
	mov	r1, #127
	ldr	r0, [r5]
	bl	memset
	ldr	r2, .L44+36
	ldr	r3, .L44+80
	ldr	r1, [r2]
	ldr	r0, [r3]
	mov	r2, #1
	mov	r3, #0
	bl	POKEYSND_Init
	ldr	r3, .L44+84
	ldr	r0, [r3]
	bl	Supexec
	b	.L16
.L22:
	mov	r3, #1
	str	r3, [sp, #8]
	ldr	r3, .L44+8
	str	r3, [sp, #4]
	b	.L2
.L42:
	ldr	r3, [sp, #4]
	ldr	r3, [r3]
	b	.L18
.L43:
	ldr	r0, .L44+88
	bl	printf
	mov	r0, #1
	bl	exit
	ldr	r0, [r5]
	b	.L20
.L37:
	bl	__stack_chk_fail
.L45:
	.align	2
.L44:
	.word	.LC7
	.word	FALSE
	.word	sound_enabled
	.word	.LC0
	.word	TRUE
	.word	.LC1
	.word	.LC5
	.word	.LC2
	.word	RATE50KHZ
	.word	dsprate
	.word	RATE25KHZ
	.word	SNDBUFSIZE
	.word	RATE12KHZ
	.word	sndbufsize
	.word	.LC3
	.word	.LC4
	.word	dsp_buffer1
	.word	dsp_endbuf1
	.word	dsp_endbuf2
	.word	dsp_buffer2
	.word	POKEYSND_FREQ_17_EXACT
	.word	MFP_IRQ_on
	.word	.LC6
	.size	Sound_Initialise, .-Sound_Initialise
	.comm	sound_enabled,4,4
	.comm	sndbufsize,4,4
	.comm	dsprate,4,4
	.comm	dsp_endbuf2,4,4
	.comm	dsp_endbuf1,4,4
	.comm	dsp_buffer2,4,4
	.comm	dsp_buffer1,4,4
	.comm	TRUE,4,4
	.comm	SNDBUFSIZE,4,4
	.comm	RATE50KHZ,4,4
	.comm	RATE25KHZ,4,4
	.comm	RATE12KHZ,4,4
	.comm	POKEYSND_FREQ_17_EXACT,4,4
	.comm	MFP_IRQ_on,4,4
	.comm	FALSE,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
