	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function kvaser_pciefd_setup_board
_kvaser_pciefd_setup_board:             ## @kvaser_pciefd_setup_board
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	callq	_kvaser_pciefd_read_cfg
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_11
## %bb.1:
	movq	_KVASER_PCIEFD_SYSID_VERSION_REG@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	16(%r15), %rdi
	callq	_ioread32
	movq	%rax, %r14
	movq	_KVASER_PCIEFD_SYSID_NRCHAN_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	movl	%r14d, %eax
	sarl	%cl, %eax
	movzbl	%al, %ecx
	movl	(%r15), %edx
	cmpl	%ecx, %edx
	jne	LBB0_2
## %bb.4:
	movq	_KVASER_PCIEFD_MAX_CAN_CHANNELS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	cmpl	%eax, %ecx
	jle	LBB0_6
## %bb.5:
	movl	%eax, (%r15)
LBB0_6:
	movq	_KVASER_PCIEFD_SYSID_BUILD_REG@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	16(%r15), %rdi
	callq	_ioread32
	movq	32(%r15), %rdi
	movq	_KVASER_PCIEFD_SYSID_MAJOR_VER_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	movl	%r14d, %edx
	sarl	%cl, %edx
	movzbl	%dl, %edx
	movzbl	%r14b, %ebx
	movq	_KVASER_PCIEFD_SYSID_BUILD_VER_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	sarl	%cl, %eax
	andl	$32767, %eax                    ## imm = 0x7FFF
	leaq	L_.str.1(%rip), %rsi
	movl	%ebx, %ecx
	movl	%eax, %r8d
	callq	_dev_dbg
	movq	_KVASER_PCIEFD_SRB_STAT_REG@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	16(%r15), %rdi
	callq	_ioread32
	movq	_KVASER_PCIEFD_SRB_STAT_DMA@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_7
## %bb.8:
	movq	_KVASER_PCIEFD_SYSID_BUSFREQ_REG@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	16(%r15), %rdi
	callq	_ioread32
	movq	%rax, 24(%r15)
	movq	_KVASER_PCIEFD_SYSID_CANFREQ_REG@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	16(%r15), %rdi
	callq	_ioread32
	movl	%eax, 4(%r15)
	leal	999999(%rax), %edx
	movl	$1, %ecx
	cmpl	$1999999, %edx                  ## imm = 0x1E847F
	jb	LBB0_10
## %bb.9:
	cltq
	imulq	$1125899907, %rax, %rcx         ## imm = 0x431BDE83
	movq	%rcx, %rax
	shrq	$63, %rax
	sarq	$50, %rcx
	addl	%eax, %ecx
LBB0_10:
	movl	%ecx, 8(%r15)
	movq	_KVASER_PCIEFD_LOOP_REG@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	16(%r15), %rsi
	xorl	%ebx, %ebx
	xorl	%edi, %edi
	callq	_iowrite32
	jmp	LBB0_11
LBB0_2:
	movq	32(%r15), %rdi
	leaq	L_.str(%rip), %rsi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_3
LBB0_7:
	movq	32(%r15), %rdi
	leaq	L_.str.2(%rip), %rsi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_dev_err
LBB0_3:
	movq	_ENODEV@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
LBB0_11:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_KVASER_PCIEFD_SYSID_VERSION_REG,8,3 ## @KVASER_PCIEFD_SYSID_VERSION_REG
	.comm	_KVASER_PCIEFD_SYSID_NRCHAN_SHIFT,4,2 ## @KVASER_PCIEFD_SYSID_NRCHAN_SHIFT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Number of channels does not match: %u vs %u\n"

	.comm	_ENODEV,4,2                     ## @ENODEV
	.comm	_KVASER_PCIEFD_MAX_CAN_CHANNELS,4,2 ## @KVASER_PCIEFD_MAX_CAN_CHANNELS
	.comm	_KVASER_PCIEFD_SYSID_BUILD_REG,8,3 ## @KVASER_PCIEFD_SYSID_BUILD_REG
L_.str.1:                               ## @.str.1
	.asciz	"Version %u.%u.%u\n"

	.comm	_KVASER_PCIEFD_SYSID_MAJOR_VER_SHIFT,4,2 ## @KVASER_PCIEFD_SYSID_MAJOR_VER_SHIFT
	.comm	_KVASER_PCIEFD_SYSID_BUILD_VER_SHIFT,4,2 ## @KVASER_PCIEFD_SYSID_BUILD_VER_SHIFT
	.comm	_KVASER_PCIEFD_SRB_STAT_REG,8,3 ## @KVASER_PCIEFD_SRB_STAT_REG
	.comm	_KVASER_PCIEFD_SRB_STAT_DMA,4,2 ## @KVASER_PCIEFD_SRB_STAT_DMA
