// File: philpoore[P]Math/./src/Interp.cpp
// Function: Interp::execStmt(AstStmt*)
void Interp::execStmt(AstStmt* stmt) {
    if (stmt->expr->type == AST_TYPE_ASSIGN) {
        AstAssign* assign = (AstAssign*)stmt->expr;
        double value = eval(assign->expr);
        string name = assign->name;
#ifdef DEBUG
        cerr << "--> setting variable: " + name + " to " + to_string(value)
             << endl;
#endif
        variables[name] = value;
    } else if (stmt->expr->type == AST_TYPE_BLOCK) {
        AstBlock* block = (AstBlock*)stmt->expr;
        for (auto stmt : block->stmts) {
            execStmt(stmt);
        }
    } else if (stmt->expr->type == AST_TYPE_IF) {
        AstIf* ast = (AstIf*)stmt->expr;
        double a = eval(ast->expr);
        if (a) {
            if (ast->if_branch) {
                for (auto stmt : ast->if_branch->stmts) {
                    execStmt(stmt);
                }
            }
        } else {
            if (ast->else_branch) {
                for (auto stmt : ast->else_branch->stmts) {
                    execStmt(stmt);
                }
            }
        }
    } else {
        double value = eval(stmt->expr);
        cout << setprecision(16) << value << endl;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x180, %rsp            # imm = 0x180
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x160(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x1, (%rax)
jne 0x7c63
movq -0x160(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rsi
callq 0x76b0
movsd %xmm0, -0x20(%rbp)
movq -0x18(%rbp), %rsi
addq $0x8, %rsi
leaq -0x40(%rbp), %rdi
movq %rdi, -0x168(%rbp)
callq 0x4160
movq -0x168(%rbp), %rdx
leaq 0xe894(%rip), %rsi      # 0x1636e
leaq -0xa0(%rbp), %rdi
callq 0xbbc0
jmp 0x7ae8
leaq 0xe896(%rip), %rdx      # 0x16385
leaq -0x80(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0xb790
jmp 0x7b01
movsd -0x20(%rbp), %xmm0
leaq -0xd0(%rbp), %rdi
callq 0xbb70
jmp 0x7b14
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rsi
leaq -0xd0(%rbp), %rdx
callq 0xb7e0
jmp 0x7b2a
movq 0x184bf(%rip), %rdi     # 0x1fff0
leaq -0x60(%rbp), %rsi
callq 0x42b0
movq %rax, -0x170(%rbp)
jmp 0x7b43
movq -0x170(%rbp), %rdi
movq 0x183af(%rip), %rsi     # 0x1ff00
callq 0x4320
jmp 0x7b58
leaq -0x60(%rbp), %rdi
callq 0x4200
leaq -0xd0(%rbp), %rdi
callq 0x4200
leaq -0x80(%rbp), %rdi
callq 0x4200
leaq -0xa0(%rbp), %rdi
callq 0x4200
movq -0x160(%rbp), %rdi
movsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x180(%rbp)
leaq -0x40(%rbp), %rsi
callq 0xc8e0
movq %rax, -0x178(%rbp)
jmp 0x7ba8
movq -0x178(%rbp), %rax
movsd -0x180(%rbp), %xmm0
movsd %xmm0, (%rax)
leaq -0x40(%rbp), %rdi
callq 0x4200
jmp 0x7f11
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0x7c55
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0x7c49
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0x7c40
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0x7c34
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x4200
leaq -0xd0(%rbp), %rdi
callq 0x4200
leaq -0x80(%rbp), %rdi
callq 0x4200
leaq -0xa0(%rbp), %rdi
callq 0x4200
leaq -0x40(%rbp), %rdi
callq 0x4200
jmp 0x7f1a
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x8, (%rax)
jne 0x7d10
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xd8(%rbp)
movq -0xd8(%rbp), %rax
addq $0x8, %rax
movq %rax, -0xe0(%rbp)
movq -0xe0(%rbp), %rdi
callq 0xbdc0
movq %rax, -0xe8(%rbp)
movq -0xe0(%rbp), %rdi
callq 0xbdf0
movq %rax, -0xf0(%rbp)
leaq -0xe8(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0xbe20
testb $0x1, %al
jne 0x7cd4
jmp 0x7d0b
leaq -0xe8(%rbp), %rdi
callq 0xbe60
movq -0x160(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0xf8(%rbp)
movq -0xf8(%rbp), %rsi
callq 0x7a60
leaq -0xe8(%rbp), %rdi
callq 0xbe80
jmp 0x7cbb
jmp 0x7f0f
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x9, (%rax)
jne 0x7eb0
movq -0x160(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x100(%rbp)
movq -0x100(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x76b0
movsd %xmm0, -0x108(%rbp)
movsd -0x108(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x7d67
jp 0x7d67
jmp 0x7e0c
movq -0x100(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x7e07
movq -0x100(%rbp), %rax
movq 0x10(%rax), %rax
addq $0x8, %rax
movq %rax, -0x110(%rbp)
movq -0x110(%rbp), %rdi
callq 0xbdc0
movq %rax, -0x118(%rbp)
movq -0x110(%rbp), %rdi
callq 0xbdf0
movq %rax, -0x120(%rbp)
leaq -0x118(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0xbe20
testb $0x1, %al
jne 0x7dce
jmp 0x7e05
leaq -0x118(%rbp), %rdi
callq 0xbe60
movq -0x160(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x128(%rbp)
movq -0x128(%rbp), %rsi
callq 0x7a60
leaq -0x118(%rbp), %rdi
callq 0xbe80
jmp 0x7db5
jmp 0x7e07
jmp 0x7eae
movq -0x100(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x7eac
movq -0x100(%rbp), %rax
movq 0x18(%rax), %rax
addq $0x8, %rax
movq %rax, -0x130(%rbp)
movq -0x130(%rbp), %rdi
callq 0xbdc0
movq %rax, -0x138(%rbp)
movq -0x130(%rbp), %rdi
callq 0xbdf0
movq %rax, -0x140(%rbp)
leaq -0x138(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0xbe20
testb $0x1, %al
jne 0x7e73
jmp 0x7eaa
leaq -0x138(%rbp), %rdi
callq 0xbe60
movq -0x160(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x148(%rbp)
movq -0x148(%rbp), %rsi
callq 0x7a60
leaq -0x138(%rbp), %rdi
callq 0xbe80
jmp 0x7e5a
jmp 0x7eac
jmp 0x7eae
jmp 0x7f0d
movq -0x160(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x76b0
movsd %xmm0, -0x150(%rbp)
movl $0x10, %edi
callq 0xc9c0
movl %eax, -0x154(%rbp)
movl -0x154(%rbp), %esi
movq 0x18087(%rip), %rdi     # 0x1ff70
callq 0x4450
movq %rax, %rdi
movsd -0x150(%rbp), %xmm0
callq 0x4520
movq %rax, %rdi
movq 0x17ff8(%rip), %rsi     # 0x1ff00
callq 0x4320
jmp 0x7f0f
jmp 0x7f11
addq $0x180, %rsp            # imm = 0x180
popq %rbp
retq
movq -0xa8(%rbp), %rdi
callq 0x44f0
nopw %cs:(%rax,%rax)