	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function surface_button_add
_surface_button_add:                    ## @surface_button_add
	.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	%rdi, %r14
	callq	_acpi_device_hid
	movq	%rax, %r13
	movq	%r14, %rdi
	callq	_acpi_device_bid
	movl	%eax, %r15d
	movq	_SURFACE_BUTTON_OBJ_NAME@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movl	%ebx, %edi
	callq	_strlen
	movl	%r15d, %edi
	movl	%ebx, %esi
	movl	%eax, %edx
	callq	_strncmp
	testq	%rax, %rax
	je	LBB0_3
LBB0_1:
	movq	_ENODEV@GOTPCREL(%rip), %rax
LBB0_2:
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
LBB0_12:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_3:
	movq	%r14, %rdi
	callq	_surface_button_check_MSHW0040
	testl	%eax, %eax
	je	LBB0_1
## %bb.4:
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$16, %edi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_5
## %bb.6:
	movq	%rax, %rbx
	movq	%rax, 8(%r14)
	xorl	%r15d, %r15d
	xorl	%eax, %eax
	callq	_input_allocate_device
	movq	%rax, 8(%rbx)
	testq	%rax, %rax
	je	LBB0_7
## %bb.8:
	movq	%rax, %r12
	movq	%r14, %rdi
	callq	_acpi_device_name
	movq	%rax, %r15
	movq	_SURFACE_BUTTON_DEVICE_NAME@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_strcpy
	movl	(%rbx), %edi
	leaq	L_.str(%rip), %rdx
	movl	$4, %esi
	movq	%r13, %rcx
	movq	%r15, %r13
	callq	_snprintf
	movq	%r15, (%r12)
	movl	(%rbx), %eax
	movl	%eax, 20(%r12)
	movq	_BUS_HOST@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 16(%r12)
	movq	%r14, 8(%r12)
	movq	_EV_KEY@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	movq	_KEY_POWER@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r12, %rdi
	callq	_input_set_capability
	movl	(%r15), %esi
	movq	_KEY_LEFTMETA@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r12, %rdi
	callq	_input_set_capability
	movl	(%r15), %esi
	movq	_KEY_VOLUMEUP@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r12, %rdi
	callq	_input_set_capability
	movl	(%r15), %esi
	movq	_KEY_VOLUMEDOWN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r12, %rdi
	callq	_input_set_capability
	movq	%r12, %rdi
	callq	_input_register_device
	testl	%eax, %eax
	je	LBB0_9
## %bb.10:
	movl	%eax, %r15d
	movq	%r12, %rdi
	callq	_input_free_device
	jmp	LBB0_11
LBB0_5:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_7:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	subl	(%rax), %r15d
LBB0_11:
	movq	%rbx, %rdi
	callq	_kfree
	jmp	LBB0_12
LBB0_9:
	movq	%r14, %rdi
	movl	$1, %esi
	callq	_device_init_wakeup
	movq	%r14, %rdi
	callq	_acpi_device_bid
	leaq	L_.str.1(%rip), %rsi
	movq	%r14, %rdi
	movq	%r13, %rdx
	movl	%eax, %ecx
	callq	_dev_info
	xorl	%r15d, %r15d
	jmp	LBB0_12
	.cfi_endproc
                                        ## -- End function
	.comm	_SURFACE_BUTTON_OBJ_NAME,4,2    ## @SURFACE_BUTTON_OBJ_NAME
	.comm	_ENODEV,4,2                     ## @ENODEV
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_SURFACE_BUTTON_DEVICE_NAME,4,2 ## @SURFACE_BUTTON_DEVICE_NAME
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%s/buttons"

	.comm	_BUS_HOST,4,2                   ## @BUS_HOST
	.comm	_EV_KEY,4,2                     ## @EV_KEY
	.comm	_KEY_POWER,4,2                  ## @KEY_POWER
	.comm	_KEY_LEFTMETA,4,2               ## @KEY_LEFTMETA
	.comm	_KEY_VOLUMEUP,4,2               ## @KEY_VOLUMEUP
	.comm	_KEY_VOLUMEDOWN,4,2             ## @KEY_VOLUMEDOWN
L_.str.1:                               ## @.str.1
	.asciz	"%s [%s]\n"

	.no_dead_strip	_surface_button_add
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function surface_button_add
_surface_button_add:                    ; @surface_button_add
	.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	x19, x0
	bl	_acpi_device_hid
	mov	x23, x0
	mov	x0, x19
	bl	_acpi_device_bid
	mov	x20, x0
Lloh0:
	adrp	x8, _SURFACE_BUTTON_OBJ_NAME@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SURFACE_BUTTON_OBJ_NAME@GOTPAGEOFF]
Lloh2:
	ldr	w21, [x8]
	mov	x0, x21
	bl	_strlen
	mov	x2, x0
	mov	x0, x20
	mov	x1, x21
	bl	_strncmp
	cbz	x0, LBB0_4
LBB0_1:
Lloh3:
	adrp	x8, _ENODEV@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
