	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_vusb_transfer_keyboard         ## -- Begin function vusb_transfer_keyboard
	.p2align	4, 0x90
_vusb_transfer_keyboard:                ## @vusb_transfer_keyboard
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	_VUSB_TRANSFER_KEYBOARD_MAX_TRIES@GOTPCREL(%rip), %r14
	cmpl	$0, (%r14)
	jle	LBB0_13
## %bb.1:
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	xorl	%eax, %eax
	callq	_usbInterruptIsReady
	testq	%rax, %rax
	jne	LBB0_3
## %bb.12:                              ##   in Loop: Header=BB0_2 Depth=1
	xorl	%eax, %eax
	callq	_usbPoll
	movl	$1, %edi
	callq	__delay_ms
	incl	%ebx
	cmpl	(%r14), %ebx
	jl	LBB0_2
	jmp	LBB0_13
LBB0_3:
	movq	_kbuf_head@GOTPCREL(%rip), %r14
	movq	_kbuf_tail@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rdi
	cmpq	%rdi, (%r14)
	je	LBB0_13
## %bb.4:
	movq	_kbuf@GOTPCREL(%rip), %rax
	shlq	$2, %rdi
	addq	(%rax), %rdi
	movl	$4, %esi
	callq	_usbSetInterrupt
	movq	(%rbx), %rax
	incq	%rax
	movq	_KBUF_SIZE@GOTPCREL(%rip), %r15
	movq	(%r15), %rcx
	movq	%rax, %rdx
	orq	%rcx, %rdx
	shrq	$32, %rdx
	je	LBB0_5
## %bb.6:
	xorl	%edx, %edx
	divq	%rcx
	jmp	LBB0_7
LBB0_5:
                                        ## kill: def $eax killed $eax killed $rax
	xorl	%edx, %edx
	divl	%ecx
                                        ## kill: def $edx killed $edx def $rdx
LBB0_7:
	movq	%rdx, (%rbx)
	movq	_debug_keyboard@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_13
## %bb.8:
	leaq	L_.str(%rip), %rdi
	callq	_print
	movq	(%rbx), %rdi
	callq	_pdec
	leaq	L_.str.1(%rip), %rdi
	callq	_print
	movq	(%r14), %rdi
	callq	_pdec
	leaq	L_.str.2(%rip), %rdi
	callq	_print
	movq	(%r14), %rax
	subq	(%rbx), %rax
	jae	LBB0_9
## %bb.10:
	movq	(%r15), %rcx
	jmp	LBB0_11
LBB0_13:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_9:
	xorl	%ecx, %ecx
LBB0_11:
	leaq	(%rax,%rcx), %rdi
	callq	_phex
	leaq	L_.str.3(%rip), %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_print                          ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_VUSB_TRANSFER_KEYBOARD_MAX_TRIES,4,2 ## @VUSB_TRANSFER_KEYBOARD_MAX_TRIES
	.comm	_kbuf_head,8,3                  ## @kbuf_head
	.comm	_kbuf_tail,8,3                  ## @kbuf_tail
	.comm	_kbuf,8,3                       ## @kbuf
	.comm	_KBUF_SIZE,8,3                  ## @KBUF_SIZE
	.comm	_debug_keyboard,8,3             ## @debug_keyboard
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"V-USB: kbuf["

L_.str.1:                               ## @.str.1
	.asciz	"->"

L_.str.2:                               ## @.str.2
	.asciz	"]("

L_.str.3:                               ## @.str.3
	.asciz	")\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_vusb_transfer_keyboard         ; -- Begin function vusb_transfer_keyboard
	.p2align	2
_vusb_transfer_keyboard:                ; @vusb_transfer_keyboard
	.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
Lloh0:
	adrp	x19, _VUSB_TRANSFER_KEYBOARD_MAX_TRIES@GOTPAGE
Lloh1:
	ldr	x19, [x19, _VUSB_TRANSFER_KEYBOARD_MAX_TRIES@GOTPAGEOFF]
	ldr	w8, [x19]
	cmp	w8, #1
	b.lt	LBB0_7
; %bb.1:
	mov	w20, #0
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	bl	_usbInterruptIsReady
	cbnz	x0, LBB0_4
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	bl	_usbPoll
	mov	w0, #1
	bl	__delay_ms
	add	w20, w20, #1
	ldr	w8, [x19]
	cmp	w20, w8
	b.lt	LBB0_2
	b	LBB0_7
LBB0_4:
Lloh2:
	adrp	x19, _kbuf_head@GOTPAGE
Lloh3:
	ldr	x19, [x19, _kbuf_head@GOTPAGEOFF]
	ldr	x9, [x19]
Lloh4:
	adrp	x20, _kbuf_tail@GOTPAGE
Lloh5:
	ldr	x20, [x20, _kbuf_tail@GOTPAGEOFF]
	ldr	x8, [x20]
	cmp	x9, x8
	b.eq	LBB0_7
; %bb.5:
Lloh6:
	adrp	x9, _kbuf@GOTPAGE
Lloh7:
	ldr	x9, [x9, _kbuf@GOTPAGEOFF]
Lloh8:
	ldr	x9, [x9]
	add	x0, x9, x8, lsl #2
	mov	w1, #4
	bl	_usbSetInterrupt
	ldr	x8, [x20]
	add	x8, x8, #1
Lloh9:
	adrp	x21, _KBUF_SIZE@GOTPAGE
Lloh10:
	ldr	x21, [x21, _KBUF_SIZE@GOTPAGEOFF]
	ldr	x9, [x21]
	udiv	x10, x8, x9
	msub	x8, x10, x9, x8
	str	x8, [x20]
Lloh11:
	adrp	x8, _debug_keyboard@GOTPAGE
Lloh12:
	ldr	x8, [x8, _debug_keyboard@GOTPAGEOFF]
Lloh13:
	ldr	x8, [x8]
	cbz	x8, LBB0_7
; %bb.6:
Lloh14:
	adrp	x0, l_.str@PAGE
Lloh15:
	add	x0, x0, l_.str@PAGEOFF
	bl	_print
	ldr	x0, [x20]
	bl	_pdec
Lloh16:
	adrp	x0, l_.str.1@PAGE
Lloh17:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_print
	ldr	x0, [x19]
	bl	_pdec
Lloh18:
	adrp	x0, l_.str.2@PAGE
Lloh19:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_print
	ldr	x8, [x19]
	ldr	x9, [x20]
	ldr	x10, [x21]
	subs	x8, x8, x9
	csel	x9, x10, xzr, lo
	add	x0, x8, x9
	bl	_phex
Lloh20:
	adrp	x0, l_.str.3@PAGE
Lloh21:
	add	x0, x0, l_.str.3@PAGEOFF
	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
	b	_print
LBB0_7:
	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
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpAdd	Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_VUSB_TRANSFER_KEYBOARD_MAX_TRIES,4,2 ; @VUSB_TRANSFER_KEYBOARD_MAX_TRIES
	.comm	_kbuf_head,8,3                  ; @kbuf_head
	.comm	_kbuf_tail,8,3                  ; @kbuf_tail
	.comm	_kbuf,8,3                       ; @kbuf
	.comm	_KBUF_SIZE,8,3                  ; @KBUF_SIZE
	.comm	_debug_keyboard,8,3             ; @debug_keyboard
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"V-USB: kbuf["

l_.str.1:                               ; @.str.1
	.asciz	"->"

l_.str.2:                               ; @.str.2
	.asciz	"]("

l_.str.3:                               ; @.str.3
	.asciz	")\n"

.subsections_via_symbols
