	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function __mthca_write_mtt
___mthca_write_mtt:                     ## @__mthca_write_mtt
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%r8d, %r13d
	movq	%rcx, %r12
                                        ## kill: def $edx killed $edx def $rdx
	movq	%rdx, -64(%rbp)                 ## 8-byte Spill
	movq	%rsi, %r15
	movq	%rdi, %r14
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_mthca_alloc_mailbox
	movq	%rax, %rbx
	movq	%rax, %rdi
	callq	_IS_ERR
	testq	%rax, %rax
	je	LBB0_1
## %bb.16:
	movq	%rbx, %rdi
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_PTR_ERR                        ## TAILCALL
LBB0_1:
	movq	%r15, -72(%rbp)                 ## 8-byte Spill
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	testl	%r13d, %r13d
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	jle	LBB0_2
## %bb.3:
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	movq	(%rbx), %r15
	.p2align	4, 0x90
LBB0_4:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_5 Depth 2
	movl	%r13d, %r13d
	movl	(%r14), %eax
	movq	-72(%rbp), %rdx                 ## 8-byte Reload
	imull	(%rdx), %eax
	movq	%rcx, -64(%rbp)                 ## 8-byte Spill
	leal	(,%rcx,8), %edi
	addl	4(%r14), %edi
	addl	%eax, %edi
	callq	_cpu_to_be64
	movq	%rax, (%r15)
	movq	$0, 8(%r15)
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_5:                                 ##   Parent Loop BB0_4 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	_MTHCA_MAILBOX_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	leal	7(%rax), %ecx
	testl	%eax, %eax
	cmovnsl	%eax, %ecx
	sarl	$3, %ecx
	addl	$-2, %ecx
	movslq	%ecx, %rax
	cmpq	%rax, %rbx
	jge	LBB0_17
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=2
	movq	_MTHCA_MTT_FLAG_PRESENT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	orl	(%r12,%rbx,4), %edi
	callq	_cpu_to_be64
	movq	%rax, 16(%r15,%rbx,8)
	incq	%rbx
	cmpq	%rbx, %r13
	jne	LBB0_5
## %bb.7:                               ##   in Loop: Header=BB0_4 Depth=1
	movq	%r14, %rdi
	movl	%r13d, %ebx
	jmp	LBB0_8
	.p2align	4, 0x90
LBB0_17:                                ##   in Loop: Header=BB0_4 Depth=1
	movq	%r14, %rdi
LBB0_8:                                 ##   in Loop: Header=BB0_4 Depth=1
	movl	%ebx, %r14d
	testb	$1, %bl
	je	LBB0_10
## %bb.9:                               ##   in Loop: Header=BB0_4 Depth=1
	movq	$0, 16(%r15,%r14,8)
LBB0_10:                                ##   in Loop: Header=BB0_4 Depth=1
	leal	1(%rbx), %edx
	andl	$2147483646, %edx               ## imm = 0x7FFFFFFE
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	callq	_mthca_WRITE_MTT
	testl	%eax, %eax
	jne	LBB0_11
## %bb.12:                              ##   in Loop: Header=BB0_4 Depth=1
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	addl	%ebx, %ecx
	leaq	(%r12,%r14,4), %r12
	subl	%ebx, %r13d
	movq	-56(%rbp), %r14                 ## 8-byte Reload
	jg	LBB0_4
## %bb.13:
	xorl	%r14d, %r14d
	jmp	LBB0_14
LBB0_2:
	xorl	%r14d, %r14d
	jmp	LBB0_15
LBB0_11:
	leaq	L_.str(%rip), %rsi
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	%eax, %r14d
	movl	%eax, %edx
	callq	_mthca_warn
LBB0_14:
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
LBB0_15:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movq	%rbx, %rsi
	callq	_mthca_free_mailbox
	movl	%r14d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_MTHCA_MAILBOX_SIZE,4,2         ## @MTHCA_MAILBOX_SIZE
	.comm	_MTHCA_MTT_FLAG_PRESENT,4,2     ## @MTHCA_MTT_FLAG_PRESENT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"WRITE_MTT failed (%d)\n"

	.no_dead_strip	___mthca_write_mtt
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function __mthca_write_mtt
___mthca_write_mtt:                     ; @__mthca_write_mtt
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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	x24, x4
	mov	x21, x3
	mov	x22, x2
	mov	x23, x1
	mov	x19, x0
Lloh0:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	bl	_mthca_alloc_mailbox
	mov	x20, x0
	bl	_IS_ERR
	cbz	x0, LBB0_2
; %bb.1:
	mov	x0, x20
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	b	_PTR_ERR
LBB0_2:
	cmp	w24, #1
	b.lt	LBB0_13
; %bb.3:
	str	x20, [sp, #8]                   ; 8-byte Folded Spill
	ldr	x25, [x20]
	add	x26, x25, #16
Lloh3:
	adrp	x27, _MTHCA_MAILBOX_SIZE@GOTPAGE
Lloh4:
	ldr	x27, [x27, _MTHCA_MAILBOX_SIZE@GOTPAGEOFF]
Lloh5:
	adrp	x28, _MTHCA_MTT_FLAG_PRESENT@GOTPAGE
Lloh6:
	ldr	x28, [x28, _MTHCA_MTT_FLAG_PRESENT@GOTPAGEOFF]
	str	x23, [sp]                       ; 8-byte Folded Spill
LBB0_4:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_5 Depth 2
	mov	w20, w24
	ldr	w8, [x23]
	ldp	w10, w9, [x19]
	add	w9, w9, w22, lsl #3
	madd	w0, w10, w8, w9
	bl	_cpu_to_be64
	mov	x23, #0
	stp	x0, xzr, [x25]
LBB0_5:                                 ;   Parent Loop BB0_4 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w8, [x27]
	add	w9, w8, #7
	cmp	w8, #0
	csel	w8, w9, w8, lt
	asr	w8, w8, #3
	sub	w8, w8, #2
	cmp	x23, w8, sxtw
	b.ge	LBB0_8
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=2
	ldr	w8, [x21, x23, lsl #2]
	ldr	w9, [x28]
	orr	w0, w9, w8
	bl	_cpu_to_be64
	str	x0, [x26, x23, lsl #3]
	add	x23, x23, #1
	cmp	x20, x23
	b.ne	LBB0_5
; %bb.7:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	x23, x20
LBB0_8:                                 ;   in Loop: Header=BB0_4 Depth=1
	tbz	w23, #0, LBB0_10
; %bb.9:                                ;   in Loop: Header=BB0_4 Depth=1
	add	w8, w23, #2
	str	xzr, [x25, w8, uxtw #3]
LBB0_10:                                ;   in Loop: Header=BB0_4 Depth=1
	add	w8, w23, #1
	and	w2, w8, #0x7ffffffe
	mov	x0, x19
	ldr	x1, [sp, #8]                    ; 8-byte Folded Reload
	bl	_mthca_WRITE_MTT
	cbnz	w0, LBB0_14
; %bb.11:                               ;   in Loop: Header=BB0_4 Depth=1
	sub	w24, w20, w23
	add	w22, w23, w22
	add	x21, x21, w23, uxtw #2
	cmp	w24, #0
	ldr	x23, [sp]                       ; 8-byte Folded Reload
	b.gt	LBB0_4
; %bb.12:
	mov	w24, #0
	b	LBB0_15
LBB0_13:
	mov	w24, #0
	b	LBB0_16
LBB0_14:
	mov	x24, x0
Lloh7:
	adrp	x1, l_.str@PAGE
Lloh8:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	mov	x2, x24
	bl	_mthca_warn
LBB0_15:
	ldr	x20, [sp, #8]                   ; 8-byte Folded Reload
LBB0_16:
	mov	x0, x19
	mov	x1, x20
	bl	_mthca_free_mailbox
	mov	x0, x24
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpAdd	Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_MTHCA_MAILBOX_SIZE,4,2         ; @MTHCA_MAILBOX_SIZE
	.comm	_MTHCA_MTT_FLAG_PRESENT,4,2     ; @MTHCA_MTT_FLAG_PRESENT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"WRITE_MTT failed (%d)\n"

	.no_dead_strip	___mthca_write_mtt
.subsections_via_symbols
