	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mthca_map_user_db              ## -- Begin function mthca_map_user_db
	.p2align	4, 0x90
_mthca_map_user_db:                     ## @mthca_map_user_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
	movl	%r8d, %r15d
	movl	%ecx, %ebx
	movq	%rdx, %r14
	movq	%rsi, %r13
	movq	%rdi, %r12
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	callq	_mthca_is_memfree
	testl	%eax, %eax
	je	LBB0_1
## %bb.2:
	testl	%ebx, %ebx
	js	LBB0_4
## %bb.3:
	movl	4(%r12), %eax
	leal	7(%rax), %ecx
	testl	%eax, %eax
	cmovnsl	%eax, %ecx
	sarl	$3, %ecx
	cmpl	%ebx, %ecx
	jge	LBB0_5
LBB0_4:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r13d, %r13d
	subl	(%rax), %r13d
	jmp	LBB0_20
LBB0_1:
	xorl	%r13d, %r13d
	jmp	LBB0_20
LBB0_5:
	movq	%r14, %rdi
	callq	_mutex_lock
	movq	_MTHCA_DB_REC_PER_PAGE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%ebx, %eax
	cltd
	idivl	%esi
	movq	8(%r14), %rbx
	movslq	%eax, %rdx
	leaq	(%rdx,%rdx,2), %rdi
	movl	(%rbx,%rdi,4), %ecx
	cmpl	%esi, %ecx
	jge	LBB0_8
## %bb.6:
	movl	4(%rbx,%rdi,4), %esi
	testl	%esi, %esi
	sete	%r8b
	cmpl	%r15d, %esi
	sete	%sil
	testl	$4095, %r15d                    ## imm = 0xFFF
	jne	LBB0_8
## %bb.7:
	orb	%sil, %r8b
	je	LBB0_8
## %bb.9:
	testl	%ecx, %ecx
	je	LBB0_11
## %bb.10:
	leaq	(%rbx,%rdi,4), %rax
	incl	%ecx
	movl	%ecx, (%rax)
LBB0_18:
	xorl	%r13d, %r13d
	jmp	LBB0_19
LBB0_8:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r13d, %r13d
	subl	(%rax), %r13d
LBB0_19:
	movq	%r14, %rdi
	callq	_mutex_unlock
LBB0_20:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_22
## %bb.21:
	movl	%r13d, %eax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_11:
	movq	%rdx, %rbx
	movl	%eax, -60(%rbp)                 ## 4-byte Spill
	movq	%rdi, -80(%rbp)                 ## 8-byte Spill
	movq	%r13, -88(%rbp)                 ## 8-byte Spill
	movq	_PAGE_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	andl	%r15d, %edi
	movq	_FOLL_WRITE@GOTPCREL(%rip), %rax
	movq	_FOLL_LONGTERM@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	orl	(%rax), %edx
	leaq	-56(%rbp), %rcx
	movl	$1, %esi
	callq	_get_user_pages_fast
	testl	%eax, %eax
	js	LBB0_12
## %bb.13:
	movq	8(%r14), %rax
	shlq	$2, %rbx
	leaq	(%rbx,%rbx,2), %rbx
	leaq	(%rax,%rbx), %rdi
	addq	$8, %rdi
	movq	-56(%rbp), %rsi
	movq	_MTHCA_ICM_PAGE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_PAGE_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	notl	%ecx
	andl	%r15d, %ecx
	callq	_sg_set_page
	movl	(%r12), %edi
	movq	8(%r14), %rax
	leaq	(%rax,%rbx), %rsi
	addq	$8, %rsi
	movq	_PCI_DMA_TODEVICE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	$1, %edx
	callq	_pci_map_sg
	testl	%eax, %eax
	js	LBB0_14
## %bb.15:
	movq	%rbx, -72(%rbp)                 ## 8-byte Spill
	movq	8(%r14), %rax
	movq	-80(%rbp), %rbx                 ## 8-byte Reload
	leaq	(%rax,%rbx,4), %rdi
	addq	$8, %rdi
	callq	_sg_dma_address
	movl	%eax, %r13d
	movq	%r12, %rdi
	movq	-88(%rbp), %rsi                 ## 8-byte Reload
	movl	-60(%rbp), %edx                 ## 4-byte Reload
	callq	_mthca_uarc_virt
	movq	%r12, %rdi
	movl	%r13d, %esi
	movl	%eax, %edx
	callq	_mthca_MAP_ICM_page
	testl	%eax, %eax
	je	LBB0_17
## %bb.16:
	movl	%eax, %r13d
	movl	(%r12), %edi
	movq	8(%r14), %rax
	movq	-72(%rbp), %rbx                 ## 8-byte Reload
	leaq	(%rax,%rbx), %rsi
	addq	$8, %rsi
	movq	_PCI_DMA_TODEVICE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	$1, %edx
	callq	_pci_unmap_sg
	movq	8(%r14), %rax
	leaq	(%rax,%rbx), %rdi
	addq	$8, %rdi
	callq	_sg_page
	movq	%rax, %rdi
	callq	_put_user_page
	jmp	LBB0_19
LBB0_12:
	movl	%eax, %r13d
	jmp	LBB0_19
LBB0_14:
	movl	%eax, %r13d
	movq	-56(%rbp), %rdi
	callq	_put_user_page
	jmp	LBB0_19
LBB0_17:
	movq	8(%r14), %rax
	movl	%r15d, 4(%rax,%rbx,4)
	movl	$1, (%rax,%rbx,4)
	jmp	LBB0_18
LBB0_22:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_MTHCA_DB_REC_PER_PAGE,4,2      ## @MTHCA_DB_REC_PER_PAGE
	.comm	_PAGE_MASK,4,2                  ## @PAGE_MASK
	.comm	_FOLL_WRITE,4,2                 ## @FOLL_WRITE
	.comm	_FOLL_LONGTERM,4,2              ## @FOLL_LONGTERM
	.comm	_MTHCA_ICM_PAGE_SIZE,4,2        ## @MTHCA_ICM_PAGE_SIZE
	.comm	_PCI_DMA_TODEVICE,4,2           ## @PCI_DMA_TODEVICE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mthca_map_user_db              ; -- Begin function mthca_map_user_db
	.p2align	2
_mthca_map_user_db:                     ; @mthca_map_user_db
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	mov	x20, x4
	mov	x23, x3
	mov	x19, x2
	mov	x22, x1
	mov	x21, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #8]
	bl	_mthca_is_memfree
	cbz	w0, LBB0_4
; %bb.1:
	tbnz	w23, #31, LBB0_3
