	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function twidjoy_connect
_twidjoy_connect:                       ## @twidjoy_connect
	.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, %rbx
	movq	%rdi, %r14
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r13d, %r13d
	subl	(%rax), %r13d
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$16, %edi
	callq	_kzalloc
	movq	%rax, %r15
	xorl	%eax, %eax
	callq	_input_allocate_device
	movq	%rax, %r12
	testq	%r15, %r15
	je	LBB0_13
## %bb.1:
	testq	%r12, %r12
	je	LBB0_13
## %bb.2:
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	movq	%r12, (%r15)
	movl	8(%r15), %edi
	movq	(%r14), %rcx
	leaq	L_.str(%rip), %rdx
	movl	$4, %esi
	callq	_snprintf
	leaq	L_.str.1(%rip), %rax
	movq	%rax, (%r12)
	movl	8(%r15), %eax
	movl	%eax, 48(%r12)
	movq	_BUS_RS232@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 44(%r12)
	movq	_SERIO_TWIDJOY@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 40(%r12)
	movabsq	$1099511627777, %rax            ## imm = 0x10000000001
	movq	%rax, 32(%r12)
	leaq	8(%r14), %rax
	movq	%rax, 24(%r12)
	movq	_EV_KEY@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_BIT_MASK
	movl	%eax, %r13d
	movq	_EV_ABS@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_BIT_MASK
	orl	%r13d, %eax
	movq	8(%r12), %rcx
	movl	%eax, (%rcx)
	movq	_ABS_X@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	movl	$-50, %edx
	movl	$50, %ecx
	movl	$4, %r8d
	movl	$4, %r9d
	callq	_input_set_abs_params
	movq	_ABS_Y@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	movl	$-50, %edx
	movl	$50, %ecx
	movl	$4, %r8d
	movl	$4, %r9d
	callq	_input_set_abs_params
	movq	_twidjoy_buttons@GOTPCREL(%rip), %rax
	movq	(%rax), %r13
	movl	(%r13), %eax
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_7:                                 ##   in Loop: Header=BB0_3 Depth=1
	movl	16(%r13), %eax
	addq	$16, %r13
LBB0_3:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_6 Depth 2
	testl	%eax, %eax
	je	LBB0_8
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	testl	%eax, %eax
	jle	LBB0_7
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_6:                                 ##   Parent Loop BB0_3 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	8(%r13), %rax
	movl	(%rax,%rbx,4), %edi
	movl	16(%r12), %esi
	callq	_set_bit
	incq	%rbx
	movslq	(%r13), %rax
	cmpq	%rax, %rbx
	jl	LBB0_6
	jmp	LBB0_7
LBB0_8:
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_serio_set_drvdata
	movq	%r14, %rdi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	callq	_serio_open
	movl	%eax, %r13d
	testl	%eax, %eax
	jne	LBB0_12
## %bb.9:
	movq	(%r15), %rdi
	callq	_input_register_device
	testl	%eax, %eax
	je	LBB0_10
## %bb.11:
	movl	%eax, %r13d
	movq	%r14, %rdi
	callq	_serio_close
LBB0_12:
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	_serio_set_drvdata
LBB0_13:
	movq	%r12, %rdi
	callq	_input_free_device
	movq	%r15, %rdi
	callq	_kfree
LBB0_14:
	movl	%r13d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_10:
	xorl	%r13d, %r13d
	jmp	LBB0_14
	.cfi_endproc
                                        ## -- End function
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%s/input0"

L_.str.1:                               ## @.str.1
	.asciz	"Handykey Twiddler"

	.comm	_BUS_RS232,4,2                  ## @BUS_RS232
	.comm	_SERIO_TWIDJOY,4,2              ## @SERIO_TWIDJOY
	.comm	_EV_KEY,4,2                     ## @EV_KEY
	.comm	_EV_ABS,4,2                     ## @EV_ABS
	.comm	_ABS_X,4,2                      ## @ABS_X
	.comm	_ABS_Y,4,2                      ## @ABS_Y
	.comm	_twidjoy_buttons,8,3            ## @twidjoy_buttons
	.no_dead_strip	_twidjoy_connect
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal8,8byte_literals
	.p2align	3                               ; -- Begin function twidjoy_connect
lCPI0_0:
	.long	1                               ; 0x1
	.long	256                             ; 0x100
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	2
_twidjoy_connect:                       ; @twidjoy_connect
	.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	x22, x1
	mov	x20, x0
Lloh0:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh2:
	ldr	w23, [x8]
Lloh3:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	mov	w0, #16
	bl	_kzalloc
	mov	x19, x0
	bl	_input_allocate_device
	mov	x21, x0
	cmp	x19, #0
	ccmp	x0, #0, #4, ne
	b.ne	LBB0_2
; %bb.1:
	neg	w22, w23
	b	LBB0_7
