	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal16,16byte_literals
	.p2align	4                               ## -- Begin function mlx4_alloc_icm
LCPI0_0:
	.space	16,255
	.section	__TEXT,__text,regular,pure_instructions
	.globl	_mlx4_alloc_icm
	.p2align	4, 0x90
_mlx4_alloc_icm:                        ## @mlx4_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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r15d
	movl	%esi, %ebx
	movq	%rdi, %r14
	movl	%ecx, -44(%rbp)                 ## 4-byte Spill
	testl	%ecx, %ecx
	setne	%al
	movq	___GFP_HIGHMEM@GOTPCREL(%rip), %r12
	movl	(%r12), %ecx
	andl	%edx, %ecx
	setne	%cl
	andb	%al, %cl
	movzbl	%cl, %edi
	callq	_BUG_ON
	movq	___GFP_NOWARN@GOTPCREL(%rip), %r13
	movl	(%r13), %esi
	orl	(%r12), %esi
	notl	%esi
	andl	%r15d, %esi
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	movl	8(%r14), %edx
	movl	$16, %edi
	callq	_kmalloc_node
	testq	%rax, %rax
	jne	LBB0_2
## %bb.1:
	movl	(%r13), %esi
	orl	(%r12), %esi
	notl	%esi
	andl	%r15d, %esi
	movl	$16, %edi
	callq	_kmalloc
	testq	%rax, %rax
	je	LBB0_19
LBB0_2:
	movl	%r15d, -48(%rbp)                ## 4-byte Spill
	movq	$0, 8(%rax)
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movq	%rax, %rdi
	callq	_INIT_LIST_HEAD
	movq	_MLX4_ICM_ALLOC_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_get_order
	movl	%eax, %r14d
	xorl	%r12d, %r12d
	xorl	%eax, %eax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
LBB0_3:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_4 Depth 2
                                        ##       Child Loop BB0_12 Depth 3
	movl	%ebx, %r15d
	movl	%r14d, %r13d
	jmp	LBB0_4
	.p2align	4, 0x90
LBB0_16:                                ##   in Loop: Header=BB0_4 Depth=2
	movq	8(%r12), %rdi
	shlq	$2, %rdi
	addq	24(%r12), %rdi
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movl	8(%rax), %eax
	movl	%r14d, %esi
	movl	%ecx, %edx
	movl	%eax, %ecx
	callq	_mlx4_alloc_icm_pages
	testl	%eax, %eax
	je	LBB0_20
LBB0_17:                                ##   in Loop: Header=BB0_4 Depth=2
	testl	%r14d, %r14d
	jle	LBB0_18
LBB0_4:                                 ##   Parent Loop BB0_3 Depth=1
                                        ## =>  This Loop Header: Depth=2
                                        ##       Child Loop BB0_12 Depth 3
	testl	%r15d, %r15d
	jle	LBB0_24
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=2
	testq	%r12, %r12
	jne	LBB0_11
## %bb.6:                               ##   in Loop: Header=BB0_4 Depth=2
	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
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movl	8(%rax), %edx
	movl	$48, %edi
	callq	_kzalloc_node
	movq	%rax, %r12
	testq	%rax, %rax
	jne	LBB0_8
## %bb.7:                               ##   in Loop: Header=BB0_4 Depth=2
	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	$48, %edi
	callq	_kzalloc
	movq	%rax, %r12
	testq	%rax, %rax
	je	LBB0_18
LBB0_8:                                 ##   in Loop: Header=BB0_4 Depth=2
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	movl	%eax, (%r12)
	testl	%eax, %eax
	jne	LBB0_10
## %bb.9:                               ##   in Loop: Header=BB0_4 Depth=2
	movq	24(%r12), %rdi
	movq	_MLX4_ICM_CHUNK_LEN@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	callq	_sg_init_table
LBB0_10:                                ##   in Loop: Header=BB0_4 Depth=2
	leaq	40(%r12), %rdi
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	callq	_list_add_tail
LBB0_11:                                ##   in Loop: Header=BB0_4 Depth=2
	incl	%r13d
	movl	%r13d, %r14d
	.p2align	4, 0x90
LBB0_12:                                ##   Parent Loop BB0_3 Depth=1
                                        ##     Parent Loop BB0_4 Depth=2
                                        ## =>    This Inner Loop Header: Depth=3
	decl	%r14d
	movl	$1, %eax
	movl	%r14d, %ecx
	shll	%cl, %eax
	movl	%r15d, %ebx
	subl	%eax, %ebx
	jl	LBB0_12
## %bb.13:                              ##   in Loop: Header=BB0_4 Depth=2
	movl	%r14d, %r13d
	subl	$1, %r13d
	movq	___GFP_DIRECT_RECLAIM@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	notl	%ecx
	movl	$-1, %eax
	cmovbl	%eax, %ecx
	andl	-48(%rbp), %ecx                 ## 4-byte Folded Reload
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_16
## %bb.14:                              ##   in Loop: Header=BB0_4 Depth=2
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rax
	movq	(%rax), %rdi
	movq	8(%r12), %rsi
	shlq	$2, %rsi
	addq	32(%r12), %rsi
	movl	%r14d, %edx
	callq	_mlx4_alloc_icm_coherent
	testl	%eax, %eax
	jne	LBB0_17
## %bb.15:                              ##   in Loop: Header=BB0_3 Depth=1
	movdqu	8(%r12), %xmm0
	psubq	LCPI0_0(%rip), %xmm0
	movdqu	%xmm0, 8(%r12)
	movq	%xmm0, %rdx
	jmp	LBB0_23
LBB0_20:                                ##   in Loop: Header=BB0_3 Depth=1
	movq	8(%r12), %rdx
	incq	%rdx
	movq	%rdx, 8(%r12)
	movq	_MLX4_ICM_CHUNK_LEN@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rdx
	jne	LBB0_23
## %bb.21:                              ##   in Loop: Header=BB0_3 Depth=1
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rax
	movq	(%rax), %rdi
	movq	24(%r12), %rsi
	movq	_DMA_BIDIRECTIONAL@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	callq	_dma_map_sg
	movq	%rax, 16(%r12)
	testq	%rax, %rax
	jle	LBB0_18
## %bb.22:                              ##   in Loop: Header=BB0_3 Depth=1
	movq	8(%r12), %rdx
	.p2align	4, 0x90
LBB0_23:                                ##   in Loop: Header=BB0_3 Depth=1
	movq	_MLX4_ICM_CHUNK_LEN@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rdx
	movl	$0, %eax
	cmoveq	%rax, %r12
	movq	%r12, %rax
	movq	%r12, -72(%rbp)                 ## 8-byte Spill
	jmp	LBB0_3
LBB0_24:
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	jne	LBB0_27
## %bb.25:
	movq	-72(%rbp), %rbx                 ## 8-byte Reload
	testq	%rbx, %rbx
	je	LBB0_27
## %bb.26:
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rax
	movq	(%rax), %rdi
	movq	8(%rbx), %rdx
	movq	24(%rbx), %rsi
	movq	_DMA_BIDIRECTIONAL@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	callq	_dma_map_sg
	movq	%rax, 16(%rbx)
	testq	%rax, %rax
	jg	LBB0_27
LBB0_18:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	callq	_mlx4_free_icm
LBB0_19:
	xorl	%eax, %eax
	jmp	LBB0_28
LBB0_27:
	movq	-64(%rbp), %rax                 ## 8-byte Reload
LBB0_28:
	addq	$40, %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	_MLX4_ICM_ALLOC_SIZE,4,2        ## @MLX4_ICM_ALLOC_SIZE
	.comm	_MLX4_ICM_CHUNK_LEN,8,3         ## @MLX4_ICM_CHUNK_LEN
	.comm	___GFP_DIRECT_RECLAIM,4,2       ## @__GFP_DIRECT_RECLAIM
	.comm	_DMA_BIDIRECTIONAL,4,2          ## @DMA_BIDIRECTIONAL
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mlx4_alloc_icm                 ; -- Begin function mlx4_alloc_icm
	.p2align	2
_mlx4_alloc_icm:                        ; @mlx4_alloc_icm
	.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	x19, x3
	mov	x22, x2
	mov	x27, x1
	mov	x20, x0
Lloh0:
	adrp	x23, ___GFP_HIGHMEM@GOTPAGE
Lloh1:
	ldr	x23, [x23, ___GFP_HIGHMEM@GOTPAGEOFF]
	ldr	w8, [x23]
	tst	w8, w2
	ccmp	w3, #0, #4, ne
	cset	w0, ne
	bl	_BUG_ON
	ldr	w8, [x23]
Lloh2:
	adrp	x24, ___GFP_NOWARN@GOTPAGE
