// File: /workspace/github_cpp_makefile_star2_O3/DoubleString[P]RtConverter/src/Rtklib/rtcm.cpp
// Function: bamboo::init_rtcm(bamboo::rtcm_t*)
extern int init_rtcm(rtcm_t *rtcm)
{
    gtime_t time0={0};
    obsd_t data0={{0}};
    eph_t  eph0 ={0,-1,-1};
    geph_t geph0={0,-1};
    ssr_t ssr0={{{0}}};
    int i,j;
    
    trace(3,"init_rtcm:\n");
    
    rtcm->staid=rtcm->stah=rtcm->seqno=rtcm->outtype=0;
    rtcm->time=rtcm->time_s=time0;
    rtcm->sta.name[0]=rtcm->sta.marker[0]='\0';
    rtcm->sta.antdes[0]=rtcm->sta.antsno[0]='\0';
    rtcm->sta.rectype[0]=rtcm->sta.recver[0]=rtcm->sta.recsno[0]='\0';
    rtcm->sta.antsetup=rtcm->sta.itrf=rtcm->sta.deltype=0;
    for (i=0;i<3;i++) {
        rtcm->sta.pos[i]=rtcm->sta.del[i]=0.0;
    }
    rtcm->sta.hgt=0.0;
    rtcm->dgps=NULL;
    for (i=0;i<MAXRTKSAT;i++) {
        rtcm->ssr[i]=ssr0;
        for(j=0;j < 6;j++)
        	rtcm->ssr[i].iod[j] = -999;
    }
    rtcm->msg[0]=rtcm->msgtype[0]=rtcm->opt[0]='\0';
    for (i=0;i<6;i++) rtcm->msmtype[i][0]='\0';
    rtcm->obsflag=rtcm->ephsat=0;
    for (i=0;i<MAXRTKSAT;i++) for (j=0;j<NFREQ+NEXOBS;j++) {
        rtcm->cp[i][j]=0.0;
        rtcm->lock[i][j]=rtcm->loss[i][j]=0;
        rtcm->lltime[i][j]=time0;
    }
    rtcm->nbyte=rtcm->nbit=rtcm->len=0;
    rtcm->word=0;
    for (i=0;i<100;i++) rtcm->nmsg2[i]=0;
    for (i=0;i<400;i++) rtcm->nmsg3[i]=0;
    
    rtcm->obs.data=NULL;
    rtcm->nav.eph =NULL;
    rtcm->nav.geph=NULL;
    
    /* reallocate memory for observation and ephemris buffer */
    if (!(rtcm->obs.data=(obsd_t *)malloc(sizeof(obsd_t)*MAXOBS))||
        !(rtcm->nav.eph =(eph_t  *)malloc(sizeof(eph_t )*MAXRTKSAT))||
        !(rtcm->nav.geph=(geph_t *)malloc(sizeof(geph_t)*MAXPRNGLO))) {
        free_rtcm(rtcm);
        return 0;
    }
    rtcm->obs.n=0;
    rtcm->nav.n=MAXRTKSAT;
    rtcm->nav.ng=MAXPRNGLO;
    for (i=0;i<MAXOBS   ;i++) rtcm->obs.data[i]=data0;
    for (i=0;i<MAXRTKSAT   ;i++) rtcm->nav.eph [i]=eph0;
    for (i=0;i<MAXPRNGLO;i++) rtcm->nav.geph[i]=geph0;
    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x35830(%rip), %rsi     # 0x6e1e1
xorl %r14d, %r14d
movl $0x3, %edi
xorl %eax, %eax
callq 0x4d55d
movb %r14b, 0x6ef78(%rbx)
movb %r14b, 0x6ef38(%rbx)
movb %r14b, 0x6eff8(%rbx)
movb %r14b, 0x6efb8(%rbx)
movb %r14b, 0x6f0b8(%rbx)
movb %r14b, 0x6f078(%rbx)
movb %r14b, 0x6f038(%rbx)
movl $0x0, 0x6f100(%rbx)
movq %r14, 0x6f0f8(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x6f108(%rbx)
movq %r14, 0x6f118(%rbx)
movups %xmm0, (%rbx)
movups %xmm0, 0x10(%rbx)
movups %xmm0, 0x20(%rbx)
movl $0xde24, %eax           # imm = 0xDE24
movq $0x0, (%rbx,%rax,8)
incq %rax
cmpq $0xde27, %rax           # imm = 0xDE27
jne 0x38a23
leaq 0x6f148(%rbx), %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x6f138(%rbx)
leaq 0x6f1d8(%rbx), %r15
xorl %r12d, %r12d
imulq $0x498, %r12, %rdi      # imm = 0x498
addq %r14, %rdi
movl $0x498, %edx            # imm = 0x498
xorl %esi, %esi
callq 0x8390
xorl %eax, %eax
movl $0xfffffc19, (%r15,%rax,4) # imm = 0xFFFFFC19
incq %rax
cmpq $0x6, %rax
jne 0x38a69
incq %r12
addq $0x498, %r15            # imm = 0x498
cmpq $0x9b, %r12
jne 0x38a51
xorl %eax, %eax
movb %al, 0x9fd48(%rbx)
movb %al, 0x9b9d0(%rbx)
movb %al, 0x9b950(%rbx)
movl $0x9bad0, %eax          # imm = 0x9BAD0
movb $0x0, (%rbx,%rax)
subq $-0x80, %rax
cmpq $0x9bdd0, %rax          # imm = 0x9BDD0
jne 0x38aa6
movq $0x0, 0x9bdd0(%rbx)
movl $0x9cc60, %eax          # imm = 0x9CC60
xorl %ecx, %ecx
xorps %xmm0, %xmm0
xorl %edx, %edx
movl $0x3, %esi
movq %rax, %rdi
movq $0x0, -0x1d73a8(%rbx,%rdi,4)
movw %cx, 0x3a2(%rbx,%rdi)
movw %cx, (%rbx,%rdi)
movups %xmm0, -0x448f58(%rbx,%rdi,8)
addq $0x2, %rdi
decq %rsi
jne 0x38ad5
incq %rdx
addq $0x6, %rax
cmpq $0x9b, %rdx
jne 0x38acd
movl $0x0, 0x9f0c0(%rbx)
movq $0x0, 0x9f0b8(%rbx)
leaq 0x9f574(%rbx), %r15
movl $0x1800, %edi           # imm = 0x1800
callq 0x8840
movq %rax, %r12
xorps %xmm0, %xmm0
movups %xmm0, 0x80(%rbx)
xorl %r14d, %r14d
movl $0x7d4, %edx            # imm = 0x7D4
movq %r15, %rdi
xorl %esi, %esi
callq 0x8390
movq %r12, 0x38(%rbx)
testq %r12, %r12
je 0x38c58
leaq 0x80(%rbx), %r15
movl $0xae60, %edi           # imm = 0xAE60
callq 0x8840
movq %rax, (%r15)
testq %rax, %rax
je 0x38c58
movl $0x1008, %edi           # imm = 0x1008
callq 0x8840
movq %rax, 0x88(%rbx)
testq %rax, %rax
je 0x38c58
movl $0x0, 0x30(%rbx)
movl $0x9b, 0x40(%rbx)
movl $0x1b, 0x48(%rbx)
xorl %eax, %eax
xorps %xmm0, %xmm0
movq 0x38(%rbx), %rcx
movups %xmm0, 0x50(%rcx,%rax)
movups %xmm0, 0x40(%rcx,%rax)
movups %xmm0, 0x30(%rcx,%rax)
movups %xmm0, 0x20(%rcx,%rax)
movups %xmm0, 0x10(%rcx,%rax)
movups %xmm0, (%rcx,%rax)
addq $0x60, %rax
cmpq $0x1800, %rax           # imm = 0x1800
jne 0x38bb1
movl $0xc, %r12d
movabsq $-0x100000000, %r14     # imm = 0xFFFFFFFF00000000
movq (%r15), %rax
leaq (%rax,%r12), %rdi
movq %r14, -0xc(%rax,%r12)
movl $0xffffffff, -0x4(%rax,%r12) # imm = 0xFFFFFFFF
movl $0x114, %edx            # imm = 0x114
xorl %esi, %esi
callq 0x8390
addq $0x120, %r12            # imm = 0x120
cmpq $0xae6c, %r12           # imm = 0xAE6C
jne 0x38bee
movl $0x8, %r15d
movq 0x88(%rbx), %rdi
movq %r14, -0x8(%rdi,%r15)
addq %r15, %rdi
movl $0x90, %edx
xorl %esi, %esi
callq 0x8390
addq $0x98, %r15
cmpq $0x1010, %r15           # imm = 0x1010
jne 0x38c25
movl $0x1, %r14d
jmp 0x38c60
movq %rbx, %rdi
callq 0x38c6c
movl %r14d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq