	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function qp_alloc_res
_qp_alloc_res:                          ## @qp_alloc_res
	.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
	movl	%esi, %r14d
	movq	%rdi, %r15
	movl	%r8d, -48(%rbp)
	cmpl	$129, %edx
	je	LBB0_8
## %bb.1:
	cmpl	$128, %edx
	jne	LBB0_15
## %bb.2:
	movq	%r9, -64(%rbp)                  ## 8-byte Spill
	leaq	-48(%rbp), %rbx
	movq	%rbx, %rdi
	callq	_get_param_l
	movl	%eax, %r13d
	andl	$16777215, %r13d                ## imm = 0xFFFFFF
	movq	%rbx, %rdi
	callq	_get_param_l
	movl	%eax, %r12d
	movl	(%r15), %eax
	movl	%eax, -56(%rbp)                 ## 4-byte Spill
	movq	%rbx, %rdi
	callq	_get_param_h
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	movq	_RES_QP@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	movl	%r14d, %esi
	movl	%r13d, %ecx
	xorl	%r8d, %r8d
	callq	_mlx4_grant_resource
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_16
## %bb.3:
	sarl	$24, %r12d
	andl	-56(%rbp), %r12d                ## 4-byte Folded Reload
	leaq	-44(%rbp), %rcx
	movq	%r15, %rdi
	movl	%r13d, %esi
	movl	-52(%rbp), %edx                 ## 4-byte Reload
	movl	%r12d, %r8d
	callq	___mlx4_qp_reserve_range
	testl	%eax, %eax
	je	LBB0_5
## %bb.4:
	movl	%eax, %ebx
	movq	_RES_QP@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	movl	%r14d, %esi
	movl	%r13d, %ecx
	xorl	%r8d, %r8d
	callq	_mlx4_release_resource
	jmp	LBB0_16
LBB0_8:
	leaq	-48(%rbp), %rdi
	callq	_get_param_l
	movl	%eax, %r12d
	andl	$8388607, %r12d                 ## imm = 0x7FFFFF
	movq	%r15, %rdi
	movl	%r14d, %esi
	movl	%r12d, %edx
	callq	_valid_reserved
	testl	%eax, %eax
	je	LBB0_10
## %bb.9:
	movq	_RES_QP@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	movq	%r15, %rdi
	movl	%r14d, %esi
	movl	%r12d, %edx
	movl	$1, %ecx
	xorl	%r9d, %r9d
	callq	_add_res_range
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_16
LBB0_10:
	movq	_RES_QP_MAPPED@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r15, %rdi
	movl	%r14d, %esi
	movl	%r12d, %edx
	xorl	%r8d, %r8d
	movl	$1, %r9d
	callq	_qp_res_start_move_to
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_16
## %bb.11:
	movq	%r15, %rdi
	movl	%r12d, %esi
	callq	_fw_reserved
	testl	%eax, %eax
	je	LBB0_12
LBB0_14:
	movq	_RES_QP@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	movl	%r14d, %esi
	movl	%r12d, %ecx
	callq	_res_end_move
	xorl	%ebx, %ebx
	jmp	LBB0_16
LBB0_15:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_16:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	movl	-44(%rbp), %edx
	movq	_RES_QP@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	xorl	%ebx, %ebx
	movq	%r15, %rdi
	movl	%r14d, %esi
	movl	%r13d, %ecx
	xorl	%r9d, %r9d
	callq	_add_res_range
	testl	%eax, %eax
	je	LBB0_7
## %bb.6:
	movl	%eax, %r12d
	movq	_RES_QP@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	movl	%r14d, %esi
	movl	%r13d, %ecx
	xorl	%r8d, %r8d
	callq	_mlx4_release_resource
	movl	-44(%rbp), %esi
	movq	%r15, %rdi
	movl	%r13d, %edx
	callq	___mlx4_qp_release_range
	movl	%r12d, %ebx
	jmp	LBB0_16
LBB0_12:
	movq	%r15, %rdi
	movl	%r12d, %esi
	callq	___mlx4_qp_alloc_icm
	testl	%eax, %eax
	je	LBB0_14
## %bb.13:
	movl	%eax, %ebx
	movq	_RES_QP@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	movl	%r14d, %esi
	movl	%r12d, %ecx
	callq	_res_abort_move
	jmp	LBB0_16
