	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function applesmc_init_smcreg_try
_applesmc_init_smcreg_try:              ## @applesmc_init_smcreg_try
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset %rbx, -24
	movl	$0, -20(%rbp)
	movl	$0, -16(%rbp)
	movq	_smcreg@GOTPCREL(%rip), %rbx
	xorl	%eax, %eax
	cmpl	$0, (%rbx)
	jne	LBB0_16
## %bb.1:
	leaq	-12(%rbp), %rdi
	callq	_read_register_count
	testl	%eax, %eax
	jne	LBB0_16
## %bb.2:
	cmpq	$0, 56(%rbx)
	je	LBB0_5
## %bb.3:
	movl	4(%rbx), %esi
	movl	-12(%rbp), %edx
	cmpl	%edx, %esi
	je	LBB0_7
## %bb.4:
	leaq	L_.str(%rip), %rdi
	callq	_pr_warn
	movq	56(%rbx), %rdi
	callq	_kfree
	movq	$0, 56(%rbx)
LBB0_5:
	movl	-12(%rbp), %edi
	movl	%edi, 4(%rbx)
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	$4, %esi
	callq	_kcalloc
	movq	%rax, 56(%rbx)
	testq	%rax, %rax
	je	LBB0_6
LBB0_7:
	movq	_FANS_COUNT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	-24(%rbp), %rsi
	movl	$1, %edx
	callq	_applesmc_read_key
	testl	%eax, %eax
	jne	LBB0_16
## %bb.8:
	movl	-24(%rbp), %eax
	cmpl	$10, %eax
	movl	$10, %ecx
	cmovll	%eax, %ecx
	movl	%ecx, 8(%rbx)
	leaq	40(%rbx), %rdi
	leaq	L_.str.1(%rip), %rsi
	callq	_applesmc_get_lower_bound
	testl	%eax, %eax
	jne	LBB0_16
## %bb.9:
	leaq	48(%rbx), %rdi
	leaq	L_.str.2(%rip), %rsi
	callq	_applesmc_get_lower_bound
	testl	%eax, %eax
	jne	LBB0_16
## %bb.10:
	movq	48(%rbx), %rax
	subq	40(%rbx), %rax
	movq	%rax, 32(%rbx)
	movq	%rbx, %rdi
	callq	_applesmc_init_index
	testl	%eax, %eax
	jne	LBB0_16
## %bb.11:
	movq	_LIGHT_SENSOR_LEFT_KEY@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	-20(%rbp), %rsi
	callq	_applesmc_has_key
	testl	%eax, %eax
	jne	LBB0_16
## %bb.12:
	movq	_LIGHT_SENSOR_RIGHT_KEY@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	-16(%rbp), %rsi
	callq	_applesmc_has_key
	testl	%eax, %eax
	jne	LBB0_16
## %bb.13:
	movq	_MOTION_SENSOR_KEY@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	12(%rbx), %rsi
	callq	_applesmc_has_key
	testl	%eax, %eax
	jne	LBB0_16
## %bb.14:
	movq	_BACKLIGHT_KEY@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	16(%rbx), %rsi
	callq	_applesmc_has_key
	testl	%eax, %eax
	jne	LBB0_16
## %bb.15:
	movl	-16(%rbp), %eax
	addl	-20(%rbp), %eax
	movl	%eax, 20(%rbx)
	movl	$1, (%rbx)
	movl	4(%rbx), %esi
	movl	8(%rbx), %edx
	movq	32(%rbx), %rcx
	movl	24(%rbx), %r8d
	movl	12(%rbx), %r9d
	movl	16(%rbx), %ebx
	leaq	L_.str.3(%rip), %rdi
	pushq	%rbx
	pushq	%rax
	callq	_pr_info
	addq	$16, %rsp
	xorl	%eax, %eax
	jmp	LBB0_16
LBB0_6:
	movq	_ENOMEM@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_16:
	addq	$24, %rsp
	popq	%rbx
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_smcreg,64,3                    ## @smcreg
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"key count changed from %d to %d\n"

	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_FANS_COUNT,4,2                 ## @FANS_COUNT
L_.str.1:                               ## @.str.1
	.asciz	"T"

L_.str.2:                               ## @.str.2
	.asciz	"U"

	.comm	_LIGHT_SENSOR_LEFT_KEY,4,2      ## @LIGHT_SENSOR_LEFT_KEY
	.comm	_LIGHT_SENSOR_RIGHT_KEY,4,2     ## @LIGHT_SENSOR_RIGHT_KEY
	.comm	_MOTION_SENSOR_KEY,4,2          ## @MOTION_SENSOR_KEY
	.comm	_BACKLIGHT_KEY,4,2              ## @BACKLIGHT_KEY
