// File: /workspace/github_cpp_makefile_star2_O2/jkingan[P]ladyheather/heathmsc.cpp
// Function: open_it(char*, char*)
FILE *open_it(char *line, char *fn)
{
FILE *file;

    if(line == 0) return 0;
    if(fn == 0) return 0;

    strcpy(line, fn);
    file = topen(line, "r");
    if(file) return file;

    if(strstr(fn, ".")) return file; // extension given,  we are done trying

    // no extension give. try to open file with default extensions
    if(rcvr_type == CS_RCVR) {
       strcpy(line, fn);
       strcat(line, ".xml");
       file = topen(line, "r");
       if(file) return file;

       strcpy(line, fn);
       strcat(line, ".log");
       file = topen(line, "r");
       if(file) return file;
    }
    else {
       strcpy(line, fn);
       strcat(line, ".log");
       file = topen(line, "r");
       if(file) return file;

       strcpy(line, fn);
       strcat(line, ".xml");
       file = topen(line, "r");
       if(file) return file;
    }

    strcpy(line, fn);
    strcat(line, ".gpx");
    file = topen(line, "r");
    if(file) return file;

    strcpy(line, fn);
    strcat(line, ".kml");
    file = topen(line, "r");
    if(file) return file;

    strcpy(line, fn);         // RINEX
    strcat(line, ".obs");
    file = topen(line, "r");
    if(file) return file;


    // try non-log file names
    strcpy(line, fn);
    strcat(line, ".scr");
    file = topen(line, "r");
    if(file) return file;

    strcpy(line, fn);
    strcat(line, ".lla");
    file = topen(line, "r");
    if(file) return file;

    strcpy(line, fn);
    strcat(line, ".cal");
    file = topen(line, "r");
    if(file) return file;

    strcpy(line, fn);
    strcat(line, ".sig");
    file = topen(line, "r");
    if(file) return file;

    strcpy(line, fn);
    strcat(line, ".prn");
    file = topen(line, "r");
    if(file) return file;

    strcpy(line, fn);
    strcat(line, ".adv");
    file = topen(line, "r");
    if(file) return file;

    strcpy(line, fn);
    strcat(line, ".tim");
    file = topen(line, "r");
    if(file) return file;

    strcpy(line, fn);
    strcat(line, ".tie");
    file = topen(line, "r");
    if(file) return file;

    strcpy(line, fn);
    strcat(line, ".rpn");
    file = topen(line, "r");
    if(file) return file;

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
je 0xc2559
xorl %eax, %eax
jmp 0xc2578
movq %rsi, %r14
movq %rdi, %rbx
callq 0x9330
leaq 0x4876a(%rip), %rsi     # 0x10acd5
movq %rbx, %rdi
callq 0x9a22
testq %rax, %rax
je 0xc2583
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
pushq $0x2e
popq %rsi
movq %r14, %rdi
callq 0x9100
testq %rax, %rax
jne 0xc2555
leaq 0x140336(%rip), %rax    # 0x2028d0
movq (%rax), %r15
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9330
movq %rbx, %rdi
callq 0x9120
addq %rbx, %rax
cmpq $0x20000, %r15          # imm = 0x20000
jne 0xc25f6
movb $0x0, 0x4(%rax)
movl $0x6c6d782e, (%rax)     # imm = 0x6C6D782E
leaq 0x48708(%rip), %rsi     # 0x10acd5
movq %rbx, %rdi
callq 0x9a22
testq %rax, %rax
jne 0xc2578
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9330
movq %rbx, %rdi
callq 0x9120
movl $0x676f6c2e, (%rbx,%rax) # imm = 0x676F6C2E
jmp 0xc2632
movb $0x0, 0x4(%rax)
movl $0x676f6c2e, (%rax)     # imm = 0x676F6C2E
leaq 0x486ce(%rip), %rsi     # 0x10acd5
movq %rbx, %rdi
callq 0x9a22
testq %rax, %rax
jne 0xc2578
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9330
movq %rbx, %rdi
callq 0x9120
movl $0x6c6d782e, (%rbx,%rax) # imm = 0x6C6D782E
movb $0x0, 0x4(%rbx,%rax)
leaq 0x48697(%rip), %rsi     # 0x10acd5
movq %rbx, %rdi
callq 0x9a22
testq %rax, %rax
jne 0xc2578
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9330
movq %rbx, %rdi
callq 0x9120
movl $0x7870672e, (%rbx,%rax) # imm = 0x7870672E
movb $0x0, 0x4(%rbx,%rax)
leaq 0x48660(%rip), %rsi     # 0x10acd5
movq %rbx, %rdi
callq 0x9a22
testq %rax, %rax
jne 0xc2578
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9330
movq %rbx, %rdi
callq 0x9120
movl $0x6c6d6b2e, (%rbx,%rax) # imm = 0x6C6D6B2E
movb $0x0, 0x4(%rbx,%rax)
leaq 0x48629(%rip), %rsi     # 0x10acd5
movq %rbx, %rdi
callq 0x9a22
testq %rax, %rax
jne 0xc2578
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9330
movq %rbx, %rdi
callq 0x9120
movl $0x73626f2e, (%rbx,%rax) # imm = 0x73626F2E
movb $0x0, 0x4(%rbx,%rax)
leaq 0x485f2(%rip), %rsi     # 0x10acd5
movq %rbx, %rdi
callq 0x9a22
testq %rax, %rax
jne 0xc2578
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9330
movq %rbx, %rdi
callq 0x9120
movl $0x7263732e, (%rbx,%rax) # imm = 0x7263732E
movb $0x0, 0x4(%rbx,%rax)
leaq 0x485bb(%rip), %rsi     # 0x10acd5
movq %rbx, %rdi
callq 0x9a22
testq %rax, %rax
jne 0xc2578
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9330
movq %rbx, %rdi
callq 0x9120
movl $0x616c6c2e, (%rbx,%rax) # imm = 0x616C6C2E
movb $0x0, 0x4(%rbx,%rax)
leaq 0x48584(%rip), %rsi     # 0x10acd5
movq %rbx, %rdi
callq 0x9a22
testq %rax, %rax
jne 0xc2578
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9330
movq %rbx, %rdi
callq 0x9120
movl $0x6c61632e, (%rbx,%rax) # imm = 0x6C61632E
movb $0x0, 0x4(%rbx,%rax)
leaq 0x4854d(%rip), %rsi     # 0x10acd5
movq %rbx, %rdi
callq 0x9a22
testq %rax, %rax
jne 0xc2578
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9330
movq %rbx, %rdi
callq 0x9120
movl $0x6769732e, (%rbx,%rax) # imm = 0x6769732E
movb $0x0, 0x4(%rbx,%rax)
leaq 0x48516(%rip), %rsi     # 0x10acd5
movq %rbx, %rdi
callq 0x9a22
testq %rax, %rax
jne 0xc2578
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9330
movq %rbx, %rdi
callq 0x9120
movl $0x6e72702e, (%rbx,%rax) # imm = 0x6E72702E
movb $0x0, 0x4(%rbx,%rax)
leaq 0x484df(%rip), %rsi     # 0x10acd5
movq %rbx, %rdi
callq 0x9a22
testq %rax, %rax
jne 0xc2578
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9330
movq %rbx, %rdi
callq 0x9120
movl $0x7664612e, (%rbx,%rax) # imm = 0x7664612E
movb $0x0, 0x4(%rbx,%rax)
leaq 0x484a8(%rip), %rsi     # 0x10acd5
movq %rbx, %rdi
callq 0x9a22
testq %rax, %rax
jne 0xc2578
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9330
movq %rbx, %rdi
callq 0x9120
movl $0x6d69742e, (%rbx,%rax) # imm = 0x6D69742E
movb $0x0, 0x4(%rbx,%rax)
leaq 0x48471(%rip), %rsi     # 0x10acd5
movq %rbx, %rdi
callq 0x9a22
testq %rax, %rax
jne 0xc2578
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9330
movq %rbx, %rdi
callq 0x9120
movl $0x6569742e, (%rbx,%rax) # imm = 0x6569742E
movb $0x0, 0x4(%rbx,%rax)
leaq 0x4843a(%rip), %rsi     # 0x10acd5
movq %rbx, %rdi
callq 0x9a22
testq %rax, %rax
jne 0xc2578
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9330
movq %rbx, %rdi
callq 0x9120
movl $0x6e70722e, (%rbx,%rax) # imm = 0x6E70722E
movb $0x0, 0x4(%rbx,%rax)
leaq 0x48403(%rip), %rsi     # 0x10acd5
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x9a22