	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_amdgpu_kv_copy_bytes_to_smc    ## -- Begin function amdgpu_kv_copy_bytes_to_smc
	.p2align	4, 0x90
_amdgpu_kv_copy_bytes_to_smc:           ## @amdgpu_kv_copy_bytes_to_smc
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
                                        ## kill: def $ecx killed $ecx def $rcx
	movl	%esi, %ebx
	leal	(%rcx,%rbx), %eax
	cmpl	%r8d, %eax
	jle	LBB0_2
## %bb.1:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_36
LBB0_2:
	movl	%r8d, %r12d
	movl	%ebx, %r14d
	andl	$3, %r14d
	je	LBB0_18
## %bb.3:
	movq	%rcx, -48(%rbp)                 ## 8-byte Spill
	movq	%rdx, %r15
	andl	$-4, %ebx
	movq	%rdi, %r13
	movl	%ebx, %esi
	movl	%r12d, %edx
	callq	_kv_set_smc_sram_address
	testl	%eax, %eax
	jne	LBB0_36
## %bb.4:
	movq	_mmSMC_IND_DATA_0@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_RREG32
	movl	%eax, -60(%rbp)                 ## 4-byte Spill
	xorl	%edx, %edx
	cmpl	$2, %r14d
	je	LBB0_5
## %bb.6:
	movl	$16777215, %eax                 ## imm = 0xFFFFFF
	cmpl	$1, %r14d
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	jne	LBB0_13
## %bb.7:
	testl	%ecx, %ecx
	jle	LBB0_8
## %bb.9:
	movl	(%r15), %edx
	addq	$4, %r15
	decl	%ecx
	movl	$16711680, %eax                 ## imm = 0xFF0000
	jmp	LBB0_10
LBB0_5:
	movl	$16776960, %eax                 ## imm = 0xFFFF00
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
LBB0_10:
	testl	%ecx, %ecx
	jle	LBB0_11
## %bb.12:
	shll	$8, %edx
	addl	(%r15), %edx
	addq	$4, %r15
	decl	%ecx
LBB0_13:
	testl	%ecx, %ecx
	jle	LBB0_14
## %bb.15:
	shll	$8, %edx
	addl	(%r15), %edx
	movl	%edx, %r14d
	addq	$4, %r15
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	decl	%ecx
	movq	%rcx, -48(%rbp)                 ## 8-byte Spill
	shll	$8, %eax
	jmp	LBB0_16
LBB0_8:
	movl	$16776960, %eax                 ## imm = 0xFFFF00
	xorl	%edx, %edx
LBB0_11:
	shll	$8, %edx
	orl	$255, %eax
LBB0_14:
	movq	%rcx, -48(%rbp)                 ## 8-byte Spill
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	shll	$8, %edx
	movl	%edx, %r14d
	shll	$8, %eax
	orl	$255, %eax
LBB0_16:
	movl	%eax, %r15d
	movq	%r13, %rdi
	movl	%ebx, %esi
	movl	%r12d, %edx
	callq	_kv_set_smc_sram_address
	testl	%eax, %eax
	jne	LBB0_36
## %bb.17:
	andl	-60(%rbp), %r15d                ## 4-byte Folded Reload
	orl	%r14d, %r15d
	movq	_mmSMC_IND_DATA_0@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	%r15d, %esi
	callq	_WREG32
	addl	$4, %ebx
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movq	%r13, %rdi
LBB0_18:
	cmpl	$4, %ecx
	jl	LBB0_19
## %bb.20:
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	movl	%r12d, -64(%rbp)                ## 4-byte Spill
	.p2align	4, 0x90
LBB0_21:                                ## =>This Inner Loop Header: Depth=1
	movq	%rcx, -48(%rbp)                 ## 8-byte Spill
	movl	(%rdx), %r13d
	movl	4(%rdx), %r12d
	movl	8(%rdx), %r15d
	movl	12(%rdx), %eax
	movl	%eax, -60(%rbp)                 ## 4-byte Spill
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	%ebx, %esi
	movq	%rdx, %r14
	movl	-64(%rbp), %edx                 ## 4-byte Reload
	callq	_kv_set_smc_sram_address
	testl	%eax, %eax
	jne	LBB0_36
