// File: /workspace/github_c_makefile_star2_O0/justy989[P]ce/ce.c
// Function: move_point_based_on_buffer_change
static CePoint_t move_point_based_on_buffer_change(CeBuffer_t* buffer, CeBufferChangeNode_t* change, CePoint_t point){
     if(!change->change.string) return point;
     if(!ce_point_after(point, change->change.location)) return point;

     int64_t change_line_count = ce_util_count_string_lines(change->change.string);

     if(change_line_count == 1){
          if(point.y != change->change.location.y) return point;

          int64_t change_len = ce_utf8_strlen(change->change.string);

          if(change->change.insertion){
               return ce_buffer_advance_point(buffer, point, change_len);
          }

          return ce_buffer_advance_point(buffer, point, -change_len);
     }else if(change_line_count > 1){
          if(point.y < change->change.location.y + change_line_count){
               point = change->change.location;
          }else{
               if(change->change.insertion){
                    point.y += change_line_count - 1;
               }else{
                    point.y -= change_line_count - 1;
               }
          }
     }
     return point;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdx, -0x20(%rbp)
movq %rcx, -0x18(%rbp)
movq %rdi, -0x28(%rbp)
movq %rsi, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x114f8
movq -0x20(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x11640
movq -0x30(%rbp), %rax
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq 0x10(%rax), %rdx
movq 0x18(%rax), %rcx
callq 0xf690
testb $0x1, %al
jne 0x1152a
movq -0x20(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x11640
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xe6c0
movq %rax, -0x38(%rbp)
cmpq $0x1, -0x38(%rbp)
jne 0x115c9
movq -0x18(%rbp), %rax
movq -0x30(%rbp), %rcx
cmpq 0x18(%rcx), %rax
je 0x11569
movq -0x20(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x11640
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xea70
movq %rax, -0x40(%rbp)
movq -0x30(%rbp), %rax
testb $0x1, 0x1(%rax)
je 0x115a6
movq -0x28(%rbp), %rdi
movq -0x40(%rbp), %rcx
movq -0x20(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0xfaf0
movq %rax, -0x10(%rbp)
movq %rdx, -0x8(%rbp)
jmp 0x11640
movq -0x28(%rbp), %rdi
xorl %eax, %eax
movl %eax, %ecx
subq -0x40(%rbp), %rcx
movq -0x20(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0xfaf0
movq %rax, -0x10(%rbp)
movq %rdx, -0x8(%rbp)
jmp 0x11640
cmpq $0x1, -0x38(%rbp)
jle 0x1162e
movq -0x18(%rbp), %rax
movq -0x30(%rbp), %rcx
movq 0x18(%rcx), %rcx
addq -0x38(%rbp), %rcx
cmpq %rcx, %rax
jge 0x115fb
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rcx
movq %rcx, -0x20(%rbp)
movq 0x18(%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x1162c
movq -0x30(%rbp), %rax
testb $0x1, 0x1(%rax)
je 0x11617
movq -0x38(%rbp), %rax
subq $0x1, %rax
addq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0x1162a
movq -0x38(%rbp), %rcx
subq $0x1, %rcx
movq -0x18(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x18(%rbp)
jmp 0x1162c
jmp 0x1162e
jmp 0x11630
movq -0x20(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rdx
addq $0x40, %rsp
popq %rbp
retq
nop