	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ican3_startup_module
_ican3_startup_module:                  ## @ican3_startup_module
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %rbx
	callq	_ican3_reset_module
	testl	%eax, %eax
	je	LBB0_2
## %bb.1:
	movl	%eax, %r14d
	movl	4(%rbx), %edi
	leaq	L_.str(%rip), %rsi
LBB0_20:
	xorl	%eax, %eax
	callq	_netdev_err
	jmp	LBB0_21
LBB0_2:
	movl	20(%rbx), %edi
	movq	_FIRMWARE_STAMP@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	24(%rbx), %rsi
	movl	$3, %edx
	callq	_memcpy_fromio
	movl	20(%rbx), %edi
	leaq	L_.str.1(%rip), %rsi
	movl	$10, %edx
	callq	_strncmp
	testq	%rax, %rax
	je	LBB0_4
## %bb.3:
	movl	4(%rbx), %edi
	movl	20(%rbx), %edx
	leaq	L_.str.2(%rip), %rsi
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	callq	_netdev_err
	movq	_ENODEV@GOTPCREL(%rip), %rax
	subl	(%rax), %r14d
LBB0_21:
	movl	%r14d, %eax
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
LBB0_4:
	movl	20(%rbx), %edi
	leaq	L_.str.3(%rip), %rsi
	callq	_strstr
	testq	%rax, %rax
	jne	LBB0_5
## %bb.6:
	movq	_ICAN3_FWTYPE_ICANOS@GOTPCREL(%rip), %rax
	jmp	LBB0_7
LBB0_5:
	movq	_ICAN3_FWTYPE_CAL_CANOPEN@GOTPCREL(%rip), %rax
LBB0_7:
	movl	(%rax), %eax
	movl	%eax, 16(%rbx)
	movb	(%rbx), %cl
	movl	$1, %edi
	shll	%cl, %edi
	movq	8(%rbx), %rsi
	callq	_iowrite8
	movq	%rbx, %rdi
	callq	_ican3_msg_connect
	testl	%eax, %eax
	je	LBB0_9
## %bb.8:
	movl	%eax, %r14d
	movl	4(%rbx), %edi
	leaq	L_.str.4(%rip), %rsi
	jmp	LBB0_20
LBB0_9:
	movq	%rbx, %rdi
	callq	_ican3_init_new_host_interface
	movq	%rbx, %rdi
	callq	_ican3_msg_newhostif
	testl	%eax, %eax
	je	LBB0_11
## %bb.10:
	movl	%eax, %r14d
	movl	4(%rbx), %edi
	leaq	L_.str.5(%rip), %rsi
	jmp	LBB0_20
LBB0_11:
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_ican3_set_termination
	testl	%eax, %eax
	je	LBB0_13
## %bb.12:
	movl	%eax, %r14d
	movl	4(%rbx), %edi
	leaq	L_.str.6(%rip), %rsi
	jmp	LBB0_20
LBB0_13:
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_ican3_set_buserror
	testl	%eax, %eax
	je	LBB0_15
## %bb.14:
	movl	%eax, %r14d
	movl	4(%rbx), %edi
	leaq	L_.str.7(%rip), %rsi
	jmp	LBB0_20
LBB0_15:
	movq	%rbx, %rdi
	callq	_ican3_init_fast_host_interface
	movq	%rbx, %rdi
	callq	_ican3_msg_fasthostif
	testl	%eax, %eax
	je	LBB0_17
## %bb.16:
	movl	%eax, %r14d
	movl	4(%rbx), %edi
	leaq	L_.str.8(%rip), %rsi
	jmp	LBB0_20
LBB0_17:
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_ican3_set_id_filter
	testl	%eax, %eax
	je	LBB0_18
## %bb.19:
	movl	%eax, %r14d
	movl	4(%rbx), %edi
	leaq	L_.str.9(%rip), %rsi
	jmp	LBB0_20
LBB0_18:
	xorl	%r14d, %r14d
	jmp	LBB0_21
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"unable to reset module\n"

	.comm	_FIRMWARE_STAMP,8,3             ## @FIRMWARE_STAMP
L_.str.1:                               ## @.str.1
	.asciz	"JANZ-ICAN3"

L_.str.2:                               ## @.str.2
	.asciz	"ICAN3 not detected (found %s)\n"

	.comm	_ENODEV,4,2                     ## @ENODEV
L_.str.3:                               ## @.str.3
	.asciz	"CAL/CANopen"

	.comm	_ICAN3_FWTYPE_CAL_CANOPEN,4,2   ## @ICAN3_FWTYPE_CAL_CANOPEN
	.comm	_ICAN3_FWTYPE_ICANOS,4,2        ## @ICAN3_FWTYPE_ICANOS
L_.str.4:                               ## @.str.4
	.asciz	"unable to connect to module\n"

L_.str.5:                               ## @.str.5
	.asciz	"unable to switch to new-style interface\n"

L_.str.6:                               ## @.str.6
	.asciz	"unable to enable termination\n"

L_.str.7:                               ## @.str.7
	.asciz	"unable to set bus-error\n"

L_.str.8:                               ## @.str.8
	.asciz	"unable to switch to fast host interface\n"

L_.str.9:                               ## @.str.9
	.asciz	"unable to set acceptance filter\n"

	.no_dead_strip	_ican3_startup_module
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ican3_startup_module
_ican3_startup_module:                  ; @ican3_startup_module
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #48
	.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
	mov	x19, x0
	bl	_ican3_reset_module
	cbz	w0, LBB0_3
