// File: protonpopsicle[P]lang/src/compiler/Parser.cpp
// Function: Parser::stmts()
void Parser::stmts() {
    char lhs, rhs;
    std::string id;
    
    while (look.tag == '{' || look.tag == ID || look.tag == BASIC || look.tag == PRINT || 
           look.tag == IF || look.tag == WHILE || look.tag == DO) {
        switch (look.tag) {
            // stmt -> block
            case '{':
                block();
                break;
            // stmt -> decl
            case BASIC:
                decl();
                break;
            // stmt -> id = bool
            case ID:
                id = look.lexeme;
                move(); 
                match('=');
                rhs = boolean();
                byteCoder->assignVar(id, rhs);
                break;
            // stmt -> print bool
            case PRINT:
                move(); 
                rhs = boolean();
                byteCoder->print(rhs);
                break;
            // stmt -> if bool block
            case IF:
                move(); 
                boolean();
                byteCoder->jump();
                block();
                byteCoder->land();
                break;
            // stmt -> while bool block
            case WHILE:
                move();
                byteCoder->startLoop();
                boolean();
                byteCoder->jump();
                block();
                byteCoder->endLoop();
                byteCoder->land();
                break;
            // stmt -> do block while bool
            case DO:
                move();
                byteCoder->startLoop();
                block();
                match(WHILE);
                boolean();
                byteCoder->jump();
                byteCoder->endLoop();
                byteCoder->land();
                break;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x68(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x22f0
movq -0x68(%rbp), %rax
movswl 0x18(%rax), %ecx
movb $0x1, %al
cmpl $0x7b, %ecx
movb %al, -0x69(%rbp)
je 0x906e
movq -0x68(%rbp), %rax
movswl 0x18(%rax), %ecx
movb $0x1, %al
cmpl $0x102, %ecx            # imm = 0x102
movb %al, -0x69(%rbp)
je 0x906e
movq -0x68(%rbp), %rax
movswl 0x18(%rax), %ecx
movb $0x1, %al
cmpl $0x103, %ecx            # imm = 0x103
movb %al, -0x69(%rbp)
je 0x906e
movq -0x68(%rbp), %rax
movswl 0x18(%rax), %ecx
movb $0x1, %al
cmpl $0x106, %ecx            # imm = 0x106
movb %al, -0x69(%rbp)
je 0x906e
movq -0x68(%rbp), %rax
movswl 0x18(%rax), %ecx
movb $0x1, %al
cmpl $0x107, %ecx            # imm = 0x107
movb %al, -0x69(%rbp)
je 0x906e
movq -0x68(%rbp), %rax
movswl 0x18(%rax), %ecx
movb $0x1, %al
cmpl $0x108, %ecx            # imm = 0x108
movb %al, -0x69(%rbp)
je 0x906e
movq -0x68(%rbp), %rax
movswl 0x18(%rax), %eax
cmpl $0x109, %eax            # imm = 0x109
sete %al
movb %al, -0x69(%rbp)
movb -0x69(%rbp), %al
testb $0x1, %al
jne 0x907a
jmp 0x9308
movq -0x68(%rbp), %rax
movswl 0x18(%rax), %eax
movl %eax, -0x70(%rbp)
subl $0x7b, %eax
je 0x90eb
jmp 0x908c
movl -0x70(%rbp), %eax
subl $0x102, %eax            # imm = 0x102
je 0x911c
jmp 0x909c
movl -0x70(%rbp), %eax
subl $0x103, %eax            # imm = 0x103
je 0x910c
jmp 0x90a8
movl -0x70(%rbp), %eax
subl $0x106, %eax            # imm = 0x106
je 0x91b4
jmp 0x90b8
movl -0x70(%rbp), %eax
subl $0x107, %eax            # imm = 0x107
je 0x91f1
jmp 0x90c8
movl -0x70(%rbp), %eax
subl $0x108, %eax            # imm = 0x108
je 0x9235
jmp 0x90d8
movl -0x70(%rbp), %eax
subl $0x109, %eax            # imm = 0x109
je 0x9294
jmp 0x9303
movq -0x68(%rbp), %rdi
callq 0x8f50
jmp 0x90f6
jmp 0x9303
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x931a
movq -0x68(%rbp), %rdi
callq 0x9330
jmp 0x9117
jmp 0x9303
movq -0x68(%rbp), %rsi
addq $0x20, %rsi
leaq -0x30(%rbp), %rdi
callq 0x2050
jmp 0x912f
movq -0x68(%rbp), %rdi
callq 0x8e50
jmp 0x913a
movq -0x68(%rbp), %rdi
movl $0x3d, %esi
callq 0x8e90
jmp 0x914a
movq -0x68(%rbp), %rdi
callq 0x9530
movb %al, -0x71(%rbp)
jmp 0x9158
movq -0x68(%rbp), %rax
movb -0x71(%rbp), %cl
movb %cl, -0xa(%rbp)
movq 0x10(%rax), %rax
movq %rax, -0x80(%rbp)
leaq -0x60(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x2100
jmp 0x9179
movq -0x80(%rbp), %rdi
movsbl -0xa(%rbp), %edx
leaq -0x60(%rbp), %rsi
callq 0x2970
jmp 0x918c
leaq -0x60(%rbp), %rdi
callq 0x2160
jmp 0x9303
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x2160
jmp 0x931a
movq -0x68(%rbp), %rdi
callq 0x8e50
jmp 0x91bf
movq -0x68(%rbp), %rdi
callq 0x9530
movb %al, -0x81(%rbp)
jmp 0x91d0
movq -0x68(%rbp), %rax
movb -0x81(%rbp), %cl
movb %cl, -0xa(%rbp)
movq 0x10(%rax), %rdi
movsbl -0xa(%rbp), %esi
callq 0x31d0
jmp 0x91ec
jmp 0x9303
movq -0x68(%rbp), %rdi
callq 0x8e50
jmp 0x91fc
movq -0x68(%rbp), %rdi
callq 0x9530
jmp 0x9207
movq -0x68(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x3360
jmp 0x9216
movq -0x68(%rbp), %rdi
callq 0x8f50
jmp 0x9221
movq -0x68(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x33b0
jmp 0x9230
jmp 0x9303
movq -0x68(%rbp), %rdi
callq 0x8e50
jmp 0x9240
movq -0x68(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x32e0
jmp 0x924f
movq -0x68(%rbp), %rdi
callq 0x9530
jmp 0x925a
movq -0x68(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x3360
jmp 0x9269
movq -0x68(%rbp), %rdi
callq 0x8f50
jmp 0x9274
movq -0x68(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x3310
jmp 0x9283
movq -0x68(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x33b0
jmp 0x9292
jmp 0x9303
movq -0x68(%rbp), %rdi
callq 0x8e50
jmp 0x929f
movq -0x68(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x32e0
jmp 0x92ae
movq -0x68(%rbp), %rdi
callq 0x8f50
jmp 0x92b9
movq -0x68(%rbp), %rdi
movl $0x108, %esi            # imm = 0x108
callq 0x8e90
jmp 0x92c9
movq -0x68(%rbp), %rdi
callq 0x9530
jmp 0x92d4
movq -0x68(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x3360
jmp 0x92e3
movq -0x68(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x3310
jmp 0x92f2
movq -0x68(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x33b0
jmp 0x9301
jmp 0x9303
jmp 0x8fe0
leaq -0x30(%rbp), %rdi
callq 0x2160
addq $0x90, %rsp
popq %rbp
retq
leaq -0x30(%rbp), %rdi
callq 0x2160
movq -0x38(%rbp), %rdi
callq 0x2390
nopl (%rax)