	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_qxl_alloc_release_reserved     ## -- Begin function qxl_alloc_release_reserved
	.p2align	4, 0x90
_qxl_alloc_release_reserved:            ## @qxl_alloc_release_reserved
	.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	%rcx, %r14
	movq	%rdi, %rbx
	movq	_QXL_RELEASE_DRAWABLE@GOTPCREL(%rip), %rax
	cmpl	%edx, (%rax)
	jne	LBB0_5
## %bb.1:
	xorl	%r13d, %r13d
	jmp	LBB0_2
LBB0_5:
	movq	_QXL_RELEASE_SURFACE_CMD@GOTPCREL(%rip), %rax
	movl	$1, %r13d
	cmpl	%edx, (%rax)
	je	LBB0_2
## %bb.6:
	movq	_QXL_RELEASE_CURSOR_CMD@GOTPCREL(%rip), %rax
	movl	$2, %r13d
	cmpl	%edx, (%rax)
	jne	LBB0_7
LBB0_2:
	movq	%r8, -56(%rbp)                  ## 8-byte Spill
	movq	%rbx, %rdi
	movl	%edx, %esi
	movq	%r14, %rdx
	callq	_qxl_release_alloc
	movl	%eax, %r15d
	testl	%eax, %eax
	js	LBB0_3
## %bb.8:
	leaq	8(%rbx), %rdi
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	callq	_mutex_lock
	movq	(%rbx), %rax
	movl	(%rax,%r13,4), %eax
	incl	%eax
	movq	_releases_per_bo@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpl	(%rcx,%r13,4), %eax
	jl	LBB0_10
## %bb.9:
	leaq	(,%r13,8), %rdi
	addq	16(%rbx), %rdi
	callq	_qxl_bo_unref
	movq	(%rbx), %rax
	movl	$0, (%rax,%r13,4)
	movq	16(%rbx), %rax
	movq	$0, (%rax,%r13,8)
LBB0_10:
	movq	16(%rbx), %rax
	movq	(%rax,%r13,8), %rdi
	testq	%rdi, %rdi
	je	LBB0_11
LBB0_13:
	callq	_qxl_bo_ref
	movq	%rax, %r12
	movq	%rax, -64(%rbp)
	movq	(%r14), %rax
	movq	%r12, 8(%rax)
	movq	(%rbx), %rax
	movq	_release_size_per_bo@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movl	(%rcx,%r13,4), %ecx
	imull	(%rax,%r13,4), %ecx
	movq	(%r14), %rdx
	movl	%ecx, (%rdx)
	incl	(%rax,%r13,4)
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	testq	%rax, %rax
	je	LBB0_15
## %bb.14:
	movq	%r12, (%rax)
LBB0_15:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_mutex_unlock
	movq	(%r14), %rdi
	movq	%r12, %rsi
	callq	_qxl_release_list_add
	movl	%eax, %r12d
	leaq	-64(%rbp), %rdi
	callq	_qxl_bo_unref
	movq	(%r14), %rsi
	testl	%r12d, %r12d
	jne	LBB0_16
## %bb.17:
	movq	%rbx, %rdi
	callq	_qxl_release_map
	movl	%r15d, (%rax)
	movq	(%r14), %rsi
	movq	%rbx, %rdi
	movq	%rax, %rdx
	callq	_qxl_release_unmap
	xorl	%r15d, %r15d
	jmp	LBB0_18
LBB0_3:
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	testq	%rax, %rax
	je	LBB0_18
## %bb.4:
	movq	$0, (%rax)
	jmp	LBB0_18
LBB0_11:
	leaq	(%rax,%r13,8), %rsi
	movq	%rbx, %rdi
	callq	_qxl_release_bo_alloc
	testl	%eax, %eax
	je	LBB0_12
## %bb.19:
	movl	%eax, %r12d
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_mutex_unlock
	movq	(%r14), %rsi
LBB0_16:
	movq	%rbx, %rdi
	callq	_qxl_release_free
	movl	%r12d, %r15d
	jmp	LBB0_18
LBB0_7:
	leaq	L_.str(%rip), %rdi
	movl	%edx, %esi
	callq	_DRM_ERROR
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
LBB0_18:
	movl	%r15d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_12:
	movq	16(%rbx), %rax
	movq	(%rax,%r13,8), %rdi
	jmp	LBB0_13
	.cfi_endproc
                                        ## -- End function
	.comm	_QXL_RELEASE_DRAWABLE,4,2       ## @QXL_RELEASE_DRAWABLE
	.comm	_QXL_RELEASE_SURFACE_CMD,4,2    ## @QXL_RELEASE_SURFACE_CMD
	.comm	_QXL_RELEASE_CURSOR_CMD,4,2     ## @QXL_RELEASE_CURSOR_CMD
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"got illegal type: %d\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_releases_per_bo,8,3            ## @releases_per_bo
	.comm	_release_size_per_bo,8,3        ## @release_size_per_bo
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_qxl_alloc_release_reserved     ; -- Begin function qxl_alloc_release_reserved
	.p2align	2
_qxl_alloc_release_reserved:            ; @qxl_alloc_release_reserved
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x22, x4
	mov	x20, x3
	mov	x1, x2
	mov	x19, x0
