// File: johan-bjareholt[P]lua-compiler/src/ir.cc
// Function: Expression::dump(std::ostream&, int)
void Expression::dump(std::ostream& ss, int depth)
{
    for(int i=0; i<depth; i++)  
        ss << "  ";
    switch(kind)
    {
        case 'N':  ss << op    << endl; break;
        case 'V':  ss << name  << endl; break;
        case 'C':  ss << value << endl; break;
	    case 'S':  ss << name  << endl; break;
	    case 'f':  ss << name  << endl; break;
        default: std::cout << "ERROR: bad expression kind '" << kind << '\''<< endl; ss << "bad expression" << endl; break;
    }
    if(left!=NULL)
        left->dump(ss, depth+1);
    if(right!=NULL)
        right->dump(ss, depth+1);
    for (Expression* exp : subexp)
        exp->dump(ss, depth+1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x7025
movq -0x10(%rbp), %rdi
leaq 0x244fe(%rip), %rsi     # 0x2b513
callq 0x3260
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x7002
movq -0x40(%rbp), %rax
movsbl 0x28(%rax), %eax
addl $-0x43, %eax
movl %eax, %ecx
movq %rcx, -0x48(%rbp)
subl $0x23, %eax
ja 0x7108
movq -0x48(%rbp), %rax
leaq 0x23ffe(%rip), %rcx     # 0x2b048
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x40(%rbp), %rax
movq -0x10(%rbp), %rdi
movsbl 0x29(%rax), %esi
callq 0x3300
movq %rax, %rdi
movq 0x36f32(%rip), %rsi     # 0x3dfa0
callq 0x32a0
jmp 0x7166
movq -0x40(%rbp), %rsi
movq -0x10(%rbp), %rdi
addq $0x30, %rsi
callq 0x3220
movq %rax, %rdi
movq 0x36f0d(%rip), %rsi     # 0x3dfa0
callq 0x32a0
jmp 0x7166
movq -0x40(%rbp), %rax
movq -0x10(%rbp), %rdi
movl 0x2c(%rax), %esi
callq 0x3490
movq %rax, %rdi
movq 0x36ee9(%rip), %rsi     # 0x3dfa0
callq 0x32a0
jmp 0x7166
movq -0x40(%rbp), %rsi
movq -0x10(%rbp), %rdi
addq $0x30, %rsi
callq 0x3220
movq %rax, %rdi
movq 0x36ec4(%rip), %rsi     # 0x3dfa0
callq 0x32a0
jmp 0x7166
movq -0x40(%rbp), %rsi
movq -0x10(%rbp), %rdi
addq $0x30, %rsi
callq 0x3220
movq %rax, %rdi
movq 0x36e9f(%rip), %rsi     # 0x3dfa0
callq 0x32a0
jmp 0x7166
movq 0x36eb9(%rip), %rdi     # 0x3dfc8
leaq 0x24100(%rip), %rsi     # 0x2b216
callq 0x3260
movq %rax, %rdi
movq -0x40(%rbp), %rax
movsbl 0x28(%rax), %esi
callq 0x3300
movq %rax, %rdi
movl $0x27, %esi
callq 0x3300
movq %rax, %rdi
movq 0x36e5e(%rip), %rsi     # 0x3dfa0
callq 0x32a0
movq -0x10(%rbp), %rdi
leaq 0x240e1(%rip), %rsi     # 0x2b233
callq 0x3260
movq %rax, %rdi
movq 0x36e3f(%rip), %rsi     # 0x3dfa0
callq 0x32a0
movq -0x40(%rbp), %rax
cmpq $0x0, (%rax)
je 0x7186
movq -0x40(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
addl $0x1, %edx
callq 0x6fe0
movq -0x40(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x71a8
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
addl $0x1, %edx
callq 0x6fe0
movq -0x40(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0xa040
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rdi
callq 0xa070
movq %rax, -0x30(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0xa0a0
testb $0x1, %al
jne 0x71e1
jmp 0x720f
leaq -0x28(%rbp), %rdi
callq 0xa0d0
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x14(%rbp), %edx
addl $0x1, %edx
callq 0x6fe0
leaq -0x28(%rbp), %rdi
callq 0xa100
jmp 0x71ce
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)