; %bb.1:
	mov	x20, x0
	ldr	w0, [x19, #4]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
LBB0_2:
	bl	_netdev_err
	b	LBB0_5
LBB0_3:
	ldr	w0, [x19, #20]
	ldr	x8, [x19, #24]
Lloh2:
	adrp	x9, _FIRMWARE_STAMP@GOTPAGE
Lloh3:
	ldr	x9, [x9, _FIRMWARE_STAMP@GOTPAGEOFF]
Lloh4:
	ldr	x9, [x9]
	add	x1, x9, x8
	mov	w2, #3
	bl	_memcpy_fromio
	ldr	w0, [x19, #20]
Lloh5:
	adrp	x1, l_.str.1@PAGE
Lloh6:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	w2, #10
	bl	_strncmp
	cbz	x0, LBB0_6
; %bb.4:
	ldr	w0, [x19, #4]
	ldr	w8, [x19, #20]
	str	x8, [sp]
Lloh7:
	adrp	x1, l_.str.2@PAGE
Lloh8:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_netdev_err
Lloh9:
	adrp	x8, _ENODEV@GOTPAGE
Lloh10:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	neg	w20, w8
LBB0_5:
	mov	x0, x20
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
LBB0_6:
	ldr	w0, [x19, #20]
Lloh12:
	adrp	x1, l_.str.3@PAGE
Lloh13:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_strstr
Lloh14:
	adrp	x8, _ICAN3_FWTYPE_ICANOS@GOTPAGE
Lloh15:
	ldr	x8, [x8, _ICAN3_FWTYPE_ICANOS@GOTPAGEOFF]
Lloh16:
	adrp	x9, _ICAN3_FWTYPE_CAL_CANOPEN@GOTPAGE
Lloh17:
	ldr	x9, [x9, _ICAN3_FWTYPE_CAL_CANOPEN@GOTPAGEOFF]
	cmp	x0, #0
	csel	x8, x8, x9, eq
	ldr	w8, [x8]
	str	w8, [x19, #16]
	ldr	w8, [x19]
	mov	w9, #1
	lsl	w0, w9, w8
	ldr	x1, [x19, #8]
	bl	_iowrite8
	mov	x0, x19
	bl	_ican3_msg_connect
	cbz	w0, LBB0_8
; %bb.7:
	mov	x20, x0
	ldr	w0, [x19, #4]
Lloh18:
	adrp	x1, l_.str.4@PAGE
Lloh19:
	add	x1, x1, l_.str.4@PAGEOFF
	b	LBB0_2
LBB0_8:
	mov	x0, x19
	bl	_ican3_init_new_host_interface
	mov	x0, x19
	bl	_ican3_msg_newhostif
	cbz	w0, LBB0_10
; %bb.9:
	mov	x20, x0
	ldr	w0, [x19, #4]
Lloh20:
	adrp	x1, l_.str.5@PAGE
Lloh21:
	add	x1, x1, l_.str.5@PAGEOFF
	b	LBB0_2
LBB0_10:
	mov	x0, x19
	mov	w1, #1
	bl	_ican3_set_termination
	cbz	w0, LBB0_12
; %bb.11:
	mov	x20, x0
	ldr	w0, [x19, #4]
Lloh22:
	adrp	x1, l_.str.6@PAGE
Lloh23:
	add	x1, x1, l_.str.6@PAGEOFF
	b	LBB0_2
LBB0_12:
	mov	x0, x19
	mov	w1, #1
	bl	_ican3_set_buserror
	cbz	w0, LBB0_14
; %bb.13:
	mov	x20, x0
	ldr	w0, [x19, #4]
Lloh24:
	adrp	x1, l_.str.7@PAGE
Lloh25:
	add	x1, x1, l_.str.7@PAGEOFF
	b	LBB0_2
LBB0_14:
	mov	x0, x19
	bl	_ican3_init_fast_host_interface
	mov	x0, x19
	bl	_ican3_msg_fasthostif
	cbz	w0, LBB0_16
; %bb.15:
	mov	x20, x0
	ldr	w0, [x19, #4]
Lloh26:
	adrp	x1, l_.str.8@PAGE
Lloh27:
	add	x1, x1, l_.str.8@PAGEOFF
	b	LBB0_2
LBB0_16:
	mov	x0, x19
	mov	w1, #1
	bl	_ican3_set_id_filter
	mov	x20, x0
	cbz	w0, LBB0_5
; %bb.17:
	ldr	w0, [x19, #4]
Lloh28:
	adrp	x1, l_.str.9@PAGE
Lloh29:
	add	x1, x1, l_.str.9@PAGEOFF
	b	LBB0_2
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpAdd	Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"unable to reset module\n"

	.comm	_FIRMWARE_STAMP,8,3             ; @FIRMWARE_STAMP
l_.str.1:                               ; @.str.1
	.asciz	"JANZ-ICAN3"

l_.str.2:                               ; @.str.2
	.asciz	"ICAN3 not detected (found %s)\n"

	.comm	_ENODEV,4,2                     ; @ENODEV
l_.str.3:                               ; @.str.3
	.asciz	"CAL/CANopen"

	.comm	_ICAN3_FWTYPE_CAL_CANOPEN,4,2   ; @ICAN3_FWTYPE_CAL_CANOPEN
	.comm	_ICAN3_FWTYPE_ICANOS,4,2        ; @ICAN3_FWTYPE_ICANOS
l_.str.4:                               ; @.str.4
	.asciz	"unable to connect to module\n"

l_.str.5:                               ; @.str.5
	.asciz	"unable to switch to new-style interface\n"

l_.str.6:                               ; @.str.6
	.asciz	"unable to enable termination\n"

l_.str.7:                               ; @.str.7
	.asciz	"unable to set bus-error\n"

l_.str.8:                               ; @.str.8
	.asciz	"unable to switch to fast host interface\n"

l_.str.9:                               ; @.str.9
	.asciz	"unable to set acceptance filter\n"

	.no_dead_strip	_ican3_startup_module
.subsections_via_symbols
