// File: /workspace/github_c_makefile_star2_O0/chgzm[P]minic/generator.c
// Function: process_unary_expr_right
static void process_unary_expr_right(const UnaryExprNode* node) {
    switch (node->type) {
    // postfix-expression
    case UN_NONE: {
        process_postfix_expr_right(node->postfix_expr_node);
        break;
    }
    // ++ unary-expression
    case UN_INC: {
        process_unary_expr_left(node->unary_expr_node);

        printf("  pop rax\n");
        printf("  mov rdi, [rax]\n");
        printf("  add rdi, 1\n");
        printf("  mov [rax], rdi\n");

        break;
    }
    // -- unary-expression
    case UN_DEC: {
        process_unary_expr_left(node->unary_expr_node);

        printf("  pop rax\n");
        printf("  mov rdi, [rax]\n");
        printf("  sub rdi, 1\n");
        printf("  mov [rax], rdi\n");

        break;
    }
    // unary-operator cast-expression
    case UN_OP: {
        switch (node->op_type) {
        case OP_AND: {
            process_cast_expr_left(node->cast_expr_node);
            break;
        }
        case OP_MUL: {
            process_cast_expr(node->cast_expr_node);
            printf("  pop rax\n");
            printf("  mov rax, [rax]\n");
            printf("  push rax\n");
            break;
        }
        case OP_ADD: {
            break;
        }
        case OP_SUB: {
            process_cast_expr(node->cast_expr_node);
            printf("  pop rdi\n");
            printf("  mov rax, 0\n");
            printf("  sub rax, rdi\n");
            printf("  push rax\n");
            break;
        }
        case OP_TILDE: {
            break;
        }
        case OP_EXCLA: {
            process_cast_expr(node->cast_expr_node);
            printf("  pop rax\n");
            printf("  cmp rax, 0\n");
            printf("  sete al\n");
            printf("  movzb rax, al\n");
            printf("  push rax\n");
            break;
        }
        default: {
            break;
        }
        }

        break;
    }
    case UN_SIZEOF_IDENT: {
        const LocalVar* lv = get_localvar(node->sizeof_name);
        if (lv != NULL) {
            printf("  push %d\n", lv->type->type_size);
        } 
        else {
            const GlobalVar* gv = get_globalvar(node->sizeof_name);
            printf("  push %d\n", gv->type->type_size);
        }
        break;
    }
    case UN_SIZEOF_TYPE: {
        const TypeNameNode* type_name_node = node->type_name_node;
        int size = 0;
        if (type_name_node->is_pointer) {
            size = 8;
        }
        else {
            const TypeSpecifierNode* type_specifier_node = type_name_node->specifier_qualifier_node->type_specifier_node; 
            switch (type_specifier_node->type_specifier) {
            case TYPE_CHAR:   { size = 1; break; }
            case TYPE_INT:    { size = 8; break; }
            case TYPE_DOUBLE: { size = 8; break; } 
            case TYPE_STRUCT: { 
                const StructSpecifierNode* struct_specifier_node = type_specifier_node->struct_specifier_node;
                const char* ident = struct_specifier_node->identifier;
                const StructInfo* struct_info1 = strptrmap_get(struct_map, ident);
                size = struct_info1->size;
                break;                                   
            }
            case TYPE_TYPEDEFNAME: {
                const StructInfo* struct_info2 = strptrmap_get(struct_map, type_specifier_node->struct_name);
                size = struct_info2->size;
                break;
            }
            default: {
                break;
            }
            }
        }

        printf("  push %d\n", size);

        break;
    }
    default: {
        break;
    }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl 0x20(%rax), %eax
movq %rax, -0x58(%rbp)
subq $0x5, %rax
ja 0x577f
movq -0x58(%rbp), %rax
leaq 0xa0c0(%rip), %rcx      # 0xf51c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x8(%rbp), %rax
movq (%rax), %rdi
callq 0x5790
jmp 0x5781
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x48c0
leaq 0xa25a(%rip), %rdi      # 0xf6e4
movb $0x0, %al
callq 0x1090
leaq 0xa40e(%rip), %rdi      # 0xf8a6
movb $0x0, %al
callq 0x1090
leaq 0xa412(%rip), %rdi      # 0xf8b8
movb $0x0, %al
callq 0x1090
leaq 0xa24d(%rip), %rdi      # 0xf701
movb $0x0, %al
callq 0x1090
jmp 0x5781
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x48c0
leaq 0xa210(%rip), %rdi      # 0xf6e4
movb $0x0, %al
callq 0x1090
leaq 0xa3c4(%rip), %rdi      # 0xf8a6
movb $0x0, %al
callq 0x1090
leaq 0xa3d6(%rip), %rdi      # 0xf8c6
movb $0x0, %al
callq 0x1090
leaq 0xa203(%rip), %rdi      # 0xf701
movb $0x0, %al
callq 0x1090
jmp 0x5781
movq -0x8(%rbp), %rax
movl 0x24(%rax), %eax
addl $-0xa, %eax
movl %eax, %ecx
movq %rcx, -0x60(%rbp)
subl $0x7, %eax
ja 0x5628
movq -0x60(%rbp), %rax
leaq 0xa01e(%rip), %rcx      # 0xf54c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x5be0
jmp 0x562a
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x5400
leaq 0xa187(%rip), %rdi      # 0xf6e4
movb $0x0, %al
callq 0x1090
leaq 0xa369(%rip), %rdi      # 0xf8d4
movb $0x0, %al
callq 0x1090
leaq 0xa154(%rip), %rdi      # 0xf6cd
movb $0x0, %al
callq 0x1090
jmp 0x562a
jmp 0x562a
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x5400
leaq 0xa13b(%rip), %rdi      # 0xf6d9
movb $0x0, %al
callq 0x1090
leaq 0xa33a(%rip), %rdi      # 0xf8e6
movb $0x0, %al
callq 0x1090
leaq 0xa2bf(%rip), %rdi      # 0xf879
movb $0x0, %al
callq 0x1090
leaq 0xa105(%rip), %rdi      # 0xf6cd
movb $0x0, %al
callq 0x1090
jmp 0x562a
jmp 0x562a
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x5400
leaq 0xa0fd(%rip), %rdi      # 0xf6e4
movb $0x0, %al
callq 0x1090
leaq 0xa1ca(%rip), %rdi      # 0xf7bf
movb $0x0, %al
callq 0x1090
leaq 0xa210(%rip), %rdi      # 0xf813
movb $0x0, %al
callq 0x1090
leaq 0xa20d(%rip), %rdi      # 0xf81e
movb $0x0, %al
callq 0x1090
leaq 0xa0ae(%rip), %rdi      # 0xf6cd
movb $0x0, %al
callq 0x1090
jmp 0x562a
jmp 0x562a
jmp 0x5781
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x5c10
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x5661
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl 0x4(%rax), %esi
leaq 0xa29c(%rip), %rdi      # 0xf8f4
movb $0x0, %al
callq 0x1090
jmp 0x568a
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x5c90
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movl 0x4(%rax), %esi
leaq 0xa271(%rip), %rdi      # 0xf8f4
movb $0x0, %al
callq 0x1090
jmp 0x5781
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x20(%rbp), %rax
testb $0x1, 0x8(%rax)
je 0x56b8
movl $0x8, -0x24(%rbp)
jmp 0x576c
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movl (%rax), %eax
addl $-0x2, %eax
movl %eax, %ecx
movq %rcx, -0x68(%rbp)
subl $0x5, %eax
ja 0x5768
movq -0x68(%rbp), %rax
leaq 0x9e4b(%rip), %rcx      # 0xf534
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x1, -0x24(%rbp)
jmp 0x576a
movl $0x8, -0x24(%rbp)
jmp 0x576a
movl $0x8, -0x24(%rbp)
jmp 0x576a
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movq 0xfa25(%rip), %rdi      # 0x15150
movq -0x40(%rbp), %rsi
callq 0xeb80
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x24(%rbp)
jmp 0x576a
movq 0xfa05(%rip), %rdi      # 0x15150
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0xeb80
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x24(%rbp)
jmp 0x576a
jmp 0x576a
jmp 0x576c
movl -0x24(%rbp), %esi
leaq 0xa17e(%rip), %rdi      # 0xf8f4
movb $0x0, %al
callq 0x1090
jmp 0x5781
jmp 0x5781
addq $0x70, %rsp
popq %rbp
retq
nopw (%rax,%rax)