// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce_commands.c
// Function: command_jump_list
CeCommandStatus_t command_jump_list(CeCommand_t* command, void* user_data){
     if(command->arg_count != 1) return CE_COMMAND_PRINT_HELP;
     if(command->args[0].type != CE_COMMAND_ARG_STRING) return CE_COMMAND_PRINT_HELP;
     CeApp_t* app = user_data;
     CommandContext_t command_context = {};

     if(!get_command_context(app, &command_context)) return CE_COMMAND_NO_ACTION;

     CeDestination_t* destination = NULL;
     int64_t view_width = ce_view_width(command_context.view);
     int64_t view_height = ce_view_height(command_context.view);
     CeRect_t view_rect = {command_context.view->scroll.x, command_context.view->scroll.x + view_width,
                           command_context.view->scroll.y, command_context.view->scroll.y + view_height};
     CeAppViewData_t* view_data = command_context.view->user_data;
     CeJumpList_t* jump_list = &view_data->jump_list;

     // TODO: I think these names are backwards ?
     if(strcmp(command->args[0].string, "next")){
          // ignore destinations on screen
          while((destination = ce_jump_list_next(jump_list))){
               if(strcmp(destination->filepath, command_context.view->buffer->name) != 0 || !ce_point_in_rect(destination->point, view_rect)){
                    break;
               }
          }
     }else if(strcmp(command->args[0].string, "previous")){
          // ignore destinations on screen
          while((destination = ce_jump_list_previous(jump_list))){
               if(strcmp(destination->filepath, command_context.view->buffer->name) != 0 || !ce_point_in_rect(destination->point, view_rect)){
                    break;
               }
          }
     }

     if(destination){
          if(load_file_into_view(&app->buffer_node_head, command_context.view, &app->config_options, &app->vim,
                                 false, destination->filepath)){
               command_context.view->cursor = destination->point;
          }else{
               ce_clangd_file_open(&app->clangd, app->buffer_node_head->buffer);
               CeBufferNode_t* itr = app->buffer_node_head;
               while(itr){
                    if(strcmp(itr->buffer->name, destination->filepath) == 0){
                         itr->buffer->cursor_save = destination->point;
                         ce_view_switch_buffer(command_context.view, itr->buffer, &app->vim,
                                               &app->config_options, false);
                         break;
                    }
                    itr = itr->next;
               }
          }
     }
     return CE_COMMAND_SUCCESS;
}

// Assembly:
movl $0x2, %eax
cmpq $0x1, 0x208(%rdi)
jne 0x18a09
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %r15
movq 0x200(%rdi), %rcx
cmpl $0x2, (%rcx)
jne 0x189fb
movq %rsi, %r14
movl $0x3, %eax
cmpq $0x0, 0x27f8(%rsi)
jne 0x189fb
movq 0x2818(%r14), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x8(%rax), %rcx
xorl %ebx, %ebx
cmpl $0x0, (%rax)
cmoveq %rcx, %rbx
movq %rbx, %rdi
callq 0xff6e
movq %rax, %r12
movq %rbx, %rdi
callq 0xff76
movq 0x20(%rbx), %rcx
movq %rcx, 0x28(%rsp)
addq %rcx, %r12
movq %r12, 0x30(%rsp)
movq 0x28(%rbx), %rcx
movq %rcx, 0x38(%rsp)
addq %rcx, %rax
movq %rax, 0x40(%rsp)
movq 0x48(%rbx), %r12
movq 0x200(%r15), %rax
movq 0x8(%rax), %r15
leaq 0x17ede(%rip), %rsi     # 0x307dd
movq %r15, %rdi
callq 0xd390
testl %eax, %eax
je 0x18960
movq %r12, %rdi
callq 0x110e3
testq %rax, %rax
je 0x189f9
movq %rax, %r15
movq %rax, %rdi
addq $0x10, %rdi
movq 0x40(%rbx), %rax
movq 0x10(%rax), %rsi
callq 0xd390
testl %eax, %eax
jne 0x189c2
movq (%r15), %rdi
movq 0x8(%r15), %rsi
movups 0x28(%rsp), %xmm0
movups 0x38(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0x10121
testb %al, %al
jne 0x1890b
jmp 0x189c2
leaq 0x17e63(%rip), %rsi     # 0x307ca
movq %r15, %rdi
callq 0xd390
testl %eax, %eax
je 0x189f9
movq %r12, %rdi
callq 0x110a9
testq %rax, %rax
je 0x189f9
movq %rax, %r15
movq %rax, %rdi
addq $0x10, %rdi
movq 0x40(%rbx), %rax
movq 0x10(%rax), %rsi
callq 0xd390
testl %eax, %eax
jne 0x189c2
movq (%r15), %rdi
movq 0x8(%r15), %rsi
movups 0x28(%rsp), %xmm0
movups 0x38(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0x10121
testb %al, %al
jne 0x18977
leaq 0x2828(%r14), %rdi
leaq 0x1a50(%r14), %r12
leaq 0x20(%r14), %r13
leaq 0x10(%r15), %rbp
movq %rbx, %rsi
movq %r12, %rdx
movq %r13, %rcx
xorl %r8d, %r8d
movq %rbp, %r9
callq 0x1169d
testq %rax, %rax
je 0x18a0a
movups (%r15), %xmm0
movups %xmm0, 0x30(%rbx)
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, 0x20(%rsp)
leaq 0x2cd0(%r14), %rdi
movq 0x2828(%r14), %rax
movq (%rax), %rsi
callq 0x15667
movq 0x2828(%r14), %r14
testq %r14, %r14
je 0x189f9
movq (%r14), %r12
movq 0x10(%r12), %rdi
movq %rbp, %rsi
callq 0xd390
testl %eax, %eax
je 0x18a4b
movq 0x8(%r14), %r14
jmp 0x18a2c
movups (%r15), %xmm0
movups %xmm0, 0x20(%r12)
movq (%r14), %rsi
movq %rbx, %rdi
movq %r13, %rdx
movq 0x20(%rsp), %rcx
xorl %r8d, %r8d
callq 0x11135
jmp 0x189f9