	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function qxl_reap_surface_id
_qxl_reap_surface_id:                   ## @qxl_reap_surface_id
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, -64(%rbp)                 ## 4-byte Spill
	movq	%rdi, %rbx
	addq	$4, %rdi
	movq	%rdi, -72(%rbp)                 ## 8-byte Spill
	callq	_mutex_lock
	leaq	8(%rbx), %r13
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	leaq	12(%rbx), %rax
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	movl	$0, -44(%rbp)                   ## 4-byte Folded Spill
	movb	$1, %al
	jmp	LBB0_1
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_1 Depth=1
	testl	%r12d, %r12d
	sete	%al
	movl	$1, -44(%rbp)                   ## 4-byte Folded Spill
	testb	%al, -60(%rbp)                  ## 1-byte Folded Reload
	movl	$0, %eax
	je	LBB0_7
LBB0_1:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_3 Depth 2
	movl	%eax, -60(%rbp)                 ## 4-byte Spill
	movq	%r13, %rdi
	callq	_spin_lock
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	movl	(%rbx), %r14d
	movq	%r13, %rdi
	callq	_spin_unlock
	movq	16(%rbx), %rax
	movl	(%rax), %ecx
	movl	$0, %r12d
	testl	%ecx, %ecx
	jle	LBB0_6
## %bb.2:                               ##   in Loop: Header=BB0_1 Depth=1
	incl	%r14d
	xorl	%r12d, %r12d
	movq	%r14, %rax
	movq	%r14, -88(%rbp)                 ## 8-byte Spill
	movl	%r14d, %r15d
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_5:                                 ##   in Loop: Header=BB0_3 Depth=2
	incl	%r15d
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	16(%rax), %rax
	movl	(%rax), %ecx
	movq	-88(%rbp), %rax                 ## 8-byte Reload
	addl	%ecx, %eax
	cmpl	%eax, %r15d
	jge	LBB0_6
LBB0_3:                                 ##   Parent Loop BB0_1 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	%r15d, %eax
	cltd
	idivl	%ecx
	movl	%edx, %ebx
	movq	%r13, %rdi
	callq	_spin_lock
	movq	-80(%rbp), %rdi                 ## 8-byte Reload
	movl	%ebx, %esi
	callq	_idr_find
	movq	%rax, %r14
	movq	%r13, %rdi
	callq	_spin_unlock
	testq	%r14, %r14
	je	LBB0_5
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=2
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movq	%r14, %rsi
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	callq	_qxl_reap_surf
	cmpl	$1, %eax
	adcl	$0, %r12d
	cmpl	-64(%rbp), %r12d                ## 4-byte Folded Reload
	jl	LBB0_5
	jmp	LBB0_6
LBB0_7:
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	callq	_mutex_unlock
	testl	%r12d, %r12d
	je	LBB0_9
## %bb.8:
	movl	$500, %edi                      ## imm = 0x1F4
	movl	$1000, %esi                     ## imm = 0x3E8
	callq	_usleep_range
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	$1, %esi
	callq	_qxl_queue_garbage_collect
LBB0_9:
	xorl	%eax, %eax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.no_dead_strip	_qxl_reap_surface_id
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function qxl_reap_surface_id
_qxl_reap_surface_id:                   ; @qxl_reap_surface_id
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x21, x1
	mov	x19, x0
	add	x20, x0, #4
	mov	x0, x20
	bl	_mutex_lock
	add	x22, x19, #8
	add	x23, x19, #12
	mov	x0, x22
	bl	_spin_lock
	ldr	w24, [x19]
	mov	x0, x22
	bl	_spin_unlock
	ldr	x8, [x19, #16]
	ldr	w8, [x8]
	cmp	w8, #1
	b.lt	LBB0_5
; %bb.1:
	mov	w25, #0
	add	w26, w24, #1
	mov	x27, x26
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	add	w27, w27, #1
	ldr	x8, [x19, #16]
	ldr	w8, [x8]
	add	w9, w8, w26
	cmp	w27, w9
	b.ge	LBB0_6
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	sdiv	w9, w27, w8
	msub	w24, w9, w8, w27
	mov	x0, x22
	bl	_spin_lock
	mov	x0, x23
	mov	x1, x24
	bl	_idr_find
	mov	x24, x0
	mov	x0, x22
	bl	_spin_unlock
	cbz	x24, LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	x0, x19
	mov	x1, x24
	mov	w2, #0
	bl	_qxl_reap_surf
	cmp	w0, #0
	cinc	w25, w25, eq
	cmp	w25, w21
	b.lt	LBB0_2
	b	LBB0_6
LBB0_5:
	mov	w25, #0
LBB0_6:
	cmp	w25, #0
	cset	w24, eq
	cbnz	w25, LBB0_14
; %bb.7:
	mov	x0, x22
	bl	_spin_lock
	ldr	w24, [x19]
	mov	x0, x22
	bl	_spin_unlock
	ldr	x8, [x19, #16]
	ldr	w8, [x8]
	cmp	w8, #1
	b.lt	LBB0_12
; %bb.8:
	mov	w25, #0
	add	w26, w24, #1
	mov	x27, x26
	b	LBB0_10
LBB0_9:                                 ;   in Loop: Header=BB0_10 Depth=1
	add	w27, w27, #1
	ldr	x8, [x19, #16]
	ldr	w8, [x8]
	add	w9, w8, w26
	cmp	w27, w9
	b.ge	LBB0_13
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	sdiv	w9, w27, w8
	msub	w24, w9, w8, w27
	mov	x0, x22
	bl	_spin_lock
	mov	x0, x23
	mov	x1, x24
	bl	_idr_find
	mov	x24, x0
	mov	x0, x22
	bl	_spin_unlock
	cbz	x24, LBB0_9
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=1
	mov	x0, x19
	mov	x1, x24
	mov	w2, #1
	bl	_qxl_reap_surf
	cmp	w0, #0
	cinc	w25, w25, eq
	cmp	w25, w21
	b.lt	LBB0_9
	b	LBB0_13
LBB0_12:
	mov	w25, #0
LBB0_13:
	cmp	w25, #0
	cset	w24, eq
LBB0_14:
	mov	x0, x20
	bl	_mutex_unlock
	tbnz	w24, #0, LBB0_16
; %bb.15:
	mov	w0, #500
	mov	w1, #1000
	bl	_usleep_range
	mov	x0, x19
	mov	w1, #1
	bl	_qxl_queue_garbage_collect
LBB0_16:
	mov	w0, #0
	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
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
	.cfi_endproc
                                        ; -- End function
	.no_dead_strip	_qxl_reap_surface_id
.subsections_via_symbols
