// File: /workspace/github_cpp_makefile_star2_O3/philpoore[P]Math/./src/Parser.cpp
// Function: Parser::parseStatement()
AstStmt* Parser::parseStatement() {
    consumeWhiteSpace();
    AstExpr* expr = nullptr;

    Token t = peek();
    // Assignment statement
    if (t.type == TOKEN_IF) {
        expr = (AstExpr*)parseIf();
    } else if (t.type == TOKEN_IDENT) {
        if (peekNonWhitespace(1).type == TOKEN_EQ) {
            // parse assignment statement
            Token t_ident = expect(TOKEN_IDENT);
            consumeWhiteSpace();

            expect(TOKEN_EQ);
            AstAssign* ast = new AstAssign();
            ast->name = t_ident.source;
            ast->expr = parseExpr();
            expr = (AstExpr*)ast;
        }
    } else if (peek().type == TOKEN_LCURLY) {
        // Block statement
        consume();
        expr = (AstExpr*)parseBlock();
        expect(TOKEN_RCURLY, "Unmatched curly brace, missing closing bracket.");
    }

    // default to parsing expressions.
    if (expr == nullptr) {
        expr = parseExpr();
    }

    if (expr == nullptr) {
        return nullptr;
    }

    consumeWhiteSpace();
    if (expr->type != AST_TYPE_BLOCK && expr->type != AST_TYPE_IF &&
        peek().type != TOKEN_EOF) {
        expect(TOKEN_SEMI, "Missing semi colon");
    }

    AstStmt* stmt = new AstStmt();
    stmt->expr = expr;
    return stmt;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movq %rdi, %rbx
callq 0x88a6
movslq 0x1c(%rbx), %rax
movq (%rbx), %r14
leaq (%rax,%rax,2), %r15
shlq $0x4, %r15
movl (%r14,%r15), %eax
leaq -0x100(%rbp), %rdi
movl %eax, -0x8(%rdi)
leaq -0xf0(%rbp), %r13
movq %r13, -0x10(%r13)
movq 0x8(%r14,%r15), %rsi
movq 0x10(%r14,%r15), %rdx
addq %rsi, %rdx
callq 0xb26a
movq 0x28(%r14,%r15), %rax
movq %rax, 0x10(%r13)
movl -0x18(%r13), %eax
cmpl $0x101, %eax            # imm = 0x101
je 0x8bdf
cmpl $0x10e, %eax            # imm = 0x10E
jne 0x8d4a
movq %rbx, %rdi
callq 0x90b2
movq %rax, %r14
jmp 0x8ec0
leaq -0x58(%rbp), %rdi
movq %rbx, %rsi
movl $0x1, %edx
callq 0x80e6
leaq -0x40(%rbp), %r12
movl -0x18(%r12), %r14d
movq -0x10(%r12), %rdi
cmpq %r12, %rdi
je 0x8c0f
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3240
cmpl $0x103, %r14d           # imm = 0x103
jne 0x8ea7
leaq -0xc8(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x487f(%rip), %rdx      # 0xd4ad
leaq -0xd8(%rbp), %rdi
movq %rdx, %rsi
callq 0xb494
leaq -0x58(%rbp), %rdi
leaq -0xd8(%rbp), %rcx
movq %rbx, %rsi
movl $0x101, %edx            # imm = 0x101
callq 0x839c
movq -0xd8(%rbp), %rdi
cmpq %r14, %rdi
je 0x8c70
movq -0xc8(%rbp), %rsi
incq %rsi
callq 0x3240
movq %rbx, %rdi
callq 0x88a6
leaq -0xa8(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x4823(%rip), %rdx      # 0xd4ad
leaq -0xb8(%rbp), %rdi
movq %rdx, %rsi
callq 0xb494
leaq -0x1c8(%rbp), %rdi
leaq -0xb8(%rbp), %rcx
movq %rbx, %rsi
movl $0x103, %edx            # imm = 0x103
callq 0x839c
leaq -0x1b0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8cd3
movq -0x1b0(%rbp), %rsi
incq %rsi
callq 0x3240
movq -0xb8(%rbp), %rdi
cmpq %r14, %rdi
je 0x8cee
movq -0xa8(%rbp), %rsi
incq %rsi
callq 0x3240
movl $0x30, %edi
callq 0x3230
movq %rax, %r14
movl $0x1, (%rax)
leaq 0x8(%rax), %rdi
addq $0x18, %rax
movq %rax, 0x8(%r14)
movq $0x0, 0x10(%r14)
movb $0x0, 0x18(%r14)
leaq -0x50(%rbp), %rsi
callq 0x3150
movq %rbx, %rdi
movl $0xffffd8f1, %esi       # imm = 0xFFFFD8F1
callq 0x9552
movq %rax, 0x28(%r14)
movq -0x50(%rbp), %rdi
cmpq %r12, %rdi
je 0x8ec0
movq -0x40(%rbp), %rsi
jmp 0x8e9d
movslq 0x1c(%rbx), %rax
movq (%rbx), %r14
leaq (%rax,%rax,2), %r12
shlq $0x4, %r12
movl (%r14,%r12), %eax
leaq -0x50(%rbp), %rdi
movl %eax, -0x8(%rdi)
leaq -0x40(%rbp), %r13
movq %r13, -0x10(%r13)
movq 0x8(%r14,%r12), %rsi
movq 0x10(%r14,%r12), %rdx
addq %rsi, %rdx
callq 0xb26a
addq %r12, %r14
movq 0x28(%r14), %rax
movq %rax, -0x30(%rbp)
movl -0x58(%rbp), %r14d
movq -0x50(%rbp), %rdi
cmpq %r13, %rdi
je 0x8da2
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3240
cmpl $0x10c, %r14d           # imm = 0x10C
leaq -0xf0(%rbp), %r13
jne 0x8ea7
movslq 0x1c(%rbx), %rax
leal 0x1(%rax), %ecx
movl %ecx, 0x1c(%rbx)
movq (%rbx), %r14
leaq (%rax,%rax,2), %r12
shlq $0x4, %r12
movl (%r14,%r12), %eax
leaq -0x130(%rbp), %rdi
movl %eax, -0x8(%rdi)
leaq -0x120(%rbp), %r15
movq %r15, -0x10(%r15)
movq 0x8(%r14,%r12), %rsi
movq 0x10(%r14,%r12), %rdx
addq %rsi, %rdx
callq 0xb26a
addq %r12, %r14
movq 0x28(%r14), %rax
movq %rax, -0x110(%rbp)
movq -0x130(%rbp), %rdi
cmpq %r15, %rdi
je 0x8e1f
movq -0x120(%rbp), %rsi
incq %rsi
callq 0x3240
movq %rbx, %rdi
callq 0x98c2
movq %rax, %r14
leaq -0x88(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x453a(%rip), %rsi      # 0xd377
leaq 0x4562(%rip), %rdx      # 0xd3a6
leaq -0x98(%rbp), %rdi
callq 0xb494
leaq -0x198(%rbp), %rdi
leaq -0x98(%rbp), %rcx
movq %rbx, %rsi
movl $0x10d, %edx            # imm = 0x10D
callq 0x839c
leaq -0x180(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8e8a
movq -0x180(%rbp), %rsi
incq %rsi
callq 0x3240
movq -0x98(%rbp), %rdi
cmpq %r12, %rdi
je 0x8ec0
movq -0x88(%rbp), %rsi
incq %rsi
callq 0x3240
jmp 0x8ec0
movq %rbx, %rdi
movl $0xffffd8f1, %esi       # imm = 0xFFFFD8F1
callq 0x9552
movq %rax, %r14
testq %rax, %rax
je 0x8ff3
movq %rbx, %rdi
callq 0x88a6
movl (%r14), %eax
andl $-0x2, %eax
cmpl $0x8, %eax
je 0x8fac
movslq 0x1c(%rbx), %rax
movq (%rbx), %r12
leaq (%rax,%rax,2), %r13
shlq $0x4, %r13
movl (%r12,%r13), %eax
leaq -0x50(%rbp), %rdi
movl %eax, -0x8(%rdi)
leaq -0x40(%rbp), %r15
movq %r15, -0x10(%r15)
movq 0x8(%r12,%r13), %rsi
movq 0x10(%r12,%r13), %rdx
addq %rsi, %rdx
callq 0xb26a
addq %r13, %r12
movq 0x28(%r12), %rax
movq %rax, -0x30(%rbp)
movl -0x58(%rbp), %r12d
movq -0x50(%rbp), %rdi
cmpq %r15, %rdi
je 0x8f30
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3240
cmpl $0x112, %r12d           # imm = 0x112
leaq -0xf0(%rbp), %r13
je 0x8fac
leaq -0x68(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0x4457(%rip), %rsi      # 0xd3a7
leaq 0x4462(%rip), %rdx      # 0xd3b9
leaq -0x78(%rbp), %rdi
callq 0xb494
leaq -0x168(%rbp), %rdi
leaq -0x78(%rbp), %rcx
movq %rbx, %rsi
movl $0x110, %edx            # imm = 0x110
callq 0x839c
leaq -0x150(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8f97
movq -0x150(%rbp), %rsi
incq %rsi
callq 0x3240
movq -0x78(%rbp), %rdi
cmpq %r12, %rdi
je 0x8fac
movq -0x68(%rbp), %rsi
incq %rsi
callq 0x3240
movl $0x10, %edi
callq 0x3230
movq %rax, %rbx
movl $0x0, (%rax)
movq %r14, 0x8(%rax)
movq -0x100(%rbp), %rdi
cmpq %r13, %rdi
je 0x8fde
movq -0xf0(%rbp), %rsi
incq %rsi
callq 0x3240
movq %rbx, %rax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebx, %ebx
jmp 0x8fc3
movq %rax, %rbx
movq -0xb8(%rbp), %rdi
cmpq %r14, %rdi
je 0x906c
movq -0xa8(%rbp), %rsi
incq %rsi
callq 0x3240
jmp 0x906c
movq %rax, %rbx
movq -0x98(%rbp), %rdi
cmpq %r12, %rdi
je 0x9088
movq -0x88(%rbp), %rsi
jmp 0x9079
jmp 0x9069
jmp 0x9085
jmp 0x9069
movq %rax, %rbx
movq -0xd8(%rbp), %rdi
cmpq %r14, %rdi
je 0x9088
movq -0xc8(%rbp), %rsi
jmp 0x9079
jmp 0x9085
movq %rax, %rbx
movq -0x78(%rbp), %rdi
cmpq %r12, %rdi
je 0x9088
movq -0x68(%rbp), %rsi
jmp 0x9079
jmp 0x9085
jmp 0x9085
jmp 0x9085
jmp 0x9085
movq %rax, %rbx
movq -0x50(%rbp), %rdi
cmpq %r12, %rdi
je 0x9088
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x3240
jmp 0x9088
jmp 0x9085
movq %rax, %rbx
movq -0x100(%rbp), %rdi
leaq -0xf0(%rbp), %rax
cmpq %rax, %rdi
je 0x90aa
movq -0xf0(%rbp), %rsi
incq %rsi
callq 0x3240
movq %rbx, %rdi
callq 0x3370