	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function flexcop_usb_readwrite_dw
_flexcop_usb_readwrite_dw:              ## @flexcop_usb_readwrite_dw
	.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
	movl	%ecx, %r13d
	movq	%rdx, -56(%rbp)                 ## 8-byte Spill
	movq	(%rdi), %r15
	xorl	%ebx, %ebx
	testl	%ecx, %ecx
	setne	%bl
	movq	_B2C2_USB_WRITE_REG@GOTPCREL(%rip), %rax
	cmovneq	_B2C2_USB_READ_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movq	_USB_DIR_OUT@GOTPCREL(%rip), %rax
	cmovneq	_USB_DIR_IN@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	movq	_USB_TYPE_VENDOR@GOTPCREL(%rip), %rax
	orl	(%rax), %r12d
	movl	%esi, -44(%rbp)                 ## 4-byte Spill
	movl	%esi, %edi
	callq	_B2C2_FLEX_PCIOFFSET_TO_INTERNALADDR
	movl	%eax, %r14d
	shll	$7, %ebx
	movq	%r15, %rdi
	callq	_mutex_lock
	testl	%r13d, %r13d
	jne	LBB0_2
## %bb.1:
	movq	8(%r15), %rdi
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	movl	$4, %edx
	callq	_memcpy
LBB0_2:
	orl	%ebx, %r14d
	movl	16(%r15), %edi
	testl	%r13d, %r13d
	je	LBB0_3
## %bb.4:
	movq	_B2C2_USB_CTRL_PIPE_IN@GOTPCREL(%rip), %rax
	jmp	LBB0_5
LBB0_3:
	movq	_B2C2_USB_CTRL_PIPE_OUT@GOTPCREL(%rip), %rax
LBB0_5:
	movl	(%rax), %esi
	movq	_B2C2_WAIT_FOR_OPERATION_RDW@GOTPCREL(%rip), %rax
	movq	_HZ@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ebx
	imull	(%rax), %ebx
	subq	$8, %rsp
	movl	-48(%rbp), %edx                 ## 4-byte Reload
	movl	%r12d, %ecx
	movl	%r14d, %r8d
	xorl	%r9d, %r9d
	pushq	%rbx
	pushq	$4
	pushq	8(%r15)
	callq	_usb_control_msg
	addq	$32, %rsp
	movl	$4, %ebx
	cmpl	$4, %eax
	je	LBB0_9
## %bb.6:
	movl	%eax, %r12d
	testl	%r13d, %r13d
	leaq	L_.str.1(%rip), %rax
	leaq	L_.str.2(%rip), %rsi
	cmovneq	%rax, %rsi
	leaq	L_.str(%rip), %rdi
	movl	%r14d, %edx
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	callq	_err
	testl	%r12d, %r12d
	js	LBB0_7
## %bb.8:
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_9:
	testl	%r13d, %r13d
	je	LBB0_12
## %bb.10:
	testl	%ebx, %ebx
	js	LBB0_12
## %bb.11:
	movq	8(%r15), %rsi
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	$4, %edx
	callq	_memcpy
	jmp	LBB0_12
LBB0_7:
	movl	%r12d, %ebx
LBB0_12:
	movq	%r15, %rdi
	callq	_mutex_unlock
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_B2C2_USB_READ_REG,4,2          ## @B2C2_USB_READ_REG
	.comm	_B2C2_USB_WRITE_REG,4,2         ## @B2C2_USB_WRITE_REG
	.comm	_USB_DIR_IN,4,2                 ## @USB_DIR_IN
	.comm	_USB_DIR_OUT,4,2                ## @USB_DIR_OUT
	.comm	_USB_TYPE_VENDOR,4,2            ## @USB_TYPE_VENDOR
	.comm	_B2C2_USB_CTRL_PIPE_IN,4,2      ## @B2C2_USB_CTRL_PIPE_IN
	.comm	_B2C2_USB_CTRL_PIPE_OUT,4,2     ## @B2C2_USB_CTRL_PIPE_OUT
	.comm	_B2C2_WAIT_FOR_OPERATION_RDW,4,2 ## @B2C2_WAIT_FOR_OPERATION_RDW
	.comm	_HZ,4,2                         ## @HZ
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"error while %s dword from %d (%d)."

L_.str.1:                               ## @.str.1
	.asciz	"reading"

L_.str.2:                               ## @.str.2
	.asciz	"writing"

	.comm	_EIO,4,2                        ## @EIO
	.no_dead_strip	_flexcop_usb_readwrite_dw
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function flexcop_usb_readwrite_dw
_flexcop_usb_readwrite_dw:              ; @flexcop_usb_readwrite_dw
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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	x21, x3
	mov	x20, x2
	mov	x22, x1
	ldr	x19, [x0]
	cmp	w3, #0
	cset	w23, ne
Lloh0:
	adrp	x8, _B2C2_USB_READ_REG@GOTPAGE
Lloh1:
	ldr	x8, [x8, _B2C2_USB_READ_REG@GOTPAGEOFF]
Lloh2:
	adrp	x9, _B2C2_USB_WRITE_REG@GOTPAGE
Lloh3:
	ldr	x9, [x9, _B2C2_USB_WRITE_REG@GOTPAGEOFF]
	csel	x8, x8, x9, ne
	ldr	w24, [x8]
