// File: /workspace/github_c_makefile_star2_O1/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 0x18f0e
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 0x18f00
movq %rsi, %r14
movq 0x27f8(%rsi), %rcx
testq %rcx, %rcx
je 0x18d89
xorl %ebx, %ebx
jmp 0x18da5
movq 0x2818(%r14), %rax
movq 0x10(%rax), %rax
movq 0x10(%rax), %rax
leaq 0x8(%rax), %rdx
xorl %ebx, %ebx
cmpl $0x0, (%rax)
cmoveq %rdx, %rbx
movl $0x3, %eax
testq %rcx, %rcx
jne 0x18f00
movq %rbx, %rdi
callq 0x100f0
movq %rax, %r12
movq %rbx, %rdi
callq 0x100f8
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 0x18935(%rip), %rsi     # 0x31733
movq %r15, %rdi
callq 0xd390
testl %eax, %eax
je 0x18e5f
movq %r12, %rdi
callq 0x1128d
testq %rax, %rax
je 0x18ebf
movq %rax, %r15
movq %rax, %rdi
addq $0x10, %rdi
movq 0x40(%rbx), %rax
movq 0x10(%rax), %rsi
callq 0xd390
testl %eax, %eax
jne 0x18ec2
movq (%r15), %rdi
movq 0x8(%r15), %rsi
movups 0x28(%rsp), %xmm0
movups 0x38(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0x102c3
testb %al, %al
jne 0x18e0a
jmp 0x18ec2
leaq 0x188ba(%rip), %rsi     # 0x31720
movq %r15, %rdi
callq 0xd390
testl %eax, %eax
je 0x18ebf
movq %r12, %rdi
callq 0x11253
testq %rax, %rax
je 0x18ebf
movq %rax, %r15
movq %rax, %rdi
addq $0x10, %rdi
movq 0x40(%rbx), %rax
movq 0x10(%rax), %rsi
callq 0xd390
testl %eax, %eax
jne 0x18ec2
movq (%r15), %rdi
movq 0x8(%r15), %rsi
movups 0x28(%rsp), %xmm0
movups 0x38(%rsp), %xmm1
movups %xmm1, 0x10(%rsp)
movups %xmm0, (%rsp)
callq 0x102c3
testb %al, %al
jne 0x18e72
jmp 0x18ec2
xorl %r15d, %r15d
testq %r15, %r15
je 0x18efe
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 0x118b2
testq %rax, %rax
je 0x18f0f
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 0x159ff
movq 0x2828(%r14), %r14
testq %r14, %r14
je 0x18efe
movq (%r14), %r12
movq 0x10(%r12), %rdi
movq %rbp, %rsi
callq 0xd390
testl %eax, %eax
je 0x18f50
movq 0x8(%r14), %r14
jmp 0x18f31
movups (%r15), %xmm0
movups %xmm0, 0x20(%r12)
movq (%r14), %rsi
movq %rbx, %rdi
movq %r13, %rdx
movq 0x20(%rsp), %rcx
xorl %r8d, %r8d
callq 0x112df
jmp 0x18efe