L_.str.3:                               ## @.str.3
	.asciz	"key=%d fan=%d temp=%d index=%d acc=%d lux=%d kbd=%d\n"

	.no_dead_strip	_applesmc_init_smcreg_try
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function applesmc_init_smcreg_try
_applesmc_init_smcreg_try:              ; @applesmc_init_smcreg_try
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #48
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	w0, #0
	str	xzr, [sp, #8]
Lloh0:
	adrp	x19, _smcreg@GOTPAGE
Lloh1:
	ldr	x19, [x19, _smcreg@GOTPAGEOFF]
	ldr	w8, [x19]
	cbnz	w8, LBB0_16
; %bb.1:
	add	x0, sp, #4
	bl	_read_register_count
	cbnz	w0, LBB0_16
; %bb.2:
	ldr	x8, [x19, #56]
	cbz	x8, LBB0_5
; %bb.3:
	ldr	w1, [x19, #4]
	ldr	w2, [sp, #4]
	cmp	w1, w2
	b.eq	LBB0_6
; %bb.4:
Lloh2:
	adrp	x0, l_.str@PAGE
Lloh3:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_warn
	ldr	x0, [x19, #56]
	bl	_kfree
	str	xzr, [x19, #56]
LBB0_5:
	ldr	w0, [sp, #4]
	str	w0, [x19, #4]
Lloh4:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh5:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh6:
	ldr	w2, [x8]
	mov	w1, #4
	bl	_kcalloc
	str	x0, [x19, #56]
	cbz	x0, LBB0_15
LBB0_6:
Lloh7:
	adrp	x8, _FANS_COUNT@GOTPAGE
Lloh8:
	ldr	x8, [x8, _FANS_COUNT@GOTPAGEOFF]
Lloh9:
	ldr	w0, [x8]
	mov	x1, sp
	mov	w2, #1
	bl	_applesmc_read_key
	cbnz	w0, LBB0_16
; %bb.7:
	ldr	w8, [sp]
	mov	w9, #10
	cmp	w8, #10
	csel	w8, w8, w9, lt
	str	w8, [x19, #8]
	add	x0, x19, #40
Lloh10:
	adrp	x1, l_.str.1@PAGE
Lloh11:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_applesmc_get_lower_bound
	cbnz	w0, LBB0_16
; %bb.8:
	add	x0, x19, #48
Lloh12:
	adrp	x1, l_.str.2@PAGE
Lloh13:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_applesmc_get_lower_bound
	cbnz	w0, LBB0_16
; %bb.9:
	ldp	x9, x8, [x19, #40]
	sub	x8, x8, x9
	str	x8, [x19, #32]
	mov	x0, x19
	bl	_applesmc_init_index
	cbnz	w0, LBB0_16
; %bb.10:
Lloh14:
	adrp	x8, _LIGHT_SENSOR_LEFT_KEY@GOTPAGE
Lloh15:
	ldr	x8, [x8, _LIGHT_SENSOR_LEFT_KEY@GOTPAGEOFF]
Lloh16:
	ldr	w0, [x8]
	add	x1, sp, #12
	bl	_applesmc_has_key
	cbnz	w0, LBB0_16
; %bb.11:
Lloh17:
	adrp	x8, _LIGHT_SENSOR_RIGHT_KEY@GOTPAGE
Lloh18:
	ldr	x8, [x8, _LIGHT_SENSOR_RIGHT_KEY@GOTPAGEOFF]
Lloh19:
	ldr	w0, [x8]
	add	x1, sp, #8
	bl	_applesmc_has_key
	cbnz	w0, LBB0_16
; %bb.12:
Lloh20:
	adrp	x8, _MOTION_SENSOR_KEY@GOTPAGE
Lloh21:
	ldr	x8, [x8, _MOTION_SENSOR_KEY@GOTPAGEOFF]
Lloh22:
	ldr	w0, [x8]
	add	x1, x19, #12
	bl	_applesmc_has_key
	cbnz	w0, LBB0_16
; %bb.13:
Lloh23:
	adrp	x8, _BACKLIGHT_KEY@GOTPAGE
Lloh24:
	ldr	x8, [x8, _BACKLIGHT_KEY@GOTPAGEOFF]
Lloh25:
	ldr	w0, [x8]
	add	x1, x19, #16
	bl	_applesmc_has_key
	cbnz	w0, LBB0_16
; %bb.14:
	ldp	w9, w8, [sp, #8]
	add	w6, w9, w8
	str	w6, [x19, #20]
	mov	w8, #1
	str	w8, [x19]
	ldp	w1, w2, [x19, #4]
	ldr	x3, [x19, #32]
	ldr	w4, [x19, #24]
	ldp	w5, w7, [x19, #12]
Lloh26:
	adrp	x0, l_.str.3@PAGE
Lloh27:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_pr_info
	mov	w0, #0
	b	LBB0_16
LBB0_15:
Lloh28:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh29:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh30:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_16:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.cfi_endproc
                                        ; -- End function
	.comm	_smcreg,64,3                    ; @smcreg
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"key count changed from %d to %d\n"

	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_FANS_COUNT,4,2                 ; @FANS_COUNT
l_.str.1:                               ; @.str.1
	.asciz	"T"

l_.str.2:                               ; @.str.2
	.asciz	"U"

	.comm	_LIGHT_SENSOR_LEFT_KEY,4,2      ; @LIGHT_SENSOR_LEFT_KEY
	.comm	_LIGHT_SENSOR_RIGHT_KEY,4,2     ; @LIGHT_SENSOR_RIGHT_KEY
	.comm	_MOTION_SENSOR_KEY,4,2          ; @MOTION_SENSOR_KEY
	.comm	_BACKLIGHT_KEY,4,2              ; @BACKLIGHT_KEY
l_.str.3:                               ; @.str.3
	.asciz	"key=%d fan=%d temp=%d index=%d acc=%d lux=%d kbd=%d\n"

	.no_dead_strip	_applesmc_init_smcreg_try
.subsections_via_symbols
