// File: /workspace/github_c_makefile_star2_O2/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 %r15
pushq %r14
pushq %rbx
subq $0x30, %rsp
pushq $0x2
popq %rax
cmpq $0x1, 0x208(%rdi)
jne 0x15e13
movq 0x200(%rdi), %r15
cmpl $0x2, (%r15)
jne 0x15e13
movq %rsi, %rbx
leaq 0x8(%rsp), %rsi
andq $0x0, (%rsi)
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rdx
movaps %xmm0, 0x10(%rdx)
movaps %xmm0, (%rdx)
movq 0x2818(%rbx), %rax
movq 0x10(%rax), %r14
movq %r14, %rdi
callq 0x15e3a
testb %al, %al
je 0x15e1d
movq 0x8(%r15), %r15
cmpb $0x75, (%r15)
jne 0x15c98
cmpb $0x70, 0x1(%r15)
jne 0x15c98
cmpb $0x0, 0x2(%r15)
je 0x15d5c
leaq 0x17a5e(%rip), %rsi     # 0x2d6fd
movq %r15, %rdi
callq 0xd390
testl %eax, %eax
je 0x15cd9
leaq 0x17a7e(%rip), %rsi     # 0x2d730
movq %r15, %rdi
callq 0xd390
testl %eax, %eax
je 0x15cfe
leaq 0x17a51(%rip), %rsi     # 0x2d716
movq %r15, %rdi
callq 0xd390
testl %eax, %eax
je 0x15d25
pushq $0x2
popq %rax
jmp 0x15e13
movq 0x8(%rsp), %r15
testq %r15, %r15
je 0x15d4d
movq 0x1a58(%rbx), %rsi
movl 0x1a50(%rbx), %edx
movq %r15, %rdi
callq 0x10ec2
movq 0x18(%r15), %rcx
jmp 0x15d57
movq 0x8(%rsp), %r15
testq %r15, %r15
je 0x15d81
movq 0x1a58(%rbx), %rsi
movl 0x1a50(%rbx), %edx
movq %r15, %rdi
callq 0x10ec2
movq %rdx, %rcx
movq (%r15), %rax
jmp 0x15d8b
movq 0x8(%rsp), %r15
testq %r15, %r15
je 0x15d90
movq 0x1a58(%rbx), %rsi
movl 0x1a50(%rbx), %edx
movq %r15, %rdi
callq 0x10ec2
movq %rdx, %rcx
movq 0x8(%r15), %rax
jmp 0x15d9a
movq 0x10(%rsp), %rax
movq 0x28(%rsp), %rcx
incq %rcx
jmp 0x15dac
movq 0x8(%rsp), %r15
testq %r15, %r15
je 0x15d9f
movq 0x1a58(%rbx), %rsi
movl 0x1a50(%rbx), %edx
movq %r15, %rdi
callq 0x10ec2
movq 0x10(%r15), %rcx
jmp 0x15da9
movq 0x10(%rsp), %rax
movq 0x20(%rsp), %rcx
decq %rax
jmp 0x15dac
movq 0x18(%rsp), %rax
movq 0x20(%rsp), %rcx
incq %rax
jmp 0x15dac
movq 0x10(%rsp), %rax
movq 0x20(%rsp), %rcx
decq %rcx
movslq 0x2700(%rbx), %rdi
cmpq %rdi, %rax
jl 0x15dc0
cqto
idivq %rdi
movq %rdx, %rax
movq %rax, %rsi
sarq $0x3f, %rsi
andq %rdi, %rsi
addq %rax, %rsi
movslq 0x2704(%rbx), %rdi
cmpq %rdi, %rcx
jl 0x15de4
movq %rcx, %rax
cqto
idivq %rdi
movq %rdx, %rcx
movq %rcx, %rdx
sarq $0x3f, %rdx
andq %rdi, %rdx
addq %rcx, %rdx
movq %r14, %rdi
callq 0x1d04c
movq %rax, %rcx
xorl %eax, %eax
testq %rcx, %rcx
je 0x15e13
movq %rcx, 0x10(%r14)
andl $0x0, 0x20(%rbx)
andq $0x0, 0x27f8(%rbx)
addq $0x30, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x16440(%rip), %rdi     # 0x2c264
leaq 0x16450(%rip), %rsi     # 0x2c27b
leaq 0x16457(%rip), %rcx     # 0x2c289
pushq $0x71
popq %rdx
callq 0xd280