Lloh3:
	ldr	x24, [x24, ___GFP_NOWARN@GOTPAGEOFF]
	ldr	w9, [x24]
	orr	w8, w9, w8
	bic	w1, w22, w8
	ldr	w2, [x20, #8]
	mov	w0, #16
	bl	_kmalloc_node
	mov	x21, x0
	cbnz	x0, LBB0_2
; %bb.1:
	ldr	w8, [x23]
	ldr	w9, [x24]
	orr	w8, w9, w8
	bic	w1, w22, w8
	mov	w0, #16
	bl	_kmalloc
	mov	x21, x0
	cbz	x0, LBB0_26
LBB0_2:
	str	xzr, [x21, #8]
	mov	x0, x21
	bl	_INIT_LIST_HEAD
Lloh4:
	adrp	x8, _MLX4_ICM_ALLOC_SIZE@GOTPAGE
Lloh5:
	ldr	x8, [x8, _MLX4_ICM_ALLOC_SIZE@GOTPAGEOFF]
Lloh6:
	ldr	w0, [x8]
	bl	_get_order
	mov	x25, x0
	mov	x24, #0
	mov	w28, #1
	mov	w26, #-1
LBB0_3:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_6 Depth 2
                                        ;       Child Loop BB0_14 Depth 3
	str	x24, [sp, #8]                   ; 8-byte Folded Spill
	mov	x23, x25
	b	LBB0_6
LBB0_4:                                 ;   in Loop: Header=BB0_6 Depth=2
	ldr	x8, [x24, #24]
	ldr	x9, [x24, #8]
	add	x0, x8, x9, lsl #2
	ldr	w8, [x20, #8]
	mov	x1, x25
	mov	x2, x3
	mov	x3, x8
	bl	_mlx4_alloc_icm_pages
	cbz	w0, LBB0_18
LBB0_5:                                 ;   in Loop: Header=BB0_6 Depth=2
	sub	w23, w25, #1
	cmp	w25, #1
	b.lt	LBB0_25
LBB0_6:                                 ;   Parent Loop BB0_3 Depth=1
                                        ; =>  This Loop Header: Depth=2
                                        ;       Child Loop BB0_14 Depth 3
	cmp	w27, #1
	b.lt	LBB0_22
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=2
	cbnz	x24, LBB0_13
; %bb.8:                                ;   in Loop: Header=BB0_6 Depth=2
Lloh7:
	adrp	x8, ___GFP_HIGHMEM@GOTPAGE
Lloh8:
	ldr	x8, [x8, ___GFP_HIGHMEM@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
Lloh10:
	adrp	x9, ___GFP_NOWARN@GOTPAGE
Lloh11:
	ldr	x9, [x9, ___GFP_NOWARN@GOTPAGEOFF]
Lloh12:
	ldr	w9, [x9]
	orr	w8, w9, w8
	bic	w1, w22, w8
	ldr	w2, [x20, #8]
	mov	w0, #48
	bl	_kzalloc_node
	mov	x24, x0
	cbnz	x0, LBB0_10
; %bb.9:                                ;   in Loop: Header=BB0_6 Depth=2
Lloh13:
	adrp	x8, ___GFP_HIGHMEM@GOTPAGE
Lloh14:
	ldr	x8, [x8, ___GFP_HIGHMEM@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
Lloh16:
	adrp	x9, ___GFP_NOWARN@GOTPAGE
Lloh17:
	ldr	x9, [x9, ___GFP_NOWARN@GOTPAGEOFF]
Lloh18:
	ldr	w9, [x9]
	orr	w8, w9, w8
	bic	w1, w22, w8
	mov	w0, #48
	bl	_kzalloc
	mov	x24, x0
	cbz	x0, LBB0_25
LBB0_10:                                ;   in Loop: Header=BB0_6 Depth=2
	str	w19, [x24]
	cbnz	w19, LBB0_12
; %bb.11:                               ;   in Loop: Header=BB0_6 Depth=2
	ldr	x0, [x24, #24]
Lloh19:
	adrp	x8, _MLX4_ICM_CHUNK_LEN@GOTPAGE
Lloh20:
	ldr	x8, [x8, _MLX4_ICM_CHUNK_LEN@GOTPAGEOFF]
Lloh21:
	ldr	x1, [x8]
	bl	_sg_init_table
LBB0_12:                                ;   in Loop: Header=BB0_6 Depth=2
	add	x0, x24, #40
	mov	x1, x21
	bl	_list_add_tail
LBB0_13:                                ;   in Loop: Header=BB0_6 Depth=2
	add	w25, w23, #1
LBB0_14:                                ;   Parent Loop BB0_3 Depth=1
                                        ;     Parent Loop BB0_6 Depth=2
                                        ; =>    This Inner Loop Header: Depth=3
	sub	w25, w25, #1
	lsl	w8, w28, w25
	subs	w23, w27, w8
	b.lt	LBB0_14
; %bb.15:                               ;   in Loop: Header=BB0_6 Depth=2
Lloh22:
	adrp	x8, ___GFP_DIRECT_RECLAIM@GOTPAGE
Lloh23:
	ldr	x8, [x8, ___GFP_DIRECT_RECLAIM@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
	cmp	w25, #0
	csinv	w8, w26, w8, eq
	and	w3, w8, w22
	cbz	w19, LBB0_4
; %bb.16:                               ;   in Loop: Header=BB0_6 Depth=2
	ldr	x8, [x20]
	ldr	x0, [x8]
	ldr	x8, [x24, #32]
	ldr	x9, [x24, #8]
	add	x1, x8, x9, lsl #2
	mov	x2, x25
	bl	_mlx4_alloc_icm_coherent
	cbnz	w0, LBB0_5
; %bb.17:                               ;   in Loop: Header=BB0_3 Depth=1
	ldur	q0, [x24, #8]
	dup.2d	v1, x28
	add.2d	v0, v0, v1
	stur	q0, [x24, #8]
	fmov	x2, d0
	b	LBB0_21
LBB0_18:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	x8, [x24, #8]
	add	x2, x8, #1
	str	x2, [x24, #8]
Lloh25:
	adrp	x8, _MLX4_ICM_CHUNK_LEN@GOTPAGE
Lloh26:
	ldr	x8, [x8, _MLX4_ICM_CHUNK_LEN@GOTPAGEOFF]
Lloh27:
	ldr	x8, [x8]
	cmp	x2, x8
	b.ne	LBB0_21
; %bb.19:                               ;   in Loop: Header=BB0_3 Depth=1
	ldr	x8, [x20]
	ldr	x0, [x8]
	ldr	x1, [x24, #24]
Lloh28:
	adrp	x8, _DMA_BIDIRECTIONAL@GOTPAGE
Lloh29:
	ldr	x8, [x8, _DMA_BIDIRECTIONAL@GOTPAGEOFF]
Lloh30:
	ldr	w3, [x8]
	bl	_dma_map_sg
	str	x0, [x24, #16]
	cmp	x0, #1
	b.lt	LBB0_25
; %bb.20:                               ;   in Loop: Header=BB0_3 Depth=1
	ldr	x2, [x24, #8]
LBB0_21:                                ;   in Loop: Header=BB0_3 Depth=1
Lloh31:
	adrp	x8, _MLX4_ICM_CHUNK_LEN@GOTPAGE
Lloh32:
	ldr	x8, [x8, _MLX4_ICM_CHUNK_LEN@GOTPAGEOFF]
Lloh33:
	ldr	x8, [x8]
	cmp	x2, x8
	csel	x24, xzr, x24, eq
	mov	x27, x23
	b	LBB0_3
LBB0_22:
	cbnz	w19, LBB0_26
; %bb.23:
	ldr	x22, [sp, #8]                   ; 8-byte Folded Reload
	cbz	x22, LBB0_26
; %bb.24:
	ldr	x8, [x20]
	ldr	x0, [x8]
	ldr	x1, [x22, #24]
	ldr	x2, [x22, #8]
Lloh34:
	adrp	x8, _DMA_BIDIRECTIONAL@GOTPAGE
Lloh35:
	ldr	x8, [x8, _DMA_BIDIRECTIONAL@GOTPAGEOFF]
Lloh36:
	ldr	w3, [x8]
	bl	_dma_map_sg
	str	x0, [x22, #16]
	cmp	x0, #0
	b.gt	LBB0_26
LBB0_25:
	mov	x0, x20
	mov	x1, x21
	mov	x2, x19
	bl	_mlx4_free_icm
	mov	x21, #0
LBB0_26:
	mov	x0, x21
	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 AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.cfi_endproc
                                        ; -- End function
	.comm	___GFP_HIGHMEM,4,2              ; @__GFP_HIGHMEM
	.comm	___GFP_NOWARN,4,2               ; @__GFP_NOWARN
	.comm	_MLX4_ICM_ALLOC_SIZE,4,2        ; @MLX4_ICM_ALLOC_SIZE
	.comm	_MLX4_ICM_CHUNK_LEN,8,3         ; @MLX4_ICM_CHUNK_LEN
	.comm	___GFP_DIRECT_RECLAIM,4,2       ; @__GFP_DIRECT_RECLAIM
	.comm	_DMA_BIDIRECTIONAL,4,2          ; @DMA_BIDIRECTIONAL
.subsections_via_symbols
