// File: /workspace/github_c_makefile_star2_O0/justy989[P]ce/ce.c
// Function: ce_rune_string_to_char_string
char* ce_rune_string_to_char_string(const CeRune_t* int_str){
     // build length
     size_t len = 1; // account for NULL terminator
     const int* int_itr = int_str;
     while(*int_itr){
          if(isprint(*int_itr)){
               len++;
          }else{
               switch(*int_itr){
               default:
                    if(*int_itr >= 1 && *int_itr <= 31){
                         len += 3;
                    }else{
                         len++; // going to fill in with '~' for now
                    }
                    break;
               case KEY_ONLY_BACKSPACE:
               case KEY_ESCAPE:
               case KEY_CARRIAGE_RETURN:
               case CE_TAB:
               case KEY_UP_ARROW:
               case KEY_DOWN_ARROW:
               case KEY_LEFT_ARROW:
               case KEY_RIGHT_ARROW:
               case '\\':
                    len += 2;
                    break;
               case KEY_REDO:
                    len += 3;
                    break;
               }
          }

          int_itr++;
     }

     char* char_str = malloc(len);
     if(!char_str) return NULL;

     char* char_itr = char_str;
     int_itr = int_str;
     while(*int_itr){
          if(isprint(*int_itr)){
               *char_itr = *int_itr;
               char_itr++;
          }else{
               switch(*int_itr){
               default:
                    if(*int_itr >= 1 && *int_itr <= 26){
                         *char_itr = '\\'; char_itr++;
                         *char_itr = '^'; char_itr++;
                         *char_itr = 'a' + (*int_itr - 1); char_itr++;
                    }else if(*int_itr == 27){
                         *char_itr = '\\'; char_itr++;
                         *char_itr = '^'; char_itr++;
                         *char_itr = '['; char_itr++;
                    }else if(*int_itr == 28){
                         *char_itr = '\\'; char_itr++;
                         *char_itr = '^'; char_itr++;
                         *char_itr = '\\'; char_itr++;
                    }else if(*int_itr == 29){
                         *char_itr = '\\'; char_itr++;
                         *char_itr = '^'; char_itr++;
                         *char_itr = ']'; char_itr++;
                    }else if(*int_itr == 30){
                         *char_itr = '\\'; char_itr++;
                         *char_itr = '^'; char_itr++;
                         *char_itr = '^'; char_itr++;
                    }else if(*int_itr == 31){
                         *char_itr = '\\'; char_itr++;
                         *char_itr = '^'; char_itr++;
                         *char_itr = '_'; char_itr++;
                    }else{
                         *char_itr = '~';
                         char_itr++;
                    }
                    break;
               case KEY_ONLY_BACKSPACE:
                    *char_itr = '\\'; char_itr++;
                    *char_itr = 'b'; char_itr++;
                    break;
               case KEY_ESCAPE:
                    *char_itr = '\\'; char_itr++;
                    *char_itr = 'e'; char_itr++;
                    break;
               case KEY_CARRIAGE_RETURN:
                    *char_itr = '\\'; char_itr++;
                    *char_itr = 'r'; char_itr++;
                    break;
               case CE_TAB:
                    *char_itr = '\\'; char_itr++;
                    *char_itr = 't'; char_itr++;
                    break;
               case KEY_UP_ARROW:
                    *char_itr = '\\'; char_itr++;
                    *char_itr = 'u'; char_itr++;
                    break;
               case KEY_DOWN_ARROW:
                    *char_itr = '\\'; char_itr++;
                    *char_itr = 'd'; char_itr++;
                    break;
               case KEY_LEFT_ARROW:
                    *char_itr = '\\'; char_itr++;
                    *char_itr = 'l'; char_itr++;
                    break;
               case KEY_RIGHT_ARROW:
                    *char_itr = '\\'; char_itr++;
                    *char_itr = 'i'; char_itr++; // NOTE: not happy with 'i'
                    break;
               case KEY_REDO:
                    *char_itr = '\\'; char_itr++;
                    *char_itr = '^'; char_itr++;
                    *char_itr = 'r'; char_itr++;
                    break;
               case '\\':
                    *char_itr = '\\'; char_itr++;
                    *char_itr = '\\'; char_itr++;
                    break;
               }
          }

          int_itr++;
     }

     char_str[len - 1] = 0;

     return char_str;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq $0x1, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x12069
callq 0xd700
movq (%rax), %rax
movq -0x20(%rbp), %rcx
movslq (%rcx), %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x4000, %eax           # imm = 0x4000
cmpl $0x0, %eax
je 0x11fb7
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x12058
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x34(%rbp)
subl $0x9, %eax
je 0x1203c
jmp 0x11fc7
movl -0x34(%rbp), %eax
subl $0x1b, %eax
je 0x1203c
jmp 0x11fd1
movl -0x34(%rbp), %eax
subl $0x5c, %eax
je 0x1203c
jmp 0x11fdb
movl -0x34(%rbp), %eax
addl $0xfffffefe, %eax       # imm = 0xFFFFFEFE
subl $0x4, %eax
jb 0x1203c
jmp 0x11fea
movl -0x34(%rbp), %eax
subl $0x107, %eax            # imm = 0x107
je 0x1203c
jmp 0x11ff6
movl -0x34(%rbp), %eax
subl $0x157, %eax            # imm = 0x157
je 0x1203c
jmp 0x12002
movl -0x34(%rbp), %eax
subl $0x173, %eax            # imm = 0x173
je 0x1204a
jmp 0x1200e
movq -0x20(%rbp), %rax
cmpl $0x1, (%rax)
jl 0x1202e
movq -0x20(%rbp), %rax
cmpl $0x1f, (%rax)
jg 0x1202e
movq -0x18(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x18(%rbp)
jmp 0x1203a
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x12056
movq -0x18(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x18(%rbp)
jmp 0x12056
movq -0x18(%rbp), %rax
addq $0x3, %rax
movq %rax, -0x18(%rbp)
jmp 0x12058
movq -0x20(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x20(%rbp)
jmp 0x11f7c
movq -0x18(%rbp), %rdi
callq 0xd4a0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x1208a
movq $0x0, -0x8(%rbp)
jmp 0x12540
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, (%rax)
je 0x12528
callq 0xd700
movq (%rax), %rax
movq -0x20(%rbp), %rcx
movslq (%rcx), %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x4000, %eax           # imm = 0x4000
cmpl $0x0, %eax
je 0x120e3
movq -0x20(%rbp), %rax
movl (%rax), %eax
movb %al, %cl
movq -0x30(%rbp), %rax
movb %cl, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x12517
movq -0x20(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x38(%rbp)
subl $0x9, %eax
je 0x123e0
jmp 0x120f7
movl -0x38(%rbp), %eax
subl $0x1b, %eax
je 0x1238a
jmp 0x12105
movl -0x38(%rbp), %eax
subl $0x5c, %eax
je 0x124ef
jmp 0x12113
movl -0x38(%rbp), %eax
subl $0x102, %eax            # imm = 0x102
je 0x12436
jmp 0x12123
movl -0x38(%rbp), %eax
subl $0x103, %eax            # imm = 0x103
je 0x1240b
jmp 0x12133
movl -0x38(%rbp), %eax
subl $0x104, %eax            # imm = 0x104
je 0x12461
jmp 0x12143
movl -0x38(%rbp), %eax
subl $0x105, %eax            # imm = 0x105
je 0x1248c
jmp 0x12153
movl -0x38(%rbp), %eax
subl $0x107, %eax            # imm = 0x107
je 0x1235f
jmp 0x12163
movl -0x38(%rbp), %eax
subl $0x157, %eax            # imm = 0x157
je 0x123b5
jmp 0x12173
movl -0x38(%rbp), %eax
subl $0x173, %eax            # imm = 0x173
je 0x124b4
jmp 0x12183
movq -0x20(%rbp), %rax
cmpl $0x1, (%rax)
jl 0x121e0
movq -0x20(%rbp), %rax
cmpl $0x1a, (%rax)
jg 0x121e0
movq -0x30(%rbp), %rax
movb $0x5c, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movb $0x5e, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
subl $0x1, %eax
addl $0x61, %eax
movb %al, %cl
movq -0x30(%rbp), %rax
movb %cl, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x1235a
movq -0x20(%rbp), %rax
cmpl $0x1b, (%rax)
jne 0x12227
movq -0x30(%rbp), %rax
movb $0x5c, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movb $0x5e, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movb $0x5b, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x12358
movq -0x20(%rbp), %rax
cmpl $0x1c, (%rax)
jne 0x1226e
movq -0x30(%rbp), %rax
movb $0x5c, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movb $0x5e, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movb $0x5c, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x12356
movq -0x20(%rbp), %rax
cmpl $0x1d, (%rax)
jne 0x122b5
movq -0x30(%rbp), %rax
movb $0x5c, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movb $0x5e, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movb $0x5d, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x12354
movq -0x20(%rbp), %rax
cmpl $0x1e, (%rax)
jne 0x122f9
movq -0x30(%rbp), %rax
movb $0x5c, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movb $0x5e, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movb $0x5e, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x12352
movq -0x20(%rbp), %rax
cmpl $0x1f, (%rax)
jne 0x1233d
movq -0x30(%rbp), %rax
movb $0x5c, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movb $0x5e, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movb $0x5f, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x12350
movq -0x30(%rbp), %rax
movb $0x7e, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x12352
jmp 0x12354
jmp 0x12356
jmp 0x12358
jmp 0x1235a
jmp 0x12515
movq -0x30(%rbp), %rax
movb $0x5c, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movb $0x62, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x12515
movq -0x30(%rbp), %rax
movb $0x5c, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movb $0x65, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x12515
movq -0x30(%rbp), %rax
movb $0x5c, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movb $0x72, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x12515
movq -0x30(%rbp), %rax
movb $0x5c, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movb $0x74, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x12515
movq -0x30(%rbp), %rax
movb $0x5c, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movb $0x75, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x12515
movq -0x30(%rbp), %rax
movb $0x5c, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movb $0x64, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x12515
movq -0x30(%rbp), %rax
movb $0x5c, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movb $0x6c, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x12515
movq -0x30(%rbp), %rax
movb $0x5c, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movb $0x69, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x12515
movq -0x30(%rbp), %rax
movb $0x5c, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movb $0x5e, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movb $0x72, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x12515
movq -0x30(%rbp), %rax
movb $0x5c, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movb $0x5c, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x12517
movq -0x20(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x20(%rbp)
jmp 0x1209a
movq -0x28(%rbp), %rax
movq -0x18(%rbp), %rcx
subq $0x1, %rcx
movb $0x0, (%rax,%rcx)
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)