; %bb.2:
	ldr	w8, [x21, #4]
	add	w9, w8, #7
	cmp	w8, #0
	csel	w8, w9, w8, lt
	cmp	w23, w8, asr #3
	b.le	LBB0_5
LBB0_3:
Lloh3:
	adrp	x8, _EINVAL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	neg	w24, w8
	b	LBB0_13
LBB0_4:
	mov	w24, #0
	b	LBB0_13
LBB0_5:
	mov	x0, x19
	bl	_mutex_lock
Lloh6:
	adrp	x8, _MTHCA_DB_REC_PER_PAGE@GOTPAGE
Lloh7:
	ldr	x8, [x8, _MTHCA_DB_REC_PER_PAGE@GOTPAGEOFF]
Lloh8:
	ldr	w12, [x8]
	sdiv	w11, w23, w12
	ldr	x10, [x19, #8]
	mov	w8, #12
	smaddl	x8, w11, w8, x10
	ldr	w9, [x8]
	cmp	w9, w12
	b.ge	LBB0_11
; %bb.6:
	sxtw	x23, w11
	mov	w11, #12
	madd	x10, x23, x11, x10
	ldr	w10, [x10, #4]
	cmp	w10, #0
	ccmp	w10, w20, #4, ne
	cset	w10, eq
	tst	w20, #0xfff
	b.ne	LBB0_11
; %bb.7:
	tbz	w10, #0, LBB0_11
; %bb.8:
	cbz	w9, LBB0_15
; %bb.9:
	mov	w24, #0
	add	w9, w9, #1
LBB0_10:
	str	w9, [x8]
	b	LBB0_12
LBB0_11:
Lloh9:
	adrp	x8, _EINVAL@GOTPAGE
Lloh10:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	neg	w24, w8
LBB0_12:
	mov	x0, x19
	bl	_mutex_unlock
LBB0_13:
	ldr	x8, [sp, #8]
Lloh12:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh13:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh14:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_22
; %bb.14:
	mov	x0, x24
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
LBB0_15:
Lloh15:
	adrp	x25, _PAGE_MASK@GOTPAGE
Lloh16:
	ldr	x25, [x25, _PAGE_MASK@GOTPAGEOFF]
	ldr	w8, [x25]
Lloh17:
	adrp	x9, _FOLL_WRITE@GOTPAGE
Lloh18:
	ldr	x9, [x9, _FOLL_WRITE@GOTPAGEOFF]
	and	w0, w8, w20
Lloh19:
	ldr	w8, [x9]
Lloh20:
	adrp	x9, _FOLL_LONGTERM@GOTPAGE
Lloh21:
	ldr	x9, [x9, _FOLL_LONGTERM@GOTPAGEOFF]
Lloh22:
	ldr	w9, [x9]
	orr	w2, w9, w8
	mov	x3, sp
	mov	w1, #1
	bl	_get_user_pages_fast
	tbnz	w0, #31, LBB0_19
; %bb.16:
	ldr	x8, [x19, #8]
	add	x9, x23, x23, lsl #1
	lsl	x24, x9, #2
	add	x8, x8, x24
	add	x0, x8, #8
	ldr	x1, [sp]
Lloh23:
	adrp	x8, _MTHCA_ICM_PAGE_SIZE@GOTPAGE
Lloh24:
	ldr	x8, [x8, _MTHCA_ICM_PAGE_SIZE@GOTPAGEOFF]
Lloh25:
	ldr	w2, [x8]
	ldr	w8, [x25]
	bic	w3, w20, w8
	bl	_sg_set_page
	ldr	w0, [x21]
	ldr	x8, [x19, #8]
	add	x8, x8, x24
	add	x1, x8, #8
Lloh26:
	adrp	x25, _PCI_DMA_TODEVICE@GOTPAGE
Lloh27:
	ldr	x25, [x25, _PCI_DMA_TODEVICE@GOTPAGEOFF]
	ldr	w3, [x25]
	mov	w2, #1
	bl	_pci_map_sg
	tbnz	w0, #31, LBB0_20
; %bb.17:
	ldr	x8, [x19, #8]
	mov	w9, #12
	madd	x8, x23, x9, x8
	add	x0, x8, #8
	bl	_sg_dma_address
	mov	x24, x0
	mov	x0, x21
	mov	x1, x22
	mov	x2, x23
	bl	_mthca_uarc_virt
	mov	x2, x0
	mov	x0, x21
	mov	x1, x24
	bl	_mthca_MAP_ICM_page
	mov	x24, x0
	cbz	w0, LBB0_21
; %bb.18:
	ldr	w0, [x21]
	ldr	x8, [x19, #8]
	add	x9, x23, x23, lsl #1
	lsl	x20, x9, #2
	add	x8, x8, x20
	add	x1, x8, #8
	ldr	w3, [x25]
	mov	w2, #1
	bl	_pci_unmap_sg
	ldr	x8, [x19, #8]
	add	x8, x8, x20
	add	x0, x8, #8
	bl	_sg_page
	bl	_put_user_page
	b	LBB0_12
LBB0_19:
	mov	x24, x0
	b	LBB0_12
LBB0_20:
	mov	x24, x0
	ldr	x0, [sp]
	bl	_put_user_page
	b	LBB0_12
LBB0_21:
	ldr	x8, [x19, #8]
	mov	w9, #12
	madd	x8, x23, x9, x8
	mov	w9, #1
	str	w20, [x8, #4]
	b	LBB0_10
LBB0_22:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_MTHCA_DB_REC_PER_PAGE,4,2      ; @MTHCA_DB_REC_PER_PAGE
	.comm	_PAGE_MASK,4,2                  ; @PAGE_MASK
	.comm	_FOLL_WRITE,4,2                 ; @FOLL_WRITE
	.comm	_FOLL_LONGTERM,4,2              ; @FOLL_LONGTERM
	.comm	_MTHCA_ICM_PAGE_SIZE,4,2        ; @MTHCA_ICM_PAGE_SIZE
	.comm	_PCI_DMA_TODEVICE,4,2           ; @PCI_DMA_TODEVICE
.subsections_via_symbols