Lloh4:
	adrp	x8, _USB_DIR_IN@GOTPAGE
Lloh5:
	ldr	x8, [x8, _USB_DIR_IN@GOTPAGEOFF]
Lloh6:
	adrp	x9, _USB_DIR_OUT@GOTPAGE
Lloh7:
	ldr	x9, [x9, _USB_DIR_OUT@GOTPAGEOFF]
	csel	x8, x8, x9, ne
	ldr	w8, [x8]
Lloh8:
	adrp	x9, _USB_TYPE_VENDOR@GOTPAGE
Lloh9:
	ldr	x9, [x9, _USB_TYPE_VENDOR@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	orr	w26, w8, w9
	mov	x0, x1
	bl	_B2C2_FLEX_PCIOFFSET_TO_INTERNALADDR
	orr	w23, w0, w23, lsl #7
	mov	x0, x19
	bl	_mutex_lock
	cbnz	w21, LBB0_2
; %bb.1:
	ldr	x0, [x19, #8]
	mov	x1, x20
	mov	w2, #4
	bl	_memcpy
LBB0_2:
Lloh11:
	adrp	x8, _B2C2_USB_CTRL_PIPE_IN@GOTPAGE
Lloh12:
	ldr	x8, [x8, _B2C2_USB_CTRL_PIPE_IN@GOTPAGEOFF]
Lloh13:
	adrp	x9, _B2C2_USB_CTRL_PIPE_OUT@GOTPAGE
Lloh14:
	ldr	x9, [x9, _B2C2_USB_CTRL_PIPE_OUT@GOTPAGEOFF]
	ldr	w0, [x19, #16]
	cmp	w21, #0
	csel	x8, x8, x9, ne
	ldr	w1, [x8]
Lloh15:
	adrp	x8, _B2C2_WAIT_FOR_OPERATION_RDW@GOTPAGE
Lloh16:
	ldr	x8, [x8, _B2C2_WAIT_FOR_OPERATION_RDW@GOTPAGEOFF]
	ldr	x6, [x19, #8]
Lloh17:
	ldr	w8, [x8]
Lloh18:
	adrp	x9, _HZ@GOTPAGE
Lloh19:
	ldr	x9, [x9, _HZ@GOTPAGEOFF]
Lloh20:
	ldr	w9, [x9]
	mul	w8, w9, w8
	str	w8, [sp]
	mov	w25, #4
	mov	x2, x24
	mov	x3, x26
	mov	x4, x23
	mov	w5, #0
	mov	w7, #4
	bl	_usb_control_msg
	cmp	w0, #4
	b.eq	LBB0_5
; %bb.3:
	mov	x24, x0
Lloh21:
	adrp	x8, l_.str.2@PAGE
Lloh22:
	add	x8, x8, l_.str.2@PAGEOFF
Lloh23:
	adrp	x9, l_.str.1@PAGE
Lloh24:
	add	x9, x9, l_.str.1@PAGEOFF
	cmp	w21, #0
	csel	x1, x9, x8, ne
Lloh25:
	adrp	x0, l_.str@PAGE
Lloh26:
	add	x0, x0, l_.str@PAGEOFF
	mov	x2, x23
	mov	x3, x22
	bl	_err
	mov	x25, x24
	tbnz	w24, #31, LBB0_8
; %bb.4:
Lloh27:
	adrp	x8, _EIO@GOTPAGE
Lloh28:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh29:
	ldr	w8, [x8]
	neg	w25, w8
LBB0_5:
	cbz	w21, LBB0_8
; %bb.6:
	tbnz	w25, #31, LBB0_8
; %bb.7:
	ldr	x1, [x19, #8]
	mov	x0, x20
	mov	w2, #4
	bl	_memcpy
LBB0_8:
	mov	x0, x19
	bl	_mutex_unlock
	mov	x0, x25
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.comm	_B2C2_USB_READ_REG,4,2          ; @B2C2_USB_READ_REG
	.comm	_B2C2_USB_WRITE_REG,4,2         ; @B2C2_USB_WRITE_REG
	.comm	_USB_DIR_IN,4,2                 ; @USB_DIR_IN
	.comm	_USB_DIR_OUT,4,2                ; @USB_DIR_OUT
	.comm	_USB_TYPE_VENDOR,4,2            ; @USB_TYPE_VENDOR
	.comm	_B2C2_USB_CTRL_PIPE_IN,4,2      ; @B2C2_USB_CTRL_PIPE_IN
	.comm	_B2C2_USB_CTRL_PIPE_OUT,4,2     ; @B2C2_USB_CTRL_PIPE_OUT
	.comm	_B2C2_WAIT_FOR_OPERATION_RDW,4,2 ; @B2C2_WAIT_FOR_OPERATION_RDW
	.comm	_HZ,4,2                         ; @HZ
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"error while %s dword from %d (%d)."

l_.str.1:                               ; @.str.1
	.asciz	"reading"

l_.str.2:                               ; @.str.2
	.asciz	"writing"

	.comm	_EIO,4,2                        ; @EIO
	.no_dead_strip	_flexcop_usb_readwrite_dw
.subsections_via_symbols
