// File: /workspace/github_c_makefile_star2_O2/justy989[P]ce/ce_syntax.c
// Function: ce_syntax_highlight_bash
void ce_syntax_highlight_bash(CeView_t* view, CeRangeList_t* highlight_range_list, CeDrawColorList_t* draw_color_list,
                              CeSyntaxDef_t* syntax_defs, void* user_data){
     if(!view->buffer) return;
     if(view->buffer->line_count <= 0) return;
     int64_t min = view->scroll.y;
     int64_t max = min + (view->rect.bottom - view->rect.top);
     int64_t clamp_max = (view->buffer->line_count - 1);
     if(clamp_max < 0) clamp_max = 0;
     CE_CLAMP(min, 0, clamp_max);
     CE_CLAMP(max, 0, clamp_max);
     int64_t match_len = 0;
     bool in_visual = false;
     CeRangeNode_t* range_node = highlight_range_list->head;

     check_visual_start(range_node, min, draw_color_list, syntax_defs, &in_visual);

     for(int64_t y = min; y <= max; ++y){
          char* line = view->buffer->lines[y];
          int64_t line_len = ce_utf8_strlen(line);
          int64_t current_match_len = 1;
          CePoint_t match_point = {0, y};

          ce_syntax_highlight_visual(&range_node, &in_visual, match_point, draw_color_list, syntax_defs);

          if(in_visual && line_len == 0) change_draw_color(draw_color_list, syntax_defs, CE_SYNTAX_COLOR_VISUAL, match_point);

          for(int64_t x = 0; x < line_len; ++x){
               char* str = ce_utf8_iterate_to(line, x);
               match_point.x = x;

               ce_syntax_highlight_visual(&range_node, &in_visual, match_point, draw_color_list, syntax_defs);

               if(current_match_len <= 1){
                    if((match_len = match_bash_keyword(str, line))){
                         change_draw_color(draw_color_list, syntax_defs, CE_SYNTAX_COLOR_KEYWORD, match_point);
                    }else if((match_len = match_caps_var(str, line))){
                         change_draw_color(draw_color_list, syntax_defs, CE_SYNTAX_COLOR_CAPS_VAR, match_point);
                    }else if((match_len = match_python_comment(str))){
                         change_draw_color(draw_color_list, syntax_defs, CE_SYNTAX_COLOR_COMMENT, match_point);
                    }else if((match_len = match_python_string(str))){
                         change_draw_color(draw_color_list, syntax_defs, CE_SYNTAX_COLOR_STRING, match_point);
                    }else if((match_len = match_c_literal(str, line))){
                         change_draw_color(draw_color_list, syntax_defs, CE_SYNTAX_COLOR_NUMBER_LITERAL, match_point);
                    }else if(((view->cursor.y != y) || (x > view->cursor.x)) && (match_len = match_trailing_whitespace(str))){
                         change_draw_color(draw_color_list, syntax_defs, CE_SYNTAX_COLOR_TRAILING_WHITESPACE, match_point);
                         ce_draw_color_list_insert(draw_color_list, ce_syntax_def_get_fg(syntax_defs, CE_SYNTAX_COLOR_NORMAL, CE_COLOR_DEFAULT),
                                                   ce_syntax_def_get_bg(syntax_defs, CE_SYNTAX_COLOR_NORMAL, CE_COLOR_DEFAULT),
                                                   (CePoint_t){0, match_point.y + 1});
                    }else if(!draw_color_list->tail || (draw_color_list->tail->fg != CE_COLOR_DEFAULT || draw_color_list->tail->bg != CE_COLOR_DEFAULT)){
                         change_draw_color(draw_color_list, syntax_defs, CE_SYNTAX_COLOR_NORMAL, match_point);
                    }

                    if(match_len) current_match_len = match_len;
               }else{
                    current_match_len--;
               }

               if(in_visual) change_draw_color(draw_color_list, syntax_defs, CE_SYNTAX_COLOR_VISUAL, match_point);
          }

          check_visual_mode_end(range_node, &in_visual, match_point.y, line_len, draw_color_list);
     }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, 0x28(%rsp)
movq 0x40(%rdi), %rax
testq %rax, %rax
je 0x1fd2b
movq 0x8(%rax), %r14
testq %r14, %r14
jle 0x1fd2b
movq %rcx, %rbx
movq %rdx, %r15
movq 0x28(%rsp), %rdx
movq 0x18(%rdx), %rax
movq 0x28(%rdx), %rcx
subq 0x10(%rdx), %rax
addq %rcx, %rax
decq %r14
cmpq %r14, %rcx
movq %r14, %r12
cmovlq %rcx, %r12
xorl %edx, %edx
testq %rcx, %rcx
cmovsq %rdx, %r12
cmpq %r14, %rax
cmovlq %rax, %r14
testq %rax, %rax
cmovsq %rdx, %r14
leaq 0xf(%rsp), %r8
movb $0x0, (%r8)
movq (%rsi), %rdi
leaq 0x30(%rsp), %rax
movq %rdi, (%rax)
movq %r12, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x1dd92
movq %r14, 0x40(%rsp)
movq %r15, 0x10(%rsp)
cmpq %r14, %r12
jg 0x1fd2b
movq 0x28(%rsp), %rax
movq 0x40(%rax), %rax
movq (%rax), %rax
movq (%rax,%r12,8), %r13
movq %r13, %rdi
callq 0xe38c
movq %rax, %r14
leaq 0x30(%rsp), %rdi
leaq 0xf(%rsp), %rsi
xorl %edx, %edx
movq %r12, %rcx
movq %r15, %r8
movq %rbx, %r9
callq 0x1de28
cmpb $0x1, 0xf(%rsp)
jne 0x1fac1
testq %r14, %r14
jne 0x1fac1
movq %r15, %rdi
movq %rbx, %rsi
pushq $0xc
popq %rdx
xorl %ecx, %ecx
movq %r12, %r8
callq 0x1e564
leaq 0x1(%r12), %rax
movq %rax, 0x38(%rsp)
testq %r14, %r14
movq %r14, 0x48(%rsp)
movl $0x0, %eax
cmovleq %rax, %r14
movq %r14, 0x50(%rsp)
pushq $0x1
popq %r14
xorl %ebp, %ebp
movq %r12, 0x18(%rsp)
movq %r13, 0x20(%rsp)
cmpq %rbp, 0x50(%rsp)
je 0x1fcfd
movq %r13, %rdi
movq %rbp, %rsi
callq 0xe4a6
movq %rax, %r15
leaq 0x30(%rsp), %rdi
leaq 0xf(%rsp), %rsi
movq %rbp, %rdx
movq %r12, %rcx
movq 0x10(%rsp), %r8
movq %rbx, %r9
callq 0x1de28
cmpq $0x1, %r14
jg 0x1fb76
movq %rbx, %r12
movq %r15, %rdi
movq %r13, %rsi
leaq 0x19f03(%rip), %rdx     # 0x39a40
pushq $0x11
popq %rcx
callq 0x204e8
testq %rax, %rax
je 0x1fb7e
movq %rax, %rbx
movq 0x10(%rsp), %rdi
movq %r12, %r15
movq %r12, %rsi
pushq $0x2
popq %rdx
movq %rbp, %rcx
movq 0x18(%rsp), %r12
movq %r12, %r8
callq 0x1e564
movq %rbx, %r14
movq %r15, %rbx
jmp 0x1fc1c
decq %r14
jmp 0x1fc1c
movq %r15, %rdi
movq %r13, %rsi
callq 0x1e66a
testq %rax, %rax
je 0x1fba0
movq %rax, %rbx
movq 0x10(%rsp), %rdi
movq %r12, %r13
movq %r12, %rsi
pushq $0x4
jmp 0x1fc00
movq %r15, %rdi
callq 0x1f974
testq %rax, %rax
je 0x1fbbf
movq %rax, %rbx
movq 0x10(%rsp), %rdi
movq %r12, %r13
movq %r12, %rsi
pushq $0x5
jmp 0x1fc00
movq %r15, %rdi
callq 0x1f980
testq %rax, %rax
je 0x1fbde
movq %rax, %rbx
movq 0x10(%rsp), %rdi
movq %r12, %r13
movq %r12, %rsi
pushq $0x6
jmp 0x1fc00
movq %r15, %rdi
movq 0x20(%rsp), %rsi
callq 0x1e77f
testq %rax, %rax
je 0x1fc41
movq %rax, %rbx
movq 0x10(%rsp), %rdi
movq %r12, %r13
movq %r12, %rsi
pushq $0x8
popq %rdx
movq %rbp, %rcx
movq 0x18(%rsp), %r12
movq %r12, %r8
callq 0x1e564
movq %rbx, %r14
movq %r13, %rbx
movq 0x20(%rsp), %r13
cmpb $0x1, 0xf(%rsp)
jne 0x1fc39
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
pushq $0xc
popq %rdx
movq %rbp, %rcx
movq %r12, %r8
callq 0x1e564
incq %rbp
jmp 0x1faf1
movq 0x28(%rsp), %rax
movq 0x18(%rsp), %rcx
cmpq %rcx, 0x38(%rax)
jne 0x1fc5c
movq 0x28(%rsp), %rax
cmpq 0x30(%rax), %rbp
jle 0x1fcb8
movq %r15, %rdi
callq 0x1e5a1
testq %rax, %rax
je 0x1fcb8
movq %rax, %r13
movq 0x10(%rsp), %r14
movq %r14, %rdi
movq %r12, %rbx
movq %r12, %rsi
pushq $0xb
popq %rdx
movq %rbp, %rcx
movq 0x18(%rsp), %r12
movq %r12, %r8
callq 0x1e564
movl (%rbx), %esi
cmpl $-0x2, %esi
pushq $-0x1
popq %rax
cmovel %eax, %esi
movl 0x4(%rbx), %edx
cmpl $-0x2, %edx
cmovel %eax, %edx
movq %r14, %rdi
xorl %ecx, %ecx
movq 0x38(%rsp), %r8
callq 0x1dadd
movq %r13, %r14
jmp 0x1fc17
movq 0x10(%rsp), %rax
movq 0x8(%rax), %rax
testq %rax, %rax
movq %r12, %rbx
je 0x1fcd4
cmpl $-0x1, (%rax)
jne 0x1fcd4
cmpl $-0x1, 0x4(%rax)
je 0x1fcf3
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
xorl %edx, %edx
movq %rbp, %rcx
movq 0x18(%rsp), %r12
movq %r12, %r8
callq 0x1e564
jmp 0x1fc17
movq 0x18(%rsp), %r12
jmp 0x1fc17
movq 0x30(%rsp), %rdi
leaq 0xf(%rsp), %rsi
movq %r12, %rdx
movq 0x48(%rsp), %rcx
movq 0x10(%rsp), %r15
movq %r15, %r8
callq 0x1df50
movq 0x38(%rsp), %r12
movq 0x40(%rsp), %r14
jmp 0x1fa64
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq