// File: /workspace/github_cpp_makefile_star2_O3/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 0x181a8(%rip), %r15     # 0x29630
cmpl $0x1f, (%r15)
jne 0x11794
movq %rdi, %rbx
leaq -0x94(%rbp), %rsi
callq 0x1a77d
testb %al, %al
je 0x116fa
cmpl $0x3, -0x90(%rbp)
jne 0x11733
callq 0x19d18
leaq -0xa8(%rbp), %r14
movq %r14, -0x10(%r14)
movq $0x0, -0x8(%r14)
movb $0x0, (%r14)
leaq -0xb8(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x11c82
cmpl $0x1, -0x40(%rbp)
je 0x1152b
leaq -0x108(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0xb0e2(%rip), %rsi      # 0x1c5dd
leaq 0xb0fb(%rip), %rdx      # 0x1c5fd
leaq -0x118(%rbp), %rdi
callq 0x14396
leaq -0x118(%rbp), %rdi
callq 0xdccb
movq -0x118(%rbp), %rdi
cmpq %r12, %rdi
je 0x1152b
callq 0x32a0
leaq -0xb8(%rbp), %rdi
leaq -0x3c(%rbp), %rsi
callq 0x163ae
testb %al, %al
je 0x11591
movl -0x3c(%rbp), %eax
testl %eax, %eax
js 0x1154e
cmpl -0x88(%rbp), %eax
jl 0x11591
leaq -0xe8(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0xb09d(%rip), %rsi      # 0x1c5fe
leaq 0xb0aa(%rip), %rdx      # 0x1c612
leaq -0xf8(%rbp), %rdi
callq 0x14396
leaq -0xf8(%rbp), %rdi
callq 0xdccb
movq -0xf8(%rbp), %rdi
cmpq %r12, %rdi
je 0x11591
callq 0x32a0
callq 0x19d18
leaq -0x30(%rbp), %rsi
movl $0x23, (%rsi)
leaq -0x80(%rbp), %rdi
movl $0x1, %edx
callq 0x13dee
movabsq $0x2600000022, %r12     # imm = 0x2600000022
leaq -0x70(%rbp), %rsi
movq %r12, (%rsi)
leaq -0x78(%rbp), %rdi
movl $0x2, %edx
callq 0x13dee
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 0x13dee
movq -0x70(%rbp), %rax
movl (%r15), %ecx
btq %rcx, %rax
jae 0x1176c
callq 0x19d18
leaq -0x60(%rbp), %r15
movq %r15, -0x10(%r15)
movq $0x0, -0x8(%r15)
movb $0x0, (%r15)
leaq -0x70(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x11c82
movl -0x38(%rbp), %eax
cmpl -0x8c(%rbp), %eax
je 0x11676
leaq -0xc8(%rbp), %r13
movq %r13, -0x10(%r13)
leaq 0xad94(%rip), %rsi      # 0x1c3da
leaq 0xad9b(%rip), %rdx      # 0x1c3e8
leaq -0xd8(%rbp), %rdi
callq 0x14396
leaq -0xd8(%rbp), %rdi
callq 0xdccb
movq -0xd8(%rbp), %rdi
cmpq %r13, %rdi
je 0x11676
callq 0x32a0
leaq -0x30(%rbp), %rdi
movl $0xd, (%rdi)
leaq -0xb8(%rbp), %rdx
leaq -0x70(%rbp), %rcx
movq %rbx, %rsi
callq 0x150ec
leaq -0x34(%rbp), %rsi
movl $0x26, (%rsi)
leaq -0x50(%rbp), %rdi
movl $0x1, %edx
callq 0x13dee
leaq -0x30(%rbp), %rsi
movq %r12, (%rsi)
leaq -0x48(%rbp), %rdi
movl $0x2, %edx
callq 0x13dee
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 0x13dee
callq 0x19d18
movq -0x70(%rbp), %rdi
cmpq %r15, %rdi
je 0x11771
callq 0x32a0
jmp 0x11771
leaq -0x148(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0xad0c(%rip), %rsi      # 0x1c418
leaq 0xad26(%rip), %rdx      # 0x1c439
leaq -0x158(%rbp), %rbx
movq %rbx, %rdi
callq 0x14396
movq %rbx, %rdi
callq 0xdccb
movq -0x158(%rbp), %rdi
jmp 0x11778
leaq -0x128(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0xb025(%rip), %rsi      # 0x1c76a
leaq 0xb04a(%rip), %rdx      # 0x1c796
leaq -0x138(%rbp), %rbx
movq %rbx, %rdi
callq 0x14396
movq %rbx, %rdi
callq 0xdccb
movq -0x138(%rbp), %rdi
jmp 0x11778
callq 0x19d18
movq -0xb8(%rbp), %rdi
cmpq %r14, %rdi
je 0x11782
callq 0x32a0
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xaf8b(%rip), %rdi      # 0x1c726
leaq 0xabe7(%rip), %rsi      # 0x1c389
leaq 0xaf8d(%rip), %rcx      # 0x1c736
movl $0x1eb, %edx            # imm = 0x1EB
callq 0x31b0
movq %rax, %rbx
movq -0xf8(%rbp), %rdi
jmp 0x117e3
jmp 0x11827
movq %rax, %rbx
movq -0xd8(%rbp), %rdi
cmpq %r13, %rdi
je 0x11809
callq 0x32a0
jmp 0x11809
jmp 0x11806
movq %rax, %rbx
movq -0x118(%rbp), %rdi
cmpq %r12, %rdi
jne 0x11812
jmp 0x1182a
jmp 0x11827
jmp 0x11806
jmp 0x11806
jmp 0x11806
jmp 0x11827
jmp 0x11827
movq %rax, %rbx
movq -0x138(%rbp), %rdi
jmp 0x11831
jmp 0x11827
jmp 0x11806
movq %rax, %rbx
movq -0x70(%rbp), %rdi
cmpq %r15, %rdi
je 0x1182a
callq 0x32a0
jmp 0x1182a
jmp 0x11827
movq %rax, %rbx
movq -0x158(%rbp), %rdi
jmp 0x11831
movq %rax, %rbx
movq -0xb8(%rbp), %rdi
cmpq %r14, %rdi
je 0x1183b
callq 0x32a0
movq %rbx, %rdi
callq 0x3480