	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function switchtec_ntb_init_crosslink
_switchtec_ntb_init_crosslink:          ## @switchtec_ntb_init_crosslink
	.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
	movq	%rdi, %rbx
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	(%rdi), %rax
	movl	(%rax), %r14d
	callq	_crosslink_is_enabled
	movl	%eax, %ecx
	xorl	%eax, %eax
	testl	%ecx, %ecx
	je	LBB0_10
## %bb.1:
	movq	40(%rbx), %rdi
	addq	$4, %rdi
	leaq	L_.str(%rip), %rsi
	callq	_dev_info
	movq	_NTB_TOPO_CROSSLINK@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 56(%rbx)
	leaq	-80(%rbp), %rsi
	movq	%rbx, %rdi
	callq	_crosslink_enum_partition
	cmpl	8(%rbx), %eax
	jle	LBB0_2
## %bb.3:
	movl	%eax, %r15d
	movq	_SWITCHTEC_GAS_NTB_OFFSET@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	-80(%rbp), %eax
	movq	_SWITCHTEC_NTB_REG_DBMSG_OFFSET@GOTPCREL(%rip), %rcx
	addl	(%rcx), %eax
	movl	12(%rbx), %ecx
	movl	52(%rbx), %esi
	leal	(%rax,%rcx,4), %eax
	movq	_LUT_SIZE@GOTPCREL(%rip), %r13
	movslq	(%r13), %r12
	decq	%r12
	movslq	%eax, %r8
	andq	%r8, %r12
	subl	%r12d, %r8d
	movq	%rbx, %rdi
	movl	$1, %edx
                                        ## kill: def $ecx killed $ecx killed $rcx
                                        ## kill: def $r8d killed $r8d killed $r8
	callq	_config_rsvd_lut_win
	testl	%eax, %eax
	jne	LBB0_10
## %bb.4:
	leaq	-76(%rbp), %rdx
	decl	%r15d
	movq	%rbx, %rdi
	movl	$1, %esi
	movl	%r15d, %ecx
	callq	_crosslink_setup_mws
	testl	%eax, %eax
	jne	LBB0_10
## %bb.5:
	movl	48(%rbx), %esi
	movq	%rbx, %rdi
	callq	_crosslink_setup_req_ids
	testl	%eax, %eax
	jne	LBB0_10
## %bb.6:
	movq	40(%rbx), %rax
	movl	(%rax), %edi
	movl	(%r13), %ecx
	movl	%r14d, %esi
	movl	%ecx, %edx
	callq	_pci_iomap_range
	movq	%rax, 24(%rbx)
	testq	%rax, %rax
	je	LBB0_7
## %bb.9:
	addq	%r12, %rax
	movq	%rax, 32(%rbx)
	incl	16(%rbx)
	movq	%rbx, %rdi
	callq	_crosslink_init_dbmsgs
	xorl	%eax, %eax
	jmp	LBB0_10
LBB0_2:
	movq	40(%rbx), %rdi
	addq	$4, %rdi
	leaq	L_.str.1(%rip), %rsi
	callq	_dev_err
	movq	_EINVAL@GOTPCREL(%rip), %rcx
LBB0_8:
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_10:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	-48(%rbp), %rcx
	jne	LBB0_12
## %bb.11:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	movq	_ENOMEM@GOTPCREL(%rip), %rcx
	jmp	LBB0_8
LBB0_12:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Using crosslink configuration\n"

	.comm	_NTB_TOPO_CROSSLINK,4,2         ## @NTB_TOPO_CROSSLINK
L_.str.1:                               ## @.str.1
	.asciz	"Error enumerating crosslink partition\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_SWITCHTEC_GAS_NTB_OFFSET,4,2   ## @SWITCHTEC_GAS_NTB_OFFSET
	.comm	_SWITCHTEC_NTB_REG_DBMSG_OFFSET,4,2 ## @SWITCHTEC_NTB_REG_DBMSG_OFFSET
	.comm	_LUT_SIZE,4,2                   ## @LUT_SIZE
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.no_dead_strip	_switchtec_ntb_init_crosslink
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function switchtec_ntb_init_crosslink
_switchtec_ntb_init_crosslink:          ; @switchtec_ntb_init_crosslink
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	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
	mov	x19, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #24]
	ldr	x8, [x0]
	ldr	w20, [x8]
	bl	_crosslink_is_enabled
	cbz	w0, LBB0_9
; %bb.1:
	ldr	x8, [x19, #40]
	add	x0, x8, #4
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_info
Lloh5:
	adrp	x8, _NTB_TOPO_CROSSLINK@GOTPAGE
Lloh6:
	ldr	x8, [x8, _NTB_TOPO_CROSSLINK@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	str	w8, [x19, #56]
	mov	x1, sp
	mov	x0, x19
	bl	_crosslink_enum_partition
	ldr	w8, [x19, #8]
	cmp	w0, w8
	b.le	LBB0_7
; %bb.2:
	mov	x21, x0
	ldr	w8, [sp]
Lloh8:
	adrp	x9, _SWITCHTEC_GAS_NTB_OFFSET@GOTPAGE
Lloh9:
	ldr	x9, [x9, _SWITCHTEC_GAS_NTB_OFFSET@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
Lloh11:
	adrp	x10, _SWITCHTEC_NTB_REG_DBMSG_OFFSET@GOTPAGE
Lloh12:
	ldr	x10, [x10, _SWITCHTEC_NTB_REG_DBMSG_OFFSET@GOTPAGEOFF]
Lloh13:
	ldr	w10, [x10]
	add	w8, w9, w8
	add	w8, w8, w10
	ldr	w3, [x19, #12]
	add	w8, w8, w3, lsl #2
Lloh14:
	adrp	x23, _LUT_SIZE@GOTPAGE
Lloh15:
	ldr	x23, [x23, _LUT_SIZE@GOTPAGEOFF]
	ldrsw	x9, [x23]
	sub	x9, x9, #1
	sxtw	x10, w8
	and	x22, x10, x9
	sub	w4, w8, w22
	ldr	w1, [x19, #52]
	mov	x0, x19
	mov	w2, #1
	bl	_config_rsvd_lut_win
	cbnz	w0, LBB0_9
; %bb.3:
	mov	x8, sp
	add	x2, x8, #4
	sub	w3, w21, #1
	mov	x0, x19
	mov	w1, #1
	bl	_crosslink_setup_mws
	cbnz	w0, LBB0_9
; %bb.4:
	ldr	w1, [x19, #48]
	mov	x0, x19
	bl	_crosslink_setup_req_ids
	cbnz	w0, LBB0_9
; %bb.5:
	ldr	x8, [x19, #40]
	ldr	w0, [x8]
	ldr	w2, [x23]
	mov	x1, x20
	mov	x3, x2
	bl	_pci_iomap_range
	str	x0, [x19, #24]
	cbz	x0, LBB0_11
; %bb.6:
	add	x8, x0, x22
	str	x8, [x19, #32]
	ldr	w8, [x19, #16]
	add	w8, w8, #1
	str	w8, [x19, #16]
	mov	x0, x19
	bl	_crosslink_init_dbmsgs
	mov	w0, #0
	b	LBB0_9
LBB0_7:
	ldr	x8, [x19, #40]
	add	x0, x8, #4
Lloh16:
	adrp	x1, l_.str.1@PAGE
Lloh17:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
Lloh18:
	adrp	x8, _EINVAL@GOTPAGE
Lloh19:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_8:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_9:
	ldr	x8, [sp, #24]
Lloh20:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh21:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh22:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_12
; %bb.10:
	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
	add	sp, sp, #96
	ret
LBB0_11:
Lloh23:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh24:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_8
LBB0_12:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Using crosslink configuration\n"

	.comm	_NTB_TOPO_CROSSLINK,4,2         ; @NTB_TOPO_CROSSLINK
l_.str.1:                               ; @.str.1
	.asciz	"Error enumerating crosslink partition\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_SWITCHTEC_GAS_NTB_OFFSET,4,2   ; @SWITCHTEC_GAS_NTB_OFFSET
	.comm	_SWITCHTEC_NTB_REG_DBMSG_OFFSET,4,2 ; @SWITCHTEC_NTB_REG_DBMSG_OFFSET
	.comm	_LUT_SIZE,4,2                   ; @LUT_SIZE
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.no_dead_strip	_switchtec_ntb_init_crosslink
.subsections_via_symbols
