// File: /workspace/github_c_makefile_star2_O0/justy989[P]ce/ce_commands.c
// Function: command_goto_next_destination
CeCommandStatus_t command_goto_next_destination(CeCommand_t* command, void* user_data){
     if(command->arg_count != 0) 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;

     CeBuffer_t* buffer = app->last_goto_buffer;
     if(!buffer || buffer->line_count == 0) return CE_COMMAND_SUCCESS;

     CeAppBufferData_t* buffer_data = buffer->app_data;

     int64_t save_destination = buffer_data->last_goto_destination;
     for(int64_t i = buffer_data->last_goto_destination + 1; i != buffer_data->last_goto_destination; i++){
          if(i >= buffer->line_count){
               i = 0;
               if(i == buffer_data->last_goto_destination) break;
          }

          CeDestination_t destination = scan_line_for_destination(buffer->lines[i]);
          if(destination.point.x < 0 || destination.point.y < 0) continue;

          char* base_directory = buffer_base_directory(buffer);
          CeBuffer_t* loaded_buffer = load_destination_into_view(&app->buffer_node_head, command_context.view,
                                                                 &app->config_options, &app->vim,
                                                                 true, base_directory, &destination);
          free(base_directory);
          if(loaded_buffer){
               CeLayout_t* layout = ce_layout_buffer_in_view(command_context.tab_layout, buffer);
               if(layout) layout->view.scroll.y = i;
               buffer_data->last_goto_destination = i;
               break;
          }
     }

     // we didn't find anything, and since the user asked for a destination, find this one
     if(buffer_data->last_goto_destination == save_destination && save_destination < buffer->line_count){
          CeDestination_t destination = scan_line_for_destination(buffer->lines[save_destination]);
          if(destination.point.x >= 0 && destination.point.y >= 0){
               CeLayout_t* layout = ce_layout_buffer_in_view(command_context.tab_layout, buffer);
               if(layout) layout->view.scroll.y = save_destination;
               char* base_directory = buffer_base_directory(buffer);
               load_destination_into_view(&app->buffer_node_head, command_context.view, &app->config_options, &app->vim,
                                          true, base_directory, &destination);
               free(base_directory);
          }
     }

     return CE_COMMAND_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x8a0, %rsp            # imm = 0x8A0
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x208(%rax)
je 0x1f46d
movl $0x2, -0x4(%rbp)
jmp 0x1f720
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 0x1f4a2
movl $0x3, -0x4(%rbp)
jmp 0x1f720
movq -0x20(%rbp), %rax
movq 0x2888(%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x1f4c3
movq -0x38(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x1f4cf
movl $0x0, -0x4(%rbp)
jmp 0x1f720
movq -0x38(%rbp), %rax
movq 0x58(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq 0x5f8(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rax
movq 0x5f8(%rax), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq -0x40(%rbp), %rcx
cmpq 0x5f8(%rcx), %rax
je 0x1f631
movq -0x50(%rbp), %rax
movq -0x38(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jl 0x1f540
movq $0x0, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq -0x40(%rbp), %rcx
cmpq 0x5f8(%rcx), %rax
jne 0x1f53e
jmp 0x1f631
jmp 0x1f540
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq -0x50(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq -0x460(%rbp), %rdi
callq 0x150e0
cmpq $0x0, -0x460(%rbp)
jl 0x1f56f
cmpq $0x0, -0x458(%rbp)
jge 0x1f574
jmp 0x1f620
movq -0x38(%rbp), %rdi
callq 0x149f0
movq %rax, -0x468(%rbp)
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 -0x468(%rbp), %r9
movl $0x1, %r8d
leaq -0x460(%rbp), %rax
movq %rax, (%rsp)
callq 0x17ab0
movq %rax, -0x470(%rbp)
movq -0x468(%rbp), %rdi
callq 0xd090
cmpq $0x0, -0x470(%rbp)
je 0x1f61e
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x2a340
movq %rax, -0x478(%rbp)
cmpq $0x0, -0x478(%rbp)
je 0x1f60d
movq -0x50(%rbp), %rcx
movq -0x478(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x50(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x5f8(%rax)
jmp 0x1f631
jmp 0x1f620
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x1f4fd
movq -0x40(%rbp), %rax
movq 0x5f8(%rax), %rax
cmpq -0x48(%rbp), %rax
jne 0x1f719
movq -0x48(%rbp), %rax
movq -0x38(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jge 0x1f719
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq -0x48(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq -0x888(%rbp), %rdi
callq 0x150e0
cmpq $0x0, -0x888(%rbp)
jl 0x1f717
cmpq $0x0, -0x880(%rbp)
jl 0x1f717
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x2a340
movq %rax, -0x890(%rbp)
cmpq $0x0, -0x890(%rbp)
je 0x1f6bc
movq -0x48(%rbp), %rcx
movq -0x890(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x38(%rbp), %rdi
callq 0x149f0
movq %rax, -0x898(%rbp)
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 -0x898(%rbp), %r9
movl $0x1, %r8d
leaq -0x888(%rbp), %rax
movq %rax, (%rsp)
callq 0x17ab0
movq -0x898(%rbp), %rdi
callq 0xd090
jmp 0x1f719
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x8a0, %rsp            # imm = 0x8A0
popq %rbp
retq
nopl (%rax)