	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function w8001_connect
_w8001_connect:                         ## @w8001_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
	subq	$88, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r15
	movq	%rdi, %r14
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$56, %edi
	callq	_kzalloc
	movq	%rax, %r13
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_input_allocate_device
	movq	%rax, %r12
	xorl	%eax, %eax
	callq	_input_allocate_device
	testq	%r13, %r13
	movq	%rax, -120(%rbp)                ## 8-byte Spill
	je	LBB0_3
## %bb.1:
	testq	%r12, %r12
	je	LBB0_3
## %bb.2:
	testq	%rax, %rax
	je	LBB0_3
## %bb.4:
	movq	%r14, 48(%r13)
	movq	%r12, 16(%r13)
	movq	%rax, 24(%r13)
	leaq	40(%r13), %rdi
	callq	_mutex_init
	movq	%r13, %rdi
	addq	$36, %rdi
	callq	_init_completion
	movl	32(%r13), %edi
	movq	(%r14), %rcx
	leaq	L_.str(%rip), %rdx
	movl	$4, %esi
	callq	_snprintf
	movq	%r14, %rdi
	movq	%r13, %rsi
	callq	_serio_set_drvdata
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_serio_open
	testl	%eax, %eax
	je	LBB0_6
## %bb.5:
	movl	%eax, %ebx
	jmp	LBB0_21
LBB0_3:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	jmp	LBB0_22
LBB0_6:
	movq	%r13, %rdi
	callq	_w8001_detect
	testl	%eax, %eax
	je	LBB0_8
## %bb.7:
	movl	%eax, %ebx
	jmp	LBB0_20
LBB0_8:
	leaq	L_.str.1(%rip), %rsi
	leaq	-112(%rbp), %r15
	movq	%r15, %rdi
	movl	$64, %edx
	callq	_strlcpy
	movq	%r13, %rdi
	movq	%r15, %rsi
	movl	$64, %edx
	callq	_w8001_setup_pen
	movl	%eax, %ebx
	movq	%r13, %rdi
	movq	%r15, %rsi
	movl	$64, %edx
	callq	_w8001_setup_touch
	movl	%eax, %r15d
	testl	%ebx, %ebx
	je	LBB0_11
## %bb.9:
	testl	%r15d, %r15d
	je	LBB0_11
## %bb.10:
	movq	_ENXIO@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_20:
	movq	%r14, %rdi
	callq	_serio_close
LBB0_21:
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	_serio_set_drvdata
LBB0_22:
	movq	%r12, %rdi
	callq	_input_free_device
	movq	-120(%rbp), %rdi                ## 8-byte Reload
	callq	_input_free_device
	movq	%r13, %rdi
	callq	_kfree
LBB0_23:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_25
## %bb.24:
	movl	%ebx, %eax
	addq	$88, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_11:
	testl	%ebx, %ebx
	je	LBB0_12
## %bb.13:
	movq	%r12, %rdi
	callq	_input_free_device
	movq	$0, 16(%r13)
	xorl	%r12d, %r12d
LBB0_14:
	testl	%r15d, %r15d
	je	LBB0_15
## %bb.17:
	movq	-120(%rbp), %rdi                ## 8-byte Reload
	callq	_input_free_device
	movq	$0, 24(%r13)
	xorl	%ebx, %ebx
	jmp	LBB0_23
LBB0_12:
	movq	(%r13), %rdi
	leaq	-112(%rbp), %rsi
	movl	$8, %edx
	callq	_strlcpy
	movq	(%r13), %rdi
	leaq	L_.str.2(%rip), %rsi
	movl	$8, %edx
	callq	_strlcat
	movq	(%r13), %rax
	movq	%rax, (%r12)
	movq	%r12, %rdi
	movq	%r13, %rsi
	movq	%r14, %rdx
	callq	_w8001_set_devdata
	movq	16(%r13), %rdi
	callq	_input_register_device
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_20
	jmp	LBB0_14
LBB0_15:
	movq	8(%r13), %rdi
	leaq	-112(%rbp), %rsi
	movl	$8, %edx
	callq	_strlcpy
	movq	8(%r13), %rdi
	leaq	L_.str.3(%rip), %rsi
	movl	$8, %edx
	callq	_strlcat
	movq	8(%r13), %rax
	movq	-120(%rbp), %rdi                ## 8-byte Reload
	movq	%rax, (%rdi)
	movq	%r13, %rsi
	movq	%r14, %rdx
	callq	_w8001_set_devdata
	movq	24(%r13), %rdi
	callq	_input_register_device
	testl	%eax, %eax
	je	LBB0_16
## %bb.18:
	movl	%eax, %ebx
	movq	16(%r13), %rdi
	testq	%rdi, %rdi
	je	LBB0_20
## %bb.19:
	callq	_input_unregister_device
	jmp	LBB0_20
LBB0_16:
	xorl	%ebx, %ebx
	jmp	LBB0_23
LBB0_25:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%s/input0"

L_.str.1:                               ## @.str.1
	.asciz	"Wacom Serial"

	.comm	_ENXIO,4,2                      ## @ENXIO
L_.str.2:                               ## @.str.2
	.asciz	" Pen"

