// File: /workspace/github_c_makefile_star2_O0/justy989[P]ce/ce_app.c
// Function: ce_view_switch_buffer
void ce_view_switch_buffer(CeView_t* view, CeBuffer_t* buffer, CeVim_t* vim,
                           CeConfigOptions_t* config_options, bool insert_into_jump_list){
     CeAppViewData_t* view_data = view->user_data;
     CeJumpList_t* jump_list = &view_data->jump_list;

     if(view_data->prev_buffer != view->buffer) view_data->prev_buffer = view->buffer;

     // if the old buffer is not in the jump list, then add it
     if(insert_into_jump_list){
          bool add_current = false;
          CeDestination_t* current_destination = ce_jump_list_current(jump_list);
          if(current_destination){
               if(!ce_destination_in_view(current_destination, view)){
                    add_current = true;
               }
          }else{
               add_current = true;
          }

          CeDestination_t destination = {};

          if(add_current){
               destination.point = view->cursor;
               strncpy(destination.filepath, view->buffer->name, MAX_PATH_LEN);
               ce_jump_list_insert(jump_list, destination);
          }
     }

     // save the cursor on the old buffer
     view->buffer->cursor_save = view->cursor;
     view->buffer->scroll_save = view->scroll;

     // update new buffer, using the buffer's cursor
     view->buffer = buffer;
     view->cursor = buffer->cursor_save;
     view->scroll = buffer->scroll_save;

     ce_view_follow_cursor(view, config_options->horizontal_scroll_off, config_options->vertical_scroll_off, config_options->tab_width);

     // add to the jump list
     if(insert_into_jump_list){
          CeDestination_t destination = {};
          destination.point = view->cursor;
          strncpy(destination.filepath, view->buffer->name, MAX_PATH_LEN);
          ce_jump_list_insert(jump_list, destination);
     }

     vim->mode = CE_VIM_MODE_NORMAL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc90, %rsp            # imm = 0xC90
movb %r8b, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
andb $0x1, %al
movb %al, -0x21(%rbp)
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
movq 0x4118(%rax), %rax
movq -0x8(%rbp), %rcx
cmpq 0x40(%rcx), %rax
je 0x13caf
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x4118(%rax)
testb $0x1, -0x21(%rbp)
je 0x13d6b
movb $0x0, -0x39(%rbp)
movq -0x38(%rbp), %rdi
callq 0x13c10
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x13ce8
movq -0x48(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x13e90
testb $0x1, %al
jne 0x13ce6
movb $0x1, -0x39(%rbp)
jmp 0x13cec
movb $0x1, -0x39(%rbp)
leaq -0x458(%rbp), %rdi
xorl %esi, %esi
movl $0x410, %edx            # imm = 0x410
callq 0xd290
testb $0x1, -0x39(%rbp)
je 0x13d69
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rcx
movq %rcx, -0x458(%rbp)
movq 0x38(%rax), %rax
movq %rax, -0x450(%rbp)
leaq -0x458(%rbp), %rdi
addq $0x10, %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x10(%rax), %rsi
movl $0x400, %edx            # imm = 0x400
callq 0xd0b0
movq -0x38(%rbp), %rax
movq %rax, -0x870(%rbp)
movq %rsp, %rdi
movl $0x82, %ecx
leaq -0x458(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq -0x870(%rbp), %rdi
callq 0x139c0
jmp 0x13d6b
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x30(%rcx), %rdx
movq %rdx, 0x20(%rax)
movq 0x38(%rcx), %rcx
movq %rcx, 0x28(%rax)
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x20(%rcx), %rdx
movq %rdx, 0x30(%rax)
movq 0x28(%rcx), %rcx
movq %rcx, 0x38(%rax)
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x8(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x20(%rcx), %rdx
movq %rdx, 0x30(%rax)
movq 0x28(%rcx), %rcx
movq %rcx, 0x38(%rax)
movq -0x8(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x30(%rcx), %rdx
movq %rdx, 0x20(%rax)
movq 0x38(%rcx), %rcx
movq %rcx, 0x28(%rax)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rdx
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rcx
callq 0x116a0
testb $0x1, -0x21(%rbp)
je 0x13e7d
leaq -0x868(%rbp), %rdi
xorl %esi, %esi
movl $0x410, %edx            # imm = 0x410
callq 0xd290
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rcx
movq %rcx, -0x868(%rbp)
movq 0x38(%rax), %rax
movq %rax, -0x860(%rbp)
leaq -0x868(%rbp), %rdi
addq $0x10, %rdi
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x10(%rax), %rsi
movl $0x400, %edx            # imm = 0x400
callq 0xd0b0
movq -0x38(%rbp), %rax
movq %rax, -0x878(%rbp)
movq %rsp, %rdi
movl $0x82, %ecx
leaq -0x868(%rbp), %rsi
rep  movsq (%rsi), %es:(%rdi)
movq -0x878(%rbp), %rdi
callq 0x139c0
movq -0x18(%rbp), %rax
movl $0x0, (%rax)
addq $0xc90, %rsp            # imm = 0xC90
popq %rbp
retq