// File: /workspace/github_cpp_makefile_star2_O3/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 0xd3e86
xorl %eax, %eax
jmp 0xd3ea5
movq %rsi, %r14
movq %rdi, %rbx
callq 0x9340
leaq 0x4cef5(%rip), %rsi     # 0x120d8d
movq %rbx, %rdi
callq 0x9a47
testq %rax, %rax
je 0xd3eb0
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
movl $0x2e, %esi
callq 0x9100
testq %rax, %rax
jne 0xd3e82
leaq 0x144a07(%rip), %rax    # 0x2188d0
movq (%rax), %r15
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9340
movq %rbx, %rdi
callq 0x9120
addq %rbx, %rax
cmpq $0x20000, %r15          # imm = 0x20000
jne 0xd3f25
movb $0x0, 0x4(%rax)
movl $0x6c6d782e, (%rax)     # imm = 0x6C6D782E
leaq 0x4ce91(%rip), %rsi     # 0x120d8d
movq %rbx, %rdi
callq 0x9a47
testq %rax, %rax
jne 0xd3ea5
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9340
movq %rbx, %rdi
callq 0x9120
movl $0x676f6c2e, (%rbx,%rax) # imm = 0x676F6C2E
jmp 0xd3f61
movb $0x0, 0x4(%rax)
movl $0x676f6c2e, (%rax)     # imm = 0x676F6C2E
leaq 0x4ce57(%rip), %rsi     # 0x120d8d
movq %rbx, %rdi
callq 0x9a47
testq %rax, %rax
jne 0xd3ea5
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9340
movq %rbx, %rdi
callq 0x9120
movl $0x6c6d782e, (%rbx,%rax) # imm = 0x6C6D782E
movb $0x0, 0x4(%rbx,%rax)
leaq 0x4ce20(%rip), %rsi     # 0x120d8d
movq %rbx, %rdi
callq 0x9a47
testq %rax, %rax
jne 0xd3ea5
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9340
movq %rbx, %rdi
callq 0x9120
movl $0x7870672e, (%rbx,%rax) # imm = 0x7870672E
movb $0x0, 0x4(%rbx,%rax)
leaq 0x4cde9(%rip), %rsi     # 0x120d8d
movq %rbx, %rdi
callq 0x9a47
testq %rax, %rax
jne 0xd3ea5
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9340
movq %rbx, %rdi
callq 0x9120
movl $0x6c6d6b2e, (%rbx,%rax) # imm = 0x6C6D6B2E
movb $0x0, 0x4(%rbx,%rax)
leaq 0x4cdb2(%rip), %rsi     # 0x120d8d
movq %rbx, %rdi
callq 0x9a47
testq %rax, %rax
jne 0xd3ea5
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9340
movq %rbx, %rdi
callq 0x9120
movl $0x73626f2e, (%rbx,%rax) # imm = 0x73626F2E
movb $0x0, 0x4(%rbx,%rax)
leaq 0x4cd7b(%rip), %rsi     # 0x120d8d
movq %rbx, %rdi
callq 0x9a47
testq %rax, %rax
jne 0xd3ea5
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9340
movq %rbx, %rdi
callq 0x9120
movl $0x7263732e, (%rbx,%rax) # imm = 0x7263732E
movb $0x0, 0x4(%rbx,%rax)
leaq 0x4cd44(%rip), %rsi     # 0x120d8d
movq %rbx, %rdi
callq 0x9a47
testq %rax, %rax
jne 0xd3ea5
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9340
movq %rbx, %rdi
callq 0x9120
movl $0x616c6c2e, (%rbx,%rax) # imm = 0x616C6C2E
movb $0x0, 0x4(%rbx,%rax)
leaq 0x4cd0d(%rip), %rsi     # 0x120d8d
movq %rbx, %rdi
callq 0x9a47
testq %rax, %rax
jne 0xd3ea5
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9340
movq %rbx, %rdi
callq 0x9120
movl $0x6c61632e, (%rbx,%rax) # imm = 0x6C61632E
movb $0x0, 0x4(%rbx,%rax)
leaq 0x4ccd6(%rip), %rsi     # 0x120d8d
movq %rbx, %rdi
callq 0x9a47
testq %rax, %rax
jne 0xd3ea5
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9340
movq %rbx, %rdi
callq 0x9120
movl $0x6769732e, (%rbx,%rax) # imm = 0x6769732E
movb $0x0, 0x4(%rbx,%rax)
leaq 0x4cc9f(%rip), %rsi     # 0x120d8d
movq %rbx, %rdi
callq 0x9a47
testq %rax, %rax
jne 0xd3ea5
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9340
movq %rbx, %rdi
callq 0x9120
movl $0x6e72702e, (%rbx,%rax) # imm = 0x6E72702E
movb $0x0, 0x4(%rbx,%rax)
leaq 0x4cc68(%rip), %rsi     # 0x120d8d
movq %rbx, %rdi
callq 0x9a47
testq %rax, %rax
jne 0xd3ea5
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9340
movq %rbx, %rdi
callq 0x9120
movl $0x7664612e, (%rbx,%rax) # imm = 0x7664612E
movb $0x0, 0x4(%rbx,%rax)
leaq 0x4cc31(%rip), %rsi     # 0x120d8d
movq %rbx, %rdi
callq 0x9a47
testq %rax, %rax
jne 0xd3ea5
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9340
movq %rbx, %rdi
callq 0x9120
movl $0x6d69742e, (%rbx,%rax) # imm = 0x6D69742E
movb $0x0, 0x4(%rbx,%rax)
leaq 0x4cbfa(%rip), %rsi     # 0x120d8d
movq %rbx, %rdi
callq 0x9a47
testq %rax, %rax
jne 0xd3ea5
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9340
movq %rbx, %rdi
callq 0x9120
movl $0x6569742e, (%rbx,%rax) # imm = 0x6569742E
movb $0x0, 0x4(%rbx,%rax)
leaq 0x4cbc3(%rip), %rsi     # 0x120d8d
movq %rbx, %rdi
callq 0x9a47
testq %rax, %rax
jne 0xd3ea5
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9340
movq %rbx, %rdi
callq 0x9120
movl $0x6e70722e, (%rbx,%rax) # imm = 0x6E70722E
movb $0x0, 0x4(%rbx,%rax)
leaq 0x4cb8c(%rip), %rsi     # 0x120d8d
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x9a47