// File: /workspace/github_c_makefile_star2_O2/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:
pushq $0x2
popq %rax
cmpq $0x1, 0x208(%rdi)
jne 0x17f79
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %r15
movq 0x200(%rdi), %rcx
cmpl $0x2, (%rcx)
jne 0x17f6b
movq %rsi, %r14
xorps %xmm0, %xmm0
leaq 0x50(%rsp), %rsi
movaps %xmm0, (%rsi)
movq %r14, %rdi
callq 0x15be9
testb %al, %al
je 0x17e57
movq 0x58(%rsp), %rbx
movq %rbx, %rdi
callq 0xfbf0
movq %rax, %r12
movq %rbx, %rdi
callq 0xfbf8
movq 0x20(%rbx), %rcx
movq %rcx, 0x30(%rsp)
addq %rcx, %r12
movq %r12, 0x38(%rsp)
movq 0x28(%rbx), %rcx
movq %rcx, 0x40(%rsp)
addq %rcx, %rax
movq %rax, 0x48(%rsp)
movq 0x48(%rbx), %r12
movq 0x200(%r15), %rax
movq 0x8(%rax), %r15
leaq 0x15987(%rip), %rsi     # 0x2d77d
movq %r15, %rdi
callq 0xd390
testl %eax, %eax
je 0x17e5f
movq %r12, %rdi
callq 0x10b77
testq %rax, %rax
je 0x17f69
movq %rax, %r15
movq %rax, %rdi
addq $0x10, %rdi
movq 0x40(%rbx), %rax
movq 0x10(%rax), %rsi
callq 0xd390
testl %eax, %eax
jne 0x17ec5
movq (%r15), %rdi
movq 0x8(%r15), %rsi
movups 0x30(%rsp), %xmm0
movups 0x40(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0xfd9a
testb %al, %al
jne 0x17e02
jmp 0x17ec5
pushq $0x3
popq %rax
jmp 0x17f6b
leaq 0x15904(%rip), %rsi     # 0x2d76a
movq %r15, %rdi
callq 0xd390
testl %eax, %eax
je 0x17f69
movq %r12, %rdi
callq 0x10b3d
testq %rax, %rax
je 0x17f69
movq %rax, %r15
movq %rax, %rdi
addq $0x10, %rdi
movq 0x40(%rbx), %rax
movq 0x10(%rax), %rsi
callq 0xd390
testl %eax, %eax
jne 0x17ec5
movq (%r15), %rdi
movq 0x8(%r15), %rsi
movups 0x30(%rsp), %xmm0
movups 0x40(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0xfd9a
testb %al, %al
jne 0x17e76
leaq 0x2828(%r14), %rbp
leaq 0x1a50(%r14), %r13
leaq 0x20(%r14), %rcx
leaq 0x10(%r15), %r12
movq %rbp, %rdi
movq %rbx, %rsi
movq %r13, %rdx
movq %rcx, 0x28(%rsp)
xorl %r8d, %r8d
movq %r12, %r9
callq 0x10fbd
testq %rax, %rax
je 0x17f03
movups (%r15), %xmm0
movups %xmm0, 0x30(%rbx)
jmp 0x17f69
movq %r13, 0x20(%rsp)
movq 0x2828(%r14), %rax
addq $0x2cd0, %r14           # imm = 0x2CD0
movq (%rax), %rsi
movq %r14, %rdi
callq 0x14cd5
movq 0x28(%rsp), %r13
movq (%rbp), %rbp
testq %rbp, %rbp
je 0x17f69
movq (%rbp), %r14
movq 0x10(%r14), %rdi
movq %r12, %rsi
callq 0xd390
testl %eax, %eax
je 0x17f49
addq $0x8, %rbp
jmp 0x17f26
movups (%r15), %xmm0
movups %xmm0, 0x20(%r14)
movq (%rbp), %rsi
movq %rbx, %rdi
movq %r13, %rdx
movq 0x20(%rsp), %rcx
xorl %r8d, %r8d
callq 0x10bc9
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq