// File: /workspace/github_c_makefile_star2_O2/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 0xc7c3(%rip), %r13      # 0x24760
movl 0x18(%r13), %esi
testq %rsi, %rsi
je 0x17fbe
cmpl $0x34, %esi
jb 0x18007
leaq 0x227e(%rip), %rdi      # 0x1a230
xorl %eax, %eax
callq 0x8050
jmp 0x18090
movl 0x20(%r13), %esi
testl %esi, %esi
je 0x18201
cmpl $0x34, %esi
jb 0x17fe1
leaq 0x22ac(%rip), %rdi      # 0x1a282
xorl %eax, %eax
callq 0x8050
movl 0x20(%r13), %esi
movslq %esi, %rax
leaq 0xc115(%rip), %rcx      # 0x24100
movq (%rcx,%rax,8), %rsi
leaq 0x22a1(%rip), %rdi      # 0x1a297
xorl %eax, %eax
callq 0x8050
andl $0x0, 0x20(%r13)
jmp 0x18090
movl %esi, %eax
andl $0x3e, %eax
cmpl $0x32, %eax
je 0x18201
cmpq $0x17, %rsi
je 0x18034
cmpl $0xb, %esi
jne 0x18077
leaq 0xc279(%rip), %rax      # 0x242a0
movq 0x10(%rax), %rsi
leaq 0x2211(%rip), %rdi      # 0x1a243
jmp 0x18089
movq 0x38(%r13), %rax
movslq 0x1c(%r13), %rcx
movl -0x4(%rax,%rcx,4), %eax
leaq 0x1061(%rip), %rsi      # 0x190a8
testl %eax, %eax
jle 0x1806e
leaq 0xc24e(%rip), %rcx      # 0x242a0
movq (%rcx), %rdi
cmpl 0x14a0(%rdi), %eax
jg 0x1806e
addq $0x14a0, %rdi           # imm = 0x14A0
movl %eax, %esi
callq 0x9088
movq (%rax), %rsi
leaq 0x21ef(%rip), %rdi      # 0x1a264
jmp 0x18089
leaq 0xc082(%rip), %rax      # 0x24100
movq (%rax,%rsi,8), %rsi
leaq 0x21d0(%rip), %rdi      # 0x1a259
xorl %eax, %eax
callq 0x8050
testq %r14, %r14
je 0x180c1
testl %r12d, %r12d
js 0x180b0
leaq 0x220f(%rip), %rdi      # 0x1a2b0
movl %r12d, %esi
movq %r14, %rdx
xorl %eax, %eax
callq 0x8050
jmp 0x180c1
leaq 0x21ed(%rip), %rdi      # 0x1a2a4
movq %r14, %rsi
xorl %eax, %eax
callq 0x8050
pushq $0xa
popq %rdi
callq 0x81e0
testq %rbx, %rbx
je 0x18201
movslq %r15d, %rsi
leal 0x1(%rsi), %eax
movq %rsi, %rcx
movb (%rbx,%rcx), %dl
decl %eax
testq %rcx, %rcx
jle 0x180ed
decq %rcx
cmpb $0xa, %dl
jne 0x180db
xorl %r12d, %r12d
cmpb $0xa, %dl
sete %r12b
addl %eax, %r12d
movq %rsi, 0x10(%rsp)
movq %rsi, %r13
movzbl (%rbx,%r13), %eax
testl %eax, %eax
je 0x18115
cmpl $0xa, %eax
je 0x18115
incq %r13
jmp 0x18102
testq %r14, %r14
sete %r14b
xorl %ecx, %ecx
cmpb $0xa, %al
sete %cl
subq %rcx, %r13
pushq $0xa
popq %rdi
callq 0x81e0
testb %bpl, %bpl
sete %al
testb %al, %r14b
jne 0x18156
movslq %r12d, %rax
pushq $0x1
popq %rsi
xorl %ecx, %ecx
cmpq %rax, %rcx
jge 0x1815d
xorl %edx, %edx
cmpb $0xa, (%rbx,%rcx)
sete %dl
addl %edx, %esi
incq %rcx
jmp 0x18141
andl $0x0, 0xc(%rsp)
jmp 0x18170
leaq 0x215a(%rip), %rdi      # 0x1a2be
leaq 0xc(%rsp), %rdx
xorl %eax, %eax
callq 0x8050
pushq $0x1
popq %r15
movslq %r12d, %r12
movslq %r13d, %r13
pushq $0x20
popq %rbp
movq %r12, %r14
cmpq %r13, %r14
jg 0x181ac
movzbl (%rbx,%r14), %eax
leaq 0x8fef(%rip), %rcx      # 0x21180
cmpl $0x0, (%rcx,%rax,4)
je 0x181a7
cmpb $0x9, %al
movzbl %al, %eax
cmovel %ebp, %eax
movsbl %al, %edi
callq 0x81e0
incq %r14
jmp 0x18180
pushq $0xa
popq %rdi
callq 0x81e0
pushq $0x20
popq %rbp
movq 0x10(%rsp), %r14
cmpl 0xc(%rsp), %r15d
jg 0x181cf
movl %ebp, %edi
callq 0x81e0
incl %r15d
jmp 0x181bc
pushq $0x20
popq %rbp
cmpq %r14, %r12
jge 0x181f5
movzbl (%rbx,%r12), %eax
leaq 0x8f9d(%rip), %rcx      # 0x21180
cmpl $0x0, (%rcx,%rax,4)
je 0x181f0
movl %ebp, %edi
callq 0x81e0
incq %r12
jmp 0x181d2
leaq 0x20e6(%rip), %rdi      # 0x1a2e2
callq 0x8200
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq