	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function elan_i2c_power_control
_elan_i2c_power_control:                ## @elan_i2c_power_control
	.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
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r15d
	movq	%rdi, %r14
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -40(%rbp)
	movq	_ETP_I2C_POWER_CMD@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	leaq	-48(%rbp), %rdx
	callq	_elan_i2c_read_cmd
	testl	%eax, %eax
	je	LBB0_2
## %bb.1:
	movl	%eax, %ebx
	leaq	L_.str(%rip), %rsi
	jmp	LBB0_5
LBB0_2:
	leaq	-48(%rbp), %rdi
	callq	_le16_to_cpup
	movq	_ETP_DISABLE_POWER@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movl	%edx, %ecx
	notl	%ecx
	andl	%eax, %ecx
	orl	%eax, %edx
	testl	%r15d, %r15d
	cmovnel	%ecx, %edx
	movl	(%r12), %esi
	movq	%r14, %rdi
	callq	_elan_i2c_write_cmd
	testl	%eax, %eax
	je	LBB0_3
## %bb.4:
	movl	%eax, %ebx
	leaq	L_.str.1(%rip), %rsi
LBB0_5:
	movq	%r14, %rdi
	movl	%ebx, %edx
	callq	_dev_err
LBB0_6:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-40(%rbp), %rax
	jne	LBB0_8
## %bb.7:
	movl	%ebx, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_3:
	xorl	%ebx, %ebx
	jmp	LBB0_6
LBB0_8:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_ETP_I2C_POWER_CMD,4,2          ## @ETP_I2C_POWER_CMD
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"failed to read current power state: %d\n"

	.comm	_ETP_DISABLE_POWER,4,2          ## @ETP_DISABLE_POWER
L_.str.1:                               ## @.str.1
	.asciz	"failed to write current power state: %d\n"

	.no_dead_strip	_elan_i2c_power_control
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function elan_i2c_power_control
_elan_i2c_power_control:                ; @elan_i2c_power_control
	.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, x1
	mov	x19, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #8]
Lloh3:
	adrp	x22, _ETP_I2C_POWER_CMD@GOTPAGE
Lloh4:
	ldr	x22, [x22, _ETP_I2C_POWER_CMD@GOTPAGEOFF]
	ldr	w1, [x22]
	mov	x2, sp
	bl	_elan_i2c_read_cmd
	cbz	w0, LBB0_2
; %bb.1:
	mov	x20, x0
Lloh5:
	adrp	x1, l_.str@PAGE
Lloh6:
	add	x1, x1, l_.str@PAGEOFF
	b	LBB0_4
LBB0_2:
	mov	x0, sp
	bl	_le16_to_cpup
Lloh7:
	adrp	x8, _ETP_DISABLE_POWER@GOTPAGE
Lloh8:
	ldr	x8, [x8, _ETP_DISABLE_POWER@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	bic	w9, w0, w8
	orr	w8, w8, w0
	cmp	w21, #0
	csel	w2, w8, w9, eq
	ldr	w1, [x22]
	mov	x0, x19
	bl	_elan_i2c_write_cmd
	mov	x20, x0
	cbz	w0, LBB0_5
; %bb.3:
Lloh10:
	adrp	x1, l_.str.1@PAGE
Lloh11:
	add	x1, x1, l_.str.1@PAGEOFF
LBB0_4:
	mov	x0, x19
	mov	x2, x20
	bl	_dev_err
LBB0_5:
	ldr	x8, [sp, #8]
Lloh12:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh13:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh14:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_7
; %bb.6:
	mov	x0, x20
	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
LBB0_7:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_ETP_I2C_POWER_CMD,4,2          ; @ETP_I2C_POWER_CMD
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"failed to read current power state: %d\n"

	.comm	_ETP_DISABLE_POWER,4,2          ; @ETP_DISABLE_POWER
l_.str.1:                               ; @.str.1
	.asciz	"failed to write current power state: %d\n"

	.no_dead_strip	_elan_i2c_power_control
.subsections_via_symbols