Lloh0:
	adrp	x8, _QXL_RELEASE_DRAWABLE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _QXL_RELEASE_DRAWABLE@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w2
	b.ne	LBB0_2
; %bb.1:
	mov	x25, #0
	b	LBB0_6
LBB0_2:
Lloh3:
	adrp	x8, _QXL_RELEASE_SURFACE_CMD@GOTPAGE
Lloh4:
	ldr	x8, [x8, _QXL_RELEASE_SURFACE_CMD@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	cmp	w8, w1
	b.ne	LBB0_4
; %bb.3:
	mov	w25, #1
	b	LBB0_6
LBB0_4:
Lloh6:
	adrp	x8, _QXL_RELEASE_CURSOR_CMD@GOTPAGE
Lloh7:
	ldr	x8, [x8, _QXL_RELEASE_CURSOR_CMD@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	cmp	w8, w1
	b.ne	LBB0_19
; %bb.5:
	mov	w25, #2
LBB0_6:
	mov	x0, x19
	mov	x2, x20
	bl	_qxl_release_alloc
	mov	x21, x0
	tbnz	w0, #31, LBB0_14
; %bb.7:
	add	x23, x19, #8
	mov	x0, x23
	bl	_mutex_lock
	ldr	x8, [x19]
	lsl	x26, x25, #2
	ldr	w8, [x8, x26]
	add	w8, w8, #1
Lloh9:
	adrp	x9, _releases_per_bo@GOTPAGE
Lloh10:
	ldr	x9, [x9, _releases_per_bo@GOTPAGEOFF]
Lloh11:
	ldr	x9, [x9]
	ldr	w9, [x9, x26]
	cmp	w8, w9
	b.lt	LBB0_9
; %bb.8:
	ldr	x8, [x19, #16]
	lsl	x24, x25, #3
	add	x0, x8, x24
	bl	_qxl_bo_unref
	ldr	x8, [x19]
	str	wzr, [x8, x25, lsl #2]
	ldr	x8, [x19, #16]
	str	xzr, [x8, x24]
LBB0_9:
	ldr	x8, [x19, #16]
	add	x1, x8, x25, lsl #3
	ldr	x0, [x1]
	cbz	x0, LBB0_16
LBB0_10:
	bl	_qxl_bo_ref
	mov	x24, x0
	ldr	x8, [x20]
	str	x0, [x8, #8]
	ldr	x8, [x19]
	ldr	w9, [x8, x26]
Lloh12:
	adrp	x10, _release_size_per_bo@GOTPAGE
Lloh13:
	ldr	x10, [x10, _release_size_per_bo@GOTPAGEOFF]
	str	x0, [sp, #8]
Lloh14:
	ldr	x10, [x10]
	ldr	w10, [x10, x26]
	mul	w9, w10, w9
	ldr	x10, [x20]
	str	w9, [x10]
	ldr	w9, [x8, x26]
	add	w9, w9, #1
	str	w9, [x8, x26]
	cbz	x22, LBB0_12
; %bb.11:
	str	x24, [x22]
LBB0_12:
	mov	x0, x23
	bl	_mutex_unlock
	ldr	x0, [x20]
	mov	x1, x24
	bl	_qxl_release_list_add
	mov	x22, x0
	add	x0, sp, #8
	bl	_qxl_bo_unref
	ldr	x1, [x20]
	cbz	w22, LBB0_18
; %bb.13:
	mov	x0, x19
	bl	_qxl_release_free
	mov	x21, x22
	b	LBB0_20
LBB0_14:
	cbz	x22, LBB0_20
; %bb.15:
	str	xzr, [x22]
	b	LBB0_20
LBB0_16:
	mov	x0, x19
	bl	_qxl_release_bo_alloc
	cbz	w0, LBB0_21
; %bb.17:
	mov	x24, x0
	mov	x0, x23
	bl	_mutex_unlock
	ldr	x1, [x20]
	mov	x0, x19
	bl	_qxl_release_free
	mov	x21, x24
	b	LBB0_20
LBB0_18:
	mov	x0, x19
	bl	_qxl_release_map
	mov	x2, x0
	str	w21, [x0]
	ldr	x1, [x20]
	mov	x0, x19
	bl	_qxl_release_unmap
	mov	w21, #0
	b	LBB0_20
LBB0_19:
Lloh15:
	adrp	x0, l_.str@PAGE
Lloh16:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DRM_ERROR
Lloh17:
	adrp	x8, _EINVAL@GOTPAGE
Lloh18:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh19:
	ldr	w8, [x8]
	neg	w21, w8
LBB0_20:
	mov	x0, x21
	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
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
LBB0_21:
	ldr	x8, [x19, #16]
	ldr	x0, [x8, x25, lsl #3]
	b	LBB0_10
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpAdd	Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.comm	_QXL_RELEASE_DRAWABLE,4,2       ; @QXL_RELEASE_DRAWABLE
	.comm	_QXL_RELEASE_SURFACE_CMD,4,2    ; @QXL_RELEASE_SURFACE_CMD
	.comm	_QXL_RELEASE_CURSOR_CMD,4,2     ; @QXL_RELEASE_CURSOR_CMD
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"got illegal type: %d\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_releases_per_bo,8,3            ; @releases_per_bo
	.comm	_release_size_per_bo,8,3        ; @release_size_per_bo
.subsections_via_symbols
