// File: /workspace/github_c_makefile_star2_O0/justy989[P]ce/ce_vim.c
// Function: change_number
static bool change_number(CeView_t* view, CePoint_t* cursor, CePoint_t point, int64_t delta){
     char* start = ce_utf8_iterate_to(view->buffer->lines[point.y], point.x);
     char* itr = start;
     while(*itr && !isdigit((int)(*itr))){
          itr++;
     }

     if(!(*itr)) return false;

     // loop backward if we are inside a number, checking for the beginning or for the negative sign
     while(itr > view->buffer->lines[point.y]){
          itr--;
          if(!isdigit((int)(*itr))){
               if(*itr == '-') break;
               itr++;
               break;
          }
     }

     if(itr < view->buffer->lines[point.y]) itr = view->buffer->lines[point.y];

     char* end = NULL;
     int64_t value = strtol(itr, &end, 10);
     value += delta;
     assert(end);

     int64_t distance_to_number = ce_utf8_strlen_between(view->buffer->lines[point.y], itr) - 1;

     int64_t number_len = 0;
     if(*end){
          number_len = ce_utf8_strlen_between(itr, end) - 1;
     }else{
          number_len = ce_utf8_strlen(itr);
     }

     CePoint_t change_point = {distance_to_number, point.y};
     CePoint_t change_point_save = change_point;

     int64_t digits = ce_count_digits(value);
     if(value < 0) digits++; // account for negative sign
     char* new_number_string = malloc(digits + 1);
     snprintf(new_number_string, digits + 1, "%" PRId64, value);
     new_number_string[digits] = 0;

     ce_buffer_remove_string_change(view->buffer, change_point, number_len, &change_point_save,
                                    change_point, false);
     change_point_save = change_point;
     ce_buffer_insert_string_change_at_cursor(view->buffer, new_number_string, &change_point_save, true);
     *cursor = change_point;
     return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdx, -0x18(%rbp)
movq %rcx, -0x10(%rbp)
movq %rdi, -0x20(%rbp)
movq %rsi, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x18(%rbp), %rsi
callq 0xeca0
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x91(%rbp)
je 0x3c074
callq 0xd700
movq (%rax), %rax
movq -0x40(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
movb %al, -0x91(%rbp)
movb -0x91(%rbp), %al
testb $0x1, %al
jne 0x3c080
jmp 0x3c08e
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x3c037
movq -0x40(%rbp), %rax
cmpb $0x0, (%rax)
jne 0x3c0a0
movb $0x0, -0x1(%rbp)
jmp 0x3c2ee
jmp 0x3c0a2
movq -0x40(%rbp), %rax
movq -0x20(%rbp), %rcx
movq 0x40(%rcx), %rcx
movq (%rcx), %rcx
movq -0x10(%rbp), %rdx
cmpq (%rcx,%rdx,8), %rax
jbe 0x3c105
movq -0x40(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x40(%rbp)
callq 0xd700
movq (%rax), %rax
movq -0x40(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
jne 0x3c103
movq -0x40(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x3c0f5
jmp 0x3c105
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x3c105
jmp 0x3c0a2
movq -0x40(%rbp), %rax
movq -0x20(%rbp), %rcx
movq 0x40(%rcx), %rcx
movq (%rcx), %rcx
movq -0x10(%rbp), %rdx
cmpq (%rcx,%rdx,8), %rax
jae 0x3c135
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq -0x40(%rbp), %rdi
leaq -0x48(%rbp), %rsi
movl $0xa, %edx
callq 0xd3e0
movq %rax, -0x50(%rbp)
movq -0x30(%rbp), %rax
addq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x3c168
jmp 0x3c187
leaq 0x6549(%rip), %rdi      # 0x426b8
leaq 0x9289(%rip), %rsi      # 0x453ff
movl $0xdf1, %edx            # imm = 0xDF1
leaq 0x954b(%rip), %rcx      # 0x456cd
callq 0xd270
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x40(%rbp), %rsi
callq 0x11a20
subq $0x1, %rax
movq %rax, -0x58(%rbp)
movq $0x0, -0x60(%rbp)
movq -0x48(%rbp), %rax
cmpb $0x0, (%rax)
je 0x3c1d3
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x11a20
subq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x3c1e0
movq -0x40(%rbp), %rdi
callq 0xea70
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x50(%rbp), %rdi
callq 0x128d0
movq %rax, -0x88(%rbp)
cmpq $0x0, -0x50(%rbp)
jge 0x3c229
movq -0x88(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rdi
addq $0x1, %rdi
callq 0xd4a0
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rdi
movq -0x88(%rbp), %rsi
addq $0x1, %rsi
movq -0x50(%rbp), %rcx
leaq 0x8378(%rip), %rdx      # 0x445d5
movb $0x0, %al
callq 0xd250
movq -0x90(%rbp), %rax
movq -0x88(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rdi
movq -0x60(%rbp), %rcx
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
leaq -0x80(%rbp), %r8
leaq -0x70(%rbp), %rax
xorl %r9d, %r9d
movq (%rax), %r10
movq %r10, (%rsp)
movq 0x8(%rax), %rax
movq %rax, 0x8(%rsp)
callq 0x110a0
movq -0x70(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rdi
movq -0x90(%rbp), %rsi
leaq -0x80(%rbp), %rdx
movl $0x1, %ecx
callq 0x10f90
movq -0x28(%rbp), %rax
movq -0x70(%rbp), %rcx
movq %rcx, (%rax)
movq -0x68(%rbp), %rcx
movq %rcx, 0x8(%rax)
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xb0, %rsp
popq %rbp
retq
nopl (%rax)