// File: fondoger[P]C0-Compiler/src/grammar.cpp
// Function: pLocalVariableDefinitions()
static void pLocalVariableDefinitions()
{
    while (g_sym == INTSY || g_sym == CHARSY) {
        DataType dtype = (g_sym == INTSY ? DT_INT : DT_CHAR);
        std::string type_str = (dtype == DT_INT ? "int" : "char");
        while (true) {
            // g_sym always points to the one before idnetifier
            readSymbol(); // skip comma or INTSY or CHARSY
            test3(Symset({IDENTSY}));
            std::string id = g_id;
            readSymbol(); // skip identifier
            if (g_sym == LBRACK) {      // array definition
                readSymbol(); // skip left bracket
                test3(Symset({INTVALUE}));
                int array_size = g_num;
                TabEntry entry = { LOCAL, IT_ARRAY, dtype, array_size, -1 };
                tabInsert(id, entry);
                genMidCode(VAR, type_str, id, std::to_string(array_size));
                readSymbol(); // skip size number
                test3(Symset({RBRACK}));
                readSymbol();
            } else {                    // normal variable definition
                TabEntry entry = { LOCAL, IT_VARIABLE, dtype, -1, -1 };
                tabInsert(id, entry);
                genMidCode(VAR, type_str, id, NONE);
            }
            if (g_sym != COMMA) {
                break;
            }
        }
        test3(Symset({SEMICOLON}));
        readSymbol();
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x250, %rsp            # imm = 0x250
movb $0x1, %al
leaq 0x2fb1c(%rip), %rcx     # 0x4b6b0
cmpl $0x2, (%rcx)
movb %al, -0x22d(%rbp)
je 0x1bbb2
leaq 0x2fb0a(%rip), %rax     # 0x4b6b0
cmpl $0x3, (%rax)
sete %al
movb %al, -0x22d(%rbp)
movb -0x22d(%rbp), %al
testb $0x1, %al
jne 0x1bbc1
jmp 0x1c29d
leaq 0x2fae8(%rip), %rax     # 0x4b6b0
movl (%rax), %eax
subl $0x2, %eax
setne %al
movzbl %al, %eax
incl %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
subl $0x1, %eax
leaq 0x19bc4(%rip), %rcx     # 0x357a9
leaq 0x194c7(%rip), %rax     # 0x350b3
cmoveq %rcx, %rax
movq %rax, -0x240(%rbp)
leaq -0x29(%rbp), %rdi
movq %rdi, -0x238(%rbp)
callq 0x3570
movq -0x240(%rbp), %rsi
movq -0x238(%rbp), %rdx
leaq -0x28(%rbp), %rdi
callq 0x3440
jmp 0x1bc20
leaq -0x29(%rbp), %rdi
callq 0x3370
jmp 0x1bc2b
callq 0x2e050
jmp 0x1bc32
jmp 0x1bc34
movl $0x0, -0x5c(%rbp)
leaq -0x5c(%rbp), %rax
movq %rax, -0x58(%rbp)
movq $0x1, -0x50(%rbp)
movq -0x58(%rbp), %rsi
movq -0x50(%rbp), %rdx
leaq -0x48(%rbp), %rdi
callq 0x227f0
jmp 0x1bc5e
movl $0x22, -0x80(%rbp)
movl $0x26, -0x7c(%rbp)
leaq -0x80(%rbp), %rax
movq %rax, -0x78(%rbp)
movq $0x2, -0x70(%rbp)
movq -0x78(%rbp), %rsi
movq -0x70(%rbp), %rdx
leaq -0x68(%rbp), %rdi
callq 0x227f0
jmp 0x1bc8f
movq -0x48(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0x18170
jmp 0x1bc9e
movl $0x0, -0x9c(%rbp)
leaq -0x9c(%rbp), %rax
movq %rax, -0x98(%rbp)
movq $0x1, -0x90(%rbp)
movq -0x98(%rbp), %rsi
movq -0x90(%rbp), %rdx
leaq -0x88(%rbp), %rdi
callq 0x227f0
jmp 0x1bcdd
leaq 0x2f9cc(%rip), %rax     # 0x4b6b0
movl (%rax), %esi
leaq -0x88(%rbp), %rdi
callq 0x18b40
xorb $-0x1, %al
testb $0x1, %al
jne 0x1bcfa
jmp 0x1bd3b
callq 0x2e050
jmp 0x1bd01
movl $0x1, -0xa0(%rbp)
jmp 0x1c276
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x29(%rbp), %rdi
callq 0x3370
jmp 0x1c2a6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x1c292
jmp 0x1bd3d
jmp 0x1bd3f
leaq 0x2f972(%rip), %rsi     # 0x4b6b8
leaq -0xc0(%rbp), %rdi
callq 0x3140
jmp 0x1bd54
callq 0x2e050
jmp 0x1bd5b
leaq 0x2f94e(%rip), %rax     # 0x4b6b0
cmpl $0x1f, (%rax)
jne 0x1c07b
callq 0x2e050
jmp 0x1bd72
jmp 0x1bd74
movl $0x11, -0xdc(%rbp)
leaq -0xdc(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq $0x1, -0xd0(%rbp)
movq -0xd8(%rbp), %rsi
movq -0xd0(%rbp), %rdx
leaq -0xc8(%rbp), %rdi
callq 0x227f0
jmp 0x1bdb3
movl $0x22, -0x100(%rbp)
movl $0x26, -0xfc(%rbp)
leaq -0x100(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq $0x2, -0xf0(%rbp)
movq -0xf8(%rbp), %rsi
movq -0xf0(%rbp), %rdx
leaq -0xe8(%rbp), %rdi
callq 0x227f0
jmp 0x1bdfc
movq -0xc8(%rbp), %rdi
movq -0xe8(%rbp), %rsi
callq 0x18170
jmp 0x1be11
movl $0x11, -0x11c(%rbp)
leaq -0x11c(%rbp), %rax
movq %rax, -0x118(%rbp)
movq $0x1, -0x110(%rbp)
movq -0x118(%rbp), %rsi
movq -0x110(%rbp), %rdx
leaq -0x108(%rbp), %rdi
callq 0x227f0
jmp 0x1be50
leaq 0x2f859(%rip), %rax     # 0x4b6b0
movl (%rax), %esi
leaq -0x108(%rbp), %rdi
callq 0x18b40
xorb $-0x1, %al
testb $0x1, %al
jne 0x1be6d
jmp 0x1be94
callq 0x2e050
jmp 0x1be74
movl $0x1, -0xa0(%rbp)
jmp 0x1c10f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
jmp 0x1c142
jmp 0x1be96
jmp 0x1be98
leaq 0x2f83d(%rip), %rax     # 0x4b6dc
movl (%rax), %eax
movl %eax, -0x120(%rbp)
movl $0x1, -0x134(%rbp)
movl $0x3, -0x130(%rbp)
movl -0x4(%rbp), %eax
movl %eax, -0x12c(%rbp)
movl -0x120(%rbp), %eax
movl %eax, -0x128(%rbp)
movl $0xffffffff, -0x124(%rbp) # imm = 0xFFFFFFFF
leaq -0xc0(%rbp), %rdi
leaq -0x134(%rbp), %rsi
callq 0x2f430
jmp 0x1beef
movl $0x8, -0x138(%rbp)
movl -0x120(%rbp), %esi
leaq -0x158(%rbp), %rdi
callq 0x22950
jmp 0x1bf0d
leaq -0x138(%rbp), %rdi
leaq -0x28(%rbp), %rsi
leaq -0xc0(%rbp), %rdx
leaq -0x158(%rbp), %rcx
callq 0x26340
jmp 0x1bf2d
leaq -0x158(%rbp), %rdi
callq 0x35e8
callq 0x2e050
jmp 0x1bf40
jmp 0x1bf42
movl $0x20, -0x174(%rbp)
leaq -0x174(%rbp), %rax
movq %rax, -0x170(%rbp)
movq $0x1, -0x168(%rbp)
movq -0x170(%rbp), %rsi
movq -0x168(%rbp), %rdx
leaq -0x160(%rbp), %rdi
callq 0x227f0
jmp 0x1bf81
movl $0x22, -0x198(%rbp)
movl $0x26, -0x194(%rbp)
leaq -0x198(%rbp), %rax
movq %rax, -0x190(%rbp)
movq $0x2, -0x188(%rbp)
movq -0x190(%rbp), %rsi
movq -0x188(%rbp), %rdx
leaq -0x180(%rbp), %rdi
callq 0x227f0
jmp 0x1bfca
movq -0x160(%rbp), %rdi
movq -0x180(%rbp), %rsi
callq 0x18170
jmp 0x1bfdf
movl $0x20, -0x1b4(%rbp)
leaq -0x1b4(%rbp), %rax
movq %rax, -0x1b0(%rbp)
movq $0x1, -0x1a8(%rbp)
movq -0x1b0(%rbp), %rsi
movq -0x1a8(%rbp), %rdx
leaq -0x1a0(%rbp), %rdi
callq 0x227f0
jmp 0x1c01e
leaq 0x2f68b(%rip), %rax     # 0x4b6b0
movl (%rax), %esi
leaq -0x1a0(%rbp), %rdi
callq 0x18b40
xorb $-0x1, %al
testb $0x1, %al
jne 0x1c03b
jmp 0x1c06e
callq 0x2e050
jmp 0x1c042
movl $0x1, -0xa0(%rbp)
jmp 0x1c10f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x35e8
jmp 0x1c142
jmp 0x1c070
jmp 0x1c072
callq 0x2e050
jmp 0x1c079
jmp 0x1c0ed
movl $0x1, -0x1c8(%rbp)
movl $0x1, -0x1c4(%rbp)
movl -0x4(%rbp), %eax
movl %eax, -0x1c0(%rbp)
movl $0xffffffff, -0x1bc(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x1b8(%rbp) # imm = 0xFFFFFFFF
leaq -0xc0(%rbp), %rdi
leaq -0x1c8(%rbp), %rsi
callq 0x2f430
jmp 0x1c0c1
movl $0x8, -0x1cc(%rbp)
leaq 0x2af2e(%rip), %rcx     # 0x47000
leaq -0x1cc(%rbp), %rdi
leaq -0x28(%rbp), %rsi
leaq -0xc0(%rbp), %rdx
callq 0x26340
jmp 0x1c0eb
jmp 0x1c0ed
leaq 0x2f5bc(%rip), %rax     # 0x4b6b0
cmpl $0x24, (%rax)
je 0x1c105
movl $0x5, -0xa0(%rbp)
jmp 0x1c10f
movl $0x0, -0xa0(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x35e8
movl -0xa0(%rbp), %eax
movl %eax, -0x244(%rbp)
testl %eax, %eax
je 0x1c13d
jmp 0x1c12d
movl -0x244(%rbp), %eax
subl $0x5, %eax
je 0x1c153
jmp 0x1c276
jmp 0x1bc29
leaq -0xc0(%rbp), %rdi
callq 0x35e8
jmp 0x1c292
jmp 0x1c155
movl $0x26, -0x1ec(%rbp)
leaq -0x1ec(%rbp), %rax
movq %rax, -0x1e8(%rbp)
movq $0x1, -0x1e0(%rbp)
movq -0x1e8(%rbp), %rsi
movq -0x1e0(%rbp), %rdx
leaq -0x1d8(%rbp), %rdi
callq 0x227f0
jmp 0x1c194
movl $0x22, -0x210(%rbp)
movl $0x26, -0x20c(%rbp)
leaq -0x210(%rbp), %rax
movq %rax, -0x208(%rbp)
movq $0x2, -0x200(%rbp)
movq -0x208(%rbp), %rsi
movq -0x200(%rbp), %rdx
leaq -0x1f8(%rbp), %rdi
callq 0x227f0
jmp 0x1c1dd
movq -0x1d8(%rbp), %rdi
movq -0x1f8(%rbp), %rsi
callq 0x18170
jmp 0x1c1f2
movl $0x26, -0x22c(%rbp)
leaq -0x22c(%rbp), %rax
movq %rax, -0x228(%rbp)
movq $0x1, -0x220(%rbp)
movq -0x228(%rbp), %rsi
movq -0x220(%rbp), %rdx
leaq -0x218(%rbp), %rdi
callq 0x227f0
jmp 0x1c231
leaq 0x2f478(%rip), %rax     # 0x4b6b0
movl (%rax), %esi
leaq -0x218(%rbp), %rdi
callq 0x18b40
xorb $-0x1, %al
testb $0x1, %al
jne 0x1c24e
jmp 0x1c261
callq 0x2e050
jmp 0x1c255
movl $0x1, -0xa0(%rbp)
jmp 0x1c276
jmp 0x1c263
jmp 0x1c265
callq 0x2e050
jmp 0x1c26c
movl $0x0, -0xa0(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x35e8
movl -0xa0(%rbp), %eax
testl %eax, %eax
je 0x1c28d
jmp 0x1c28b
jmp 0x1c29d
jmp 0x1bb8b
leaq -0x28(%rbp), %rdi
callq 0x35e8
jmp 0x1c2a6
addq $0x250, %rsp            # imm = 0x250
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x3560
nop