// File: /workspace/github_c_makefile_star2_O2/chgzm[P]minic/generator.c
// Function: process_postfix_expr_left
static void process_postfix_expr_left(const PostfixExprNode* node) {
    switch (node->postfix_expr_type) {
    // primary-expression
    case PS_PRIMARY: {
        process_primary_expr_left(node->primary_expr_node);
        break;
    }
    // postfix-expression [ expression ]
    case PS_LSQUARE: {
        process_postfix_expr_left(node->postfix_expr_node);

        Type* type1 = stack_top(type_stack);
        stack_pop(type_stack);

        process_expr(node->expr_node);

        printf("  pop rdi\n");
        printf("  pop rax\n");
        if (type1->array_size) {
            if (type1->ptr_count > 0) {
                printf("  imul rdi, 8\n");
                printf("  mov rax, [rax]\n");
            } else {
                printf("  imul rdi, %d\n", type1->type_size);
            }
        } else {
            if (type1->ptr_count > 1) {
                printf("  imul rdi, 8\n");
                printf("  mov rax, [rax]\n");
            } else {
                printf("  imul rdi, %d\n", type1->type_size);
                printf("  mov rax, [rax]\n");
            }
        }

        printf("  add rax, rdi\n");
        printf("  push rax\n");

        stack_push(type_stack, type1);
        break;
    }
    // postfix-expression . identifier
    case PS_DOT: {
        process_postfix_expr_left(node->postfix_expr_node);

        Type* type2 = stack_top(type_stack);
        stack_pop(type_stack);

        const FieldInfo* field_info1 = strptrmap_get(type2->struct_info->field_info_map, node->identifier);

        printf("  pop rax\n");
        printf("  add rax, %d\n", field_info1->offset);
        printf("  push rax\n");

        break;        
    }
    // postfix-expression -> identifier
    case PS_ARROW: {
        process_postfix_expr_left(node->postfix_expr_node);

        Type* type3 = stack_top(type_stack);
        stack_pop(type_stack);

        const FieldInfo* field_info2 = strptrmap_get(type3->struct_info->field_info_map, node->identifier);
        stack_push(type_stack, field_info2->type);

        printf("  pop rax\n");
        printf("  mov rax, [rax]\n");
        printf("  add rax, %d\n", field_info2->offset);
        printf("  push rax\n");

        break;        
    }
    // postfix-expression ++
    case PS_INC: {
        process_postfix_expr_left(node->postfix_expr_node);
        printf("  pop rax\n");
        printf("  mov rdi, [rax]\n");
        printf("  push rdi\n");
        printf("  push 1\n");
        printf("  pop rdi\n");
        printf("  add [rax], rdi\n");
        break;                       
    }
    // postfix-expression --
    case PS_DEC: {
        process_postfix_expr_left(node->postfix_expr_node);
        printf("  pop rax\n");
        printf("  mov rdi, [rax]\n");
        printf("  push rdi\n");
        printf("  push 1\n");
        printf("  pop rdi\n");
        printf("  sub [rax], rdi\n");
        break;                       
    }
    default: {
        // @todo
        break;
    }
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl 0x28(%rdi), %eax
cmpq $0x6, %rax
ja 0x47c3
movq %rdi, %r14
leaq 0x506a(%rip), %rcx      # 0x9564
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq (%r14), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x46f2
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x4819
movq 0x8(%r14), %rdi
callq 0x44df
movq 0x9bda(%rip), %rdi      # 0xe108
callq 0x8227
movq %rax, %rbx
movq 0x9bcb(%rip), %rdi      # 0xe108
callq 0x823b
movq 0x18(%rbx), %rax
movq (%rax), %rdi
movq 0x20(%r14), %rsi
callq 0x8412
movq %rax, %rbx
leaq 0x53f3(%rip), %rdi      # 0x994f
jmp 0x467b
movq 0x8(%r14), %rdi
callq 0x44df
leaq 0x53de(%rip), %rdi      # 0x994f
callq 0x1070
leaq 0x5322(%rip), %rdi      # 0x989f
callq 0x1070
leaq 0x5327(%rip), %rdi      # 0x98b0
callq 0x1070
leaq 0x5326(%rip), %rdi      # 0x98bb
callq 0x1070
leaq 0x538a(%rip), %rdi      # 0x992b
callq 0x1070
leaq 0x52e1(%rip), %rdi      # 0x988e
jmp 0x46e6
movq 0x8(%r14), %rdi
callq 0x44df
movq 0x9b46(%rip), %rdi      # 0xe108
callq 0x8227
movq %rax, %rbx
movq 0x9b37(%rip), %rdi      # 0xe108
callq 0x823b
movq 0x10(%r14), %rdi
callq 0x3919
leaq 0x5345(%rip), %rdi      # 0x992b
callq 0x1070
leaq 0x535d(%rip), %rdi      # 0x994f
callq 0x1070
cmpl $0x0, 0xc(%rbx)
movl 0x10(%rbx), %eax
je 0x4739
testl %eax, %eax
jg 0x473e
movl 0x4(%rbx), %esi
leaq 0x506c(%rip), %rdi      # 0x9682
xorl %eax, %eax
callq 0x10a0
jmp 0x4769
movq 0x8(%r14), %rdi
callq 0x44df
movq 0x9ad6(%rip), %rdi      # 0xe108
callq 0x8227
movq %rax, %rbx
movq 0x9ac7(%rip), %rdi      # 0xe108
callq 0x823b
movq 0x18(%rbx), %rax
movq (%rax), %rdi
movq 0x20(%r14), %rsi
callq 0x8412
movq %rax, %rbx
movq 0x9aa8(%rip), %rdi      # 0xe108
movq (%rax), %rsi
callq 0x81e3
leaq 0x52e0(%rip), %rdi      # 0x994f
callq 0x1070
leaq 0x5283(%rip), %rdi      # 0x98fe
callq 0x1070
movl 0x8(%rbx), %esi
leaq 0x5008(%rip), %rdi      # 0x9692
xorl %eax, %eax
callq 0x10a0
leaq 0x529d(%rip), %rdi      # 0x9935
jmp 0x46e6
movq 0x8(%r14), %rdi
callq 0x44df
leaq 0x52a5(%rip), %rdi      # 0x994f
callq 0x1070
leaq 0x51e9(%rip), %rdi      # 0x989f
callq 0x1070
leaq 0x51ee(%rip), %rdi      # 0x98b0
callq 0x1070
leaq 0x51ed(%rip), %rdi      # 0x98bb
callq 0x1070
leaq 0x5251(%rip), %rdi      # 0x992b
callq 0x1070
leaq 0x51de(%rip), %rdi      # 0x98c4
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x1070
movq 0x8(%rax), %rcx
testq %rcx, %rcx
je 0x4797
movq (%rcx), %rax
movq (%rax), %rax
movq (%rax), %rax
movq (%rax), %rax
movq (%rax), %rax
movq (%rax), %rax
movq (%rax), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movq 0x8(%rax), %rax
movq (%rax), %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x38a4
cmpl $0x2, %eax
jl 0x474c
leaq 0x5190(%rip), %rdi      # 0x98d5
callq 0x1070
jmp 0x475d
movl 0x4(%rbx), %esi
leaq 0x4f2c(%rip), %rdi      # 0x9682
xorl %eax, %eax
callq 0x10a0
leaq 0x519a(%rip), %rdi      # 0x98fe
callq 0x1070
leaq 0x5173(%rip), %rdi      # 0x98e3
callq 0x1070
leaq 0x51b9(%rip), %rdi      # 0x9935
callq 0x1070
movq 0x9980(%rip), %rdi      # 0xe108
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x81e3
movq 0x18(%rax), %r14
testq %r14, %r14
je 0x47c3
movq %r14, %rdi
callq 0x4449
testq %rax, %rax
je 0x47cb
movq %rax, %rbx
movl 0x14(%rax), %esi
leaq 0x4e6a(%rip), %rdi      # 0x9624
xorl %eax, %eax
callq 0x10a0
jmp 0x47e8
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %r14, %rdi
callq 0x4494
movq %rax, %rbx
movq 0x8(%rax), %rsi
leaq 0x4ec0(%rip), %rdi      # 0x96a1
xorl %eax, %eax
callq 0x10a0
leaq 0x5146(%rip), %rdi      # 0x9935
callq 0x1070
movq 0x990d(%rip), %rdi      # 0xe108
movq (%rbx), %rsi
callq 0x81e3
movq 0x990e(%rip), %rdi      # 0xe118
pushq $0x8
popq %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x8269