L_.str.2:                               ## @.str.2
	.asciz	"Hardware without DMA is not supported\n"

	.comm	_KVASER_PCIEFD_SYSID_BUSFREQ_REG,8,3 ## @KVASER_PCIEFD_SYSID_BUSFREQ_REG
	.comm	_KVASER_PCIEFD_SYSID_CANFREQ_REG,8,3 ## @KVASER_PCIEFD_SYSID_CANFREQ_REG
	.comm	_KVASER_PCIEFD_LOOP_REG,8,3     ## @KVASER_PCIEFD_LOOP_REG
	.no_dead_strip	_kvaser_pciefd_setup_board
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function kvaser_pciefd_setup_board
_kvaser_pciefd_setup_board:             ; @kvaser_pciefd_setup_board
	.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	_kvaser_pciefd_read_cfg
	cbnz	w0, LBB0_9
; %bb.1:
	ldr	x8, [x19, #16]
Lloh0:
	adrp	x9, _KVASER_PCIEFD_SYSID_VERSION_REG@GOTPAGE
Lloh1:
	ldr	x9, [x9, _KVASER_PCIEFD_SYSID_VERSION_REG@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	add	x0, x9, x8
	bl	_ioread32
	mov	x20, x0
Lloh3:
	adrp	x8, _KVASER_PCIEFD_SYSID_NRCHAN_SHIFT@GOTPAGE
Lloh4:
	ldr	x8, [x8, _KVASER_PCIEFD_SYSID_NRCHAN_SHIFT@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	asr	w8, w20, w8
	and	w8, w8, #0xff
	ldr	w9, [x19]
	cmp	w9, w8
	b.ne	LBB0_6
; %bb.2:
Lloh6:
	adrp	x9, _KVASER_PCIEFD_MAX_CAN_CHANNELS@GOTPAGE
Lloh7:
	ldr	x9, [x9, _KVASER_PCIEFD_MAX_CAN_CHANNELS@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	cmp	w8, w9
	b.le	LBB0_4
; %bb.3:
	str	w9, [x19]
LBB0_4:
	ldr	x8, [x19, #16]
Lloh9:
	adrp	x9, _KVASER_PCIEFD_SYSID_BUILD_REG@GOTPAGE
Lloh10:
	ldr	x9, [x9, _KVASER_PCIEFD_SYSID_BUILD_REG@GOTPAGEOFF]
Lloh11:
	ldr	x9, [x9]
	add	x0, x9, x8
	bl	_ioread32
	ldr	x8, [x19, #32]
Lloh12:
	adrp	x9, _KVASER_PCIEFD_SYSID_MAJOR_VER_SHIFT@GOTPAGE
Lloh13:
	ldr	x9, [x9, _KVASER_PCIEFD_SYSID_MAJOR_VER_SHIFT@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	asr	w9, w20, w9
	and	w2, w9, #0xff
	and	w3, w20, #0xff
Lloh15:
	adrp	x9, _KVASER_PCIEFD_SYSID_BUILD_VER_SHIFT@GOTPAGE
Lloh16:
	ldr	x9, [x9, _KVASER_PCIEFD_SYSID_BUILD_VER_SHIFT@GOTPAGEOFF]
Lloh17:
	ldr	w9, [x9]
	asr	w9, w0, w9
	and	w4, w9, #0x7fff
Lloh18:
	adrp	x1, l_.str.1@PAGE
Lloh19:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x8
	bl	_dev_dbg
	ldr	x8, [x19, #16]
Lloh20:
	adrp	x9, _KVASER_PCIEFD_SRB_STAT_REG@GOTPAGE
Lloh21:
	ldr	x9, [x9, _KVASER_PCIEFD_SRB_STAT_REG@GOTPAGEOFF]
Lloh22:
	ldr	x9, [x9]
	add	x0, x9, x8
	bl	_ioread32
Lloh23:
	adrp	x8, _KVASER_PCIEFD_SRB_STAT_DMA@GOTPAGE
Lloh24:
	ldr	x8, [x8, _KVASER_PCIEFD_SRB_STAT_DMA@GOTPAGEOFF]
Lloh25:
	ldr	w8, [x8]
	tst	w8, w0
	b.eq	LBB0_7
; %bb.5:
	ldr	x8, [x19, #16]
Lloh26:
	adrp	x9, _KVASER_PCIEFD_SYSID_BUSFREQ_REG@GOTPAGE
Lloh27:
	ldr	x9, [x9, _KVASER_PCIEFD_SYSID_BUSFREQ_REG@GOTPAGEOFF]
Lloh28:
	ldr	x9, [x9]
	add	x0, x9, x8
	bl	_ioread32
	str	x0, [x19, #24]
	ldr	x8, [x19, #16]
Lloh29:
	adrp	x9, _KVASER_PCIEFD_SYSID_CANFREQ_REG@GOTPAGE
Lloh30:
	ldr	x9, [x9, _KVASER_PCIEFD_SYSID_CANFREQ_REG@GOTPAGEOFF]
Lloh31:
	ldr	x9, [x9]
	add	x0, x9, x8
	bl	_ioread32
	mov	w8, #16959
	movk	w8, #15, lsl #16
	add	w9, w8, #1
	sdiv	w9, w0, w9
	mov	w10, #33919
	movk	w10, #30, lsl #16
	add	w8, w0, w8
	cmp	w8, w10
	csinc	w8, w9, wzr, hs
	stp	w0, w8, [x19, #4]
	ldr	x8, [x19, #16]
Lloh32:
	adrp	x9, _KVASER_PCIEFD_LOOP_REG@GOTPAGE
Lloh33:
	ldr	x9, [x9, _KVASER_PCIEFD_LOOP_REG@GOTPAGEOFF]
Lloh34:
	ldr	x9, [x9]
	add	x1, x9, x8
	mov	w0, #0
	bl	_iowrite32
	mov	w0, #0
	b	LBB0_9
LBB0_6:
	ldr	x0, [x19, #32]
	stp	x9, x8, [sp]
Lloh35:
	adrp	x1, l_.str@PAGE
Lloh36:
	add	x1, x1, l_.str@PAGEOFF
	b	LBB0_8
LBB0_7:
	ldr	x0, [x19, #32]
Lloh37:
	adrp	x1, l_.str.2@PAGE
Lloh38:
	add	x1, x1, l_.str.2@PAGEOFF
LBB0_8:
	bl	_dev_err
Lloh39:
	adrp	x8, _ENODEV@GOTPAGE
Lloh40:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
Lloh41:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_9:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpAdd	Lloh35, Lloh36
	.loh AdrpAdd	Lloh37, Lloh38
	.loh AdrpLdrGotLdr	Lloh39, Lloh40, Lloh41
	.cfi_endproc
                                        ; -- End function
	.comm	_KVASER_PCIEFD_SYSID_VERSION_REG,8,3 ; @KVASER_PCIEFD_SYSID_VERSION_REG
	.comm	_KVASER_PCIEFD_SYSID_NRCHAN_SHIFT,4,2 ; @KVASER_PCIEFD_SYSID_NRCHAN_SHIFT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Number of channels does not match: %u vs %u\n"

	.comm	_ENODEV,4,2                     ; @ENODEV
	.comm	_KVASER_PCIEFD_MAX_CAN_CHANNELS,4,2 ; @KVASER_PCIEFD_MAX_CAN_CHANNELS
	.comm	_KVASER_PCIEFD_SYSID_BUILD_REG,8,3 ; @KVASER_PCIEFD_SYSID_BUILD_REG
l_.str.1:                               ; @.str.1
	.asciz	"Version %u.%u.%u\n"

	.comm	_KVASER_PCIEFD_SYSID_MAJOR_VER_SHIFT,4,2 ; @KVASER_PCIEFD_SYSID_MAJOR_VER_SHIFT
	.comm	_KVASER_PCIEFD_SYSID_BUILD_VER_SHIFT,4,2 ; @KVASER_PCIEFD_SYSID_BUILD_VER_SHIFT
	.comm	_KVASER_PCIEFD_SRB_STAT_REG,8,3 ; @KVASER_PCIEFD_SRB_STAT_REG
	.comm	_KVASER_PCIEFD_SRB_STAT_DMA,4,2 ; @KVASER_PCIEFD_SRB_STAT_DMA
l_.str.2:                               ; @.str.2
	.asciz	"Hardware without DMA is not supported\n"

	.comm	_KVASER_PCIEFD_SYSID_BUSFREQ_REG,8,3 ; @KVASER_PCIEFD_SYSID_BUSFREQ_REG
	.comm	_KVASER_PCIEFD_SYSID_CANFREQ_REG,8,3 ; @KVASER_PCIEFD_SYSID_CANFREQ_REG
	.comm	_KVASER_PCIEFD_LOOP_REG,8,3     ; @KVASER_PCIEFD_LOOP_REG
	.no_dead_strip	_kvaser_pciefd_setup_board
.subsections_via_symbols