LBB0_7:
	movl	-44(%rbp), %esi
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_set_param_l
	jmp	LBB0_16
	.cfi_endproc
                                        ## -- End function
	.comm	_RES_QP,4,2                     ## @RES_QP
	.comm	_RES_QP_MAPPED,4,2              ## @RES_QP_MAPPED
	.comm	_EINVAL,4,2                     ## @EINVAL
	.no_dead_strip	_qp_alloc_res
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function qp_alloc_res
_qp_alloc_res:                          ; @qp_alloc_res
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x20, x1
	mov	x19, x0
	str	w4, [sp, #12]
	cmp	w2, #129
	b.eq	LBB0_5
; %bb.1:
	cmp	w2, #128
	b.ne	LBB0_10
; %bb.2:
	mov	x22, x5
	add	x0, sp, #12
	bl	_get_param_l
	and	w21, w0, #0xffffff
	add	x0, sp, #12
	bl	_get_param_l
	mov	x25, x0
	ldr	w27, [x19]
	add	x0, sp, #12
	bl	_get_param_h
	mov	x24, x0
Lloh0:
	adrp	x26, _RES_QP@GOTPAGE
Lloh1:
	ldr	x26, [x26, _RES_QP@GOTPAGEOFF]
	ldr	w2, [x26]
	mov	x0, x19
	mov	x1, x20
	mov	x3, x21
	mov	w4, #0
	bl	_mlx4_grant_resource
	mov	x23, x0
	cbnz	w0, LBB0_11
; %bb.3:
	and	w4, w27, w25, asr #24
	add	x3, sp, #8
	mov	x0, x19
	mov	x1, x21
	mov	x2, x24
	bl	___mlx4_qp_reserve_range
	cbz	w0, LBB0_12
; %bb.4:
	mov	x23, x0
	ldr	w2, [x26]
	mov	x0, x19
	mov	x1, x20
	mov	x3, x21
	mov	w4, #0
	bl	_mlx4_release_resource
	b	LBB0_11
LBB0_5:
	add	x0, sp, #12
	bl	_get_param_l
	and	w21, w0, #0x7fffff
	mov	x0, x19
	mov	x1, x20
	mov	x2, x21
	bl	_valid_reserved
	cbz	w0, LBB0_7
; %bb.6:
Lloh2:
	adrp	x8, _RES_QP@GOTPAGE
Lloh3:
	ldr	x8, [x8, _RES_QP@GOTPAGEOFF]
Lloh4:
	ldr	w4, [x8]
	mov	x0, x19
	mov	x1, x20
	mov	x2, x21
	mov	w3, #1
	mov	w5, #0
	bl	_add_res_range
	mov	x23, x0
	cbnz	w0, LBB0_11
LBB0_7:
Lloh5:
	adrp	x8, _RES_QP_MAPPED@GOTPAGE
Lloh6:
	ldr	x8, [x8, _RES_QP_MAPPED@GOTPAGEOFF]
Lloh7:
	ldr	w3, [x8]
	mov	x0, x19
	mov	x1, x20
	mov	x2, x21
	mov	x4, #0
	mov	w5, #1
	bl	_qp_res_start_move_to
	mov	x23, x0
	cbnz	w0, LBB0_11
; %bb.8:
	mov	x0, x19
	mov	x1, x21
	bl	_fw_reserved
	cbz	w0, LBB0_14
LBB0_9:
Lloh8:
	adrp	x8, _RES_QP@GOTPAGE
Lloh9:
	ldr	x8, [x8, _RES_QP@GOTPAGEOFF]
Lloh10:
	ldr	w2, [x8]
	mov	x0, x19
	mov	x1, x20
	mov	x3, x21
	bl	_res_end_move
	mov	w23, #0
	b	LBB0_11
LBB0_10:
Lloh11:
	adrp	x8, _EINVAL@GOTPAGE
Lloh12:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	neg	w23, w8
LBB0_11:
	mov	x0, x23
	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
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_12:
	ldr	w2, [sp, #8]
	ldr	w4, [x26]
	mov	x0, x19
	mov	x1, x20
	mov	x3, x21
	mov	w5, #0
	bl	_add_res_range
	mov	x23, x0
	cbz	w0, LBB0_16
; %bb.13:
	ldr	w2, [x26]
	mov	x0, x19
	mov	x1, x20
	mov	x3, x21
	mov	w4, #0
	bl	_mlx4_release_resource
	ldr	w1, [sp, #8]
	mov	x0, x19
	mov	x2, x21
	bl	___mlx4_qp_release_range
	b	LBB0_11
LBB0_14:
	mov	x0, x19
	mov	x1, x21
	bl	___mlx4_qp_alloc_icm
	cbz	w0, LBB0_9
; %bb.15:
	mov	x23, x0
Lloh14:
	adrp	x8, _RES_QP@GOTPAGE
Lloh15:
	ldr	x8, [x8, _RES_QP@GOTPAGEOFF]
Lloh16:
	ldr	w2, [x8]
	mov	x0, x19
	mov	x1, x20
	mov	x3, x21
	bl	_res_abort_move
	b	LBB0_11
LBB0_16:
	ldr	w1, [sp, #8]
	mov	x0, x22
	bl	_set_param_l
	b	LBB0_11
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.comm	_RES_QP,4,2                     ; @RES_QP
	.comm	_RES_QP_MAPPED,4,2              ; @RES_QP_MAPPED
	.comm	_EINVAL,4,2                     ; @EINVAL
	.no_dead_strip	_qp_alloc_res
.subsections_via_symbols
