	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ims_pcu_setup_gamepad
_ims_pcu_setup_gamepad:                 ## @ims_pcu_setup_gamepad
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$16, %edi
	callq	_kzalloc
	movq	%rax, %r14
	xorl	%eax, %eax
	callq	_input_allocate_device
	movq	%rax, %r12
	testq	%r14, %r14
	je	LBB0_2
## %bb.1:
	testq	%r12, %r12
	je	LBB0_2
## %bb.3:
	movq	%r12, 8(%r14)
	movl	4(%r14), %edi
	movl	(%r15), %ecx
	leaq	L_.str.1(%rip), %rdx
	movl	$4, %esi
	callq	_snprintf
	movl	32(%r15), %edi
	movl	(%r14), %esi
	movl	$4, %edx
	callq	_usb_make_path
	movl	(%r14), %edi
	leaq	L_.str.2(%rip), %rsi
	movl	$4, %edx
	callq	_strlcat
	movl	4(%r14), %eax
	movl	%eax, 24(%r12)
	movl	(%r14), %eax
	movl	%eax, 20(%r12)
	movl	32(%r15), %edi
	movq	%r12, %rsi
	addq	$16, %rsi
	callq	_usb_to_input_id
	movq	24(%r15), %rax
	movq	%rax, 8(%r12)
	movq	_EV_KEY@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	(%r12), %esi
	callq	___set_bit
	movq	_BTN_A@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	4(%r12), %esi
	callq	___set_bit
	movq	_BTN_B@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	4(%r12), %esi
	callq	___set_bit
	movq	_BTN_X@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	4(%r12), %esi
	callq	___set_bit
	movq	_BTN_Y@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	4(%r12), %esi
	callq	___set_bit
	movq	_BTN_START@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	4(%r12), %esi
	callq	___set_bit
	movq	_BTN_SELECT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	4(%r12), %esi
	callq	___set_bit
	movq	_EV_ABS@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	(%r12), %esi
	callq	___set_bit
	movq	_ABS_X@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%ebx, %ebx
	movq	%r12, %rdi
	movl	$-1, %edx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	_input_set_abs_params
	movq	_ABS_Y@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	movl	$-1, %edx
	movl	$1, %ecx
	xorl	%r8d, %r8d
	xorl	%r9d, %r9d
	callq	_input_set_abs_params
	movq	%r12, %rdi
	callq	_input_register_device
	testl	%eax, %eax
	je	LBB0_7
## %bb.4:
	movl	16(%r15), %edi
	leaq	L_.str.3(%rip), %rsi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_5
LBB0_2:
	movl	16(%r15), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_err
LBB0_5:
	movq	%r12, %rdi
	callq	_input_free_device
	movq	%r14, %rdi
	callq	_kfree
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_6:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	movq	%r14, 8(%r15)
	jmp	LBB0_6
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Not enough memory for gamepad device\n"

	.comm	_ENOMEM,4,2                     ## @ENOMEM
L_.str.1:                               ## @.str.1
	.asciz	"IMS PCU#%d Gamepad Interface"

L_.str.2:                               ## @.str.2
	.asciz	"/input1"

	.comm	_EV_KEY,4,2                     ## @EV_KEY
	.comm	_BTN_A,4,2                      ## @BTN_A
	.comm	_BTN_B,4,2                      ## @BTN_B
	.comm	_BTN_X,4,2                      ## @BTN_X
	.comm	_BTN_Y,4,2                      ## @BTN_Y
	.comm	_BTN_START,4,2                  ## @BTN_START
	.comm	_BTN_SELECT,4,2                 ## @BTN_SELECT
	.comm	_EV_ABS,4,2                     ## @EV_ABS
	.comm	_ABS_X,4,2                      ## @ABS_X
	.comm	_ABS_Y,4,2                      ## @ABS_Y
L_.str.3:                               ## @.str.3
	.asciz	"Failed to register gamepad input device: %d\n"

	.no_dead_strip	_ims_pcu_setup_gamepad
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ims_pcu_setup_gamepad
_ims_pcu_setup_gamepad:                 ; @ims_pcu_setup_gamepad
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
	mov	x21, x0
Lloh0:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	w0, #16
	bl	_kzalloc
	mov	x19, x0
	bl	_input_allocate_device
	mov	x20, x0
	cmp	x19, #0
	ccmp	x0, #0, #4, ne
	b.ne	LBB0_2
