	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_SndSave_OpenSoundFile          ## -- Begin function SndSave_OpenSoundFile
	.p2align	4, 0x90
_SndSave_OpenSoundFile:                 ## @SndSave_OpenSoundFile
	.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
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	xorl	%eax, %eax
	callq	_SndSave_CloseSoundFile
	leaq	L_.str(%rip), %rsi
	movq	%rbx, %rdi
	callq	_fopen
	movq	_sndoutput@GOTPCREL(%rip), %rbx
	movq	%rax, (%rbx)
	movq	_FALSE@GOTPCREL(%rip), %r14
	testq	%rax, %rax
	je	LBB0_5
## %bb.1:
	leaq	l_.str.1(%rip), %rdi
	movl	$1, %esi
	movl	$22, %edx
	movq	%rax, %rcx
	callq	_fwrite
	cmpl	$22, %eax
	jne	LBB0_2
## %bb.3:
	movq	_POKEYSND_num_pokeys@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	(%rbx), %rsi
	callq	_fputc
	movq	(%rbx), %rsi
	xorl	%edi, %edi
	callq	_fputc
	movq	_POKEYSND_playback_freq@GOTPCREL(%rip), %r15
	movl	(%r15), %edi
	callq	_write32
	movq	_POKEYSND_snd_flags@GOTPCREL(%rip), %r12
	movq	_POKEYSND_BIT16@GOTPCREL(%rip), %r13
	movl	(%r13), %eax
	andl	(%r12), %eax
	setne	%cl
	movq	_POKEYSND_num_pokeys@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	shll	%cl, %edi
	imull	(%r15), %edi
	callq	_write32
	movl	(%r13), %eax
	andl	(%r12), %eax
	setne	%cl
	movq	_POKEYSND_num_pokeys@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	shll	%cl, %edi
	movq	(%rbx), %rsi
	callq	_fputc
	movq	(%rbx), %rsi
	xorl	%edi, %edi
	callq	_fputc
	movl	(%r13), %eax
	xorl	%ecx, %ecx
	andl	(%r12), %eax
	setne	%cl
	leal	8(,%rcx,8), %edi
	movq	(%rbx), %rsi
	callq	_fputc
	movq	(%rbx), %rcx
	leaq	l_.str.2(%rip), %rdi
	movl	$1, %esi
	movl	$9, %edx
	callq	_fwrite
	cmpl	$9, %eax
	jne	LBB0_2
## %bb.4:
	movq	_byteswritten@GOTPCREL(%rip), %rax
	movq	$0, (%rax)
	movq	_TRUE@GOTPCREL(%rip), %r14
	jmp	LBB0_5
LBB0_2:
	movq	(%rbx), %rdi
	callq	_fclose
	movq	$0, (%rbx)
LBB0_5:
	movl	(%r14), %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"wb"

	.comm	_sndoutput,8,3                  ## @sndoutput
	.comm	_FALSE,4,2                      ## @FALSE
	.section	__TEXT,__const
l_.str.1:                               ## @.str.1
	.asciz	"RIFF\000\000\000\000WAVEfmt \020\000\000\000\001\000"

	.comm	_POKEYSND_num_pokeys,4,2        ## @POKEYSND_num_pokeys
	.comm	_POKEYSND_playback_freq,4,2     ## @POKEYSND_playback_freq
	.comm	_POKEYSND_snd_flags,4,2         ## @POKEYSND_snd_flags
	.comm	_POKEYSND_BIT16,4,2             ## @POKEYSND_BIT16
l_.str.2:                               ## @.str.2
	.asciz	"\000data\000\000\000\000"

	.comm	_byteswritten,8,3               ## @byteswritten
	.comm	_TRUE,4,2                       ## @TRUE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_SndSave_OpenSoundFile          ; -- Begin function SndSave_OpenSoundFile
	.p2align	2
_SndSave_OpenSoundFile:                 ; @SndSave_OpenSoundFile
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x19, x0
	bl	_SndSave_CloseSoundFile
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	bl	_fopen
Lloh2:
	adrp	x19, _sndoutput@GOTPAGE
Lloh3:
	ldr	x19, [x19, _sndoutput@GOTPAGEOFF]
	str	x0, [x19]
	cbz	x0, LBB0_5
