// File: /workspace/github_cpp_makefile_star2_O3/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, -0xa0(%rbp)
movaps %xmm0, -0x90(%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 0x53827
cmpb $0x0, (%r12)
je 0x5382f
leaq 0x21b54(%rip), %rsi     # 0x7536b
movq %r14, %rdi
movq %r12, %rdx
callq 0x53dcf
movl %eax, %r12d
jmp 0x53832
xorl %r15d, %r15d
jmp 0x53dba
xorl %r12d, %r12d
cmpb $0x0, (%r15)
je 0x5384d
leaq 0x21b2f(%rip), %rsi     # 0x7536e
movq %r14, %rdi
movq %r15, %rdx
callq 0x53dcf
orl %eax, %r12d
testq %rbx, %rbx
je 0x53c61
leaq -0xe0(%rbp), %r15
movq %rbx, %rdi
movsd -0x38(%rbp), %xmm0
movq %r15, %rsi
callq 0x4f104
movsd (%r15), %xmm0
movsd %xmm0, -0x40(%rbp)
movq %r15, %r13
leaq -0xb0(%rbp), %r15
movsd %xmm0, (%r15)
leaq 0x1ee13(%rip), %rdi     # 0x726a0
callq 0x4f027
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 0x18533(%rip), %xmm0    # 0x6be00
mulsd 0x1700b(%rip), %xmm0    # 0x6a8e0
addsd %xmm1, %xmm0
addsd -0x38(%rbp), %xmm0
divsd 0x16fea(%rip), %xmm0    # 0x6a8d0
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x30(%rbp)
movq %r15, %rdi
callq 0x4f027
movsd %xmm0, -0x50(%rbp)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x8330
addsd -0x38(%rbp), %xmm0
subsd -0x50(%rbp), %xmm0
divsd 0x16fb4(%rip), %xmm0    # 0x6a8d0
callq 0x8ac0
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 0x179af(%rip), %r13     # 0x6b30d
movl %r12d, -0x38(%rbp)
leaq -0x120(%rbp), %r12
movq %r12, %rdi
movq %r13, %rsi
xorl %eax, %eax
callq 0x8120
leaq 0x219f4(%rip), %rsi     # 0x75371
movq %r14, %rdi
movq %r12, %rdx
callq 0x53dcf
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 0x219b9(%rip), %rsi     # 0x75375
movq %r14, %rdi
movq %r12, %rdx
callq 0x53dcf
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 0x2198e(%rip), %rsi     # 0x75379
movq %r14, %rdi
movq %r12, %rdx
callq 0x53dcf
movl %eax, -0x68(%rbp)
leaq 0x2197d(%rip), %rsi     # 0x7537d
movq %r12, %rdi
movsd -0x40(%rbp), %xmm0
movb $0x1, %al
callq 0x8120
leaq 0x2196e(%rip), %rsi     # 0x75384
movq %r14, %rdi
movq %r12, %rdx
callq 0x53dcf
movl %eax, -0x64(%rbp)
movsd 0x21154(%rip), %xmm1    # 0x74b80
movsd -0x40(%rbp), %xmm0
callq 0x8850
leaq 0x2194a(%rip), %r15     # 0x75387
movq %r12, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x8120
leaq 0x2193d(%rip), %rsi     # 0x7538e
movq %r14, %rdi
movq %r12, %rdx
callq 0x53dcf
movl %eax, -0x40(%rbp)
leaq -0xe0(%rbp), %r13
movsd 0x8(%r13), %xmm0
movq %r12, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x8120
leaq 0x21911(%rip), %rsi     # 0x75391
movq %r14, %rdi
movq %r12, %rdx
callq 0x53dcf
movl %eax, %ebx
movsd 0x10(%r13), %xmm0
movq %r12, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x8120
leaq 0x22684(%rip), %rsi     # 0x7612b
movq %r14, %rdi
movq %r12, %rdx
callq 0x53dcf
movl %eax, -0x60(%rbp)
movq %r12, %rdi
movq %r15, %rsi
movsd -0x48(%rbp), %xmm0
movb $0x1, %al
callq 0x8120
leaq 0x218c6(%rip), %rsi     # 0x75394
movq %r14, %rdi
movq %r12, %rdx
callq 0x53dcf
movl %eax, -0x48(%rbp)
movsd 0x20(%r13), %xmm0
movsd %xmm0, -0x78(%rbp)
movq %r12, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x8120
leaq 0x2189c(%rip), %rsi     # 0x75397
movq %r14, %rdi
movq %r12, %rdx
callq 0x53dcf
movl %eax, %r13d
leaq -0xe0(%rbp), %rax
movsd 0x28(%rax), %xmm0
callq 0x8ac0
movq %r12, %rdi
movq %r15, %rsi
movb $0x1, %al
callq 0x8120
leaq 0x2186c(%rip), %rsi     # 0x7539a
movq %r14, %rdi
movq %r12, %rdx
callq 0x53dcf
movl %eax, -0x5c(%rbp)
leaq 0x214bb(%rip), %rsi     # 0x74ffe
movq %r12, %rdi
movl -0x2c(%rbp), %edx
xorl %eax, %eax
callq 0x8120
leaq 0x21846(%rip), %rsi     # 0x7539d
movq %r14, %rdi
movq %r12, %rdx
callq 0x53dcf
movl %eax, -0x2c(%rbp)
leaq 0x21834(%rip), %rsi     # 0x753a0
movq %r12, %rdi
movq -0x58(%rbp), %rdx
xorl %eax, %eax
callq 0x8120
leaq 0x21824(%rip), %rsi     # 0x753a5
movq %r14, %rdi
movq %r12, %rdx
callq 0x53dcf
movl %eax, -0x58(%rbp)
movq %r12, %rdi
leaq 0x22592(%rip), %rsi     # 0x7612b
movl -0x30(%rbp), %edx
xorl %eax, %eax
callq 0x8120
leaq 0x217fe(%rip), %rsi     # 0x753a8
movq %r14, %rdi
movq %r12, %rdx
callq 0x53dcf
movl %eax, %r15d
movq -0x80(%rbp), %rax
addl $0x61, %eax
movb %al, (%r12)
movb $0x0, 0x1(%r12)
leaq 0x217db(%rip), %rsi     # 0x753ab
movq %r14, %rdi
movq %r12, %rdx
callq 0x53dcf
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 0x17701(%rip), %rsi     # 0x6b30d
xorl %eax, %eax
callq 0x8120
leaq 0x21794(%rip), %rsi     # 0x753ae
movq %r14, %rdi
movq %r12, %rdx
callq 0x53dcf
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 0x53dba
leaq 0x21709(%rip), %rsi     # 0x75371
movq %r14, %rdi
callq 0x8160
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
testq %rax, %rax
jne 0x53dba
leaq 0x216ef(%rip), %rsi     # 0x75375
movq %r14, %rdi
callq 0x8160
testq %rax, %rax
jne 0x53dba
leaq 0x216db(%rip), %rsi     # 0x75379
movq %r14, %rdi
callq 0x8160
testq %rax, %rax
jne 0x53dba
leaq 0x216ce(%rip), %rsi     # 0x75384
movq %r14, %rdi
callq 0x8160
testq %rax, %rax
jne 0x53dba
leaq 0x216c0(%rip), %rsi     # 0x7538e
movq %r14, %rdi
callq 0x8160
testq %rax, %rax
jne 0x53dba
leaq 0x216ab(%rip), %rsi     # 0x75391
movq %r14, %rdi
callq 0x8160
testq %rax, %rax
jne 0x53dba
leaq 0x2242d(%rip), %rsi     # 0x7612b
movq %r14, %rdi
callq 0x8160
testq %rax, %rax
jne 0x53dba
leaq 0x2167e(%rip), %rsi     # 0x75394
movq %r14, %rdi
callq 0x8160
testq %rax, %rax
jne 0x53dba
leaq 0x21669(%rip), %rsi     # 0x75397
movq %r14, %rdi
callq 0x8160
testq %rax, %rax
jne 0x53dba
leaq 0x21658(%rip), %rsi     # 0x7539a
movq %r14, %rdi
callq 0x8160
testq %rax, %rax
jne 0x53dba
leaq 0x21647(%rip), %rsi     # 0x7539d
movq %r14, %rdi
callq 0x8160
testq %rax, %rax
jne 0x53dba
leaq 0x2163b(%rip), %rsi     # 0x753a5
movq %r14, %rdi
callq 0x8160
testq %rax, %rax
jne 0x53dba
leaq 0x2162a(%rip), %rsi     # 0x753a8
movq %r14, %rdi
callq 0x8160
testq %rax, %rax
jne 0x53dba
leaq 0x21619(%rip), %rsi     # 0x753ab
movq %r14, %rdi
callq 0x8160
testq %rax, %rax
jne 0x53dba
leaq 0x21608(%rip), %rsi     # 0x753ae
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