LBB0_2:
	ldr	w8, [x8]
	neg	w23, w8
LBB0_3:
	mov	x0, x23
	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_4:
	mov	x0, x19
	bl	_surface_button_check_MSHW0040
	cbz	w0, LBB0_1
; %bb.5:
Lloh5:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh6:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
	mov	w0, #16
	bl	_kzalloc
	cbz	x0, LBB0_9
; %bb.6:
	mov	x20, x0
	str	x0, [x19, #8]
	bl	_input_allocate_device
	str	x0, [x20, #8]
	cbz	x0, LBB0_10
; %bb.7:
	mov	x22, x0
	mov	x0, x19
	bl	_acpi_device_name
	mov	x21, x0
Lloh8:
	adrp	x8, _SURFACE_BUTTON_DEVICE_NAME@GOTPAGE
Lloh9:
	ldr	x8, [x8, _SURFACE_BUTTON_DEVICE_NAME@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
	bl	_strcpy
	ldr	w0, [x20]
Lloh11:
	adrp	x2, l_.str@PAGE
Lloh12:
	add	x2, x2, l_.str@PAGEOFF
	mov	w1, #4
	mov	x3, x23
	bl	_snprintf
Lloh13:
	adrp	x8, _BUS_HOST@GOTPAGE
Lloh14:
	ldr	x8, [x8, _BUS_HOST@GOTPAGEOFF]
	ldr	w9, [x20]
Lloh15:
	ldr	w8, [x8]
	stp	w8, w9, [x22, #16]
	stp	x21, x19, [x22]
Lloh16:
	adrp	x23, _EV_KEY@GOTPAGE
Lloh17:
	ldr	x23, [x23, _EV_KEY@GOTPAGEOFF]
	ldr	w1, [x23]
Lloh18:
	adrp	x8, _KEY_POWER@GOTPAGE
Lloh19:
	ldr	x8, [x8, _KEY_POWER@GOTPAGEOFF]
Lloh20:
	ldr	w2, [x8]
	mov	x0, x22
	bl	_input_set_capability
	ldr	w1, [x23]
Lloh21:
	adrp	x8, _KEY_LEFTMETA@GOTPAGE
Lloh22:
	ldr	x8, [x8, _KEY_LEFTMETA@GOTPAGEOFF]
Lloh23:
	ldr	w2, [x8]
	mov	x0, x22
	bl	_input_set_capability
	ldr	w1, [x23]
Lloh24:
	adrp	x8, _KEY_VOLUMEUP@GOTPAGE
Lloh25:
	ldr	x8, [x8, _KEY_VOLUMEUP@GOTPAGEOFF]
Lloh26:
	ldr	w2, [x8]
	mov	x0, x22
	bl	_input_set_capability
	ldr	w1, [x23]
Lloh27:
	adrp	x8, _KEY_VOLUMEDOWN@GOTPAGE
Lloh28:
	ldr	x8, [x8, _KEY_VOLUMEDOWN@GOTPAGEOFF]
Lloh29:
	ldr	w2, [x8]
	mov	x0, x22
	bl	_input_set_capability
	mov	x0, x22
	bl	_input_register_device
	mov	x23, x0
	cbz	w0, LBB0_12
; %bb.8:
	mov	x0, x22
	bl	_input_free_device
	b	LBB0_11
LBB0_9:
Lloh30:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh31:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_2
LBB0_10:
Lloh32:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh33:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh34:
	ldr	w8, [x8]
	neg	w23, w8
LBB0_11:
	mov	x0, x20
	bl	_kfree
	b	LBB0_3
LBB0_12:
	mov	x0, x19
	mov	w1, #1
	bl	_device_init_wakeup
	mov	x0, x19
	bl	_acpi_device_bid
	mov	x3, x0
Lloh35:
	adrp	x1, l_.str.1@PAGE
Lloh36:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x19
	mov	x2, x21
	bl	_dev_info
	b	LBB0_3
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpAdd	Lloh35, Lloh36
	.cfi_endproc
                                        ; -- End function
	.comm	_SURFACE_BUTTON_OBJ_NAME,4,2    ; @SURFACE_BUTTON_OBJ_NAME
	.comm	_ENODEV,4,2                     ; @ENODEV
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_SURFACE_BUTTON_DEVICE_NAME,4,2 ; @SURFACE_BUTTON_DEVICE_NAME
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%s/buttons"

	.comm	_BUS_HOST,4,2                   ; @BUS_HOST
	.comm	_EV_KEY,4,2                     ; @EV_KEY
	.comm	_KEY_POWER,4,2                  ; @KEY_POWER
	.comm	_KEY_LEFTMETA,4,2               ; @KEY_LEFTMETA
	.comm	_KEY_VOLUMEUP,4,2               ; @KEY_VOLUMEUP
	.comm	_KEY_VOLUMEDOWN,4,2             ; @KEY_VOLUMEDOWN
l_.str.1:                               ; @.str.1
	.asciz	"%s [%s]\n"

	.no_dead_strip	_surface_button_add
.subsections_via_symbols
