// File: /workspace/github_c_makefile_star2_O3/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 0x1681e
movq 0x200(%rdi), %rax
cmpl $0x2, (%rax)
jne 0x1681e
movq %rsi, %rbx
movq 0x2818(%rsi), %rcx
movq 0x10(%rcx), %rdx
movq 0x10(%rdx), %r12
movl (%r12), %ecx
cmpl $0x2, %ecx
movq %rdx, (%rsp)
je 0x16689
cmpl $0x1, %ecx
je 0x16677
testl %ecx, %ecx
jne 0x1682f
addq $0x8, %r12
xorl %r13d, %r13d
xorl %ecx, %ecx
xorl %r15d, %r15d
xorl %edx, %edx
jmp 0x1669c
movq 0x20(%rdx), %r13
movq 0x28(%rdx), %rcx
movq 0x30(%rdx), %r15
movq 0x38(%rdx), %rdx
jmp 0x16699
movq 0x18(%rdx), %r13
movq 0x20(%rdx), %rcx
movq 0x28(%rdx), %r15
movq 0x30(%rdx), %rdx
xorl %r12d, %r12d
movq 0x8(%rax), %r14
cmpb $0x75, (%r14)
jne 0x166b8
cmpb $0x70, 0x1(%r14)
jne 0x166b8
cmpb $0x0, 0x2(%r14)
je 0x1677e
movq %rdx, 0x10(%rsp)
movq %rcx, 0x8(%rsp)
leaq 0x1a094(%rip), %rsi     # 0x3075d
movq %r14, %rdi
callq 0xd390
testl %eax, %eax
je 0x1672a
leaq 0x1a0b4(%rip), %rsi     # 0x30790
movq %r14, %rdi
callq 0xd390
testl %eax, %eax
je 0x1674e
leaq 0x1a087(%rip), %rsi     # 0x30776
movq %r14, %rdi
callq 0xd390
testl %eax, %eax
jne 0x1681e
testq %r12, %r12
je 0x167a5
movq 0x1a58(%rbx), %rsi
movl 0x1a50(%rbx), %edx
movq %r12, %rdi
callq 0x1159f
movq %rdx, %r15
movq 0x8(%r12), %r13
jmp 0x167aa
testq %r12, %r12
je 0x16774
movq 0x1a58(%rbx), %rsi
movl 0x1a50(%rbx), %edx
movq %r12, %rdi
callq 0x1159f
movq %rax, %r13
movq 0x18(%r12), %r15
jmp 0x16779
testq %r12, %r12
je 0x1676f
movq 0x1a58(%rbx), %rsi
movl 0x1a50(%rbx), %edx
movq %r12, %rdi
callq 0x1159f
movq %rdx, %r15
movq (%r12), %r13
decq %r13
jmp 0x167ad
movq 0x10(%rsp), %r15
incq %r15
jmp 0x167ad
testq %r12, %r12
je 0x167a0
movq 0x1a58(%rbx), %rsi
movl 0x1a50(%rbx), %edx
movq %r12, %rdi
callq 0x1159f
movq %rax, %r13
movq 0x10(%r12), %r15
decq %r15
jmp 0x167ad
movq 0x8(%rsp), %r13
incq %r13
movq (%rsp), %r14
movslq 0x2700(%rbx), %rcx
cmpq %rcx, %r13
jl 0x167c8
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 0x167ec
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 0x1ede6
xorl %ebp, %ebp
testq %rax, %rax
je 0x1681e
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 0x18a2e(%rip), %rdi     # 0x2f264
leaq 0x18a3e(%rip), %rsi     # 0x2f27b
leaq 0x18a45(%rip), %rcx     # 0x2f289
movl $0x71, %edx
callq 0xd280