	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_PLATFORM_SoundSetup            ## -- Begin function PLATFORM_SoundSetup
	.p2align	4, 0x90
_PLATFORM_SoundSetup:                   ## @PLATFORM_SoundSetup
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r13
	movq	_Sound_enabled@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_2
## %bb.1:
	movq	_dsp_fd@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_close
LBB0_2:
	movq	_dspname@GOTPCREL(%rip), %r12
	movl	(%r12), %edi
	movq	_O_WRONLY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_open
	movq	_dsp_fd@GOTPCREL(%rip), %r15
	movl	%eax, (%r15)
	cmpl	$-1, %eax
	je	LBB0_7
## %bb.3:
	movl	(%r13), %ecx
	testl	%ecx, %ecx
	jne	LBB0_5
## %bb.4:
	movslq	4(%r13), %rcx
	imulq	$1374389535, %rcx, %rcx         ## imm = 0x51EB851F
	movq	%rcx, %rdx
	shrq	$63, %rdx
	sarq	$36, %rcx
	addl	%edx, %ecx
LBB0_5:
	imull	8(%r13), %ecx
	imull	12(%r13), %ecx
	movl	%ecx, -52(%rbp)
	cmpl	$2, %ecx
	jae	LBB0_8
## %bb.6:
	movl	$1, %esi
	movl	$2147418112, %edx               ## imm = 0x7FFF0000
	jmp	LBB0_10
LBB0_7:
	movl	(%r12), %edi
	callq	_perror
	jmp	LBB0_31
LBB0_8:
	movl	$2147418112, %edx               ## imm = 0x7FFF0000
	movl	$1, %esi
	movl	%ecx, %ebx
	movl	%ecx, %edi
	.p2align	4, 0x90
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	sarl	%edi
	addl	%esi, %esi
	incl	%edx
	cmpl	$3, %ebx
	movl	%edi, %ebx
	ja	LBB0_9
LBB0_10:
	xorl	%edi, %edi
	cmpl	%ecx, %esi
	setl	%dil
	addl	%edx, %edi
	movl	%edi, -48(%rbp)
	movq	_SNDCTL_DSP_SETFRAGMENT@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	leaq	-48(%rbp), %rdx
	movl	%eax, %edi
	callq	_ioctl
	cmpl	$-1, %eax
	je	LBB0_13
## %bb.11:
	cmpl	$2, 12(%r13)
	jne	LBB0_14
## %bb.12:
	movq	_AFMT_S16_NE@GOTPCREL(%rip), %rax
	jmp	LBB0_15
LBB0_13:
	movl	(%r12), %esi
	movl	-48(%rbp), %edx
	leaq	L_.str(%rip), %rdi
	jmp	LBB0_29
LBB0_14:
	movq	_AFMT_U8@GOTPCREL(%rip), %rax
LBB0_15:
	movl	(%rax), %eax
	movl	%eax, -44(%rbp)
	movl	(%r15), %edi
	movq	_SNDCTL_DSP_SETFMT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-44(%rbp), %rdx
	callq	_ioctl
	cmpl	$-1, %eax
	je	LBB0_25
## %bb.16:
	movl	-44(%rbp), %edx
	movq	_AFMT_S16_NE@GOTPCREL(%rip), %rcx
	movl	$2, %eax
	cmpl	(%rcx), %edx
	je	LBB0_18
## %bb.17:
	movq	_AFMT_U8@GOTPCREL(%rip), %rcx
	movl	$1, %eax
	cmpl	(%rcx), %edx
	jne	LBB0_27
LBB0_18:
	leaq	8(%r13), %r14
	movl	%eax, 12(%r13)
	movl	(%r15), %edi
	movq	_SNDCTL_DSP_CHANNELS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdx
	callq	_ioctl
	cmpl	$-1, %eax
	je	LBB0_26
## %bb.19:
	movl	(%r15), %edi
	movq	_SNDCTL_DSP_SPEED@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	4(%r13), %r14
	movq	%r14, %rdx
	callq	_ioctl
	cmpl	$-1, %eax
	je	LBB0_28
