// File: /workspace/github_c_makefile_star2_O0/justy989[P]ce/ce_vim.c
// Function: ce_vim_get_indentation
int64_t ce_vim_get_indentation(CeBuffer_t* buffer, CePoint_t point, int64_t tab_length){
     CeAppBufferData_t* buffer_data = buffer->app_data;

     if(buffer_data->syntax_function == ce_syntax_highlight_c ||
        buffer_data->syntax_function == ce_syntax_highlight_cpp ||
        buffer_data->syntax_function == ce_syntax_highlight_java ||
        buffer_data->syntax_function == ce_syntax_highlight_config){
          CeRange_t brace_range = ce_vim_find_pair(buffer, point, '{', false, 0);
          CeRange_t paren_range = ce_vim_find_pair(buffer, point, '(', false, 0);
          if(brace_range.start.x < 0 && paren_range.start.x < 0) return 0;
          int64_t indent = 0;
          if(ce_point_after(paren_range.start, brace_range.start)){
               indent = paren_range.start.x + 1;
          }else{
               indent = ce_vim_soft_begin_line(buffer, brace_range.start.y);
               // if in our indent, we are inside parens, get the indentation of where the parens started
               paren_range = ce_vim_find_pair(buffer, (CePoint_t){indent, brace_range.start.y}, '(', false, 0);
               if(paren_range.start.x >= 0){
                    indent = ce_vim_soft_begin_line(buffer, paren_range.start.y);
               }
               indent += tab_length;
          }
          return indent;
     }else if(buffer_data->syntax_function == ce_syntax_highlight_python){
          for(int64_t y = point.y; y >= 0; --y){
               const char* itr = buffer->lines[y];

               // find previous line that isn't blank
               bool blank = true;

               while(*itr){
                    if(!isblank((int)(*itr))){
                         blank = false;
                         break;
                    }

                    itr++;
               }

               if(blank) continue;

               // use it as indentation unless it ends in a ':'
               int indentation = itr - buffer->lines[y];

               while(*itr) itr++;
               itr--;

               if(*itr == ':') indentation += 5;
               return indentation;
          }
     }

     return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rsi, -0x18(%rbp)
movq %rdx, -0x10(%rbp)
movq %rdi, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq 0x58(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
leaq -0x7a22(%rip), %rcx     # 0x2bb30
cmpq %rcx, 0x600(%rax)
je 0x3359b
movq -0x30(%rbp), %rax
leaq -0x6826(%rip), %rcx     # 0x2cd40
cmpq %rcx, 0x600(%rax)
je 0x3359b
movq -0x30(%rbp), %rax
leaq -0x5dca(%rip), %rcx     # 0x2d7b0
cmpq %rcx, 0x600(%rax)
je 0x3359b
movq -0x30(%rbp), %rax
leaq -0x46de(%rip), %rcx     # 0x2eeb0
cmpq %rcx, 0x600(%rax)
jne 0x336e3
movq -0x20(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x10(%rbp), %rcx
leaq -0x50(%rbp), %rdi
movl $0x7b, %r8d
xorl %r9d, %r9d
movl $0x0, (%rsp)
callq 0x36ca0
movq -0x20(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x10(%rbp), %rcx
leaq -0x70(%rbp), %rdi
movl $0x28, %r8d
xorl %r9d, %r9d
movl $0x0, (%rsp)
callq 0x36ca0
cmpq $0x0, -0x50(%rbp)
jge 0x33600
cmpq $0x0, -0x70(%rbp)
jge 0x33600
movq $0x0, -0x8(%rbp)
jmp 0x3382b
movq $0x0, -0x78(%rbp)
movq -0x70(%rbp), %rdi
movq -0x68(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq -0x48(%rbp), %rcx
callq 0xf690
testb $0x1, %al
jne 0x33623
jmp 0x33634
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x78(%rbp)
jmp 0x336d6
movq -0x20(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x35210
movq %rax, -0x78(%rbp)
movq -0x20(%rbp), %rsi
movq -0x78(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0xa8(%rbp), %rdx
movq -0xa0(%rbp), %rcx
leaq -0x98(%rbp), %rdi
movl $0x28, %r8d
xorl %r9d, %r9d
movl $0x0, (%rsp)
callq 0x36ca0
movq -0x98(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x90(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x70(%rbp)
jl 0x336ca
movq -0x20(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0x35210
movq %rax, -0x78(%rbp)
movq -0x28(%rbp), %rax
addq -0x78(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x3382b
movq -0x30(%rbp), %rax
leaq -0x583e(%rip), %rcx     # 0x2deb0
cmpq %rcx, 0x600(%rax)
jne 0x33821
movq -0x10(%rbp), %rax
movq %rax, -0xb0(%rbp)
cmpq $0x0, -0xb0(%rbp)
jl 0x3381f
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq -0xb0(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xb8(%rbp)
movb $0x1, -0xb9(%rbp)
movq -0xb8(%rbp), %rax
cmpb $0x0, (%rax)
je 0x3377e
callq 0xd700
movq (%rax), %rax
movq -0xb8(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x3376a
movb $0x0, -0xb9(%rbp)
jmp 0x3377e
movq -0xb8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xb8(%rbp)
jmp 0x33734
testb $0x1, -0xb9(%rbp)
je 0x33789
jmp 0x33808
movq -0xb8(%rbp), %rax
movq -0x20(%rbp), %rcx
movq (%rcx), %rcx
movq -0xb0(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
subq %rcx, %rax
movl %eax, -0xc0(%rbp)
movq -0xb8(%rbp), %rax
cmpb $0x0, (%rax)
je 0x337cb
movq -0xb8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xb8(%rbp)
jmp 0x337ab
movq -0xb8(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3a, %eax
jne 0x337fb
movl -0xc0(%rbp), %eax
addl $0x5, %eax
movl %eax, -0xc0(%rbp)
movslq -0xc0(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x3382b
movq -0xb0(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0xb0(%rbp)
jmp 0x33706
jmp 0x33821
jmp 0x33823
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xd0, %rsp
popq %rbp
retq
nopl (%rax,%rax)