	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mlx4_mw_alloc                  ## -- Begin function mlx4_mw_alloc
	.p2align	4, 0x90
_mlx4_mw_alloc:                         ## @mlx4_mw_alloc
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rcx, %r14
	movl	%edx, %ebx
	movl	%esi, %r15d
	movq	_MLX4_MW_TYPE_1@GOTPCREL(%rip), %rax
	cmpl	%edx, (%rax)
	jne	LBB0_2
## %bb.1:
	movq	_MLX4_DEV_CAP_FLAG_MEM_WINDOW@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%rdi)
	je	LBB0_4
LBB0_2:
	movq	_MLX4_MW_TYPE_2@GOTPCREL(%rip), %rax
	cmpl	%ebx, (%rax)
	jne	LBB0_6
## %bb.3:
	movq	_MLX4_BMME_FLAG_TYPE_2_WIN@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 4(%rdi)
	je	LBB0_4
LBB0_6:
	callq	_mlx4_mpt_reserve
	cmpl	$-1, %eax
	je	LBB0_7
## %bb.8:
	movl	%eax, %edi
	callq	_hw_index_to_key
	movl	%eax, 12(%r14)
	movl	%r15d, (%r14)
	movl	%ebx, 4(%r14)
	movq	_MLX4_MPT_DISABLED@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 8(%r14)
	xorl	%eax, %eax
	jmp	LBB0_9
LBB0_4:
	movq	_EOPNOTSUPP@GOTPCREL(%rip), %rcx
	jmp	LBB0_5
LBB0_7:
	movq	_ENOMEM@GOTPCREL(%rip), %rcx
LBB0_5:
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_9:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MLX4_MW_TYPE_1,4,2             ## @MLX4_MW_TYPE_1
	.comm	_MLX4_DEV_CAP_FLAG_MEM_WINDOW,4,2 ## @MLX4_DEV_CAP_FLAG_MEM_WINDOW
	.comm	_MLX4_MW_TYPE_2,4,2             ## @MLX4_MW_TYPE_2
	.comm	_MLX4_BMME_FLAG_TYPE_2_WIN,4,2  ## @MLX4_BMME_FLAG_TYPE_2_WIN
	.comm	_EOPNOTSUPP,4,2                 ## @EOPNOTSUPP
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_MLX4_MPT_DISABLED,4,2          ## @MLX4_MPT_DISABLED
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mlx4_mw_alloc                  ; -- Begin function mlx4_mw_alloc
	.p2align	2
_mlx4_mw_alloc:                         ; @mlx4_mw_alloc
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x19, x3
	mov	x20, x2
	mov	x21, x1
Lloh0:
	adrp	x8, _MLX4_MW_TYPE_1@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MLX4_MW_TYPE_1@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w2
	b.ne	LBB0_2
; %bb.1:
	ldr	w8, [x0]
Lloh3:
	adrp	x9, _MLX4_DEV_CAP_FLAG_MEM_WINDOW@GOTPAGE
Lloh4:
	ldr	x9, [x9, _MLX4_DEV_CAP_FLAG_MEM_WINDOW@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_6
LBB0_2:
Lloh6:
	adrp	x8, _MLX4_MW_TYPE_2@GOTPAGE
Lloh7:
	ldr	x8, [x8, _MLX4_MW_TYPE_2@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	cmp	w8, w20
	b.ne	LBB0_4
; %bb.3:
	ldr	w8, [x0, #4]
Lloh9:
	adrp	x9, _MLX4_BMME_FLAG_TYPE_2_WIN@GOTPAGE
Lloh10:
	ldr	x9, [x9, _MLX4_BMME_FLAG_TYPE_2_WIN@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_6
LBB0_4:
	bl	_mlx4_mpt_reserve
	cmn	w0, #1
	b.eq	LBB0_7
; %bb.5:
	bl	_hw_index_to_key
	mov	x8, x0
	mov	w0, #0
	stp	w21, w20, [x19]
Lloh12:
	adrp	x9, _MLX4_MPT_DISABLED@GOTPAGE
Lloh13:
	ldr	x9, [x9, _MLX4_MPT_DISABLED@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	stp	w9, w8, [x19, #8]
	b	LBB0_9
LBB0_6:
Lloh15:
	adrp	x8, _EOPNOTSUPP@GOTPAGE
Lloh16:
	ldr	x8, [x8, _EOPNOTSUPP@GOTPAGEOFF]
	b	LBB0_8
LBB0_7:
Lloh17:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh18:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
LBB0_8:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_9:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.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 AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.comm	_MLX4_MW_TYPE_1,4,2             ; @MLX4_MW_TYPE_1
	.comm	_MLX4_DEV_CAP_FLAG_MEM_WINDOW,4,2 ; @MLX4_DEV_CAP_FLAG_MEM_WINDOW
	.comm	_MLX4_MW_TYPE_2,4,2             ; @MLX4_MW_TYPE_2
	.comm	_MLX4_BMME_FLAG_TYPE_2_WIN,4,2  ; @MLX4_BMME_FLAG_TYPE_2_WIN
	.comm	_EOPNOTSUPP,4,2                 ; @EOPNOTSUPP
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_MLX4_MPT_DISABLED,4,2          ; @MLX4_MPT_DISABLED
.subsections_via_symbols