## %bb.22:                              ##   in Loop: Header=BB0_21 Depth=1
	shll	$24, %r13d
	shll	$16, %r12d
	addl	%r13d, %r12d
	shll	$8, %r15d
	addl	%r12d, %r15d
	addl	-60(%rbp), %r15d                ## 4-byte Folded Reload
	movq	_mmSMC_IND_DATA_0@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	%r15d, %esi
	callq	_WREG32
	addq	$16, %r14
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	leal	-4(%rax), %r15d
	addl	$4, %ebx
	cmpl	$7, %eax
	movl	%r15d, %ecx
	movq	%r14, %rdx
	jg	LBB0_21
## %bb.23:
	movl	-64(%rbp), %r12d                ## 4-byte Reload
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	testl	%r15d, %r15d
	jg	LBB0_25
	jmp	LBB0_35
LBB0_19:
	movl	%ecx, %r15d
	testl	%r15d, %r15d
	jle	LBB0_35
LBB0_25:
	movq	%rdx, %r14
	movq	%rdi, %r13
	movl	%ebx, %esi
	movl	%r12d, %edx
	callq	_kv_set_smc_sram_address
	testl	%eax, %eax
	jne	LBB0_36
## %bb.26:
	movq	%r13, -56(%rbp)                 ## 8-byte Spill
	movq	_mmSMC_IND_DATA_0@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_RREG32
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	leal	-1(%r15), %eax
	cmpl	$3, %eax
	jae	LBB0_28
## %bb.27:
	xorl	%r13d, %r13d
	jmp	LBB0_30
LBB0_28:
	movl	%r15d, %eax
	andl	$-4, %eax
	xorl	%r13d, %r13d
	.p2align	4, 0x90
LBB0_29:                                ## =>This Inner Loop Header: Depth=1
	shll	$8, %r13d
	addl	(%r14), %r13d
	shll	$8, %r13d
	addl	4(%r14), %r13d
	shll	$8, %r13d
	addl	8(%r14), %r13d
	shll	$8, %r13d
	addl	12(%r14), %r13d
	addq	$16, %r14
	addl	$-4, %eax
	jne	LBB0_29
LBB0_30:
	testb	$3, %r15b
	je	LBB0_33
## %bb.31:
	movl	%r15d, %eax
	andl	$3, %eax
	xorl	%ecx, %ecx
	.p2align	4, 0x90
LBB0_32:                                ## =>This Inner Loop Header: Depth=1
	shll	$8, %r13d
	addl	(%r14,%rcx,4), %r13d
	incq	%rcx
	cmpl	%ecx, %eax
	jne	LBB0_32
LBB0_33:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	%ebx, %esi
	movl	%r12d, %edx
	callq	_kv_set_smc_sram_address
	testl	%eax, %eax
	jne	LBB0_36
## %bb.34:
	shll	$3, %r15d
	movl	$32, %ecx
	subl	%r15d, %ecx
	shll	%cl, %r13d
	movq	$-1, %rax
                                        ## kill: def $cl killed $cl killed $ecx
	shlq	%cl, %rax
	notl	%eax
	movl	-48(%rbp), %esi                 ## 4-byte Reload
	andl	%eax, %esi
	orl	%r13d, %esi
	movq	_mmSMC_IND_DATA_0@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_WREG32
LBB0_35:
	xorl	%eax, %eax
LBB0_36:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_mmSMC_IND_DATA_0,4,2           ## @mmSMC_IND_DATA_0
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_amdgpu_kv_copy_bytes_to_smc    ; -- Begin function amdgpu_kv_copy_bytes_to_smc
	.p2align	2
_amdgpu_kv_copy_bytes_to_smc:           ; @amdgpu_kv_copy_bytes_to_smc
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	add	w8, w3, w1
	cmp	w8, w4
	b.le	LBB0_2
; %bb.1:
Lloh0:
	adrp	x8, _EINVAL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_30
LBB0_2:
	mov	x19, x4
	mov	x22, x3
	mov	x21, x2
	mov	x23, x1
	mov	x20, x0
	ands	w26, w1, #0x3
	b.eq	LBB0_18
; %bb.3:
	and	w23, w23, #0xfffffffc
	mov	x0, x20
	mov	x1, x23
	mov	x2, x19
	bl	_kv_set_smc_sram_address
	cbnz	w0, LBB0_30
; %bb.4:
Lloh3:
	adrp	x25, _mmSMC_IND_DATA_0@GOTPAGE
Lloh4:
	ldr	x25, [x25, _mmSMC_IND_DATA_0@GOTPAGEOFF]
	ldr	w0, [x25]
	bl	_RREG32
	mov	x24, x0
	mov	w8, #0
	cmp	w26, #2
	b.eq	LBB0_8
; %bb.5:
	cmp	w26, #1
	b.ne	LBB0_11
; %bb.6:
	subs	w10, w22, #1
	b.lt	LBB0_13
; %bb.7:
	ldr	w8, [x21], #4
	mov	w9, #16711680
	mov	x22, x10
	b	LBB0_9
LBB0_8:
	mov	w9, #16776960
LBB0_9:
	cmp	w22, #0
	b.le	LBB0_14
; %bb.10:
	ldr	w10, [x21], #4
	add	w8, w10, w8, lsl #8
	sub	w22, w22, #1
	cmp	w22, #0
	b.gt	LBB0_12
	b	LBB0_15
LBB0_11:
	mov	w9, #16777215
	cmp	w22, #0
	b.le	LBB0_15
LBB0_12:
	ldr	w10, [x21], #4
	add	w26, w10, w8, lsl #8
	sub	w22, w22, #1
	lsl	w27, w9, #8
	b	LBB0_16
LBB0_13:
	mov	w8, #0
	mov	w9, #16776960
LBB0_14:
	lsl	w8, w8, #8
	orr	w9, w9, #0xff
LBB0_15:
	lsl	w26, w8, #8
	mov	w27, #255
	bfi	w27, w9, #8, #24
LBB0_16:
	mov	x0, x20
	mov	x1, x23
	mov	x2, x19
	bl	_kv_set_smc_sram_address
	cbnz	w0, LBB0_30
; %bb.17:
	and	w8, w27, w24
	orr	w1, w8, w26
	ldr	w0, [x25]
	bl	_WREG32
	add	w23, w23, #4
LBB0_18:
	cmp	w22, #4
	b.lt	LBB0_23
; %bb.19:
Lloh5:
	adrp	x24, _mmSMC_IND_DATA_0@GOTPAGE
Lloh6:
	ldr	x24, [x24, _mmSMC_IND_DATA_0@GOTPAGEOFF]
LBB0_20:                                ; =>This Inner Loop Header: Depth=1
	ldp	w25, w28, [x21]
	ldp	w26, w27, [x21, #8]
	mov	x0, x20
	mov	x1, x23
	mov	x2, x19
	bl	_kv_set_smc_sram_address
	cbnz	w0, LBB0_30
; %bb.21:                               ;   in Loop: Header=BB0_20 Depth=1
	lsl	w8, w28, #16
	add	w8, w8, w25, lsl #24
	add	w8, w8, w26, lsl #8
	add	w1, w8, w27
	ldr	w0, [x24]
	bl	_WREG32
	add	x21, x21, #16
	sub	w25, w22, #4
	add	w23, w23, #4
	cmp	w22, #7
	mov	x22, x25
	b.gt	LBB0_20
; %bb.22:
	cmp	w25, #1
	b.ge	LBB0_24
	b	LBB0_29
LBB0_23:
	mov	x25, x22
	cmp	w25, #1
	b.lt	LBB0_29
LBB0_24:
	mov	x0, x20
	mov	x1, x23
	mov	x2, x19
	bl	_kv_set_smc_sram_address
	cbnz	w0, LBB0_30
; %bb.25:
Lloh7:
	adrp	x24, _mmSMC_IND_DATA_0@GOTPAGE
Lloh8:
	ldr	x24, [x24, _mmSMC_IND_DATA_0@GOTPAGEOFF]
	ldr	w0, [x24]
	bl	_RREG32
	mov	x22, x0
	mov	w27, #0
	mov	w8, #32
	sub	w26, w8, w25, lsl #3
	add	w8, w25, #1
LBB0_26:                                ; =>This Inner Loop Header: Depth=1
	ldr	w9, [x21], #4
	add	w27, w9, w27, lsl #8
	sub	w8, w8, #1
	cmp	w8, #1
	b.hi	LBB0_26
; %bb.27:
	mov	x0, x20
	mov	x1, x23
	mov	x2, x19
	bl	_kv_set_smc_sram_address
	cbnz	w0, LBB0_30
; %bb.28:
	lsl	w8, w27, w26
	mov	x9, #-1
	lsl	x9, x9, x26
	bic	w9, w22, w9
	orr	w1, w8, w9
	ldr	w0, [x24]
	bl	_WREG32
LBB0_29:
	mov	w0, #0
LBB0_30:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_mmSMC_IND_DATA_0,4,2           ; @mmSMC_IND_DATA_0
.subsections_via_symbols
