// File: /workspace/github_cpp_makefile_star2_O1/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, %r13
movl (%rax), %eax
movl %eax, -0x30(%rbp)
movl $0x0, (%r13)
leaq -0xa0(%rbp), %r14
movq %rbx, %rdi
movq %r14, %rsi
movl $0xa, %edx
callq 0x3330
cmpq %rbx, (%r14)
je 0x138f8
movq %rax, %r12
movslq %r12d, %rax
cmpq %r12, %rax
jne 0x13904
movl (%r13), %eax
cmpl $0x22, %eax
je 0x13904
testl %eax, %eax
jne 0x137e9
movl -0x30(%rbp), %eax
movl %eax, (%r13)
leaq -0xb0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x137fe
callq 0x3230
movq -0x38(%rbp), %rcx
cmpl %r12d, 0x10(%rcx)
jle 0x13826
movq (%r15), %rax
movzbl (%rax), %eax
cmpl $0x46, %eax
je 0x13862
cmpl $0x52, %eax
jne 0x13873
testl %r12d, %r12d
je 0x138a3
movq (%rcx), %rax
jmp 0x13866
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 0x7168
leaq 0x2199(%rip), %rsi      # 0x159e4
movq %rbx, %rdi
callq 0x34a0
leaq -0x58(%rbp), %rdi
callq 0x9777
movq -0x58(%rbp), %rdi
jmp 0x138da
movq 0x8(%rcx), %rax
movslq %r12d, %rcx
movl -0x2c(%rbp), %edx
movl %edx, (%rax,%rcx,4)
movb $0x1, %al
jmp 0x138e6
leaq -0x68(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x217c(%rip), %rsi      # 0x159fe
leaq 0x2183(%rip), %rdx      # 0x15a0c
leaq -0x78(%rbp), %rbx
movq %rbx, %rdi
callq 0x7202
movq %rbx, %rdi
callq 0x9777
movq -0x78(%rbp), %rdi
jmp 0x138da
leaq -0x88(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x2158(%rip), %rsi      # 0x15a0d
leaq 0x2165(%rip), %rdx      # 0x15a21
leaq -0x98(%rbp), %rbx
movq %rbx, %rdi
callq 0x7202
movq %rbx, %rdi
callq 0x9777
movq -0x98(%rbp), %rdi
cmpq %r14, %rdi
je 0x138e4
callq 0x3230
xorl %eax, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1c4d(%rip), %rdi      # 0x1554c
callq 0x3180
leaq 0x1c41(%rip), %rdi      # 0x1554c
callq 0x3360
movq %rax, %rbx
movq -0x98(%rbp), %rdi
jmp 0x1392e
movq %rax, %rbx
movq -0x78(%rbp), %rdi
jmp 0x1392e
jmp 0x13927
movq %rax, %rbx
movq -0x58(%rbp), %rdi
cmpq %r14, %rdi
jne 0x13956
jmp 0x1395b
movq %rax, %rbx
cmpl $0x0, (%r13)
jne 0x13946
movl -0x30(%rbp), %eax
movl %eax, (%r13)
leaq -0xb0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1395b
callq 0x3230
movq %rbx, %rdi
callq 0x3440
nop