	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sti_hqvdp_get_free_cmd
_sti_hqvdp_get_free_cmd:                ## @sti_hqvdp_get_free_cmd
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	movq	(%rdi), %rbx
	movq	_HQVDP_MBX_CURRENT_CMD@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	8(%r15), %rdi
	callq	_readl
	movq	%rax, %r14
	movq	_HQVDP_MBX_NEXT_CMD@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	8(%r15), %rdi
	callq	_readl
	movq	%rax, %rcx
	movq	_NB_VDP_CMD@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	$-1, %eax
	testl	%edx, %edx
	jle	LBB0_6
## %bb.1:
	movq	%rbx, %rsi
	subq	%r14, %rsi
	subq	%rcx, %rbx
	xorl	%ecx, %ecx
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_5:                                 ##   in Loop: Header=BB0_2 Depth=1
	addq	$-4, %rcx
	decl	%edx
	je	LBB0_6
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	cmpq	%rcx, %rsi
	je	LBB0_5
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	cmpq	%rcx, %rbx
	je	LBB0_5
## %bb.4:
	negl	%ecx
	movl	%ecx, %eax
LBB0_6:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_HQVDP_MBX_CURRENT_CMD,8,3      ## @HQVDP_MBX_CURRENT_CMD
	.comm	_HQVDP_MBX_NEXT_CMD,8,3         ## @HQVDP_MBX_NEXT_CMD
	.comm	_NB_VDP_CMD,4,2                 ## @NB_VDP_CMD
	.no_dead_strip	_sti_hqvdp_get_free_cmd
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sti_hqvdp_get_free_cmd
_sti_hqvdp_get_free_cmd:                ; @sti_hqvdp_get_free_cmd
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x20, x0
	ldp	x21, x8, [x0]
Lloh0:
	adrp	x9, _HQVDP_MBX_CURRENT_CMD@GOTPAGE
Lloh1:
	ldr	x9, [x9, _HQVDP_MBX_CURRENT_CMD@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	add	x0, x9, x8
	bl	_readl
	mov	x19, x0
	ldr	x8, [x20, #8]
Lloh3:
	adrp	x9, _HQVDP_MBX_NEXT_CMD@GOTPAGE
Lloh4:
	ldr	x9, [x9, _HQVDP_MBX_NEXT_CMD@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	add	x0, x9, x8
	bl	_readl
Lloh6:
	adrp	x8, _NB_VDP_CMD@GOTPAGE
Lloh7:
	ldr	x8, [x8, _NB_VDP_CMD@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	cmp	w8, #1
	b.lt	LBB0_6
; %bb.1:
	mov	x9, #0
	sub	x10, x21, x19
	sub	x11, x21, x0
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	sub	x9, x9, #4
	subs	w8, w8, #1
	b.eq	LBB0_6
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	cmp	x10, x9
	b.eq	LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	cmp	x11, x9
	b.eq	LBB0_2
; %bb.5:
	neg	w0, w9
	b	LBB0_7
LBB0_6:
	mov	w0, #-1
LBB0_7:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_HQVDP_MBX_CURRENT_CMD,8,3      ; @HQVDP_MBX_CURRENT_CMD
	.comm	_HQVDP_MBX_NEXT_CMD,8,3         ; @HQVDP_MBX_NEXT_CMD
	.comm	_NB_VDP_CMD,4,2                 ; @NB_VDP_CMD
	.no_dead_strip	_sti_hqvdp_get_free_cmd
.subsections_via_symbols
