// File: /workspace/github_c_makefile_star2_O0/justy989[P]ce/ce_syntax.c
// Function: ce_syntax_highlight_c
void ce_syntax_highlight_c(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 multiline_comment = false;
     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);

     int prepass_min = min - SEARCH_BACK_LINES;
     if(prepass_min < 0) prepass_min = 0;

     // pre-pass to check if we are in a multiline comment
     for(int64_t y = prepass_min; y < min; y++){
          char* line = view->buffer->lines[y];
          int64_t line_len = ce_utf8_strlen(line);

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

               if(multiline_comment){
                    if(match_c_multiline_comment_end(str)){
                         multiline_comment = false;
                    }
               }else{
                    if((match_len = match_c_multiline_comment(str))){
                         multiline_comment = true;
                         x += (match_len - 1);
                    }
               }
          }
     }

     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};

          if(multiline_comment){
               change_draw_color(draw_color_list, syntax_defs, CE_SYNTAX_COLOR_COMMENT, match_point);
          }

          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(multiline_comment){
                         if((match_len = match_c_multiline_comment_end(str))){
                              multiline_comment = false;
                         }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((match_len = match_c_type(str, line, false))){
                              change_draw_color(draw_color_list, syntax_defs, CE_SYNTAX_COLOR_TYPE, match_point);
                         }else if((match_len = match_c_keyword(str, line))){
                              change_draw_color(draw_color_list, syntax_defs, CE_SYNTAX_COLOR_KEYWORD, match_point);
                         }else if((match_len = match_c_control(str, line))){
                              change_draw_color(draw_color_list, syntax_defs, CE_SYNTAX_COLOR_CONTROL, 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_c_comment(str))){
                              change_draw_color(draw_color_list, syntax_defs, CE_SYNTAX_COLOR_COMMENT, match_point);
                         }else if((match_len = match_c_string(str))){
                              change_draw_color(draw_color_list, syntax_defs, CE_SYNTAX_COLOR_STRING, match_point);
                         }else if((match_len = match_c_character_literal(str))){
                              change_draw_color(draw_color_list, syntax_defs, CE_SYNTAX_COLOR_CHAR_LITERAL, 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((match_len = match_c_preproc(str))){
                              change_draw_color(draw_color_list, syntax_defs, CE_SYNTAX_COLOR_PREPROCESSOR, match_point);
                         }else if((match_len = match_c_multiline_comment(str))){
                              change_draw_color(draw_color_list, syntax_defs, CE_SYNTAX_COLOR_COMMENT, match_point);
                              multiline_comment = true;
                         }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
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x40(%rax)
jne 0x2bb5f
jmp 0x2c412
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
cmpq $0x0, 0x8(%rax)
jg 0x2bb73
jmp 0x2c412
movq -0x8(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x18(%rcx), %rcx
movq -0x8(%rbp), %rdx
subq 0x10(%rdx), %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x8(%rax), %rax
subq $0x1, %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jge 0x2bbbd
movq $0x0, -0x40(%rbp)
cmpq $0x0, -0x30(%rbp)
jge 0x2bbcf
xorl %eax, %eax
movq %rax, -0xf0(%rbp)
jmp 0x2bbff
movq -0x30(%rbp), %rax
cmpq -0x40(%rbp), %rax
jle 0x2bbe6
movq -0x40(%rbp), %rax
movq %rax, -0xf8(%rbp)
jmp 0x2bbf1
movq -0x30(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0xf8(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0xf0(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x38(%rbp)
jge 0x2bc1c
xorl %eax, %eax
movq %rax, -0x100(%rbp)
jmp 0x2bc4c
movq -0x38(%rbp), %rax
cmpq -0x40(%rbp), %rax
jle 0x2bc33
movq -0x40(%rbp), %rax
movq %rax, -0x108(%rbp)
jmp 0x2bc3e
movq -0x38(%rbp), %rax
movq %rax, -0x108(%rbp)
movq -0x108(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0x100(%rbp), %rax
movq %rax, -0x38(%rbp)
movq $0x0, -0x48(%rbp)
movb $0x0, -0x49(%rbp)
movb $0x0, -0x4a(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
leaq -0x4a(%rbp), %r8
callq 0x2b7f0
movq -0x30(%rbp), %rax
subq $0x400, %rax            # imm = 0x400
movl %eax, -0x5c(%rbp)
cmpl $0x0, -0x5c(%rbp)
jge 0x2bca5
movl $0x0, -0x5c(%rbp)
movslq -0x5c(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
cmpq -0x30(%rbp), %rax
jge 0x2bd72
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq (%rax), %rax
movq -0x68(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rdi
callq 0xea70
movq %rax, -0x78(%rbp)
movq $0x0, -0x80(%rbp)
movq -0x80(%rbp), %rax
cmpq -0x78(%rbp), %rax
jge 0x2bd5f
movq -0x70(%rbp), %rdi
movq -0x80(%rbp), %rsi
callq 0xeca0
movq %rax, -0x88(%rbp)
testb $0x1, -0x49(%rbp)
je 0x2bd23
movq -0x88(%rbp), %rdi
callq 0x2c420
cmpq $0x0, %rax
je 0x2bd21
movb $0x0, -0x49(%rbp)
jmp 0x2bd4f
movq -0x88(%rbp), %rdi
callq 0x2c470
movq %rax, -0x48(%rbp)
cmpq $0x0, %rax
je 0x2bd4d
movb $0x1, -0x49(%rbp)
movq -0x48(%rbp), %rax
subq $0x1, %rax
addq -0x80(%rbp), %rax
movq %rax, -0x80(%rbp)
jmp 0x2bd4f
jmp 0x2bd51
movq -0x80(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x80(%rbp)
jmp 0x2bce7
jmp 0x2bd61
movq -0x68(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
jmp 0x2bcad
movq -0x30(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rax
cmpq -0x38(%rbp), %rax
jg 0x2c412
movq -0x8(%rbp), %rax
movq 0x40(%rax), %rax
movq (%rax), %rax
movq -0x90(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rdi
callq 0xea70
movq %rax, -0xa0(%rbp)
movq $0x1, -0xa8(%rbp)
movq $0x0, -0xb8(%rbp)
movq -0x90(%rbp), %rax
movq %rax, -0xb0(%rbp)
testb $0x1, -0x49(%rbp)
je 0x2be08
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0xb8(%rbp), %rcx
movq -0xb0(%rbp), %r8
movl $0x5, %edx
callq 0x2c4f0
movq -0x18(%rbp), %r8
movq -0x20(%rbp), %r9
movq -0xb8(%rbp), %rdx
movq -0xb0(%rbp), %rcx
leaq -0x58(%rbp), %rdi
leaq -0x4a(%rbp), %rsi
callq 0x2b8e0
testb $0x1, -0x4a(%rbp)
je 0x2be5b
cmpq $0x0, -0xa0(%rbp)
jne 0x2be5b
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0xb8(%rbp), %rcx
movq -0xb0(%rbp), %r8
movl $0xc, %edx
callq 0x2c4f0
movq $0x0, -0xc0(%rbp)
movq -0xc0(%rbp), %rax
cmpq -0xa0(%rbp), %rax
jge 0x2c3dc
movq -0x98(%rbp), %rdi
movq -0xc0(%rbp), %rsi
callq 0xeca0
movq %rax, -0xc8(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x18(%rbp), %r8
movq -0x20(%rbp), %r9
movq -0xb8(%rbp), %rdx
movq -0xb0(%rbp), %rcx
leaq -0x58(%rbp), %rdi
leaq -0x4a(%rbp), %rsi
callq 0x2b8e0
cmpq $0x1, -0xa8(%rbp)
jg 0x2c38b
testb $0x1, -0x49(%rbp)
je 0x2bfd3
movq -0xc8(%rbp), %rdi
callq 0x2c420
movq %rax, -0x48(%rbp)
cmpq $0x0, %rax
je 0x2befc
movb $0x0, -0x49(%rbp)
jmp 0x2bfce
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
cmpq -0x90(%rbp), %rax
jne 0x2bf22
movq -0xc0(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x30(%rcx), %rax
jle 0x2bfcc
movq -0xc8(%rbp), %rdi
callq 0x2c580
movq %rax, -0x48(%rbp)
cmpq $0x0, %rax
je 0x2bfcc
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0xb8(%rbp), %rcx
movq -0xb0(%rbp), %r8
movl $0xb, %edx
callq 0x2c4f0
movq -0x18(%rbp), %rax
movq %rax, -0x118(%rbp)
movq -0x20(%rbp), %rdi
xorl %esi, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2b180
movl %eax, -0x10c(%rbp)
movq -0x20(%rbp), %rdi
xorl %esi, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2b1c0
movq -0x118(%rbp), %rdi
movl -0x10c(%rbp), %esi
movl %eax, %edx
movq $0x0, -0xd8(%rbp)
movq -0xb0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xd0(%rbp)
movq -0xd8(%rbp), %rcx
movq -0xd0(%rbp), %r8
callq 0x2b200
jmp 0x2bfce
jmp 0x2c377
movq -0xc8(%rbp), %rdi
movq -0x98(%rbp), %rsi
xorl %edx, %edx
callq 0x2c5f0
movq %rax, -0x48(%rbp)
cmpq $0x0, %rax
je 0x2c017
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0xb8(%rbp), %rcx
movq -0xb0(%rbp), %r8
movl $0x1, %edx
callq 0x2c4f0
jmp 0x2c375
movq -0xc8(%rbp), %rdi
movq -0x98(%rbp), %rsi
callq 0x2c730
movq %rax, -0x48(%rbp)
cmpq $0x0, %rax
je 0x2c059
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0xb8(%rbp), %rcx
movq -0xb0(%rbp), %r8
movl $0x2, %edx
callq 0x2c4f0
jmp 0x2c373
movq -0xc8(%rbp), %rdi
movq -0x98(%rbp), %rsi
callq 0x2c760
movq %rax, -0x48(%rbp)
cmpq $0x0, %rax
je 0x2c09b
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0xb8(%rbp), %rcx
movq -0xb0(%rbp), %r8
movl $0x3, %edx
callq 0x2c4f0
jmp 0x2c371
movq -0xc8(%rbp), %rdi
movq -0x98(%rbp), %rsi
callq 0x2c790
movq %rax, -0x48(%rbp)
cmpq $0x0, %rax
je 0x2c0dd
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0xb8(%rbp), %rcx
movq -0xb0(%rbp), %r8
movl $0x4, %edx
callq 0x2c4f0
jmp 0x2c36f
movq -0xc8(%rbp), %rdi
callq 0x2c880
movq %rax, -0x48(%rbp)
cmpq $0x0, %rax
je 0x2c118
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0xb8(%rbp), %rcx
movq -0xb0(%rbp), %r8
movl $0x5, %edx
callq 0x2c4f0
jmp 0x2c36d
movq -0xc8(%rbp), %rdi
callq 0x2c8d0
movq %rax, -0x48(%rbp)
cmpq $0x0, %rax
je 0x2c153
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0xb8(%rbp), %rcx
movq -0xb0(%rbp), %r8
movl $0x6, %edx
callq 0x2c4f0
jmp 0x2c36b
movq -0xc8(%rbp), %rdi
callq 0x2c950
movq %rax, -0x48(%rbp)
cmpq $0x0, %rax
je 0x2c18e
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0xb8(%rbp), %rcx
movq -0xb0(%rbp), %r8
movl $0x7, %edx
callq 0x2c4f0
jmp 0x2c369
movq -0xc8(%rbp), %rdi
movq -0x98(%rbp), %rsi
callq 0x2ca00
movq %rax, -0x48(%rbp)
cmpq $0x0, %rax
je 0x2c1d0
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0xb8(%rbp), %rcx
movq -0xb0(%rbp), %r8
movl $0x8, %edx
callq 0x2c4f0
jmp 0x2c367
movq -0xc8(%rbp), %rdi
callq 0x2ccc0
movq %rax, -0x48(%rbp)
cmpq $0x0, %rax
je 0x2c20b
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0xb8(%rbp), %rcx
movq -0xb0(%rbp), %r8
movl $0xa, %edx
callq 0x2c4f0
jmp 0x2c365
movq -0xc8(%rbp), %rdi
callq 0x2c470
movq %rax, -0x48(%rbp)
cmpq $0x0, %rax
je 0x2c24a
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0xb8(%rbp), %rcx
movq -0xb0(%rbp), %r8
movl $0x5, %edx
callq 0x2c4f0
movb $0x1, -0x49(%rbp)
jmp 0x2c363
movq -0x8(%rbp), %rax
movq 0x38(%rax), %rax
cmpq -0x90(%rbp), %rax
jne 0x2c270
movq -0xc0(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq 0x30(%rcx), %rax
jle 0x2c31c
movq -0xc8(%rbp), %rdi
callq 0x2c580
movq %rax, -0x48(%rbp)
cmpq $0x0, %rax
je 0x2c31c
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0xb8(%rbp), %rcx
movq -0xb0(%rbp), %r8
movl $0xb, %edx
callq 0x2c4f0
movq -0x18(%rbp), %rax
movq %rax, -0x128(%rbp)
movq -0x20(%rbp), %rdi
xorl %esi, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2b180
movl %eax, -0x11c(%rbp)
movq -0x20(%rbp), %rdi
xorl %esi, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x2b1c0
movq -0x128(%rbp), %rdi
movl -0x11c(%rbp), %esi
movl %eax, %edx
movq $0x0, -0xe8(%rbp)
movq -0xb0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xe0(%rbp)
movq -0xe8(%rbp), %rcx
movq -0xe0(%rbp), %r8
callq 0x2b200
jmp 0x2c361
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x2c342
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $-0x1, (%rax)
jne 0x2c342
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $-0x1, 0x4(%rax)
je 0x2c35f
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0xb8(%rbp), %rcx
movq -0xb0(%rbp), %r8
xorl %edx, %edx
callq 0x2c4f0
jmp 0x2c361
jmp 0x2c363
jmp 0x2c365
jmp 0x2c367
jmp 0x2c369
jmp 0x2c36b
jmp 0x2c36d
jmp 0x2c36f
jmp 0x2c371
jmp 0x2c373
jmp 0x2c375
jmp 0x2c377
cmpq $0x0, -0x48(%rbp)
je 0x2c389
movq -0x48(%rbp), %rax
movq %rax, -0xa8(%rbp)
jmp 0x2c39d
movq -0xa8(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0xa8(%rbp)
testb $0x1, -0x4a(%rbp)
je 0x2c3c3
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0xb8(%rbp), %rcx
movq -0xb0(%rbp), %r8
movl $0xc, %edx
callq 0x2c4f0
jmp 0x2c3c5
movq -0xc0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xc0(%rbp)
jmp 0x2be66
movq -0x58(%rbp), %rdi
movq -0xb0(%rbp), %rdx
movq -0xa0(%rbp), %rcx
movq -0x18(%rbp), %r8
leaq -0x4a(%rbp), %rsi
callq 0x2ba90
movq -0x90(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x90(%rbp)
jmp 0x2bd7d
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
nopl (%rax,%rax)