	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mthca_alloc_db                 ## -- Begin function mthca_alloc_db
	.p2align	4, 0x90
_mthca_alloc_db:                        ## @mthca_alloc_db
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rcx, %r15
	movl	%edx, %r12d
	movl	%esi, %r14d
	movq	%rdi, -64(%rbp)                 ## 8-byte Spill
	movq	(%rdi), %rdi
	addq	$8, %rdi
	callq	_mutex_lock
	leal	-128(%r14), %eax
	cmpl	$4, %eax
	ja	LBB0_3
## %bb.1:
	movl	$13, %ecx
	btl	%eax, %ecx
	jae	LBB0_2
## %bb.4:
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	movq	(%rsi), %rax
	movl	24(%rax), %ebx
	decl	%ebx
	leaq	4(%rax), %rcx
	movq	$-1, %r9
	movb	$1, %r8b
	xorl	%edi, %edi
	jmp	LBB0_5
LBB0_2:
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	movq	(%rsi), %rax
	movl	$1, %r9d
	xorl	%r8d, %r8d
	movb	$1, %dil
	xorl	%ebx, %ebx
	movq	%rax, %rcx
LBB0_5:
	movl	(%rcx), %edx
	cmpl	%edx, %ebx
	movl	%ebx, -44(%rbp)                 ## 4-byte Spill
	jne	LBB0_6
## %bb.10:
	movq	(%rsi), %rax
	jmp	LBB0_17
LBB0_6:
	movl	%edi, -84(%rbp)                 ## 4-byte Spill
	movl	%r8d, -48(%rbp)                 ## 4-byte Spill
	movl	%r12d, -52(%rbp)                ## 4-byte Spill
	movq	%r14, -72(%rbp)                 ## 8-byte Spill
	movq	%r15, -80(%rbp)                 ## 8-byte Spill
	movslq	%ebx, %r12
	movq	%r12, -96(%rbp)                 ## 8-byte Spill
	shlq	$4, %r12
	movq	%r9, %r13
	shlq	$4, %r13
	jmp	LBB0_7
	.p2align	4, 0x90
LBB0_11:                                ##   in Loop: Header=BB0_7 Depth=1
	movq	(%rsi), %rax
	addl	%r9d, %ebx
	addq	%r13, %r12
	cmpl	%ebx, %edx
	je	LBB0_12
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movq	16(%rax), %rax
	cmpq	$0, (%rax,%r12)
	je	LBB0_11
## %bb.8:                               ##   in Loop: Header=BB0_7 Depth=1
	movl	8(%rax,%r12), %edi
	movq	_MTHCA_DB_REC_PER_PAGE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r9, %r14
	movl	%edx, %r15d
	callq	_bitmap_full
	movl	%r15d, %edx
	movq	%r14, %r9
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	testl	%eax, %eax
	jne	LBB0_11
## %bb.9:
	movq	(%rsi), %rax
	addq	16(%rax), %r12
	jmp	LBB0_28
LBB0_12:
	movq	-96(%rbp), %rbx                 ## 8-byte Reload
	shlq	$4, %rbx
	addq	16(%rax), %rbx
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	.p2align	4, 0x90
LBB0_13:                                ## =>This Inner Loop Header: Depth=1
	cmpq	$0, (%rbx)
	je	LBB0_14
## %bb.15:                              ##   in Loop: Header=BB0_13 Depth=1
	addl	%r9d, %ecx
	addq	%r13, %rbx
	cmpl	%ecx, %edx
	jne	LBB0_13
## %bb.16:
	movl	%edx, -44(%rbp)                 ## 4-byte Spill
	movq	-80(%rbp), %r15                 ## 8-byte Reload
	movq	-72(%rbp), %r14                 ## 8-byte Reload
	movl	-52(%rbp), %r12d                ## 4-byte Reload
	movl	-48(%rbp), %r8d                 ## 4-byte Reload
	movl	-84(%rbp), %edi                 ## 4-byte Reload
LBB0_17:
	movl	(%rax), %ecx
	movl	4(%rax), %ebx
	decl	%ebx
	cmpl	%ebx, %ecx
	jge	LBB0_18
## %bb.19:
	movl	%r8d, -48(%rbp)                 ## 4-byte Spill
	movl	%r12d, -52(%rbp)                ## 4-byte Spill
	movslq	%edx, %rdx
	testb	%dil, %dil
	movq	%r15, -80(%rbp)                 ## 8-byte Spill
	movq	%r14, -72(%rbp)                 ## 8-byte Spill
	je	LBB0_21
## %bb.20:
	incl	%ecx
	movl	%ecx, (%rax)
	jmp	LBB0_22
LBB0_18:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_30
LBB0_3:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_29
LBB0_14:
	movl	%ecx, -44(%rbp)                 ## 4-byte Spill
	jmp	LBB0_23
LBB0_21:
	movl	%ebx, 4(%rax)
LBB0_22:
	shlq	$4, %rdx
	addq	16(%rax), %rdx
	movq	%rdx, %rbx
LBB0_23:
	movq	%rsi, %r12
	movq	8(%rsi), %rdi
	movq	_MTHCA_ICM_PAGE_SIZE@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	leaq	12(%rbx), %r14
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r14, %rdx
	callq	_dma_alloc_coherent
	movq	%rax, (%rbx)
	testq	%rax, %rax
	je	LBB0_24
## %bb.25:
	movq	%rbx, %r13
	movl	(%r14), %ebx
	leaq	16(%r12), %rsi
	movq	%r12, %rdi
	movl	-44(%rbp), %r14d                ## 4-byte Reload
	movl	%r14d, %edx
	callq	_mthca_uarc_virt
	movq	%r12, %rdi
	movl	%ebx, %esi
	movl	%eax, %edx
	callq	_mthca_MAP_ICM_page
	testl	%eax, %eax
	je	LBB0_27
## %bb.26:
	movl	%eax, %ebx
	movq	8(%r12), %rdi
	movl	(%r15), %esi
	movq	(%r13), %rdx
	movl	12(%r13), %ecx
	callq	_dma_free_coherent
	movq	%r12, %rsi
	jmp	LBB0_30
LBB0_24:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	movq	%r12, %rsi
	jmp	LBB0_30
LBB0_27:
	movq	%r13, %r12
	movl	8(%r13), %edi
	movq	_MTHCA_DB_REC_PER_PAGE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_bitmap_zero
	movl	%r14d, %ebx
LBB0_28:
	movl	8(%r12), %edi
	movq	_MTHCA_DB_REC_PER_PAGE@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	callq	_find_first_zero_bit
	movl	%eax, %r14d
	movl	8(%r12), %esi
	movl	%eax, %edi
	callq	_set_bit
	movl	(%r15), %eax
	movl	%r14d, %r15d
	notl	%r15d
	addl	%eax, %r15d
	cmpb	$0, -48(%rbp)                   ## 1-byte Folded Reload
	cmovel	%r14d, %r15d
	imull	%eax, %ebx
	addl	%r15d, %ebx
	movl	-52(%rbp), %eax                 ## 4-byte Reload
	shll	$8, %eax
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	shll	$5, %edi
	orl	%eax, %edi
                                        ## kill: def $edi killed $edi killed $rdi
	callq	_cpu_to_be64
	movq	(%r12), %rcx
	movslq	%r15d, %rdx
	leaq	(%rcx,%rdx,4), %rsi
	movl	%eax, (%rcx,%rdx,4)
	movq	-80(%rbp), %rax                 ## 8-byte Reload
	movq	%rsi, (%rax)
LBB0_29:
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
LBB0_30:
	movq	(%rsi), %rdi
	addq	$8, %rdi
	callq	_mutex_unlock
	movl	%ebx, %eax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_MTHCA_DB_REC_PER_PAGE,4,2      ## @MTHCA_DB_REC_PER_PAGE
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_MTHCA_ICM_PAGE_SIZE,4,2        ## @MTHCA_ICM_PAGE_SIZE
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mthca_alloc_db                 ; -- Begin function mthca_alloc_db
	.p2align	2
_mthca_alloc_db:                        ; @mthca_alloc_db
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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	x25, x3
	mov	x22, x2
	mov	x21, x1
	mov	x19, x0
	ldr	x8, [x0]
	add	x0, x8, #8
	bl	_mutex_lock
	sub	w8, w21, #128
	cmp	w8, #4
	b.hi	LBB0_18
; %bb.1:
	mov	w9, #1
	lsl	w8, w9, w8
	mov	w9, #13
	tst	w8, w9
	b.eq	LBB0_3
; %bb.2:
	mov	w13, #0
	ldr	x8, [x19]
	ldr	w9, [x8, #24]
	sub	w23, w9, #1
	add	x9, x8, #4
	mov	x27, #-1
	mov	w12, #1
	b	LBB0_4
LBB0_3:
	mov	w12, #0
	mov	w23, #0
	ldr	x8, [x19]
	mov	w13, #1
	mov	x9, x8
	mov	w27, #1
LBB0_4:
	ldr	w28, [x9]
	cmp	w23, w28
	b.ne	LBB0_6
; %bb.5:
	ldr	x8, [x19]
	b	LBB0_15
LBB0_6:
	stp	x13, x25, [sp, #8]              ; 16-byte Folded Spill
	stp	w21, w12, [sp, #24]             ; 8-byte Folded Spill
	mov	x21, x22
	sxtw	x26, w23
	sbfiz	x22, x23, #4, #32
Lloh0:
	adrp	x24, _MTHCA_DB_REC_PER_PAGE@GOTPAGE
Lloh1:
	ldr	x24, [x24, _MTHCA_DB_REC_PER_PAGE@GOTPAGEOFF]
	mov	x20, x23
	lsl	x25, x27, #4
	b	LBB0_8
LBB0_7:                                 ;   in Loop: Header=BB0_8 Depth=1
	ldr	x8, [x19]
	add	x22, x22, x25
	add	w20, w20, w27
	cmp	w28, w20
	b.eq	LBB0_11
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x8, #16]
	ldr	x9, [x8, x22]
	cbz	x9, LBB0_7
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=1
	add	x8, x8, x22
	ldr	w0, [x8, #8]
	ldr	w1, [x24]
	bl	_bitmap_full
	cbnz	w0, LBB0_7
; %bb.10:
	ldr	x8, [x19]
	ldr	x8, [x8, #16]
	add	x26, x8, x22
	ldr	x25, [sp, #16]                  ; 8-byte Folded Reload
	b	LBB0_28
LBB0_11:
	ldr	x9, [x8, #16]
	add	x26, x9, x26, lsl #4
	mov	x22, x21
	ldr	w21, [sp, #24]                  ; 4-byte Folded Reload
LBB0_12:                                ; =>This Inner Loop Header: Depth=1
	ldr	x9, [x26]
	cbz	x9, LBB0_19
; %bb.13:                               ;   in Loop: Header=BB0_12 Depth=1
	add	x26, x26, x25
	add	w23, w23, w27
	cmp	w28, w23
	b.ne	LBB0_12
; %bb.14:
	mov	x23, x28
	ldp	x13, x25, [sp, #8]              ; 16-byte Folded Reload
	ldr	w12, [sp, #28]                  ; 4-byte Folded Reload
LBB0_15:
	ldp	w10, w9, [x8]
	sub	w11, w9, #1
	cmp	w10, w11
	b.ge	LBB0_25
; %bb.16:
	sxtw	x9, w28
	str	w12, [sp, #28]                  ; 4-byte Folded Spill
	cbz	w13, LBB0_20
; %bb.17:
	add	w10, w10, #1
	str	w10, [x8]
	b	LBB0_21
LBB0_18:
Lloh2:
	adrp	x8, _EINVAL@GOTPAGE
Lloh3:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_26
LBB0_19:
	ldr	x25, [sp, #16]                  ; 8-byte Folded Reload
	b	LBB0_22
LBB0_20:
	str	w11, [x8, #4]
LBB0_21:
	ldr	x8, [x8, #16]
	add	x26, x8, x9, lsl #4
LBB0_22:
Lloh4:
	adrp	x20, _MTHCA_ICM_PAGE_SIZE@GOTPAGE
Lloh5:
	ldr	x20, [x20, _MTHCA_ICM_PAGE_SIZE@GOTPAGEOFF]
	ldr	x0, [x19, #8]
	ldr	w1, [x20]
	add	x24, x26, #12
Lloh6:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh7:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh8:
	ldr	w3, [x8]
	mov	x2, x24
	bl	_dma_alloc_coherent
	str	x0, [x26]
	cbz	x0, LBB0_25
; %bb.23:
	ldr	w24, [x24]
	add	x1, x19, #16
	mov	x0, x19
	mov	x2, x23
	bl	_mthca_uarc_virt
	mov	x2, x0
	mov	x0, x19
	mov	x1, x24
	bl	_mthca_MAP_ICM_page
	cbz	w0, LBB0_27
; %bb.24:
	mov	x24, x0
	ldr	x0, [x19, #8]
	ldr	w1, [x20]
	ldr	x2, [x26]
	ldr	w3, [x26, #12]
	bl	_dma_free_coherent
	b	LBB0_29
LBB0_25:
Lloh9:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh10:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
LBB0_26:
	ldr	w8, [x8]
	neg	w24, w8
	b	LBB0_29
LBB0_27:
	str	w21, [sp, #24]                  ; 4-byte Folded Spill
	mov	x21, x22
	ldr	w0, [x26, #8]
Lloh11:
	adrp	x8, _MTHCA_DB_REC_PER_PAGE@GOTPAGE
Lloh12:
	ldr	x8, [x8, _MTHCA_DB_REC_PER_PAGE@GOTPAGEOFF]
Lloh13:
	ldr	w1, [x8]
	bl	_bitmap_zero
	mov	x20, x23
LBB0_28:
	ldr	w0, [x26, #8]
Lloh14:
	adrp	x22, _MTHCA_DB_REC_PER_PAGE@GOTPAGE
Lloh15:
	ldr	x22, [x22, _MTHCA_DB_REC_PER_PAGE@GOTPAGEOFF]
	ldr	w1, [x22]
	bl	_find_first_zero_bit
	mov	x23, x0
	ldr	w1, [x26, #8]
	bl	_set_bit
	ldr	w8, [x22]
	mvn	w9, w23
	add	w9, w8, w9
	ldr	w10, [sp, #28]                  ; 4-byte Folded Reload
	cmp	w10, #0
	csel	w22, w9, w23, ne
	madd	w24, w8, w20, w22
	lsl	w8, w21, #8
	ldr	w9, [sp, #24]                   ; 4-byte Folded Reload
	orr	w0, w8, w9, lsl #5
	bl	_cpu_to_be64
	ldr	x8, [x26]
	sbfiz	x9, x22, #2, #32
	add	x10, x8, x9
	str	w0, [x8, x9]
	str	x10, [x25]
LBB0_29:
	ldr	x8, [x19]
	add	x0, x8, #8
	bl	_mutex_unlock
	mov	x0, x24
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_MTHCA_DB_REC_PER_PAGE,4,2      ; @MTHCA_DB_REC_PER_PAGE
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_MTHCA_ICM_PAGE_SIZE,4,2        ; @MTHCA_ICM_PAGE_SIZE
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
.subsections_via_symbols
