// File: /workspace/github_cpp_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq %rdx, %r14
movq %rsi, -0x40(%rbp)
movq %rdi, %rbx
leaq 0x21edf(%rip), %rsi     # 0x6b382
callq 0x8750
testq %rax, %rax
je 0x49635
movq %rax, %r12
movq %r14, -0x38(%rbp)
leaq 0x40be1(%rip), %rcx     # 0x8a0a0
leaq -0x250(%rbp), %r13
leaq 0x21c17(%rip), %r15     # 0x6b0e4
leaq 0x4cbcc(%rip), %r14     # 0x960a0
xorl %eax, %eax
cmpq $0x800, %rax            # imm = 0x800
je 0x49661
movq %rax, -0x30(%rbp)
imulq $0x18, %rax, %rax
leaq (%rcx,%rax), %rdx
movq %rdx, -0x50(%rbp)
leaq (%rax,%rcx), %rdx
addq $0x8, %rdx
movq %rdx, -0x48(%rbp)
leaq (%rax,%rcx), %rbx
addq $0x10, %rbx
movq %r13, %rdi
movl $0x100, %esi            # imm = 0x100
movq %r12, %rdx
callq 0x89d0
testq %rax, %rax
je 0x49584
movzbl -0x250(%rbp), %eax
cmpl $0x23, %eax
je 0x49506
cmpl $0x25, %eax
je 0x49506
movq %r13, %rdi
movq %r15, %rsi
movq -0x50(%rbp), %rdx
movq -0x48(%rbp), %rcx
movq %rbx, %r8
leaq -0x150(%rbp), %r9
xorl %eax, %eax
callq 0x8600
cmpl $0x4, %eax
jl 0x49506
movq -0x30(%rbp), %rbx
shlq $0x4, %rbx
leaq (%r14,%rbx), %rdi
leaq -0x150(%rbp), %rsi
pushq $0xf
popq %rdx
callq 0x8360
movq -0x30(%rbp), %rax
incq %rax
movb $0x0, 0xf(%rbx,%r14)
leaq 0x40b21(%rip), %rcx     # 0x8a0a0
jmp 0x494d6
movl -0x30(%rbp), %r13d
movq %r12, %rdi
callq 0x8620
movq -0x40(%rbp), %rdi
callq 0x8290
movslq %eax, %rbx
imulq $0x18, %r13, %r13
pushq $0x18
popq %r12
addq $-0x18, %r12
movq %r13, %rax
addq %r12, %rax
je 0x495f2
leaq 0x10(%r14), %r15
movq %r14, %rdi
movq -0x40(%rbp), %rsi
movq %rbx, %rdx
callq 0x8300
movq %r15, %r14
testl %eax, %eax
jne 0x495a4
leaq 0x40acf(%rip), %rdx     # 0x8a0a0
subq %r12, %rdx
xorl %eax, %eax
movq -0x38(%rbp), %rcx
cmpq $0x3, %rax
je 0x49605
movsd (%rdx), %xmm0
movsd %xmm0, (%rcx,%rax,8)
incq %rax
addq $0x8, %rdx
jmp 0x495da
xorpd %xmm0, %xmm0
movq -0x38(%rbp), %rax
movupd %xmm0, (%rax)
andq $0x0, 0x10(%rax)
jmp 0x49623
movsd 0x21673(%rip), %xmm0    # 0x6ac80
movsd (%rcx), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, (%rcx)
mulsd 0x8(%rcx), %xmm0
movsd %xmm0, 0x8(%rcx)
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x3c994(%rip), %rax     # 0x85fd0
movq (%rax), %rdi
leaq 0x21a75(%rip), %rsi     # 0x6b0bb
movq %rbx, %rdx
xorl %eax, %eax
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x88c0
movl $0x800, %r13d           # imm = 0x800
jmp 0x49588