// File: /workspace/github_cpp_makefile_star2_O1/fondoger[P]C0-Compiler/src/grammar.cpp
// Function: pArrayAssignmentStatement(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
static void pArrayAssignmentStatement(const std::string &id)
{
    TabEntry entry;

    assert(g_sym == LBRACK);
    if (!tabFind(id, entry)) {
        error(ERR_UNDEFINED_IDENTIFIER);
        return;
    }
    if (entry.itype != IT_ARRAY) {
        error(ERR_NOT_AN_ARRAY);
        return;
    }
    readSymbol(); // skip left bracket
    // handle index
    std::string index;    // index
    DataType index_dtype; // index's data type
    pExpression(index, index_dtype);
    if (index_dtype != DT_INT) {
        // array's index must be int type
        error(ERR_EXPECT_INT_ARRAY_INDEX);
    }
    // overflow check for const indexes
    int val;
    if (isConstValue(index, val) &&
        (val < 0 || val >= entry.value)) {
        error(ERR_ARRAY_INDEX_OVERFLOW);
    }
    readSymbol(); // skip right bracket
    test3(Symset({ BECOMES }));
    readSymbol(); // skip = 
    // handle right value
    std::string rvalue;
    DataType rvalue_dtype;
    pExpression(rvalue, rvalue_dtype);
    if (rvalue_dtype != entry.dtype) {
        error(ERR_TYPE_NOT_MATCH);
    }
    // generate middle code
    genMidCode(WARRAY, id, index, rvalue);
    test3(Symset({ SEMICOLON }));
    readSymbol();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
leaq 0x180e3(%rip), %r15     # 0x29630
cmpl $0x1f, (%r15)
jne 0x11859
movq %rdi, %rbx
leaq -0x94(%rbp), %rsi
callq 0x1a8c5
testb %al, %al
je 0x117bf
cmpl $0x3, -0x90(%rbp)
jne 0x117f8
callq 0x19e44
leaq -0xa8(%rbp), %r14
movq %r14, -0x10(%r14)
movq $0x0, -0x8(%r14)
movb $0x0, (%r14)
leaq -0xb8(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x11d47
cmpl $0x1, -0x40(%rbp)
je 0x115f0
leaq -0x108(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0xb062(%rip), %rsi      # 0x1c622
leaq 0xb07b(%rip), %rdx      # 0x1c642
leaq -0x118(%rbp), %rdi
callq 0x14454
leaq -0x118(%rbp), %rdi
callq 0xdcc8
movq -0x118(%rbp), %rdi
cmpq %r12, %rdi
je 0x115f0
callq 0x32a0
leaq -0xb8(%rbp), %rdi
leaq -0x3c(%rbp), %rsi
callq 0x16448
testb %al, %al
je 0x11656
movl -0x3c(%rbp), %eax
testl %eax, %eax
js 0x11613
cmpl -0x88(%rbp), %eax
jl 0x11656
leaq -0xe8(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0xb01d(%rip), %rsi      # 0x1c643
leaq 0xb02a(%rip), %rdx      # 0x1c657
leaq -0xf8(%rbp), %rdi
callq 0x14454
leaq -0xf8(%rbp), %rdi
callq 0xdcc8
movq -0xf8(%rbp), %rdi
cmpq %r12, %rdi
je 0x11656
callq 0x32a0
callq 0x19e44
leaq -0x30(%rbp), %rsi
movl $0x23, (%rsi)
leaq -0x80(%rbp), %rdi
movl $0x1, %edx
callq 0x13eac
movabsq $0x2600000022, %r12     # imm = 0x2600000022
leaq -0x70(%rbp), %rsi
movq %r12, (%rsi)
leaq -0x78(%rbp), %rdi
movl $0x2, %edx
callq 0x13eac
movq -0x80(%rbp), %rdi
movq -0x78(%rbp), %rsi
callq 0xd8a2
leaq -0x30(%rbp), %rsi
movl $0x23, (%rsi)
leaq -0x70(%rbp), %rdi
movl $0x1, %edx
callq 0x13eac
movq -0x70(%rbp), %rax
movl (%r15), %ecx
btq %rcx, %rax
jae 0x11831
callq 0x19e44
leaq -0x60(%rbp), %r15
movq %r15, -0x10(%r15)
movq $0x0, -0x8(%r15)
movb $0x0, (%r15)
leaq -0x70(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x11d47
movl -0x38(%rbp), %eax
cmpl -0x8c(%rbp), %eax
je 0x1173b
leaq -0xc8(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0xad14(%rip), %rsi      # 0x1c41f
leaq 0xad1b(%rip), %rdx      # 0x1c42d
leaq -0xd8(%rbp), %rdi
callq 0x14454
leaq -0xd8(%rbp), %rdi
callq 0xdcc8
movq -0xd8(%rbp), %rdi
cmpq %r13, %rdi
je 0x1173b
callq 0x32a0
leaq -0x30(%rbp), %rdi
movl $0xd, (%rdi)
leaq -0xb8(%rbp), %rdx
leaq -0x70(%rbp), %rcx
movq %rbx, %rsi
callq 0x151b0
leaq -0x34(%rbp), %rsi
movl $0x26, (%rsi)
leaq -0x50(%rbp), %rdi
movl $0x1, %edx
callq 0x13eac
leaq -0x30(%rbp), %rsi
movq %r12, (%rsi)
leaq -0x48(%rbp), %rdi
movl $0x2, %edx
callq 0x13eac
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0xd8a2
leaq -0x34(%rbp), %rsi
movl $0x26, (%rsi)
leaq -0x30(%rbp), %rdi
movl $0x1, %edx
callq 0x13eac
callq 0x19e44
movq -0x70(%rbp), %rdi
cmpq %r15, %rdi
je 0x11836
callq 0x32a0
jmp 0x11836
leaq -0x148(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0xac8c(%rip), %rsi      # 0x1c45d
leaq 0xaca6(%rip), %rdx      # 0x1c47e
leaq -0x158(%rbp), %rbx
movq %rbx, %rdi
callq 0x14454
movq %rbx, %rdi
callq 0xdcc8
movq -0x158(%rbp), %rdi
jmp 0x1183d
leaq -0x128(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0xafa5(%rip), %rsi      # 0x1c7af
leaq 0xafca(%rip), %rdx      # 0x1c7db
leaq -0x138(%rbp), %rbx
movq %rbx, %rdi
callq 0x14454
movq %rbx, %rdi
callq 0xdcc8
movq -0x138(%rbp), %rdi
jmp 0x1183d
callq 0x19e44
movq -0xb8(%rbp), %rdi
cmpq %r14, %rdi
je 0x11847
callq 0x32a0
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xaf0b(%rip), %rdi      # 0x1c76b
leaq 0xab22(%rip), %rsi      # 0x1c389
leaq 0xaf0d(%rip), %rcx      # 0x1c77b
movl $0x1eb, %edx            # imm = 0x1EB
callq 0x31b0
movq %rax, %rbx
movq -0xf8(%rbp), %rdi
jmp 0x118a8
jmp 0x118ec
movq %rax, %rbx
movq -0xd8(%rbp), %rdi
cmpq %r13, %rdi
je 0x118ce
callq 0x32a0
jmp 0x118ce
jmp 0x118cb
movq %rax, %rbx
movq -0x118(%rbp), %rdi
cmpq %r12, %rdi
jne 0x118d7
jmp 0x118ef
jmp 0x118ec
jmp 0x118cb
jmp 0x118cb
jmp 0x118cb
jmp 0x118ec
jmp 0x118ec
movq %rax, %rbx
movq -0x138(%rbp), %rdi
jmp 0x118f6
jmp 0x118ec
jmp 0x118cb
movq %rax, %rbx
movq -0x70(%rbp), %rdi
cmpq %r15, %rdi
je 0x118ef
callq 0x32a0
jmp 0x118ef
jmp 0x118ec
movq %rax, %rbx
movq -0x158(%rbp), %rdi
jmp 0x118f6
movq %rax, %rbx
movq -0xb8(%rbp), %rdi
cmpq %r14, %rdi
je 0x11900
callq 0x32a0
movq %rbx, %rdi
callq 0x3480