// File: /workspace/github_c_makefile_star2_O0/justy989[P]ce/ce_commands.c
// Function: command_select_adjacent_layout
CeCommandStatus_t command_select_adjacent_layout(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;
     CePoint_t target;
     CeView_t* view = NULL;
     CeRect_t view_rect = {};
     CeLayout_t* tab_layout = app->tab_list_layout->tab_list.current;

     if(!get_view_info_from_tab(tab_layout, &view, &view_rect)){
          assert(!"unknown layout type");
          return CE_COMMAND_FAILURE;
     }

     if(strcmp(command->args[0].string, "up") == 0){
          if(view){
               CePoint_t screen_cursor = view_cursor_on_screen(view, app->config_options.tab_width,
                                                               app->config_options.line_number);
               target = (CePoint_t){screen_cursor.x, view->rect.top - 1};
          }else{
               target = (CePoint_t){view_rect.left, view_rect.top - 1};
          }
     }else if(strcmp(command->args[0].string, "down") == 0){
          if(view){
               CePoint_t screen_cursor = view_cursor_on_screen(view, app->config_options.tab_width,
                                                               app->config_options.line_number);
               target = (CePoint_t){screen_cursor.x, view->rect.bottom + 1};
          }else{
               target = (CePoint_t){view_rect.left, view_rect.bottom + 1};
          }
     }else if(strcmp(command->args[0].string, "left") == 0){
          if(view){
               CePoint_t screen_cursor = view_cursor_on_screen(view, app->config_options.tab_width,
                                                               app->config_options.line_number);
               target = (CePoint_t){view->rect.left - 1, screen_cursor.y};
          }else{
               target = (CePoint_t){view_rect.left - 1, view_rect.top};
          }
     }else if(strcmp(command->args[0].string, "right") == 0){
          if(view){
               CePoint_t screen_cursor = view_cursor_on_screen(view, app->config_options.tab_width,
                                                               app->config_options.line_number);
               target = (CePoint_t){view->rect.right + 1, screen_cursor.y};
          }else{
               target = (CePoint_t){view_rect.right + 1, view_rect.top};
          }
     }else{
          return CE_COMMAND_PRINT_HELP;
     }

     // wrap around
     if(target.x >= app->terminal_width) target.x %= app->terminal_width;
     if(target.x < 0) target.x = app->terminal_width + target.x;
     if(target.y >= app->terminal_height) target.y %= app->terminal_height;
     if(target.y < 0) target.y = app->terminal_height + target.y;

     CeLayout_t* layout = ce_layout_find_at(tab_layout, target);
     if(layout){
          tab_layout->tab.current = layout;
          app->vim.mode = CE_VIM_MODE_NORMAL;
          app->input_complete_func = NULL;
     }

     return CE_COMMAND_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x1, 0x208(%rax)
je 0x1c66d
movl $0x2, -0x4(%rbp)
jmp 0x1cadb
movq -0x10(%rbp), %rax
movq 0x200(%rax), %rax
cmpl $0x2, (%rax)
je 0x1c689
movl $0x2, -0x4(%rbp)
jmp 0x1cadb
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
movq $0x0, -0x38(%rbp)
leaq -0x58(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0xd290
movq -0x20(%rbp), %rax
movq 0x2818(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x58(%rbp), %rdx
callq 0x1caf0
testb $0x1, %al
jne 0x1c6f0
leaq 0x27b0f(%rip), %rdi     # 0x441e7
leaq 0x27b1f(%rip), %rsi     # 0x441fe
movl $0x71, %edx
leaq 0x27b21(%rip), %rcx     # 0x4420c
callq 0xd270
movq -0x10(%rbp), %rax
movq 0x200(%rax), %rax
movq 0x8(%rax), %rdi
leaq 0x29210(%rip), %rsi     # 0x45916
callq 0xd370
cmpl $0x0, %eax
jne 0x1c7a0
cmpq $0x0, -0x38(%rbp)
je 0x1c76b
movq -0x38(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x1a58(%rax), %rsi
movq -0x20(%rbp), %rax
movl 0x1a50(%rax), %edx
callq 0x14260
movq %rax, -0x70(%rbp)
movq %rdx, -0x68(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
subq $0x1, %rax
movq %rax, -0x78(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x1c79b
movq -0x58(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x48(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x88(%rbp)
movq -0x90(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x1c9fd
movq -0x10(%rbp), %rax
movq 0x200(%rax), %rax
movq 0x8(%rax), %rdi
leaq 0x2917a(%rip), %rsi     # 0x45930
callq 0xd370
cmpl $0x0, %eax
jne 0x1c865
cmpq $0x0, -0x38(%rbp)
je 0x1c830
movq -0x38(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x1a58(%rax), %rsi
movq -0x20(%rbp), %rax
movl 0x1a50(%rax), %edx
callq 0x14260
movq %rax, -0xa0(%rbp)
movq %rdx, -0x98(%rbp)
movq -0xa0(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
addq $0x1, %rax
movq %rax, -0xa8(%rbp)
movq -0xb0(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0xa8(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x1c860
movq -0x58(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xb8(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0xb8(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x1c9fb
movq -0x10(%rbp), %rax
movq 0x200(%rax), %rax
movq 0x8(%rax), %rdi
leaq 0x290e8(%rip), %rsi     # 0x45963
callq 0xd370
cmpl $0x0, %eax
jne 0x1c929
cmpq $0x0, -0x38(%rbp)
je 0x1c8f4
movq -0x38(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x1a58(%rax), %rsi
movq -0x20(%rbp), %rax
movl 0x1a50(%rax), %edx
callq 0x14260
movq %rax, -0xd0(%rbp)
movq %rdx, -0xc8(%rbp)
movq -0x38(%rbp), %rax
movq (%rax), %rax
subq $0x1, %rax
movq %rax, -0xe0(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0xe0(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0xd8(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x1c924
movq -0x58(%rbp), %rax
subq $0x1, %rax
movq %rax, -0xf0(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0xf0(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0xe8(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x1c9f9
movq -0x10(%rbp), %rax
movq 0x200(%rax), %rax
movq 0x8(%rax), %rdi
leaq 0x2900a(%rip), %rsi     # 0x45949
callq 0xd370
cmpl $0x0, %eax
jne 0x1c9eb
cmpq $0x0, -0x38(%rbp)
je 0x1c9b9
movq -0x38(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x1a58(%rax), %rsi
movq -0x20(%rbp), %rax
movl 0x1a50(%rax), %edx
callq 0x14260
movq %rax, -0x100(%rbp)
movq %rdx, -0xf8(%rbp)
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
addq $0x1, %rax
movq %rax, -0x110(%rbp)
movq -0xf8(%rbp), %rax
movq %rax, -0x108(%rbp)
movq -0x110(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x108(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x1c9e9
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x120(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x118(%rbp)
movq -0x120(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x118(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x1c9f7
movl $0x2, -0x4(%rbp)
jmp 0x1cadb
jmp 0x1c9f9
jmp 0x1c9fb
jmp 0x1c9fd
movq -0x30(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq 0x2700(%rcx), %rcx
cmpq %rcx, %rax
jl 0x1ca29
movq -0x20(%rbp), %rax
movslq 0x2700(%rax), %rcx
movq -0x30(%rbp), %rax
cqto
idivq %rcx
movq %rdx, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jge 0x1ca43
movq -0x20(%rbp), %rax
movslq 0x2700(%rax), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq 0x2704(%rcx), %rcx
cmpq %rcx, %rax
jl 0x1ca6f
movq -0x20(%rbp), %rax
movslq 0x2704(%rax), %rcx
movq -0x28(%rbp), %rax
cqto
idivq %rcx
movq %rdx, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jge 0x1ca89
movq -0x20(%rbp), %rax
movslq 0x2704(%rax), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x60(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x29d60
movq %rax, -0x128(%rbp)
cmpq $0x0, -0x128(%rbp)
je 0x1cad4
movq -0x128(%rbp), %rcx
movq -0x60(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movl $0x0, 0x20(%rax)
movq -0x20(%rbp), %rax
movq $0x0, 0x27f8(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
nopw (%rax,%rax)