// File: /workspace/github_cpp_makefile_star2_O2/DoubleString[P]RtConverter/src/Rtklib/rtkcmn.cpp
// Function: bamboo::readerp(char const*, bamboo::erp_t*)
extern int readerp(const char *file, erp_t *erp)
{
    FILE *fp;
    erpd_t *erp_data;
    double v[14]={0};
    char buff[256];
    
    trace(3,"readerp: file=%s\n",file);
    
    if (!(fp=fopen(file,"r"))) {
        trace(2,"erp file open error: file=%s\n",file);
        return 0;
    }
    while (fgets(buff,sizeof(buff),fp)) {
        if (sscanf(buff,"%lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf",
                   v,v+1,v+2,v+3,v+4,v+5,v+6,v+7,v+8,v+9,v+10,v+11,v+12,v+13)<5) {
            continue;
        }
        if (erp->n>=erp->nmax) {
            erp->nmax=erp->nmax<=0?128:erp->nmax*2;
            erp_data=(erpd_t *)realloc(erp->data,sizeof(erpd_t)*erp->nmax);
            if (!erp_data) {
                free(erp->data); erp->data=NULL; erp->n=erp->nmax=0;
                fclose(fp);
                return 0;
            }
            erp->data=erp_data;
        }
        erp->data[erp->n].mjd=v[0];
        erp->data[erp->n].xp=v[1]*1E-6*AS2R;
        erp->data[erp->n].yp=v[2]*1E-6*AS2R;
        erp->data[erp->n].ut1_utc=v[3]*1E-7;
        erp->data[erp->n].lod=v[4]*1E-7;
        erp->data[erp->n].xpr=v[12]*1E-6*AS2R;
        erp->data[erp->n++].ypr=v[13]*1E-6*AS2R;
    }
    fclose(fp);
    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x178, %rsp            # imm = 0x178
movq %rsi, %rbx
xorpd %xmm0, %xmm0
movapd %xmm0, -0x40(%rbp)
movapd %xmm0, -0x50(%rbp)
movapd %xmm0, -0x60(%rbp)
movapd %xmm0, -0x70(%rbp)
movapd %xmm0, -0x80(%rbp)
movapd %xmm0, -0x90(%rbp)
movapd %xmm0, -0xa0(%rbp)
leaq 0x21ab8(%rip), %rsi     # 0x6b382
callq 0x8750
testq %rax, %rax
je 0x49a64
movq %rax, %r14
leaq -0x1a0(%rbp), %r15
leaq 0x2180f(%rip), %r12     # 0x6b0f8
leaq -0xa0(%rbp), %r13
movq %r15, %rdi
movl $0x100, %esi            # imm = 0x100
movq %r14, %rdx
callq 0x89d0
testq %rax, %rax
je 0x49a57
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
leaq -0x98(%rbp), %rcx
leaq -0x90(%rbp), %r8
leaq -0x88(%rbp), %r9
xorl %eax, %eax
leaq -0x38(%rbp), %r10
pushq %r10
leaq -0x40(%rbp), %r10
pushq %r10
leaq -0x48(%rbp), %r10
pushq %r10
leaq -0x50(%rbp), %r10
pushq %r10
leaq -0x58(%rbp), %r10
pushq %r10
leaq -0x60(%rbp), %r10
pushq %r10
leaq -0x68(%rbp), %r10
pushq %r10
leaq -0x70(%rbp), %r10
pushq %r10
leaq -0x78(%rbp), %r10
pushq %r10
leaq -0x80(%rbp), %r10
pushq %r10
callq 0x8600
addq $0x50, %rsp
cmpl $0x5, %eax
jl 0x498f0
movl (%rbx), %ecx
movl 0x4(%rbx), %edx
movq 0x8(%rbx), %rax
cmpl %edx, %ecx
jl 0x499af
leal (%rdx,%rdx), %ecx
testl %edx, %edx
movl $0x80, %edx
cmovlel %edx, %ecx
movl %ecx, 0x4(%rbx)
imulq $0x38, %rcx, %rsi
movq %rax, %rdi
callq 0x8a70
testq %rax, %rax
je 0x49a7a
movq %rax, 0x8(%rbx)
movl (%rbx), %ecx
movsd -0xa0(%rbp), %xmm0
movslq %ecx, %rcx
imulq $0x38, %rcx, %rdx
movsd %xmm0, (%rax,%rdx)
movsd -0x98(%rbp), %xmm0
movsd 0x1926d(%rip), %xmm1    # 0x62c40
mulsd %xmm1, %xmm0
movsd 0x21249(%rip), %xmm2    # 0x6ac28
mulsd %xmm2, %xmm0
movsd %xmm0, 0x8(%rax,%rdx)
movsd -0x90(%rbp), %xmm0
mulsd %xmm1, %xmm0
mulsd %xmm2, %xmm0
movsd %xmm0, 0x10(%rax,%rdx)
movsd -0x88(%rbp), %xmm0
movsd 0x21279(%rip), %xmm3    # 0x6ac88
mulsd %xmm3, %xmm0
movsd %xmm0, 0x28(%rax,%rdx)
movsd -0x80(%rbp), %xmm0
mulsd %xmm3, %xmm0
movsd %xmm0, 0x30(%rax,%rdx)
movsd -0x40(%rbp), %xmm0
mulsd %xmm1, %xmm0
mulsd %xmm2, %xmm0
movsd %xmm0, 0x18(%rax,%rdx)
movsd -0x38(%rbp), %xmm0
mulsd %xmm1, %xmm0
mulsd %xmm2, %xmm0
incl %ecx
movl %ecx, (%rbx)
movsd %xmm0, 0x20(%rax,%rdx)
jmp 0x498f0
pushq $0x1
popq %rbx
movq %r14, %rdi
callq 0x8620
jmp 0x49a66
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rbx), %rdi
callq 0x8780
xorpd %xmm0, %xmm0
movupd %xmm0, (%rbx)
xorl %ebx, %ebx
jmp 0x49a5a