	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal16,16byte_literals
	.p2align	4                               ## -- Begin function mthca_alloc_icm
LCPI0_0:
	.space	16
LCPI0_1:
	.space	16,255
	.section	__TEXT,__text,regular,pure_instructions
	.globl	_mthca_alloc_icm
	.p2align	4, 0x90
_mthca_alloc_icm:                       ## @mthca_alloc_icm
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %ebx
	movl	%esi, %r13d
	movq	%rdi, -64(%rbp)                 ## 8-byte Spill
	movl	%ecx, -44(%rbp)                 ## 4-byte Spill
	testl	%ecx, %ecx
	setne	%al
	movq	___GFP_HIGHMEM@GOTPCREL(%rip), %r14
	movl	(%r14), %ecx
	andl	%edx, %ecx
	setne	%cl
	andb	%al, %cl
	movzbl	%cl, %edi
	callq	_BUG_ON
	movq	___GFP_NOWARN@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	orl	(%r14), %esi
	notl	%esi
	movl	%ebx, -48(%rbp)                 ## 4-byte Spill
	andl	%ebx, %esi
	movl	$16, %edi
	callq	_kmalloc
	testq	%rax, %rax
	je	LBB0_21
## %bb.1:
	movq	$0, 8(%rax)
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	%rax, %rdi
	callq	_INIT_LIST_HEAD
	movq	_MTHCA_ICM_ALLOC_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_get_order
	testl	%r13d, %r13d
	jle	LBB0_22
## %bb.2:
	movl	%eax, %r15d
	xorl	%r14d, %r14d
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_14:                                ##   in Loop: Header=BB0_3 Depth=1
	movq	(%r14), %rdi
	shlq	$2, %rdi
	addq	16(%r14), %rdi
	movl	%r12d, %esi
	movl	-48(%rbp), %edx                 ## 4-byte Reload
	callq	_mthca_alloc_icm_pages
	testl	%eax, %eax
	je	LBB0_10
LBB0_15:                                ##   in Loop: Header=BB0_3 Depth=1
	movl	%r13d, %ebx
	testl	%r12d, %r12d
	jle	LBB0_20
## %bb.16:                              ##   in Loop: Header=BB0_3 Depth=1
	testl	%ebx, %ebx
	jle	LBB0_17
LBB0_3:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_6 Depth 2
	testq	%r14, %r14
	jne	LBB0_6
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	___GFP_NOWARN@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	___GFP_HIGHMEM@GOTPCREL(%rip), %rax
	orl	(%rax), %esi
	notl	%esi
	andl	-48(%rbp), %esi                 ## 4-byte Folded Reload
	movl	$32, %edi
	callq	_kmalloc
	testq	%rax, %rax
	je	LBB0_20
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	%rax, %r14
	movq	16(%rax), %rdi
	movq	_MTHCA_ICM_CHUNK_LEN@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	callq	_sg_init_table
	movq	%r14, %rdi
	addq	$24, %rdi
	pxor	%xmm0, %xmm0
	movdqu	%xmm0, (%r14)
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	callq	_list_add_tail
	.p2align	4, 0x90
LBB0_6:                                 ##   Parent Loop BB0_3 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	$1, %eax
	movl	%r15d, %ecx
	shll	%cl, %eax
	decl	%r15d
	movl	%r13d, %ebx
	subl	%eax, %ebx
	jl	LBB0_6
## %bb.7:                               ##   in Loop: Header=BB0_3 Depth=1
	leal	1(%r15), %r12d
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_14
## %bb.8:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rdi
	movq	(%r14), %rsi
	shlq	$2, %rsi
	addq	16(%r14), %rsi
	movl	%r12d, %edx
	movl	-48(%rbp), %ecx                 ## 4-byte Reload
	callq	_mthca_alloc_icm_coherent
	testl	%eax, %eax
	jne	LBB0_15
## %bb.9:                               ##   in Loop: Header=BB0_3 Depth=1
	movdqu	(%r14), %xmm0
	psubq	LCPI0_1(%rip), %xmm0
	movdqu	%xmm0, (%r14)
	movq	%xmm0, %rdx
	jmp	LBB0_13
LBB0_10:                                ##   in Loop: Header=BB0_3 Depth=1
	movq	(%r14), %rdx
	incq	%rdx
	movq	%rdx, (%r14)
	movq	_MTHCA_ICM_CHUNK_LEN@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rdx
	jne	LBB0_13
## %bb.11:                              ##   in Loop: Header=BB0_3 Depth=1
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rdi
	movq	16(%r14), %rsi
	movq	_PCI_DMA_BIDIRECTIONAL@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	callq	_pci_map_sg
	movq	%rax, 8(%r14)
	testq	%rax, %rax
	jle	LBB0_20
## %bb.12:                              ##   in Loop: Header=BB0_3 Depth=1
	movq	(%r14), %rdx
	.p2align	4, 0x90
LBB0_13:                                ##   in Loop: Header=BB0_3 Depth=1
	movq	_MTHCA_ICM_CHUNK_LEN@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rdx
	movl	$0, %eax
	cmoveq	%rax, %r14
	movl	%r12d, %r15d
	movl	%ebx, %r13d
	testl	%ebx, %ebx
	jg	LBB0_3
LBB0_17:
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	jne	LBB0_22
## %bb.18:
	testq	%r14, %r14
	je	LBB0_22
## %bb.19:
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rdi
	movq	(%r14), %rdx
	movq	16(%r14), %rsi
	movq	_PCI_DMA_BIDIRECTIONAL@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	callq	_pci_map_sg
	movq	%rax, 8(%r14)
	testq	%rax, %rax
	jg	LBB0_22
LBB0_20:
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	callq	_mthca_free_icm
LBB0_21:
	xorl	%eax, %eax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
LBB0_22:
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	___GFP_HIGHMEM,4,2              ## @__GFP_HIGHMEM
	.comm	___GFP_NOWARN,4,2               ## @__GFP_NOWARN
	.comm	_MTHCA_ICM_ALLOC_SIZE,4,2       ## @MTHCA_ICM_ALLOC_SIZE
	.comm	_MTHCA_ICM_CHUNK_LEN,8,3        ## @MTHCA_ICM_CHUNK_LEN
	.comm	_PCI_DMA_BIDIRECTIONAL,4,2      ## @PCI_DMA_BIDIRECTIONAL
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mthca_alloc_icm                ; -- Begin function mthca_alloc_icm
	.p2align	2
_mthca_alloc_icm:                       ; @mthca_alloc_icm
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x3
	mov	x22, x2
	mov	x28, x1
	mov	x20, x0
Lloh0:
	adrp	x21, ___GFP_HIGHMEM@GOTPAGE
Lloh1:
	ldr	x21, [x21, ___GFP_HIGHMEM@GOTPAGEOFF]
	ldr	w8, [x21]
	tst	w8, w2
	ccmp	w3, #0, #4, ne
	cset	w0, ne
	bl	_BUG_ON
	ldr	w8, [x21]
Lloh2:
	adrp	x9, ___GFP_NOWARN@GOTPAGE
Lloh3:
	ldr	x9, [x9, ___GFP_NOWARN@GOTPAGEOFF]
Lloh4:
	ldr	w9, [x9]
	orr	w8, w9, w8
	bic	w1, w22, w8
	mov	w0, #16
	bl	_kmalloc
	mov	x21, x0
	cbz	x0, LBB0_21
; %bb.1:
	str	xzr, [x21, #8]
	mov	x0, x21
	bl	_INIT_LIST_HEAD
Lloh5:
	adrp	x8, _MTHCA_ICM_ALLOC_SIZE@GOTPAGE
Lloh6:
	ldr	x8, [x8, _MTHCA_ICM_ALLOC_SIZE@GOTPAGEOFF]
Lloh7:
	ldr	w0, [x8]
	bl	_get_order
	cmp	w28, #1
	b.lt	LBB0_21
; %bb.2:
	mov	x25, x0
	mov	x23, #0
	mov	w27, #1
	b	LBB0_6
LBB0_3:                                 ;   in Loop: Header=BB0_6 Depth=1
	ldr	x8, [x23, #16]
	ldr	x9, [x23]
	add	x0, x8, x9, lsl #2
	mov	x1, x26
	mov	x2, x22
	bl	_mthca_alloc_icm_pages
	cbz	w0, LBB0_13
LBB0_4:                                 ;   in Loop: Header=BB0_6 Depth=1
	cmp	w26, #1
	b.lt	LBB0_20
; %bb.5:                                ;   in Loop: Header=BB0_6 Depth=1
	cmp	w28, #0
	b.le	LBB0_17
LBB0_6:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_9 Depth 2
	cbnz	x23, LBB0_9
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
Lloh8:
	adrp	x8, ___GFP_HIGHMEM@GOTPAGE
Lloh9:
	ldr	x8, [x8, ___GFP_HIGHMEM@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
Lloh11:
	adrp	x9, ___GFP_NOWARN@GOTPAGE
Lloh12:
	ldr	x9, [x9, ___GFP_NOWARN@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
	orr	w8, w9, w8
	bic	w1, w22, w8
	mov	w0, #32
	bl	_kmalloc
	cbz	x0, LBB0_20
; %bb.8:                                ;   in Loop: Header=BB0_6 Depth=1
	mov	x23, x0
	ldr	x0, [x0, #16]
Lloh14:
	adrp	x8, _MTHCA_ICM_CHUNK_LEN@GOTPAGE
Lloh15:
	ldr	x8, [x8, _MTHCA_ICM_CHUNK_LEN@GOTPAGEOFF]
Lloh16:
	ldr	x1, [x8]
	bl	_sg_init_table
	add	x0, x23, #24
	stp	xzr, xzr, [x23]
	mov	x1, x21
	bl	_list_add_tail
LBB0_9:                                 ;   Parent Loop BB0_6 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	lsl	w8, w27, w25
	sub	w25, w25, #1
	subs	w24, w28, w8
	b.lt	LBB0_9
; %bb.10:                               ;   in Loop: Header=BB0_6 Depth=1
	add	w26, w25, #1
	cbz	w19, LBB0_3
; %bb.11:                               ;   in Loop: Header=BB0_6 Depth=1
	ldr	x0, [x20]
	ldr	x8, [x23, #16]
	ldr	x9, [x23]
	add	x1, x8, x9, lsl #2
	mov	x2, x26
	mov	x3, x22
	bl	_mthca_alloc_icm_coherent
	cbnz	w0, LBB0_4
; %bb.12:                               ;   in Loop: Header=BB0_6 Depth=1
	ldr	q0, [x23]
	dup.2d	v1, x27
	add.2d	v0, v0, v1
	str	q0, [x23]
	fmov	x2, d0
	b	LBB0_16
LBB0_13:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	x8, [x23]
	add	x2, x8, #1
	str	x2, [x23]
Lloh17:
	adrp	x8, _MTHCA_ICM_CHUNK_LEN@GOTPAGE
Lloh18:
	ldr	x8, [x8, _MTHCA_ICM_CHUNK_LEN@GOTPAGEOFF]
Lloh19:
	ldr	x8, [x8]
	cmp	x2, x8
	b.ne	LBB0_16
; %bb.14:                               ;   in Loop: Header=BB0_6 Depth=1
	ldr	x0, [x20]
	ldr	x1, [x23, #16]
Lloh20:
	adrp	x8, _PCI_DMA_BIDIRECTIONAL@GOTPAGE
Lloh21:
	ldr	x8, [x8, _PCI_DMA_BIDIRECTIONAL@GOTPAGEOFF]
Lloh22:
	ldr	w3, [x8]
	bl	_pci_map_sg
	str	x0, [x23, #8]
	cmp	x0, #1
	b.lt	LBB0_20
; %bb.15:                               ;   in Loop: Header=BB0_6 Depth=1
	ldr	x2, [x23]
LBB0_16:                                ;   in Loop: Header=BB0_6 Depth=1
Lloh23:
	adrp	x8, _MTHCA_ICM_CHUNK_LEN@GOTPAGE
Lloh24:
	ldr	x8, [x8, _MTHCA_ICM_CHUNK_LEN@GOTPAGEOFF]
Lloh25:
	ldr	x8, [x8]
	cmp	x2, x8
	csel	x23, xzr, x23, eq
	mov	x28, x24
	mov	x25, x26
	cmp	w28, #0
	b.gt	LBB0_6
LBB0_17:
	cbnz	w19, LBB0_21
; %bb.18:
	cbz	x23, LBB0_21
; %bb.19:
	ldr	x0, [x20]
	ldr	x1, [x23, #16]
	ldr	x2, [x23]
Lloh26:
	adrp	x8, _PCI_DMA_BIDIRECTIONAL@GOTPAGE
Lloh27:
	ldr	x8, [x8, _PCI_DMA_BIDIRECTIONAL@GOTPAGEOFF]
Lloh28:
	ldr	w3, [x8]
	bl	_pci_map_sg
	str	x0, [x23, #8]
	cmp	x0, #0
	b.gt	LBB0_21
LBB0_20:
	mov	x0, x20
	mov	x1, x21
	mov	x2, x19
	bl	_mthca_free_icm
	mov	x21, #0
LBB0_21:
	mov	x0, x21
	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
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.cfi_endproc
                                        ; -- End function
	.comm	___GFP_HIGHMEM,4,2              ; @__GFP_HIGHMEM
	.comm	___GFP_NOWARN,4,2               ; @__GFP_NOWARN
	.comm	_MTHCA_ICM_ALLOC_SIZE,4,2       ; @MTHCA_ICM_ALLOC_SIZE
	.comm	_MTHCA_ICM_CHUNK_LEN,8,3        ; @MTHCA_ICM_CHUNK_LEN
	.comm	_PCI_DMA_BIDIRECTIONAL,4,2      ; @PCI_DMA_BIDIRECTIONAL
.subsections_via_symbols
