	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mthca_alloc_srq_buf
_mthca_alloc_srq_buf:                   ## @mthca_alloc_srq_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	%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
	xorl	%eax, %eax
	testq	%rcx, %rcx
	je	LBB0_1
LBB0_14:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_1:
	movq	%rdx, %r12
	movq	%rsi, %r15
	movq	%rdi, %rbx
	movl	(%rdx), %edi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	$4, %esi
	callq	_kmalloc_array
	movl	%eax, 16(%r12)
	testl	%eax, %eax
	je	LBB0_2
## %bb.3:
	movl	(%r12), %esi
	movb	4(%r12), %cl
	shll	%cl, %esi
	movq	_MTHCA_MAX_DIRECT_SRQ_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	leaq	28(%r12), %rcx
	leaq	24(%r12), %r8
	leaq	20(%r12), %rax
	movq	%rbx, %rdi
	movq	%r15, %r9
	pushq	%rax
	pushq	$1
	callq	_mthca_buf_alloc
	addq	$16, %rsp
	testl	%eax, %eax
	je	LBB0_4
## %bb.15:
	movl	%eax, %ebx
	movl	16(%r12), %edi
	callq	_kfree
	movl	%ebx, %eax
	jmp	LBB0_14
LBB0_2:
	movq	_ENOMEM@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_14
LBB0_4:
	movl	(%r12), %esi
	testl	%esi, %esi
	jle	LBB0_13
## %bb.5:
	xorl	%r15d, %r15d
	movq	_MTHCA_INVAL_LKEY@GOTPCREL(%rip), %r13
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_12:                                ##   in Loop: Header=BB0_6 Depth=1
	incl	%r15d
	movl	(%r12), %esi
	cmpl	%esi, %r15d
	jge	LBB0_13
LBB0_6:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_11 Depth 2
	movq	%r12, %rdi
	movl	%r15d, %esi
	callq	_get_wqe
	movq	%rax, %r14
	movl	(%r12), %eax
	decl	%eax
	cmpl	%eax, %r15d
	jge	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	movq	%r13, %rbx
	leal	1(%r15), %r13d
	movq	%r14, %rdi
	callq	_wqe_to_link
	movl	%r13d, (%rax)
	movb	4(%r12), %cl
	shll	%cl, %r13d
	orl	$1, %r13d
	movl	%r13d, %edi
	movq	%rbx, %r13
	callq	_htonl
	jmp	LBB0_9
	.p2align	4, 0x90
LBB0_8:                                 ##   in Loop: Header=BB0_6 Depth=1
	movq	%r14, %rdi
	callq	_wqe_to_link
	movl	$-1, (%rax)
	xorl	%eax, %eax
LBB0_9:                                 ##   in Loop: Header=BB0_6 Depth=1
	movq	%rax, (%r14)
	movb	4(%r12), %cl
	movl	$1, %eax
	shll	%cl, %eax
	leaq	8(%r14), %rbx
	.p2align	4, 0x90
LBB0_11:                                ##   Parent Loop BB0_6 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	cltq
	addq	%r14, %rax
	cmpq	%rbx, %rax
	jbe	LBB0_12
## %bb.10:                              ##   in Loop: Header=BB0_11 Depth=2
	movl	(%r13), %edi
	callq	_cpu_to_be32
	movl	%eax, (%rbx)
	movzbl	4(%r12), %ecx
	movl	$1, %eax
	shll	%cl, %eax
	addq	$4, %rbx
	jmp	LBB0_11
LBB0_13:
	decl	%esi
	movq	%r12, %rdi
	callq	_get_wqe
	movq	%rax, 8(%r12)
	xorl	%eax, %eax
	jmp	LBB0_14
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_MTHCA_MAX_DIRECT_SRQ_SIZE,4,2  ## @MTHCA_MAX_DIRECT_SRQ_SIZE
	.comm	_MTHCA_INVAL_LKEY,4,2           ## @MTHCA_INVAL_LKEY
	.no_dead_strip	_mthca_alloc_srq_buf
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mthca_alloc_srq_buf
_mthca_alloc_srq_buf:                   ; @mthca_alloc_srq_buf
	.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
	cbz	x3, LBB0_3
; %bb.1:
	mov	w20, #0
LBB0_2:
	mov	x0, x20
	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_3:
	mov	x19, x2
	mov	x20, x1
	mov	x21, x0
	ldr	w0, [x2]
Lloh0:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh2:
	ldr	w2, [x8]
	mov	w1, #4
	bl	_kmalloc_array
	str	w0, [x19, #16]
	cbz	w0, LBB0_6
; %bb.4:
	ldp	w8, w9, [x19]
	lsl	w1, w8, w9
Lloh3:
	adrp	x8, _MTHCA_MAX_DIRECT_SRQ_SIZE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _MTHCA_MAX_DIRECT_SRQ_SIZE@GOTPAGEOFF]
Lloh5:
	ldr	w2, [x8]
	add	x3, x19, #28
	add	x4, x19, #24
	add	x7, x19, #20
	mov	x0, x21
	mov	x5, x20
	mov	w6, #1
	bl	_mthca_buf_alloc
	cbz	w0, LBB0_7
; %bb.5:
	mov	x20, x0
	ldr	w0, [x19, #16]
	bl	_kfree
	b	LBB0_2
LBB0_6:
Lloh6:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh7:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_2
LBB0_7:
	ldr	w8, [x19]
	cmp	w8, #1
	b.lt	LBB0_16
; %bb.8:
	mov	w20, #0
	mov	w22, #1
Lloh9:
	adrp	x23, _MTHCA_INVAL_LKEY@GOTPAGE
Lloh10:
	ldr	x23, [x23, _MTHCA_INVAL_LKEY@GOTPAGEOFF]
	mov	w24, #-1
	b	LBB0_10
LBB0_9:                                 ;   in Loop: Header=BB0_10 Depth=1
	add	w20, w20, #1
	ldr	w8, [x19]
	cmp	w20, w8
	b.ge	LBB0_16
LBB0_10:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_14 Depth 2
	mov	x0, x19
	mov	x1, x20
	bl	_get_wqe
	mov	x21, x0
	ldr	w8, [x19]
	sub	w8, w8, #1
	cmp	w20, w8
	b.ge	LBB0_12
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=1
	add	w25, w20, #1
	mov	x0, x21
	bl	_wqe_to_link
	str	w25, [x0]
	ldr	w8, [x19, #4]
	lsl	w8, w25, w8
	orr	w0, w8, #0x1
	bl	_htonl
	b	LBB0_13
LBB0_12:                                ;   in Loop: Header=BB0_10 Depth=1
	mov	x0, x21
	bl	_wqe_to_link
	mov	x8, x0
	mov	x0, #0
	str	w24, [x8]
LBB0_13:                                ;   in Loop: Header=BB0_10 Depth=1
	mov	x25, x21
	str	x0, [x25], #8
LBB0_14:                                ;   Parent Loop BB0_10 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w8, [x19, #4]
	lsl	w8, w22, w8
	add	x8, x21, w8, sxtw
	cmp	x8, x25
	b.ls	LBB0_9
; %bb.15:                               ;   in Loop: Header=BB0_14 Depth=2
	ldr	w0, [x23]
	bl	_cpu_to_be32
	str	w0, [x25], #4
	b	LBB0_14
LBB0_16:
	sub	w1, w8, #1
	mov	x0, x19
	bl	_get_wqe
	mov	w20, #0
	str	x0, [x19, #8]
	b	LBB0_2
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_MTHCA_MAX_DIRECT_SRQ_SIZE,4,2  ; @MTHCA_MAX_DIRECT_SRQ_SIZE
	.comm	_MTHCA_INVAL_LKEY,4,2           ; @MTHCA_INVAL_LKEY
	.no_dead_strip	_mthca_alloc_srq_buf
.subsections_via_symbols
