// File: rofl0r[P]ascc/cc_symboltable.cpp
// Function: symbolTable::reset()
void symbolTable::reset() {
	for (std::map<int, char*>::iterator it = nameGenCache.begin(); it != nameGenCache.end(); ++it) {
		free(it->second);
	}
	nameGenCache.clear();

	entries.clear();

    stringStructSym = 0;
    symbolTree.clear();

    add_ex("___dummy__sym0",999,0);
    normalIntSym = add_ex("int",SYM_VARTYPE,4);
    normalCharSym = add_ex("char",SYM_VARTYPE,1);
    normalLongSym = add_ex("long",SYM_VARTYPE,4);
    normalShortSym = add_ex("short",SYM_VARTYPE,2);
    normalStringSym = add_ex("string",SYM_VARTYPE,4);
    normalVoidSym = add_ex("void",SYM_VARTYPE,0);
    normalFloatSym = add_ex("float", SYM_VARTYPE, 4);
    add_ex("=",SYM_ASSIGN,0);
    add_ex(";",SYM_SEMICOLON,0);
    add_ex(",",SYM_COMMA,0);
    add_ex("(",SYM_OPENPARENTHESIS,0);
    add_ex(")",SYM_CLOSEPARENTHESIS,0);
    add_ex("{",SYM_OPENBRACE,0);
    add_ex("}",SYM_CLOSEBRACE,0);
    add_ex("+=",SYM_MASSIGN,SCMD_ADDREG);
    add_ex("-=",SYM_MASSIGN,SCMD_SUBREG);
    add_ex("*=",SYM_MASSIGN,SCMD_MULREG);
    add_ex("/=",SYM_MASSIGN,SCMD_DIVREG);
    add_ex("&=",SYM_MASSIGN,SCMD_BITAND);
    add_ex("|=",SYM_MASSIGN,SCMD_BITOR);
    add_ex("^=",SYM_MASSIGN,SCMD_XORREG);
    add_ex("<<=",SYM_MASSIGN,SCMD_SHIFTLEFT);
    add_ex(">>=",SYM_MASSIGN,SCMD_SHIFTRIGHT);
    add_ex("++",SYM_SASSIGN,SCMD_ADD);
    add_ex("--",SYM_SASSIGN,SCMD_SUB);
    // the second argument to the operators is their precedence: 1 is highest
    add_operator("!",1, SCMD_NOTREG);
    add_operator("*",2, SCMD_MULREG);
    add_operator("/",3, SCMD_DIVREG);
    add_operator("%",4, SCMD_MODREG);
    add_operator("+",5, SCMD_ADDREG);
    add_operator("-",5, SCMD_SUBREG);
    add_operator("<<",7, SCMD_SHIFTLEFT);
    add_operator(">>",8, SCMD_SHIFTRIGHT);
    add_operator("&",9, SCMD_BITAND);
    add_operator("|",10, SCMD_BITOR);
    add_operator("^",11, SCMD_XORREG);
    add_operator("==",12, SCMD_ISEQUAL);
    add_operator("!=",13, SCMD_NOTEQUAL);
    add_operator(">",14, SCMD_GREATER);
    add_operator("<",15, SCMD_LESSTHAN);
    add_operator(">=",16, SCMD_GTE);
    add_operator("<=",17, SCMD_LTE);
    add_operator("&&",18, SCMD_AND);
    add_operator("||",19, SCMD_OR);
    add_ex("new", SYM_NEW, 1);
    add_ex("[",SYM_OPENBRACKET,0);
    add_ex("]",SYM_CLOSEBRACKET,0);
    add_ex(".",SYM_DOT,0);
    add_ex("if",SYM_IF,0);
    add_ex("else",SYM_ELSE,0);
    add_ex("while",SYM_WHILE,0);
    add_ex("for",SYM_FOR,0);
    add_ex("break",SYM_BREAK,0);
    add_ex("continue",SYM_CONTINUE,0);
    add_ex("do",SYM_DO,0);
    add_ex("switch",SYM_SWITCH,0);
    add_ex("case",SYM_CASE,0);
    add_ex("default",SYM_DEFAULT,0);
    add_ex("...",SYM_VARARGS,0);
    add_ex("struct",SYM_STRUCT,0);
    add_ex("import",SYM_IMPORT,0);
    add_ex("_tryimport",SYM_IMPORT,0);
    add_ex("export",SYM_EXPORT,0);
    add_ex("return", SYM_RETURN, 0);
    add_ex("readonly",SYM_READONLY,0);
    add_ex("::", SYM_MEMBERACCESS, 0);
    add_ex(":", SYM_LABEL, 0);
    add_ex("attribute", SYM_PROPERTY, 0);
    add_ex("enum", SYM_ENUM, 0);
    add_ex("managed", SYM_MANAGED, 0);
    nullSym = add_ex("null", SYM_NULL, 0);
    add_ex("extends", SYM_EXTENDS, 0);
    add_ex("static", SYM_STATIC, 0);
    add_ex("protected", SYM_PROTECTED, 0);
    add_ex("writeprotected", SYM_WRITEPROTECTED, 0);
    add_ex("const", SYM_CONST, 0);
    add_ex("internalstring", SYM_STRINGSTRUCT, 0);
    add_ex("autoptr", SYM_AUTOPTR, 0);
    add_ex("noloopcheck", SYM_LOOPCHECKOFF, 0);
    add_ex("builtin", SYM_BUILTIN, 0);
    add_ex("?", SYM_QMARK, 0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x20(%rbp)
addq $0x40, %rdi
callq 0x1f920
movq %rax, -0x10(%rbp)
movq -0x20(%rbp), %rdi
addq $0x40, %rdi
callq 0x1f980
movq %rax, -0x18(%rbp)
leaq -0x10(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x1f950
testb $0x1, %al
jne 0x1e3a5
jmp 0x1e3c2
leaq -0x10(%rbp), %rdi
callq 0x1f9b0
movq 0x8(%rax), %rdi
callq 0x4460
leaq -0x10(%rbp), %rdi
callq 0x1f9d0
jmp 0x1e381
movq -0x20(%rbp), %rdi
addq $0x40, %rdi
callq 0x1fa00
movq -0x20(%rbp), %rdi
addq $0x28, %rdi
callq 0x1fa20
movq -0x20(%rbp), %rdi
movl $0x0, 0x20(%rdi)
addq $0x70, %rdi
callq 0x1bf90
movq -0x20(%rbp), %rdi
leaq 0x1558e(%rip), %rsi     # 0x33989
movl $0x3e7, %edx            # imm = 0x3E7
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x1408c(%rip), %rsi     # 0x3249e
movl $0x2e, %edx
movl $0x4, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
movl %eax, (%rdi)
leaq 0x16067(%rip), %rsi     # 0x34495
movl $0x2e, %edx
movl $0x1, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
movl %eax, 0x4(%rdi)
leaq 0x13d47(%rip), %rsi     # 0x32192
movl $0x2e, %edx
movl $0x4, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
movl %eax, 0x8(%rdi)
leaq 0x13a13(%rip), %rsi     # 0x31e7b
movl $0x2e, %edx
movl $0x2, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
movl %eax, 0xc(%rdi)
leaq 0x16043(%rip), %rsi     # 0x344c8
movl $0x2e, %edx
movl $0x4, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
movl %eax, 0x10(%rdi)
leaq 0x154f6(%rip), %rsi     # 0x33998
movl $0x2e, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
movl %eax, 0x18(%rdi)
leaq 0x154e1(%rip), %rsi     # 0x3399d
movl $0x2e, %edx
movl $0x4, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
movl %eax, 0x14(%rdi)
leaq 0x154ff(%rip), %rsi     # 0x339d8
movl $0x19, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x154b3(%rip), %rsi     # 0x339a3
movl $0x28, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x1549e(%rip), %rsi     # 0x339a5
movl $0x2a, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x16257(%rip), %rsi     # 0x34775
movl $0x5, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x13e23(%rip), %rsi     # 0x32358
movl $0x6, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x1545b(%rip), %rsi     # 0x339a7
movl $0x17, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x153c5(%rip), %rsi     # 0x33928
movl $0x18, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x1542f(%rip), %rsi     # 0x339a9
movl $0x1a, %edx
movl $0xb, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x15418(%rip), %rsi     # 0x339ac
movl $0x1a, %edx
movl $0xc, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x15401(%rip), %rsi     # 0x339af
movl $0x1a, %edx
movl $0x9, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x153ea(%rip), %rsi     # 0x339b2
movl $0x1a, %edx
movl $0xa, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x153d3(%rip), %rsi     # 0x339b5
movl $0x1a, %edx
movl $0xd, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x153bc(%rip), %rsi     # 0x339b8
movl $0x1a, %edx
movl $0xe, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x153a5(%rip), %rsi     # 0x339bb
movl $0x1a, %edx
movl $0x29, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x1538e(%rip), %rsi     # 0x339be
movl $0x1a, %edx
movl $0x2b, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x15378(%rip), %rsi     # 0x339c2
movl $0x1a, %edx
movl $0x2c, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x15362(%rip), %rsi     # 0x339c6
movl $0x22, %edx
movl $0x1, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x1534b(%rip), %rsi     # 0x339c9
movl $0x22, %edx
movl $0x2, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x16137(%rip), %rsi     # 0x347cf
movl $0x1, %edx
movl $0x2a, %ecx
callq 0x1efc0
movq -0x20(%rbp), %rdi
leaq 0x15b6a(%rip), %rsi     # 0x3421c
movl $0x2, %edx
movl $0x9, %ecx
callq 0x1efc0
movq -0x20(%rbp), %rdi
leaq 0x15b4a(%rip), %rsi     # 0x34216
movl $0x3, %edx
movl $0xa, %ecx
callq 0x1efc0
movq -0x20(%rbp), %rdi
leaq 0x152e6(%rip), %rsi     # 0x339cc
movl $0x4, %edx
movl $0x28, %ecx
callq 0x1efc0
movq -0x20(%rbp), %rdi
leaq 0x152c7(%rip), %rsi     # 0x339c7
movl $0x5, %edx
movl $0xb, %ecx
callq 0x1efc0
movq -0x20(%rbp), %rdi
leaq 0x152b0(%rip), %rsi     # 0x339ca
movl $0x5, %edx
movl $0xc, %ecx
callq 0x1efc0
movq -0x20(%rbp), %rdi
leaq 0x1529a(%rip), %rsi     # 0x339ce
movl $0x7, %edx
movl $0x2b, %ecx
callq 0x1efc0
movq -0x20(%rbp), %rdi
leaq 0x15283(%rip), %rsi     # 0x339d1
movl $0x8, %edx
movl $0x2c, %ecx
callq 0x1efc0
movq -0x20(%rbp), %rdi
leaq 0x15273(%rip), %rsi     # 0x339db
movl $0x9, %edx
movl $0xd, %ecx
callq 0x1efc0
movq -0x20(%rbp), %rdi
leaq 0x1525c(%rip), %rsi     # 0x339de
movl $0xa, %edx
movl $0xe, %ecx
callq 0x1efc0
movq -0x20(%rbp), %rdi
leaq 0x153b8(%rip), %rsi     # 0x33b54
movl $0xb, %edx
movl $0x29, %ecx
callq 0x1efc0
movq -0x20(%rbp), %rdi
leaq 0x1521e(%rip), %rsi     # 0x339d4
movl $0xc, %edx
movl $0xf, %ecx
callq 0x1efc0
movq -0x20(%rbp), %rdi
leaq 0x15207(%rip), %rsi     # 0x339d7
movl $0xd, %edx
movl $0x10, %ecx
callq 0x1efc0
movq -0x20(%rbp), %rdi
leaq 0x151e8(%rip), %rsi     # 0x339d2
movl $0xe, %edx
movl $0x11, %ecx
callq 0x1efc0
movq -0x20(%rbp), %rdi
leaq 0x151cb(%rip), %rsi     # 0x339cf
movl $0xf, %edx
movl $0x12, %ecx
callq 0x1efc0
movq -0x20(%rbp), %rdi
leaq 0x151a5(%rip), %rsi     # 0x339c3
movl $0x10, %edx
movl $0x13, %ecx
callq 0x1efc0
movq -0x20(%rbp), %rdi
leaq 0x15187(%rip), %rsi     # 0x339bf
movl $0x11, %edx
movl $0x14, %ecx
callq 0x1efc0
movq -0x20(%rbp), %rdi
leaq 0x15188(%rip), %rsi     # 0x339da
movl $0x12, %edx
movl $0x15, %ecx
callq 0x1efc0
movq -0x20(%rbp), %rdi
leaq 0x15171(%rip), %rsi     # 0x339dd
movl $0x13, %edx
movl $0x16, %ecx
callq 0x1efc0
movq -0x20(%rbp), %rdi
leaq 0x1515a(%rip), %rsi     # 0x339e0
movl $0x35, %edx
movl $0x1, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x15144(%rip), %rsi     # 0x339e4
movl $0x7, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x151d4(%rip), %rsi     # 0x33a8b
movl $0x8, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x15149(%rip), %rsi     # 0x33a17
movl $0x9, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x158fb(%rip), %rsi     # 0x341e0
movl $0x1c, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x150ea(%rip), %rsi     # 0x339e6
movl $0x1d, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x130b2(%rip), %rsi     # 0x319c5
movl $0x1f, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x150c1(%rip), %rsi     # 0x339eb
movl $0x36, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x150ae(%rip), %rsi     # 0x339ef
movl $0x37, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x1509d(%rip), %rsi     # 0x339f5
movl $0x38, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x1508f(%rip), %rsi     # 0x339fe
movl $0x39, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x1507b(%rip), %rsi     # 0x33a01
movl $0x3b, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x1506b(%rip), %rsi     # 0x33a08
movl $0x3c, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x15059(%rip), %rsi     # 0x33a0d
movl $0x3d, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x1504a(%rip), %rsi     # 0x33a15
movl $0x1b, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x132b0(%rip), %rsi     # 0x31c92
movl $0x1e, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x1459a(%rip), %rsi     # 0x32f93
movl $0x20, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x1478a(%rip), %rsi     # 0x3319a
movl $0x20, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x14ff2(%rip), %rsi     # 0x33a19
movl $0x21, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x153ad(%rip), %rsi     # 0x33deb
movl $0x23, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x14831(%rip), %rsi     # 0x33286
movl $0x24, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x143d5(%rip), %rsi     # 0x32e41
movl $0x25, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x143bf(%rip), %rsi     # 0x32e42
movl $0x3e, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x14f86(%rip), %rsi     # 0x33a20
movl $0x26, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x14f79(%rip), %rsi     # 0x33a2a
movl $0x27, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x14f67(%rip), %rsi     # 0x33a2f
movl $0x29, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x1383e(%rip), %rsi     # 0x3231d
movl $0x15, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
movl %eax, 0x1c(%rdi)
leaq 0x14f3e(%rip), %rsi     # 0x33a37
movl $0x2b, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x14718(%rip), %rsi     # 0x33228
movl $0x2c, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x1473d(%rip), %rsi     # 0x33264
movl $0x2d, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x14f01(%rip), %rsi     # 0x33a3f
movl $0x30, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x154f2(%rip), %rsi     # 0x34047
movl $0x31, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x14ee2(%rip), %rsi     # 0x33a4e
movl $0x32, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x14eda(%rip), %rsi     # 0x33a5d
movl $0x33, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x14ecb(%rip), %rsi     # 0x33a65
movl $0x34, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x14ec0(%rip), %rsi     # 0x33a71
movl $0x3a, %edx
xorl %ecx, %ecx
callq 0x1ebe0
movq -0x20(%rbp), %rdi
leaq 0x12e8f(%rip), %rsi     # 0x31a57
movl $0x3f, %edx
xorl %ecx, %ecx
callq 0x1ebe0
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)