	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_SNDDMA_BeginPainting           ## -- Begin function SNDDMA_BeginPainting
	.p2align	4, 0x90
_SNDDMA_BeginPainting:                  ## @SNDDMA_BeginPainting
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	_pDSBuf@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rdi
	testq	%rdi, %rdi
	je	LBB0_16
## %bb.1:
	movq	(%rdi), %rax
	leaq	-44(%rbp), %rsi
	callq	*(%rax)
	movq	_DS_OK@GOTPCREL(%rip), %r14
	cmpq	(%r14), %rax
	je	LBB0_3
## %bb.2:
	leaq	L_.str(%rip), %rdi
	xorl	%eax, %eax
	callq	_Com_Printf
LBB0_3:
	movl	-44(%rbp), %eax
	movq	_DSBSTATUS_BUFFERLOST@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_5
## %bb.4:
	movq	(%rbx), %rdi
	movq	(%rdi), %rax
	callq	*16(%rax)
	movl	-44(%rbp), %eax
LBB0_5:
	movq	_DSBSTATUS_PLAYING@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	jne	LBB0_7
## %bb.6:
	movq	(%rbx), %rdi
	movq	(%rdi), %rax
	movq	_DSBPLAY_LOOPING@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	xorl	%esi, %esi
	xorl	%edx, %edx
	callq	*24(%rax)
LBB0_7:
	movq	_dma@GOTPCREL(%rip), %r15
	movq	$0, (%r15)
	movq	(%rbx), %rdi
	movq	(%rdi), %rax
	movq	_gSndBufSize@GOTPCREL(%rip), %r13
	movl	(%r13), %edx
	leaq	-68(%rbp), %r12
	movq	_locksize@GOTPCREL(%rip), %r8
	leaq	-56(%rbp), %rcx
	leaq	-64(%rbp), %r9
	xorl	%esi, %esi
	pushq	$0
	pushq	%r12
	callq	*8(%rax)
	addq	$16, %rsp
	cmpq	(%r14), %rax
	jne	LBB0_8
LBB0_15:
	movq	-56(%rbp), %rax
	movq	%rax, (%r15)
	jmp	LBB0_16
LBB0_8:
	movq	_DSERR_BUFFERLOST@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_9
## %bb.10:
	movq	(%rbx), %rdi
	movq	(%rdi), %rax
	callq	*16(%rax)
	movq	(%rbx), %rdi
	movq	(%rdi), %rax
	movl	(%r13), %edx
	movq	_locksize@GOTPCREL(%rip), %r8
	leaq	-56(%rbp), %rcx
	leaq	-64(%rbp), %r9
	xorl	%esi, %esi
	pushq	$0
	pushq	%r12
	callq	*8(%rax)
	addq	$16, %rsp
	cmpq	(%r14), %rax
	je	LBB0_15
## %bb.11:
	movq	_DSERR_BUFFERLOST@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_9
## %bb.12:
	movq	(%rbx), %rdi
	movq	(%rdi), %rax
	callq	*16(%rax)
	movq	(%rbx), %rdi
	movq	(%rdi), %rax
	movl	(%r13), %edx
	movq	_locksize@GOTPCREL(%rip), %r8
	leaq	-56(%rbp), %rcx
	leaq	-64(%rbp), %r9
	xorl	%esi, %esi
	pushq	$0
	pushq	%r12
	callq	*8(%rax)
	addq	$16, %rsp
	cmpq	(%r14), %rax
	je	LBB0_15
## %bb.13:
	movq	_DSERR_BUFFERLOST@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_9
## %bb.14:
	movq	(%rbx), %rdi
	movq	(%rdi), %rax
	callq	*16(%rax)
	jmp	LBB0_16
LBB0_9:
	movq	%rax, %rdi
	callq	_DSoundError
	leaq	L_.str.1(%rip), %rdi
	movl	%eax, %esi
	xorl	%eax, %eax
	callq	_Com_Printf
	xorl	%eax, %eax
	callq	_S_Shutdown
