	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function applesmc_get_entry_by_index
_applesmc_get_entry_by_index:           ## @applesmc_get_entry_by_index
	.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	$112, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -40(%rbp)
	movq	_smcreg@GOTPCREL(%rip), %rax
	movq	8(%rax), %r15
	movslq	%edi, %rax
	leaq	(%rax,%rax,4), %r12
	leaq	(%r15,%r12,8), %r14
	cmpl	$0, (%r15,%r12,8)
	jne	LBB0_7
## %bb.1:
	movl	%edi, %ebx
	movq	_smcreg@GOTPCREL(%rip), %rdi
	callq	_mutex_lock
	cmpl	$0, (%r14)
	je	LBB0_2
LBB0_5:
	movq	_smcreg@GOTPCREL(%rip), %rdi
	callq	_mutex_unlock
	jmp	LBB0_7
LBB0_2:
	movl	%ebx, %edi
	callq	_cpu_to_be32
	movl	%eax, -132(%rbp)
	movq	_APPLESMC_GET_KEY_BY_INDEX_CMD@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	-132(%rbp), %rsi
	leaq	-80(%rbp), %rdx
	movl	$4, %ecx
	callq	_read_smc
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_6
## %bb.3:
	movq	_APPLESMC_GET_KEY_TYPE_CMD@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	-80(%rbp), %rsi
	leaq	-128(%rbp), %rdx
	movl	$6, %ecx
	callq	_read_smc
	movl	%eax, %ebx
	testl	%eax, %eax
	je	LBB0_4
LBB0_6:
	movq	_smcreg@GOTPCREL(%rip), %rdi
	callq	_mutex_unlock
	movl	%ebx, %edi
	callq	_ERR_PTR
	movq	%rax, %r14
LBB0_7:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-40(%rbp), %rax
	jne	LBB0_9
## %bb.8:
	movq	%r14, %rax
	addq	$112, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	movl	32(%r15,%r12,8), %edi
	leaq	-80(%rbp), %rsi
	movl	$4, %edx
	callq	_memcpy
	movq	-128(%rbp), %rax
	movq	%rax, 24(%r15,%r12,8)
	movl	16(%r15,%r12,8), %edi
	leaq	-120(%rbp), %rsi
	movl	$4, %edx
	callq	_memcpy
	movq	-88(%rbp), %rax
	movq	%rax, 8(%r15,%r12,8)
	movl	$1, (%r14)
	jmp	LBB0_5
LBB0_9:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_smcreg,16,3                    ## @smcreg
	.comm	_APPLESMC_GET_KEY_BY_INDEX_CMD,4,2 ## @APPLESMC_GET_KEY_BY_INDEX_CMD
	.comm	_APPLESMC_GET_KEY_TYPE_CMD,4,2  ## @APPLESMC_GET_KEY_TYPE_CMD
	.no_dead_strip	_applesmc_get_entry_by_index
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function applesmc_get_entry_by_index
_applesmc_get_entry_by_index:           ; @applesmc_get_entry_by_index
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #160
	.cfi_def_cfa_offset 160
	stp	x24, x23, [sp, #96]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #112]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #128]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #144]            ; 16-byte Folded Spill
	add	x29, sp, #144
	.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
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-56]
Lloh3:
	adrp	x8, _smcreg@GOTPAGE
Lloh4:
	ldr	x8, [x8, _smcreg@GOTPAGEOFF]
Lloh5:
	ldr	x22, [x8, #8]
	mov	w8, #40
	smaddl	x19, w0, w8, x22
	ldr	w8, [x19]
	cbnz	w8, LBB0_6
; %bb.1:
	mov	x20, x0
Lloh6:
	adrp	x0, _smcreg@GOTPAGE
Lloh7:
	ldr	x0, [x0, _smcreg@GOTPAGEOFF]
	bl	_mutex_lock
	ldr	w8, [x19]
	cbz	w8, LBB0_3
LBB0_2:
Lloh8:
	adrp	x0, _smcreg@GOTPAGE
Lloh9:
	ldr	x0, [x0, _smcreg@GOTPAGEOFF]
	bl	_mutex_unlock
	b	LBB0_6
LBB0_3:
	mov	x0, x20
	bl	_cpu_to_be32
	str	w0, [sp, #4]
Lloh10:
	adrp	x8, _APPLESMC_GET_KEY_BY_INDEX_CMD@GOTPAGE
Lloh11:
	ldr	x8, [x8, _APPLESMC_GET_KEY_BY_INDEX_CMD@GOTPAGEOFF]
Lloh12:
	ldr	w0, [x8]
	add	x1, sp, #4
	add	x2, sp, #56
	mov	w3, #4
	bl	_read_smc
	mov	x21, x0
	cbnz	w0, LBB0_5
; %bb.4:
Lloh13:
	adrp	x8, _APPLESMC_GET_KEY_TYPE_CMD@GOTPAGE
Lloh14:
	ldr	x8, [x8, _APPLESMC_GET_KEY_TYPE_CMD@GOTPAGEOFF]
Lloh15:
	ldr	w0, [x8]
	add	x23, sp, #8
	add	x1, sp, #56
	add	x2, sp, #8
	mov	w3, #6
	bl	_read_smc
	mov	x21, x0
	cbz	w0, LBB0_8
LBB0_5:
Lloh16:
	adrp	x0, _smcreg@GOTPAGE
Lloh17:
	ldr	x0, [x0, _smcreg@GOTPAGEOFF]
	bl	_mutex_unlock
	mov	x0, x21
	bl	_ERR_PTR
	mov	x19, x0
LBB0_6:
	ldur	x8, [x29, #-56]
Lloh18:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh19:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh20:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_9
; %bb.7:
	mov	x0, x19
	ldp	x29, x30, [sp, #144]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #128]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #112]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #96]             ; 16-byte Folded Reload
	add	sp, sp, #160
	ret
LBB0_8:
	sxtw	x8, w20
	mov	w9, #40
	madd	x20, x8, x9, x22
	ldr	w0, [x20, #32]
	add	x1, sp, #56
	mov	w2, #4
	bl	_memcpy
	ldr	x8, [sp, #8]
	str	x8, [x20, #24]
	ldr	w0, [x20, #16]
	add	x1, x23, #8
	mov	w2, #4
	bl	_memcpy
	ldr	x8, [sp, #48]
	str	x8, [x20, #8]
	mov	w8, #1
	str	w8, [x19]
	b	LBB0_2
LBB0_9:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_smcreg,16,3                    ; @smcreg
	.comm	_APPLESMC_GET_KEY_BY_INDEX_CMD,4,2 ; @APPLESMC_GET_KEY_BY_INDEX_CMD
	.comm	_APPLESMC_GET_KEY_TYPE_CMD,4,2  ; @APPLESMC_GET_KEY_TYPE_CMD
	.no_dead_strip	_applesmc_get_entry_by_index
.subsections_via_symbols
