	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function calc_total_bfregs
_calc_total_bfregs:                     ## @calc_total_bfregs
	.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	(%rdx), %eax
	testl	%eax, %eax
	je	LBB0_1
## %bb.3:
	movq	%rdx, %rbx
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movl	%esi, %r12d
	movq	%rcx, -64(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r15
	movq	_MLX5_MAX_BFREGS@GOTPCREL(%rip), %r14
	movl	(%r14), %eax
	movq	_MLX5_NON_FP_BFREGS_IN_PAGE@GOTPCREL(%rip), %r13
	cltd
	idivl	(%r13)
	movl	%edx, %edi
	callq	_BUILD_BUG_ON
	movl	(%r14), %eax
	xorl	%edi, %edi
	cmpl	(%r13), %eax
	setl	%dil
	callq	_BUILD_BUG_ON
	movl	(%rbx), %eax
	cmpl	(%r14), %eax
	jle	LBB0_5
## %bb.4:
	movq	_ENOMEM@GOTPCREL(%rip), %rcx
	jmp	LBB0_2
LBB0_5:
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	movq	%r15, %rdi
	movl	%r12d, %esi
	callq	_get_uars_per_sys_page
	movl	%eax, %r14d
	movq	_MLX5_NON_FP_BFREGS_PER_UAR@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	imull	%r14d, %r13d
	movl	(%rbx), %edi
	movl	%r13d, %esi
	callq	_ALIGN
	movl	%eax, (%rbx)
	leal	-1(%rax), %ecx
	movslq	%ecx, %rcx
	cmpq	%rcx, 8(%rbx)
	jle	LBB0_6
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
LBB0_2:
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_7:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
                                        ## kill: def $eax killed $eax killed $rax
	cltd
	idivl	%r13d
	movq	-64(%rbp), %r15                 ## 8-byte Reload
	movl	%eax, (%r15)
	movl	%r14d, %edi
	callq	_calc_dynamic_bfregs
	movl	%eax, %edi
	movl	%r13d, %esi
	callq	_ALIGN
	movl	%eax, 4(%r15)
	addl	(%rbx), %eax
	movl	%eax, 8(%r15)
                                        ## kill: def $eax killed $eax killed $rax
	cltd
	idivl	%r13d
	movl	%eax, 12(%r15)
	movq	-56(%rbp), %r14                 ## 8-byte Reload
	movl	(%r14), %edi
	movq	_uar_4k@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_MLX5_CAP_GEN
	testq	%rax, %rax
	leaq	L_.str.2(%rip), %rax
	leaq	L_.str.1(%rip), %rcx
	movq	%rcx, %rdx
	cmoveq	%rax, %rdx
	testl	%r12d, %r12d
	cmoveq	%rax, %rcx
	movl	(%rbx), %r9d
	movl	8(%r15), %eax
	movl	12(%r15), %ebx
	leaq	L_.str(%rip), %rsi
	movq	%r14, %rdi
	movl	-44(%rbp), %r8d                 ## 4-byte Reload
	pushq	%rbx
	pushq	%rax
	callq	_mlx5_ib_dbg
	addq	$16, %rsp
	xorl	%eax, %eax
	jmp	LBB0_7
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_MLX5_MAX_BFREGS,4,2            ## @MLX5_MAX_BFREGS
	.comm	_MLX5_NON_FP_BFREGS_IN_PAGE,4,2 ## @MLX5_NON_FP_BFREGS_IN_PAGE
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_MLX5_NON_FP_BFREGS_PER_UAR,4,2 ## @MLX5_NON_FP_BFREGS_PER_UAR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"uar_4k: fw support %s, lib support %s, user requested %d bfregs, allocated %d, total bfregs %d, using %d sys pages\n"

	.comm	_uar_4k,4,2                     ## @uar_4k
L_.str.1:                               ## @.str.1
	.asciz	"yes"

L_.str.2:                               ## @.str.2
	.asciz	"no"

	.no_dead_strip	_calc_total_bfregs
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function calc_total_bfregs
_calc_total_bfregs:                     ; @calc_total_bfregs
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	ldr	w19, [x2]
	cbz	w19, LBB0_4
; %bb.1:
	mov	x21, x3
	mov	x22, x2
	mov	x23, x1
	mov	x20, x0
Lloh0:
	adrp	x24, _MLX5_MAX_BFREGS@GOTPAGE
Lloh1:
	ldr	x24, [x24, _MLX5_MAX_BFREGS@GOTPAGEOFF]
	ldr	w8, [x24]
Lloh2:
	adrp	x25, _MLX5_NON_FP_BFREGS_IN_PAGE@GOTPAGE
Lloh3:
	ldr	x25, [x25, _MLX5_NON_FP_BFREGS_IN_PAGE@GOTPAGEOFF]
	ldr	w9, [x25]
	sdiv	w10, w8, w9
	msub	w0, w10, w9, w8
	bl	_BUILD_BUG_ON
	ldr	w8, [x24]
	ldr	w9, [x25]
	cmp	w8, w9
	cset	w0, lt
	bl	_BUILD_BUG_ON
	ldr	w8, [x22]
	ldr	w9, [x24]
	cmp	w8, w9
	b.le	LBB0_3
; %bb.2:
Lloh4:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh5:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_5
LBB0_3:
	mov	x0, x20
	mov	x1, x23
	bl	_get_uars_per_sys_page
	mov	x25, x0
Lloh6:
	adrp	x8, _MLX5_NON_FP_BFREGS_PER_UAR@GOTPAGE
Lloh7:
	ldr	x8, [x8, _MLX5_NON_FP_BFREGS_PER_UAR@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	mul	w24, w8, w0
	ldr	w0, [x22]
	mov	x1, x24
	bl	_ALIGN
	str	w0, [x22]
	ldr	x8, [x22, #8]
	sub	w9, w0, #1
	cmp	x8, w9, sxtw
	b.le	LBB0_7
LBB0_4:
Lloh9:
	adrp	x8, _EINVAL@GOTPAGE
Lloh10:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_5:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_6:
	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
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_7:
	sdiv	w8, w0, w24
	str	w8, [x21]
	mov	x0, x25
	bl	_calc_dynamic_bfregs
	mov	x1, x24
	bl	_ALIGN
	ldr	w8, [x22]
	add	w8, w8, w0
	stp	w0, w8, [x21, #4]
	sdiv	w8, w8, w24
	str	w8, [x21, #12]
	ldr	w0, [x20]
Lloh11:
	adrp	x8, _uar_4k@GOTPAGE
Lloh12:
	ldr	x8, [x8, _uar_4k@GOTPAGEOFF]
Lloh13:
	ldr	w1, [x8]
	bl	_MLX5_CAP_GEN
Lloh14:
	adrp	x8, l_.str.1@PAGE
Lloh15:
	add	x8, x8, l_.str.1@PAGEOFF
Lloh16:
	adrp	x9, l_.str.2@PAGE
Lloh17:
	add	x9, x9, l_.str.2@PAGEOFF
	cmp	x0, #0
	csel	x2, x9, x8, eq
	cmp	w23, #0
	csel	x3, x9, x8, eq
	ldr	w5, [x22]
	ldp	w6, w7, [x21, #8]
Lloh18:
	adrp	x1, l_.str@PAGE
Lloh19:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x20
	mov	x4, x19
	bl	_mlx5_ib_dbg
	mov	w0, #0
	b	LBB0_6
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_MLX5_MAX_BFREGS,4,2            ; @MLX5_MAX_BFREGS
	.comm	_MLX5_NON_FP_BFREGS_IN_PAGE,4,2 ; @MLX5_NON_FP_BFREGS_IN_PAGE
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_MLX5_NON_FP_BFREGS_PER_UAR,4,2 ; @MLX5_NON_FP_BFREGS_PER_UAR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"uar_4k: fw support %s, lib support %s, user requested %d bfregs, allocated %d, total bfregs %d, using %d sys pages\n"

	.comm	_uar_4k,4,2                     ; @uar_4k
l_.str.1:                               ; @.str.1
	.asciz	"yes"

l_.str.2:                               ; @.str.2
	.asciz	"no"

	.no_dead_strip	_calc_total_bfregs
.subsections_via_symbols