LBB0_16:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_pDSBuf,8,3                     ## @pDSBuf
	.comm	_DS_OK,8,3                      ## @DS_OK
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Couldn't get sound buffer status\n"

	.comm	_DSBSTATUS_BUFFERLOST,4,2       ## @DSBSTATUS_BUFFERLOST
	.comm	_DSBSTATUS_PLAYING,4,2          ## @DSBSTATUS_PLAYING
	.comm	_DSBPLAY_LOOPING,4,2            ## @DSBPLAY_LOOPING
	.comm	_dma,8,3                        ## @dma
	.comm	_gSndBufSize,4,2                ## @gSndBufSize
	.comm	_locksize,4,2                   ## @locksize
	.comm	_DSERR_BUFFERLOST,8,3           ## @DSERR_BUFFERLOST
L_.str.1:                               ## @.str.1
	.asciz	"SNDDMA_BeginPainting: Lock failed with error '%s'\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_SNDDMA_BeginPainting           ; -- Begin function SNDDMA_BeginPainting
	.p2align	2
_SNDDMA_BeginPainting:                  ; @SNDDMA_BeginPainting
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
Lloh0:
	adrp	x19, _pDSBuf@GOTPAGE
Lloh1:
	ldr	x19, [x19, _pDSBuf@GOTPAGEOFF]
	ldr	x0, [x19]
	cbz	x0, LBB0_16
; %bb.1:
	ldr	x8, [x0]
	ldr	x8, [x8]
	add	x1, sp, #20
	blr	x8
Lloh2:
	adrp	x20, _DS_OK@GOTPAGE
Lloh3:
	ldr	x20, [x20, _DS_OK@GOTPAGEOFF]
	ldr	x8, [x20]
	cmp	x0, x8
	b.eq	LBB0_3
; %bb.2:
Lloh4:
	adrp	x0, l_.str@PAGE
Lloh5:
	add	x0, x0, l_.str@PAGEOFF
	bl	_Com_Printf
