	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_amd_mp2_rw                     ## -- Begin function amd_mp2_rw
	.p2align	4, 0x90
_amd_mp2_rw:                            ## @amd_mp2_rw
	.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	%esi, %r14d
	movq	%rdi, %rbx
	movq	16(%rdi), %r15
	leaq	-32(%rbp), %rsi
	movl	%r14d, %edx
	callq	_amd_mp2_cmd_rw_fill
	movq	%rbx, %rdi
	callq	_amd_mp2_c2p_mutex_lock
	movq	8(%rbx), %rax
	cmpl	$32, (%rax)
	jg	LBB0_3
## %bb.1:
	movq	_use_c2pmsg@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, -32(%rbp)
	movq	_i2c_write@GOTPCREL(%rip), %rcx
	cmpl	%r14d, (%rcx)
	jne	LBB0_4
## %bb.2:
	movq	_AMD_C2P_MSG2@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rdi
	addq	(%r15), %rdi
	movl	(%rax), %edx
	movl	4(%rax), %esi
	callq	_memcpy_toio
	jmp	LBB0_4
LBB0_3:
	movq	_use_dram@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -32(%rbp)
	movl	(%rbx), %edi
	movq	_AMD_C2P_MSG2@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	(%r15), %rsi
	callq	_writeq
LBB0_4:
	movl	-32(%rbp), %esi
	movq	%rbx, %rdi
	callq	_amd_mp2_cmd
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_use_c2pmsg,4,2                 ## @use_c2pmsg
	.comm	_i2c_write,4,2                  ## @i2c_write
	.comm	_AMD_C2P_MSG2,8,3               ## @AMD_C2P_MSG2
	.comm	_use_dram,4,2                   ## @use_dram
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_amd_mp2_rw                     ; -- Begin function amd_mp2_rw
	.p2align	2
_amd_mp2_rw:                            ; @amd_mp2_rw
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x20, x1
	mov	x19, x0
	ldr	x21, [x0, #16]
	add	x1, sp, #8
	mov	x2, x20
	bl	_amd_mp2_cmd_rw_fill
	mov	x0, x19
	bl	_amd_mp2_c2p_mutex_lock
	ldr	x8, [x19, #8]
	ldr	w9, [x8]
	cmp	w9, #32
	b.gt	LBB0_3
; %bb.1:
Lloh0:
	adrp	x9, _use_c2pmsg@GOTPAGE
Lloh1:
	ldr	x9, [x9, _use_c2pmsg@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	str	w9, [sp, #8]
Lloh3:
	adrp	x9, _i2c_write@GOTPAGE
Lloh4:
	ldr	x9, [x9, _i2c_write@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	cmp	w9, w20
	b.ne	LBB0_4
; %bb.2:
	ldr	x9, [x21]
Lloh6:
	adrp	x10, _AMD_C2P_MSG2@GOTPAGE
Lloh7:
	ldr	x10, [x10, _AMD_C2P_MSG2@GOTPAGEOFF]
Lloh8:
	ldr	x10, [x10]
	add	x0, x10, x9
	ldp	w2, w1, [x8]
	bl	_memcpy_toio
	b	LBB0_4
LBB0_3:
Lloh9:
	adrp	x8, _use_dram@GOTPAGE
Lloh10:
	ldr	x8, [x8, _use_dram@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	str	w8, [sp, #8]
	ldr	w0, [x19]
	ldr	x8, [x21]
Lloh12:
	adrp	x9, _AMD_C2P_MSG2@GOTPAGE
Lloh13:
	ldr	x9, [x9, _AMD_C2P_MSG2@GOTPAGEOFF]
Lloh14:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writeq
LBB0_4:
	ldr	w1, [sp, #8]
	mov	x0, x19
	bl	_amd_mp2_cmd
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_use_c2pmsg,4,2                 ; @use_c2pmsg
	.comm	_i2c_write,4,2                  ; @i2c_write
	.comm	_AMD_C2P_MSG2,8,3               ; @AMD_C2P_MSG2
	.comm	_use_dram,4,2                   ; @use_dram
.subsections_via_symbols
