	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mpt_alloc_res
_mpt_alloc_res:                         ## @mpt_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, -44(%rbp)
	cmpl	$129, %edx
	je	LBB0_9
## %bb.1:
	cmpl	$128, %edx
	jne	LBB0_2
## %bb.3:
	movq	%r9, %r12
	movq	_RES_MPT@GOTPCREL(%rip), %r13
	movl	(%r13), %edx
	movq	%r15, %rdi
	movl	%r14d, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	callq	_mlx4_grant_resource
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_14
## %bb.4:
	movq	%r13, %rbx
	movq	%r15, %rdi
	callq	___mlx4_mpt_reserve
	cmpl	$-1, %eax
	je	LBB0_5
## %bb.6:
	movl	%eax, %r13d
	movq	%r15, %rdi
	callq	_mpt_mask
	movl	%r13d, %edx
	andl	%eax, %edx
	movl	(%rbx), %r8d
	movq	%r15, %rdi
	movl	%r14d, %esi
	movl	$1, %ecx
	movl	%r13d, %r9d
	callq	_add_res_range
	testl	%eax, %eax
	je	LBB0_8
## %bb.7:
	movl	%eax, %ebx
	movq	_RES_MPT@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	movl	%r14d, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	callq	_mlx4_release_resource
	movq	%r15, %rdi
	movl	%r13d, %esi
	callq	___mlx4_mpt_release
	jmp	LBB0_14
LBB0_9:
	leaq	-44(%rbp), %rdi
	callq	_get_param_l
	movl	%eax, %ebx
	movq	%r15, %rdi
	callq	_mpt_mask
	movl	%eax, %r12d
	andl	%ebx, %r12d
	movq	_RES_MPT_MAPPED@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	-56(%rbp), %r8
	movq	%r15, %rdi
	movl	%r14d, %esi
	movl	%r12d, %edx
	callq	_mr_res_start_move_to
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_14
## %bb.10:
	movq	-56(%rbp), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	___mlx4_mpt_alloc_icm
	movl	%eax, %ebx
	movq	_RES_MPT@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	movl	%r14d, %esi
	movl	%r12d, %ecx
	testl	%ebx, %ebx
	je	LBB0_12
## %bb.11:
	callq	_res_abort_move
	jmp	LBB0_14
LBB0_2:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_14:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	movl	(%rbx), %edx
	xorl	%ebx, %ebx
	movq	%r15, %rdi
	movl	%r14d, %esi
	movl	$1, %ecx
	xorl	%r8d, %r8d
	callq	_mlx4_release_resource
	jmp	LBB0_14
LBB0_12:
	callq	_res_end_move
	jmp	LBB0_13
LBB0_8:
	movq	%r12, %rdi
	movl	%r13d, %esi
	callq	_set_param_l
LBB0_13:
	xorl	%ebx, %ebx
	jmp	LBB0_14
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_RES_MPT,4,2                    ## @RES_MPT
	.comm	_RES_MPT_MAPPED,4,2             ## @RES_MPT_MAPPED
	.no_dead_strip	_mpt_alloc_res
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mpt_alloc_res
_mpt_alloc_res:                         ; @mpt_alloc_res
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	mov	x20, x1
	mov	x19, x0
	str	w4, [sp, #12]
	cmp	w2, #129
	b.eq	LBB0_6
; %bb.1:
	cmp	w2, #128
	b.ne	LBB0_9
; %bb.2:
	mov	x21, x5
Lloh0:
	adrp	x24, _RES_MPT@GOTPAGE
Lloh1:
	ldr	x24, [x24, _RES_MPT@GOTPAGEOFF]
	ldr	w2, [x24]
	mov	x0, x19
	mov	x1, x20
	mov	w3, #1
	mov	w4, #0
	bl	_mlx4_grant_resource
	mov	x22, x0
	cbnz	w0, LBB0_10
; %bb.3:
	mov	x0, x19
	bl	___mlx4_mpt_reserve
	cmn	w0, #1
	b.eq	LBB0_11
; %bb.4:
	mov	x23, x0
	mov	x0, x19
	bl	_mpt_mask
	and	w2, w0, w23
	ldr	w4, [x24]
	mov	x0, x19
	mov	x1, x20
	mov	w3, #1
	mov	x5, x23
	bl	_add_res_range
	mov	x22, x0
	cbz	w0, LBB0_13
; %bb.5:
	ldr	w2, [x24]
	mov	x0, x19
	mov	x1, x20
	mov	w3, #1
	mov	w4, #0
	bl	_mlx4_release_resource
	mov	x0, x19
	mov	x1, x23
	bl	___mlx4_mpt_release
	b	LBB0_10
LBB0_6:
	add	x0, sp, #12
	bl	_get_param_l
	mov	x21, x0
	mov	x0, x19
	bl	_mpt_mask
	and	w21, w0, w21
Lloh2:
	adrp	x8, _RES_MPT_MAPPED@GOTPAGE
Lloh3:
	ldr	x8, [x8, _RES_MPT_MAPPED@GOTPAGEOFF]
Lloh4:
	ldr	w3, [x8]
	mov	x4, sp
	mov	x0, x19
	mov	x1, x20
	mov	x2, x21
	bl	_mr_res_start_move_to
	mov	x22, x0
	cbnz	w0, LBB0_10
; %bb.7:
	ldr	x8, [sp]
	ldr	w1, [x8]
	mov	x0, x19
	bl	___mlx4_mpt_alloc_icm
	mov	x22, x0
Lloh5:
	adrp	x8, _RES_MPT@GOTPAGE
Lloh6:
	ldr	x8, [x8, _RES_MPT@GOTPAGEOFF]
Lloh7:
	ldr	w2, [x8]
	cbz	w0, LBB0_12
; %bb.8:
	mov	x0, x19
	mov	x1, x20
	mov	x3, x21
	bl	_res_abort_move
	b	LBB0_10
LBB0_9:
Lloh8:
	adrp	x8, _EINVAL@GOTPAGE
Lloh9:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_10:
	mov	x0, x22
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
LBB0_11:
	ldr	w2, [x24]
	mov	x0, x19
	mov	x1, x20
	mov	w3, #1
	mov	w4, #0
	bl	_mlx4_release_resource
	mov	w22, #0
	b	LBB0_10
LBB0_12:
	mov	x0, x19
	mov	x1, x20
	mov	x3, x21
	bl	_res_end_move
	b	LBB0_10
LBB0_13:
	mov	x0, x21
	mov	x1, x23
	bl	_set_param_l
	b	LBB0_10
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_RES_MPT,4,2                    ; @RES_MPT
	.comm	_RES_MPT_MAPPED,4,2             ; @RES_MPT_MAPPED
	.no_dead_strip	_mpt_alloc_res
.subsections_via_symbols
