	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function pcan_usb_fd_send_cmd
_pcan_usb_fd_send_cmd:                  ## @pcan_usb_fd_send_cmd
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r13
	movq	%rdi, %r14
	callq	_pcan_usb_fd_cmd_buffer
	movq	%rax, %r15
	movq	_PCAN_USB_STATE_CONNECTED@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r14)
	je	LBB0_8
## %bb.1:
	movq	%r13, %r12
	subq	%r15, %r12
	movslq	%r12d, %rbx
	movq	_PCAN_UFD_CMD_BUFFER_SIZE@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	addq	$-4, %rax
	cmpq	%rax, %rbx
	ja	LBB0_3
## %bb.2:
	movq	%r13, %rdi
	movl	$255, %esi
	movl	$4, %edx
	callq	_memset
	addq	$4, %rbx
	movq	%rbx, %r12
LBB0_3:
	movq	8(%r14), %rax
	movq	(%rax), %rax
	movq	_USB_SPEED_HIGH@GOTPCREL(%rip), %rcx
	xorl	%edi, %edi
	cmpq	(%rcx), %rax
	setne	%dil
	callq	_unlikely
	movl	%r12d, %ebx
	testq	%rax, %rax
	je	LBB0_5
## %bb.4:
	movq	_PCAN_UFD_LOSPD_PKT_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r12d, %edi
	callq	_min
	movl	%eax, %ebx
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movq	8(%r14), %r13
	movq	_PCAN_USBPRO_EP_CMDOUT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	callq	_usb_sndbulkpipe
	movq	_PCAN_UFD_CMD_TIMEOUT_MS@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r9d
	movq	%r13, %rdi
	movl	%eax, %esi
	movq	%r15, %rdx
	movl	%ebx, %ecx
	xorl	%r8d, %r8d
	callq	_usb_bulk_msg
	testl	%eax, %eax
	jne	LBB0_6
## %bb.7:                               ##   in Loop: Header=BB0_5 Depth=1
	movslq	%ebx, %rax
	subl	%ebx, %r12d
	movq	_PCAN_UFD_LOSPD_PKT_SIZE@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %r12d
	leaq	(%r15,%rax,4), %r15
	cmovll	%r12d, %ebx
	testl	%ebx, %ebx
	jg	LBB0_5
LBB0_8:
	xorl	%r13d, %r13d
	jmp	LBB0_9
LBB0_6:
	movl	%eax, %r13d
	movl	4(%r14), %edi
	leaq	L_.str(%rip), %rsi
	movl	%eax, %edx
	callq	_netdev_err
LBB0_9:
	movl	%r13d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PCAN_USB_STATE_CONNECTED,4,2   ## @PCAN_USB_STATE_CONNECTED
	.comm	_PCAN_UFD_CMD_BUFFER_SIZE,4,2   ## @PCAN_UFD_CMD_BUFFER_SIZE
	.comm	_USB_SPEED_HIGH,8,3             ## @USB_SPEED_HIGH
	.comm	_PCAN_UFD_LOSPD_PKT_SIZE,4,2    ## @PCAN_UFD_LOSPD_PKT_SIZE
	.comm	_PCAN_USBPRO_EP_CMDOUT,4,2      ## @PCAN_USBPRO_EP_CMDOUT
	.comm	_PCAN_UFD_CMD_TIMEOUT_MS,4,2    ## @PCAN_UFD_CMD_TIMEOUT_MS
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"sending command failure: %d\n"

	.no_dead_strip	_pcan_usb_fd_send_cmd
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function pcan_usb_fd_send_cmd
_pcan_usb_fd_send_cmd:                  ; @pcan_usb_fd_send_cmd
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x22, x1
	mov	x19, x0
	bl	_pcan_usb_fd_cmd_buffer
	ldr	w8, [x19]
Lloh0:
	adrp	x9, _PCAN_USB_STATE_CONNECTED@GOTPAGE
Lloh1:
	ldr	x9, [x9, _PCAN_USB_STATE_CONNECTED@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_8
; %bb.1:
	mov	x20, x0
	sub	x21, x22, x0
	sxtw	x23, w21
Lloh3:
	adrp	x8, _PCAN_UFD_CMD_BUFFER_SIZE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _PCAN_UFD_CMD_BUFFER_SIZE@GOTPAGEOFF]
Lloh5:
	ldrsw	x8, [x8]
	sub	x8, x8, #4
	cmp	x23, x8
	b.hi	LBB0_3
; %bb.2:
	mov	x0, x22
	mov	w1, #255
	mov	w2, #4
	bl	_memset
	add	x21, x23, #4
LBB0_3:
	ldr	x8, [x19, #8]
	ldr	x8, [x8]
Lloh6:
	adrp	x9, _USB_SPEED_HIGH@GOTPAGE
Lloh7:
	ldr	x9, [x9, _USB_SPEED_HIGH@GOTPAGEOFF]
Lloh8:
	ldr	x9, [x9]
	cmp	x8, x9
	cset	w0, ne
	bl	_unlikely
Lloh9:
	adrp	x24, _PCAN_UFD_LOSPD_PKT_SIZE@GOTPAGE
Lloh10:
	ldr	x24, [x24, _PCAN_UFD_LOSPD_PKT_SIZE@GOTPAGEOFF]
	mov	x22, x21
	cbz	x0, LBB0_5
; %bb.4:
	ldr	w1, [x24]
	mov	x0, x21
	bl	_min
	mov	x22, x0
LBB0_5:
Lloh11:
	adrp	x25, _PCAN_USBPRO_EP_CMDOUT@GOTPAGE
Lloh12:
	ldr	x25, [x25, _PCAN_USBPRO_EP_CMDOUT@GOTPAGEOFF]
Lloh13:
	adrp	x26, _PCAN_UFD_CMD_TIMEOUT_MS@GOTPAGE
Lloh14:
	ldr	x26, [x26, _PCAN_UFD_CMD_TIMEOUT_MS@GOTPAGEOFF]
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x23, [x19, #8]
	ldr	w1, [x25]
	mov	x0, x23
	bl	_usb_sndbulkpipe
	mov	x1, x0
	ldr	w5, [x26]
	mov	x0, x23
	mov	x2, x20
	mov	x3, x22
	mov	x4, #0
	bl	_usb_bulk_msg
	cbnz	w0, LBB0_9
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	add	x20, x20, w22, sxtw #2
	ldr	w8, [x24]
	sub	w21, w21, w22
	cmp	w21, w8
	csel	w22, w21, w22, lt
	cmp	w22, #0
	b.gt	LBB0_6
LBB0_8:
	mov	w23, #0
	b	LBB0_10
LBB0_9:
	mov	x23, x0
	ldr	w0, [x19, #4]
Lloh15:
	adrp	x1, l_.str@PAGE
Lloh16:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x23
	bl	_netdev_err
LBB0_10:
	mov	x0, x23
	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
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpAdd	Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.comm	_PCAN_USB_STATE_CONNECTED,4,2   ; @PCAN_USB_STATE_CONNECTED
	.comm	_PCAN_UFD_CMD_BUFFER_SIZE,4,2   ; @PCAN_UFD_CMD_BUFFER_SIZE
	.comm	_USB_SPEED_HIGH,8,3             ; @USB_SPEED_HIGH
	.comm	_PCAN_UFD_LOSPD_PKT_SIZE,4,2    ; @PCAN_UFD_LOSPD_PKT_SIZE
	.comm	_PCAN_USBPRO_EP_CMDOUT,4,2      ; @PCAN_USBPRO_EP_CMDOUT
	.comm	_PCAN_UFD_CMD_TIMEOUT_MS,4,2    ; @PCAN_UFD_CMD_TIMEOUT_MS
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"sending command failure: %d\n"

	.no_dead_strip	_pcan_usb_fd_send_cmd
.subsections_via_symbols
