	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cp2112_read
_cp2112_read:                           ## @cp2112_read
	.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	%rsi, -56(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r15
	cmpq	$4, %rdx
	movl	$4, %ebx
	cmovbq	%rdx, %rbx
	movq	16(%rdi), %r12
	movq	_CP2112_DATA_READ_FORCE_SEND@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -48(%rbp)
	movq	%rbx, %rdi
	callq	_cpu_to_be16
	movl	%eax, -44(%rbp)
	leaq	12(%r15), %r13
	movq	%r13, %rdi
	xorl	%esi, %esi
	callq	_atomic_set
	movq	_HID_OUTPUT_REPORT@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	-48(%rbp), %rsi
	movq	%r12, %rdi
	movl	$8, %edx
	callq	_cp2112_hid_output
	testl	%eax, %eax
	js	LBB0_1
## %bb.2:
	movq	%r15, %rdi
	movq	%r13, %rsi
	callq	_cp2112_wait
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_4
## %bb.3:
	movq	(%r15), %rdx
	leaq	L_.str.1(%rip), %rsi
	movq	%r12, %rdi
	movq	%rbx, %rcx
	callq	_hid_dbg
	movq	(%r15), %rdx
	cmpq	%rdx, %rbx
	cmovbq	%rbx, %rdx
	movl	8(%r15), %esi
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_memcpy
	movl	(%r15), %r14d
	jmp	LBB0_4
LBB0_1:
	movl	%eax, %r14d
	leaq	L_.str(%rip), %rsi
	movq	%r12, %rdi
	movl	%eax, %edx
	callq	_hid_warn
LBB0_4:
	movl	%r14d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_CP2112_DATA_READ_FORCE_SEND,4,2 ## @CP2112_DATA_READ_FORCE_SEND
	.comm	_HID_OUTPUT_REPORT,4,2          ## @HID_OUTPUT_REPORT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Error requesting data: %d\n"

L_.str.1:                               ## @.str.1
	.asciz	"read %d of %zd bytes requested\n"

	.no_dead_strip	_cp2112_read
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cp2112_read
_cp2112_read:                           ; @cp2112_read
	.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, x1
	mov	x19, x0
	ldr	x21, [x0, #16]
	mov	w8, #4
	cmp	x2, #4
	csel	x22, x2, x8, lo
Lloh0:
	adrp	x8, _CP2112_DATA_READ_FORCE_SEND@GOTPAGE
Lloh1:
	ldr	x8, [x8, _CP2112_DATA_READ_FORCE_SEND@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	str	w8, [sp, #8]
	mov	x0, x22
	bl	_cpu_to_be16
	str	w0, [sp, #12]
	add	x23, x19, #12
	mov	x0, x23
	mov	w1, #0
	bl	_atomic_set
Lloh3:
	adrp	x8, _HID_OUTPUT_REPORT@GOTPAGE
Lloh4:
	ldr	x8, [x8, _HID_OUTPUT_REPORT@GOTPAGEOFF]
Lloh5:
	ldr	w3, [x8]
	add	x1, sp, #8
	mov	x0, x21
	mov	w2, #8
	bl	_cp2112_hid_output
	tbnz	w0, #31, LBB0_3
; %bb.1:
	mov	x0, x19
	mov	x1, x23
	bl	_cp2112_wait
	mov	x24, x0
	cbnz	w0, LBB0_4
; %bb.2:
	ldr	x2, [x19]
Lloh6:
	adrp	x1, l_.str.1@PAGE
Lloh7:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x21
	mov	x3, x22
	bl	_hid_dbg
	ldr	x8, [x19]
	cmp	x22, x8
	csel	x2, x22, x8, lo
	ldr	w1, [x19, #8]
	mov	x0, x20
	bl	_memcpy
	ldr	w24, [x19]
	b	LBB0_4
LBB0_3:
	mov	x24, x0
Lloh8:
	adrp	x1, l_.str@PAGE
Lloh9:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x21
	mov	x2, x24
	bl	_hid_warn
LBB0_4:
	mov	x0, x24
	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 AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.comm	_CP2112_DATA_READ_FORCE_SEND,4,2 ; @CP2112_DATA_READ_FORCE_SEND
	.comm	_HID_OUTPUT_REPORT,4,2          ; @HID_OUTPUT_REPORT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Error requesting data: %d\n"

l_.str.1:                               ; @.str.1
	.asciz	"read %d of %zd bytes requested\n"

	.no_dead_strip	_cp2112_read
.subsections_via_symbols
