// File: /workspace/github_cpp_makefile_star2_O2/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 0x31974(%rip), %rsi     # 0x641e1
xorl %r14d, %r14d
pushq $0x3
popq %rdi
xorl %eax, %eax
callq 0x455bc
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)
andl $0x0, 0x6f100(%rbx)
andq $0x0, 0x6f0f8(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movups %xmm0, 0x10(%rbx)
movups %xmm0, 0x20(%rbx)
movl $0xde21, %eax           # imm = 0xDE21
cmpq $0xde24, %rax           # imm = 0xDE24
je 0x328e5
andq $0x0, 0x18(%rbx,%rax,8)
andq $0x0, (%rbx,%rax,8)
incq %rax
jmp 0x328cd
leaq 0x6f148(%rbx), %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x6f138(%rbx)
leaq 0x6f1d8(%rbx), %r15
xorl %r12d, %r12d
cmpq $0x9b, %r12
je 0x32940
imulq $0x498, %r12, %rdi      # imm = 0x498
addq %r14, %rdi
movl $0x498, %edx            # imm = 0x498
xorl %esi, %esi
callq 0x8390
xorl %eax, %eax
cmpq $0x6, %rax
je 0x32934
movl $0xfffffc19, (%r15,%rax,4) # imm = 0xFFFFFC19
incq %rax
jmp 0x32921
incq %r12
addq $0x498, %r15            # imm = 0x498
jmp 0x32900
xorl %eax, %eax
movb %al, 0x9fd48(%rbx)
movb %al, 0x9b9d0(%rbx)
movb %al, 0x9b950(%rbx)
movl $0x9bad0, %eax          # imm = 0x9BAD0
cmpq $0x9bdd0, %rax          # imm = 0x9BDD0
je 0x3296b
movb $0x0, (%rbx,%rax)
subq $-0x80, %rax
jmp 0x32959
andq $0x0, 0x9bdd0(%rbx)
leaq 0x9bdd8(%rbx), %rax
leaq 0x9cc60(%rbx), %rcx
leaq 0x9d3a8(%rbx), %rdx
xorl %esi, %esi
xorps %xmm0, %xmm0
cmpq $0x9b, %rsi
je 0x329cc
xorl %edi, %edi
cmpq $0x6, %rdi
je 0x329bb
andq $0x0, (%rax,%rdi,4)
andw $0x0, 0x3a2(%rcx,%rdi)
andw $0x0, (%rcx,%rdi)
movups %xmm0, (%rdx,%rdi,8)
addq $0x2, %rdi
jmp 0x32998
incq %rsi
addq $0x18, %rax
addq $0x6, %rcx
addq $0x30, %rdx
jmp 0x3298d
andl $0x0, 0x9f0c0(%rbx)
andq $0x0, 0x9f0b8(%rbx)
andl $0x0, 0x9f574(%rbx)
movl $0x27d5e, %eax          # imm = 0x27D5E
cmpq $0x27dc2, %rax          # imm = 0x27DC2
je 0x329f8
andl $0x0, (%rbx,%rax,4)
incq %rax
jmp 0x329e7
movl $0x27dc2, %eax          # imm = 0x27DC2
cmpq $0x27f52, %rax          # imm = 0x27F52
je 0x32a0e
andl $0x0, (%rbx,%rax,4)
incq %rax
jmp 0x329fd
movl $0x1800, %edi           # imm = 0x1800
callq 0x8830
xorps %xmm0, %xmm0
movups %xmm0, 0x80(%rbx)
movq %rax, 0x38(%rbx)
testq %rax, %rax
je 0x32aa0
leaq 0x80(%rbx), %r14
movl $0xae60, %edi           # imm = 0xAE60
callq 0x8830
movq %rax, (%r14)
testq %rax, %rax
je 0x32aa0
movl $0x1008, %edi           # imm = 0x1008
callq 0x8830
movq %rax, 0x88(%rbx)
testq %rax, %rax
je 0x32aa0
andl $0x0, 0x30(%rbx)
movl $0x9b, 0x40(%rbx)
movl $0x1b, 0x48(%rbx)
xorl %eax, %eax
xorps %xmm0, %xmm0
cmpq $0x1800, %rax           # imm = 0x1800
je 0x32ab7
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
jmp 0x32a71
movq %rbx, %rdi
callq 0x32b2a
xorl %r14d, %r14d
movl %r14d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
pushq $0xc
popq %r12
movabsq $-0x100000000, %r15     # imm = 0xFFFFFFFF00000000
cmpq $0xae6c, %r12           # imm = 0xAE6C
je 0x32af5
movq (%r14), %rax
leaq (%rax,%r12), %rdi
movq %r15, -0xc(%rax,%r12)
orl $-0x1, -0x4(%rax,%r12)
movl $0x114, %edx            # imm = 0x114
xorl %esi, %esi
callq 0x8390
addq $0x120, %r12            # imm = 0x120
jmp 0x32ac5
pushq $0x8
popq %r12
pushq $0x1
popq %r14
cmpq $0x1010, %r12           # imm = 0x1010
je 0x32aab
movq 0x88(%rbx), %rdi
movq %r15, -0x8(%rdi,%r12)
addq %r12, %rdi
movl $0x90, %edx
xorl %esi, %esi
callq 0x8390
addq $0x98, %r12
jmp 0x32afd