	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtt_alloc_res
_mtt_alloc_res:                         ## @mtt_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	%r8d, -48(%rbp)
	movq	_RES_OP_RESERVE_AND_MAP@GOTPCREL(%rip), %rax
	cmpl	%edx, (%rax)
	jne	LBB0_5
## %bb.1:
	movl	%esi, %r14d
	movq	%rdi, %r13
	movq	%r9, -56(%rbp)                  ## 8-byte Spill
	leaq	-48(%rbp), %rdi
	callq	_get_param_l
	movl	%eax, %r12d
	movq	_RES_MTT@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	$1, %ebx
	movl	%r12d, %ecx
	shll	%cl, %ebx
	movq	%r13, %rdi
	movl	%r14d, %esi
	movl	%ebx, %ecx
	xorl	%r8d, %r8d
	callq	_mlx4_grant_resource
	movl	%eax, %r15d
	testl	%eax, %eax
	jne	LBB0_7
## %bb.2:
	movq	%r13, %rdi
	movl	%r12d, %esi
	callq	___mlx4_alloc_mtt_range
	movq	_RES_MTT@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r8d
	cmpl	$-1, %eax
	je	LBB0_8
## %bb.3:
	movq	%r13, %rdi
	movl	%r14d, %esi
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movl	%eax, %edx
	movl	$1, %ecx
	movl	%r12d, %r9d
	callq	_add_res_range
	testl	%eax, %eax
	je	LBB0_9
## %bb.4:
	movl	%eax, %r15d
	movq	_RES_MTT@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r13, %rdi
	movl	%r14d, %esi
	movl	%ebx, %ecx
	xorl	%r8d, %r8d
	callq	_mlx4_release_resource
	movq	%r13, %rdi
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	movl	%r12d, %edx
	callq	___mlx4_free_mtt_range
	jmp	LBB0_7
LBB0_5:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
LBB0_6:
	subl	(%rax), %r15d
LBB0_7:
	movl	%r15d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	xorl	%r15d, %r15d
	movq	%r13, %rdi
	movl	%r14d, %esi
	movl	%r8d, %edx
	movl	%ebx, %ecx
	xorl	%r8d, %r8d
	callq	_mlx4_release_resource
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_6
LBB0_9:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	callq	_set_param_l
	xorl	%r15d, %r15d
	jmp	LBB0_7
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_RES_OP_RESERVE_AND_MAP,4,2     ## @RES_OP_RESERVE_AND_MAP
	.comm	_RES_MTT,4,2                    ## @RES_MTT
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.no_dead_strip	_mtt_alloc_res
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mtt_alloc_res
_mtt_alloc_res:                         ; @mtt_alloc_res
	.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
	str	w4, [sp, #12]
Lloh0:
	adrp	x8, _RES_OP_RESERVE_AND_MAP@GOTPAGE
Lloh1:
	ldr	x8, [x8, _RES_OP_RESERVE_AND_MAP@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w2
	b.ne	LBB0_5
; %bb.1:
	mov	x21, x5
	mov	x20, x1
	mov	x19, x0
	add	x0, sp, #12
	bl	_get_param_l
	mov	x22, x0
Lloh3:
	adrp	x26, _RES_MTT@GOTPAGE
Lloh4:
	ldr	x26, [x26, _RES_MTT@GOTPAGEOFF]
	ldr	w2, [x26]
	mov	w8, #1
	lsl	w23, w8, w0
	mov	x0, x19
	mov	x1, x20
	mov	x3, x23
	mov	w4, #0
	bl	_mlx4_grant_resource
	mov	x24, x0
	cbnz	w0, LBB0_7
; %bb.2:
	mov	x0, x19
	mov	x1, x22
	bl	___mlx4_alloc_mtt_range
	ldr	w4, [x26]
	cmn	w0, #1
	b.eq	LBB0_8
; %bb.3:
	mov	x25, x0
	mov	x0, x19
	mov	x1, x20
	mov	x2, x25
	mov	w3, #1
	mov	x5, x22
	bl	_add_res_range
	mov	x24, x0
	cbz	w0, LBB0_9
; %bb.4:
	ldr	w2, [x26]
	mov	x0, x19
	mov	x1, x20
	mov	x3, x23
	mov	w4, #0
	bl	_mlx4_release_resource
	mov	x0, x19
	mov	x1, x25
	mov	x2, x22
	bl	___mlx4_free_mtt_range
	b	LBB0_7
LBB0_5:
Lloh5:
	adrp	x8, _EINVAL@GOTPAGE
Lloh6:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_6:
	ldr	w8, [x8]
	neg	w24, w8
LBB0_7:
	mov	x0, x24
	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_8:
	mov	x0, x19
	mov	x1, x20
	mov	x2, x4
	mov	x3, x23
	mov	w4, #0
	bl	_mlx4_release_resource
Lloh7:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh8:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_6
LBB0_9:
	mov	x0, x21
	mov	x1, x25
	bl	_set_param_l
	b	LBB0_7
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_RES_OP_RESERVE_AND_MAP,4,2     ; @RES_OP_RESERVE_AND_MAP
	.comm	_RES_MTT,4,2                    ; @RES_MTT
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.no_dead_strip	_mtt_alloc_res
.subsections_via_symbols
