	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_WPAD_ReadEvent                 ## -- Begin function WPAD_ReadEvent
	.p2align	4, 0x90
_WPAD_ReadEvent:                        ## @WPAD_ReadEvent
	.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, %r14
	movq	%rdi, %rbx
	callq	__CPU_ISR_Disable
	movq	___wpads_inited@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_WPAD_STATE_DISABLED@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_2
LBB0_1:
	callq	__CPU_ISR_Restore
	movq	_WPAD_ERR_NOT_READY@GOTPCREL(%rip), %rax
	jmp	LBB0_11
LBB0_2:
	movq	___wpads@GOTPCREL(%rip), %r15
	movq	(%r15), %rax
	movq	(%rax,%rbx,8), %rdi
	testq	%rdi, %rdi
	je	LBB0_10
## %bb.3:
	movq	_WIIMOTE_STATE_CONNECTED@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_WIIMOTE_IS_SET
	testq	%rax, %rax
	je	LBB0_10
## %bb.4:
	movq	(%r15), %rax
	movq	(%rax,%rbx,8), %rdi
	movq	_WIIMOTE_STATE_HANDSHAKE_COMPLETE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_WIIMOTE_IS_SET
	testq	%rax, %rax
	je	LBB0_1
## %bb.5:
	movq	___wpdcb@GOTPCREL(%rip), %rax
	movq	(%rax), %r12
	leaq	(%rbx,%rbx,2), %r13
	shlq	$4, %r13
	movq	8(%r12,%r13), %rcx
	testq	%rcx, %rcx
	je	LBB0_13
## %bb.6:
	movq	_EVENTQUEUE_LENGTH@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	movq	16(%r12,%r13), %rax
	testq	%r14, %r14
	je	LBB0_8
## %bb.7:
	movq	32(%r12,%r13), %rdx
	movl	(%rdx,%rax,4), %edx
	movl	%edx, (%r14)
LBB0_8:
	leaq	(%r12,%r13), %rsi
	addq	$8, %rsi
	incq	%rax
	movq	%rax, %rdx
	orq	%rdi, %rdx
	shrq	$32, %rdx
	je	LBB0_14
## %bb.9:
	xorl	%edx, %edx
	divq	%rdi
	jmp	LBB0_15
LBB0_10:
	callq	__CPU_ISR_Restore
	movq	_WPAD_ERR_NO_CONTROLLER@GOTPCREL(%rip), %rax
LBB0_11:
	movq	(%rax), %rax
LBB0_12:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_13:
	callq	__CPU_ISR_Restore
	movq	_WPAD_ERR_QUEUE_EMPTY@GOTPCREL(%rip), %rax
	jmp	LBB0_11
LBB0_14:
                                        ## kill: def $eax killed $eax killed $rax
	xorl	%edx, %edx
	divl	%edi
                                        ## kill: def $edx killed $edx def $rdx
LBB0_15:
	movq	%rdx, 8(%rsi)
	decq	%rcx
	movq	%rcx, (%rsi)
	movq	(%r15), %rax
	movq	(%rax,%rbx,8), %rbx
	movq	_WIIUSE_SMOOTHING@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_WIIMOTE_IS_FLAG_SET
	movq	%rax, %r15
	callq	__CPU_ISR_Restore
	testq	%r14, %r14
	je	LBB0_17
## %bb.16:
	leaq	(%r12,%r13), %rsi
	addq	$24, %rsi
	movq	%r14, %rdi
	movq	%rbx, %rdx
	movq	%r15, %rcx
	callq	___wpad_calc_data
LBB0_17:
	xorl	%eax, %eax
	jmp	LBB0_12
	.cfi_endproc
                                        ## -- End function
	.comm	___wpads_inited,8,3             ## @__wpads_inited
	.comm	_WPAD_STATE_DISABLED,8,3        ## @WPAD_STATE_DISABLED
	.comm	_WPAD_ERR_NOT_READY,8,3         ## @WPAD_ERR_NOT_READY
	.comm	___wpads,8,3                    ## @__wpads
	.comm	_WIIMOTE_STATE_CONNECTED,4,2    ## @WIIMOTE_STATE_CONNECTED
	.comm	_WIIMOTE_STATE_HANDSHAKE_COMPLETE,4,2 ## @WIIMOTE_STATE_HANDSHAKE_COMPLETE
	.comm	___wpdcb,8,3                    ## @__wpdcb
	.comm	_EVENTQUEUE_LENGTH,8,3          ## @EVENTQUEUE_LENGTH
	.comm	_WPAD_ERR_QUEUE_EMPTY,8,3       ## @WPAD_ERR_QUEUE_EMPTY
	.comm	_WIIUSE_SMOOTHING,4,2           ## @WIIUSE_SMOOTHING
	.comm	_WPAD_ERR_NO_CONTROLLER,8,3     ## @WPAD_ERR_NO_CONTROLLER
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_WPAD_ReadEvent                 ; -- Begin function WPAD_ReadEvent
	.p2align	2
_WPAD_ReadEvent:                        ; @WPAD_ReadEvent
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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	x19, x1
	mov	x20, x0
	bl	__CPU_ISR_Disable
Lloh0:
	adrp	x8, ___wpads_inited@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___wpads_inited@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
Lloh3:
	adrp	x9, _WPAD_STATE_DISABLED@GOTPAGE
Lloh4:
	ldr	x9, [x9, _WPAD_STATE_DISABLED@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_2
LBB0_1:
	bl	__CPU_ISR_Restore
Lloh6:
	adrp	x8, _WPAD_ERR_NOT_READY@GOTPAGE
Lloh7:
	ldr	x8, [x8, _WPAD_ERR_NOT_READY@GOTPAGEOFF]
	b	LBB0_12
LBB0_2:
Lloh8:
	adrp	x21, ___wpads@GOTPAGE
Lloh9:
	ldr	x21, [x21, ___wpads@GOTPAGEOFF]
	ldr	x8, [x21]
	ldr	x0, [x8, x20, lsl #3]
	cbz	x0, LBB0_11
; %bb.3:
Lloh10:
	adrp	x8, _WIIMOTE_STATE_CONNECTED@GOTPAGE
Lloh11:
	ldr	x8, [x8, _WIIMOTE_STATE_CONNECTED@GOTPAGEOFF]
Lloh12:
	ldr	w1, [x8]
	bl	_WIIMOTE_IS_SET
	cbz	x0, LBB0_11
; %bb.4:
	ldr	x8, [x21]
	ldr	x0, [x8, x20, lsl #3]
Lloh13:
	adrp	x8, _WIIMOTE_STATE_HANDSHAKE_COMPLETE@GOTPAGE
Lloh14:
	ldr	x8, [x8, _WIIMOTE_STATE_HANDSHAKE_COMPLETE@GOTPAGEOFF]
Lloh15:
	ldr	w1, [x8]
	bl	_WIIMOTE_IS_SET
	cbz	x0, LBB0_1
; %bb.5:
Lloh16:
	adrp	x8, ___wpdcb@GOTPAGE
Lloh17:
	ldr	x8, [x8, ___wpdcb@GOTPAGEOFF]
Lloh18:
	ldr	x23, [x8]
	mov	w8, #48
	madd	x8, x20, x8, x23
	ldr	x9, [x8, #8]!
	cbz	x9, LBB0_14
; %bb.6:
Lloh19:
	adrp	x10, _EVENTQUEUE_LENGTH@GOTPAGE
Lloh20:
	ldr	x10, [x10, _EVENTQUEUE_LENGTH@GOTPAGEOFF]
Lloh21:
	ldr	x10, [x10]
	mov	w11, #48
	madd	x11, x20, x11, x23
	ldr	x12, [x11, #16]!
	cbz	x19, LBB0_8
; %bb.7:
	ldr	x13, [x8, #24]
	ldr	w13, [x13, x12, lsl #2]
	str	w13, [x19]
LBB0_8:
	add	x12, x12, #1
	udiv	x13, x12, x10
	msub	x10, x13, x10, x12
	str	x10, [x11]
	sub	x9, x9, #1
	str	x9, [x8]
	ldr	x8, [x21]
	ldr	x21, [x8, x20, lsl #3]
Lloh22:
	adrp	x8, _WIIUSE_SMOOTHING@GOTPAGE
Lloh23:
	ldr	x8, [x8, _WIIUSE_SMOOTHING@GOTPAGEOFF]
Lloh24:
	ldr	w1, [x8]
	mov	x0, x21
	bl	_WIIMOTE_IS_FLAG_SET
	mov	x22, x0
	bl	__CPU_ISR_Restore
	cbz	x19, LBB0_10
; %bb.9:
	mov	w8, #48
	madd	x8, x20, x8, x23
	add	x1, x8, #24
	mov	x0, x19
	mov	x2, x21
	mov	x3, x22
	bl	___wpad_calc_data
LBB0_10:
	mov	x0, #0
	b	LBB0_13
LBB0_11:
	bl	__CPU_ISR_Restore
Lloh25:
	adrp	x8, _WPAD_ERR_NO_CONTROLLER@GOTPAGE
Lloh26:
	ldr	x8, [x8, _WPAD_ERR_NO_CONTROLLER@GOTPAGEOFF]
LBB0_12:
	ldr	x0, [x8]
LBB0_13:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_14:
	bl	__CPU_ISR_Restore
Lloh27:
	adrp	x8, _WPAD_ERR_QUEUE_EMPTY@GOTPAGE
Lloh28:
	ldr	x8, [x8, _WPAD_ERR_QUEUE_EMPTY@GOTPAGEOFF]
	b	LBB0_12
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh27, Lloh28
	.cfi_endproc
                                        ; -- End function
	.comm	___wpads_inited,8,3             ; @__wpads_inited
	.comm	_WPAD_STATE_DISABLED,8,3        ; @WPAD_STATE_DISABLED
	.comm	_WPAD_ERR_NOT_READY,8,3         ; @WPAD_ERR_NOT_READY
	.comm	___wpads,8,3                    ; @__wpads
	.comm	_WIIMOTE_STATE_CONNECTED,4,2    ; @WIIMOTE_STATE_CONNECTED
	.comm	_WIIMOTE_STATE_HANDSHAKE_COMPLETE,4,2 ; @WIIMOTE_STATE_HANDSHAKE_COMPLETE
	.comm	___wpdcb,8,3                    ; @__wpdcb
	.comm	_EVENTQUEUE_LENGTH,8,3          ; @EVENTQUEUE_LENGTH
	.comm	_WPAD_ERR_QUEUE_EMPTY,8,3       ; @WPAD_ERR_QUEUE_EMPTY
	.comm	_WIIUSE_SMOOTHING,4,2           ; @WIIUSE_SMOOTHING
	.comm	_WPAD_ERR_NO_CONTROLLER,8,3     ; @WPAD_ERR_NO_CONTROLLER
.subsections_via_symbols
