	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ci_load_smc_ucode
_ci_load_smc_ucode:                     ## @ci_load_smc_ucode
	.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
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	xorps	%xmm0, %xmm0
	movaps	%xmm0, -64(%rbp)
	movaps	%xmm0, -80(%rbp)
	movl	(%rdi), %edi
	movq	_CGS_UCODE_ID_SMU@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-80(%rbp), %rdx
	callq	_cgs_get_firmware_info
	movl	-60(%rbp), %eax
	movl	%eax, 8(%r14)
	movl	-64(%rbp), %eax
	movl	%eax, 4(%r14)
	movl	-80(%rbp), %r15d
	movq	_SMC_RAM_END@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r15d
	jle	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rdi
	jmp	LBB0_8
LBB0_2:
	movl	-76(%rbp), %edx
	movq	-72(%rbp), %rbx
	movl	(%r14), %edi
	movq	_mmSMC_IND_INDEX_0@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_cgs_write_register
	movl	(%r14), %edi
	movq	_SMC_IND_ACCESS_CNTL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_AUTO_INCREMENT_IND_0@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	$1, %ecx
	callq	_PHM_WRITE_FIELD
	cmpl	$4, %r15d
	jl	LBB0_3
## %bb.4:
	movq	_mmSMC_IND_DATA_0@GOTPCREL(%rip), %r12
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%rbx), %eax
	movl	4(%rbx), %ecx
	shll	$24, %eax
	shll	$16, %ecx
	orl	%eax, %ecx
	movl	8(%rbx), %edx
	shll	$8, %edx
	orl	%ecx, %edx
	orl	12(%rbx), %edx
	movl	(%r14), %edi
	movl	(%r12), %esi
	callq	_cgs_write_register
	leal	-4(%r15), %r13d
	addq	$16, %rbx
	cmpl	$7, %r15d
	movl	%r13d, %r15d
	ja	LBB0_5
	jmp	LBB0_6
LBB0_3:
	movl	%r15d, %r13d
LBB0_6:
	movl	(%r14), %edi
	movq	_SMC_IND_ACCESS_CNTL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_AUTO_INCREMENT_IND_0@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	xorl	%ebx, %ebx
	xorl	%ecx, %ecx
	callq	_PHM_WRITE_FIELD
	testl	%r13d, %r13d
	je	LBB0_9
## %bb.7:
	leaq	L_.str.1(%rip), %rdi
LBB0_8:
	callq	_pr_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_9:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_CGS_UCODE_ID_SMU,4,2           ## @CGS_UCODE_ID_SMU
	.comm	_SMC_RAM_END,4,2                ## @SMC_RAM_END
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"SMC address is beyond the SMC RAM area.\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_mmSMC_IND_INDEX_0,4,2          ## @mmSMC_IND_INDEX_0
	.comm	_SMC_IND_ACCESS_CNTL,4,2        ## @SMC_IND_ACCESS_CNTL
	.comm	_AUTO_INCREMENT_IND_0,4,2       ## @AUTO_INCREMENT_IND_0
	.comm	_mmSMC_IND_DATA_0,4,2           ## @mmSMC_IND_DATA_0
L_.str.1:                               ## @.str.1
	.asciz	"SMC size must be divisible by 4\n"

	.no_dead_strip	_ci_load_smc_ucode
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ci_load_smc_ucode
_ci_load_smc_ucode:                     ; @ci_load_smc_ucode
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x19, x0
	movi.2d	v0, #0000000000000000
	stp	q0, q0, [sp]
	ldr	w0, [x0]
Lloh0:
	adrp	x8, _CGS_UCODE_ID_SMU@GOTPAGE
Lloh1:
	ldr	x8, [x8, _CGS_UCODE_ID_SMU@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	x2, sp
	bl	_cgs_get_firmware_info
	ldr	d0, [sp, #16]
	stur	d0, [x19, #4]
	ldr	w20, [sp]
Lloh3:
	adrp	x8, _SMC_RAM_END@GOTPAGE
Lloh4:
	ldr	x8, [x8, _SMC_RAM_END@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	cmp	w20, w8
	b.le	LBB0_2
; %bb.1:
Lloh6:
	adrp	x0, l_.str@PAGE
Lloh7:
	add	x0, x0, l_.str@PAGEOFF
	b	LBB0_8
LBB0_2:
	ldr	w2, [sp, #4]
	ldr	x21, [sp, #8]
	ldr	w0, [x19]
Lloh8:
	adrp	x8, _mmSMC_IND_INDEX_0@GOTPAGE
Lloh9:
	ldr	x8, [x8, _mmSMC_IND_INDEX_0@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
	bl	_cgs_write_register
	ldr	w0, [x19]
Lloh11:
	adrp	x22, _SMC_IND_ACCESS_CNTL@GOTPAGE
Lloh12:
	ldr	x22, [x22, _SMC_IND_ACCESS_CNTL@GOTPAGEOFF]
	ldr	w1, [x22]
Lloh13:
	adrp	x23, _AUTO_INCREMENT_IND_0@GOTPAGE
Lloh14:
	ldr	x23, [x23, _AUTO_INCREMENT_IND_0@GOTPAGEOFF]
	ldr	w2, [x23]
	mov	w3, #1
	bl	_PHM_WRITE_FIELD
	cmp	w20, #4
	b.lt	LBB0_5
; %bb.3:
Lloh15:
	adrp	x24, _mmSMC_IND_DATA_0@GOTPAGE
Lloh16:
	ldr	x24, [x24, _mmSMC_IND_DATA_0@GOTPAGEOFF]
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldp	w8, w9, [x21]
	lsl	w9, w9, #16
	orr	w8, w9, w8, lsl #24
	ldp	w9, w10, [x21, #8]
	orr	w8, w8, w9, lsl #8
	orr	w2, w8, w10
	ldr	w0, [x19]
	ldr	w1, [x24]
	bl	_cgs_write_register
	sub	w25, w20, #4
	add	x21, x21, #16
	cmp	w20, #7
	mov	x20, x25
	b.hi	LBB0_4
	b	LBB0_6
LBB0_5:
	mov	x25, x20
LBB0_6:
	ldr	w0, [x19]
	ldr	w1, [x22]
	ldr	w2, [x23]
	mov	w3, #0
	bl	_PHM_WRITE_FIELD
	cbz	w25, LBB0_9
; %bb.7:
Lloh17:
	adrp	x0, l_.str.1@PAGE
Lloh18:
	add	x0, x0, l_.str.1@PAGEOFF
LBB0_8:
	bl	_pr_err
Lloh19:
	adrp	x8, _EINVAL@GOTPAGE
Lloh20:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_10
LBB0_9:
	mov	w0, #0
LBB0_10:
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.comm	_CGS_UCODE_ID_SMU,4,2           ; @CGS_UCODE_ID_SMU
	.comm	_SMC_RAM_END,4,2                ; @SMC_RAM_END
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"SMC address is beyond the SMC RAM area.\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_mmSMC_IND_INDEX_0,4,2          ; @mmSMC_IND_INDEX_0
	.comm	_SMC_IND_ACCESS_CNTL,4,2        ; @SMC_IND_ACCESS_CNTL
	.comm	_AUTO_INCREMENT_IND_0,4,2       ; @AUTO_INCREMENT_IND_0
	.comm	_mmSMC_IND_DATA_0,4,2           ; @mmSMC_IND_DATA_0
l_.str.1:                               ; @.str.1
	.asciz	"SMC size must be divisible by 4\n"

	.no_dead_strip	_ci_load_smc_ucode
.subsections_via_symbols
