// File: 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
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x1213f4
movq $0x0, -0x8(%rbp)
jmp 0x1218cd
cmpq $0x0, -0x18(%rbp)
jne 0x121408
movq $0x0, -0x8(%rbp)
jmp 0x1218cd
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x9350
movq -0x10(%rbp), %rdi
leaq 0x62bed(%rip), %rsi     # 0x18400d
callq 0x9b20
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x12143d
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1218cd
movq -0x18(%rbp), %rdi
leaq 0x74980(%rip), %rsi     # 0x195dc8
callq 0x9090
cmpq $0x0, %rax
je 0x121460
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1218cd
leaq 0x156649(%rip), %rax    # 0x277ab0
cmpq $0x20000, (%rax)        # imm = 0x20000
jne 0x121503
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x9350
movq -0x10(%rbp), %rdi
leaq 0x61629(%rip), %rsi     # 0x182ab5
callq 0x96a0
movq -0x10(%rbp), %rdi
leaq 0x62b71(%rip), %rsi     # 0x18400d
callq 0x9b20
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x1214b9
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1218cd
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x9350
movq -0x10(%rbp), %rdi
leaq 0x4f8b2(%rip), %rsi     # 0x170d83
callq 0x96a0
movq -0x10(%rbp), %rdi
leaq 0x62b2c(%rip), %rsi     # 0x18400d
callq 0x9b20
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x1214fe
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1218cd
jmp 0x12158f
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x9350
movq -0x10(%rbp), %rdi
leaq 0x4f868(%rip), %rsi     # 0x170d83
callq 0x96a0
movq -0x10(%rbp), %rdi
leaq 0x62ae2(%rip), %rsi     # 0x18400d
callq 0x9b20
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x121548
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1218cd
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x9350
movq -0x10(%rbp), %rdi
leaq 0x61555(%rip), %rsi     # 0x182ab5
callq 0x96a0
movq -0x10(%rbp), %rdi
leaq 0x62a9d(%rip), %rsi     # 0x18400d
callq 0x9b20
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x12158d
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1218cd
jmp 0x12158f
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x9350
movq -0x10(%rbp), %rdi
leaq 0x6ea92(%rip), %rsi     # 0x190039
callq 0x96a0
movq -0x10(%rbp), %rdi
leaq 0x62a56(%rip), %rsi     # 0x18400d
callq 0x9b20
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x1215d4
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1218cd
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x9350
movq -0x10(%rbp), %rdi
leaq 0x6ea57(%rip), %rsi     # 0x190043
callq 0x96a0
movq -0x10(%rbp), %rdi
leaq 0x62a11(%rip), %rsi     # 0x18400d
callq 0x9b20
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x121619
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1218cd
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x9350
movq -0x10(%rbp), %rdi
leaq 0x6ea1c(%rip), %rsi     # 0x19004d
callq 0x96a0
movq -0x10(%rbp), %rdi
leaq 0x629cc(%rip), %rsi     # 0x18400d
callq 0x9b20
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x12165e
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1218cd
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x9350
movq -0x10(%rbp), %rdi
leaq 0x610ea(%rip), %rsi     # 0x182760
callq 0x96a0
movq -0x10(%rbp), %rdi
leaq 0x62987(%rip), %rsi     # 0x18400d
callq 0x9b20
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x1216a3
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1218cd
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x9350
movq -0x10(%rbp), %rdi
leaq 0x76691(%rip), %rsi     # 0x197d4c
callq 0x96a0
movq -0x10(%rbp), %rdi
leaq 0x62942(%rip), %rsi     # 0x18400d
callq 0x9b20
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x1216e8
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1218cd
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x9350
movq -0x10(%rbp), %rdi
leaq 0x4f57c(%rip), %rsi     # 0x170c7c
callq 0x96a0
movq -0x10(%rbp), %rdi
leaq 0x628fd(%rip), %rsi     # 0x18400d
callq 0x9b20
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x12172d
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1218cd
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x9350
movq -0x10(%rbp), %rdi
leaq 0x59983(%rip), %rsi     # 0x17b0c8
callq 0x96a0
movq -0x10(%rbp), %rdi
leaq 0x628b8(%rip), %rsi     # 0x18400d
callq 0x9b20
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x121772
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1218cd
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x9350
movq -0x10(%rbp), %rdi
leaq 0x4fde1(%rip), %rsi     # 0x17156b
callq 0x96a0
movq -0x10(%rbp), %rdi
leaq 0x62873(%rip), %rsi     # 0x18400d
callq 0x9b20
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x1217b7
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1218cd
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x9350
movq -0x10(%rbp), %rdi
leaq 0x73ced(%rip), %rsi     # 0x1954bc
callq 0x96a0
movq -0x10(%rbp), %rdi
leaq 0x6282e(%rip), %rsi     # 0x18400d
callq 0x9b20
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x1217fc
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1218cd
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x9350
movq -0x10(%rbp), %rdi
leaq 0x73cad(%rip), %rsi     # 0x1954c1
callq 0x96a0
movq -0x10(%rbp), %rdi
leaq 0x627e9(%rip), %rsi     # 0x18400d
callq 0x9b20
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x121841
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1218cd
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x9350
movq -0x10(%rbp), %rdi
leaq 0x73c6d(%rip), %rsi     # 0x1954c6
callq 0x96a0
movq -0x10(%rbp), %rdi
leaq 0x627a4(%rip), %rsi     # 0x18400d
callq 0x9b20
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x121883
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1218cd
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x9350
movq -0x10(%rbp), %rdi
leaq 0x4f525(%rip), %rsi     # 0x170dc0
callq 0x96a0
movq -0x10(%rbp), %rdi
leaq 0x62762(%rip), %rsi     # 0x18400d
callq 0x9b20
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x1218c5
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1218cd
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)