// File: /workspace/github_c_makefile_star2_O0/chgzm[P]minic/generator.c
// Function: process_assign_expr
static void process_assign_expr(const AssignExprNode* node) {
    // <conditional-expression>
    if (node->conditional_expr_node != NULL) {
        process_conditional_expr(node->conditional_expr_node);
    }
    // <unary-expression> <assignment-operator> <assignment-expression>
    else {
        process_unary_expr_left(node->unary_expr_node);
        process_assign_expr(node->assign_expr_node);

        switch (node->assign_operator) {
        case OP_ASSIGN: {
            printf("  pop rdi\n");
            printf("  pop rax\n");

            const int size = intstack_top(size_stack); 
            intstack_pop(size_stack);
            printf("  mov [rax], %s\n", get_reg("di", size));

            break;
        }
        case OP_MUL_EQ: {
            printf("  pop rdi\n");
            printf("  pop rax\n");
            printf("  mov rsi, [rax]\n");
            printf("  imul rdi, rsi\n");
            printf("  mov [rax], rdi\n");

            break;
        }
        case OP_DIV_EQ: {
            printf("  pop rdi\n");
            printf("  pop rsi\n");
            printf("  mov rax, [rsi]\n");
            printf("  cqo\n");
            printf("  idiv rdi\n");
            printf("  mov [rsi], rax\n");

            break;
        }
        case OP_MOD_EQ: {
            printf("  pop rdi\n");
            printf("  pop rsi\n");
            printf("  mov rax, [rsi]\n");
            printf("  cqo\n");
            printf("  idiv rdi\n");
            printf("  mov [rsi], rdx\n");

            break;
        }
        case OP_ADD_EQ: {
            printf("  pop rdi\n");
            printf("  pop rax\n");
            printf("  add [rax], rdi\n");

            break;
        }
        case OP_SUB_EQ: {
            printf("  pop rdi\n");
            printf("  pop rax\n");
            printf("  sub [rax], rdi\n");

            break;
        }
        case OP_AND_EQ:
        case OP_XOR_EQ:
        case OP_OR_EQ: {
            // @todo
            break;
        }
        default: {
            break;
        }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, (%rax)
je 0x45e7
movq -0x8(%rbp), %rax
movq (%rax), %rdi
callq 0x47f0
jmp 0x47e1
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x48c0
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x45c0
movq -0x8(%rbp), %rax
movl 0x18(%rax), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x18(%rbp)
subl $0x8, %eax
ja 0x47dd
movq -0x18(%rbp), %rax
leaq 0xaea0(%rip), %rcx      # 0xf4c4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0xb0a5(%rip), %rdi      # 0xf6d9
movb $0x0, %al
callq 0x1090
leaq 0xb0a2(%rip), %rdi      # 0xf6e4
movb $0x0, %al
callq 0x1090
movq 0x10af0(%rip), %rdi     # 0x15140
callq 0xe890
movl %eax, -0xc(%rbp)
movq 0x10ae1(%rip), %rdi     # 0x15140
callq 0xe8e0
movl -0xc(%rbp), %esi
leaq 0xb035(%rip), %rdi      # 0xf6a3
callq 0x4930
movq %rax, %rsi
leaq 0xb096(%rip), %rdi      # 0xf713
movb $0x0, %al
callq 0x1090
jmp 0x47df
leaq 0xb049(%rip), %rdi      # 0xf6d9
movb $0x0, %al
callq 0x1090
leaq 0xb046(%rip), %rdi      # 0xf6e4
movb $0x0, %al
callq 0x1090
leaq 0xb078(%rip), %rdi      # 0xf724
movb $0x0, %al
callq 0x1090
leaq 0xb07c(%rip), %rdi      # 0xf736
movb $0x0, %al
callq 0x1090
leaq 0xb039(%rip), %rdi      # 0xf701
movb $0x0, %al
callq 0x1090
jmp 0x47df
leaq 0xaffe(%rip), %rdi      # 0xf6d9
movb $0x0, %al
callq 0x1090
leaq 0xb05e(%rip), %rdi      # 0xf747
movb $0x0, %al
callq 0x1090
leaq 0xb05b(%rip), %rdi      # 0xf752
movb $0x0, %al
callq 0x1090
leaq 0xb05f(%rip), %rdi      # 0xf764
movb $0x0, %al
callq 0x1090
leaq 0xb058(%rip), %rdi      # 0xf76b
movb $0x0, %al
callq 0x1090
leaq 0xb056(%rip), %rdi      # 0xf777
movb $0x0, %al
callq 0x1090
jmp 0x47df
leaq 0xafa5(%rip), %rdi      # 0xf6d9
movb $0x0, %al
callq 0x1090
leaq 0xb005(%rip), %rdi      # 0xf747
movb $0x0, %al
callq 0x1090
leaq 0xb002(%rip), %rdi      # 0xf752
movb $0x0, %al
callq 0x1090
leaq 0xb006(%rip), %rdi      # 0xf764
movb $0x0, %al
callq 0x1090
leaq 0xafff(%rip), %rdi      # 0xf76b
movb $0x0, %al
callq 0x1090
leaq 0xb00f(%rip), %rdi      # 0xf789
movb $0x0, %al
callq 0x1090
jmp 0x47df
leaq 0xaf4f(%rip), %rdi      # 0xf6d9
movb $0x0, %al
callq 0x1090
leaq 0xaf4c(%rip), %rdi      # 0xf6e4
movb $0x0, %al
callq 0x1090
leaq 0xaff5(%rip), %rdi      # 0xf79b
movb $0x0, %al
callq 0x1090
jmp 0x47df
leaq 0xaf23(%rip), %rdi      # 0xf6d9
movb $0x0, %al
callq 0x1090
leaq 0xaf20(%rip), %rdi      # 0xf6e4
movb $0x0, %al
callq 0x1090
leaq 0xafdb(%rip), %rdi      # 0xf7ad
movb $0x0, %al
callq 0x1090
jmp 0x47df
jmp 0x47df
jmp 0x47df
jmp 0x47e1
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)