	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mlx4_alloc_qp_buf              ## -- Begin function mlx4_alloc_qp_buf
	.p2align	4, 0x90
_mlx4_alloc_qp_buf:                     ## @mlx4_alloc_qp_buf
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rcx, %r12
	movq	%rdi, %r14
	movl	(%rsi), %eax
	movl	%eax, 16(%rcx)
	movl	40(%rcx), %edi
	testl	%edi, %edi
	je	LBB0_3
## %bb.1:
	shll	$2, %edi
	callq	_malloc
	movq	%rax, 56(%r12)
	testq	%rax, %rax
	je	LBB0_2
LBB0_3:
	movl	20(%r12), %edi
	testl	%edi, %edi
	je	LBB0_7
## %bb.4:
	shll	$2, %edi
	callq	_malloc
	movq	%rax, 32(%r12)
	testq	%rax, %rax
	je	LBB0_5
LBB0_7:
	movslq	16(%r12), %rdx
	shlq	$2, %rdx
	movl	$3, %eax
	.p2align	4, 0x90
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	incl	%eax
	movl	$1, %esi
	movl	%eax, %ecx
	shll	%cl, %esi
	movslq	%esi, %rcx
	cmpq	%rcx, %rdx
	ja	LBB0_8
## %bb.9:
	movl	%eax, 24(%r12)
	movl	20(%r12), %edx
	movl	40(%r12), %ebx
	movl	%eax, %ecx
	shll	%cl, %edx
	movl	44(%r12), %ecx
	shll	%cl, %ebx
	xorl	%r15d, %r15d
	cmpl	%ecx, %eax
	movl	%ebx, %eax
	cmovgl	%r15d, %eax
	movl	$0, %ecx
	cmovgl	%edx, %ecx
	addl	%edx, %ebx
	movl	%ebx, (%r12)
	movl	%eax, 28(%r12)
	movl	%ecx, 48(%r12)
	je	LBB0_13
## %bb.10:
	leaq	8(%r12), %r15
	movl	(%r14), %edi
	callq	_to_mdev
	movl	(%rax), %esi
	movl	%ebx, %edi
	callq	_align
	movl	%eax, %ebx
	movl	(%r14), %edi
	callq	_to_mdev
	movl	(%rax), %edx
	movq	%r15, %rdi
	movl	%ebx, %esi
	callq	_mlx4_alloc_buf
	testq	%rax, %rax
	je	LBB0_12
## %bb.11:
	movq	56(%r12), %rdi
	callq	_free
	movq	32(%r12), %rdi
	jmp	LBB0_6
LBB0_2:
	movl	$-1, %r15d
	jmp	LBB0_14
LBB0_13:
	movq	$0, 8(%r12)
	jmp	LBB0_14
LBB0_5:
	movq	56(%r12), %rdi
LBB0_6:
	callq	_free
	movl	$-1, %r15d
	jmp	LBB0_14
LBB0_12:
	movq	8(%r12), %rdi
	movl	(%r12), %edx
	xorl	%r15d, %r15d
	xorl	%esi, %esi
	callq	_memset
LBB0_14:
	movl	%r15d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mlx4_alloc_qp_buf              ; -- Begin function mlx4_alloc_qp_buf
	.p2align	2
_mlx4_alloc_qp_buf:                     ; @mlx4_alloc_qp_buf
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x19, x3
	mov	x20, x0
	ldr	w8, [x1]
	str	w8, [x3, #16]
	ldr	w8, [x3, #40]
	cbz	w8, LBB0_2
; %bb.1:
	lsl	w0, w8, #2
	bl	_malloc
	str	x0, [x19, #56]
	cbz	x0, LBB0_9
LBB0_2:
	ldr	w8, [x19, #20]
	cbz	w8, LBB0_4
; %bb.3:
	lsl	w0, w8, #2
	bl	_malloc
	str	x0, [x19, #32]
	cbz	x0, LBB0_11
LBB0_4:
	ldrsw	x8, [x19, #16]
	lsl	x9, x8, #2
	mov	w8, #3
	mov	w10, #1
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	add	w8, w8, #1
	lsl	w11, w10, w8
	cmp	x9, w11, sxtw
	b.hi	LBB0_5
; %bb.6:
	ldr	w9, [x19, #20]
	lsl	w9, w9, w8
	ldp	w10, w11, [x19, #40]
	lsl	w10, w10, w11
	cmp	w8, w11
	csel	w11, wzr, w10, gt
	csel	w12, w9, wzr, gt
	stp	w8, w11, [x19, #24]
	str	w12, [x19, #48]
	add	w21, w10, w9
	str	w21, [x19]
	cbz	w21, LBB0_10
; %bb.7:
	add	x22, x19, #8
	ldr	w0, [x20]
	bl	_to_mdev
	ldr	w1, [x0]
	mov	x0, x21
	bl	_align
	mov	x21, x0
	ldr	w0, [x20]
	bl	_to_mdev
	ldr	w2, [x0]
	mov	x0, x22
	mov	x1, x21
	bl	_mlx4_alloc_buf
	cbz	x0, LBB0_13
; %bb.8:
	ldr	x0, [x19, #56]
	bl	_free
	ldr	x0, [x19, #32]
	b	LBB0_12
LBB0_9:
	mov	w0, #-1
	b	LBB0_14
LBB0_10:
	mov	w0, #0
	str	xzr, [x19, #8]
	b	LBB0_14
LBB0_11:
	ldr	x0, [x19, #56]
LBB0_12:
	bl	_free
	mov	w0, #-1
	b	LBB0_14
LBB0_13:
	ldr	x0, [x19, #8]
	ldr	w2, [x19]
	mov	w1, #0
	bl	_memset
	mov	w0, #0
LBB0_14:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.cfi_endproc
                                        ; -- End function
.subsections_via_symbols
