// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x1, 0x208(%rax)
je 0x2050d
movl $0x2, -0x4(%rbp)
jmp 0x20802
movq -0x10(%rbp), %rax
movq 0x200(%rax), %rax
cmpl $0x2, (%rax)
je 0x20529
movl $0x2, -0x4(%rbp)
jmp 0x20802
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0xd290
movq -0x20(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x1c5d0
testb $0x1, %al
jne 0x2055e
movl $0x3, -0x4(%rbp)
jmp 0x20802
movq $0x0, -0x38(%rbp)
movq -0x28(%rbp), %rdi
callq 0x119e0
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rdi
callq 0x11a00
movq %rax, -0x48(%rbp)
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
addq -0x40(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rax
addq -0x48(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x28(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x10(%rbp), %rax
movq 0x200(%rax), %rax
movq 0x8(%rax), %rdi
leaq 0x253ce(%rip), %rsi     # 0x459b0
callq 0xd370
cmpl $0x0, %eax
je 0x20662
jmp 0x205ee
movq -0x78(%rbp), %rdi
callq 0x13b80
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
je 0x2065d
movq -0x38(%rbp), %rdi
addq $0x10, %rdi
movq -0x28(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x10(%rax), %rsi
callq 0xd370
cmpl $0x0, %eax
jne 0x20659
movq -0x38(%rbp), %rax
movq (%rax), %rdi
movq 0x8(%rax), %rsi
leaq -0x68(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rcx
movq %rcx, 0x10(%rsp)
movq 0x18(%rax), %rax
movq %rax, 0x18(%rsp)
callq 0x11d80
testb $0x1, %al
jne 0x2065b
jmp 0x2065d
jmp 0x205ee
jmp 0x206f7
movq -0x10(%rbp), %rax
movq 0x200(%rax), %rax
movq 0x8(%rax), %rdi
leaq 0x25325(%rip), %rsi     # 0x4599d
callq 0xd370
cmpl $0x0, %eax
je 0x206f5
jmp 0x20684
movq -0x78(%rbp), %rdi
callq 0x13ae0
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
je 0x206f3
movq -0x38(%rbp), %rdi
addq $0x10, %rdi
movq -0x28(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x10(%rax), %rsi
callq 0xd370
cmpl $0x0, %eax
jne 0x206ef
movq -0x38(%rbp), %rax
movq (%rax), %rdi
movq 0x8(%rax), %rsi
leaq -0x68(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rcx
movq %rcx, 0x10(%rsp)
movq 0x18(%rax), %rax
movq %rax, 0x18(%rsp)
callq 0x11d80
testb $0x1, %al
jne 0x206f1
jmp 0x206f3
jmp 0x20684
jmp 0x206f5
jmp 0x206f7
cmpq $0x0, -0x38(%rbp)
je 0x207fb
movq -0x20(%rbp), %rdi
addq $0x2828, %rdi           # imm = 0x2828
movq -0x28(%rbp), %rsi
movq -0x20(%rbp), %rdx
addq $0x1a50, %rdx           # imm = 0x1A50
movq -0x20(%rbp), %rcx
addq $0x20, %rcx
movq -0x38(%rbp), %r9
addq $0x10, %r9
xorl %r8d, %r8d
callq 0x14420
cmpq $0x0, %rax
je 0x20756
movq -0x28(%rbp), %rax
movq -0x38(%rbp), %rcx
movq (%rcx), %rdx
movq %rdx, 0x30(%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x38(%rax)
jmp 0x207f9
movq -0x20(%rbp), %rdi
addq $0x2cd0, %rdi           # imm = 0x2CD0
movq -0x20(%rbp), %rax
movq 0x2828(%rax), %rax
movq (%rax), %rsi
callq 0x1a760
movq -0x20(%rbp), %rax
movq 0x2828(%rax), %rax
movq %rax, -0x80(%rbp)
cmpq $0x0, -0x80(%rbp)
je 0x207f7
movq -0x80(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rdi
movq -0x38(%rbp), %rsi
addq $0x10, %rsi
callq 0xd370
cmpl $0x0, %eax
jne 0x207e9
movq -0x80(%rbp), %rax
movq (%rax), %rax
movq -0x38(%rbp), %rcx
movq (%rcx), %rdx
movq %rdx, 0x20(%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x28(%rax)
movq -0x28(%rbp), %rdi
movq -0x80(%rbp), %rax
movq (%rax), %rsi
movq -0x20(%rbp), %rdx
addq $0x20, %rdx
movq -0x20(%rbp), %rcx
addq $0x1a50, %rcx           # imm = 0x1A50
xorl %r8d, %r8d
callq 0x13c50
jmp 0x207f7
movq -0x80(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x80(%rbp)
jmp 0x20783
jmp 0x207f9
jmp 0x207fb
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq
nop