// File: /workspace/github_c_makefile_star2_O3/justy989[P]ce/ce_draw_term.c
// Function: draw_view_status
void _draw_view_status(CeView_t* view, CeVim_t* vim, CeMacros_t* macros,
                       CeColorDefs_t* color_defs, int64_t height_offset, int ui_fg_color, int ui_bg_color){
     // create bottom bar bg
     int64_t bottom = view->rect.bottom + height_offset;
     int color_pair = ce_color_def_get(color_defs, ui_fg_color, ui_bg_color);
     attron(COLOR_PAIR(color_pair));
     int64_t width = (view->rect.right - view->rect.left) + 1;
     move(bottom, view->rect.left);
     for(int64_t i = 0; i < width; ++i){
          addch(' ');
     }

     // set the mode line
     int vim_mode_fg = ui_fg_color;
     const char* vim_mode_string = NULL;

     if(vim){
          switch(vim->mode){
          default:
               break;
          case CE_VIM_MODE_NORMAL:
               vim_mode_string = "NORMAL";
               vim_mode_fg = CE_COLOR_BLUE;
               break;
          case CE_VIM_MODE_INSERT:
               vim_mode_string = "INSERT";
               vim_mode_fg = CE_COLOR_GREEN;
               break;
          case CE_VIM_MODE_VISUAL:
               vim_mode_string = "VISUAL";
               vim_mode_fg = CE_COLOR_YELLOW;
               break;
          case CE_VIM_MODE_VISUAL_LINE:
               vim_mode_string = "VISUAL LINE";
               vim_mode_fg = CE_COLOR_BRIGHT_YELLOW;
               break;
          case CE_VIM_MODE_VISUAL_BLOCK:
               vim_mode_string = "VISUAL BLOCK";
               vim_mode_fg = CE_COLOR_BRIGHT_YELLOW;
               break;
          case CE_VIM_MODE_REPLACE:
               vim_mode_string = "REPLACE";
               vim_mode_fg = CE_COLOR_RED;
               break;
          }
     }

     if(vim_mode_string){
          color_pair = ce_color_def_get(color_defs, vim_mode_fg, ui_bg_color);
          attron(COLOR_PAIR(color_pair));
          mvprintw(bottom, view->rect.left + 1, "%s", vim_mode_string);

          color_pair = ce_color_def_get(color_defs, ui_fg_color, ui_bg_color);
          attron(COLOR_PAIR(color_pair));
          printw(" %s", view->buffer->name);
     }else{
          color_pair = ce_color_def_get(color_defs, ui_fg_color, ui_bg_color);
          attron(COLOR_PAIR(color_pair));
          mvprintw(bottom, view->rect.left + 1, "%s", view->buffer->name);
     }

     const char* status_str = ce_buffer_status_get_str(view->buffer->status);
     if(status_str) printw("%s", status_str);

     if(vim_mode_string && ce_macros_is_recording(macros)){
          printw(" RECORDING %c", macros->recording);
     }

#ifdef ENABLE_DEBUG_KEY_PRESS_INFO
     if(vim_mode_string) printw(" %s %d ", keyname(g_last_key), g_last_key);
#endif

     char cursor_pos_string[32];
     int64_t cursor_pos_string_len = snprintf(cursor_pos_string, 32, "%"PRId64", %"PRId64"", view->cursor.x + 1, view->cursor.y + 1);
     mvprintw(bottom, view->rect.right - (cursor_pos_string_len + 1), "%s", cursor_pos_string);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r8, %r12
movq %rdx, 0x18(%rsp)
movq %rsi, %r15
movq %rdi, %r14
movl 0x80(%rsp), %edx
addl 0x18(%rdi), %r12d
movq %rcx, 0x8(%rsp)
movq %rcx, %rdi
movl %r9d, 0x4(%rsp)
movl %r9d, %esi
callq 0x1fb52
movq 0x1f835(%rip), %rbx     # 0x39f90
movq (%rbx), %rdi
shll $0x8, %eax
movzwl %ax, %esi
xorl %edx, %edx
callq 0xd0f0
movq (%r14), %r13
movq 0x8(%r14), %rbp
movq (%rbx), %rdi
movq %r12, 0x10(%rsp)
movl %r12d, %esi
movl %r13d, %edx
callq 0xd070
subq %r13, %rbp
jl 0x1a79f
incq %rbp
movq (%rbx), %rdi
movl $0x20, %esi
callq 0xd620
decq %rbp
jne 0x1a78d
testq %r15, %r15
je 0x1a857
movl (%r15), %eax
cmpq $0x5, %rax
ja 0x1a857
leaq 0x14f54(%rip), %rcx     # 0x2f710
movl (%rcx,%rax,4), %esi
leaq 0x14f62(%rip), %rcx     # 0x2f728
movslq (%rcx,%rax,4), %r13
addq %rcx, %r13
movq 0x8(%rsp), %r12
movq %r12, %rdi
movl 0x80(%rsp), %edx
callq 0x1fb52
movq (%rbx), %rdi
shll $0x8, %eax
movl $0xffff, %r15d          # imm = 0xFFFF
andl %r15d, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0xd0f0
movl (%r14), %esi
incl %esi
leaq 0x16161(%rip), %rdx     # 0x30966
movq 0x10(%rsp), %rbp
movl %ebp, %edi
movq %r13, %rcx
xorl %eax, %eax
callq 0xd600
movq %r12, %rdi
movl 0x4(%rsp), %esi
movl 0x80(%rsp), %edx
callq 0x1fb52
movq (%rbx), %rdi
shll $0x8, %eax
andl %eax, %r15d
movl %r15d, %esi
xorl %r15d, %r15d
xorl %edx, %edx
callq 0xd0f0
movq 0x40(%r14), %rax
movq 0x10(%rax), %rsi
leaq 0x1450a(%rip), %rdi     # 0x2ed58
xorl %eax, %eax
callq 0xd4d0
jmp 0x1a8a1
movq 0x8(%rsp), %rdi
movl 0x4(%rsp), %esi
movl 0x80(%rsp), %edx
callq 0x1fb52
movq (%rbx), %rdi
shll $0x8, %eax
movzwl %ax, %esi
xorl %edx, %edx
callq 0xd0f0
movl (%r14), %esi
incl %esi
movq 0x40(%r14), %rax
movq 0x10(%rax), %rcx
leaq 0x160d6(%rip), %rdx     # 0x30966
movq 0x10(%rsp), %rbp
movl %ebp, %edi
xorl %eax, %eax
callq 0xd600
movb $0x1, %r15b
movq 0x40(%r14), %rax
movl 0x18(%rax), %edi
callq 0xfd8b
testq %rax, %rax
movq 0x18(%rsp), %rbx
je 0x1a8c8
leaq 0x160a8(%rip), %rdi     # 0x30966
movq %rax, %rsi
xorl %eax, %eax
callq 0xd4d0
testb %r15b, %r15b
jne 0x1a90f
movq %rbx, %rdi
callq 0x1f378
testb %al, %al
je 0x1a8ee
movzbl 0x2f8(%rbx), %esi
leaq 0x14ddf(%rip), %rdi     # 0x2f6c6
xorl %eax, %eax
callq 0xd4d0
leaq 0x22217(%rip), %rbx     # 0x3cb0c
movl (%rbx), %edi
callq 0xd6b0
movl (%rbx), %edx
leaq 0x14dcf(%rip), %rdi     # 0x2f6d4
movq %rax, %rsi
xorl %eax, %eax
callq 0xd4d0
movq 0x30(%r14), %rcx
movq 0x38(%r14), %r8
incq %rcx
incq %r8
leaq 0x14db8(%rip), %rdx     # 0x2f6dc
leaq 0x20(%rsp), %r15
movl $0x20, %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0xd260
notl %eax
addl 0x8(%r14), %eax
leaq 0x16021(%rip), %rdx     # 0x30966
movl %ebp, %edi
movl %eax, %esi
movq %r15, %rcx
xorl %eax, %eax
callq 0xd600
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq