// File: vssense[P]Compiler/src/back-end/compiling.cpp
// Function: NameTableDump(NameTable*)
void NameTableDump(NameTable* table)
{
    assert(table);

    for (size_t i = 0; i < table->num_func; ++i)
    {
        printf("\n%s :\n", table->functions[i].name);
        printf("\tparams(%lu) : ", table->functions[i].num_args);

        for (size_t j = 0; j < table->functions[i].num_args; ++j)
        {
            printf("%s[%d], ", table->functions[i].vars[j], GetVarOfs(table->functions + i, table->functions[i].vars[j]));
        }
        printf("\n\tvars(%lu) : ", table->functions[i].num_vars);

        for (size_t j = table->functions[i].num_args; j < table->functions[i].num_args + 
                                                          table->functions[i].num_vars; ++j)
        {
            printf("%s[%d], ", table->functions[i].vars[j], GetVarOfs(table->functions + i, table->functions[i].vars[j]));
        }
    }

    printf("\n");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x2555
jmp 0x2574
leaq 0x8424(%rip), %rdi      # 0xa980
leaq 0x8388(%rip), %rsi      # 0xa8eb
movl $0x36d, %edx            # imm = 0x36D
leaq 0x87ae(%rip), %rcx      # 0xad1d
callq 0x20a0
movq $0x0, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x2750
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x30, -0x10(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rsi
leaq 0x8796(%rip), %rdi      # 0xad3d
movb $0x0, %al
callq 0x2040
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x30, -0x10(%rbp), %rcx
addq %rcx, %rax
movq 0x18(%rax), %rsi
leaq 0x877c(%rip), %rdi      # 0xad44
movb $0x0, %al
callq 0x2040
movq $0x0, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x30, -0x10(%rbp), %rdx
addq %rdx, %rcx
cmpq 0x18(%rcx), %rax
jae 0x2663
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x30, -0x10(%rbp), %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
imulq $0x30, -0x10(%rbp), %rax
addq %rax, %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x30, -0x10(%rbp), %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq -0x18(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x37f0
movq -0x28(%rbp), %rsi
movl %eax, %edx
leaq 0x8709(%rip), %rdi      # 0xad54
movb $0x0, %al
callq 0x2040
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x25d7
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x30, -0x10(%rbp), %rcx
addq %rcx, %rax
movq 0x20(%rax), %rsi
leaq 0x86e0(%rip), %rdi      # 0xad5d
movb $0x0, %al
callq 0x2040
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x30, -0x10(%rbp), %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
imulq $0x30, -0x10(%rbp), %rdx
addq %rdx, %rcx
movq 0x18(%rcx), %rcx
movq -0x8(%rbp), %rdx
movq (%rdx), %rdx
imulq $0x30, -0x10(%rbp), %rsi
addq %rsi, %rdx
addq 0x20(%rdx), %rcx
cmpq %rcx, %rax
jae 0x273d
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x30, -0x10(%rbp), %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
imulq $0x30, -0x10(%rbp), %rax
addq %rax, %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rax
imulq $0x30, -0x10(%rbp), %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x37f0
movq -0x30(%rbp), %rsi
movl %eax, %edx
leaq 0x862f(%rip), %rdi      # 0xad54
movb $0x0, %al
callq 0x2040
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x269b
jmp 0x273f
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x257c
leaq 0x8181(%rip), %rdi      # 0xa8d8
movb $0x0, %al
callq 0x2040
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)