	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function kvaser_usb_hydra_update_state
_kvaser_usb_hydra_update_state:         ## @kvaser_usb_hydra_update_state
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r15
	movq	%rdi, %rbx
	movq	16(%rdi), %r14
	movl	(%rdi), %r13d
	leaq	-44(%rbp), %rcx
	callq	_kvaser_usb_hydra_bus_status_to_can_state
	movl	-44(%rbp), %eax
	cmpl	%r13d, %eax
	je	LBB0_17
## %bb.1:
	movq	_CAN_STATE_STOPPED@GOTPCREL(%rip), %rcx
	movq	_CAN_STATE_BUS_OFF@GOTPCREL(%rip), %rdx
	cmpl	(%rcx), %r13d
	jne	LBB0_3
## %bb.2:
	cmpl	(%rdx), %eax
	je	LBB0_17
LBB0_3:
	leaq	-56(%rbp), %rsi
	movq	%r14, %rdi
	callq	_alloc_can_err_skb
	movq	%rax, %r12
	testq	%rax, %rax
	je	LBB0_5
## %bb.4:
	movq	(%r15), %rax
	cmpq	8(%r15), %rax
	movl	-44(%rbp), %ecx
	movq	_CAN_STATE_ERROR_ACTIVE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%ecx, %edx
	cmovll	%eax, %edx
	cmovgl	%eax, %ecx
	movq	-56(%rbp), %rsi
	movq	%r14, %rdi
	callq	_can_change_state
LBB0_5:
	movq	_CAN_STATE_BUS_OFF@GOTPCREL(%rip), %rcx
	movl	(%rcx), %eax
	cmpl	%eax, -44(%rbp)
	jne	LBB0_10
## %bb.6:
	cmpl	%eax, %r13d
	jae	LBB0_10
## %bb.7:
	cmpq	$0, 8(%rbx)
	jne	LBB0_9
## %bb.8:
	movq	_CMD_STOP_CHIP_REQ@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_kvaser_usb_hydra_send_simple_cmd_async
LBB0_9:
	movq	%r14, %rdi
	callq	_can_bus_off
	movq	_CAN_STATE_BUS_OFF@GOTPCREL(%rip), %rcx
LBB0_10:
	testq	%r12, %r12
	je	LBB0_11
## %bb.12:
	cmpq	$0, 8(%rbx)
	je	LBB0_16
## %bb.13:
	movl	(%rcx), %eax
	cmpl	%eax, %r13d
	jb	LBB0_16
## %bb.14:
	cmpl	%eax, -44(%rbp)
	jae	LBB0_16
## %bb.15:
	incl	4(%rbx)
LBB0_16:
	movq	(%r15), %rax
	movq	-56(%rbp), %rcx
	movq	(%rcx), %rdx
	movq	%rax, 48(%rdx)
	movq	8(%r15), %rax
	movq	%rax, 56(%rdx)
	incl	4(%r14)
	movl	8(%rcx), %eax
	addl	%eax, (%r14)
	movq	%r12, %rdi
	callq	_netif_rx
	jmp	LBB0_17
LBB0_11:
	leaq	L_.str(%rip), %rsi
	movq	%r14, %rdi
	callq	_netdev_warn
LBB0_17:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_CAN_STATE_STOPPED,4,2          ## @CAN_STATE_STOPPED
	.comm	_CAN_STATE_BUS_OFF,4,2          ## @CAN_STATE_BUS_OFF
	.comm	_CAN_STATE_ERROR_ACTIVE,4,2     ## @CAN_STATE_ERROR_ACTIVE
	.comm	_CMD_STOP_CHIP_REQ,4,2          ## @CMD_STOP_CHIP_REQ
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"No memory left for err_skb\n"

	.no_dead_strip	_kvaser_usb_hydra_update_state
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function kvaser_usb_hydra_update_state
_kvaser_usb_hydra_update_state:         ; @kvaser_usb_hydra_update_state
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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	x20, x2
	mov	x21, x0
	ldr	x19, [x0, #16]
	ldr	w23, [x0]
	add	x3, sp, #4
	bl	_kvaser_usb_hydra_bus_status_to_can_state
	ldr	w8, [sp, #4]
	cmp	w8, w23
	b.eq	LBB0_14
; %bb.1:
Lloh0:
	adrp	x9, _CAN_STATE_STOPPED@GOTPAGE
Lloh1:
	ldr	x9, [x9, _CAN_STATE_STOPPED@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
Lloh3:
	adrp	x24, _CAN_STATE_BUS_OFF@GOTPAGE
Lloh4:
	ldr	x24, [x24, _CAN_STATE_BUS_OFF@GOTPAGEOFF]
	ldr	w10, [x24]
	cmp	w23, w9
	ccmp	w8, w10, #0, eq
	b.eq	LBB0_14
; %bb.2:
	add	x1, sp, #8
	mov	x0, x19
	bl	_alloc_can_err_skb
	mov	x22, x0
	cbz	x0, LBB0_4
; %bb.3:
	ldp	x8, x9, [x20]
Lloh5:
	adrp	x10, _CAN_STATE_ERROR_ACTIVE@GOTPAGE
Lloh6:
	ldr	x10, [x10, _CAN_STATE_ERROR_ACTIVE@GOTPAGEOFF]
	ldr	w11, [sp, #4]
Lloh7:
	ldr	w10, [x10]
	cmp	x8, x9
	csel	w2, w10, w11, lt
	csel	w3, w10, w11, gt
	ldr	x1, [sp, #8]
	mov	x0, x19
	bl	_can_change_state
LBB0_4:
	ldr	w8, [sp, #4]
	ldr	w9, [x24]
	cmp	w8, w9
	ccmp	w23, w9, #2, eq
	b.hs	LBB0_8
; %bb.5:
	ldr	x8, [x21, #8]
	cbnz	x8, LBB0_7
; %bb.6:
Lloh8:
	adrp	x8, _CMD_STOP_CHIP_REQ@GOTPAGE
Lloh9:
	ldr	x8, [x8, _CMD_STOP_CHIP_REQ@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
	mov	x0, x21
	bl	_kvaser_usb_hydra_send_simple_cmd_async
LBB0_7:
	mov	x0, x19
	bl	_can_bus_off
LBB0_8:
	cbz	x22, LBB0_13
; %bb.9:
	ldr	x8, [x21, #8]
	cbz	x8, LBB0_12
; %bb.10:
	ldr	w8, [x24]
	ldr	w9, [sp, #4]
	cmp	w23, w8
	ccmp	w9, w8, #2, hs
	b.hs	LBB0_12
; %bb.11:
	ldr	w8, [x21, #4]
	add	w8, w8, #1
	str	w8, [x21, #4]
LBB0_12:
	ldr	x8, [x20]
	ldr	x9, [sp, #8]
	ldr	x10, [x9]
	str	x8, [x10, #48]
	ldr	x8, [x20, #8]
	str	x8, [x10, #56]
	add	x8, x9, #8
	ldr	d0, [x19]
	movi.2s	v1, #1
	ld1.s	{ v1 }[0], [x8]
	add.2s	v0, v0, v1
	str	d0, [x19]
	mov	x0, x22
	bl	_netif_rx
	b	LBB0_14
LBB0_13:
Lloh11:
	adrp	x1, l_.str@PAGE
Lloh12:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	bl	_netdev_warn
LBB0_14:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_CAN_STATE_STOPPED,4,2          ; @CAN_STATE_STOPPED
	.comm	_CAN_STATE_BUS_OFF,4,2          ; @CAN_STATE_BUS_OFF
	.comm	_CAN_STATE_ERROR_ACTIVE,4,2     ; @CAN_STATE_ERROR_ACTIVE
	.comm	_CMD_STOP_CHIP_REQ,4,2          ; @CMD_STOP_CHIP_REQ
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"No memory left for err_skb\n"

	.no_dead_strip	_kvaser_usb_hydra_update_state
.subsections_via_symbols
