// File: /workspace/github_c_makefile_star2_O3/heltilda[P]cicada/ccmain.c
// Function: printError
void printError(char *errFileName, ccInt errFileNameLength, char *errText, ccInt errCharNum, ccBool forceLineNo)
{
    
        // print the error/warning message, if there is one
    
    if (errCode != passed)  {
        if ((errCode < passed) || (errCode > finished_signal))  printf("Unknown error #%i\n", (int) errCode);
        else if ((errCode == return_flag) || (errCode == finished_signal))  return;
        else if (errCode == token_expected_err)  printf("Error:  '%s' expected", expectedTokenName);
        else if (errCode != member_not_found_err)  printf("Error:  %s", errorStrings[errCode]);
        else  {
            const char *defaultMemberName = "";
            char *memberName = (char *) defaultMemberName;
            ccInt soughtMember = *(errScript.code_ptr + errIndex - 1);
            
            if ((soughtMember >= 1) && (soughtMember <= currentCompiler->varNames.elementNum))  {
                memberName = ((varNameType *) element(&(currentCompiler->varNames), soughtMember))->theName;    }
            
            printf("Error:  member '%s' not found", memberName);
    }   }
    
    else if (warningCode != passed)  {
        if ((warningCode < passed) || (warningCode > finished_signal))  printf("Unknown warning #%i\n", (int) warningCode);
        printf("Warning:  %s", errorStrings[warningCode]);
        warningCode = passed;          }
    
    else  return;
    
    
        // print the file that caused the error, if its name was recorded
    
    if (errFileName != NULL)  {
        if (errFileNameLength < 0)  printf(" in file %s", errFileName);
        else  printf(" in file %.*s", errFileNameLength, errFileName);      }
    printf("\n");
    
    
        // if we have the source text, flag the line that caused the error
    
    if (errText != NULL)  {
        
        ccInt lineNo = 1, loopChar, lineBeginningChar, lineEndChar;
        int numLineNoChars;
        
        lineBeginningChar = lineEndChar = errCharNum;
        
        while ((errText[lineBeginningChar] != '\n') && (lineBeginningChar > 0))  lineBeginningChar--;
        if (errText[lineBeginningChar] == '\n')  lineBeginningChar++;
        
        while ((errText[lineEndChar] != '\n') && (errText[lineEndChar] != '\x00'))  lineEndChar++;
        if (errText[lineEndChar] == '\n')  lineEndChar--;
        
        printf("\n");
        
        
            // calculate and print out the line number (if we have a file name)
        
        if ((errFileName == NULL) && (!forceLineNo))  numLineNoChars = 0;
        else  {
            
            for (loopChar = 0; loopChar < lineBeginningChar; loopChar++)  {
            if (errText[loopChar] == '\n')  {
                lineNo++;
            }}
            
            printf("%i:  %n", (int) lineNo, &numLineNoChars);         }
        
        
            // .. and the line in the script that caused it..
        
        for (loopChar = lineBeginningChar; loopChar <= lineEndChar; loopChar++)  {
        if (lettertype(errText + loopChar) != unprintable)  {
            if (errText[loopChar] == '\t')  printf(" ");
            else  printf("%c", errText[loopChar]);
        }}
        printf("\n");
        
        
            // .. and finally a marker indicating the offending character in the line.
        
        for (loopChar = 1; loopChar <= (ccInt) numLineNoChars; loopChar++)  {
            printf(" ");        }
        
        for (loopChar = lineBeginningChar; loopChar < errCharNum; loopChar++)  {
        if (lettertype(errText + loopChar) != unprintable)  {
            printf(" ");
        }}
        printf("^\n");        }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r8d, %ebp
movl %ecx, %r15d
movq %rdx, %rbx
movl %esi, %r12d
movq %rdi, %r14
leaq 0xb505(%rip), %r13      # 0x25760
movl 0x18(%r13), %esi
testq %rsi, %rsi
je 0x1a27c
cmpl $0x34, %esi
jb 0x1a2c8
leaq 0x2000(%rip), %rdi      # 0x1c270
xorl %eax, %eax
callq 0x8050
jmp 0x1a351
movl 0x20(%r13), %esi
testl %esi, %esi
je 0x1a50e
cmpl $0x34, %esi
jb 0x1a29f
leaq 0x202e(%rip), %rdi      # 0x1c2c2
xorl %eax, %eax
callq 0x8050
movl 0x20(%r13), %esi
movslq %esi, %rax
leaq 0xae57(%rip), %rcx      # 0x25100
movq (%rcx,%rax,8), %rsi
leaq 0x2023(%rip), %rdi      # 0x1c2d7
xorl %eax, %eax
callq 0x8050
movl $0x0, 0x20(%r13)
jmp 0x1a351
movl %esi, %eax
andl $0x3e, %eax
cmpl $0x32, %eax
je 0x1a50e
cmpq $0x17, %rsi
je 0x1a2f5
cmpl $0xb, %esi
jne 0x1a338
leaq 0xafb8(%rip), %rax      # 0x252a0
movq 0x10(%rax), %rsi
leaq 0x1f90(%rip), %rdi      # 0x1c283
jmp 0x1a34a
movq 0x38(%r13), %rax
movslq 0x1c(%r13), %rcx
movl -0x4(%rax,%rcx,4), %eax
leaq 0xde0(%rip), %rsi       # 0x1b0e8
testl %eax, %eax
jle 0x1a32f
leaq 0xaf8d(%rip), %rcx      # 0x252a0
movq (%rcx), %rdi
cmpl 0x14a0(%rdi), %eax
jg 0x1a32f
addq $0x14a0, %rdi           # imm = 0x14A0
movl %eax, %esi
callq 0x91d8
movq (%rax), %rsi
leaq 0x1f6e(%rip), %rdi      # 0x1c2a4
jmp 0x1a34a
leaq 0xadc1(%rip), %rax      # 0x25100
movq (%rax,%rsi,8), %rsi
leaq 0x1f4f(%rip), %rdi      # 0x1c299
xorl %eax, %eax
callq 0x8050
testq %r14, %r14
je 0x1a382
testl %r12d, %r12d
js 0x1a371
leaq 0x1f8e(%rip), %rdi      # 0x1c2f0
movl %r12d, %esi
movq %r14, %rdx
xorl %eax, %eax
callq 0x8050
jmp 0x1a382
leaq 0x1f6c(%rip), %rdi      # 0x1c2e4
movq %r14, %rsi
xorl %eax, %eax
callq 0x8050
movl $0xa, %edi
callq 0x81e0
testq %rbx, %rbx
je 0x1a50e
movl %r15d, %esi
movslq %r15d, %rax
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movq %rax, %rcx
movb (%rbx,%rcx), %dl
incl %r15d
testq %rcx, %rcx
jle 0x1a3b7
decq %rcx
cmpb $0xa, %dl
jne 0x1a3a4
xorl %ecx, %ecx
cmpb $0xa, %dl
sete %cl
movq %rcx, 0x8(%rsp)
leal (%rax,%rcx), %r13d
subl %r15d, %r13d
addq %rbx, %rax
xorl %ecx, %ecx
movzbl (%rax,%rcx), %edx
testl %edx, %edx
je 0x1a3e2
cmpl $0xa, %edx
je 0x1a3e2
incq %rcx
jmp 0x1a3d0
testq %r14, %r14
movl %ebp, %r12d
sete %bpl
xorl %eax, %eax
cmpb $0xa, %dl
sete %al
negl %eax
movq %rsi, 0x10(%rsp)
movq %rsi, %r14
addq %rcx, %r14
addq %rax, %r14
movl $0xa, %edi
callq 0x81e0
testb %r12b, %r12b
sete %al
testb %al, %bpl
jne 0x1a43d
testl %r13d, %r13d
jle 0x1a446
movl %r13d, %eax
movl $0x1, %esi
xorl %ecx, %ecx
xorl %edx, %edx
cmpb $0xa, (%rbx,%rcx)
sete %dl
addl %edx, %esi
incq %rcx
cmpq %rax, %rcx
jb 0x1a428
jmp 0x1a44b
movl $0x0, (%rsp)
jmp 0x1a45c
movl $0x1, %esi
leaq 0x1eac(%rip), %rdi      # 0x1c2fe
movq %rsp, %rdx
xorl %eax, %eax
callq 0x8050
movl %r13d, 0x4(%rsp)
cmpl %r14d, %r13d
jg 0x1a4a3
movslq %r14d, %r14
movslq 0x4(%rsp), %r12
decq %r12
leaq 0x7d08(%rip), %r13      # 0x22180
movl $0x20, %ebp
movzbl 0x1(%rbx,%r12), %eax
cmpl $0x0, (%r13,%rax,4)
je 0x1a49b
cmpb $0x9, %al
movzbl %al, %eax
cmovel %ebp, %eax
movsbl %al, %edi
callq 0x81e0
incq %r12
cmpq %r14, %r12
jl 0x1a47d
movl $0xa, %edi
callq 0x81e0
cmpl $0x0, (%rsp)
jle 0x1a4c6
xorl %ebp, %ebp
movl $0x20, %edi
callq 0x81e0
incl %ebp
cmpl (%rsp), %ebp
jl 0x1a4b5
movl 0x4(%rsp), %eax
cmpl 0x10(%rsp), %eax
jge 0x1a502
cltq
addq %rax, %rbx
subl 0x8(%rsp), %r15d
xorl %r14d, %r14d
leaq 0x7c9c(%rip), %r12      # 0x22180
movzbl (%rbx,%r14), %eax
cmpl $0x0, (%r12,%rax,4)
je 0x1a4fa
movl $0x20, %edi
callq 0x81e0
incq %r14
cmpl %r14d, %r15d
jne 0x1a4e4
leaq 0x1e19(%rip), %rdi      # 0x1c322
callq 0x8200
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq