	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function set_kernel_sq_size
_set_kernel_sq_size:                    ## @set_kernel_sq_size
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rcx, %r14
	movl	%edx, %r12d
	movq	(%rdi), %rax
	movl	(%rax), %ecx
	movq	_MLX4_IB_SQ_MAX_SPARE@GOTPCREL(%rip), %rdx
	subl	(%rdx), %ecx
	cmpl	%ecx, (%rsi)
	jg	LBB0_3
## %bb.1:
	movq	%rsi, %r13
	movq	%rdi, %r15
	movl	4(%rsi), %ebx
	movl	4(%rax), %edi
	movl	8(%rax), %esi
	callq	_min
	cmpl	%eax, %ebx
	jg	LBB0_3
## %bb.2:
	movslq	8(%r13), %rbx
	movl	40(%r14), %esi
	movl	%r12d, %edi
	callq	_send_wqe_overhead
	cltq
	leaq	(%rax,%rbx), %rcx
	addq	$4, %rcx
	movq	(%r15), %rax
	movslq	12(%rax), %rdx
	cmpq	%rdx, %rcx
	ja	LBB0_3
## %bb.4:
	movq	_MLX4_IB_QPT_SMI@GOTPCREL(%rip), %rcx
	cmpl	%r12d, (%rcx)
	je	LBB0_8
## %bb.5:
	movq	_MLX4_IB_QPT_GSI@GOTPCREL(%rip), %rcx
	cmpl	%r12d, (%rcx)
	je	LBB0_8
## %bb.6:
	movq	_MLX4_IB_QPT_PROXY_SMI_OWNER@GOTPCREL(%rip), %rcx
	movq	_MLX4_IB_QPT_TUN_SMI_OWNER@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	orl	(%rcx), %edx
	testl	%r12d, %edx
	je	LBB0_7
LBB0_8:
	movl	4(%r13), %edi
	leal	2(%rdi), %ecx
	cmpl	4(%rax), %ecx
	jle	LBB0_9
	jmp	LBB0_3
LBB0_7:
	movl	4(%r13), %edi
LBB0_9:
	shll	$2, %edi
	movl	8(%r13), %esi
	addl	$4, %esi
                                        ## kill: def $edi killed $edi killed $rdi
	callq	_max
	movl	%eax, %ebx
	movl	40(%r14), %esi
	movl	%r12d, %edi
	callq	_send_wqe_overhead
	addl	%ebx, %eax
	movq	(%r15), %rcx
	cmpl	12(%rcx), %eax
	jle	LBB0_10
LBB0_3:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_11:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_10:
	movl	%eax, %edi
	callq	_roundup_pow_of_two
	movl	%eax, %edi
	callq	_ilog2
	movl	%eax, 8(%r14)
	movl	%eax, %edi
	callq	_MLX4_IB_SQ_HEADROOM
	movl	%eax, (%r14)
	addl	(%r13), %eax
	movl	%eax, %edi
	callq	_roundup_pow_of_two
	movl	%eax, 12(%r14)
	movq	(%r15), %rax
	movl	12(%rax), %edi
	movb	8(%r14), %cl
	movl	$1, %esi
	shll	%cl, %esi
	callq	_min
	movl	%eax, %ebx
	movl	40(%r14), %esi
	movl	%r12d, %edi
	callq	_send_wqe_overhead
	subl	%eax, %ebx
	sarl	$2, %ebx
	movl	%ebx, 16(%r14)
	movl	%ebx, %r12d
	movl	28(%r14), %edx
	movl	32(%r14), %eax
	movl	%eax, %ecx
	shll	%cl, %edx
	movl	8(%r14), %ecx
	movl	12(%r14), %esi
	movl	%esi, %edi
	shll	%cl, %edi
	xorl	%ebx, %ebx
	cmpl	%ecx, %eax
	leal	(%rdi,%rdx), %eax
	cmovgl	%ebx, %edi
	movl	%eax, 4(%r14)
	cmovlel	%ebx, %edx
	movl	%edi, 36(%r14)
	movl	%edx, 20(%r14)
	subl	(%r14), %esi
	movl	%esi, 24(%r14)
	movl	%esi, (%r13)
	movq	(%r15), %rax
	movl	4(%rax), %edi
	movl	8(%rax), %esi
	callq	_min
	movl	%r12d, %edi
	movl	%eax, %esi
	callq	_min
	movl	%eax, 4(%r13)
	movl	$0, 8(%r13)
	jmp	LBB0_11
	.cfi_endproc
                                        ## -- End function
	.comm	_MLX4_IB_SQ_MAX_SPARE,4,2       ## @MLX4_IB_SQ_MAX_SPARE
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_MLX4_IB_QPT_SMI,4,2            ## @MLX4_IB_QPT_SMI
	.comm	_MLX4_IB_QPT_GSI,4,2            ## @MLX4_IB_QPT_GSI
	.comm	_MLX4_IB_QPT_PROXY_SMI_OWNER,4,2 ## @MLX4_IB_QPT_PROXY_SMI_OWNER
	.comm	_MLX4_IB_QPT_TUN_SMI_OWNER,4,2  ## @MLX4_IB_QPT_TUN_SMI_OWNER
	.no_dead_strip	_set_kernel_sq_size
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function set_kernel_sq_size
_set_kernel_sq_size:                    ; @set_kernel_sq_size
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	ldr	w9, [x1]
	ldr	x8, [x0]
	ldr	w10, [x8]
Lloh0:
	adrp	x11, _MLX4_IB_SQ_MAX_SPARE@GOTPAGE
Lloh1:
	ldr	x11, [x11, _MLX4_IB_SQ_MAX_SPARE@GOTPAGEOFF]
Lloh2:
	ldr	w11, [x11]
	sub	w10, w10, w11
	cmp	w9, w10
	b.gt	LBB0_8
; %bb.1:
	mov	x20, x3
	mov	x22, x2
	mov	x19, x1
	mov	x21, x0
	ldr	w23, [x1, #4]
	ldp	w0, w1, [x8, #4]
	bl	_min
	cmp	w23, w0
	b.gt	LBB0_8
; %bb.2:
	ldrsw	x23, [x19, #8]
	ldr	w1, [x20, #40]
	mov	x0, x22
	bl	_send_wqe_overhead
	add	x8, x23, w0, sxtw
	add	x9, x8, #4
	ldr	x8, [x21]
	ldrsw	x10, [x8, #12]
	cmp	x9, x10
	b.hi	LBB0_8
; %bb.3:
Lloh3:
	adrp	x9, _MLX4_IB_QPT_SMI@GOTPAGE
Lloh4:
	ldr	x9, [x9, _MLX4_IB_QPT_SMI@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
Lloh6:
	adrp	x10, _MLX4_IB_QPT_GSI@GOTPAGE
Lloh7:
	ldr	x10, [x10, _MLX4_IB_QPT_GSI@GOTPAGEOFF]
Lloh8:
	ldr	w10, [x10]
	cmp	w9, w22
	ccmp	w10, w22, #4, ne
	b.eq	LBB0_5
; %bb.4:
Lloh9:
	adrp	x9, _MLX4_IB_QPT_PROXY_SMI_OWNER@GOTPAGE
Lloh10:
	ldr	x9, [x9, _MLX4_IB_QPT_PROXY_SMI_OWNER@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
Lloh12:
	adrp	x10, _MLX4_IB_QPT_TUN_SMI_OWNER@GOTPAGE
Lloh13:
	ldr	x10, [x10, _MLX4_IB_QPT_TUN_SMI_OWNER@GOTPAGEOFF]
Lloh14:
	ldr	w10, [x10]
	orr	w9, w10, w9
	tst	w9, w22
	b.eq	LBB0_6
LBB0_5:
	ldr	w9, [x19, #4]
	add	w10, w9, #2
	ldr	w8, [x8, #4]
	cmp	w10, w8
	b.le	LBB0_7
	b	LBB0_8
LBB0_6:
	ldr	w9, [x19, #4]
LBB0_7:
	lsl	w0, w9, #2
	ldr	w8, [x19, #8]
	add	w1, w8, #4
	bl	_max
	mov	x23, x0
	ldr	w1, [x20, #40]
	mov	x0, x22
	bl	_send_wqe_overhead
	ldr	x8, [x21]
	ldr	w8, [x8, #12]
	add	w0, w0, w23
	cmp	w0, w8
	b.le	LBB0_10
LBB0_8:
Lloh15:
	adrp	x8, _EINVAL@GOTPAGE
Lloh16:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_9:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_10:
	bl	_roundup_pow_of_two
	bl	_ilog2
	str	w0, [x20, #8]
	bl	_MLX4_IB_SQ_HEADROOM
	str	w0, [x20]
	ldr	w8, [x19]
	add	w0, w8, w0
	bl	_roundup_pow_of_two
	str	w0, [x20, #12]
	ldr	x8, [x21]
	ldr	w0, [x8, #12]
	ldr	w8, [x20, #8]
	mov	w9, #1
	lsl	w1, w9, w8
	bl	_min
	mov	x23, x0
	ldr	w1, [x20, #40]
	mov	x0, x22
	bl	_send_wqe_overhead
	sub	w8, w23, w0
	asr	w22, w8, #2
	ldp	w8, w9, [x20, #28]
	lsl	w8, w8, w9
	ldp	w11, w10, [x20, #8]
	lsl	w12, w10, w11
	add	w13, w12, w8
	str	w13, [x20, #4]
	cmp	w9, w11
	csel	w9, wzr, w12, gt
	csel	w8, w8, wzr, gt
	str	w9, [x20, #36]
	stp	w22, w8, [x20, #16]
	ldr	w8, [x20]
	sub	w8, w10, w8
	str	w8, [x20, #24]
	str	w8, [x19]
	ldr	x8, [x21]
	ldp	w0, w1, [x8, #4]
	bl	_min
	mov	x1, x0
	mov	x0, x22
	bl	_min
	mov	x8, x0
	mov	w0, #0
	stp	w8, wzr, [x19, #4]
	b	LBB0_9
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_MLX4_IB_SQ_MAX_SPARE,4,2       ; @MLX4_IB_SQ_MAX_SPARE
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_MLX4_IB_QPT_SMI,4,2            ; @MLX4_IB_QPT_SMI
	.comm	_MLX4_IB_QPT_GSI,4,2            ; @MLX4_IB_QPT_GSI
	.comm	_MLX4_IB_QPT_PROXY_SMI_OWNER,4,2 ; @MLX4_IB_QPT_PROXY_SMI_OWNER
	.comm	_MLX4_IB_QPT_TUN_SMI_OWNER,4,2  ; @MLX4_IB_QPT_TUN_SMI_OWNER
	.no_dead_strip	_set_kernel_sq_size
.subsections_via_symbols
