// File: DoubleString[P]RtConverter/src/Rtklib/rtkcmn.cpp
// Function: bamboo::readpos(char const*, char const*, double*)
extern void readpos(const char *file, const char *rcv, double *pos)
{
    static double poss[2048][3];
    static char stas[2048][16];
    FILE *fp;
    int i,j,len,np=0;
    char buff[256],str[256];
    
    trace(3,"readpos: file=%s\n",file);
    
    if (!(fp=fopen(file,"r"))) {
        fprintf(stderr,"reference position file open error : %s\n",file);
        return;
    }
    while (np<2048&&fgets(buff,sizeof(buff),fp)) {
        if (buff[0]=='%'||buff[0]=='#') continue;
        if (sscanf(buff,"%lf %lf %lf %s",&poss[np][0],&poss[np][1],&poss[np][2],
                   str)<4) continue;
        strncpy(stas[np],str,15); stas[np++][15]='\0';
    }
    fclose(fp);
    len=(int)strlen(rcv);
    for (i=0;i<np;i++) {
        if (strncmp(stas[i],rcv,len)) continue;
        for (j=0;j<3;j++) pos[j]=poss[i][j];
        pos[0]*=D2R; pos[1]*=D2R;
        return;
    }
    pos[0]=pos[1]=pos[2]=0.0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x240, %rsp            # imm = 0x240
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl $0x0, -0x30(%rbp)
movq -0x8(%rbp), %rdx
movl $0x3, %edi
leaq 0x3587c(%rip), %rsi     # 0xc7a9a
movb $0x0, %al
callq 0x8b980
movq -0x8(%rbp), %rdi
leaq 0x35c6f(%rip), %rsi     # 0xc7e9f
callq 0x98d0
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
jne 0x92260
movq 0x64d82(%rip), %rax     # 0xf6fc8
movq (%rax), %rdi
movq -0x8(%rbp), %rdx
leaq 0x35858(%rip), %rsi     # 0xc7aac
movb $0x0, %al
callq 0x9a90
jmp 0x92455
jmp 0x92262
xorl %eax, %eax
cmpl $0x800, -0x30(%rbp)     # imm = 0x800
movb %al, -0x231(%rbp)
jge 0x92295
leaq -0x130(%rbp), %rdi
movq -0x20(%rbp), %rdx
movl $0x100, %esi            # imm = 0x100
callq 0x9ba0
cmpq $0x0, %rax
setne %al
movb %al, -0x231(%rbp)
movb -0x231(%rbp), %al
testb $0x1, %al
jne 0x922a4
jmp 0x9236a
movsbl -0x130(%rbp), %eax
cmpl $0x25, %eax
je 0x922bc
movsbl -0x130(%rbp), %eax
cmpl $0x23, %eax
jne 0x922be
jmp 0x92262
leaq -0x130(%rbp), %rdi
movslq -0x30(%rbp), %rax
leaq 0x69990(%rip), %rdx     # 0xfbc60
imulq $0x18, %rax, %rax
addq %rax, %rdx
movslq -0x30(%rbp), %rax
leaq 0x6997e(%rip), %rcx     # 0xfbc60
imulq $0x18, %rax, %rax
addq %rax, %rcx
addq $0x8, %rcx
movslq -0x30(%rbp), %rax
leaq 0x69968(%rip), %r8      # 0xfbc60
imulq $0x18, %rax, %rax
addq %rax, %r8
addq $0x10, %r8
leaq -0x230(%rbp), %r9
leaq 0x357c4(%rip), %rsi     # 0xc7ad5
movb $0x0, %al
callq 0x9750
cmpl $0x4, %eax
jge 0x92322
jmp 0x92262
movslq -0x30(%rbp), %rax
leaq 0x75933(%rip), %rdi     # 0x107c60
shlq $0x4, %rax
addq %rax, %rdi
leaq -0x230(%rbp), %rsi
movl $0xf, %edx
callq 0x93b0
movl -0x30(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp)
movslq %eax, %rcx
leaq 0x75906(%rip), %rax     # 0x107c60
shlq $0x4, %rcx
addq %rcx, %rax
movb $0x0, 0xf(%rax)
jmp 0x92262
movq -0x20(%rbp), %rdi
callq 0x9770
movq -0x10(%rbp), %rdi
callq 0x92e0
movl %eax, -0x2c(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x30(%rbp), %eax
jge 0x92432
movslq -0x24(%rbp), %rax
leaq 0x758c3(%rip), %rdi     # 0x107c60
shlq $0x4, %rax
addq %rax, %rdi
movq -0x10(%rbp), %rsi
movslq -0x2c(%rbp), %rdx
callq 0x9360
cmpl $0x0, %eax
je 0x923b8
jmp 0x92424
movl $0x0, -0x28(%rbp)
cmpl $0x3, -0x28(%rbp)
jge 0x923f8
movslq -0x24(%rbp), %rcx
leaq 0x69890(%rip), %rax     # 0xfbc60
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movslq -0x28(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x18(%rbp), %rax
movslq -0x28(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x923bf
movq -0x18(%rbp), %rax
movsd 0x350bc(%rip), %xmm0    # 0xc74c0
mulsd (%rax), %xmm0
movsd %xmm0, (%rax)
movq -0x18(%rbp), %rax
movsd 0x350a8(%rip), %xmm0    # 0xc74c0
mulsd 0x8(%rax), %xmm0
movsd %xmm0, 0x8(%rax)
jmp 0x92455
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x92386
movq -0x18(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x10(%rax)
movq -0x18(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, 0x8(%rax)
movq -0x18(%rbp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
addq $0x240, %rsp            # imm = 0x240
popq %rbp
retq
nop