	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function switchtec_ntb_add
_switchtec_ntb_add:                     ## @switchtec_ntb_add
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	callq	_to_stdev
	movq	%rax, %r12
	movq	$0, 8(%rax)
	movq	16(%rax), %rax
	movq	_PCI_CLASS_BRIDGE_OTHER@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	shll	$8, %ecx
	cmpl	%ecx, (%rax)
	jne	LBB0_1
## %bb.3:
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movq	%r14, %rdi
	callq	_dev_to_node
	movl	$16, %edi
	movl	%ebx, %esi
	movl	%eax, %edx
	callq	_kzalloc_node
	testq	%rax, %rax
	je	LBB0_4
## %bb.5:
	movq	%rax, %r15
	movq	%r12, 8(%rax)
	movq	%rax, %rdi
	callq	_switchtec_ntb_init_sndev
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_15
## %bb.6:
	movq	%r15, %rdi
	callq	_switchtec_ntb_init_mw
	movq	%r15, %rdi
	callq	_switchtec_ntb_init_req_id_table
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_15
## %bb.7:
	movq	%r15, %rdi
	callq	_switchtec_ntb_init_crosslink
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_15
## %bb.8:
	movq	%r15, %rdi
	callq	_switchtec_ntb_init_db
	movq	%r15, %rdi
	callq	_switchtec_ntb_init_msgs
	movq	%r15, %rdi
	callq	_switchtec_ntb_init_shared_mw
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_14
## %bb.9:
	movq	%r15, %rdi
	callq	_switchtec_ntb_init_db_msg_irq
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_13
## %bb.10:
	movq	_LINK_MESSAGE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_MSG_LINK_FORCE_DOWN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	callq	_switchtec_ntb_send_msg
	movq	%r15, %rdi
	callq	_ntb_register_device
	testl	%eax, %eax
	je	LBB0_11
## %bb.12:
	movl	%eax, %ebx
	movq	%r15, %rdi
	callq	_switchtec_ntb_deinit_db_msg_irq
LBB0_13:
	movq	%r15, %rdi
	callq	_switchtec_ntb_deinit_shared_mw
LBB0_14:
	movq	%r15, %rdi
	callq	_switchtec_ntb_deinit_crosslink
LBB0_15:
	movq	%r15, %rdi
	callq	_kfree
	leaq	L_.str.1(%rip), %rsi
	movq	%r14, %rdi
	movl	%ebx, %edx
	callq	_dev_err
	jmp	LBB0_16
LBB0_1:
	movq	_ENODEV@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_4:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
LBB0_2:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_16:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_11:
	movq	%r15, 8(%r12)
	movq	_switchtec_ntb_link_notification@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%r12)
	leaq	L_.str(%rip), %rsi
	movq	%r14, %rdi
	callq	_dev_info
	xorl	%ebx, %ebx
	jmp	LBB0_16
	.cfi_endproc
                                        ## -- End function
	.comm	_PCI_CLASS_BRIDGE_OTHER,4,2     ## @PCI_CLASS_BRIDGE_OTHER
	.comm	_ENODEV,4,2                     ## @ENODEV
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_LINK_MESSAGE,4,2               ## @LINK_MESSAGE
	.comm	_MSG_LINK_FORCE_DOWN,4,2        ## @MSG_LINK_FORCE_DOWN
	.comm	_switchtec_ntb_link_notification,4,2 ## @switchtec_ntb_link_notification
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"NTB device registered\n"

