	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mlx4_grant_resource
_mlx4_grant_resource:                   ## @mlx4_grant_resource
	.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	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%r8d, %r15d
                                        ## kill: def $ecx killed $ecx def $rcx
	movq	%rcx, -80(%rbp)                 ## 8-byte Spill
	movl	%edx, %r12d
	movl	%esi, %r13d
	movq	%rdi, %rbx
	callq	_mlx4_priv
	movq	(%rbx), %rcx
	cmpl	%r13d, (%rcx)
	jge	LBB0_2
## %bb.1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
	jmp	LBB0_15
LBB0_2:
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
	movq	(%rax), %r14
	movl	%r12d, -56(%rbp)                ## 4-byte Spill
	movl	%r12d, %r12d
	movq	_EDQUOT@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	shlq	$6, %r12
	leaq	(%r14,%r12), %rdi
	addq	$56, %rdi
	movq	%rdi, -104(%rbp)                ## 8-byte Spill
	callq	_spin_lock
	movq	(%r14,%r12), %rcx
	testl	%r15d, %r15d
	movq	%r15, -72(%rbp)                 ## 8-byte Spill
	movl	%r13d, -44(%rbp)                ## 4-byte Spill
	jle	LBB0_4
## %bb.3:
	leal	-1(%r15), %eax
	movq	-64(%rbp), %rdx                 ## 8-byte Reload
	movq	(%rdx), %rdx
	movl	(%rdx), %edx
	incl	%edx
	imull	%eax, %edx
	addl	%r13d, %edx
	movslq	%edx, %rsi
	shlq	$2, %rax
	movq	8(%r14,%r12), %rdi
	addq	%rax, %rdi
	addq	24(%r14,%r12), %rax
	movslq	%r13d, %r8
	jmp	LBB0_5
LBB0_4:
	movslq	%r13d, %r8
	leaq	(%r14,%r12), %rdi
	addq	$16, %rdi
	leaq	(%r14,%r12), %rax
	addq	$32, %rax
	movq	%r8, %rsi
LBB0_5:
	movq	-80(%rbp), %rdx                 ## 8-byte Reload
	movl	%ebx, %r13d
	movl	%ebx, %r15d
	negl	%r15d
	movl	(%rcx,%rsi,4), %ebx
	movq	48(%r14,%r12), %rcx
	leal	(%rbx,%rdx), %esi
	cmpl	(%rcx,%r8,4), %esi
	jle	LBB0_7
## %bb.6:
	addq	%r12, %r14
	addq	$48, %r14
	movl	-56(%rbp), %edi                 ## 4-byte Reload
	movq	%rdx, %r12
	movq	%r8, %r13
	callq	_resource_str
	movq	(%r14), %rcx
	movl	(%rcx,%r13,4), %r10d
	leaq	L_.str(%rip), %rsi
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
                                        ## kill: def $ecx killed $ecx killed $rcx
	movl	%eax, %r8d
	movl	%r12d, %r9d
	pushq	%r10
	pushq	%rbx
	callq	_mlx4_warn
	addq	$16, %rsp
	jmp	LBB0_14
LBB0_7:
	movq	40(%r14,%r12), %rcx
	movl	(%rcx,%r8,4), %ecx
	movl	%edx, %r9d
	cmpl	%ecx, %esi
	jle	LBB0_10
## %bb.8:
	movl	(%rdi), %esi
	subl	%ebx, %ecx
	xorl	%r9d, %r9d
	testl	%ecx, %ecx
	cmovgl	%ecx, %r9d
	movl	(%rax), %ecx
	movl	%edx, %ebx
	subl	%r9d, %ebx
	movl	%esi, %eax
	subl	%ebx, %eax
	cmpl	%ecx, %eax
	jge	LBB0_10
## %bb.9:
	movl	-56(%rbp), %edi                 ## 4-byte Reload
	movq	%r8, -56(%rbp)                  ## 8-byte Spill
	movl	%r9d, -88(%rbp)                 ## 4-byte Spill
	movl	%esi, -84(%rbp)                 ## 4-byte Spill
	movq	%rcx, -96(%rbp)                 ## 8-byte Spill
	callq	_resource_str
	leaq	L_.str.1(%rip), %rsi
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
                                        ## kill: def $ecx killed $ecx killed $rcx
	movl	%eax, %r8d
	movl	-84(%rbp), %r9d                 ## 4-byte Reload
	pushq	-96(%rbp)                       ## 8-byte Folded Reload
	pushq	%rbx
	callq	_mlx4_warn
	movl	-88(%rbp), %r9d                 ## 4-byte Reload
	movq	-56(%rbp), %r8                  ## 8-byte Reload
	movq	-80(%rbp), %rdx                 ## 8-byte Reload
	addq	$16, %rsp
	testl	%r13d, %r13d
	jne	LBB0_14
LBB0_10:
	leaq	(%r14,%r12), %rax
	movq	(%rax), %rax
	movq	-72(%rbp), %rsi                 ## 8-byte Reload
	testl	%esi, %esi
	jle	LBB0_12
## %bb.11:
	decl	%esi
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	movq	(%rcx), %rcx
	movl	(%rcx), %ecx
	incl	%ecx
	imull	%esi, %ecx
	addl	-44(%rbp), %ecx                 ## 4-byte Folded Reload
	movslq	%ecx, %rcx
	addl	%edx, (%rax,%rcx,4)
	movq	8(%r14,%r12), %rax
	subl	%edx, (%rax,%rsi,4)
	movq	24(%r14,%r12), %rax
	subl	%r9d, (%rax,%rsi,4)
	jmp	LBB0_13
LBB0_12:
	addl	%edx, (%rax,%r8,4)
	subl	%edx, 16(%r14,%r12)
	subl	%r9d, 32(%r14,%r12)
LBB0_13:
	xorl	%r15d, %r15d
LBB0_14:
	movq	-104(%rbp), %rdi                ## 8-byte Reload
	callq	_spin_unlock
LBB0_15:
	movl	%r15d, %eax
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EDQUOT,4,2                     ## @EDQUOT
	.comm	_EINVAL,4,2                     ## @EINVAL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"VF %d port %d res %s: quota exceeded, count %d alloc %d quota %d\n"

L_.str.1:                               ## @.str.1
	.asciz	"VF %d port %d res %s: free pool empty, free %d from_free %d rsvd %d\n"

	.no_dead_strip	_mlx4_grant_resource
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mlx4_grant_resource
_mlx4_grant_resource:                   ; @mlx4_grant_resource
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x28, x27, [sp, #48]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #64]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #80]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #96]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #112]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #128]            ; 16-byte Folded Spill
	add	x29, sp, #128
	.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	x23, x4
	mov	x21, x3
	mov	x25, x2
	mov	x22, x1
	mov	x24, x0
	bl	_mlx4_priv
	ldr	x8, [x24]
	ldr	w8, [x8]
	cmp	w8, w22
	b.ge	LBB0_2
; %bb.1:
Lloh0:
	adrp	x8, _EINVAL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_14
LBB0_2:
	ldr	x27, [x0]
	mov	w9, w25
Lloh3:
	adrp	x8, _EDQUOT@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EDQUOT@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	str	w8, [sp, #12]                   ; 4-byte Folded Spill
	neg	w20, w8
	add	x19, x27, x9, lsl #6
	add	x0, x19, #56
	stp	x0, x9, [sp, #32]               ; 16-byte Folded Spill
	bl	_spin_lock
	ldr	x8, [x19]
	subs	w9, w23, #1
	str	w20, [sp, #28]                  ; 4-byte Folded Spill
	b.lt	LBB0_4
; %bb.3:
	ldr	x10, [x24]
	ldr	w10, [x10]
	madd	w10, w9, w10, w9
	add	w10, w10, w22
	sxtw	x11, w10
	ldr	x10, [x19, #8]
	lsl	x12, x9, #2
	add	x9, x10, x12
	ldr	x10, [x19, #24]
	add	x10, x10, x12
	sxtw	x28, w22
	b	LBB0_5
LBB0_4:
	mov	x9, x22
	sxtw	x28, w9
	add	x9, x19, #16
	add	x10, x19, #32
	mov	x11, x28
LBB0_5:
	ldr	w26, [x8, x11, lsl #2]
	str	x27, [sp, #16]                  ; 8-byte Folded Spill
	ldr	x12, [sp, #40]                  ; 8-byte Folded Reload
	add	x20, x27, x12, lsl #6
	ldr	x8, [x20, #48]!
	lsl	x27, x28, #2
	ldr	w8, [x8, x27]
	add	w11, w26, w21
	cmp	w11, w8
	b.le	LBB0_7
; %bb.6:
	mov	x0, x25
	bl	_resource_str
	mov	x4, x0
	ldr	x8, [x20]
	ldr	w7, [x8, x28, lsl #2]
Lloh6:
	adrp	x1, l_.str@PAGE
Lloh7:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x24
	mov	x2, x22
	mov	x3, x23
	mov	x5, x21
	mov	x6, x26
	bl	_mlx4_warn
	ldr	w20, [sp, #28]                  ; 4-byte Folded Reload
	b	LBB0_13
LBB0_7:
	ldur	x8, [x20, #-8]
	ldr	w8, [x8, x27]
	mov	x28, x21
	cmp	w11, w8
	ldr	w20, [sp, #28]                  ; 4-byte Folded Reload
	b.le	LBB0_10
; %bb.8:
	ldr	w11, [x9]
	ldr	w9, [x10]
	sub	w8, w8, w26
	cmp	w8, #0
	csel	w28, w8, wzr, gt
	sub	w26, w21, w28
	sub	w8, w11, w26
	cmp	w8, w9
	b.ge	LBB0_10
; %bb.9:
	mov	x0, x25
	str	w9, [sp, #8]                    ; 4-byte Folded Spill
	mov	x25, x11
	bl	_resource_str
	mov	x4, x0
Lloh8:
	adrp	x1, l_.str.1@PAGE
Lloh9:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x24
	mov	x2, x22
	mov	x3, x23
	mov	x5, x25
	mov	x6, x26
	ldr	w7, [sp, #8]                    ; 4-byte Folded Reload
	bl	_mlx4_warn
	ldr	x12, [sp, #40]                  ; 8-byte Folded Reload
	ldr	w8, [sp, #12]                   ; 4-byte Folded Reload
	cbnz	w8, LBB0_13
LBB0_10:
	ldr	x8, [x19]
	mov	w20, #0
	subs	w9, w23, #1
	b.lt	LBB0_12
; %bb.11:
	ldr	x10, [x24]
	ldr	w10, [x10]
	madd	w10, w9, w10, w9
	add	w10, w10, w22
	sbfiz	x10, x10, #2, #32
	ldr	w11, [x8, x10]
	add	w11, w11, w21
	str	w11, [x8, x10]
	ldr	x8, [sp, #16]                   ; 8-byte Folded Reload
	add	x8, x8, x12, lsl #6
	ldr	x10, [x8, #8]
	lsl	x9, x9, #2
	ldr	w11, [x10, x9]
	sub	w11, w11, w21
	str	w11, [x10, x9]
	ldr	x8, [x8, #24]
	ldr	w10, [x8, x9]
	sub	w10, w10, w28
	str	w10, [x8, x9]
	b	LBB0_13
LBB0_12:
	ldr	w9, [x8, x27]
	add	w9, w9, w21
	str	w9, [x8, x27]
	ldr	x8, [sp, #16]                   ; 8-byte Folded Reload
	add	x8, x8, x12, lsl #6
	ldr	w9, [x8, #16]
	sub	w9, w9, w21
	str	w9, [x8, #16]
	ldr	w9, [x8, #32]
	sub	w9, w9, w28
	str	w9, [x8, #32]
LBB0_13:
	ldr	x0, [sp, #32]                   ; 8-byte Folded Reload
	bl	_spin_unlock
LBB0_14:
	mov	x0, x20
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #64]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #144
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.comm	_EDQUOT,4,2                     ; @EDQUOT
	.comm	_EINVAL,4,2                     ; @EINVAL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"VF %d port %d res %s: quota exceeded, count %d alloc %d quota %d\n"

l_.str.1:                               ; @.str.1
	.asciz	"VF %d port %d res %s: free pool empty, free %d from_free %d rsvd %d\n"

	.no_dead_strip	_mlx4_grant_resource
.subsections_via_symbols
