	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mouse_button_fixup
_mouse_button_fixup:                    ## @mouse_button_fixup
	.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
	cmpl	$32, %edx
	jb	LBB0_7
## %bb.1:
	movq	%rsi, %rbx
	cmpl	$149, 48(%rsi)
	jne	LBB0_7
## %bb.2:
	cmpl	$117, 56(%rbx)
	jne	LBB0_7
## %bb.3:
	cmpl	$1, 60(%rbx)
	jne	LBB0_7
## %bb.4:
	cmpl	$41, 80(%rbx)
	jne	LBB0_7
## %bb.5:
	cmpl	$117, 120(%rbx)
	jne	LBB0_7
## %bb.6:
	movl	%ecx, %r14d
	leaq	L_.str(%rip), %rsi
	callq	_hid_info
	movq	_MOUSE_BUTTONS_MAX@GOTPCREL(%rip), %r15
	movl	(%r15), %edx
	movl	%r14d, %edi
	xorl	%esi, %esi
	callq	_clamp
	movl	%eax, 52(%rbx)
	movl	%eax, 84(%rbx)
	movl	(%r15), %ecx
	subl	%eax, %ecx
	movl	%ecx, 124(%rbx)
LBB0_7:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Fixing up Elecom mouse button count\n"

	.comm	_MOUSE_BUTTONS_MAX,4,2          ## @MOUSE_BUTTONS_MAX
	.no_dead_strip	_mouse_button_fixup
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mouse_button_fixup
_mouse_button_fixup:                    ; @mouse_button_fixup
	.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
	cmp	w2, #32
	b.lo	LBB0_7
; %bb.1:
	mov	x19, x1
	ldr	w8, [x1, #48]
	cmp	w8, #149
	b.ne	LBB0_7
; %bb.2:
	ldr	w8, [x19, #56]
	cmp	w8, #117
	b.ne	LBB0_7
; %bb.3:
	ldr	w8, [x19, #60]
	cmp	w8, #1
	b.ne	LBB0_7
; %bb.4:
	ldr	w8, [x19, #80]
	cmp	w8, #41
	b.ne	LBB0_7
; %bb.5:
	ldr	w8, [x19, #120]
	cmp	w8, #117
	b.ne	LBB0_7
; %bb.6:
	mov	x20, x3
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_hid_info
Lloh2:
	adrp	x21, _MOUSE_BUTTONS_MAX@GOTPAGE
Lloh3:
	ldr	x21, [x21, _MOUSE_BUTTONS_MAX@GOTPAGEOFF]
	ldr	w2, [x21]
	mov	x0, x20
	mov	w1, #0
	bl	_clamp
	str	w0, [x19, #52]
	str	w0, [x19, #84]
	ldr	w8, [x21]
	sub	w8, w8, w0
	str	w8, [x19, #124]
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	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Fixing up Elecom mouse button count\n"

	.comm	_MOUSE_BUTTONS_MAX,4,2          ; @MOUSE_BUTTONS_MAX
	.no_dead_strip	_mouse_button_fixup
.subsections_via_symbols
