// File: /workspace/github_c_makefile_star2_O0/juliuswwj[P]emch55x/opcodes.c
// Function: mov_mem_indir_rx
static int mov_mem_indir_rx(struct em8051 *aCPU)
{
    int address1 = OPERAND1;
    int address2 = INDIR_RX_ADDRESS;
    if (address1 > 0x7f)
    {
        if (address2 > 0x7f)
        {
            int value = BAD_VALUE;
            if (aCPU->mUpperData)
            {
                value = aCPU->mUpperData[address2 - 0x80];
            }
            aCPU->mSFR[address1 - 0x80] = value;
            if (aCPU->sfrwrite)
                aCPU->sfrwrite(aCPU, address1);
        }
        else
        {
            aCPU->mSFR[address1 - 0x80] = aCPU->mLowerData[address2];
            if (aCPU->sfrwrite)
                aCPU->sfrwrite(aCPU, address1);
        }
    }
    else
    {
        if (address2 > 0x7f)
        {
            int value = BAD_VALUE;
            if (aCPU->mUpperData)
            {
                value = aCPU->mUpperData[address2 - 0x80];
            }
            aCPU->mLowerData[address1] = value;
        }
        else
        {
            aCPU->mLowerData[address1] = aCPU->mLowerData[address2];
        }
    }

    PC += 2;
    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq -0x8(%rbp), %rcx
movl 0x38(%rcx), %ecx
addl $0x1, %ecx
movq -0x8(%rbp), %rdx
movl 0x8(%rdx), %edx
subl $0x1, %edx
andl %edx, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
movq -0x8(%rbp), %rdx
movl 0x38(%rdx), %edx
addl $0x0, %edx
movq -0x8(%rbp), %rsi
movl 0x8(%rsi), %esi
subl $0x1, %esi
andl %esi, %edx
movslq %edx, %rdx
movzbl (%rcx,%rdx), %ecx
andl $0x1, %ecx
movq -0x8(%rbp), %rdx
movq 0x30(%rdx), %rdx
movzbl 0x50(%rdx), %edx
andl $0x18, %edx
sarl $0x3, %edx
shll $0x3, %edx
addl %edx, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x10(%rbp)
cmpl $0x7f, -0xc(%rbp)
jle 0xec8c
cmpl $0x7f, -0x10(%rbp)
jle 0xec40
movl $0x77, -0x14(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0xec00
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x10(%rbp), %ecx
subl $0x80, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movl -0xc(%rbp), %ecx
subl $0x80, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x1050(%rax)
je 0xec3e
movq -0x8(%rbp), %rax
movq 0x1050(%rax), %rax
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq *%rax
jmp 0xec8a
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x10(%rbp), %rcx
movb (%rax,%rcx), %dl
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movl -0xc(%rbp), %ecx
subl $0x80, %ecx
movslq %ecx, %rcx
movb %dl, (%rax,%rcx)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x1050(%rax)
je 0xec88
movq -0x8(%rbp), %rax
movq 0x1050(%rax), %rax
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq *%rax
jmp 0xec8a
jmp 0xecf5
cmpl $0x7f, -0x10(%rbp)
jle 0xecd5
movl $0x77, -0x18(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0xecbf
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movl -0x10(%rbp), %ecx
subl $0x80, %ecx
movslq %ecx, %rcx
movzbl (%rax,%rcx), %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
movb %al, %dl
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0xc(%rbp), %rcx
movb %dl, (%rax,%rcx)
jmp 0xecf3
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x10(%rbp), %rcx
movb (%rax,%rcx), %dl
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0xc(%rbp), %rcx
movb %dl, (%rax,%rcx)
jmp 0xecf5
movq -0x8(%rbp), %rax
movl 0x38(%rax), %ecx
addl $0x2, %ecx
movl %ecx, 0x38(%rax)
movl $0x1, %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)