; %bb.1:
	ldr	w0, [x21, #16]
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	b	LBB0_4
LBB0_2:
	str	x20, [x19, #8]
	ldr	w0, [x19, #4]
	ldr	w3, [x21]
Lloh5:
	adrp	x2, l_.str.1@PAGE
Lloh6:
	add	x2, x2, l_.str.1@PAGEOFF
	mov	w1, #4
	bl	_snprintf
	ldr	w0, [x21, #32]
	ldr	w1, [x19]
	mov	w2, #4
	bl	_usb_make_path
	ldr	w0, [x19]
Lloh7:
	adrp	x1, l_.str.2@PAGE
Lloh8:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	w2, #4
	bl	_strlcat
	ldr	d0, [x19]
	stur	d0, [x20, #20]
	ldr	w0, [x21, #32]
	add	x1, x20, #16
	bl	_usb_to_input_id
	ldr	x8, [x21, #24]
	str	x8, [x20, #8]
Lloh9:
	adrp	x8, _EV_KEY@GOTPAGE
Lloh10:
	ldr	x8, [x8, _EV_KEY@GOTPAGEOFF]
Lloh11:
	ldr	w0, [x8]
	ldr	w1, [x20]
	bl	___set_bit
Lloh12:
	adrp	x8, _BTN_A@GOTPAGE
Lloh13:
	ldr	x8, [x8, _BTN_A@GOTPAGEOFF]
Lloh14:
	ldr	w0, [x8]
	ldr	w1, [x20, #4]
	bl	___set_bit
Lloh15:
	adrp	x8, _BTN_B@GOTPAGE
Lloh16:
	ldr	x8, [x8, _BTN_B@GOTPAGEOFF]
Lloh17:
	ldr	w0, [x8]
	ldr	w1, [x20, #4]
	bl	___set_bit
Lloh18:
	adrp	x8, _BTN_X@GOTPAGE
Lloh19:
	ldr	x8, [x8, _BTN_X@GOTPAGEOFF]
Lloh20:
	ldr	w0, [x8]
	ldr	w1, [x20, #4]
	bl	___set_bit
Lloh21:
	adrp	x8, _BTN_Y@GOTPAGE
Lloh22:
	ldr	x8, [x8, _BTN_Y@GOTPAGEOFF]
Lloh23:
	ldr	w0, [x8]
	ldr	w1, [x20, #4]
	bl	___set_bit
Lloh24:
	adrp	x8, _BTN_START@GOTPAGE
Lloh25:
	ldr	x8, [x8, _BTN_START@GOTPAGEOFF]
Lloh26:
	ldr	w0, [x8]
	ldr	w1, [x20, #4]
	bl	___set_bit
Lloh27:
	adrp	x8, _BTN_SELECT@GOTPAGE
Lloh28:
	ldr	x8, [x8, _BTN_SELECT@GOTPAGEOFF]
Lloh29:
	ldr	w0, [x8]
	ldr	w1, [x20, #4]
	bl	___set_bit
Lloh30:
	adrp	x8, _EV_ABS@GOTPAGE
Lloh31:
	ldr	x8, [x8, _EV_ABS@GOTPAGEOFF]
Lloh32:
	ldr	w0, [x8]
	ldr	w1, [x20]
	bl	___set_bit
Lloh33:
	adrp	x8, _ABS_X@GOTPAGE
Lloh34:
	ldr	x8, [x8, _ABS_X@GOTPAGEOFF]
Lloh35:
	ldr	w1, [x8]
	mov	x0, x20
	mov	w2, #-1
	mov	w3, #1
	mov	w4, #0
	mov	w5, #0
	bl	_input_set_abs_params
Lloh36:
	adrp	x8, _ABS_Y@GOTPAGE
Lloh37:
	ldr	x8, [x8, _ABS_Y@GOTPAGEOFF]
Lloh38:
	ldr	w1, [x8]
	mov	x0, x20
	mov	w2, #-1
	mov	w3, #1
	mov	w4, #0
	mov	w5, #0
	bl	_input_set_abs_params
	mov	x0, x20
	bl	_input_register_device
                                        ; kill: def $w0 killed $w0 def $x0
	cbz	w0, LBB0_5
; %bb.3:
	ldr	w8, [x21, #16]
	str	x0, [sp]
Lloh39:
	adrp	x1, l_.str.3@PAGE
Lloh40:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x0, x8
LBB0_4:
	bl	_dev_err
	mov	x0, x20
	bl	_input_free_device
	mov	x0, x19
	bl	_kfree
Lloh41:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh42:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh43:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_6
LBB0_5:
	str	x19, [x21, #8]
LBB0_6:
	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
	add	sp, sp, #64
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh36, Lloh37, Lloh38
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.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 AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh39, Lloh40
	.loh AdrpLdrGotLdr	Lloh41, Lloh42, Lloh43
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Not enough memory for gamepad device\n"

	.comm	_ENOMEM,4,2                     ; @ENOMEM
l_.str.1:                               ; @.str.1
	.asciz	"IMS PCU#%d Gamepad Interface"

l_.str.2:                               ; @.str.2
	.asciz	"/input1"

	.comm	_EV_KEY,4,2                     ; @EV_KEY
	.comm	_BTN_A,4,2                      ; @BTN_A
	.comm	_BTN_B,4,2                      ; @BTN_B
	.comm	_BTN_X,4,2                      ; @BTN_X
	.comm	_BTN_Y,4,2                      ; @BTN_Y
	.comm	_BTN_START,4,2                  ; @BTN_START
	.comm	_BTN_SELECT,4,2                 ; @BTN_SELECT
	.comm	_EV_ABS,4,2                     ; @EV_ABS
	.comm	_ABS_X,4,2                      ; @ABS_X
	.comm	_ABS_Y,4,2                      ; @ABS_Y
l_.str.3:                               ; @.str.3
	.asciz	"Failed to register gamepad input device: %d\n"

	.no_dead_strip	_ims_pcu_setup_gamepad
.subsections_via_symbols
