// File: /workspace/github_c_makefile_star2_O1/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 0xb50a(%rip), %r13      # 0x25760
movl 0x18(%r13), %esi
testq %rsi, %rsi
je 0x1a277
cmpl $0x34, %esi
jb 0x1a2c0
leaq 0x2025(%rip), %rdi      # 0x1c290
xorl %eax, %eax
callq 0x8050
jmp 0x1a349
movl 0x20(%r13), %esi
testl %esi, %esi
je 0x1a506
cmpl $0x34, %esi
jb 0x1a296
leaq 0x2053(%rip), %rdi      # 0x1c2e2
xorl %eax, %eax
callq 0x8050
movslq 0x20(%r13), %rax
leaq 0xae5f(%rip), %rcx      # 0x25100
movq (%rcx,%rax,8), %rsi
leaq 0x204b(%rip), %rdi      # 0x1c2f7
xorl %eax, %eax
callq 0x8050
movl $0x0, 0x20(%r13)
jmp 0x1a349
movl %esi, %eax
andl $0x3e, %eax
cmpl $0x32, %eax
je 0x1a506
cmpq $0x17, %rsi
je 0x1a2ed
cmpl $0xb, %esi
jne 0x1a330
leaq 0xafc0(%rip), %rax      # 0x252a0
movq 0x10(%rax), %rsi
leaq 0x1fb8(%rip), %rdi      # 0x1c2a3
jmp 0x1a342
movq 0x38(%r13), %rax
movslq 0x1c(%r13), %rcx
movl -0x4(%rax,%rcx,4), %eax
leaq 0xe0c(%rip), %rsi       # 0x1b10c
testl %eax, %eax
jle 0x1a327
leaq 0xaf95(%rip), %rcx      # 0x252a0
movq (%rcx), %rdi
cmpl 0x14a0(%rdi), %eax
jg 0x1a327
addq $0x14a0, %rdi           # imm = 0x14A0
movl %eax, %esi
callq 0x911c
movq (%rax), %rsi
leaq 0x1f96(%rip), %rdi      # 0x1c2c4
jmp 0x1a342
leaq 0xadc9(%rip), %rax      # 0x25100
movq (%rax,%rsi,8), %rsi
leaq 0x1f77(%rip), %rdi      # 0x1c2b9
xorl %eax, %eax
callq 0x8050
testq %r14, %r14
je 0x1a37a
testl %r12d, %r12d
js 0x1a369
leaq 0x1fb6(%rip), %rdi      # 0x1c310
movl %r12d, %esi
movq %r14, %rdx
xorl %eax, %eax
callq 0x8050
jmp 0x1a37a
leaq 0x1f94(%rip), %rdi      # 0x1c304
movq %r14, %rsi
xorl %eax, %eax
callq 0x8050
movl $0xa, %edi
callq 0x81e0
testq %rbx, %rbx
je 0x1a506
movl %r15d, %esi
movslq %r15d, %rax
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
movq %rax, %rcx
movb (%rbx,%rcx), %dl
incl %r15d
testq %rcx, %rcx
jle 0x1a3af
decq %rcx
cmpb $0xa, %dl
jne 0x1a39c
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 0x1a3da
cmpl $0xa, %edx
je 0x1a3da
incq %rcx
jmp 0x1a3c8
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 0x1a435
testl %r13d, %r13d
jle 0x1a43e
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 0x1a420
jmp 0x1a443
movl $0x0, (%rsp)
jmp 0x1a454
movl $0x1, %esi
leaq 0x1ed4(%rip), %rdi      # 0x1c31e
movq %rsp, %rdx
xorl %eax, %eax
callq 0x8050
movl %r13d, 0x4(%rsp)
cmpl %r14d, %r13d
jg 0x1a49b
movslq %r14d, %r14
movslq 0x4(%rsp), %r12
decq %r12
leaq 0x7d10(%rip), %r13      # 0x22180
movl $0x20, %ebp
movzbl 0x1(%rbx,%r12), %eax
cmpl $0x0, (%r13,%rax,4)
je 0x1a493
cmpb $0x9, %al
movzbl %al, %eax
cmovel %ebp, %eax
movsbl %al, %edi
callq 0x81e0
incq %r12
cmpq %r14, %r12
jl 0x1a475
movl $0xa, %edi
callq 0x81e0
cmpl $0x0, (%rsp)
jle 0x1a4be
xorl %ebp, %ebp
movl $0x20, %edi
callq 0x81e0
incl %ebp
cmpl (%rsp), %ebp
jl 0x1a4ad
movl 0x4(%rsp), %eax
cmpl 0x10(%rsp), %eax
jge 0x1a4fa
cltq
addq %rax, %rbx
subl 0x8(%rsp), %r15d
xorl %r14d, %r14d
leaq 0x7ca4(%rip), %r12      # 0x22180
movzbl (%rbx,%r14), %eax
cmpl $0x0, (%r12,%rax,4)
je 0x1a4f2
movl $0x20, %edi
callq 0x81e0
incq %r14
cmpl %r14d, %r15d
jne 0x1a4dc
leaq 0x1e41(%rip), %rdi      # 0x1c342
callq 0x8200
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq