	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function switchtec_ntb_direct_get_addr
_switchtec_ntb_direct_get_addr:         ## @switchtec_ntb_direct_get_addr
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rcx, %r14
	movq	(%rdi), %rax
	movslq	%esi, %rcx
	movl	(%rax,%rcx,4), %r15d
	testl	%r15d, %r15d
	js	LBB0_1
## %bb.2:
	movq	%rdx, %r12
	movq	%rdi, %r13
	testl	%esi, %esi
	je	LBB0_4
## %bb.3:
	xorl	%ebx, %ebx
	testq	%r12, %r12
	je	LBB0_7
LBB0_6:
	movl	16(%r13), %edi
	movl	%r15d, %esi
	callq	_pci_resource_start
	addq	%rbx, %rax
	movq	%rax, (%r12)
LBB0_7:
	xorl	%r12d, %r12d
	testq	%r14, %r14
	je	LBB0_9
## %bb.8:
	movl	16(%r13), %edi
	movl	%r15d, %esi
	callq	_pci_resource_len
	subq	%rbx, %rax
	cmpq	%rbx, %rax
	movq	%rax, %rcx
	cmovaq	%rbx, %rcx
	testq	%rbx, %rbx
	cmoveq	%rax, %rcx
	movq	%rcx, (%r14)
	movq	_max_mw_size@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rcx
	cmovaeq	%rax, %rcx
	movq	%rcx, (%r14)
	jmp	LBB0_9
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r12d, %r12d
	subl	(%rax), %r12d
LBB0_9:
	movl	%r12d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	movq	_LUT_SIZE@GOTPCREL(%rip), %rax
	movq	8(%r13), %rbx
	imulq	(%rax), %rbx
	testq	%r12, %r12
	jne	LBB0_6
	jmp	LBB0_7
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_LUT_SIZE,8,3                   ## @LUT_SIZE
	.comm	_max_mw_size,8,3                ## @max_mw_size
	.no_dead_strip	_switchtec_ntb_direct_get_addr
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function switchtec_ntb_direct_get_addr
_switchtec_ntb_direct_get_addr:         ; @switchtec_ntb_direct_get_addr
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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]
	ldr	w20, [x8, w1, sxtw #2]
	tbnz	w20, #31, LBB0_6
; %bb.1:
	mov	x19, x3
	mov	x22, x2
	mov	x21, x0
	cbz	w1, LBB0_7
; %bb.2:
	mov	x23, #0
	cbz	x22, LBB0_4
LBB0_3:
	ldr	w0, [x21, #16]
	mov	x1, x20
	bl	_pci_resource_start
	add	x8, x0, x23
	str	x8, [x22]
LBB0_4:
	cbz	x19, LBB0_8
; %bb.5:
	ldr	w0, [x21, #16]
	mov	x1, x20
	bl	_pci_resource_len
	mov	x8, x0
	mov	w0, #0
	sub	x8, x8, x23
	cmp	x8, x23
	ccmp	x23, #0, #4, hi
	csel	x8, x23, x8, ne
	str	x8, [x19]
Lloh0:
	adrp	x9, _max_mw_size@GOTPAGE
Lloh1:
	ldr	x9, [x9, _max_mw_size@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	csel	x8, x8, x9, lo
	str	x8, [x19]
	b	LBB0_9
LBB0_6:
Lloh3:
	adrp	x8, _EINVAL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_9
LBB0_7:
Lloh6:
	adrp	x8, _LUT_SIZE@GOTPAGE
Lloh7:
	ldr	x8, [x8, _LUT_SIZE@GOTPAGEOFF]
Lloh8:
	ldr	x8, [x8]
	ldr	x9, [x21, #8]
	mul	x23, x9, x8
	cbnz	x22, LBB0_3
	b	LBB0_4
LBB0_8:
	mov	w0, #0
LBB0_9:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_LUT_SIZE,8,3                   ; @LUT_SIZE
	.comm	_max_mw_size,8,3                ; @max_mw_size
	.no_dead_strip	_switchtec_ntb_direct_get_addr
.subsections_via_symbols
