// File: /workspace/github_cpp_makefile_star2_O3/Ziang95[P]Tomasulo_simulator/registor.cpp
// Function: registor::set(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, memCell)
bool registor::set(string name, memCell val)
{
    int index = stoi(name.substr(1, name.size() - 1));
    if (index >= RegSize)
    {
        err_log(name + ": Reg access out of range");
        return false;
    }
    if (name[0] == 'R')
    {
        if (index == 0)
        {
            err_log("R0 can't be modified");
            return false;
        }
        intReg[index] = val.i;
    }
    else if (name[0] == 'F')
        flpReg[index] = val.f;
    else
    {
        err_log("Reg name error");
        return false;
    }
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movl %edx, -0x2c(%rbp)
movq %rsi, %r15
movq %rdi, -0x38(%rbp)
movq 0x8(%rsi), %rcx
decq %rcx
leaq -0xc0(%rbp), %r12
movl $0x1, %edx
movq %r12, %rdi
callq 0x3270
movq (%r12), %rbx
callq 0x3050
movq %rax, %r12
movl (%rax), %eax
movl %eax, -0x30(%rbp)
movl $0x0, (%r12)
leaq -0xa0(%rbp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0xa, %edx
callq 0x3330
cmpq %rbx, (%r14)
je 0x1391a
movq %rax, %r13
movslq %r13d, %rax
cmpq %r13, %rax
jne 0x13926
movl (%r12), %eax
cmpl $0x22, %eax
je 0x13926
testl %eax, %eax
jne 0x1380d
movl -0x30(%rbp), %eax
movl %eax, (%r12)
leaq -0xb0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x13822
callq 0x3230
movq -0x38(%rbp), %rcx
cmpl %r13d, 0x10(%rcx)
jle 0x1384a
movq (%r15), %rax
movzbl (%rax), %eax
cmpl $0x46, %eax
je 0x13886
cmpl $0x52, %eax
jne 0x13895
testl %r13d, %r13d
je 0x138c5
movq (%rcx), %rax
jmp 0x1388a
leaq -0x48(%rbp), %r14
movq %r14, -0x10(%r14)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq -0x58(%rbp), %rbx
movq %rbx, %rdi
callq 0x7180
leaq 0x2175(%rip), %rsi      # 0x159e4
movq %rbx, %rdi
callq 0x34a0
leaq -0x58(%rbp), %rdi
callq 0x97ab
movq -0x58(%rbp), %rdi
jmp 0x138fc
movq 0x8(%rcx), %rax
movl -0x2c(%rbp), %ecx
movl %ecx, (%rax,%r13,4)
movb $0x1, %al
jmp 0x13908
leaq -0x68(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x215a(%rip), %rsi      # 0x159fe
leaq 0x2161(%rip), %rdx      # 0x15a0c
leaq -0x78(%rbp), %rbx
movq %rbx, %rdi
callq 0x721e
movq %rbx, %rdi
callq 0x97ab
movq -0x78(%rbp), %rdi
jmp 0x138fc
leaq -0x88(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x2136(%rip), %rsi      # 0x15a0d
leaq 0x2143(%rip), %rdx      # 0x15a21
leaq -0x98(%rbp), %rbx
movq %rbx, %rdi
callq 0x721e
movq %rbx, %rdi
callq 0x97ab
movq -0x98(%rbp), %rdi
cmpq %r14, %rdi
je 0x13906
callq 0x3230
xorl %eax, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1c2b(%rip), %rdi      # 0x1554c
callq 0x3180
leaq 0x1c1f(%rip), %rdi      # 0x1554c
callq 0x3360
movq %rax, %rbx
movq -0x98(%rbp), %rdi
jmp 0x13950
movq %rax, %rbx
movq -0x78(%rbp), %rdi
jmp 0x13950
jmp 0x13949
movq %rax, %rbx
movq -0x58(%rbp), %rdi
cmpq %r14, %rdi
jne 0x13978
jmp 0x1397d
movq %rax, %rbx
cmpl $0x0, (%r12)
jne 0x13968
movl -0x30(%rbp), %eax
movl %eax, (%r12)
leaq -0xb0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1397d
callq 0x3230
movq %rbx, %rdi
callq 0x3440
nop