// File: DoubleString[P]RtConverter/src/Rtklib/rtkcmn.cpp
// Function: bamboo::reppath(char const*, char*, bamboo::gtime_t, char const*, char const*)
extern int reppath(const char *path, char *rpath, gtime_t time, const char *rov,
                   const char *base)
{
    double ep[6],ep0[6]={2000,1,1,0,0,0};
    int week,dow,doy,stat=0;
    char rep[64];
    
    strcpy(rpath,path);
    
    if (!strstr(rpath,"%")) return 0;
    if (*rov ) stat|=repstr(rpath,"%r",rov );
    if (*base) stat|=repstr(rpath,"%b",base);
    if (time.time!=0) {
        time2epoch(time,ep);
        ep0[0]=ep[0];
        dow=(int)floor(time2gpst(time,&week)/86400.0);
        doy=(int)floor(timediff(time,epoch2time(ep0))/86400.0)+1;
        sprintf(rep,"%02d",  ((int)ep[3]/3)*3);   stat|=repstr(rpath,"%ha",rep);
        sprintf(rep,"%02d",  ((int)ep[3]/6)*6);   stat|=repstr(rpath,"%hb",rep);
        sprintf(rep,"%02d",  ((int)ep[3]/12)*12); stat|=repstr(rpath,"%hc",rep);
        sprintf(rep,"%04.0f",ep[0]);              stat|=repstr(rpath,"%Y",rep);
        sprintf(rep,"%02.0f",fmod(ep[0],100.0));  stat|=repstr(rpath,"%y",rep);
        sprintf(rep,"%02.0f",ep[1]);              stat|=repstr(rpath,"%m",rep);
        sprintf(rep,"%02.0f",ep[2]);              stat|=repstr(rpath,"%d",rep);
        sprintf(rep,"%02.0f",ep[3]);              stat|=repstr(rpath,"%h",rep);
        sprintf(rep,"%02.0f",ep[4]);              stat|=repstr(rpath,"%M",rep);
        sprintf(rep,"%02.0f",floor(ep[5]));       stat|=repstr(rpath,"%S",rep);
        sprintf(rep,"%03d",  doy);                stat|=repstr(rpath,"%n",rep);
        sprintf(rep,"%04d",  week);               stat|=repstr(rpath,"%W",rep);
        sprintf(rep,"%d",    dow);                stat|=repstr(rpath,"%D",rep);
        sprintf(rep,"%c",    'a'+(int)ep[3]);     stat|=repstr(rpath,"%H",rep);
        sprintf(rep,"%02d",  ((int)ep[4]/15)*15); stat|=repstr(rpath,"%t",rep);
    }
    else if (strstr(rpath,"%ha")||strstr(rpath,"%hb")||strstr(rpath,"%hc")||
             strstr(rpath,"%Y" )||strstr(rpath,"%y" )||strstr(rpath,"%m" )||
             strstr(rpath,"%d" )||strstr(rpath,"%h" )||strstr(rpath,"%M" )||
             strstr(rpath,"%S" )||strstr(rpath,"%n" )||strstr(rpath,"%W" )||
             strstr(rpath,"%D" )||strstr(rpath,"%H" )||strstr(rpath,"%t" )) {
        return -1; /* no valid time */
    }
    return stat;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdx, -0x18(%rbp)
movsd %xmm0, -0x10(%rbp)
movq %rdi, -0x20(%rbp)
movq %rsi, -0x28(%rbp)
movq %rcx, -0x30(%rbp)
movq %r8, -0x38(%rbp)
leaq -0xa0(%rbp), %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x93d0
movsd 0x31569(%rip), %xmm0    # 0xc73c8
movsd %xmm0, -0xa0(%rbp)
movsd 0x25ff1(%rip), %xmm0    # 0xbbe60
movsd %xmm0, -0x98(%rbp)
movsd 0x25fe1(%rip), %xmm0    # 0xbbe60
movsd %xmm0, -0x90(%rbp)
movl $0x0, -0xb0(%rbp)
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x96f0
movq -0x28(%rbp), %rdi
leaq 0x31ff3(%rip), %rsi     # 0xc7e9c
callq 0x91b0
cmpq $0x0, %rax
jne 0x95ec0
movl $0x0, -0x4(%rbp)
jmp 0x96590
movq -0x30(%rbp), %rax
cmpb $0x0, (%rax)
je 0x95ee9
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rdx
leaq 0x31fc6(%rip), %rsi     # 0xc7e9e
callq 0x965a0
orl -0xb0(%rbp), %eax
movl %eax, -0xb0(%rbp)
movq -0x38(%rbp), %rax
cmpb $0x0, (%rax)
je 0x95f12
movq -0x28(%rbp), %rdi
movq -0x38(%rbp), %rdx
leaq 0x31fa0(%rip), %rsi     # 0xc7ea1
callq 0x965a0
orl -0xb0(%rbp), %eax
movl %eax, -0xb0(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x9640e
movq -0x18(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xf8(%rbp)
leaq -0x70(%rbp), %rsi
movq -0x100(%rbp), %rdi
movsd -0xf8(%rbp), %xmm0
callq 0x8e2f0
movsd -0x70(%rbp), %xmm0
movsd %xmm0, -0xa0(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x110(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x108(%rbp)
movq -0x110(%rbp), %rdi
movsd -0x108(%rbp), %xmm0
leaq -0xa4(%rbp), %rsi
callq 0x8e540
movsd 0x26e8f(%rip), %xmm1    # 0xbce20
divsd %xmm1, %xmm0
callq 0x9c90
cvttsd2si %xmm0, %eax
movl %eax, -0xa8(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x120(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x118(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x8e180
movq %rax, -0x130(%rbp)
movsd %xmm0, -0x128(%rbp)
movq -0x120(%rbp), %rdi
movsd -0x118(%rbp), %xmm0
movq -0x130(%rbp), %rsi
movsd -0x128(%rbp), %xmm1
callq 0x8e8e0
movsd 0x26e20(%rip), %xmm1    # 0xbce20
divsd %xmm1, %xmm0
callq 0x9c90
cvttsd2si %xmm0, %eax
addl $0x1, %eax
movl %eax, -0xac(%rbp)
leaq -0xf0(%rbp), %rdi
cvttsd2si -0x58(%rbp), %eax
movl $0x3, %ecx
cltd
idivl %ecx
imull $0x3, %eax, %edx
leaq 0x27289(%rip), %rsi     # 0xbd2bd
movb $0x0, %al
callq 0x9150
movq -0x28(%rbp), %rdi
leaq -0xf0(%rbp), %rdx
leaq 0x31e57(%rip), %rsi     # 0xc7ea4
callq 0x965a0
orl -0xb0(%rbp), %eax
movl %eax, -0xb0(%rbp)
leaq -0xf0(%rbp), %rdi
cvttsd2si -0x58(%rbp), %eax
movl $0x6, %ecx
cltd
idivl %ecx
imull $0x6, %eax, %edx
leaq 0x27241(%rip), %rsi     # 0xbd2bd
movb $0x0, %al
callq 0x9150
movq -0x28(%rbp), %rdi
leaq -0xf0(%rbp), %rdx
leaq 0x31e13(%rip), %rsi     # 0xc7ea8
callq 0x965a0
orl -0xb0(%rbp), %eax
movl %eax, -0xb0(%rbp)
leaq -0xf0(%rbp), %rdi
cvttsd2si -0x58(%rbp), %eax
movl $0xc, %ecx
cltd
idivl %ecx
imull $0xc, %eax, %edx
leaq 0x271f9(%rip), %rsi     # 0xbd2bd
movb $0x0, %al
callq 0x9150
movq -0x28(%rbp), %rdi
leaq -0xf0(%rbp), %rdx
leaq 0x31dcf(%rip), %rsi     # 0xc7eac
callq 0x965a0
orl -0xb0(%rbp), %eax
movl %eax, -0xb0(%rbp)
leaq -0xf0(%rbp), %rdi
movsd -0x70(%rbp), %xmm0
leaq 0x31daf(%rip), %rsi     # 0xc7eb0
movb $0x1, %al
callq 0x9150
movq -0x28(%rbp), %rdi
leaq -0xf0(%rbp), %rdx
leaq 0x31d9d(%rip), %rsi     # 0xc7eb7
callq 0x965a0
orl -0xb0(%rbp), %eax
movl %eax, -0xb0(%rbp)
leaq -0xf0(%rbp), %rax
movq %rax, -0x140(%rbp)
movsd -0x70(%rbp), %xmm0
movsd 0x3127a(%rip), %xmm1    # 0xc73c0
callq 0x99f0
movq -0x140(%rbp), %rdi
leaq 0x31d61(%rip), %rsi     # 0xc7eba
movb $0x1, %al
callq 0x9150
movq -0x28(%rbp), %rdi
leaq -0xf0(%rbp), %rdx
leaq 0x31d4f(%rip), %rsi     # 0xc7ec1
callq 0x965a0
orl -0xb0(%rbp), %eax
movl %eax, -0xb0(%rbp)
leaq -0xf0(%rbp), %rdi
movsd -0x68(%rbp), %xmm0
leaq 0x31d24(%rip), %rsi     # 0xc7eba
movb $0x1, %al
callq 0x9150
movq -0x28(%rbp), %rdi
leaq -0xf0(%rbp), %rdx
leaq 0x31d15(%rip), %rsi     # 0xc7ec4
callq 0x965a0
orl -0xb0(%rbp), %eax
movl %eax, -0xb0(%rbp)
leaq -0xf0(%rbp), %rdi
movsd -0x60(%rbp), %xmm0
leaq 0x31ce7(%rip), %rsi     # 0xc7eba
movb $0x1, %al
callq 0x9150
movq -0x28(%rbp), %rdi
leaq -0xf0(%rbp), %rdx
leaq 0x32d0e(%rip), %rsi     # 0xc8efa
callq 0x965a0
orl -0xb0(%rbp), %eax
movl %eax, -0xb0(%rbp)
leaq -0xf0(%rbp), %rdi
movsd -0x58(%rbp), %xmm0
leaq 0x31caa(%rip), %rsi     # 0xc7eba
movb $0x1, %al
callq 0x9150
movq -0x28(%rbp), %rdi
leaq -0xf0(%rbp), %rdx
leaq 0x31c9e(%rip), %rsi     # 0xc7ec7
callq 0x965a0
orl -0xb0(%rbp), %eax
movl %eax, -0xb0(%rbp)
leaq -0xf0(%rbp), %rdi
movsd -0x50(%rbp), %xmm0
leaq 0x31c6d(%rip), %rsi     # 0xc7eba
movb $0x1, %al
callq 0x9150
movq -0x28(%rbp), %rdi
leaq -0xf0(%rbp), %rdx
leaq 0x31c64(%rip), %rsi     # 0xc7eca
callq 0x965a0
orl -0xb0(%rbp), %eax
movl %eax, -0xb0(%rbp)
leaq -0xf0(%rbp), %rax
movq %rax, -0x138(%rbp)
movsd -0x48(%rbp), %xmm0
callq 0x9c90
movq -0x138(%rbp), %rdi
leaq 0x31c1d(%rip), %rsi     # 0xc7eba
movb $0x1, %al
callq 0x9150
movq -0x28(%rbp), %rdi
leaq -0xf0(%rbp), %rdx
leaq 0x31c17(%rip), %rsi     # 0xc7ecd
callq 0x965a0
orl -0xb0(%rbp), %eax
movl %eax, -0xb0(%rbp)
leaq -0xf0(%rbp), %rdi
movl -0xac(%rbp), %edx
leaq 0x31585(%rip), %rsi     # 0xc7860
movb $0x0, %al
callq 0x9150
movq -0x28(%rbp), %rdi
leaq -0xf0(%rbp), %rdx
leaq 0x31bdc(%rip), %rsi     # 0xc7ed0
callq 0x965a0
orl -0xb0(%rbp), %eax
movl %eax, -0xb0(%rbp)
leaq -0xf0(%rbp), %rdi
movl -0xa4(%rbp), %edx
leaq 0x31bba(%rip), %rsi     # 0xc7ed3
movb $0x0, %al
callq 0x9150
movq -0x28(%rbp), %rdi
leaq -0xf0(%rbp), %rdx
leaq 0x31ba6(%rip), %rsi     # 0xc7ed8
callq 0x965a0
orl -0xb0(%rbp), %eax
movl %eax, -0xb0(%rbp)
leaq -0xf0(%rbp), %rdi
movl -0xa8(%rbp), %edx
leaq 0x32ba3(%rip), %rsi     # 0xc8efa
movb $0x0, %al
callq 0x9150
movq -0x28(%rbp), %rdi
leaq -0xf0(%rbp), %rdx
leaq 0x31b6b(%rip), %rsi     # 0xc7edb
callq 0x965a0
orl -0xb0(%rbp), %eax
movl %eax, -0xb0(%rbp)
leaq -0xf0(%rbp), %rdi
cvttsd2si -0x58(%rbp), %edx
addl $0x61, %edx
leaq 0x35d07(%rip), %rsi     # 0xcc09e
movb $0x0, %al
callq 0x9150
movq -0x28(%rbp), %rdi
leaq -0xf0(%rbp), %rdx
leaq 0x31b2e(%rip), %rsi     # 0xc7ede
callq 0x965a0
orl -0xb0(%rbp), %eax
movl %eax, -0xb0(%rbp)
leaq -0xf0(%rbp), %rdi
cvttsd2si -0x50(%rbp), %eax
movl $0xf, %ecx
cltd
idivl %ecx
imull $0xf, %eax, %edx
leaq 0x26ede(%rip), %rsi     # 0xbd2bd
movb $0x0, %al
callq 0x9150
movq -0x28(%rbp), %rdi
leaq -0xf0(%rbp), %rdx
leaq 0x31ae9(%rip), %rsi     # 0xc7ee1
callq 0x965a0
orl -0xb0(%rbp), %eax
movl %eax, -0xb0(%rbp)
jmp 0x96587
movq -0x28(%rbp), %rdi
leaq 0x31a8b(%rip), %rsi     # 0xc7ea4
callq 0x91b0
cmpq $0x0, %rax
jne 0x9657c
movq -0x28(%rbp), %rdi
leaq 0x31a75(%rip), %rsi     # 0xc7ea8
callq 0x91b0
cmpq $0x0, %rax
jne 0x9657c
movq -0x28(%rbp), %rdi
leaq 0x31a5f(%rip), %rsi     # 0xc7eac
callq 0x91b0
cmpq $0x0, %rax
jne 0x9657c
movq -0x28(%rbp), %rdi
leaq 0x31a50(%rip), %rsi     # 0xc7eb7
callq 0x91b0
cmpq $0x0, %rax
jne 0x9657c
movq -0x28(%rbp), %rdi
leaq 0x31a40(%rip), %rsi     # 0xc7ec1
callq 0x91b0
cmpq $0x0, %rax
jne 0x9657c
movq -0x28(%rbp), %rdi
leaq 0x31a29(%rip), %rsi     # 0xc7ec4
callq 0x91b0
cmpq $0x0, %rax
jne 0x9657c
movq -0x28(%rbp), %rdi
leaq 0x32a45(%rip), %rsi     # 0xc8efa
callq 0x91b0
cmpq $0x0, %rax
jne 0x9657c
movq -0x28(%rbp), %rdi
leaq 0x319f8(%rip), %rsi     # 0xc7ec7
callq 0x91b0
cmpq $0x0, %rax
jne 0x9657c
movq -0x28(%rbp), %rdi
leaq 0x319e1(%rip), %rsi     # 0xc7eca
callq 0x91b0
cmpq $0x0, %rax
jne 0x9657c
movq -0x28(%rbp), %rdi
leaq 0x319ca(%rip), %rsi     # 0xc7ecd
callq 0x91b0
cmpq $0x0, %rax
jne 0x9657c
movq -0x28(%rbp), %rdi
leaq 0x319b7(%rip), %rsi     # 0xc7ed0
callq 0x91b0
cmpq $0x0, %rax
jne 0x9657c
movq -0x28(%rbp), %rdi
leaq 0x319a9(%rip), %rsi     # 0xc7ed8
callq 0x91b0
cmpq $0x0, %rax
jne 0x9657c
movq -0x28(%rbp), %rdi
leaq 0x31996(%rip), %rsi     # 0xc7edb
callq 0x91b0
cmpq $0x0, %rax
jne 0x9657c
movq -0x28(%rbp), %rdi
leaq 0x31983(%rip), %rsi     # 0xc7ede
callq 0x91b0
cmpq $0x0, %rax
jne 0x9657c
movq -0x28(%rbp), %rdi
leaq 0x31970(%rip), %rsi     # 0xc7ee1
callq 0x91b0
cmpq $0x0, %rax
je 0x96585
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x96590
jmp 0x96587
movl -0xb0(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
nopl (%rax)