L_.str.3:                               ## @.str.3
	.asciz	" Finger"

	.no_dead_strip	_w8001_connect
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function w8001_connect
_w8001_connect:                         ; @w8001_connect
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x24, x23, [sp, #80]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #96]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #112]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #128]            ; 16-byte Folded Spill
	add	x29, sp, #128
	.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	x23, x1
	mov	x22, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-56]
Lloh3:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	mov	w0, #56
	bl	_kzalloc
	mov	x19, x0
	bl	_input_allocate_device
	mov	x21, x0
	bl	_input_allocate_device
	mov	x20, x0
	cmp	x19, #0
	ccmp	x21, #0, #4, ne
	ccmp	x0, #0, #4, ne
	b.ne	LBB0_2
; %bb.1:
Lloh6:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh7:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	neg	w23, w8
	b	LBB0_14
LBB0_2:
	str	x22, [x19, #48]
	add	x0, x19, #40
	stp	x21, x20, [x19, #16]
	bl	_mutex_init
	add	x0, x19, #36
	bl	_init_completion
	ldr	w0, [x19, #32]
	ldr	x3, [x22]
Lloh9:
	adrp	x2, l_.str@PAGE
Lloh10:
	add	x2, x2, l_.str@PAGEOFF
	mov	w1, #4
	bl	_snprintf
	mov	x0, x22
	mov	x1, x19
	bl	_serio_set_drvdata
	mov	x0, x22
	mov	x1, x23
	bl	_serio_open
	cbz	w0, LBB0_4
; %bb.3:
	mov	x23, x0
	b	LBB0_13
LBB0_4:
	mov	x0, x19
	bl	_w8001_detect
	cbz	w0, LBB0_6
; %bb.5:
	mov	x23, x0
	b	LBB0_12
LBB0_6:
Lloh11:
	adrp	x1, l_.str.1@PAGE
Lloh12:
	add	x1, x1, l_.str.1@PAGEOFF
	add	x0, sp, #8
	mov	w2, #64
	bl	_strlcpy
	add	x1, sp, #8
	mov	x0, x19
	mov	w2, #64
	bl	_w8001_setup_pen
	mov	x23, x0
	add	x1, sp, #8
	mov	x0, x19
	mov	w2, #64
	bl	_w8001_setup_touch
	cmp	w23, #0
	ccmp	w0, #0, #4, ne
	b.ne	LBB0_11
; %bb.7:
	mov	x24, x0
	cbz	w23, LBB0_17
; %bb.8:
	mov	x0, x21
	bl	_input_free_device
	mov	x21, #0
	str	xzr, [x19, #16]
LBB0_9:
	cbz	w24, LBB0_18
; %bb.10:
	mov	x0, x20
	bl	_input_free_device
	mov	w23, #0
	str	xzr, [x19, #24]
	b	LBB0_15
LBB0_11:
Lloh13:
	adrp	x8, _ENXIO@GOTPAGE
Lloh14:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	neg	w23, w8
LBB0_12:
	mov	x0, x22
	bl	_serio_close
LBB0_13:
	mov	x0, x22
	mov	x1, #0
	bl	_serio_set_drvdata
LBB0_14:
	mov	x0, x21
	bl	_input_free_device
	mov	x0, x20
	bl	_input_free_device
	mov	x0, x19
	bl	_kfree
LBB0_15:
	ldur	x8, [x29, #-56]
Lloh16:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh17:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh18:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_21
; %bb.16:
	mov	x0, x23
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	add	sp, sp, #144
	ret
LBB0_17:
	ldr	x0, [x19]
	add	x1, sp, #8
	mov	w2, #8
	bl	_strlcpy
	ldr	x0, [x19]
Lloh19:
	adrp	x1, l_.str.2@PAGE
Lloh20:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	w2, #8
	bl	_strlcat
	ldr	x8, [x19]
	str	x8, [x21]
	mov	x0, x21
	mov	x1, x19
	mov	x2, x22
	bl	_w8001_set_devdata
	ldr	x0, [x19, #16]
	bl	_input_register_device
	mov	x23, x0
	cbnz	w0, LBB0_12
	b	LBB0_9
LBB0_18:
	ldr	x0, [x19, #8]
	add	x1, sp, #8
	mov	w2, #8
	bl	_strlcpy
	ldr	x0, [x19, #8]
Lloh21:
	adrp	x1, l_.str.3@PAGE
Lloh22:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	w2, #8
	bl	_strlcat
	ldr	x8, [x19, #8]
	str	x8, [x20]
	mov	x0, x20
	mov	x1, x19
	mov	x2, x22
	bl	_w8001_set_devdata
	ldr	x0, [x19, #24]
	bl	_input_register_device
	mov	x23, x0
	cbz	w0, LBB0_15
; %bb.19:
	ldr	x0, [x19, #16]
	cbz	x0, LBB0_12
; %bb.20:
	bl	_input_unregister_device
	b	LBB0_12
LBB0_21:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpAdd	Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%s/input0"

l_.str.1:                               ; @.str.1
	.asciz	"Wacom Serial"

	.comm	_ENXIO,4,2                      ; @ENXIO
l_.str.2:                               ; @.str.2
	.asciz	" Pen"

l_.str.3:                               ; @.str.3
	.asciz	" Finger"

	.no_dead_strip	_w8001_connect
.subsections_via_symbols
