// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl $0x2, %ebp
cmpq $0x1, 0x208(%rdi)
jne 0x16c02
movq 0x200(%rdi), %rax
cmpl $0x2, (%rax)
jne 0x16c02
movq %rsi, %rbx
movq 0x2818(%rsi), %rcx
movq 0x10(%rcx), %rdx
movq 0x10(%rdx), %r12
movl (%r12), %ecx
cmpl $0x2, %ecx
je 0x16a3d
cmpl $0x1, %ecx
je 0x16a26
testl %ecx, %ecx
jne 0x16a5e
addq $0x8, %r12
movb $0x1, %cl
xorl %r13d, %r13d
movq $0x0, 0x8(%rsp)
xorl %r15d, %r15d
movq $0x0, 0x10(%rsp)
jmp 0x16a7b
movq 0x20(%rdx), %r13
movq 0x28(%rdx), %rcx
movq %rcx, 0x8(%rsp)
movq 0x30(%rdx), %r15
movq 0x38(%rdx), %rcx
jmp 0x16a52
movq 0x18(%rdx), %r13
movq 0x20(%rdx), %rcx
movq %rcx, 0x8(%rsp)
movq 0x28(%rdx), %r15
movq 0x30(%rdx), %rcx
movq %rcx, 0x10(%rsp)
movb $0x1, %cl
xorl %r12d, %r12d
jmp 0x16a7b
xorl %r12d, %r12d
xorl %r13d, %r13d
movq $0x0, 0x8(%rsp)
xorl %r15d, %r15d
movq $0x0, 0x10(%rsp)
xorl %ecx, %ecx
movq %rdx, (%rsp)
testb %cl, %cl
je 0x16c13
movq 0x8(%rax), %r14
leaq 0x1ac07(%rip), %rsi     # 0x31699
movq %r14, %rdi
callq 0xd390
testl %eax, %eax
je 0x16b0e
leaq 0x1ac0e(%rip), %rsi     # 0x316b3
movq %r14, %rdi
callq 0xd390
testl %eax, %eax
je 0x16b35
leaq 0x1ac2a(%rip), %rsi     # 0x316e6
movq %r14, %rdi
callq 0xd390
testl %eax, %eax
je 0x16b59
leaq 0x1abf9(%rip), %rsi     # 0x316cc
movq %r14, %rdi
callq 0xd390
testl %eax, %eax
jne 0x16c02
testq %r12, %r12
je 0x16b89
movq 0x1a58(%rbx), %rsi
movl 0x1a50(%rbx), %edx
movq %r12, %rdi
callq 0x117a6
movq %rdx, %r15
movq 0x8(%r12), %r13
jmp 0x16b8e
testq %r12, %r12
je 0x16b30
movq 0x1a58(%rbx), %rsi
movl 0x1a50(%rbx), %edx
movq %r12, %rdi
callq 0x117a6
movq %rax, %r13
movq 0x10(%r12), %r15
decq %r15
jmp 0x16b91
testq %r12, %r12
je 0x16b7f
movq 0x1a58(%rbx), %rsi
movl 0x1a50(%rbx), %edx
movq %r12, %rdi
callq 0x117a6
movq %rax, %r13
movq 0x18(%r12), %r15
jmp 0x16b84
testq %r12, %r12
je 0x16b7a
movq 0x1a58(%rbx), %rsi
movl 0x1a50(%rbx), %edx
movq %r12, %rdi
callq 0x117a6
movq %rdx, %r15
movq (%r12), %r13
decq %r13
jmp 0x16b91
movq 0x10(%rsp), %r15
incq %r15
jmp 0x16b91
movq 0x8(%rsp), %r13
incq %r13
movq (%rsp), %r14
movslq 0x2700(%rbx), %rcx
cmpq %rcx, %r13
jl 0x16bac
movq %r13, %rax
cqto
idivq %rcx
movq %rdx, %r13
movq %r13, %rsi
sarq $0x3f, %rsi
andq %rcx, %rsi
addq %r13, %rsi
movslq 0x2704(%rbx), %rcx
cmpq %rcx, %r15
jl 0x16bd0
movq %r15, %rax
cqto
idivq %rcx
movq %rdx, %r15
movq %r15, %rdx
sarq $0x3f, %rdx
andq %rcx, %rdx
addq %r15, %rdx
movq %r14, %rdi
callq 0x1ed8e
xorl %ebp, %ebp
testq %rax, %rax
je 0x16c02
movq %rax, 0x10(%r14)
movl $0x0, 0x20(%rbx)
movq $0x0, 0x27f8(%rbx)
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1964a(%rip), %rdi     # 0x30264
leaq 0x1965a(%rip), %rsi     # 0x3027b
leaq 0x19661(%rip), %rcx     # 0x30289
movl $0x71, %edx
callq 0xd280