	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ims_pcu_setup_buttons
_ims_pcu_setup_buttons:                 ## @ims_pcu_setup_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
	movq	%rdx, %r12
	movq	%rsi, %rbx
	movq	%rdi, %r13
	xorl	%r15d, %r15d
	xorl	%eax, %eax
	callq	_input_allocate_device
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rax, %r14
	movl	(%r13), %ecx
	movl	44(%r13), %edi
	leaq	L_.str.1(%rip), %rdx
	movl	$4, %esi
	callq	_snprintf
	movl	16(%r13), %edi
	movl	40(%r13), %esi
	movl	$4, %edx
	callq	_usb_make_path
	movl	40(%r13), %edi
	leaq	L_.str.2(%rip), %rsi
	movl	$4, %edx
	callq	_strlcat
	movq	32(%r13), %rdi
	addl	%r12d, %r12d
	movq	%rbx, %rsi
	movl	%r12d, %edx
	callq	_memcpy
	movl	44(%r13), %eax
	movl	%eax, 40(%r14)
	movl	40(%r13), %eax
	movl	%eax, 36(%r14)
	movl	16(%r13), %edi
	movq	%r14, %rsi
	addq	$32, %rsi
	callq	_usb_to_input_id
	movq	8(%r13), %rax
	movq	%rax, 24(%r14)
	movq	32(%r13), %rdi
	movq	%rdi, 16(%r14)
	callq	_ARRAY_SIZE
	movl	%eax, 12(%r14)
	movl	$4, (%r14)
	movq	_EV_KEY@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	8(%r14), %esi
	callq	___set_bit
	movq	_IMS_PCU_KEYMAP_LEN@GOTPCREL(%rip), %r15
	cmpl	$0, (%r15)
	jle	LBB0_5
## %bb.3:
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movq	32(%r13), %rax
	movl	(%rax,%rbx,4), %edi
	movl	4(%r14), %esi
	callq	___set_bit
	incq	%rbx
	movslq	(%r15), %rax
	cmpq	%rax, %rbx
	jl	LBB0_4
LBB0_5:
	movq	_KEY_RESERVED@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	4(%r14), %esi
	callq	___clear_bit
	movq	%r14, %rdi
	callq	_input_register_device
	testl	%eax, %eax
	je	LBB0_7
## %bb.6:
	movl	%eax, %r15d
	movl	4(%r13), %edi
	leaq	L_.str.3(%rip), %rsi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_dev_err
	movq	%r14, %rdi
	callq	_input_free_device
	jmp	LBB0_8
LBB0_1:
	movl	4(%r13), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_err
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	subl	(%rax), %r15d
	jmp	LBB0_8
LBB0_7:
	movq	%r14, 24(%r13)
	xorl	%r15d, %r15d
LBB0_8:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Not enough memory for input input device\n"

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

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

	.comm	_EV_KEY,4,2                     ## @EV_KEY
	.comm	_IMS_PCU_KEYMAP_LEN,4,2         ## @IMS_PCU_KEYMAP_LEN
	.comm	_KEY_RESERVED,4,2               ## @KEY_RESERVED
L_.str.3:                               ## @.str.3
	.asciz	"Failed to register buttons input device: %d\n"

	.no_dead_strip	_ims_pcu_setup_buttons
.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_buttons
_ims_pcu_setup_buttons:                 ; @ims_pcu_setup_buttons
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.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
	mov	x22, x2
	mov	x21, x1
	mov	x20, x0
	bl	_input_allocate_device
	cbz	x0, LBB0_6
; %bb.1:
	mov	x19, x0
	ldr	w0, [x20, #44]
	ldr	w3, [x20]
Lloh0:
	adrp	x2, l_.str.1@PAGE
Lloh1:
	add	x2, x2, l_.str.1@PAGEOFF
	mov	w23, #4
	mov	w1, #4
	bl	_snprintf
	ldr	w0, [x20, #16]
	ldr	w1, [x20, #40]
	mov	w2, #4
	bl	_usb_make_path
	ldr	w0, [x20, #40]
Lloh2:
	adrp	x1, l_.str.2@PAGE
Lloh3:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	w2, #4
	bl	_strlcat
	ldr	x0, [x20, #32]
	lsl	w2, w22, #1
	mov	x1, x21
	bl	_memcpy
	ldr	d0, [x20, #40]
	stur	d0, [x19, #36]
	ldr	w0, [x20, #16]
	add	x1, x19, #32
	bl	_usb_to_input_id
	ldr	x8, [x20, #8]
	ldr	x0, [x20, #32]
	stp	x0, x8, [x19, #16]
	bl	_ARRAY_SIZE
	str	w0, [x19, #12]
	str	w23, [x19]
Lloh4:
	adrp	x8, _EV_KEY@GOTPAGE
Lloh5:
	ldr	x8, [x8, _EV_KEY@GOTPAGEOFF]
Lloh6:
	ldr	w0, [x8]
	ldr	w1, [x19, #8]
	bl	___set_bit
Lloh7:
	adrp	x21, _IMS_PCU_KEYMAP_LEN@GOTPAGE
Lloh8:
	ldr	x21, [x21, _IMS_PCU_KEYMAP_LEN@GOTPAGEOFF]
	ldr	w8, [x21]
	cmp	w8, #1
	b.lt	LBB0_4
; %bb.2:
	mov	x22, #0
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x20, #32]
	ldr	w0, [x8, x22, lsl #2]
	ldr	w1, [x19, #4]
	bl	___set_bit
	add	x22, x22, #1
	ldrsw	x8, [x21]
	cmp	x22, x8
	b.lt	LBB0_3
LBB0_4:
Lloh9:
	adrp	x8, _KEY_RESERVED@GOTPAGE
Lloh10:
	ldr	x8, [x8, _KEY_RESERVED@GOTPAGEOFF]
Lloh11:
	ldr	w0, [x8]
	ldr	w1, [x19, #4]
	bl	___clear_bit
	mov	x0, x19
	bl	_input_register_device
	mov	x21, x0
	cbz	w0, LBB0_7
; %bb.5:
	ldr	w0, [x20, #4]
	str	x21, [sp]
Lloh12:
	adrp	x1, l_.str.3@PAGE
Lloh13:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_dev_err
	mov	x0, x19
	bl	_input_free_device
	b	LBB0_8
LBB0_6:
	ldr	w0, [x20, #4]
Lloh14:
	adrp	x1, l_.str@PAGE
Lloh15:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
Lloh16:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh17:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_8
LBB0_7:
	str	x19, [x20, #24]
LBB0_8:
	mov	x0, x21
	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
	add	sp, sp, #80
	ret
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Not enough memory for input input device\n"

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

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

	.comm	_EV_KEY,4,2                     ; @EV_KEY
	.comm	_IMS_PCU_KEYMAP_LEN,4,2         ; @IMS_PCU_KEYMAP_LEN
	.comm	_KEY_RESERVED,4,2               ; @KEY_RESERVED
l_.str.3:                               ; @.str.3
	.asciz	"Failed to register buttons input device: %d\n"

	.no_dead_strip	_ims_pcu_setup_buttons
.subsections_via_symbols