L_.str.1:                               ## @.str.1
	.asciz	"failed to register ntb device: %d\n"

	.no_dead_strip	_switchtec_ntb_add
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function switchtec_ntb_add
_switchtec_ntb_add:                     ; @switchtec_ntb_add
	.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, x0
	bl	_to_stdev
	str	xzr, [x0, #8]
	ldr	x8, [x0, #16]
	ldr	w8, [x8]
Lloh0:
	adrp	x9, _PCI_CLASS_BRIDGE_OTHER@GOTPAGE
Lloh1:
	ldr	x9, [x9, _PCI_CLASS_BRIDGE_OTHER@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	cmp	w8, w9, lsl #8
	b.ne	LBB0_12
; %bb.1:
	mov	x20, x0
Lloh3:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh5:
	ldr	w21, [x8]
	mov	x0, x19
	bl	_dev_to_node
	mov	x2, x0
	mov	w0, #16
	mov	x1, x21
	bl	_kzalloc_node
	cbz	x0, LBB0_13
; %bb.2:
	mov	x21, x0
	str	x20, [x0, #8]
	bl	_switchtec_ntb_init_sndev
	mov	x22, x0
	cbnz	w0, LBB0_11
; %bb.3:
	mov	x0, x21
	bl	_switchtec_ntb_init_mw
	mov	x0, x21
	bl	_switchtec_ntb_init_req_id_table
	mov	x22, x0
	cbnz	w0, LBB0_11
; %bb.4:
	mov	x0, x21
	bl	_switchtec_ntb_init_crosslink
	mov	x22, x0
	cbnz	w0, LBB0_11
; %bb.5:
	mov	x0, x21
	bl	_switchtec_ntb_init_db
	mov	x0, x21
	bl	_switchtec_ntb_init_msgs
	mov	x0, x21
	bl	_switchtec_ntb_init_shared_mw
	mov	x22, x0
	cbnz	w0, LBB0_10
; %bb.6:
	mov	x0, x21
	bl	_switchtec_ntb_init_db_msg_irq
	mov	x22, x0
	cbnz	w0, LBB0_9
; %bb.7:
Lloh6:
	adrp	x8, _LINK_MESSAGE@GOTPAGE
Lloh7:
	ldr	x8, [x8, _LINK_MESSAGE@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
Lloh9:
	adrp	x8, _MSG_LINK_FORCE_DOWN@GOTPAGE
Lloh10:
	ldr	x8, [x8, _MSG_LINK_FORCE_DOWN@GOTPAGEOFF]
Lloh11:
	ldr	w2, [x8]
	mov	x0, x21
	bl	_switchtec_ntb_send_msg
	mov	x0, x21
	bl	_ntb_register_device
	mov	x22, x0
	cbz	w0, LBB0_16
; %bb.8:
	mov	x0, x21
	bl	_switchtec_ntb_deinit_db_msg_irq
LBB0_9:
	mov	x0, x21
	bl	_switchtec_ntb_deinit_shared_mw
LBB0_10:
	mov	x0, x21
	bl	_switchtec_ntb_deinit_crosslink
LBB0_11:
	mov	x0, x21
	bl	_kfree
Lloh12:
	adrp	x1, l_.str.1@PAGE
Lloh13:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x19
	mov	x2, x22
	bl	_dev_err
	b	LBB0_15
LBB0_12:
Lloh14:
	adrp	x8, _ENODEV@GOTPAGE
Lloh15:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
	b	LBB0_14
LBB0_13:
Lloh16:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh17:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
LBB0_14:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_15:
	mov	x0, x22
	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
LBB0_16:
	str	x21, [x20, #8]
Lloh18:
	adrp	x8, _switchtec_ntb_link_notification@GOTPAGE
Lloh19:
	ldr	x8, [x8, _switchtec_ntb_link_notification@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	str	w8, [x20]
Lloh21:
	adrp	x1, l_.str@PAGE
Lloh22:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	bl	_dev_info
	b	LBB0_15
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_PCI_CLASS_BRIDGE_OTHER,4,2     ; @PCI_CLASS_BRIDGE_OTHER
	.comm	_ENODEV,4,2                     ; @ENODEV
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_LINK_MESSAGE,4,2               ; @LINK_MESSAGE
	.comm	_MSG_LINK_FORCE_DOWN,4,2        ; @MSG_LINK_FORCE_DOWN
	.comm	_switchtec_ntb_link_notification,4,2 ; @switchtec_ntb_link_notification
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"NTB device registered\n"

l_.str.1:                               ; @.str.1
	.asciz	"failed to register ntb device: %d\n"

	.no_dead_strip	_switchtec_ntb_add
.subsections_via_symbols