LBB0_3:
	ldr	w8, [sp, #20]
Lloh6:
	adrp	x9, _DSBSTATUS_BUFFERLOST@GOTPAGE
Lloh7:
	ldr	x9, [x9, _DSBSTATUS_BUFFERLOST@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_5
; %bb.4:
	ldr	x0, [x19]
	ldr	x8, [x0]
	ldr	x8, [x8, #16]
	blr	x8
	ldr	w8, [sp, #20]
LBB0_5:
Lloh9:
	adrp	x9, _DSBSTATUS_PLAYING@GOTPAGE
Lloh10:
	ldr	x9, [x9, _DSBSTATUS_PLAYING@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	tst	w9, w8
	b.ne	LBB0_7
; %bb.6:
	ldr	x0, [x19]
	ldr	x8, [x0]
	ldr	x8, [x8, #24]
Lloh12:
	adrp	x9, _DSBPLAY_LOOPING@GOTPAGE
Lloh13:
	ldr	x9, [x9, _DSBPLAY_LOOPING@GOTPAGEOFF]
Lloh14:
	ldr	w3, [x9]
	mov	w1, #0
	mov	w2, #0
	blr	x8
LBB0_7:
Lloh15:
	adrp	x21, _dma@GOTPAGE
Lloh16:
	ldr	x21, [x21, _dma@GOTPAGEOFF]
	str	xzr, [x21]
	ldr	x0, [x19]
	ldr	x8, [x0]
	ldr	x8, [x8, #8]
Lloh17:
	adrp	x22, _gSndBufSize@GOTPAGE
Lloh18:
	ldr	x22, [x22, _gSndBufSize@GOTPAGEOFF]
	ldr	w2, [x22]
Lloh19:
	adrp	x4, _locksize@GOTPAGE
Lloh20:
	ldr	x4, [x4, _locksize@GOTPAGEOFF]
	add	x3, sp, #32
	add	x5, sp, #24
	add	x6, sp, #44
	mov	w1, #0
	mov	w7, #0
	blr	x8
	ldr	x8, [x20]
	cmp	x0, x8
	b.ne	LBB0_9
LBB0_8:
	ldr	x8, [sp, #32]
	str	x8, [x21]
	b	LBB0_16
LBB0_9:
Lloh21:
	adrp	x23, _DSERR_BUFFERLOST@GOTPAGE
Lloh22:
	ldr	x23, [x23, _DSERR_BUFFERLOST@GOTPAGEOFF]
	ldr	x8, [x23]
	cmp	x0, x8
	b.ne	LBB0_15
; %bb.10:
	ldr	x0, [x19]
	ldr	x8, [x0]
	ldr	x8, [x8, #16]
	blr	x8
	ldr	x0, [x19]
	ldr	x8, [x0]
	ldr	x8, [x8, #8]
	ldr	w2, [x22]
Lloh23:
	adrp	x4, _locksize@GOTPAGE
Lloh24:
	ldr	x4, [x4, _locksize@GOTPAGEOFF]
	add	x3, sp, #32
	add	x5, sp, #24
	add	x6, sp, #44
	mov	w1, #0
	mov	w7, #0
	blr	x8
	ldr	x8, [x20]
	cmp	x0, x8
	b.eq	LBB0_8
; %bb.11:
	ldr	x8, [x23]
	cmp	x0, x8
	b.ne	LBB0_15
; %bb.12:
	ldr	x0, [x19]
	ldr	x8, [x0]
	ldr	x8, [x8, #16]
	blr	x8
	ldr	x0, [x19]
	ldr	x8, [x0]
	ldr	x8, [x8, #8]
	ldr	w2, [x22]
Lloh25:
	adrp	x4, _locksize@GOTPAGE
Lloh26:
	ldr	x4, [x4, _locksize@GOTPAGEOFF]
	add	x3, sp, #32
	add	x5, sp, #24
	add	x6, sp, #44
	mov	w1, #0
	mov	w7, #0
	blr	x8
	ldr	x8, [x20]
	cmp	x0, x8
	b.eq	LBB0_8
; %bb.13:
	ldr	x8, [x23]
	cmp	x0, x8
	b.ne	LBB0_15
; %bb.14:
	ldr	x0, [x19]
	ldr	x8, [x0]
	ldr	x8, [x8, #16]
	blr	x8
	b	LBB0_16
LBB0_15:
	bl	_DSoundError
                                        ; kill: def $w0 killed $w0 def $x0
	str	x0, [sp]
Lloh27:
	adrp	x0, l_.str.1@PAGE
Lloh28:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_Com_Printf
	bl	_S_Shutdown
LBB0_16:
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpAdd	Lloh27, Lloh28
	.cfi_endproc
                                        ; -- End function
	.comm	_pDSBuf,8,3                     ; @pDSBuf
	.comm	_DS_OK,8,3                      ; @DS_OK
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Couldn't get sound buffer status\n"

	.comm	_DSBSTATUS_BUFFERLOST,4,2       ; @DSBSTATUS_BUFFERLOST
	.comm	_DSBSTATUS_PLAYING,4,2          ; @DSBSTATUS_PLAYING
	.comm	_DSBPLAY_LOOPING,4,2            ; @DSBPLAY_LOOPING
	.comm	_dma,8,3                        ; @dma
	.comm	_gSndBufSize,4,2                ; @gSndBufSize
	.comm	_locksize,4,2                   ; @locksize
	.comm	_DSERR_BUFFERLOST,8,3           ; @DSERR_BUFFERLOST
l_.str.1:                               ; @.str.1
	.asciz	"SNDDMA_BeginPainting: Lock failed with error '%s'\n"

.subsections_via_symbols
