	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ucan_open
_ucan_open:                             ## @ucan_open
	.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
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -40(%rbp)
	movq	_UCAN_MAX_RX_URBS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	shlq	$3, %rax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %r14
	movq	%r15, %rdi
	callq	_netdev_priv
	movq	%rax, %r12
	movq	%rax, %rdi
	callq	_ucan_alloc_context_array
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_22
## %bb.1:
	movq	%r12, %rdi
	movq	%r14, %rsi
	callq	_ucan_prepare_and_anchor_rx_urbs
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_21
## %bb.2:
	movl	4(%r12), %eax
	movq	_CAN_CTRLMODE_LOOPBACK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	andl	%eax, %ecx
	je	LBB0_4
## %bb.3:
	movq	_UCAN_MODE_LOOPBACK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
LBB0_4:
	movq	_CAN_CTRLMODE_LISTENONLY@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edi
	andl	%eax, %edi
	je	LBB0_6
## %bb.5:
	movq	_UCAN_MODE_SILENT@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edi
LBB0_6:
	orl	%ecx, %edi
	movq	_CAN_CTRLMODE_3_SAMPLES@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	andl	%eax, %ecx
	je	LBB0_8
## %bb.7:
	movq	_UCAN_MODE_3_SAMPLES@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
LBB0_8:
	orl	%ecx, %edi
	movq	_CAN_CTRLMODE_ONE_SHOT@GOTPCREL(%rip), %rcx
	andl	(%rcx), %eax
	je	LBB0_10
## %bb.9:
	movq	_UCAN_MODE_ONE_SHOT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
LBB0_10:
	movq	_UCAN_MODE_BERR_REPORT@GOTPCREL(%rip), %rcx
	orl	(%rcx), %edi
	orl	%eax, %edi
	callq	_cpu_to_le16
	movq	16(%r12), %rcx
	movl	%eax, (%rcx)
	movq	_UCAN_COMMAND_START@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	xorl	%edx, %edx
	movl	$2, %ecx
	callq	_ucan_ctrl_command_out
	testl	%eax, %eax
	js	LBB0_15
## %bb.11:
	movq	%r15, %rdi
	callq	_open_candev
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_13
## %bb.12:
	movq	%r12, %rdi
	movq	%r14, %rsi
	callq	_ucan_submit_rx_urbs
	movl	%eax, %ebx
	testl	%eax, %eax
	je	LBB0_24
LBB0_13:
	movq	_UCAN_COMMAND_STOP@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	callq	_ucan_ctrl_command_out
	testl	%eax, %eax
	jns	LBB0_18
## %bb.14:
	movl	(%r12), %edi
	leaq	L_.str.1(%rip), %rsi
	jmp	LBB0_16
LBB0_15:
	movl	%eax, %ebx
	movl	(%r12), %edi
	leaq	L_.str(%rip), %rsi
LBB0_16:
	movl	%eax, %edx
	callq	_netdev_err
LBB0_18:
	movq	_UCAN_COMMAND_RESET@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	callq	_ucan_ctrl_command_out
	testl	%eax, %eax
	jns	LBB0_20
## %bb.19:
	movl	(%r12), %edi
	leaq	L_.str.2(%rip), %rsi
	movl	%eax, %edx
	callq	_netdev_err
LBB0_20:
	movq	%r12, %rdi
	movq	%r14, %rsi
	callq	_ucan_cleanup_rx_urbs
LBB0_21:
	movq	%r12, %rdi
	callq	_ucan_release_context_array
LBB0_22:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-40(%rbp), %rax
	jne	LBB0_25
## %bb.23:
	movl	%ebx, %eax
	leaq	-32(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_24:
	movq	_CAN_STATE_ERROR_ACTIVE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 8(%r12)
	movq	%r15, %rdi
	callq	_netif_start_queue
	xorl	%ebx, %ebx
	jmp	LBB0_22
LBB0_25:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_UCAN_MAX_RX_URBS,4,2           ## @UCAN_MAX_RX_URBS
	.comm	_CAN_CTRLMODE_LOOPBACK,4,2      ## @CAN_CTRLMODE_LOOPBACK
	.comm	_UCAN_MODE_LOOPBACK,4,2         ## @UCAN_MODE_LOOPBACK
	.comm	_CAN_CTRLMODE_LISTENONLY,4,2    ## @CAN_CTRLMODE_LISTENONLY
	.comm	_UCAN_MODE_SILENT,4,2           ## @UCAN_MODE_SILENT
	.comm	_CAN_CTRLMODE_3_SAMPLES,4,2     ## @CAN_CTRLMODE_3_SAMPLES
	.comm	_UCAN_MODE_3_SAMPLES,4,2        ## @UCAN_MODE_3_SAMPLES
	.comm	_CAN_CTRLMODE_ONE_SHOT,4,2      ## @CAN_CTRLMODE_ONE_SHOT
	.comm	_UCAN_MODE_ONE_SHOT,4,2         ## @UCAN_MODE_ONE_SHOT
	.comm	_UCAN_MODE_BERR_REPORT,4,2      ## @UCAN_MODE_BERR_REPORT
	.comm	_UCAN_COMMAND_START,4,2         ## @UCAN_COMMAND_START
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"could not start device, code: %d\n"

	.comm	_CAN_STATE_ERROR_ACTIVE,4,2     ## @CAN_STATE_ERROR_ACTIVE
	.comm	_UCAN_COMMAND_STOP,4,2          ## @UCAN_COMMAND_STOP
L_.str.1:                               ## @.str.1
	.asciz	"could not stop device, code: %d\n"

	.comm	_UCAN_COMMAND_RESET,4,2         ## @UCAN_COMMAND_RESET
L_.str.2:                               ## @.str.2
	.asciz	"could not reset device, code: %d\n"

	.no_dead_strip	_ucan_open
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ucan_open
_ucan_open:                             ; @ucan_open
	.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
	sub	sp, sp, #16
	mov	x21, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-40]
