	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ntb_msi_setup_mws              ## -- Begin function ntb_msi_setup_mws
	.p2align	4, 0x90
_ntb_msi_setup_mws:                     ## @ntb_msi_setup_mws
	.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
	cmpq	$0, (%rdi)
	je	LBB0_6
## %bb.1:
	movq	%rdi, %r13
	movq	_SZ_32K@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movq	8(%rdi), %rdi
	callq	_first_msi_entry
	movq	%r13, %rdi
	callq	_ntb_peer_port_count
	testl	%eax, %eax
	jle	LBB0_7
## %bb.2:
	xorl	%ebx, %ebx
	leaq	-56(%rbp), %r12
                                        ## implicit-def: $r15d
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r13, %rdi
	movl	%ebx, %esi
	callq	_ntb_peer_highest_mw_idx
	movl	%eax, %r14d
	testl	%eax, %eax
	js	LBB0_25
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	%r13, %rdi
	movl	%ebx, %esi
	movl	%r14d, %edx
	movq	%r12, %rcx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	_ntb_mw_get_align
	testl	%eax, %eax
	jne	LBB0_16
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	xorl	%eax, %eax
	subl	-56(%rbp), %eax
	andl	%eax, %r15d
	incl	%ebx
	movq	%r13, %rdi
	callq	_ntb_peer_port_count
	cmpl	%eax, %ebx
	jl	LBB0_3
	jmp	LBB0_8
LBB0_6:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	jmp	LBB0_25
LBB0_7:
                                        ## implicit-def: $r15d
LBB0_8:
	movq	%r13, %rdi
	callq	_ntb_peer_port_count
	testl	%eax, %eax
	jle	LBB0_14
## %bb.9:
	xorl	%r12d, %r12d
	movq	%r13, %rbx
	movl	-44(%rbp), %r13d                ## 4-byte Reload
	.p2align	4, 0x90
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	movq	%rbx, %rdi
	movl	%r12d, %esi
	callq	_ntb_peer_highest_mw_idx
	movl	%eax, %r14d
	testl	%eax, %eax
	js	LBB0_20
## %bb.11:                              ##   in Loop: Header=BB0_10 Depth=1
	movq	%rbx, %rdi
	movl	%r12d, %esi
	movl	%r14d, %edx
	xorl	%ecx, %ecx
	leaq	-52(%rbp), %r8
	leaq	-48(%rbp), %r9
	callq	_ntb_mw_get_align
	testl	%eax, %eax
	jne	LBB0_18
## %bb.12:                              ##   in Loop: Header=BB0_10 Depth=1
	movl	-52(%rbp), %esi
	movl	%r13d, %edi
	callq	_round_up
	movl	-48(%rbp), %esi
	movl	%eax, %edi
	callq	_max
	movl	%eax, %r13d
	movq	%rbx, %rdi
	movl	%r12d, %esi
	movl	%r14d, %edx
	movl	%r15d, %ecx
	movl	%eax, %r8d
	callq	_ntb_mw_set_trans
	testl	%eax, %eax
	jne	LBB0_19
## %bb.13:                              ##   in Loop: Header=BB0_10 Depth=1
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	cmpl	%eax, %r13d
	cmovll	%r13d, %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	incl	%r12d
	movq	%rbx, %rdi
	callq	_ntb_peer_port_count
	cmpl	%eax, %r12d
	jl	LBB0_10
	jmp	LBB0_15
LBB0_14:
	movq	%r13, %rbx
LBB0_15:
	movq	(%rbx), %rax
	movl	%r15d, (%rax)
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	addl	%r15d, %ecx
	movl	%ecx, 4(%rax)
	xorl	%r14d, %r14d
	jmp	LBB0_25
LBB0_16:
	movl	%eax, %r14d
	jmp	LBB0_25
LBB0_18:
	movq	%rbx, %r15
	movl	%eax, %r14d
	testl	%r12d, %r12d
	jne	LBB0_21
	jmp	LBB0_25
LBB0_19:
	movl	%eax, %r14d
LBB0_20:
	movq	%rbx, %r15
	testl	%r12d, %r12d
	je	LBB0_25
LBB0_21:
	xorl	%ebx, %ebx
	jmp	LBB0_23
	.p2align	4, 0x90
LBB0_22:                                ##   in Loop: Header=BB0_23 Depth=1
	incl	%ebx
	cmpl	%ebx, %r12d
	je	LBB0_25
LBB0_23:                                ## =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	movl	%r12d, %esi
	callq	_ntb_peer_highest_mw_idx
	testl	%eax, %eax
	js	LBB0_22
## %bb.24:                              ##   in Loop: Header=BB0_23 Depth=1
	movq	%r15, %rdi
	movl	%ebx, %esi
	movl	%eax, %edx
	callq	_ntb_mw_clear_trans
	jmp	LBB0_22
LBB0_25:
	movl	%r14d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SZ_32K,4,2                     ## @SZ_32K
	.comm	_EINVAL,4,2                     ## @EINVAL
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ntb_msi_setup_mws              ; -- Begin function ntb_msi_setup_mws
	.p2align	2
_ntb_msi_setup_mws:                     ; @ntb_msi_setup_mws
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	ldr	x8, [x0]
	cbz	x8, LBB0_6
; %bb.1:
	mov	x19, x0
Lloh0:
	adrp	x8, _SZ_32K@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SZ_32K@GOTPAGEOFF]
Lloh2:
	ldr	w24, [x8]
	ldr	x0, [x0, #8]
	bl	_first_msi_entry
	mov	x0, x19
	bl	_ntb_peer_port_count
	cmp	w0, #1
	b.lt	LBB0_7
; %bb.2:
	mov	w21, #0
                                        ; implicit-def: $w20
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x19
	mov	x1, x21
	bl	_ntb_peer_highest_mw_idx
	mov	x22, x0
	tbnz	w0, #31, LBB0_22
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	add	x3, sp, #12
	mov	x0, x19
	mov	x1, x21
	mov	x2, x22
	mov	x4, #0
	mov	x5, #0
	bl	_ntb_mw_get_align
	cbnz	w0, LBB0_15
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w8, [sp, #12]
	neg	w8, w8
	and	w20, w20, w8
	add	w21, w21, #1
	mov	x0, x19
	bl	_ntb_peer_port_count
	cmp	w21, w0
	b.lt	LBB0_3
	b	LBB0_8
LBB0_6:
Lloh3:
	adrp	x8, _EINVAL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	neg	w22, w8
	b	LBB0_22
LBB0_7:
                                        ; implicit-def: $w20
LBB0_8:
	mov	x0, x19
	bl	_ntb_peer_port_count
	cmp	w0, #1
	b.lt	LBB0_14
; %bb.9:
	mov	w21, #0
	mov	x23, x24
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x19
	mov	x1, x21
	bl	_ntb_peer_highest_mw_idx
	mov	x22, x0
	tbnz	w0, #31, LBB0_17
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=1
	add	x4, sp, #8
	add	x5, sp, #4
	mov	x0, x19
	mov	x1, x21
	mov	x2, x22
	mov	x3, #0
	bl	_ntb_mw_get_align
	cbnz	w0, LBB0_16
; %bb.12:                               ;   in Loop: Header=BB0_10 Depth=1
	ldr	w1, [sp, #8]
	mov	x0, x23
	bl	_round_up
	ldr	w1, [sp, #4]
	bl	_max
	mov	x23, x0
	mov	x0, x19
	mov	x1, x21
	mov	x2, x22
	mov	x3, x20
	mov	x4, x23
	bl	_ntb_mw_set_trans
	cbnz	w0, LBB0_16
; %bb.13:                               ;   in Loop: Header=BB0_10 Depth=1
	cmp	w23, w24
	csel	w24, w23, w24, lt
	add	w21, w21, #1
	mov	x0, x19
	bl	_ntb_peer_port_count
	cmp	w21, w0
	b.lt	LBB0_10
LBB0_14:
	mov	w22, #0
	ldr	x8, [x19]
	add	w9, w24, w20
	stp	w20, w9, [x8]
	b	LBB0_22
LBB0_15:
	mov	x22, x0
	b	LBB0_22
LBB0_16:
	mov	x22, x0
LBB0_17:
	cbz	w21, LBB0_22
; %bb.18:
	mov	w20, #0
	b	LBB0_20
LBB0_19:                                ;   in Loop: Header=BB0_20 Depth=1
	add	w20, w20, #1
	cmp	w21, w20
	b.eq	LBB0_22
LBB0_20:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x19
	mov	x1, x21
	bl	_ntb_peer_highest_mw_idx
	tbnz	w0, #31, LBB0_19
; %bb.21:                               ;   in Loop: Header=BB0_20 Depth=1
	mov	x2, x0
	mov	x0, x19
	mov	x1, x20
	bl	_ntb_mw_clear_trans
	b	LBB0_19
LBB0_22:
	mov	x0, x22
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_SZ_32K,4,2                     ; @SZ_32K
	.comm	_EINVAL,4,2                     ; @EINVAL
.subsections_via_symbols
