	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function tpacpi_brightness_checkpoint_nvram
_tpacpi_brightness_checkpoint_nvram:    ## @tpacpi_brightness_checkpoint_nvram
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	$0, -28(%rbp)
	movq	_brightness_mode@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_TPACPI_BRGHT_MODE_ECNVRAM@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_7
## %bb.1:
	movq	_TPACPI_DBG_BRGHT@GOTPCREL(%rip), %r14
	movl	(%r14), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%eax, %eax
	callq	_vdbg_printk
	movq	_brightness_mutex@GOTPCREL(%rip), %rdi
	callq	_mutex_lock_killable
	testq	%rax, %rax
	js	LBB0_7
## %bb.2:
	movq	_TP_EC_BACKLIGHT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	-28(%rbp), %rsi
	callq	_acpi_ec_read
	xorl	%edi, %edi
	testl	%eax, %eax
	sete	%dil
	callq	_unlikely
	testq	%rax, %rax
	jne	LBB0_6
## %bb.3:
	movq	_TP_EC_BACKLIGHT_LVLMSK@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	andl	%eax, -28(%rbp)
	movq	_TP_NVRAM_ADDR_BRIGHTNESS@GOTPCREL(%rip), %r15
	movl	(%r15), %edi
	callq	_nvram_read_byte
	movl	%eax, %ebx
	movl	-28(%rbp), %edx
	movq	_TP_NVRAM_MASK_LEVEL_BRIGHTNESS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	andl	%ebx, %esi
	movq	_TP_NVRAM_POS_LEVEL_BRIGHTNESS@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	sarl	%cl, %esi
	cmpl	%esi, %edx
	jne	LBB0_4
## %bb.5:
	movl	(%r14), %edi
	leaq	L_.str.2(%rip), %rsi
	movl	%ebx, %ecx
	xorl	%eax, %eax
	callq	_vdbg_printk
	jmp	LBB0_6
LBB0_4:
                                        ## kill: def $cl killed $cl killed $ecx
	shll	%cl, %eax
	notl	%eax
	andl	%eax, %ebx
	orl	%edx, %ebx
	movl	(%r15), %esi
	movl	%ebx, %edi
	callq	_nvram_write_byte
	movl	(%r14), %edi
	movl	-28(%rbp), %edx
	leaq	L_.str.1(%rip), %rsi
	movl	%ebx, %ecx
	callq	_dbg_printk
LBB0_6:
	movq	_brightness_mutex@GOTPCREL(%rip), %rdi
	callq	_mutex_unlock
LBB0_7:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_brightness_mode,8,3            ## @brightness_mode
	.comm	_TPACPI_BRGHT_MODE_ECNVRAM,8,3  ## @TPACPI_BRGHT_MODE_ECNVRAM
	.comm	_TPACPI_DBG_BRGHT,4,2           ## @TPACPI_DBG_BRGHT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"trying to checkpoint backlight level to NVRAM...\n"

	.comm	_brightness_mutex,4,2           ## @brightness_mutex
	.comm	_TP_EC_BACKLIGHT,4,2            ## @TP_EC_BACKLIGHT
	.comm	_TP_EC_BACKLIGHT_LVLMSK,4,2     ## @TP_EC_BACKLIGHT_LVLMSK
	.comm	_TP_NVRAM_ADDR_BRIGHTNESS,4,2   ## @TP_NVRAM_ADDR_BRIGHTNESS
	.comm	_TP_NVRAM_MASK_LEVEL_BRIGHTNESS,4,2 ## @TP_NVRAM_MASK_LEVEL_BRIGHTNESS
	.comm	_TP_NVRAM_POS_LEVEL_BRIGHTNESS,4,2 ## @TP_NVRAM_POS_LEVEL_BRIGHTNESS
L_.str.1:                               ## @.str.1
	.asciz	"updated NVRAM backlight level to %u (0x%02x)\n"

L_.str.2:                               ## @.str.2
	.asciz	"NVRAM backlight level already is %u (0x%02x)\n"

	.no_dead_strip	_tpacpi_brightness_checkpoint_nvram
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function tpacpi_brightness_checkpoint_nvram
_tpacpi_brightness_checkpoint_nvram:    ; @tpacpi_brightness_checkpoint_nvram
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	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
Lloh0:
	adrp	x8, _brightness_mode@GOTPAGE
Lloh1:
	ldr	x8, [x8, _brightness_mode@GOTPAGEOFF]
	str	wzr, [sp, #28]
Lloh2:
	ldr	x8, [x8]
Lloh3:
	adrp	x9, _TPACPI_BRGHT_MODE_ECNVRAM@GOTPAGE
Lloh4:
	ldr	x9, [x9, _TPACPI_BRGHT_MODE_ECNVRAM@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_7
; %bb.1:
Lloh6:
	adrp	x20, _TPACPI_DBG_BRGHT@GOTPAGE
Lloh7:
	ldr	x20, [x20, _TPACPI_DBG_BRGHT@GOTPAGEOFF]
	ldr	w0, [x20]
Lloh8:
	adrp	x1, l_.str@PAGE
Lloh9:
	add	x1, x1, l_.str@PAGEOFF
	bl	_vdbg_printk
Lloh10:
	adrp	x0, _brightness_mutex@GOTPAGE
Lloh11:
	ldr	x0, [x0, _brightness_mutex@GOTPAGEOFF]
	bl	_mutex_lock_killable
	tbnz	x0, #63, LBB0_7
; %bb.2:
Lloh12:
	adrp	x8, _TP_EC_BACKLIGHT@GOTPAGE
Lloh13:
	ldr	x8, [x8, _TP_EC_BACKLIGHT@GOTPAGEOFF]
Lloh14:
	ldr	w0, [x8]
	add	x1, sp, #28
	bl	_acpi_ec_read
	cmp	w0, #0
	cset	w0, eq
	bl	_unlikely
	cbnz	x0, LBB0_6
; %bb.3:
Lloh15:
	adrp	x8, _TP_EC_BACKLIGHT_LVLMSK@GOTPAGE
Lloh16:
	ldr	x8, [x8, _TP_EC_BACKLIGHT_LVLMSK@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
	ldr	w9, [sp, #28]
	and	w8, w9, w8
	str	w8, [sp, #28]
Lloh18:
	adrp	x21, _TP_NVRAM_ADDR_BRIGHTNESS@GOTPAGE
Lloh19:
	ldr	x21, [x21, _TP_NVRAM_ADDR_BRIGHTNESS@GOTPAGEOFF]
	ldr	w0, [x21]
	bl	_nvram_read_byte
                                        ; kill: def $w0 killed $w0 def $x0
	ldr	w9, [sp, #28]
Lloh20:
	adrp	x8, _TP_NVRAM_MASK_LEVEL_BRIGHTNESS@GOTPAGE
Lloh21:
	ldr	x8, [x8, _TP_NVRAM_MASK_LEVEL_BRIGHTNESS@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
	and	w11, w8, w0
Lloh23:
	adrp	x10, _TP_NVRAM_POS_LEVEL_BRIGHTNESS@GOTPAGE
Lloh24:
	ldr	x10, [x10, _TP_NVRAM_POS_LEVEL_BRIGHTNESS@GOTPAGEOFF]
Lloh25:
	ldr	w10, [x10]
	asr	w11, w11, w10
	cmp	w9, w11
	b.ne	LBB0_5
; %bb.4:
	ldr	w8, [x20]
	stp	x9, x0, [sp]
Lloh26:
	adrp	x1, l_.str.2@PAGE
Lloh27:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x8
	bl	_vdbg_printk
	b	LBB0_6
LBB0_5:
	lsl	w8, w8, w10
	bic	w8, w0, w8
	orr	w19, w8, w9
	ldr	w1, [x21]
	mov	x0, x19
	bl	_nvram_write_byte
	ldr	w0, [x20]
	ldr	w2, [sp, #28]
Lloh28:
	adrp	x1, l_.str.1@PAGE
Lloh29:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x3, x19
	bl	_dbg_printk
LBB0_6:
Lloh30:
	adrp	x0, _brightness_mutex@GOTPAGE
Lloh31:
	ldr	x0, [x0, _brightness_mutex@GOTPAGEOFF]
	bl	_mutex_unlock
LBB0_7:
	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
	add	sp, sp, #80
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpAdd	Lloh28, Lloh29
	.loh AdrpLdrGot	Lloh30, Lloh31
	.cfi_endproc
                                        ; -- End function
	.comm	_brightness_mode,8,3            ; @brightness_mode
	.comm	_TPACPI_BRGHT_MODE_ECNVRAM,8,3  ; @TPACPI_BRGHT_MODE_ECNVRAM
	.comm	_TPACPI_DBG_BRGHT,4,2           ; @TPACPI_DBG_BRGHT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"trying to checkpoint backlight level to NVRAM...\n"

	.comm	_brightness_mutex,4,2           ; @brightness_mutex
	.comm	_TP_EC_BACKLIGHT,4,2            ; @TP_EC_BACKLIGHT
	.comm	_TP_EC_BACKLIGHT_LVLMSK,4,2     ; @TP_EC_BACKLIGHT_LVLMSK
	.comm	_TP_NVRAM_ADDR_BRIGHTNESS,4,2   ; @TP_NVRAM_ADDR_BRIGHTNESS
	.comm	_TP_NVRAM_MASK_LEVEL_BRIGHTNESS,4,2 ; @TP_NVRAM_MASK_LEVEL_BRIGHTNESS
	.comm	_TP_NVRAM_POS_LEVEL_BRIGHTNESS,4,2 ; @TP_NVRAM_POS_LEVEL_BRIGHTNESS
l_.str.1:                               ; @.str.1
	.asciz	"updated NVRAM backlight level to %u (0x%02x)\n"

l_.str.2:                               ; @.str.2
	.asciz	"NVRAM backlight level already is %u (0x%02x)\n"

	.no_dead_strip	_tpacpi_brightness_checkpoint_nvram
.subsections_via_symbols
