// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %r8, %r15
movq %rcx, %r12
movsd %xmm0, -0x38(%rbp)
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %rsi
xorps %xmm0, %xmm0
movaps %xmm0, -0xb0(%rbp)
movaps %xmm0, -0xa0(%rbp)
movaps %xmm0, -0x90(%rbp)
movabsq $0x409f400000000000, %rax # imm = 0x409F400000000000
movq %rax, -0xb0(%rbp)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, -0xa8(%rbp)
movq %rax, -0xa0(%rbp)
movq %r14, %rdi
callq 0x85c0
movq %r14, %rdi
movl $0x25, %esi
callq 0x8250
testq %rax, %rax
je 0x542cb
cmpb $0x0, (%r12)
je 0x542d3
leaq 0x210d0(%rip), %rsi     # 0x7538b
movq %r14, %rdi
movq %r12, %rdx
callq 0x54873
movl %eax, %r12d
jmp 0x542d6
xorl %r15d, %r15d
jmp 0x5485e
xorl %r12d, %r12d
cmpb $0x0, (%r15)
je 0x542f1
leaq 0x210ab(%rip), %rsi     # 0x7538e
movq %r14, %rdi
movq %r15, %rdx
callq 0x54873
orl %eax, %r12d
testq %rbx, %rbx
je 0x54705
leaq -0xe0(%rbp), %r15
movq %rbx, %rdi
movsd -0x38(%rbp), %xmm0
movq %r15, %rsi
callq 0x4fa81
movsd (%r15), %xmm0
movsd %xmm0, -0x40(%rbp)
movq %r15, %r13
leaq -0xb0(%rbp), %r15
movsd %xmm0, (%r15)
leaq 0x1e38f(%rip), %rdi     # 0x726c0
callq 0x4f9a4
movq %rbx, %rcx
subq %rax, %rcx
movabsq $0x377aef2669de1559, %rdx # imm = 0x377AEF2669DE1559
movq %rcx, %rax
imulq %rdx
movq %rdx, %rax
shrq $0x3f, %rax
shrq $0x11, %rdx
addl %eax, %edx
movq %rdx, -0x58(%rbp)
cvtsi2sd %rcx, %xmm1
xorps %xmm0, %xmm0
cvtsi2sd %edx, %xmm0
mulsd 0x17a8f(%rip), %xmm0    # 0x6be00
mulsd 0x16567(%rip), %xmm0    # 0x6a8e0
addsd %xmm1, %xmm0
addsd -0x38(%rbp), %xmm0
divsd 0x16546(%rip), %xmm0    # 0x6a8d0
callq 0x8ad0
cvttsd2si %xmm0, %eax
movl %eax, -0x30(%rbp)
movq %r15, %rdi
callq 0x4f9a4
movsd %xmm0, -0x50(%rbp)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x8330
addsd -0x38(%rbp), %xmm0
subsd -0x50(%rbp), %xmm0
divsd 0x16510(%rip), %xmm0    # 0x6a8d0
callq 0x8ad0
cvttsd2si %xmm0, %ecx
movsd 0x18(%r13), %xmm0
movsd %xmm0, -0x48(%rbp)
cvttsd2si %xmm0, %eax
movq %rax, -0x80(%rbp)
incl %ecx
movl %ecx, -0x2c(%rbp)
movslq %eax, %rbx
imulq $0x55555556, %rbx, %rax # imm = 0x55555556
movq %rax, %rcx
shrq $0x3f, %rcx
shrq $0x20, %rax
addl %ecx, %eax
leal (%rax,%rax,2), %edx
leaq 0x16f0b(%rip), %r13     # 0x6b30d
movl %r12d, -0x38(%rbp)
leaq -0x120(%rbp), %r12
movq %r12, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x8120
leaq 0x20f70(%rip), %rsi     # 0x75391
movq %r14, %rdi
movq %r12, %rdx
callq 0x54873
movl %eax, -0x50(%rbp)
imulq $0x2aaaaaab, %rbx, %rbx # imm = 0x2AAAAAAB
movq %rbx, %r15
shrq $0x3f, %r15
movq %rbx, %rax
shrq $0x20, %rax
addl %r15d, %eax
addl %eax, %eax
leal (%rax,%rax,2), %edx
movq %r12, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x8120
leaq 0x20f35(%rip), %rsi     # 0x75395
movq %r14, %rdi
movq %r12, %rdx
callq 0x54873
movl %eax, -0x6c(%rbp)
shrq $0x21, %rbx
addl %r15d, %ebx
shll $0x2, %ebx
leal (%rbx,%rbx,2), %edx
movq %r12, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x8120
leaq 0x20f0a(%rip), %rsi     # 0x75399
movq %r14, %rdi
movq %r12, %rdx
callq 0x54873
movl %eax, -0x68(%rbp)
leaq 0x20ef9(%rip), %rsi     # 0x7539d
movq %r12, %rdi
movsd -0x40(%rbp), %xmm0
movb $0x1, %al
callq 0x8120
leaq 0x20eea(%rip), %rsi     # 0x753a4
movq %r14, %rdi
movq %r12, %rdx
callq 0x54873
movl %eax, -0x64(%rbp)
movsd 0x206d0(%rip), %xmm1    # 0x74ba0
movsd -0x40(%rbp), %xmm0
callq 0x8860
leaq 0x20ec6(%rip), %r15     # 0x753a7
movq %r12, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x8120
leaq 0x20eb9(%rip), %rsi     # 0x753ae
movq %r14, %rdi
movq %r12, %rdx
callq 0x54873
movl %eax, -0x40(%rbp)
leaq -0xe0(%rbp), %r13
movsd 0x8(%r13), %xmm0
movq %r12, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x8120
leaq 0x20e8d(%rip), %rsi     # 0x753b1
movq %r14, %rdi
movq %r12, %rdx
callq 0x54873
movl %eax, %ebx
movsd 0x10(%r13), %xmm0
movq %r12, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x8120
leaq 0x21c5b(%rip), %rsi     # 0x761a6
movq %r14, %rdi
movq %r12, %rdx
callq 0x54873
movl %eax, -0x60(%rbp)
movq %r12, %rdi
movq %r15, %rsi
movsd -0x48(%rbp), %xmm0
movb $0x1, %al
callq 0x8120
leaq 0x20e42(%rip), %rsi     # 0x753b4
movq %r14, %rdi
movq %r12, %rdx
callq 0x54873
movl %eax, -0x48(%rbp)
movsd 0x20(%r13), %xmm0
movsd %xmm0, -0x78(%rbp)
movq %r12, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x8120
leaq 0x20e18(%rip), %rsi     # 0x753b7
movq %r14, %rdi
movq %r12, %rdx
callq 0x54873
movl %eax, %r13d
leaq -0xe0(%rbp), %rax
movsd 0x28(%rax), %xmm0
callq 0x8ad0
movq %r12, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x8120
leaq 0x20de8(%rip), %rsi     # 0x753ba
movq %r14, %rdi
movq %r12, %rdx
callq 0x54873
movl %eax, -0x5c(%rbp)
leaq 0x20a37(%rip), %rsi     # 0x7501e
movq %r12, %rdi
movl -0x2c(%rbp), %edx
xorl %eax, %eax
callq 0x8120
leaq 0x20dc2(%rip), %rsi     # 0x753bd
movq %r14, %rdi
movq %r12, %rdx
callq 0x54873
movl %eax, -0x2c(%rbp)
leaq 0x20db0(%rip), %rsi     # 0x753c0
movq %r12, %rdi
movq -0x58(%rbp), %rdx
xorl %eax, %eax
callq 0x8120
leaq 0x20da0(%rip), %rsi     # 0x753c5
movq %r14, %rdi
movq %r12, %rdx
callq 0x54873
movl %eax, -0x58(%rbp)
movq %r12, %rdi
leaq 0x21b69(%rip), %rsi     # 0x761a6
movl -0x30(%rbp), %edx
xorl %eax, %eax
callq 0x8120
leaq 0x20d7a(%rip), %rsi     # 0x753c8
movq %r14, %rdi
movq %r12, %rdx
callq 0x54873
movl %eax, %r15d
movq -0x80(%rbp), %rax
addl $0x61, %eax
movb %al, (%r12)
movb $0x0, 0x1(%r12)
leaq 0x20d57(%rip), %rsi     # 0x753cb
movq %r14, %rdi
movq %r12, %rdx
callq 0x54873
movl %eax, -0x30(%rbp)
cvttsd2si -0x78(%rbp), %eax
cltq
imulq $-0x77777777, %rax, %rcx # imm = 0x88888889
shrq $0x20, %rcx
addl %ecx, %eax
movl %eax, %ecx
shrl $0x1f, %ecx
sarl $0x3, %eax
addl %ecx, %eax
leal (%rax,%rax,4), %eax
leal (%rax,%rax,2), %edx
movq %r12, %rdi
leaq 0x16c5d(%rip), %rsi     # 0x6b30d
xorl %eax, %eax
callq 0x8120
leaq 0x20d10(%rip), %rsi     # 0x753ce
movq %r14, %rdi
movq %r12, %rdx
callq 0x54873
movl -0x6c(%rbp), %ecx
orl -0x50(%rbp), %ecx
movl -0x64(%rbp), %edx
orl -0x68(%rbp), %edx
orl %ecx, %edx
orl -0x40(%rbp), %ebx
orl -0x60(%rbp), %ebx
orl %edx, %ebx
orl -0x48(%rbp), %r13d
orl -0x5c(%rbp), %r13d
orl -0x2c(%rbp), %r13d
orl %ebx, %r13d
orl -0x58(%rbp), %r15d
orl -0x30(%rbp), %r15d
orl %eax, %r15d
orl -0x38(%rbp), %r15d
orl %r13d, %r15d
jmp 0x5485e
leaq 0x20c85(%rip), %rsi     # 0x75391
movq %r14, %rdi
callq 0x8160
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
testq %rax, %rax
jne 0x5485e
leaq 0x20c6b(%rip), %rsi     # 0x75395
movq %r14, %rdi
callq 0x8160
testq %rax, %rax
jne 0x5485e
leaq 0x20c57(%rip), %rsi     # 0x75399
movq %r14, %rdi
callq 0x8160
testq %rax, %rax
jne 0x5485e
leaq 0x20c4a(%rip), %rsi     # 0x753a4
movq %r14, %rdi
callq 0x8160
testq %rax, %rax
jne 0x5485e
leaq 0x20c3c(%rip), %rsi     # 0x753ae
movq %r14, %rdi
callq 0x8160
testq %rax, %rax
jne 0x5485e
leaq 0x20c27(%rip), %rsi     # 0x753b1
movq %r14, %rdi
callq 0x8160
testq %rax, %rax
jne 0x5485e
leaq 0x21a04(%rip), %rsi     # 0x761a6
movq %r14, %rdi
callq 0x8160
testq %rax, %rax
jne 0x5485e
leaq 0x20bfa(%rip), %rsi     # 0x753b4
movq %r14, %rdi
callq 0x8160
testq %rax, %rax
jne 0x5485e
leaq 0x20be5(%rip), %rsi     # 0x753b7
movq %r14, %rdi
callq 0x8160
testq %rax, %rax
jne 0x5485e
leaq 0x20bd4(%rip), %rsi     # 0x753ba
movq %r14, %rdi
callq 0x8160
testq %rax, %rax
jne 0x5485e
leaq 0x20bc3(%rip), %rsi     # 0x753bd
movq %r14, %rdi
callq 0x8160
testq %rax, %rax
jne 0x5485e
leaq 0x20bb7(%rip), %rsi     # 0x753c5
movq %r14, %rdi
callq 0x8160
testq %rax, %rax
jne 0x5485e
leaq 0x20ba6(%rip), %rsi     # 0x753c8
movq %r14, %rdi
callq 0x8160
testq %rax, %rax
jne 0x5485e
leaq 0x20b95(%rip), %rsi     # 0x753cb
movq %r14, %rdi
callq 0x8160
testq %rax, %rax
jne 0x5485e
leaq 0x20b84(%rip), %rsi     # 0x753ce
movq %r14, %rdi
callq 0x8160
xorl %r15d, %r15d
negq %rax
sbbl %r15d, %r15d
orl %r12d, %r15d
movl %r15d, %eax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq