LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_util_visible_index_to_string_index
int64_t ce_util_visible_index_to_string_index(const char* string, int64_t index, int64_t tab_width){
     int64_t x = 0;
     int64_t rune_len = 0;
     CeRune_t rune = 1;

     while(rune > 0 && index > 0){
          rune = ce_utf8_decode(string, &rune_len);

          if(rune > 0){
               if(rune == CE_TAB){
                    index -= tab_width;
               }else{
                    index--;
               }
          }else{
               index--;
          }

          string += rune_len;
          x++;
     }

     return x;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq $0x0, 0x8(%rsp)
testq %rsi, %rsi
jle 0xee67
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
negq %r14
movl $0x1, %ebx
leaq 0x8(%rsp), %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0xe602
testl %eax, %eax
jle 0xee69
movq %r14, %rcx
cmpl $0x9, %eax
je 0xee52
movq $-0x1, %rcx
addq %rcx, %r15
addq 0x8(%rsp), %r12
incq %rbx
testq %r15, %r15
jg 0xee34
decq %rbx
jmp 0xee69
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_buffer_advance_point
CePoint_t ce_buffer_advance_point(CeBuffer_t* buffer, CePoint_t point, int64_t delta){
     if(!ce_buffer_point_is_valid(buffer, point)) return (CePoint_t){-1, -1};

     if(delta < 0){
          while(delta < 0){
               int64_t destination = point.x + delta;
               if(destination < 0){
                    // if we are already at the beginning of the buffer, get out
                    int64_t new_line = point.y - 1;
                    if(new_line < 0){
                         point.x = 0;
                         break;
                    }

                    // move to the previous line, add to the delta
                    if(point.x == 0){
                         delta += 1;
                    }else{
                         delta += point.x;
                    }
                    point.y = new_line;
                    point.x = ce_utf8_strlen(buffer->lines[point.y]);
               }else{
                    point.x = destination;
                    break;
               }
          }
     }else if(delta > 0){
          while(delta > 0){
               int64_t line_len = ce_utf8_strlen(buffer->lines[point.y]);
               int64_t destination = point.x + delta;
               if(destination > line_len){
                    // if we are already at the end of the buffer, get out
                    int64_t new_line = point.y + 1;
                    if(new_line >= buffer->line_count) break;

                    // move to the next line, and subtract from the delta
                    delta -= (line_len - point.x) + 1;
                    point.x = 0;
                    point.y = new_line;
               }else{
                    point.x = destination;
                    break;
               }
          }
     }

     return point;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq $-0x1, %r15
testq %rdx, %rdx
js 0xeeae
movq %rcx, %rbx
movq %rdx, %rbp
movq %rsi, %r13
movq %rdi, %r14
cmpq %rdx, 0x8(%rdi)
setle %al
testq %rsi, %rsi
sets %cl
orb %al, %cl
je 0xeeca
movq $-0x1, %r12
movq %r15, %rax
movq %r12, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%r14), %rax
movq (%rax,%rbp,8), %rdi
callq 0xe445
movq $-0x1, %r12
cmpq %r13, %rax
jl 0xeeb5
testq %rbx, %rbx
js 0xef24
movq %r13, %r15
movq %rbp, %r12
je 0xeeb5
movq (%r14), %rax
movq (%rax,%r12,8), %rdi
callq 0xe445
addq %r15, %rbx
cmpq %rax, %rbx
jle 0xef5e
leaq 0x1(%r12), %rcx
cmpq 0x8(%r14), %rcx
jge 0xeeb5
notq %rax
addq %rax, %rbx
movl $0x0, %r15d
movq %rcx, %r12
testq %rbx, %rbx
jg 0xeeef
jmp 0xeeb5
movq %rbp, %r12
movq %r13, %rbp
addq %rbx, %rbp
jns 0xef66
testq %r12, %r12
jle 0xef6e
incq %rbx
movq (%r14), %rax
movq -0x8(%rax,%r12,8), %rdi
decq %r12
callq 0xe445
movq %rax, %r15
testq %r13, %r13
cmovneq %rbp, %rbx
movq %rax, %r13
testq %rbx, %rbx
js 0xef27
jmp 0xeeb5
movq %rbx, %r15
jmp 0xeeb5
movq %rbp, %r15
jmp 0xeeb5
xorl %r15d, %r15d
xorl %r12d, %r12d
jmp 0xeeb5
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_buffer_clamp_point
CePoint_t ce_buffer_clamp_point(CeBuffer_t* buffer, CePoint_t point, CeClampX_t clamp_x){
     switch(clamp_x){
     case CE_CLAMP_X_NONE:
          return point;
     case CE_CLAMP_X_ON:
          if(buffer->line_count){
               CE_CLAMP(point.y, 0, (buffer->line_count - 1));
               int64_t line_len = ce_utf8_strlen(buffer->lines[point.y]);
               CE_CLAMP(point.x, 0, line_len);
          }else{
               point.x = 0;
               point.y = 0;
          }
          break;
     case CE_CLAMP_X_INSIDE:
          if(buffer->line_count){
               CE_CLAMP(point.y, 0, (buffer->line_count - 1));
               int64_t line_len = ce_utf8_strlen(buffer->lines[point.y]);
               if(line_len){
                    CE_CLAMP(point.x, 0, (line_len - 1));
               }else{
                    point.x = 0;
               }
          }else{
               point.x = 0;
               point.y = 0;
          }
          break;
     }

     return point;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %rbx
cmpl $0x2, %ecx
je 0xefd9
cmpl $0x1, %ecx
jne 0xf02b
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0xf022
leaq -0x1(%rax), %r15
cmpq %r14, %rax
cmovgq %r14, %r15
xorl %r12d, %r12d
testq %r14, %r14
cmovsq %r12, %r15
movq (%rdi), %rax
movq (%rax,%r15,8), %rdi
callq 0xe445
cmpq %rbx, %rax
cmovgeq %rbx, %rax
testq %rbx, %rbx
cmovsq %r12, %rax
movq %rax, %rbx
movq %r15, %r14
jmp 0xf02b
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0xf022
leaq -0x1(%rax), %rcx
cmpq %r14, %rax
cmovgq %r14, %rcx
xorl %eax, %eax
testq %r14, %r14
movq %rcx, %r14
cmovsq %rax, %r14
movq (%rdi), %rax
movq (%rax,%r14,8), %rdi
callq 0xe445
testq %rax, %rax
je 0xf029
decq %rax
cmpq %rbx, %rax
cmovgeq %rbx, %rax
xorl %ecx, %ecx
testq %rbx, %rbx
cmovnsq %rax, %rcx
movq %rcx, %rbx
jmp 0xf02b
xorl %ebx, %ebx
xorl %r14d, %r14d
jmp 0xf02b
xorl %ebx, %ebx
movq %rbx, %rax
movq %r14, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: buffer_realloc_lines
static bool buffer_realloc_lines(CeBuffer_t* buffer, int64_t new_line_count){
     // if we want to realloc 0 lines, clear everything
     if(new_line_count == 0){
          free(buffer->lines);
          buffer->lines = NULL;
          buffer->line_count = 0;
          return true;
     }else if(new_line_count == buffer->line_count){
          return true;
     }

     buffer->lines = realloc(buffer->lines, new_line_count * sizeof(buffer->lines[0]));
     if(buffer->lines == NULL) return false;
     buffer->line_count = new_line_count;
     return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %r14
testq %rsi, %rsi
je 0xf080
movq %rsi, %r15
movb $0x1, %bl
cmpq %rsi, 0x8(%r14)
je 0xf095
movq (%r14), %rdi
leaq (,%r15,8), %rsi
callq 0xd520
movq %rax, (%r14)
testq %rax, %rax
je 0xf093
movq %r15, 0x8(%r14)
jmp 0xf095
movq (%r14), %rdi
callq 0xd090
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
movb $0x1, %bl
jmp 0xf095
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_utf8_encode
bool ce_utf8_encode(CeRune_t u, char* string, int64_t string_len, int64_t* bytes_written){
     if(u < 0x80){
          if(string_len < 1) return false;
          *bytes_written = 1;

          // leave as-is
          string[0] = u;
     }else if(u < 0x0800){
          if(string_len < 2) return false;
          *bytes_written = 2;

          // u = 00000000 00000000 00000abc defghijk

          // 2 bytes
          // first byte:  110abcde
          string[0] = 0xC0 | ((u >> 6) & 0x1f);

          // second byte: 10fghijk
          string[1] = 0x80 | (u & 0x3f);
     }else if(u < 0x10000){
          if(string_len < 3) return false;
          *bytes_written = 3;

          // u = 00000000 00000000 abcdefgh ijklmnop

          // 3 bytes
          // first byte:  1110abcd
          string[0] = 0xE0 | ((u >> 12) & 0x0F);

          // second byte: 10efghij
          string[1] = 0x80 | ((u >> 6) & 0x3F);

          // third byte:  10klmnop
          string[2] = 0x80 | (u & 0x3F);
     }else if(u < 0x110000){
          if(string_len < 4) return false;
          *bytes_written = 4;

          // u = 00000000 000abcde fghijklm nopqrstu

          // 4 bytes
          // first byte:  11110abc
          string[0] = 0xF0 | ((u >> 18) & 0x07);
          // second byte: 10defghi
          string[1] = 0x80 | ((u >> 12) & 0x3F);
          // third byte:  10jklmno
          string[2] = 0x80 | ((u >> 6) & 0x3F);
          // fourth byte: 10pqrstu
          string[3] = 0x80 | (u & 0x3F);
     }

     return true;
}

// Assembly:
cmpl $0x7f, %edi
jg 0xf119
testq %rdx, %rdx
jle 0xf18e
movq $0x1, (%rcx)
movb %dil, (%rsi)
jmp 0xf17b
cmpl $0x7ff, %edi            # imm = 0x7FF
ja 0xf145
cmpq $0x2, %rdx
jl 0xf18e
movq $0x2, (%rcx)
movl %edi, %eax
shrl $0x6, %eax
orb $-0x40, %al
movb %al, (%rsi)
andb $0x3f, %dil
orb $-0x80, %dil
movb %dil, 0x1(%rsi)
jmp 0xf17b
cmpl $0xffff, %edi           # imm = 0xFFFF
ja 0xf17e
cmpq $0x3, %rdx
jl 0xf18e
movq $0x3, (%rcx)
movl %edi, %eax
shrl $0xc, %eax
orb $-0x20, %al
movb %al, (%rsi)
movl %edi, %eax
shrl $0x6, %eax
andb $0x3f, %al
orb $-0x80, %al
movb %al, 0x1(%rsi)
andb $0x3f, %dil
orb $-0x80, %dil
movb %dil, 0x2(%rsi)
movb $0x1, %al
retq
movb $0x1, %al
cmpl $0x10ffff, %edi         # imm = 0x10FFFF
ja 0xf17d
cmpq $0x4, %rdx
jge 0xf191
xorl %eax, %eax
retq
movq $0x4, (%rcx)
movl %edi, %ecx
shrl $0x12, %ecx
orb $-0x10, %cl
movb %cl, (%rsi)
movl %edi, %ecx
shrl $0xc, %ecx
andb $0x3f, %cl
orb $-0x80, %cl
movb %cl, 0x1(%rsi)
movl %edi, %ecx
shrl $0x6, %ecx
andb $0x3f, %cl
orb $-0x80, %cl
movb %cl, 0x2(%rsi)
andb $0x3f, %dil
orb $-0x80, %dil
movb %dil, 0x3(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_buffer_remove_lines
bool ce_buffer_remove_lines(CeBuffer_t* buffer, int64_t line_start, int64_t lines_to_remove){
     // check invalid input
     if(line_start < 0) return false;
     if(line_start >= buffer->line_count) return false;
     if(lines_to_remove <= 0) return false;
     if(line_start + lines_to_remove > buffer->line_count) return false;

     // free lines we are going to remove and overwrite
     for(int64_t i = line_start; i < line_start + lines_to_remove; i++){
          free(buffer->lines[i]);
     }

     // shift lines down, overwriting lines we want to remove
     int64_t last_line_to_shift = buffer->line_count - lines_to_remove;
     for(int64_t dst = line_start; dst < last_line_to_shift; dst++){
          int64_t src = dst + lines_to_remove;
          buffer->lines[dst] = buffer->lines[src];
     }

     // update line count, and shrink our allocation
     buffer->line_count -= lines_to_remove;
     if(buffer->line_count > 0){
          buffer->lines = realloc(buffer->lines, buffer->line_count * sizeof(*buffer->lines));
     }else{
          ce_buffer_empty(buffer);
     }

     buffer->status = CE_BUFFER_STATUS_MODIFIED;
     return buffer->lines != NULL;
}

// Assembly:
testq %rsi, %rsi
js 0xf58d
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq 0x8(%rdi), %rax
cmpq %rsi, %rax
setle %cl
testq %rdx, %rdx
setle %dl
orb %cl, %dl
jne 0xf589
leaq (%r14,%r15), %r12
cmpq %rax, %r12
jbe 0xf590
xorl %eax, %eax
jmp 0xf600
xorl %eax, %eax
retq
movq %r15, %r13
movq (%rbx), %rax
movq (%rax,%r13,8), %rdi
callq 0xd090
incq %r13
cmpq %r12, %r13
jl 0xf593
movq 0x8(%rbx), %rsi
subq %r14, %rsi
cmpq %r15, %rsi
jle 0xf5ce
shlq $0x3, %r14
movq (%rbx), %rax
leaq (%rax,%r15,8), %rcx
movq (%r14,%rcx), %rcx
movq %rcx, (%rax,%r15,8)
incq %r15
cmpq %rsi, %r15
jl 0xf5b7
movq %rsi, 0x8(%rbx)
testq %rsi, %rsi
jle 0xf5e8
movq (%rbx), %rdi
shlq $0x3, %rsi
callq 0xd520
movq %rax, (%rbx)
jmp 0xf5f3
movq %rbx, %rdi
callq 0xe396
movq (%rbx), %rax
movl $0x1, 0x18(%rbx)
testq %rax, %rax
setne %al
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_buffer_dupe
char* ce_buffer_dupe(CeBuffer_t* buffer){
     CePoint_t start = {0, 0};
     CePoint_t end = {0, buffer->line_count};
     if(end.y) end.y--;
     end.x = ce_utf8_last_index(buffer->lines[end.y]);
     int64_t len = ce_buffer_range_len(buffer, start, end);
     if(len > 0) return ce_buffer_dupe_string(buffer, start, len);
     return NULL;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rax
movq 0x8(%rdi), %r14
xorl %ecx, %ecx
subq $0x1, %r14
cmovbq %rcx, %r14
movq (%rax,%r14,8), %rdi
callq 0xe445
xorl %ecx, %ecx
testq %rax, %rax
setg %cl
subq %rcx, %rax
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
movq %rax, %rcx
movq %r14, %r8
callq 0xeb33
testq %rax, %rax
jle 0xf8e4
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
movq %rax, %rcx
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xf60a
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_buffer_insert_string_change
bool ce_buffer_insert_string_change(CeBuffer_t* buffer, char* alloced_string, CePoint_t point, CePoint_t* cursor_before,
                                    CePoint_t cursor_after, bool chain_undo){
     if(!ce_buffer_insert_string(buffer, alloced_string, point)) return false;

     CeBufferChange_t change = {};
     change.chain = chain_undo;
     change.insertion = true;
     change.string = alloced_string;
     change.location = point;
     change.cursor_before = *cursor_before;
     change.cursor_after = cursor_after;
     ce_buffer_change(buffer, &change);

     *cursor_before = cursor_after;
     return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %r9d, 0x4(%rsp)
movq %r8, %rbx
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %r14
callq 0xda6e
movl %eax, %ebp
testb %al, %al
je 0xf965
leaq 0x80(%rsp), %rcx
leaq 0x8(%rsp), %rsi
movq $0x0, (%rsi)
movl 0x4(%rsp), %eax
movb %al, (%rsi)
movb $0x1, 0x1(%rsi)
movq %r13, 0x8(%rsi)
movq %r12, 0x10(%rsi)
movq %r15, 0x18(%rsi)
movups (%rbx), %xmm0
movups %xmm0, 0x20(%rsi)
movq %rcx, %r15
movups (%rcx), %xmm0
movups %xmm0, 0x30(%rsi)
movq %r14, %rdi
callq 0xf976
movups (%r15), %xmm0
movups %xmm0, (%rbx)
movl %ebp, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_buffer_change
bool ce_buffer_change(CeBuffer_t* buffer, CeBufferChange_t* change){
     CeBufferChangeNode_t* node = calloc(1, sizeof(*node));
     node->change = *change;
     node->next = NULL;

     if(buffer->change_node){
          if(buffer->change_node->next){
               ce_buffer_change_node_free(&buffer->change_node->next);
          }

          node->prev = buffer->change_node;
          node->index = buffer->change_node->index + 1;
          buffer->change_node->next = node;
     }else{
          CeBufferChangeNode_t* first_empty_node = calloc(1, sizeof(*node));
          first_empty_node->next = node;
          node->prev = first_empty_node;
          if(buffer->save_at_change_node == NULL) buffer->save_at_change_node = first_empty_node;
     }

     buffer->change_node = node;
     return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r15
movq %rdi, %rbx
movl $0x1, %edi
movl $0x58, %esi
callq 0xd380
movq %rax, %r14
movups (%r15), %xmm0
movups 0x10(%r15), %xmm1
movups 0x20(%r15), %xmm2
movups 0x30(%r15), %xmm3
movups %xmm3, 0x30(%rax)
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
movq 0x40(%rbx), %rdi
testq %rdi, %rdi
je 0xf9e7
cmpq $0x0, 0x40(%rdi)
je 0xf9d2
addq $0x40, %rdi
callq 0xdf25
movq 0x40(%rbx), %rdi
movq %rdi, 0x48(%r14)
movq 0x50(%rdi), %rax
incq %rax
movq %rax, 0x50(%r14)
movq %r14, 0x40(%rdi)
jmp 0xfa09
movl $0x1, %edi
movl $0x58, %esi
callq 0xd380
movq %r14, 0x40(%rax)
movq %rax, 0x48(%r14)
cmpq $0x0, 0x48(%rbx)
jne 0xfa09
movq %rax, 0x48(%rbx)
movq %r14, 0x40(%rbx)
movb $0x1, %al
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_buffer_insert_string_change_at_cursor
bool ce_buffer_insert_string_change_at_cursor(CeBuffer_t* buffer, char* alloced_string, CePoint_t* cursor, bool chain_undo){
     if(!ce_buffer_insert_string(buffer, alloced_string, *cursor)) return false;
     CePoint_t cursor_after = ce_buffer_advance_point(buffer, *cursor, strlen(alloced_string));

     CeBufferChange_t change = {};
     change.chain = chain_undo;
     change.insertion = true;
     change.string = alloced_string;
     change.location = *cursor;
     change.cursor_before = *cursor;
     change.cursor_after = cursor_after;
     ce_buffer_change(buffer, &change);

     *cursor = cursor_after;
     return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %ecx, %r12d
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq (%rdx), %rdx
movq 0x8(%rbx), %rcx
callq 0xda6e
movl %eax, %ebp
testb %al, %al
je 0xfa9f
movq %r15, %rdi
callq 0xd210
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r14, %rdi
movq %rax, %rcx
callq 0xee7a
movq %rax, %r13
movl %r12d, %eax
movq %rdx, %r12
leaq 0x8(%rsp), %rsi
movq $0x0, (%rsi)
movb %al, (%rsi)
movb $0x1, 0x1(%rsi)
movq %r15, 0x8(%rsi)
movups (%rbx), %xmm0
movups %xmm0, 0x10(%rsi)
movups (%rbx), %xmm0
movups %xmm0, 0x20(%rsi)
movq %r13, 0x30(%rsi)
movq %rdx, 0x38(%rsi)
movq %r14, %rdi
callq 0xf976
movq %r13, (%rbx)
movq %r12, 0x8(%rbx)
movl %ebp, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_buffer_remove_string_change
bool ce_buffer_remove_string_change(CeBuffer_t* buffer, CePoint_t point, int64_t remove_len, CePoint_t* cursor_before,
                                    CePoint_t cursor_after, bool chain_undo){
     char* remove_string = ce_buffer_dupe_string(buffer, point, remove_len);
     if(!ce_buffer_remove_string(buffer, point, remove_len)){
          free(remove_string);
          return false;
     }

     CeBufferChange_t change = {};
     change.chain = chain_undo;
     change.insertion = false;
     change.string = remove_string;
     change.location = point;
     change.cursor_before = *cursor_before;
     change.cursor_after = cursor_after;
     ce_buffer_change(buffer, &change);

     *cursor_before = cursor_after;
     return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %r9d, 0x4(%rsp)
movq %r8, %rbx
movq %rcx, %rbp
movq %rdx, %r15
movq %rsi, %r13
movq %rdi, %r14
callq 0xf60a
movq %rax, %r12
movq %r14, %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbp, %rcx
callq 0xf1cb
movl %eax, %ebp
testb %al, %al
je 0xfb39
leaq 0x80(%rsp), %rcx
leaq 0x8(%rsp), %rsi
movq $0x0, (%rsi)
movl 0x4(%rsp), %eax
movb %al, (%rsi)
movq %r12, 0x8(%rsi)
movq %r13, 0x10(%rsi)
movq %r15, 0x18(%rsi)
movups (%rbx), %xmm0
movups %xmm0, 0x20(%rsi)
movq %rcx, %r15
movups (%rcx), %xmm0
movups %xmm0, 0x30(%rsi)
movq %r14, %rdi
callq 0xf976
movups (%r15), %xmm0
movups %xmm0, (%rbx)
jmp 0xfb41
movq %r12, %rdi
callq 0xd090
movl %ebp, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_buffer_undo
bool ce_buffer_undo(CeBuffer_t* buffer, CePoint_t* cursor){
     // nothing to undo
     if(!buffer->change_node) return true;
     if(!buffer->change_node->prev) return true;

     CeBufferChange_t* change = &buffer->change_node->change;
     if(change->insertion){
          ce_buffer_remove_string(buffer, change->location, ce_utf8_strlen(change->string));
     }else{
          ce_buffer_insert_string(buffer, change->string, change->location);
     }

     *cursor = change->cursor_before;
     buffer->change_node = buffer->change_node->prev;

     bool success = true;
     if(change->chain) success = ce_buffer_undo(buffer, cursor);

     if(buffer->status == CE_BUFFER_STATUS_MODIFIED && buffer->change_node == buffer->save_at_change_node){
          buffer->status = CE_BUFFER_STATUS_NONE;
     }

     return success;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq 0x40(%rdi), %r15
testq %r15, %r15
je 0xfbe7
cmpq $0x0, 0x48(%r15)
je 0xfbe7
movq %rsi, %r14
movq %rdi, %rbx
cmpb $0x1, 0x1(%r15)
jne 0xfb96
movq 0x8(%r15), %rdi
callq 0xe445
movq 0x10(%r15), %rsi
movq 0x18(%r15), %rdx
movq %rbx, %rdi
movq %rax, %rcx
callq 0xf1cb
jmp 0xfbaa
movq 0x8(%r15), %rsi
movq 0x10(%r15), %rdx
movq 0x18(%r15), %rcx
movq %rbx, %rdi
callq 0xda6e
movups 0x20(%r15), %xmm0
movups %xmm0, (%r14)
movq 0x40(%rbx), %rax
movq 0x48(%rax), %rax
movq %rax, 0x40(%rbx)
cmpb $0x1, (%r15)
jne 0xfbd0
movq %rbx, %rdi
movq %r14, %rsi
callq 0xfb52
cmpl $0x1, 0x18(%rbx)
jne 0xfbe7
movq 0x40(%rbx), %rax
cmpq 0x48(%rbx), %rax
jne 0xfbe7
movl $0x0, 0x18(%rbx)
movb $0x1, %al
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_buffer_redo
bool ce_buffer_redo(CeBuffer_t* buffer, CePoint_t* cursor){
     // nothing to redo
     if(!buffer->change_node) return false;
     if(!buffer->change_node->next) return false;

     buffer->change_node = buffer->change_node->next;

     CeBufferChange_t* change = &buffer->change_node->change;
     if(change->insertion){
          ce_buffer_insert_string(buffer, change->string, change->location);
     }else{
          ce_buffer_remove_string(buffer, change->location, ce_utf8_strlen(change->string));
     }

     *cursor = change->cursor_after;

     if(buffer->change_node->next && buffer->change_node->next->change.chain) return ce_buffer_redo(buffer, cursor);

     if(buffer->status == CE_BUFFER_STATUS_MODIFIED && buffer->change_node == buffer->save_at_change_node){
          buffer->status = CE_BUFFER_STATUS_NONE;
     }

     return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq 0x40(%rdi), %rcx
testq %rcx, %rcx
je 0xfc7b
movq 0x40(%rcx), %r15
testq %r15, %r15
je 0xfc7b
movq %r15, 0x40(%rbx)
cmpb $0x1, 0x1(%r15)
jne 0xfc2d
movq 0x8(%r15), %rsi
movq 0x10(%r15), %rdx
movq 0x18(%r15), %rcx
movq %rbx, %rdi
callq 0xda6e
jmp 0xfc49
movq 0x8(%r15), %rdi
callq 0xe445
movq 0x10(%r15), %rsi
movq 0x18(%r15), %rdx
movq %rbx, %rdi
movq %rax, %rcx
callq 0xf1cb
movups 0x30(%r15), %xmm0
movups %xmm0, (%r14)
movq 0x40(%rbx), %rcx
movq 0x40(%rcx), %rax
testq %rax, %rax
je 0xfc64
cmpb $0x0, (%rax)
jne 0xfbfe
movb $0x1, %al
cmpl $0x1, 0x18(%rbx)
jne 0xfc7d
cmpq 0x48(%rbx), %rcx
jne 0xfc7d
movl $0x0, 0x18(%rbx)
jmp 0xfc7d
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_move_point_based_on_buffer_changes
CePoint_t ce_move_point_based_on_buffer_changes(CeBuffer_t* buffer, CeBufferChangeNode_t* before, CePoint_t point){
     CeBufferChangeNode_t* itr = buffer->change_node;
     while(itr && itr != before){
          point = move_point_based_on_buffer_change(buffer, itr, point);
          itr = itr->prev;
     }
     return point;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %r15
movq %rdx, %r12
movq %rdi, 0x10(%rsp)
movq 0x40(%rdi), %rbx
testq %rbx, %rbx
sete %al
cmpq %rsi, %rbx
sete %cl
orb %al, %cl
jne 0xfd70
movq %rsi, 0x8(%rsp)
movq 0x8(%rbx), %r14
testq %r14, %r14
je 0xfd50
movq 0x10(%rbx), %r13
movq 0x18(%rbx), %rbp
cmpq %r15, %rbp
jl 0xfcda
jne 0xfd50
cmpq %r12, %r13
jge 0xfd50
movq %r14, %rdi
callq 0xe279
cmpq $0x1, %rax
jne 0xfd1b
cmpq %r15, %rbp
jne 0xfd3d
movq %r14, %rdi
callq 0xe445
movq %rax, %rcx
negq %rcx
cmpb $0x0, 0x1(%rbx)
cmovneq %rax, %rcx
movq 0x10(%rsp), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0xee7a
movq %rax, %r13
movq %rdx, %rbp
jmp 0xfd43
movq 0x8(%rsp), %rsi
jle 0xfd50
leaq (%rax,%rbp), %rcx
cmpq %r15, %rcx
jg 0xfd56
cmpb $0x1, 0x1(%rbx)
jne 0xfd4a
leaq (%r15,%rax), %rbp
decq %rbp
movq %r12, %r13
jmp 0xfd56
movq %r12, %r13
movq %r15, %rbp
movq 0x8(%rsp), %rsi
jmp 0xfd56
subq %rax, %r15
incq %r15
movq %r12, %r13
movq %r15, %rbp
movq 0x48(%rbx), %rbx
testq %rbx, %rbx
je 0xfd76
movq %rbp, %r15
movq %r13, %r12
cmpq %rsi, %rbx
jne 0xfcb9
jmp 0xfd76
movq %r12, %r13
movq %r15, %rbp
movq %r13, %rax
movq %rbp, %rdx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_utf8_strlen_between
int64_t ce_utf8_strlen_between(const char* start, const char* end){
     int64_t len = 0;
     int64_t byte_count = 0;

     while(start <= end){
          if((*start & 0x80) == 0){
               byte_count = 1;
          }else if((*start & 0xE0) == 0xC0){
               byte_count = 2;
          }else if((*start & 0xF0) == 0xE0){
               byte_count = 3;
          }else if((*start & 0xF8) == 0xF0){
               byte_count = 4;
          }else{
               assert(!"unicode character claiming it has more than 4 bytes?!");
               return -1;
          }

          // validate string doesn't early terminate
          for(int64_t i = 0; i < byte_count; i++){
               if(*start == 0) return -1;
               start++;
          }

          len++;
     }

     return len;

}

// Assembly:
pushq %rax
xorl %eax, %eax
cmpq %rsi, %rdi
ja 0xfff7
movzbl (%rdi), %edx
movl $0x1, %ecx
testb %dl, %dl
jns 0xffcd
movl %edx, %r8d
andl $-0x20, %r8d
movl $0x2, %ecx
cmpl $0xc0, %r8d
je 0xffcd
movl %edx, %r8d
andl $-0x10, %r8d
movl $0x3, %ecx
cmpl $0xe0, %r8d
je 0xffcd
andl $-0x8, %edx
movl $0x4, %ecx
cmpl $0xf0, %edx
jne 0xfff9
leaq (%rdi,%rcx), %rdx
xorl %r8d, %r8d
cmpb $0x0, (%rdi,%r8)
je 0xfff0
incq %r8
cmpq %r8, %rcx
jne 0xffd4
incq %rax
movq %rdx, %rdi
cmpq %rsi, %rdx
jbe 0xff87
jmp 0xfff7
movq $-0x1, %rax
popq %rcx
retq
leaq 0x1d727(%rip), %rdi     # 0x2d727
leaq 0x1d671(%rip), %rsi     # 0x2d678
leaq 0x1d777(%rip), %rcx     # 0x2d785
movl $0x54f, %edx            # imm = 0x54F
callq 0xd280
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_utf8_decode_reverse
CeRune_t ce_utf8_decode_reverse(const char* string, const char* string_start, int64_t* bytes_consumed){
     if((*string & 0x80) == 0){
          *bytes_consumed = 1;
          return string[0];
     }

     while(string >= string_start){
          if((*string & 0x80) == 0x80){
               string--;
          }else{
               return ce_utf8_decode(string, bytes_consumed);
          }
     }

     return CE_UTF8_INVALID;
}

// Assembly:
cmpb $0x0, (%rdi)
js 0x100ba
movq $0x1, (%rdx)
movsbl (%rdi), %eax
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rsi, %rdi
jae 0x100c5
retq
decq %rdi
cmpq %rsi, %rdi
jb 0x100c4
leaq -0x1(%rdi), %rcx
cmpb $0x0, (%rdi)
movq %rcx, %rdi
js 0x100c8
incq %rcx
movq %rcx, %rdi
movq %rdx, %rsi
jmp 0xe602
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_utf8_rune_len
int64_t ce_utf8_rune_len(CeRune_t u){
     // TODO: optimize based on st's bitmasking
     if(u < 0x80){
          return 1;
     }else if(u < 0x0800){
          return 2;
     }else if(u < 0x10000){
          return 3;
     }else if(u < 0x110000){
          return 4;
     }

     return true;
}

// Assembly:
movl $0x1, %eax
cmpl $0x80, %edi
jl 0x10120
movl $0x2, %eax
cmpl $0x800, %edi            # imm = 0x800
jb 0x10120
movl $0x3, %eax
cmpl $0x10000, %edi          # imm = 0x10000
jb 0x10120
xorl %eax, %eax
cmpl $0x110000, %edi         # imm = 0x110000
setb %al
leaq (%rax,%rax,2), %rax
incq %rax
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_rune_node_string
CeRune_t* ce_rune_node_string(CeRuneNode_t* head){
     // count nodes
     CeRuneNode_t* itr = head;
     int64_t len = 0;
     while(itr){
          itr = itr->next;
          len++;
     }

     CeRune_t* runes = malloc((len + 1) * sizeof(*runes));

     // copy into string
     int64_t save_len = len;
     itr = head;
     while(itr){
          runes[len - 1] = itr->rune;
          itr = itr->next;
          len--;
     }

     // null terminate
     runes[save_len] = 0;
     return runes;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0x101c6
movq %rdi, %rbx
movq $-0x4, %r15
xorl %r14d, %r14d
movq %rdi, %rax
movq 0x8(%rax), %rax
incq %r14
addq $0x4, %r15
testq %rax, %rax
jne 0x1018f
leaq 0x8(%r15), %rdi
callq 0xd4c0
testq %rbx, %rbx
je 0x101d3
movq %rax, %rcx
addq %r15, %rcx
movl (%rbx), %edx
movl %edx, (%rcx)
movq 0x8(%rbx), %rbx
addq $-0x4, %rcx
testq %rbx, %rbx
jne 0x101b3
jmp 0x101d3
movl $0x4, %edi
callq 0xd4c0
xorl %r14d, %r14d
movl $0x0, (%rax,%r14,4)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_rune_node_free
void ce_rune_node_free(CeRuneNode_t** head){
     CeRuneNode_t* itr = *head;
     while(itr){
          CeRuneNode_t* tmp = itr;
          itr = itr->next;
          free(tmp);
     }

     *head = NULL;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x10201
movq 0x8(%rdi), %r14
callq 0xd090
movq %r14, %rdi
testq %r14, %r14
jne 0x101f0
movq $0x0, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_range_sort
bool ce_range_sort(CeRange_t* range){
     if(ce_point_after(range->start, range->end)){
          CePoint_t tmp = range->start;
          range->start = range->end;
          range->end = tmp;
          return true;
     }

     return false;
}

// Assembly:
movq 0x8(%rdi), %rcx
movq 0x18(%rdi), %rdx
cmpq %rcx, %rdx
jl 0x10631
xorl %eax, %eax
cmpq %rcx, %rdx
jne 0x1064d
movq (%rdi), %rcx
cmpq %rcx, 0x10(%rdi)
jge 0x1064d
leaq 0x10(%rdi), %rax
movups (%rdi), %xmm0
movaps %xmm0, -0x18(%rsp)
movups (%rax), %xmm0
movups %xmm0, (%rdi)
movaps -0x18(%rsp), %xmm0
movups %xmm0, (%rax)
movb $0x1, %al
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_count_digits
int64_t ce_count_digits(int64_t n){
     if(n < 0) n = -n;
     if(n == 0) return 1;

     int count = 0;
     while(n > 0){
          n /= 10;
          count++;
     }

     return count;
}

// Assembly:
testq %rdi, %rdi
je 0x10681
movq %rdi, %rsi
negq %rsi
cmovsq %rdi, %rsi
xorl %ecx, %ecx
movabsq $-0x3333333333333333, %rdi # imm = 0xCCCCCCCCCCCCCCCD
movq %rsi, %rax
mulq %rdi
shrq $0x3, %rdx
incq %rcx
cmpq $0x9, %rsi
movq %rdx, %rsi
ja 0x10669
jmp 0x10686
movl $0x1, %ecx
movq %rcx, %rax
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_line_number_column_width
int64_t ce_line_number_column_width(CeLineNumber_t line_number, int64_t buffer_line_count, int64_t view_top, int64_t view_bottom){
     if(buffer_line_count == 0) return 0;

     int64_t column_width = 0;

     if(line_number == CE_LINE_NUMBER_ABSOLUTE || line_number == CE_LINE_NUMBER_ABSOLUTE_AND_RELATIVE){
          column_width += ce_count_digits(buffer_line_count) + 1;
     }else if(line_number == CE_LINE_NUMBER_RELATIVE){
          int64_t view_height = (view_bottom - view_top) + 1;
          if(view_height > buffer_line_count){
               column_width += ce_count_digits(buffer_line_count - 1) + 1;
          }else{
               column_width += ce_count_digits(view_height - 1) + 1;
          }
     }

     return column_width;
}

// Assembly:
testq %rsi, %rsi
je 0x10718
movl %edi, %eax
andl $-0x3, %eax
cmpl $0x1, %eax
jne 0x106d1
movq %rsi, %rdi
negq %rdi
cmovsq %rsi, %rdi
movl $0x1, %ecx
movabsq $-0x3333333333333333, %rsi # imm = 0xCCCCCCCCCCCCCCCD
movq %rdi, %rax
mulq %rsi
shrq $0x3, %rdx
incq %rcx
cmpq $0xa, %rdi
movq %rdx, %rdi
jae 0x106b6
jmp 0x10758
cmpl $0x2, %edi
jne 0x10718
movq %rcx, %rax
subq %rdx, %rax
cmpq %rsi, %rax
jge 0x1071c
movl $0x1, %esi
cmpq %rdx, %rcx
je 0x10753
movq %rax, %rcx
negq %rcx
cmovsq %rax, %rcx
xorl %esi, %esi
movabsq $-0x3333333333333333, %rdi # imm = 0xCCCCCCCCCCCCCCCD
movq %rcx, %rax
mulq %rdi
shrq $0x3, %rdx
incl %esi
cmpq $0x9, %rcx
movq %rdx, %rcx
ja 0x10701
jmp 0x10753
xorl %ecx, %ecx
jmp 0x10758
decq %rsi
je 0x1074e
movq %rsi, %rcx
negq %rcx
cmovsq %rsi, %rcx
xorl %esi, %esi
movabsq $-0x3333333333333333, %rdi # imm = 0xCCCCCCCCCCCCCCCD
movq %rcx, %rax
mulq %rdi
shrq $0x3, %rdx
incl %esi
cmpq $0xa, %rcx
movq %rdx, %rcx
jae 0x10737
jmp 0x10753
movl $0x1, %esi
movl %esi, %ecx
incq %rcx
movq %rcx, %rax
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_list_dir
CeListDirResult_t ce_list_dir(const char* directory) {
     CeListDirResult_t result;
     memset(&result, 0, sizeof(result));

#if defined(PLATFORM_WINDOWS)
     WIN32_FIND_DATA find_files_result;
     memset(&find_files_result, 0, sizeof(find_files_result));

     HANDLE find_files_handle = FindFirstFileA(directory,
                                               &find_files_result);
     if (find_files_handle == INVALID_HANDLE_VALUE) {
          return result;
     }

     do{
         insert_list_dir_result_filename(&result,
                                         find_files_result.cFileName,
                                         find_files_result.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
     }while(FindNextFileA(find_files_handle, &find_files_result));

     FindClose(find_files_handle);
#else
     DIR* os_dir = opendir(directory);
     if(!os_dir){
          return result;
     }

     struct dirent* node = NULL;
     while((node = readdir(os_dir)) != NULL){
          insert_list_dir_result_filename(&result,
                                          node->d_name,
                                          node->d_type == DT_DIR);
     }

     closedir(os_dir);
#endif

     return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r15
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movq %rsi, %rdi
callq 0xd200
testq %rax, %rax
je 0x10858
movq %rax, %r13
movq %rax, %rdi
callq 0xd470
testq %rax, %rax
je 0x1084a
movq %rax, %rbx
movq %r15, 0x8(%rsp)
movl $0x8, %r15d
xorl %r12d, %r12d
xorl %ebp, %ebp
xorl %r14d, %r14d
movq %r13, 0x10(%rsp)
movq %r14, %r13
movb 0x12(%rbx), %al
movb %al, 0x7(%rsp)
addq $0x13, %rbx
incq %r14
movq %rbp, %rdi
movq %r15, %rsi
callq 0xd520
movq %rax, %rbp
movq %rbx, %rdi
callq 0xd640
movq %rax, (%rbp,%r13,8)
movq %r12, %rdi
movq %r14, %rsi
callq 0xd520
movq %rax, %r12
cmpb $0x4, 0x7(%rsp)
sete (%rax,%r13)
movq 0x10(%rsp), %r13
movq %r13, %rdi
callq 0xd470
movq %rax, %rbx
addq $0x8, %r15
testq %rax, %rax
jne 0x107de
movq 0x8(%rsp), %r15
movq %rbp, 0x8(%r15)
movq %r12, 0x10(%r15)
jmp 0x1084d
xorl %r14d, %r14d
movq %r14, (%r15)
movq %r13, %rdi
callq 0xd300
movq %r15, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce.c
// Function: ce_free_list_dir_result
void ce_free_list_dir_result(CeListDirResult_t* list_dir_result) {
     for(int64_t i = 0; i < list_dir_result->count; i++){
          free(list_dir_result->filenames[i]);
     }
     free(list_dir_result->filenames);
     free(list_dir_result->is_directories);
     memset(list_dir_result, 0, sizeof(*list_dir_result));
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpq $0x0, (%rdi)
jle 0x1088f
xorl %r14d, %r14d
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0xd090
incq %r14
cmpq (%rbx), %r14
jl 0x1087a
movq 0x8(%rbx), %rdi
callq 0xd090
movq 0x10(%rbx), %rdi
callq 0xd090
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce_app.c
// Function: ce_buffer_node_insert
bool ce_buffer_node_insert(CeBufferNode_t** head, CeBuffer_t* buffer){
     CeBufferNode_t* node = malloc(sizeof(*node));
     if(!node) return false;
     node->buffer = buffer;
     node->next = *head;
     *head = node;
     return true;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movl $0x10, %edi
callq 0xd4c0
testq %rax, %rax
je 0x108de
movq %r14, (%rax)
movq (%rbx), %rcx
movq %rcx, 0x8(%rax)
movq %rax, (%rbx)
testq %rax, %rax
setne %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce_app.c
// Function: ce_buffer_node_unlink
CeBufferNode_t* ce_buffer_node_unlink(CeBufferNode_t** head, CeBuffer_t* buffer){
     CeBufferNode_t* prev = NULL;
     CeBufferNode_t* itr = *head;
     while(itr){
          if(itr->buffer == buffer) break;
          prev = itr;
          itr = itr->next;
     }

     if(!itr) return NULL;

     if(prev){
          prev->next = itr->next;
     }else{
          *head = (*head)->next;
     }

     return itr;
}

// Assembly:
movq (%rdi), %rcx
testq %rcx, %rcx
je 0x1090f
cmpq %rsi, (%rcx)
je 0x10912
movq %rcx, %rax
movq %rax, %rdx
movq 0x8(%rax), %rax
testq %rax, %rax
je 0x1090f
cmpq %rsi, (%rax)
jne 0x108fc
jmp 0x10917
xorl %eax, %eax
retq
xorl %edx, %edx
movq %rcx, %rax
testq %rdx, %rdx
je 0x10925
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rdx)
retq
movq 0x8(%rcx), %rcx
movq %rcx, (%rdi)
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce_app.c
// Function: free_buffer_node
static void free_buffer_node(CeBufferNode_t* node){
     CeAppBufferData_t* buffer_data = node->buffer->app_data;
     if(buffer_data) free(buffer_data->base_directory);
     free(node->buffer->app_data);
     ce_buffer_free(node->buffer);
     free(node->buffer);
     free(node);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rax
movq 0x58(%rax), %rax
testq %rax, %rax
je 0x10992
movq 0x608(%rax), %rdi
callq 0xd090
movq (%rbx), %rax
movq 0x58(%rax), %rdi
jmp 0x10994
xorl %edi, %edi
callq 0xd090
movq (%rbx), %rdi
callq 0xdea8
movq (%rbx), %rdi
callq 0xd090
movq %rbx, %rdi
popq %rbx
jmp 0xd090
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce_app.c
// Function: ce_buffer_node_free
void ce_buffer_node_free(CeBufferNode_t** head){
     CeBufferNode_t* itr = *head;
     while(itr){
          CeBufferNode_t* tmp = itr;
          itr = itr->next;
          free_buffer_node(tmp);
     }
     *head = NULL;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x109d2
movq 0x8(%rdi), %r14
callq 0x1096d
movq %r14, %rdi
testq %r14, %r14
jne 0x109c1
movq $0x0, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce_app.c
// Function: ce_string_node_insert
CeStringNode_t* ce_string_node_insert(CeStringNode_t** head, const char* string){
     CeStringNode_t* tail = *head;
     CeStringNode_t* node;
     if(tail){
          while(tail->next) tail = tail->next;

          // NOTE: we probably don't want this if we want the linked list to be general
          // skip the insertion if the string matches the previous string
          if(strcmp(string, tail->string) == 0) return NULL;

          node = calloc(1, sizeof(*node));
          if(!node) return node;
          node->string = strdup(string);

          tail->next = node;
          node->prev = tail;
     }else{
          node = calloc(1, sizeof(*node));
          if(!node) return node;
          node->string = strdup(string);

          *head = node;
     }

     return node;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq (%rdi), %rax
testq %rax, %rax
je 0x10a38
movq %rax, %r15
movq 0x8(%rax), %rax
testq %rax, %rax
jne 0x109f1
movq (%r15), %rsi
movq %rbx, %rdi
callq 0xd390
testl %eax, %eax
je 0x10a62
movl $0x1, %edi
movl $0x18, %esi
callq 0xd380
testq %rax, %rax
je 0x10a62
movq %rax, %r14
movq %rbx, %rdi
callq 0xd640
movq %rax, (%r14)
movq %r14, 0x8(%r15)
movq %r15, 0x10(%r14)
jmp 0x10a65
movq %rdi, %r15
movl $0x1, %edi
movl $0x18, %esi
callq 0xd380
testq %rax, %rax
je 0x10a62
movq %rax, %r14
movq %rbx, %rdi
callq 0xd640
movq %rax, (%r14)
movq %r14, (%r15)
jmp 0x10a65
xorl %r14d, %r14d
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce_app.c
// Function: ce_string_node_free
void ce_string_node_free(CeStringNode_t** head){
     CeStringNode_t* itr = *head;
     while(itr){
          CeStringNode_t* tmp = itr;
          itr = itr->next;
          free(tmp->string);
          free(tmp);
     }

     *head = NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %r14
testq %r14, %r14
je 0x10a9a
movq (%r14), %rdi
movq 0x8(%r14), %r15
callq 0xd090
movq %r14, %rdi
callq 0xd090
movq %r15, %r14
testq %r15, %r15
jne 0x10a7e
movq $0x0, (%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce_app.c
// Function: ce_history_insert
bool ce_history_insert(CeHistory_t* history, const char* string){
     CeStringNode_t* new_node = ce_string_node_insert(&history->head, string);
     if(!new_node) return false;
     ce_history_reset_current(history);
     return true;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x109e1
testq %rax, %rax
je 0x10abd
movq $0x0, 0x8(%rbx)
testq %rax, %rax
setne %al
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce_app.c
// Function: ce_history_previous
char* ce_history_previous(CeHistory_t* history){
     if(history->current){
          if(history->current->prev){
               history->current = history->current->prev;
          }

          return history->current->string;
     }else{
          history->current = history->head;
          if(history->current){
               while(history->current->next) history->current = history->current->next;
               return history->current->string;
          }
     }

     return NULL;
}

// Assembly:
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0x10ae2
movq 0x10(%rax), %rcx
testq %rcx, %rcx
jne 0x10b03
jmp 0x10b0a
movq (%rdi), %rax
movq %rax, 0x8(%rdi)
testq %rax, %rax
je 0x10b0e
movq 0x8(%rax), %rdx
testq %rdx, %rdx
je 0x10b0a
movq %rdx, %rcx
movq 0x8(%rdx), %rdx
testq %rdx, %rdx
jne 0x10af7
movq %rcx, 0x8(%rdi)
movq %rcx, %rax
movq (%rax), %rax
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce_app.c
// Function: ce_convert_bind_defs
void ce_convert_bind_defs(CeKeyBinds_t* binds, CeKeyBindDef_t* bind_defs, int64_t bind_def_count){
     if(binds->count){
          for(int64_t i = 0; i < binds->count; ++i){
               free(binds->binds[i].keys);
          }
          free(binds->binds);
     }

     binds->count = bind_def_count;
     binds->binds = malloc(binds->count * sizeof(*binds->binds));

     for(int64_t i = 0; i < binds->count; ++i){
          ce_command_parse(&binds->binds[i].command, bind_defs[i].command);
          binds->binds[i].key_count = 0;

          for(int k = 0; k < 4; ++k){
               if(bind_defs[i].keys[k] == 0) break;
               binds->binds[i].key_count++;
          }

          if(!binds->binds[i].key_count) continue;

          binds->binds[i].keys = malloc(binds->binds[i].key_count * sizeof(binds->binds[i].keys[0]));

          for(int k = 0; k < binds->binds[i].key_count; ++k){
               binds->binds[i].keys[k] = bind_defs[i].keys[k];
          }
     }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r12
movq %rsi, (%rsp)
movq %rdi, %r13
cmpq $0x0, 0x8(%rdi)
je 0x10b7f
jle 0x10b76
xorl %ebx, %ebx
xorl %r14d, %r14d
movq (%r13), %rax
movq (%rax,%rbx), %rdi
callq 0xd090
incq %r14
addq $0x228, %rbx            # imm = 0x228
cmpq 0x8(%r13), %r14
jl 0x10b59
movq (%r13), %rdi
callq 0xd090
movq %r12, 0x8(%r13)
imulq $0x228, %r12, %rdi      # imm = 0x228
callq 0xd4c0
movq %rax, (%r13)
testq %r12, %r12
jle 0x10c49
movq %rax, %r15
xorl %ebp, %ebp
movq (%rsp), %rbx
movq %r13, 0x8(%rsp)
leaq (,%rbp,2), %rax
addq %rbp, %rax
movq (%rsp), %rcx
leaq (%rcx,%rax,8), %rax
imulq $0x228, %rbp, %r14      # imm = 0x228
leaq (%r15,%r14), %rdi
addq $0x10, %rdi
movq %rax, 0x10(%rsp)
movq 0x10(%rax), %rsi
callq 0x160b8
movq (%r13), %r15
leaq (%r15,%r14), %rax
addq $0x8, %rax
movq $0x0, (%rax)
xorl %r12d, %r12d
cmpl $0x0, (%rbx,%r12,4)
je 0x10c05
incq %r12
movq %r12, (%rax)
cmpq $0x4, %r12
jne 0x10bf0
jmp 0x10c0a
testq %r12, %r12
je 0x10c33
leaq (,%r12,4), %r13
movq %r13, %rdi
callq 0xd4c0
movq %rax, (%r15,%r14)
testq %r12, %r12
jle 0x10c33
movq %rax, %rdi
movq 0x10(%rsp), %rsi
movq %r13, %rdx
callq 0xd420
incq %rbp
addq $0x18, %rbx
movq 0x8(%rsp), %r13
cmpq 0x8(%r13), %rbp
jl 0x10baa
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce_app.c
// Function: ce_set_vim_key_bind
void ce_set_vim_key_bind(CeVimKeyBind_t* key_binds, int64_t* key_bind_count, CeRune_t key, CeVimParseFunc_t* parse_func){
     for(int64_t i = 0; i < *key_bind_count; ++i){
          CeVimKeyBind_t* key_bind = key_binds + i;
          if(key_bind->key == key){
               key_bind->function = parse_func;
               return;
          }
     }

     // we didn't find the key to override it, so we add the binding
     ce_vim_add_key_bind(key_binds, key_bind_count, key, parse_func);
}

// Assembly:
movq (%rsi), %rax
testq %rax, %rax
jle 0x22584
leaq 0x8(%rdi), %r8
jmp 0x10c9c
addq $0x10, %r8
decq %rax
je 0x22584
cmpl %edx, -0x8(%r8)
jne 0x10c8f
movq %rcx, (%r8)
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce_app.c
// Function: ce_extend_commands
void ce_extend_commands(CeCommandEntry_t** command_entries, int64_t* command_entry_count, CeCommandEntry_t* new_command_entries,
                        int64_t new_command_entry_count){
     int64_t final_command_entry_count = *command_entry_count + new_command_entry_count;
     *command_entries = realloc(*command_entries, final_command_entry_count * sizeof(**command_entries));
     for(int64_t i = 0; i < new_command_entry_count; i++){
          (*command_entries)[i + *command_entry_count] = new_command_entries[i];
     }
     *command_entry_count = final_command_entry_count;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, %rbx
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %r12
movq (%rsi), %r13
addq %rcx, %r13
movq (%rdi), %rdi
leaq (,%r13,8), %rax
leaq (%rax,%rax,2), %rsi
callq 0xd520
movq %rax, (%r12)
testq %rbx, %rbx
jle 0x10d0b
xorl %eax, %eax
movq (%r14), %rcx
leaq (%rcx,%rcx,2), %rcx
shlq $0x3, %rcx
addq (%r12), %rcx
movq 0x10(%r15,%rax), %rdx
movq %rdx, 0x10(%rax,%rcx)
movups (%r15,%rax), %xmm0
movups %xmm0, (%rax,%rcx)
addq $0x18, %rax
decq %rbx
jne 0x10ce0
movq %r13, (%r14)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce_app.c
// Function: ce_jump_list_insert
void ce_jump_list_insert(CeJumpList_t* jump_list, CeDestination_t destination){
     if(jump_list->count < JUMP_LIST_DESTINATION_COUNT){
          if(jump_list->count > 0){
               jump_list->itr++;
               jump_list->current = jump_list->itr;
          }
          jump_list->destinations[jump_list->itr] = destination;
          jump_list->count++;
          return;
     }

     // shift all destinations down
     for(int i = 1; i <= jump_list->itr; i++){
          jump_list->destinations[i - 1] = jump_list->destinations[i];
     }

     jump_list->destinations[jump_list->itr] = destination;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x30(%rsp), %r14
movq 0x4100(%rdi), %rcx
cmpq $0x10, %rcx
jge 0x1104b
movq 0x4108(%rbx), %rax
testq %rcx, %rcx
jle 0x1102b
incq %rax
movq %rax, 0x4108(%rbx)
movq %rax, 0x4110(%rbx)
imulq $0x410, %rax, %rdi      # imm = 0x410
addq %rbx, %rdi
movl $0x410, %edx            # imm = 0x410
movq %r14, %rsi
callq 0xd420
incq 0x4100(%rbx)
jmp 0x1109d
movq 0x4108(%rbx), %rax
testq %rax, %rax
jle 0x11083
xorl %r12d, %r12d
movq %rbx, %rdi
leaq 0x410(%rdi), %r15
movl $0x410, %edx            # imm = 0x410
movq %r15, %rsi
callq 0xd420
movq 0x4108(%rbx), %rax
incq %r12
movq %r15, %rdi
cmpq %r12, %rax
jg 0x1105d
imulq $0x410, %rax, %rax      # imm = 0x410
addq %rax, %rbx
movl $0x410, %edx            # imm = 0x410
movq %rbx, %rdi
movq %r14, %rsi
callq 0xd420
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq