// File: /workspace/github_cpp_makefile_star2_O3/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 $0x238, %rsp            # imm = 0x238
movq %rdx, %r14
movq %rsi, -0x40(%rbp)
movq %rdi, %rbx
leaq 0x23879(%rip), %rsi     # 0x7536c
callq 0x8770
testq %rax, %rax
je 0x51ca9
movq %rax, %r12
movq %r14, -0x38(%rbp)
movb $0x1, %bl
leaq 0x4057f(%rip), %r14     # 0x92090
leaq -0x260(%rbp), %r13
leaq 0x4c571(%rip), %r15     # 0x9e090
xorl %ecx, %ecx
movq %rcx, -0x30(%rbp)
leaq (%rcx,%rcx,2), %rax
leaq (%r14,%rax,8), %rcx
movq %rcx, -0x58(%rbp)
leaq (%r14,%rax,8), %rcx
addq $0x8, %rcx
movq %rcx, -0x50(%rbp)
leaq (%r14,%rax,8), %rax
addq $0x10, %rax
movq %rax, -0x48(%rbp)
movq %r13, %rdi
movl $0x100, %esi            # imm = 0x100
movq %r12, %rdx
callq 0x89e0
testq %rax, %rax
je 0x51bf5
movzbl -0x260(%rbp), %eax
cmpl $0x23, %eax
je 0x51b9c
cmpl $0x25, %eax
je 0x51b9c
movq %r13, %rdi
leaq 0x23551(%rip), %rsi     # 0x750ce
movq -0x58(%rbp), %rdx
movq -0x50(%rbp), %rcx
movq -0x48(%rbp), %r8
leaq -0x160(%rbp), %r9
xorl %eax, %eax
callq 0x8610
cmpl $0x3, %eax
jg 0x51ba3
testb $0x1, %bl
jne 0x51b49
jmp 0x51bf5
movq -0x30(%rbp), %rbx
shlq $0x4, %rbx
leaq (%r15,%rbx), %rdi
movl $0xf, %edx
leaq -0x160(%rbp), %rsi
callq 0x8350
movq -0x30(%rbp), %rax
cmpq $0x7ff, %rax            # imm = 0x7FF
leaq 0x1(%rax), %rax
movb $0x0, 0xf(%rbx,%r15)
setb %bl
movq %rax, %rcx
cmpq $0x800, %rax            # imm = 0x800
jne 0x51b21
movq %r12, %rdi
callq 0x8630
movl $0x800, %eax            # imm = 0x800
jmp 0x51c06
movq %r12, %rdi
callq 0x8630
movq -0x30(%rbp), %rax
testq %rax, %rax
je 0x51c43
movq -0x40(%rbp), %rdi
movq %rax, %r12
callq 0x8290
movslq %eax, %rbx
shlq $0x3, %r12
leaq (%r12,%r12,2), %r13
xorl %r12d, %r12d
movq %r15, %rdi
movq -0x40(%rbp), %rsi
movq %rbx, %rdx
callq 0x82f0
testl %eax, %eax
je 0x51c59
addq $-0x18, %r12
addq $0x10, %r15
movq %r13, %rax
addq %r12, %rax
jne 0x51c20
xorpd %xmm0, %xmm0
movq -0x38(%rbp), %rax
movupd %xmm0, (%rax)
movq $0x0, 0x10(%rax)
jmp 0x51c97
subq %r12, %r14
xorl %eax, %eax
movq -0x38(%rbp), %rcx
movsd (%r14), %xmm0
movsd %xmm0, (%rcx,%rax,8)
incq %rax
addq $0x8, %r14
cmpq $0x3, %rax
jne 0x51c62
movsd 0x22fff(%rip), %xmm0    # 0x74c80
movsd (%rcx), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, (%rcx)
mulsd 0x8(%rcx), %xmm0
movsd %xmm0, 0x8(%rcx)
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x3c328(%rip), %rax     # 0x8dfd8
movq (%rax), %rdi
leaq 0x233eb(%rip), %rsi     # 0x750a5
movq %rbx, %rdx
xorl %eax, %eax
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x88c0