	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function magicmouse_emit_buttons
_magicmouse_emit_buttons:               ## @magicmouse_emit_buttons
	.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
	movl	%esi, %r15d
	movq	%rdi, %r14
	movq	_BTN_LEFT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	8(%r14), %rax
	movl	(%rax), %esi
	callq	_test_bit
	movl	%eax, %r12d
	movq	_BTN_RIGHT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	8(%r14), %rax
	movl	(%rax), %esi
	callq	_test_bit
	movl	%eax, %ebx
	addl	%eax, %ebx
	orl	%r12d, %ebx
	movq	_BTN_MIDDLE@GOTPCREL(%rip), %r13
	movl	(%r13), %edi
	movq	8(%r14), %rax
	movl	(%rax), %esi
	callq	_test_bit
	movl	%eax, %r12d
	shll	$2, %r12d
	orl	%ebx, %r12d
	movq	_emulate_3button@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_7
## %bb.1:
	testl	%r15d, %r15d
	je	LBB0_2
## %bb.3:
	movl	%r12d, %ebx
	testl	%r12d, %r12d
	jne	LBB0_6
## %bb.4:
	movq	%r14, %rdi
	callq	_magicmouse_firm_touch
	movl	%r15d, %ebx
	testl	%eax, %eax
	js	LBB0_6
## %bb.5:
	movq	16(%r14), %rcx
	movl	%eax, %eax
	movl	(%rcx,%rax,4), %eax
	movq	_middle_button_stop@GOTPCREL(%rip), %rcx
	xorl	%edx, %edx
	cmpl	(%rcx), %eax
	movq	_middle_button_start@GOTPCREL(%rip), %rcx
	setle	%dl
	cmpl	(%rcx), %eax
	leal	2(%rdx,%rdx), %eax
	movl	$1, %ebx
	cmovgel	%eax, %ebx
	jmp	LBB0_6
LBB0_2:
	xorl	%ebx, %ebx
LBB0_6:
	movq	8(%r14), %rdi
	movl	(%r13), %esi
	movl	%ebx, %edx
	andl	$4, %edx
	callq	_input_report_key
	movl	%ebx, %r15d
LBB0_7:
	movq	_BTN_LEFT@GOTPCREL(%rip), %rax
	movq	_BTN_RIGHT@GOTPCREL(%rip), %rbx
	movq	8(%r14), %rdi
	movl	(%rax), %esi
	movl	%r15d, %edx
	andl	$1, %edx
	callq	_input_report_key
	movq	8(%r14), %rdi
	movl	(%rbx), %esi
	movl	%r15d, %edx
	andl	$2, %edx
	callq	_input_report_key
	cmpl	%r12d, %r15d
	je	LBB0_9
## %bb.8:
	movq	_SCROLL_ACCEL_DEFAULT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%r14)
LBB0_9:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_BTN_LEFT,4,2                   ## @BTN_LEFT
	.comm	_BTN_RIGHT,4,2                  ## @BTN_RIGHT
	.comm	_BTN_MIDDLE,4,2                 ## @BTN_MIDDLE
	.comm	_emulate_3button,8,3            ## @emulate_3button
	.comm	_middle_button_start,4,2        ## @middle_button_start
	.comm	_middle_button_stop,4,2         ## @middle_button_stop
	.comm	_SCROLL_ACCEL_DEFAULT,4,2       ## @SCROLL_ACCEL_DEFAULT
	.no_dead_strip	_magicmouse_emit_buttons
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function magicmouse_emit_buttons
_magicmouse_emit_buttons:               ; @magicmouse_emit_buttons
	.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	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x22, _BTN_LEFT@GOTPAGE
Lloh1:
	ldr	x22, [x22, _BTN_LEFT@GOTPAGEOFF]
	ldr	w0, [x22]
	ldr	x8, [x19, #8]
	ldr	w1, [x8]
	bl	_test_bit
	mov	x21, x0
Lloh2:
	adrp	x23, _BTN_RIGHT@GOTPAGE
Lloh3:
	ldr	x23, [x23, _BTN_RIGHT@GOTPAGEOFF]
	ldr	w0, [x23]
	ldr	x8, [x19, #8]
	ldr	w1, [x8]
	bl	_test_bit
	orr	w21, w21, w0, lsl #1
Lloh4:
	adrp	x24, _BTN_MIDDLE@GOTPAGE
Lloh5:
	ldr	x24, [x24, _BTN_MIDDLE@GOTPAGEOFF]
	ldr	w0, [x24]
	ldr	x8, [x19, #8]
	ldr	w1, [x8]
	bl	_test_bit
	orr	w21, w21, w0, lsl #2
Lloh6:
	adrp	x8, _emulate_3button@GOTPAGE
Lloh7:
	ldr	x8, [x8, _emulate_3button@GOTPAGEOFF]
Lloh8:
	ldr	x8, [x8]
	cbz	x8, LBB0_7
; %bb.1:
	cbz	w20, LBB0_5
; %bb.2:
	mov	x25, x21
	cbnz	w21, LBB0_6
; %bb.3:
	mov	x0, x19
	bl	_magicmouse_firm_touch
	mov	x25, x20
	tbnz	w0, #31, LBB0_6
; %bb.4:
	ldr	x8, [x19, #16]
	ldr	w8, [x8, w0, uxtw #2]
Lloh9:
	adrp	x9, _middle_button_start@GOTPAGE
Lloh10:
	ldr	x9, [x9, _middle_button_start@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
Lloh12:
	adrp	x10, _middle_button_stop@GOTPAGE
Lloh13:
	ldr	x10, [x10, _middle_button_stop@GOTPAGEOFF]
Lloh14:
	ldr	w10, [x10]
	mov	w11, #4
	mov	w12, #2
	cmp	w8, w10
	csel	w10, w12, w11, gt
	cmp	w8, w9
	csinc	w25, w10, wzr, ge
	b	LBB0_6
LBB0_5:
	mov	w25, #0
LBB0_6:
	ldr	x0, [x19, #8]
	ldr	w1, [x24]
	and	w2, w25, #0x4
	bl	_input_report_key
	mov	x20, x25
LBB0_7:
	ldr	x0, [x19, #8]
	ldr	w1, [x22]
	and	w2, w20, #0x1
	bl	_input_report_key
	ldr	x0, [x19, #8]
	ldr	w1, [x23]
	and	w2, w20, #0x2
	bl	_input_report_key
	cmp	w20, w21
	b.eq	LBB0_9
; %bb.8:
Lloh15:
	adrp	x8, _SCROLL_ACCEL_DEFAULT@GOTPAGE
Lloh16:
	ldr	x8, [x8, _SCROLL_ACCEL_DEFAULT@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
	str	w8, [x19]
LBB0_9:
	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	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_BTN_LEFT,4,2                   ; @BTN_LEFT
	.comm	_BTN_RIGHT,4,2                  ; @BTN_RIGHT
	.comm	_BTN_MIDDLE,4,2                 ; @BTN_MIDDLE
	.comm	_emulate_3button,8,3            ; @emulate_3button
	.comm	_middle_button_start,4,2        ; @middle_button_start
	.comm	_middle_button_stop,4,2         ; @middle_button_stop
	.comm	_SCROLL_ACCEL_DEFAULT,4,2       ; @SCROLL_ACCEL_DEFAULT
	.no_dead_strip	_magicmouse_emit_buttons
.subsections_via_symbols
