	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_pvr2_buffer_set_buffer         ## -- Begin function pvr2_buffer_set_buffer
	.p2align	4, 0x90
_pvr2_buffer_set_buffer:                ## @pvr2_buffer_set_buffer
	.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
	testq	%rdi, %rdi
	je	LBB0_1
## %bb.2:
	movl	%edx, %r12d
	movq	%rsi, %r13
	movq	%rdi, %rbx
	movq	16(%rdi), %r15
	leaq	4(%r15), %r14
	movq	%r14, %rdi
	callq	_mutex_lock
	addq	$8, %r15
	movq	%r15, %rdi
	callq	_spin_lock_irqsave
	movq	(%rbx), %rdi
	movq	_pvr2_buffer_state_idle@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rdi
	jne	LBB0_3
## %bb.4:
	movq	%r13, 24(%rbx)
	movq	16(%rbx), %rax
	movl	(%rax), %ecx
	subl	8(%rbx), %ecx
	movl	%r12d, 8(%rbx)
	addl	%r12d, %ecx
	movl	%ecx, (%rax)
	movq	_PVR2_TRACE_BUF_FLOW@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	callq	_pvr2_buffer_state_decode
	movq	16(%rbx), %rdx
	movl	(%rdx), %ecx
	movl	12(%rdx), %r8d
	leaq	L_.str(%rip), %rsi
	movl	%r12d, %edi
	movl	%eax, %edx
	callq	_pvr2_trace
	xorl	%ebx, %ebx
	jmp	LBB0_5
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_6
LBB0_3:
	movq	_EPERM@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_5:
	movq	%r15, %rdi
	callq	_spin_unlock_irqrestore
	movq	%r14, %rdi
	callq	_mutex_unlock
LBB0_6:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_pvr2_buffer_state_idle,8,3     ## @pvr2_buffer_state_idle
	.comm	_EPERM,4,2                      ## @EPERM
	.comm	_PVR2_TRACE_BUF_FLOW,4,2        ## @PVR2_TRACE_BUF_FLOW
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"/*---TRACE_FLOW---*/ bufferPool\t%8s cap cap=%07d cnt=%02d"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_pvr2_buffer_set_buffer         ; -- Begin function pvr2_buffer_set_buffer
	.p2align	2
_pvr2_buffer_set_buffer:                ; @pvr2_buffer_set_buffer
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	cbz	x0, LBB0_3
; %bb.1:
	mov	x22, x2
	mov	x23, x1
	mov	x21, x0
	ldr	x20, [x0, #16]
	add	x19, x20, #4
	mov	x0, x19
	bl	_mutex_lock
	add	x20, x20, #8
	mov	x0, x20
	bl	_spin_lock_irqsave
	ldr	x0, [x21]
Lloh0:
	adrp	x8, _pvr2_buffer_state_idle@GOTPAGE
Lloh1:
	ldr	x8, [x8, _pvr2_buffer_state_idle@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cmp	x0, x8
	b.ne	LBB0_4
; %bb.2:
	str	x23, [x21, #24]
	ldr	w8, [x21, #8]
	ldr	x9, [x21, #16]
	ldr	w10, [x9]
	str	w22, [x21, #8]
	sub	w8, w10, w8
	add	w8, w8, w22
	str	w8, [x9]
Lloh3:
	adrp	x8, _PVR2_TRACE_BUF_FLOW@GOTPAGE
Lloh4:
	ldr	x8, [x8, _PVR2_TRACE_BUF_FLOW@GOTPAGEOFF]
Lloh5:
	ldr	w22, [x8]
	bl	_pvr2_buffer_state_decode
	mov	x2, x0
	ldr	x8, [x21, #16]
	ldr	w3, [x8]
	ldr	w4, [x8, #12]
Lloh6:
	adrp	x1, l_.str@PAGE
Lloh7:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x22
	bl	_pvr2_trace
	mov	w21, #0
	b	LBB0_5
LBB0_3:
Lloh8:
	adrp	x8, _EINVAL@GOTPAGE
Lloh9:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_6
LBB0_4:
Lloh11:
	adrp	x8, _EPERM@GOTPAGE
Lloh12:
	ldr	x8, [x8, _EPERM@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	neg	w21, w8
LBB0_5:
	mov	x0, x20
	bl	_spin_unlock_irqrestore
	mov	x0, x19
	bl	_mutex_unlock
LBB0_6:
	mov	x0, x21
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_pvr2_buffer_state_idle,8,3     ; @pvr2_buffer_state_idle
	.comm	_EPERM,4,2                      ; @EPERM
	.comm	_PVR2_TRACE_BUF_FLOW,4,2        ; @PVR2_TRACE_BUF_FLOW
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"/*---TRACE_FLOW---*/ bufferPool\t%8s cap cap=%07d cnt=%02d"

.subsections_via_symbols