Lloh3:
	adrp	x8, _UCAN_MAX_RX_URBS@GOTPAGE
Lloh4:
	ldr	x8, [x8, _UCAN_MAX_RX_URBS@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	lsl	x8, x8, #3
	mov	x9, x8
Lloh6:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh7:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x9, sp
	add	x8, x8, #15
	and	x8, x8, #0xffffffff0
	sub	x20, x9, x8
	mov	sp, x20
	bl	_netdev_priv
	mov	x19, x0
	bl	_ucan_alloc_context_array
	mov	x22, x0
	cbnz	w0, LBB0_13
; %bb.1:
	mov	x0, x19
	mov	x1, x20
	bl	_ucan_prepare_and_anchor_rx_urbs
	mov	x22, x0
	cbnz	w0, LBB0_12
; %bb.2:
	ldr	w8, [x19, #4]
Lloh8:
	adrp	x9, _CAN_CTRLMODE_LOOPBACK@GOTPAGE
Lloh9:
	ldr	x9, [x9, _CAN_CTRLMODE_LOOPBACK@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
Lloh11:
	adrp	x10, _UCAN_MODE_LOOPBACK@GOTPAGE
Lloh12:
	ldr	x10, [x10, _UCAN_MODE_LOOPBACK@GOTPAGEOFF]
Lloh13:
	ldr	w10, [x10]
	tst	w9, w8
Lloh14:
	adrp	x9, _CAN_CTRLMODE_LISTENONLY@GOTPAGE
Lloh15:
	ldr	x9, [x9, _CAN_CTRLMODE_LISTENONLY@GOTPAGEOFF]
	csel	w10, wzr, w10, eq
Lloh16:
	ldr	w9, [x9]
Lloh17:
	adrp	x11, _UCAN_MODE_SILENT@GOTPAGE
Lloh18:
	ldr	x11, [x11, _UCAN_MODE_SILENT@GOTPAGEOFF]
Lloh19:
	ldr	w11, [x11]
	tst	w9, w8
	csel	w9, wzr, w11, eq
	orr	w9, w9, w10
Lloh20:
	adrp	x10, _CAN_CTRLMODE_3_SAMPLES@GOTPAGE
Lloh21:
	ldr	x10, [x10, _CAN_CTRLMODE_3_SAMPLES@GOTPAGEOFF]
Lloh22:
	adrp	x11, _UCAN_MODE_3_SAMPLES@GOTPAGE
Lloh23:
	ldr	x11, [x11, _UCAN_MODE_3_SAMPLES@GOTPAGEOFF]
Lloh24:
	ldr	w10, [x10]
Lloh25:
	ldr	w11, [x11]
	tst	w10, w8
	csel	w10, wzr, w11, eq
Lloh26:
	adrp	x11, _CAN_CTRLMODE_ONE_SHOT@GOTPAGE
Lloh27:
	ldr	x11, [x11, _CAN_CTRLMODE_ONE_SHOT@GOTPAGEOFF]
	orr	w9, w9, w10
Lloh28:
	ldr	w10, [x11]
Lloh29:
	adrp	x11, _UCAN_MODE_ONE_SHOT@GOTPAGE
Lloh30:
	ldr	x11, [x11, _UCAN_MODE_ONE_SHOT@GOTPAGEOFF]
Lloh31:
	ldr	w11, [x11]
	tst	w10, w8
	csel	w8, wzr, w11, eq
Lloh32:
	adrp	x10, _UCAN_MODE_BERR_REPORT@GOTPAGE
Lloh33:
	ldr	x10, [x10, _UCAN_MODE_BERR_REPORT@GOTPAGEOFF]
Lloh34:
	ldr	w10, [x10]
	orr	w9, w9, w10
	orr	w0, w9, w8
	bl	_cpu_to_le16
	ldr	x8, [x19, #16]
	str	w0, [x8]
Lloh35:
	adrp	x8, _UCAN_COMMAND_START@GOTPAGE
Lloh36:
	ldr	x8, [x8, _UCAN_COMMAND_START@GOTPAGEOFF]
Lloh37:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #0
	mov	w3, #2
	bl	_ucan_ctrl_command_out
	tbnz	w0, #31, LBB0_7
; %bb.3:
	mov	x0, x21
	bl	_open_candev
	mov	x22, x0
	cbnz	w0, LBB0_5
; %bb.4:
	mov	x0, x19
	mov	x1, x20
	bl	_ucan_submit_rx_urbs
	mov	x22, x0
	cbz	w0, LBB0_15
LBB0_5:
Lloh38:
	adrp	x8, _UCAN_COMMAND_STOP@GOTPAGE
Lloh39:
	ldr	x8, [x8, _UCAN_COMMAND_STOP@GOTPAGEOFF]
Lloh40:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #0
	mov	w3, #0
	bl	_ucan_ctrl_command_out
	tbz	w0, #31, LBB0_9
; %bb.6:
	mov	x2, x0
	ldr	w0, [x19]
Lloh41:
	adrp	x1, l_.str.1@PAGE
Lloh42:
	add	x1, x1, l_.str.1@PAGEOFF
	b	LBB0_8
LBB0_7:
	mov	x22, x0
	ldr	w0, [x19]
Lloh43:
	adrp	x1, l_.str@PAGE
Lloh44:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x22
LBB0_8:
	bl	_netdev_err
LBB0_9:
Lloh45:
	adrp	x8, _UCAN_COMMAND_RESET@GOTPAGE
Lloh46:
	ldr	x8, [x8, _UCAN_COMMAND_RESET@GOTPAGEOFF]
Lloh47:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #0
	mov	w3, #0
	bl	_ucan_ctrl_command_out
	tbz	w0, #31, LBB0_11
; %bb.10:
	mov	x2, x0
	ldr	w0, [x19]
Lloh48:
	adrp	x1, l_.str.2@PAGE
Lloh49:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_netdev_err
LBB0_11:
	mov	x0, x19
	mov	x1, x20
	bl	_ucan_cleanup_rx_urbs
LBB0_12:
	mov	x0, x19
	bl	_ucan_release_context_array
LBB0_13:
	ldur	x8, [x29, #-40]
Lloh50:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh51:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh52:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_16
; %bb.14:
	mov	x0, x22
	sub	sp, x29, #32
	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_15:
Lloh53:
	adrp	x8, _CAN_STATE_ERROR_ACTIVE@GOTPAGE
Lloh54:
	ldr	x8, [x8, _CAN_STATE_ERROR_ACTIVE@GOTPAGEOFF]
Lloh55:
	ldr	w8, [x8]
	str	w8, [x19, #8]
	mov	x0, x21
	bl	_netif_start_queue
	b	LBB0_13
LBB0_16:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh24
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh38, Lloh39, Lloh40
	.loh AdrpAdd	Lloh41, Lloh42
	.loh AdrpAdd	Lloh43, Lloh44
	.loh AdrpLdrGotLdr	Lloh45, Lloh46, Lloh47
	.loh AdrpAdd	Lloh48, Lloh49
	.loh AdrpLdrGotLdr	Lloh50, Lloh51, Lloh52
	.loh AdrpLdrGotLdr	Lloh53, Lloh54, Lloh55
	.cfi_endproc
                                        ; -- End function
	.comm	_UCAN_MAX_RX_URBS,4,2           ; @UCAN_MAX_RX_URBS
	.comm	_CAN_CTRLMODE_LOOPBACK,4,2      ; @CAN_CTRLMODE_LOOPBACK
	.comm	_UCAN_MODE_LOOPBACK,4,2         ; @UCAN_MODE_LOOPBACK
	.comm	_CAN_CTRLMODE_LISTENONLY,4,2    ; @CAN_CTRLMODE_LISTENONLY
	.comm	_UCAN_MODE_SILENT,4,2           ; @UCAN_MODE_SILENT
	.comm	_CAN_CTRLMODE_3_SAMPLES,4,2     ; @CAN_CTRLMODE_3_SAMPLES
	.comm	_UCAN_MODE_3_SAMPLES,4,2        ; @UCAN_MODE_3_SAMPLES
	.comm	_CAN_CTRLMODE_ONE_SHOT,4,2      ; @CAN_CTRLMODE_ONE_SHOT
	.comm	_UCAN_MODE_ONE_SHOT,4,2         ; @UCAN_MODE_ONE_SHOT
	.comm	_UCAN_MODE_BERR_REPORT,4,2      ; @UCAN_MODE_BERR_REPORT
	.comm	_UCAN_COMMAND_START,4,2         ; @UCAN_COMMAND_START
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"could not start device, code: %d\n"

	.comm	_CAN_STATE_ERROR_ACTIVE,4,2     ; @CAN_STATE_ERROR_ACTIVE
	.comm	_UCAN_COMMAND_STOP,4,2          ; @UCAN_COMMAND_STOP
l_.str.1:                               ; @.str.1
	.asciz	"could not stop device, code: %d\n"

	.comm	_UCAN_COMMAND_RESET,4,2         ; @UCAN_COMMAND_RESET
l_.str.2:                               ; @.str.2
	.asciz	"could not reset device, code: %d\n"

	.no_dead_strip	_ucan_open
.subsections_via_symbols