; %bb.1:
	mov	x3, x0
Lloh4:
	adrp	x0, l_.str.1@PAGE
Lloh5:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	w1, #1
	mov	w2, #22
	bl	_fwrite
	cmp	w0, #22
	b.ne	LBB0_4
; %bb.2:
Lloh6:
	adrp	x20, _POKEYSND_num_pokeys@GOTPAGE
Lloh7:
	ldr	x20, [x20, _POKEYSND_num_pokeys@GOTPAGEOFF]
	ldr	w0, [x20]
	ldr	x1, [x19]
	bl	_fputc
	ldr	x1, [x19]
	mov	w0, #0
	bl	_fputc
Lloh8:
	adrp	x21, _POKEYSND_playback_freq@GOTPAGE
Lloh9:
	ldr	x21, [x21, _POKEYSND_playback_freq@GOTPAGEOFF]
	ldr	w0, [x21]
	bl	_write32
	ldr	w8, [x21]
Lloh10:
	adrp	x21, _POKEYSND_snd_flags@GOTPAGE
Lloh11:
	ldr	x21, [x21, _POKEYSND_snd_flags@GOTPAGEOFF]
	ldr	w9, [x21]
Lloh12:
	adrp	x22, _POKEYSND_BIT16@GOTPAGE
Lloh13:
	ldr	x22, [x22, _POKEYSND_BIT16@GOTPAGEOFF]
	ldr	w10, [x22]
	tst	w10, w9
	cset	w9, ne
	ldr	w10, [x20]
	lsl	w9, w10, w9
	mul	w0, w9, w8
	bl	_write32
	ldr	w8, [x21]
	ldr	w9, [x22]
	tst	w9, w8
	cset	w8, ne
	ldr	w9, [x20]
	lsl	w0, w9, w8
	ldr	x1, [x19]
	bl	_fputc
	ldr	x1, [x19]
	mov	w0, #0
	bl	_fputc
	ldr	w8, [x21]
	ldr	w9, [x22]
	tst	w9, w8
	mov	w8, #16
	mov	w9, #8
	csel	w0, w9, w8, eq
	ldr	x1, [x19]
	bl	_fputc
	ldr	x3, [x19]
Lloh14:
	adrp	x0, l_.str.2@PAGE
Lloh15:
	add	x0, x0, l_.str.2@PAGEOFF
	mov	w1, #1
	mov	w2, #9
	bl	_fwrite
	cmp	w0, #9
	b.ne	LBB0_4
; %bb.3:
Lloh16:
	adrp	x8, _byteswritten@GOTPAGE
Lloh17:
	ldr	x8, [x8, _byteswritten@GOTPAGEOFF]
Lloh18:
	str	xzr, [x8]
Lloh19:
	adrp	x8, _TRUE@GOTPAGE
Lloh20:
	ldr	x8, [x8, _TRUE@GOTPAGEOFF]
	b	LBB0_6
LBB0_4:
	ldr	x0, [x19]
	bl	_fclose
	str	xzr, [x19]
LBB0_5:
Lloh21:
	adrp	x8, _FALSE@GOTPAGE
Lloh22:
	ldr	x8, [x8, _FALSE@GOTPAGEOFF]
LBB0_6:
	ldr	w0, [x8]
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGotStr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"wb"

	.comm	_sndoutput,8,3                  ; @sndoutput
	.comm	_FALSE,4,2                      ; @FALSE
	.section	__TEXT,__const
l_.str.1:                               ; @.str.1
	.asciz	"RIFF\000\000\000\000WAVEfmt \020\000\000\000\001\000"

	.comm	_POKEYSND_num_pokeys,4,2        ; @POKEYSND_num_pokeys
	.comm	_POKEYSND_playback_freq,4,2     ; @POKEYSND_playback_freq
	.comm	_POKEYSND_snd_flags,4,2         ; @POKEYSND_snd_flags
	.comm	_POKEYSND_BIT16,4,2             ; @POKEYSND_BIT16
l_.str.2:                               ; @.str.2
	.asciz	"\000data\000\000\000\000"

	.comm	_byteswritten,8,3               ; @byteswritten
	.comm	_TRUE,4,2                       ; @TRUE
.subsections_via_symbols