## %bb.20:
	movl	(%r15), %edi
	movq	_SNDCTL_DSP_GETBLKSIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-52(%rbp), %rdx
	callq	_ioctl
	cmpl	$-1, %eax
	je	LBB0_34
## %bb.21:
	movl	-52(%rbp), %eax
	cltd
	idivl	8(%r13)
	cltd
	idivl	12(%r13)
	movl	%eax, (%r13)
	movl	(%r15), %edi
	movq	_SNDCTL_DSP_GETOSPACE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-56(%rbp), %rdx
	callq	_ioctl
	movl	%eax, %ebx
	cmpl	$-1, %eax
	jne	LBB0_23
## %bb.22:
	movl	(%r12), %esi
	leaq	L_.str.6(%rip), %rdi
	xorl	%eax, %eax
	callq	_Log_print
LBB0_23:
	xorl	%eax, %eax
	cmpl	$-1, %ebx
	je	LBB0_33
## %bb.24:
	movq	_TRUE@GOTPCREL(%rip), %rax
	jmp	LBB0_32
LBB0_25:
	movl	(%r12), %esi
	movl	-44(%rbp), %edx
	leaq	L_.str.1(%rip), %rdi
	jmp	LBB0_29
LBB0_26:
	movl	(%r12), %esi
	movl	(%r14), %edx
	leaq	L_.str.3(%rip), %rdi
	jmp	LBB0_29
LBB0_27:
	movl	(%r12), %esi
	leaq	L_.str.2(%rip), %rdi
	jmp	LBB0_29
LBB0_28:
	movl	(%r12), %esi
	movl	(%r14), %edx
	leaq	L_.str.4(%rip), %rdi
LBB0_29:
	xorl	%eax, %eax
	callq	_Log_print
LBB0_30:
	movl	(%r15), %edi
	callq	_close
LBB0_31:
	movq	_FALSE@GOTPCREL(%rip), %rax
LBB0_32:
	movl	(%rax), %eax
LBB0_33:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_34:
	movl	(%r12), %esi
	leaq	L_.str.5(%rip), %rdi
	xorl	%eax, %eax
	callq	_Log_print
	jmp	LBB0_30
	.cfi_endproc
                                        ## -- End function
	.comm	_Sound_enabled,8,3              ## @Sound_enabled
	.comm	_dsp_fd,4,2                     ## @dsp_fd
	.comm	_dspname,4,2                    ## @dspname
	.comm	_O_WRONLY,4,2                   ## @O_WRONLY
	.comm	_FALSE,4,2                      ## @FALSE
	.comm	_SNDCTL_DSP_SETFRAGMENT,4,2     ## @SNDCTL_DSP_SETFRAGMENT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%s: SNDCTL_DSP_SETFRAGMENT(%.8x) failed"

	.comm	_AFMT_S16_NE,4,2                ## @AFMT_S16_NE
	.comm	_AFMT_U8,4,2                    ## @AFMT_U8
	.comm	_SNDCTL_DSP_SETFMT,4,2          ## @SNDCTL_DSP_SETFMT
L_.str.1:                               ## @.str.1
	.asciz	"%s: SNDCTL_DSP_SETFMT(%i) failed"

L_.str.2:                               ## @.str.2
	.asciz	"%s: Obtained format %i not supported"

	.comm	_SNDCTL_DSP_CHANNELS,4,2        ## @SNDCTL_DSP_CHANNELS
L_.str.3:                               ## @.str.3
	.asciz	"%s: SNDCTL_DSP_CHANNELS(%u) failed"

	.comm	_SNDCTL_DSP_SPEED,4,2           ## @SNDCTL_DSP_SPEED
L_.str.4:                               ## @.str.4
	.asciz	"%s: SNDCTL_DSP_SPEED(%u) failed"

	.comm	_SNDCTL_DSP_GETBLKSIZE,4,2      ## @SNDCTL_DSP_GETBLKSIZE
L_.str.5:                               ## @.str.5
	.asciz	"%s: SNDCTL_DSP_GETBLKSIZE failed"

	.comm	_SNDCTL_DSP_GETOSPACE,4,2       ## @SNDCTL_DSP_GETOSPACE
L_.str.6:                               ## @.str.6
	.asciz	"%s: cannot retrieve ospace"

	.comm	_TRUE,4,2                       ## @TRUE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_PLATFORM_SoundSetup            ; -- Begin function PLATFORM_SoundSetup
	.p2align	2
_PLATFORM_SoundSetup:                   ; @PLATFORM_SoundSetup
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	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
	mov	x19, x0
Lloh0:
	adrp	x8, _Sound_enabled@GOTPAGE
Lloh1:
	ldr	x8, [x8, _Sound_enabled@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
Lloh3:
	adrp	x21, _dsp_fd@GOTPAGE
Lloh4:
	ldr	x21, [x21, _dsp_fd@GOTPAGEOFF]
	cbz	x8, LBB0_2
; %bb.1:
	ldr	w0, [x21]
	bl	_close
LBB0_2:
Lloh5:
	adrp	x22, _dspname@GOTPAGE
Lloh6:
	ldr	x22, [x22, _dspname@GOTPAGEOFF]
	ldr	w0, [x22]
Lloh7:
	adrp	x8, _O_WRONLY@GOTPAGE
Lloh8:
	ldr	x8, [x8, _O_WRONLY@GOTPAGEOFF]
Lloh9:
	ldr	w1, [x8]
	bl	_open
	str	w0, [x21]
	cmn	w0, #1
	b.eq	LBB0_7
; %bb.3:
	ldr	w8, [x19]
	cbnz	w8, LBB0_5
; %bb.4:
	ldrsw	x8, [x19, #4]
	mov	w9, #34079
	movk	w9, #20971, lsl #16
	mul	x8, x8, x9
	lsr	x9, x8, #63
	asr	x8, x8, #36
	add	w8, w8, w9
LBB0_5:
	mov	x20, x19
	ldp	w9, w10, [x20, #8]!
	mul	w8, w9, w8
	mul	w8, w8, w10
	str	w8, [sp, #24]
	cmp	w8, #2
	b.hs	LBB0_8
; %bb.6:
	mov	w10, #1
	mov	w9, #2147418112
	b	LBB0_10
LBB0_7:
	ldr	w0, [x22]
	bl	_perror
	b	LBB0_29
LBB0_8:
	mov	w9, #2147418112
	mov	w10, #1
	mov	x11, x8
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	asr	w12, w11, #1
	lsl	w10, w10, #1
	add	w9, w9, #1
	cmp	w11, #3
	mov	x11, x12
	b.hi	LBB0_9
LBB0_10:
	cmp	w10, w8
	cinc	w8, w9, lt
	str	w8, [sp, #20]
Lloh10:
	adrp	x8, _SNDCTL_DSP_SETFRAGMENT@GOTPAGE
Lloh11:
	ldr	x8, [x8, _SNDCTL_DSP_SETFRAGMENT@GOTPAGEOFF]
Lloh12:
	ldr	w1, [x8]
	add	x2, sp, #20
	bl	_ioctl
	cmn	w0, #1
	b.eq	LBB0_14
; %bb.11:
	ldr	w8, [x19, #12]
Lloh13:
	adrp	x24, _AFMT_S16_NE@GOTPAGE
Lloh14:
	ldr	x24, [x24, _AFMT_S16_NE@GOTPAGEOFF]
Lloh15:
	adrp	x23, _AFMT_U8@GOTPAGE
Lloh16:
	ldr	x23, [x23, _AFMT_U8@GOTPAGEOFF]
	cmp	w8, #2
	csel	x8, x24, x23, eq
	ldr	w8, [x8]
	str	w8, [sp, #28]
	ldr	w0, [x21]
Lloh17:
	adrp	x8, _SNDCTL_DSP_SETFMT@GOTPAGE
Lloh18:
	ldr	x8, [x8, _SNDCTL_DSP_SETFMT@GOTPAGEOFF]
Lloh19:
	ldr	w1, [x8]
	add	x2, sp, #28
	bl	_ioctl
	cmn	w0, #1
	b.eq	LBB0_15
; %bb.12:
	ldr	w8, [sp, #28]
	ldr	w9, [x24]
	cmp	w8, w9
	b.ne	LBB0_16
; %bb.13:
	mov	w8, #2
	b	LBB0_18
LBB0_14:
	ldr	w1, [x22]
	ldr	w8, [sp, #20]
	str	x8, [sp]
Lloh20:
	adrp	x0, l_.str@PAGE
Lloh21:
	add	x0, x0, l_.str@PAGEOFF
	b	LBB0_28
LBB0_15:
	ldr	w1, [x22]
	ldr	w8, [sp, #28]
	str	x8, [sp]
Lloh22:
	adrp	x0, l_.str.1@PAGE
Lloh23:
	add	x0, x0, l_.str.1@PAGEOFF
	b	LBB0_28
LBB0_16:
	ldr	w9, [x23]
	cmp	w8, w9
	b.ne	LBB0_25
; %bb.17:
	mov	w8, #1
LBB0_18:
	str	w8, [x19, #12]
	ldr	w0, [x21]
Lloh24:
	adrp	x8, _SNDCTL_DSP_CHANNELS@GOTPAGE
Lloh25:
	ldr	x8, [x8, _SNDCTL_DSP_CHANNELS@GOTPAGEOFF]
Lloh26:
	ldr	w1, [x8]
	mov	x2, x20
	bl	_ioctl
	cmn	w0, #1
	b.eq	LBB0_24
; %bb.19:
	ldr	w0, [x21]
Lloh27:
	adrp	x8, _SNDCTL_DSP_SPEED@GOTPAGE
Lloh28:
	ldr	x8, [x8, _SNDCTL_DSP_SPEED@GOTPAGEOFF]
Lloh29:
	ldr	w1, [x8]
	add	x20, x19, #4
	mov	x2, x20
	bl	_ioctl
	cmn	w0, #1
	b.eq	LBB0_26
; %bb.20:
	ldr	w0, [x21]
Lloh30:
	adrp	x8, _SNDCTL_DSP_GETBLKSIZE@GOTPAGE
Lloh31:
	ldr	x8, [x8, _SNDCTL_DSP_GETBLKSIZE@GOTPAGEOFF]
Lloh32:
	ldr	w1, [x8]
	add	x2, sp, #24
	bl	_ioctl
	cmn	w0, #1
	b.eq	LBB0_27
; %bb.21:
	ldr	w8, [sp, #24]
	ldp	w9, w10, [x19, #8]
	sdiv	w8, w8, w9
	sdiv	w8, w8, w10
	str	w8, [x19]
	ldr	w0, [x21]
Lloh33:
	adrp	x8, _SNDCTL_DSP_GETOSPACE@GOTPAGE
Lloh34:
	ldr	x8, [x8, _SNDCTL_DSP_GETOSPACE@GOTPAGEOFF]
Lloh35:
	ldr	w1, [x8]
	add	x2, sp, #16
	bl	_ioctl
	mov	x19, x0
	cmn	w0, #1
	b.ne	LBB0_23
; %bb.22:
	ldr	w1, [x22]
Lloh36:
	adrp	x0, l_.str.6@PAGE
Lloh37:
	add	x0, x0, l_.str.6@PAGEOFF
	bl	_Log_print
LBB0_23:
Lloh38:
	adrp	x8, _TRUE@GOTPAGE
Lloh39:
	ldr	x8, [x8, _TRUE@GOTPAGEOFF]
Lloh40:
	ldr	w8, [x8]
	cmn	w19, #1
	csel	w0, wzr, w8, eq
	b	LBB0_30
LBB0_24:
	ldr	w1, [x22]
	ldr	w8, [x20]
	str	x8, [sp]
Lloh41:
	adrp	x0, l_.str.3@PAGE
Lloh42:
	add	x0, x0, l_.str.3@PAGEOFF
	b	LBB0_28
LBB0_25:
	ldr	w1, [x22]
	str	x8, [sp]
Lloh43:
	adrp	x0, l_.str.2@PAGE
Lloh44:
	add	x0, x0, l_.str.2@PAGEOFF
	b	LBB0_28
LBB0_26:
	ldr	w1, [x22]
	ldr	w8, [x20]
	str	x8, [sp]
Lloh45:
	adrp	x0, l_.str.4@PAGE
Lloh46:
	add	x0, x0, l_.str.4@PAGEOFF
	b	LBB0_28
LBB0_27:
	ldr	w1, [x22]
Lloh47:
	adrp	x0, l_.str.5@PAGE
Lloh48:
	add	x0, x0, l_.str.5@PAGEOFF
LBB0_28:
	bl	_Log_print
	ldr	w0, [x21]
	bl	_close
LBB0_29:
Lloh49:
	adrp	x8, _FALSE@GOTPAGE
Lloh50:
	ldr	x8, [x8, _FALSE@GOTPAGEOFF]
Lloh51:
	ldr	w0, [x8]
LBB0_30:
	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
	add	sp, sp, #96
	ret
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpAdd	Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh38, Lloh39, Lloh40
	.loh AdrpAdd	Lloh41, Lloh42
	.loh AdrpAdd	Lloh43, Lloh44
	.loh AdrpAdd	Lloh45, Lloh46
	.loh AdrpAdd	Lloh47, Lloh48
	.loh AdrpLdrGotLdr	Lloh49, Lloh50, Lloh51
	.cfi_endproc
                                        ; -- End function
	.comm	_Sound_enabled,8,3              ; @Sound_enabled
	.comm	_dsp_fd,4,2                     ; @dsp_fd
	.comm	_dspname,4,2                    ; @dspname
	.comm	_O_WRONLY,4,2                   ; @O_WRONLY
	.comm	_FALSE,4,2                      ; @FALSE
	.comm	_SNDCTL_DSP_SETFRAGMENT,4,2     ; @SNDCTL_DSP_SETFRAGMENT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%s: SNDCTL_DSP_SETFRAGMENT(%.8x) failed"

	.comm	_AFMT_S16_NE,4,2                ; @AFMT_S16_NE
	.comm	_AFMT_U8,4,2                    ; @AFMT_U8
	.comm	_SNDCTL_DSP_SETFMT,4,2          ; @SNDCTL_DSP_SETFMT
l_.str.1:                               ; @.str.1
	.asciz	"%s: SNDCTL_DSP_SETFMT(%i) failed"

l_.str.2:                               ; @.str.2
	.asciz	"%s: Obtained format %i not supported"

	.comm	_SNDCTL_DSP_CHANNELS,4,2        ; @SNDCTL_DSP_CHANNELS
l_.str.3:                               ; @.str.3
	.asciz	"%s: SNDCTL_DSP_CHANNELS(%u) failed"

	.comm	_SNDCTL_DSP_SPEED,4,2           ; @SNDCTL_DSP_SPEED
l_.str.4:                               ; @.str.4
	.asciz	"%s: SNDCTL_DSP_SPEED(%u) failed"

	.comm	_SNDCTL_DSP_GETBLKSIZE,4,2      ; @SNDCTL_DSP_GETBLKSIZE
l_.str.5:                               ; @.str.5
	.asciz	"%s: SNDCTL_DSP_GETBLKSIZE failed"

	.comm	_SNDCTL_DSP_GETOSPACE,4,2       ; @SNDCTL_DSP_GETOSPACE
l_.str.6:                               ; @.str.6
	.asciz	"%s: cannot retrieve ospace"

	.comm	_TRUE,4,2                       ; @TRUE
.subsections_via_symbols
