// File: /workspace/github_cpp_makefile_star2_O3/zimpha[P]MiniSQL/interpreter.cc
// Function: Interpreter::printSelectResult(Table const&, Response const&)
void Interpreter::printSelectResult(const Table &nt, const Response &res) {
    std::vector<int> space(nt.attributes.size());
    for (size_t i = 0; i < space.size(); ++ i) {
        space[i] = nt.attributes[i].name.length() + 1;
    }
    for (size_t i = 0; i < res.result.size(); ++ i) {
        for (size_t j = 0; j < res.result[i].size(); ++ j) {
            std::strstream sin;
            switch (res.result[i][j].type) {
            case 0:
                sin << res.result[i][j].i;
                break;
            case 1:
                sin << res.result[i][j].f;
                break;
            case 2:
                sin << res.result[i][j].s;
                break;
            default: assert(false);
            }
            std::string s; sin >> s;
            space[j] = std::max(space[j], (int)s.length() + 1);
        }
    }
    int sum = std::accumulate(space.begin(), space.end(), space.size() + 1);
    for (int _ = 0; _ < sum; ++ _) std::cout << "-"; 
    std::cout << std::endl;
    std::cout << "|";
    for (size_t i = 0; i < nt.attributes.size(); ++ i) {
        std::cout << nt.attributes[i].name;
        int extra = space[i] - nt.attributes[i].name.length();
        for (int _ = 0; _ < extra; ++ _) std::cout << " ";
        std::cout << "|";
    }
    std::cout << std::endl;
    for (size_t i = 0; i < res.result.size(); ++ i) {
        std::cout << "|";
        for (size_t j = 0; j < res.result[i].size(); ++ j) {
            std::strstream sin;
            switch (res.result[i][j].type) {
            case 0:
                sin << res.result[i][j].i;
                break;
            case 1:
                sin << res.result[i][j].f;
                break;
            case 2:
                sin << res.result[i][j].s;
                break;
            default: assert(false);
            }
            std::string s; sin >> s;
            int extra = space[j] - s.length();
            res.result[i][j].print();
            for (int _ = 0; _ < extra; ++ _) std::cout << " ";
            std::cout << "|";
        }
        std::cout << std::endl;
    }
    for (int _ = 0; _ < sum; ++ _) std::cout << "-";
    std::cout << std::endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1d8, %rsp            # imm = 0x1D8
movq %rsi, %rax
movq 0x30(%rsi), %rsi
movq %rax, -0x38(%rbp)
subq 0x28(%rax), %rsi
movq %rdx, -0x30(%rbp)
sarq $0x5, %rsi
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rsi
leaq -0x80(%rbp), %r15
leaq -0x1f8(%rbp), %rdx
movq %r15, %rdi
callq 0x119fe
movq (%r15), %rcx
movq 0x8(%r15), %rax
movq %rax, %rdx
subq %rcx, %rdx
je 0x113cb
sarq $0x2, %rdx
movq -0x38(%rbp), %rsi
movq 0x28(%rsi), %rsi
cmpq $0x1, %rdx
adcq $0x0, %rdx
addq $0x8, %rsi
xorl %edi, %edi
movl (%rsi), %r8d
incl %r8d
movl %r8d, (%rcx,%rdi,4)
incq %rdi
addq $0x60, %rsi
cmpq %rdi, %rdx
jne 0x113b5
movq -0x30(%rbp), %rdx
movq 0x28(%rdx), %rcx
movq 0x30(%rdx), %rdx
cmpq %rcx, %rdx
je 0x11529
leaq -0x50(%rbp), %r14
xorl %edi, %edi
leaq -0x1f8(%rbp), %r12
leaq (%rdi,%rdi,2), %rbx
movq 0x8(%rcx,%rbx,8), %rax
cmpq (%rcx,%rbx,8), %rax
je 0x114fc
movq %rdi, -0x40(%rbp)
xorl %r15d, %r15d
xorl %r13d, %r13d
movq %r12, %rdi
callq 0x3390
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rax
movq (%rax,%rbx,8), %rax
movl 0x28(%rax,%r15), %ecx
testl %ecx, %ecx
je 0x11465
cmpl $0x1, %ecx
je 0x1144d
cmpl $0x2, %ecx
jne 0x11901
movq 0x8(%rax,%r15), %rsi
movq 0x10(%rax,%r15), %rdx
leaq -0x1e8(%rbp), %rdi
callq 0x3310
jmp 0x11475
xorps %xmm0, %xmm0
cvtss2sd 0x4(%rax,%r15), %xmm0
leaq -0x1e8(%rbp), %rdi
callq 0x3410
jmp 0x11475
movl (%rax,%r15), %esi
leaq -0x1e8(%rbp), %rdi
callq 0x3470
movq %r14, -0x60(%rbp)
movq $0x0, -0x58(%rbp)
movb $0x0, -0x50(%rbp)
movq %r12, %rdi
leaq -0x60(%rbp), %rsi
callq 0x3360
movq -0x80(%rbp), %rax
movl -0x58(%rbp), %ecx
incl %ecx
movl (%rax,%r13,4), %edx
cmpl %ecx, %edx
cmovgl %edx, %ecx
movl %ecx, (%rax,%r13,4)
movq -0x60(%rbp), %rdi
cmpq %r14, %rdi
je 0x114b5
callq 0x3270
movq %r12, %rdi
callq 0x34e0
incq %r13
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rcx
movq 0x8(%rcx,%rbx,8), %rax
subq (%rcx,%rbx,8), %rax
sarq $0x4, %rax
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdx, %rax
addq $0x30, %r15
cmpq %rax, %r13
jb 0x1140a
movq -0x30(%rbp), %rax
movq 0x30(%rax), %rdx
movq -0x40(%rbp), %rdi
incq %rdi
movq %rdx, %rax
subq %rcx, %rax
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rsi # imm = 0xAAAAAAAAAAAAAAAB
imulq %rsi, %rax
cmpq %rax, %rdi
jb 0x113ed
movq -0x78(%rbp), %r14
movq %r14, %rax
jmp 0x1152c
movq %rax, %r14
movq -0x80(%rbp), %rcx
subq %rcx, %r14
sarq $0x2, %r14
incq %r14
cmpq %rax, %rcx
je 0x1154a
movl (%rcx), %edx
addq %rdx, %r14
addq $0x4, %rcx
jmp 0x1153a
testl %r14d, %r14d
jle 0x11574
movq 0x9a72(%rip), %r15      # 0x1afc8
leaq 0x319f(%rip), %r12      # 0x146fc
movl %r14d, %ebx
movl $0x1, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x3310
decl %ebx
jne 0x11560
movq %r14, -0x40(%rbp)
movq 0x9a49(%rip), %rdi      # 0x1afc8
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x3280
movsbl %al, %esi
movq 0x9a2e(%rip), %rdi      # 0x1afc8
callq 0x3040
movq %rax, %rdi
callq 0x31c0
movq 0x9a1a(%rip), %rdi      # 0x1afc8
leaq 0x3149(%rip), %rsi      # 0x146fe
movl $0x1, %edx
callq 0x3310
movq -0x38(%rbp), %rcx
movq 0x28(%rcx), %rax
cmpq %rax, 0x30(%rcx)
je 0x1166a
xorl %ebx, %ebx
movq 0x99ee(%rip), %r12      # 0x1afc8
leaq 0x303c(%rip), %r13      # 0x1461d
leaq (%rbx,%rbx,2), %r15
shlq $0x5, %r15
movq (%rax,%r15), %rsi
movq 0x8(%rax,%r15), %rdx
movq %r12, %rdi
callq 0x3310
movq -0x80(%rbp), %rax
movl (%rax,%rbx,4), %r14d
movq -0x38(%rbp), %rax
movq 0x28(%rax), %rax
subl 0x8(%rax,%r15), %r14d
testl %r14d, %r14d
jle 0x11629
movl $0x1, %edx
movq %r12, %rdi
movq %r13, %rsi
callq 0x3310
decl %r14d
jne 0x11614
movl $0x1, %edx
movq %r12, %rdi
leaq 0x30c6(%rip), %rsi      # 0x146fe
callq 0x3310
incq %rbx
movq -0x38(%rbp), %rcx
movq 0x28(%rcx), %rax
movq 0x30(%rcx), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdx, %rcx
cmpq %rcx, %rbx
jb 0x115e1
movq 0x9957(%rip), %rdi      # 0x1afc8
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x3280
movsbl %al, %esi
movq 0x993c(%rip), %r14      # 0x1afc8
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31c0
movq -0x30(%rbp), %rcx
movq 0x30(%rcx), %rax
cmpq 0x28(%rcx), %rax
movq -0x40(%rbp), %r12
je 0x1188e
movq $0x0, -0x68(%rbp)
leaq -0x1f8(%rbp), %r15
movl $0x1, %edx
movq %r14, %rdi
leaq 0x302e(%rip), %rsi      # 0x146fe
callq 0x3310
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x68(%rbp), %rcx
leaq (%rcx,%rcx,2), %rdx
movq 0x8(%rax,%rdx,8), %rcx
movq %rdx, -0x38(%rbp)
cmpq (%rax,%rdx,8), %rcx
je 0x11835
xorl %ebx, %ebx
movq %r15, %rdi
callq 0x3390
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rax
leaq (%rbx,%rbx,2), %r12
shlq $0x4, %r12
movl 0x28(%rax,%r12), %ecx
addq %r12, %rax
testl %ecx, %ecx
je 0x1175d
cmpl $0x1, %ecx
je 0x1174a
cmpl $0x2, %ecx
jne 0x11920
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
leaq -0x1e8(%rbp), %rdi
callq 0x3310
jmp 0x1176b
cvtss2sd 0x4(%rax), %xmm0
leaq -0x1e8(%rbp), %rdi
callq 0x3410
jmp 0x1176b
movl (%rax), %esi
leaq -0x1e8(%rbp), %rdi
callq 0x3470
leaq -0x50(%rbp), %rax
movq %rax, -0x60(%rbp)
movq $0x0, -0x58(%rbp)
movb $0x0, -0x50(%rbp)
movq %r15, %rdi
leaq -0x60(%rbp), %rsi
callq 0x3360
movq -0x80(%rbp), %rax
movl (%rax,%rbx,4), %r13d
subl -0x58(%rbp), %r13d
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x38(%rbp), %rcx
addq (%rax,%rcx,8), %r12
movq %r12, %rdi
callq 0x13386
leaq 0x2e67(%rip), %r12      # 0x1461d
testl %r13d, %r13d
jle 0x117d0
movl $0x1, %edx
movq %r14, %rdi
movq %r12, %rsi
callq 0x3310
decl %r13d
jne 0x117bb
movl $0x1, %edx
movq %r14, %rdi
leaq 0x2f1f(%rip), %rsi      # 0x146fe
callq 0x3310
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0x117f6
callq 0x3270
movq %r15, %rdi
callq 0x34e0
movq -0x30(%rbp), %rax
movq 0x28(%rax), %rax
movq -0x38(%rbp), %rdx
movq 0x8(%rax,%rdx,8), %rcx
subq (%rax,%rdx,8), %rcx
incq %rbx
sarq $0x4, %rcx
movabsq $-0x5555555555555555, %rax # imm = 0xAAAAAAAAAAAAAAAB
imulq %rax, %rcx
cmpq %rcx, %rbx
movq -0x40(%rbp), %r12
jb 0x116fa
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3280
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x31c0
movq -0x30(%rbp), %rcx
movq 0x30(%rcx), %rax
subq 0x28(%rcx), %rax
movq -0x68(%rbp), %rdx
incq %rdx
sarq $0x3, %rax
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rax
movq %rdx, -0x68(%rbp)
cmpq %rax, %rdx
jb 0x116c1
testl %r12d, %r12d
jle 0x118b6
movq 0x972e(%rip), %rbx      # 0x1afc8
leaq 0x2e5b(%rip), %r15      # 0x146fc
movl $0x1, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3310
decl %r12d
jne 0x118a1
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x3280
movsbl %al, %esi
movq 0x96f4(%rip), %rdi      # 0x1afc8
callq 0x3040
movq %rax, %rdi
callq 0x31c0
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0x118ef
callq 0x3270
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2877(%rip), %rdi      # 0x1417f
leaq 0x2d99(%rip), %rsi      # 0x146a8
leaq 0x2da1(%rip), %rcx      # 0x146b7
movl $0x176, %edx            # imm = 0x176
callq 0x31a0
leaq 0x2858(%rip), %rdi      # 0x1417f
leaq 0x2d7a(%rip), %rsi      # 0x146a8
leaq 0x2d82(%rip), %rcx      # 0x146b7
movl $0x195, %edx            # imm = 0x195
callq 0x31a0
jmp 0x11966
jmp 0x11966
jmp 0x11966
jmp 0x11966
jmp 0x11966
jmp 0x11966
jmp 0x11966
jmp 0x11951
jmp 0x1196d
movq %rax, %rbx
jmp 0x11982
movq %rax, %rbx
movq -0x60(%rbp), %rdi
cmpq %r14, %rdi
jne 0x1197d
jmp 0x11982
jmp 0x11966
movq %rax, %rbx
jmp 0x1198e
jmp 0x1196d
movq %rax, %rbx
movq -0x60(%rbp), %rdi
leaq -0x50(%rbp), %rax
cmpq %rax, %rdi
je 0x11982
callq 0x3270
leaq -0x1f8(%rbp), %rdi
callq 0x34e0
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0x1199c
callq 0x3270
movq %rbx, %rdi
callq 0x3480