// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl 0x28(%rax), %eax
movq %rax, -0x38(%rbp)
subq $0x6, %rax
ja 0x60bc
movq -0x38(%rbp), %rax
leaq 0x97dc(%rip), %rcx      # 0xf588
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x8(%rbp), %rax
movq (%rax), %rdi
callq 0x6380
jmp 0x60be
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x5d80
movq 0xf356(%rip), %rdi      # 0x15130
callq 0xe760
movq %rax, -0x10(%rbp)
movq 0xf346(%rip), %rdi      # 0x15130
callq 0xe7a0
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x4c20
leaq 0x98d6(%rip), %rdi      # 0xf6d9
movb $0x0, %al
callq 0x1090
leaq 0x98d3(%rip), %rdi      # 0xf6e4
movb $0x0, %al
callq 0x1090
movq -0x10(%rbp), %rax
cmpl $0x0, 0xc(%rax)
je 0x5e61
movq -0x10(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jle 0x5e4a
leaq 0x9ae6(%rip), %rdi      # 0xf919
movb $0x0, %al
callq 0x1090
leaq 0x9a93(%rip), %rdi      # 0xf8d4
movb $0x0, %al
callq 0x1090
jmp 0x5e5f
movq -0x10(%rbp), %rax
movl 0x4(%rax), %esi
leaq 0x9ad0(%rip), %rdi      # 0xf928
movb $0x0, %al
callq 0x1090
jmp 0x5eae
movq -0x10(%rbp), %rax
cmpl $0x1, 0x10(%rax)
jle 0x5e89
leaq 0x9aa7(%rip), %rdi      # 0xf919
movb $0x0, %al
callq 0x1090
leaq 0x9a54(%rip), %rdi      # 0xf8d4
movb $0x0, %al
callq 0x1090
jmp 0x5eac
movq -0x10(%rbp), %rax
movl 0x4(%rax), %esi
leaq 0x9a91(%rip), %rdi      # 0xf928
movb $0x0, %al
callq 0x1090
leaq 0x9a2f(%rip), %rdi      # 0xf8d4
movb $0x0, %al
callq 0x1090
jmp 0x5eae
leaq 0x99b4(%rip), %rdi      # 0xf869
movb $0x0, %al
callq 0x1090
leaq 0x980a(%rip), %rdi      # 0xf6cd
movb $0x0, %al
callq 0x1090
movq 0xf25f(%rip), %rdi      # 0x15130
movq -0x10(%rbp), %rsi
callq 0xe6e0
jmp 0x60be
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x5d80
movq 0xf23d(%rip), %rdi      # 0x15130
callq 0xe760
movq %rax, -0x18(%rbp)
movq 0xf22d(%rip), %rdi      # 0x15130
callq 0xe7a0
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
callq 0xeb80
movq %rax, -0x20(%rbp)
leaq 0x97b9(%rip), %rdi      # 0xf6e4
movb $0x0, %al
callq 0x1090
movq -0x20(%rbp), %rax
movl 0x8(%rax), %esi
leaq 0x9a15(%rip), %rdi      # 0xf955
movb $0x0, %al
callq 0x1090
leaq 0x977f(%rip), %rdi      # 0xf6cd
movb $0x0, %al
callq 0x1090
jmp 0x60be
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x5d80
movq 0xf1c2(%rip), %rdi      # 0x15130
callq 0xe760
movq %rax, -0x28(%rbp)
movq 0xf1b2(%rip), %rdi      # 0x15130
callq 0xe7a0
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x20(%rax), %rsi
callq 0xeb80
movq %rax, -0x30(%rbp)
movq 0xf18a(%rip), %rdi      # 0x15130
movq -0x30(%rbp), %rax
movq (%rax), %rsi
callq 0xe6e0
leaq 0x972b(%rip), %rdi      # 0xf6e4
movb $0x0, %al
callq 0x1090
leaq 0x990d(%rip), %rdi      # 0xf8d4
movb $0x0, %al
callq 0x1090
movq -0x30(%rbp), %rax
movl 0x8(%rax), %esi
leaq 0x9979(%rip), %rdi      # 0xf955
movb $0x0, %al
callq 0x1090
leaq 0x96e3(%rip), %rdi      # 0xf6cd
movb $0x0, %al
callq 0x1090
jmp 0x60be
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x5d80
leaq 0x96da(%rip), %rdi      # 0xf6e4
movb $0x0, %al
callq 0x1090
leaq 0x988e(%rip), %rdi      # 0xf8a6
movb $0x0, %al
callq 0x1090
leaq 0x994c(%rip), %rdi      # 0xf972
movb $0x0, %al
callq 0x1090
leaq 0x97bb(%rip), %rdi      # 0xf7ef
movb $0x0, %al
callq 0x1090
leaq 0x9697(%rip), %rdi      # 0xf6d9
movb $0x0, %al
callq 0x1090
leaq 0x974b(%rip), %rdi      # 0xf79b
movb $0x0, %al
callq 0x1090
jmp 0x60be
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x5d80
leaq 0x9677(%rip), %rdi      # 0xf6e4
movb $0x0, %al
callq 0x1090
leaq 0x982b(%rip), %rdi      # 0xf8a6
movb $0x0, %al
callq 0x1090
leaq 0x98e9(%rip), %rdi      # 0xf972
movb $0x0, %al
callq 0x1090
leaq 0x9758(%rip), %rdi      # 0xf7ef
movb $0x0, %al
callq 0x1090
leaq 0x9634(%rip), %rdi      # 0xf6d9
movb $0x0, %al
callq 0x1090
leaq 0x96fa(%rip), %rdi      # 0xf7ad
movb $0x0, %al
callq 0x1090
jmp 0x60be
jmp 0x60be
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)