// File: Manuel123cool[P]smiley/read_variable.cpp
// Function: Variable::testIfVariable(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool Variable::testIfVariable(std::string code)
{
    if (code.length() <= 0)
        return false;

    bool isInString{ MyRegex::testString(code, ":) ") };
    if (!isInString) 
        return false;

    if (checkIfValueIsIdentifier(code))
    {
        std::string value{ getValue(code) };
        int count{ 0 };
        for (const auto &elem : m_variables)
        {
            if (value == elem.identifier)
            {
                TypeValue typeValue;

                typeValue.identifier = getIdentifier(code); 
                typeValue.value = m_variables.at(count).value; 
                typeValue.type = m_variables.at(count).type; 
                m_variables.push_back(typeValue); 
                return true;
            } 
            ++count;
        } 
    }

    std::string identifier{ getIdentifier(code) };
    std::string value{ getValue(code) };
    Types type{ getType(code) };

    for (int i{ 0 }; i < m_variables.size(); ++i)
    {
        if (m_variables.at(i).identifier == identifier)
        {
            m_variables.at(i).value = value; 
            m_variables.at(i).type = type;
            return true;
        }
    } 
    
    TypeValue typeValue;

    typeValue.identifier = identifier; 
    typeValue.value = value; 
    typeValue.type = type; 
    m_variables.push_back(typeValue);
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x310, %rsp            # imm = 0x310
movq %rsi, -0x2a0(%rbp)
movq %rdi, %rax
movq -0x2a0(%rbp), %rdi
movq %rdi, -0x298(%rbp)
movq %rax, -0x10(%rbp)
movq %rdi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x290(%rbp)
callq 0x3330
cmpq $0x0, %rax
ja 0x425a
movb $0x0, -0x1(%rbp)
jmp 0x4908
movq -0x298(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x30e0
leaq -0x61(%rbp), %rdi
movq %rdi, -0x2a8(%rbp)
callq 0x3390
movq -0x2a8(%rbp), %rdx
leaq 0x10dc9(%rip), %rsi     # 0x15051
leaq -0x60(%rbp), %rdi
callq 0x8eb0
jmp 0x4293
leaq -0x40(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0xa430
movb %al, -0x2a9(%rbp)
jmp 0x42a8
leaq -0x60(%rbp), %rdi
callq 0x3160
leaq -0x61(%rbp), %rdi
callq 0x3270
leaq -0x40(%rbp), %rdi
callq 0x3160
movb -0x2a9(%rbp), %al
andb $0x1, %al
movb %al, -0x19(%rbp)
testb $0x1, -0x19(%rbp)
jne 0x4317
movb $0x0, -0x1(%rbp)
jmp 0x4908
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x4300
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x3160
leaq -0x61(%rbp), %rdi
callq 0x3270
leaq -0x40(%rbp), %rdi
callq 0x3160
jmp 0x4916
movq -0x298(%rbp), %rsi
leaq -0x98(%rbp), %rdi
movq %rdi, -0x2b8(%rbp)
callq 0x30e0
movq -0x290(%rbp), %rdi
movq -0x2b8(%rbp), %rsi
callq 0x4920
movb %al, -0x2aa(%rbp)
jmp 0x434c
leaq -0x98(%rbp), %rdi
callq 0x3160
movb -0x2aa(%rbp), %al
testb $0x1, %al
jne 0x4367
jmp 0x45ff
movq -0x298(%rbp), %rsi
leaq -0xd8(%rbp), %rdi
movq %rdi, -0x2c0(%rbp)
callq 0x30e0
movq -0x290(%rbp), %rsi
movq -0x2c0(%rbp), %rdx
leaq -0xb8(%rbp), %rdi
callq 0x4ac0
jmp 0x439d
leaq -0xd8(%rbp), %rdi
callq 0x3160
movq -0x290(%rbp), %rax
movl $0x0, -0xdc(%rbp)
movq %rax, -0xe8(%rbp)
movq -0xe8(%rbp), %rdi
callq 0x8f60
movq %rax, -0xf0(%rbp)
movq -0xe8(%rbp), %rdi
callq 0x8f90
movq %rax, -0xf8(%rbp)
leaq -0xf0(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x8fc0
testb $0x1, %al
jne 0x4403
jmp 0x45d6
leaq -0xf0(%rbp), %rdi
callq 0x9000
movq %rax, -0x100(%rbp)
movq -0x100(%rbp), %rsi
addq $0x28, %rsi
leaq -0xb8(%rbp), %rdi
callq 0x4100
testb $0x1, %al
jne 0x4436
jmp 0x45b6
leaq -0x148(%rbp), %rdi
callq 0x9020
movq -0x298(%rbp), %rsi
leaq -0x188(%rbp), %rdi
callq 0x30e0
jmp 0x4457
movq -0x290(%rbp), %rsi
leaq -0x168(%rbp), %rdi
leaq -0x188(%rbp), %rdx
callq 0x4cb0
jmp 0x4473
leaq -0x120(%rbp), %rdi
leaq -0x168(%rbp), %rsi
movq %rsi, -0x2d0(%rbp)
callq 0x32b0
movq -0x2d0(%rbp), %rdi
callq 0x3160
leaq -0x188(%rbp), %rdi
callq 0x3160
movq -0x290(%rbp), %rdi
movslq -0xdc(%rbp), %rsi
callq 0x9050
movq %rax, -0x2c8(%rbp)
jmp 0x44c1
movq -0x2c8(%rbp), %rsi
addq $0x8, %rsi
leaq -0x140(%rbp), %rdi
callq 0x3030
jmp 0x44da
movq -0x290(%rbp), %rdi
movslq -0xdc(%rbp), %rsi
callq 0x9050
movq %rax, -0x2d8(%rbp)
jmp 0x44f6
movq -0x290(%rbp), %rdi
movq -0x2d8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x148(%rbp)
leaq -0x148(%rbp), %rsi
callq 0x9090
jmp 0x451a
movb $0x1, -0x1(%rbp)
movl $0x1, -0x18c(%rbp)
leaq -0x148(%rbp), %rdi
callq 0x9100
jmp 0x45e0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x3160
jmp 0x4916
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0xd8(%rbp), %rdi
callq 0x3160
jmp 0x4916
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x4599
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x188(%rbp), %rdi
callq 0x3160
leaq -0x148(%rbp), %rdi
callq 0x9100
leaq -0xb8(%rbp), %rdi
callq 0x3160
jmp 0x4916
movl -0xdc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xdc(%rbp)
leaq -0xf0(%rbp), %rdi
callq 0x9130
jmp 0x43e7
movl $0x0, -0x18c(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x3160
movl -0x18c(%rbp), %eax
testl %eax, %eax
je 0x45fd
jmp 0x45f8
jmp 0x4908
jmp 0x45ff
movq -0x298(%rbp), %rsi
leaq -0x1d0(%rbp), %rdi
movq %rdi, -0x2e0(%rbp)
callq 0x30e0
movq -0x290(%rbp), %rsi
movq -0x2e0(%rbp), %rdx
leaq -0x1b0(%rbp), %rdi
callq 0x4cb0
jmp 0x4635
leaq -0x1d0(%rbp), %rdi
callq 0x3160
movq -0x298(%rbp), %rsi
leaq -0x210(%rbp), %rdi
callq 0x30e0
jmp 0x4656
movq -0x290(%rbp), %rsi
leaq -0x1f0(%rbp), %rdi
leaq -0x210(%rbp), %rdx
callq 0x4ac0
jmp 0x4672
leaq -0x210(%rbp), %rdi
callq 0x3160
movq -0x298(%rbp), %rsi
leaq -0x238(%rbp), %rdi
callq 0x30e0
jmp 0x4693
movq -0x290(%rbp), %rdi
leaq -0x238(%rbp), %rsi
callq 0x4e30
movl %eax, -0x2e4(%rbp)
jmp 0x46ae
leaq -0x238(%rbp), %rdi
callq 0x3160
movl -0x2e4(%rbp), %eax
movl %eax, -0x214(%rbp)
movl $0x0, -0x23c(%rbp)
movq -0x290(%rbp), %rdi
movslq -0x23c(%rbp), %rax
movq %rax, -0x2f0(%rbp)
callq 0x9150
movq %rax, %rcx
movq -0x2f0(%rbp), %rax
cmpq %rcx, %rax
jae 0x4847
movq -0x290(%rbp), %rdi
movslq -0x23c(%rbp), %rsi
callq 0x9050
movq %rax, -0x2f8(%rbp)
jmp 0x4719
movq -0x2f8(%rbp), %rdi
addq $0x28, %rdi
leaq -0x1b0(%rbp), %rsi
callq 0x4100
testb $0x1, %al
jne 0x4739
jmp 0x4831
movq -0x290(%rbp), %rdi
movslq -0x23c(%rbp), %rsi
callq 0x9050
movq %rax, -0x300(%rbp)
jmp 0x4755
movq -0x300(%rbp), %rdi
addq $0x8, %rdi
leaq -0x1f0(%rbp), %rsi
callq 0x3030
jmp 0x476e
movq -0x290(%rbp), %rdi
movl -0x214(%rbp), %eax
movl %eax, -0x30c(%rbp)
movslq -0x23c(%rbp), %rsi
callq 0x9050
movq %rax, -0x308(%rbp)
jmp 0x4796
movq -0x308(%rbp), %rax
movl -0x30c(%rbp), %ecx
movl %ecx, (%rax)
movb $0x1, -0x1(%rbp)
movl $0x1, -0x18c(%rbp)
jmp 0x48d4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x1d0(%rbp), %rdi
callq 0x3160
jmp 0x4916
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x48fa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x210(%rbp), %rdi
callq 0x3160
jmp 0x48fa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0x48ee
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x238(%rbp), %rdi
callq 0x3160
jmp 0x48ee
jmp 0x4833
movl -0x23c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x23c(%rbp)
jmp 0x46d0
leaq -0x288(%rbp), %rdi
callq 0x9020
leaq -0x260(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
callq 0x3030
jmp 0x4868
leaq -0x280(%rbp), %rdi
leaq -0x1f0(%rbp), %rsi
callq 0x3030
jmp 0x487d
movq -0x290(%rbp), %rdi
movl -0x214(%rbp), %eax
movl %eax, -0x288(%rbp)
leaq -0x288(%rbp), %rsi
callq 0x9090
jmp 0x489e
movb $0x1, -0x1(%rbp)
movl $0x1, -0x18c(%rbp)
leaq -0x288(%rbp), %rdi
callq 0x9100
jmp 0x48d4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x288(%rbp), %rdi
callq 0x9100
jmp 0x48ee
leaq -0x1f0(%rbp), %rdi
callq 0x3160
leaq -0x1b0(%rbp), %rdi
callq 0x3160
jmp 0x4908
leaq -0x1f0(%rbp), %rdi
callq 0x3160
leaq -0x1b0(%rbp), %rdi
callq 0x3160
jmp 0x4916
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x310, %rsp            # imm = 0x310
popq %rbp
retq
movq -0x70(%rbp), %rdi
callq 0x3380
nop