LBB0_2:
	str	x21, [x19]
	ldr	w0, [x19, #8]
	mov	x23, x20
	ldr	x3, [x23], #8
Lloh6:
	adrp	x2, l_.str@PAGE
Lloh7:
	add	x2, x2, l_.str@PAGEOFF
	mov	w1, #4
	bl	_snprintf
Lloh8:
	adrp	x8, l_.str.1@PAGE
Lloh9:
	add	x8, x8, l_.str.1@PAGEOFF
	str	x8, [x21]
	ldr	w8, [x19, #8]
	str	w8, [x21, #48]
Lloh10:
	adrp	x8, _BUS_RS232@GOTPAGE
Lloh11:
	ldr	x8, [x8, _BUS_RS232@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
Lloh13:
	adrp	x9, _SERIO_TWIDJOY@GOTPAGE
Lloh14:
	ldr	x9, [x9, _SERIO_TWIDJOY@GOTPAGEOFF]
Lloh15:
	ldr	w9, [x9]
	stp	w9, w8, [x21, #40]
Lloh16:
	adrp	x8, lCPI0_0@PAGE
Lloh17:
	ldr	d0, [x8, lCPI0_0@PAGEOFF]
	str	d0, [x21, #32]
	str	x23, [x21, #24]
Lloh18:
	adrp	x8, _EV_KEY@GOTPAGE
Lloh19:
	ldr	x8, [x8, _EV_KEY@GOTPAGEOFF]
Lloh20:
	ldr	w0, [x8]
	bl	_BIT_MASK
	mov	x23, x0
Lloh21:
	adrp	x8, _EV_ABS@GOTPAGE
Lloh22:
	ldr	x8, [x8, _EV_ABS@GOTPAGEOFF]
Lloh23:
	ldr	w0, [x8]
	bl	_BIT_MASK
	orr	w8, w0, w23
	ldr	x9, [x21, #8]
	str	w8, [x9]
Lloh24:
	adrp	x8, _ABS_X@GOTPAGE
Lloh25:
	ldr	x8, [x8, _ABS_X@GOTPAGEOFF]
Lloh26:
	ldr	w1, [x8]
	mov	x0, x21
	mov	w2, #-50
	mov	w3, #50
	mov	w4, #4
	mov	w5, #4
	bl	_input_set_abs_params
Lloh27:
	adrp	x8, _ABS_Y@GOTPAGE
Lloh28:
	ldr	x8, [x8, _ABS_Y@GOTPAGEOFF]
Lloh29:
	ldr	w1, [x8]
	mov	x0, x21
	mov	w2, #-50
	mov	w3, #50
	mov	w4, #4
	mov	w5, #4
	bl	_input_set_abs_params
Lloh30:
	adrp	x8, _twidjoy_buttons@GOTPAGE
Lloh31:
	ldr	x8, [x8, _twidjoy_buttons@GOTPAGEOFF]
Lloh32:
	ldr	x23, [x8]
	ldr	w8, [x23]
	cbnz	w8, LBB0_10
LBB0_3:
	mov	x0, x20
	mov	x1, x19
	bl	_serio_set_drvdata
	mov	x0, x20
	mov	x1, x22
	bl	_serio_open
	mov	x22, x0
	cbnz	w0, LBB0_6
; %bb.4:
	ldr	x0, [x19]
	bl	_input_register_device
	mov	x22, x0
	cbz	w0, LBB0_8
; %bb.5:
	mov	x0, x20
	bl	_serio_close
LBB0_6:
	mov	x0, x20
	mov	x1, #0
	bl	_serio_set_drvdata
LBB0_7:
	mov	x0, x21
	bl	_input_free_device
	mov	x0, x19
	bl	_kfree
LBB0_8:
	mov	x0, x22
	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_9:                                 ;   in Loop: Header=BB0_10 Depth=1
	ldr	w8, [x23, #16]!
	cbz	w8, LBB0_3
LBB0_10:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_12 Depth 2
	cmp	w8, #1
	b.lt	LBB0_9
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=1
	mov	x24, #0
LBB0_12:                                ;   Parent Loop BB0_10 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	x8, [x23, #8]
	ldr	w0, [x8, x24, lsl #2]
	ldr	w1, [x21, #16]
	bl	_set_bit
	add	x24, x24, #1
	ldrsw	x8, [x23]
	cmp	x24, x8
	b.lt	LBB0_12
	b	LBB0_9
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpAdrp	Lloh16, Lloh18
	.loh AdrpLdr	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%s/input0"

l_.str.1:                               ; @.str.1
	.asciz	"Handykey Twiddler"

	.comm	_BUS_RS232,4,2                  ; @BUS_RS232
	.comm	_SERIO_TWIDJOY,4,2              ; @SERIO_TWIDJOY
	.comm	_EV_KEY,4,2                     ; @EV_KEY
	.comm	_EV_ABS,4,2                     ; @EV_ABS
	.comm	_ABS_X,4,2                      ; @ABS_X
	.comm	_ABS_Y,4,2                      ; @ABS_Y
	.comm	_twidjoy_buttons,8,3            ; @twidjoy_buttons
	.no_dead_strip	_twidjoy_connect
.subsections_via_symbols
