// File: /workspace/github_cpp_makefile_star2_O2/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
pushq $0x25
popq %rsi
movq %r14, %rdi
callq 0x8250
testq %rax, %rax
je 0x4b09f
cmpb $0x0, (%r12)
je 0x4b0a7
leaq 0x202f2(%rip), %rsi     # 0x6b381
movq %r14, %rdi
movq %r12, %rdx
callq 0x4b5d6
movl %eax, %r13d
jmp 0x4b0aa
xorl %r12d, %r12d
jmp 0x4b5c1
xorl %r13d, %r13d
cmpb $0x0, (%r15)
je 0x4b0c5
leaq 0x202cd(%rip), %rsi     # 0x6b384
movq %r14, %rdi
movq %r15, %rdx
callq 0x4b5d6
orl %eax, %r13d
testq %rbx, %rbx
je 0x4b46a
leaq -0xe0(%rbp), %r15
movq %rbx, %rdi
movsd -0x38(%rbp), %xmm0
movq %r15, %rsi
callq 0x46fbf
movsd (%r15), %xmm0
movsd %xmm0, -0x40(%rbp)
movq %r15, %r12
leaq -0xb0(%rbp), %r15
movsd %xmm0, (%r15)
leaq -0x6c(%rbp), %rsi
movq %rbx, %rdi
movsd -0x38(%rbp), %xmm0
callq 0x470f1
divsd 0x157a9(%rip), %xmm0    # 0x608c0
callq 0x8ac0
cvttsd2si %xmm0, %eax
movl %eax, -0x30(%rbp)
movq %r15, %rdi
callq 0x46ee2
movsd %xmm0, -0x50(%rbp)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x8340
addsd -0x38(%rbp), %xmm0
subsd -0x50(%rbp), %xmm0
divsd 0x15773(%rip), %xmm0    # 0x608c0
callq 0x8ac0
cvttsd2si %xmm0, %eax
movsd 0x18(%r12), %xmm0
movsd %xmm0, -0x48(%rbp)
cvttsd2si %xmm0, %r12d
incl %eax
movl %eax, -0x2c(%rbp)
pushq $0x3
popq %rcx
movl %r12d, %eax
cltd
idivl %ecx
movl %r12d, %eax
subl %edx, %eax
leaq 0x1617c(%rip), %rbx     # 0x612fd
leaq -0x120(%rbp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movl %eax, %edx
xorl %eax, %eax
callq 0x8110
leaq 0x201e9(%rip), %rsi     # 0x6b387
movq %r14, %rdi
movq %r15, %rdx
callq 0x4b5d6
movl %eax, -0x38(%rbp)
pushq $0x6
popq %rcx
movl %r12d, %eax
cltd
idivl %ecx
movl %r12d, %eax
subl %edx, %eax
movq %r15, %rdi
movq %rbx, %rsi
movl %eax, %edx
xorl %eax, %eax
callq 0x8110
leaq 0x201bb(%rip), %rsi     # 0x6b38b
movq %r14, %rdi
movq %r15, %rdx
callq 0x4b5d6
movl %eax, -0x50(%rbp)
pushq $0xc
popq %rcx
movq %r12, -0x80(%rbp)
movl %r12d, %eax
cltd
idivl %ecx
movl %r12d, %eax
subl %edx, %eax
movq %r15, %rdi
movq %rbx, %rsi
movl %eax, %edx
xorl %eax, %eax
callq 0x8110
leaq 0x20189(%rip), %rsi     # 0x6b38f
movq %r14, %rdi
movq %r15, %rdx
callq 0x4b5d6
movl %eax, -0x68(%rbp)
leaq 0x20178(%rip), %rsi     # 0x6b393
movq %r15, %rdi
movsd -0x40(%rbp), %xmm0
movb $0x1, %al
callq 0x8110
leaq 0x20169(%rip), %rsi     # 0x6b39a
movq %r14, %rdi
movq %r15, %rdx
callq 0x4b5d6
movl %eax, -0x64(%rbp)
movsd 0x1f939(%rip), %xmm1    # 0x6ab80
movsd -0x40(%rbp), %xmm0
callq 0x8840
leaq 0x20145(%rip), %r12     # 0x6b39d
movq %r15, %rdi
movq %r12, %rsi
movb $0x1, %al
callq 0x8110
leaq 0x20138(%rip), %rsi     # 0x6b3a4
movq %r14, %rdi
movq %r15, %rdx
callq 0x4b5d6
movl %eax, -0x60(%rbp)
leaq -0xe0(%rbp), %rbx
movsd 0x8(%rbx), %xmm0
movq %r15, %rdi
movq %r12, %rsi
movb $0x1, %al
callq 0x8110
leaq 0x2010d(%rip), %rsi     # 0x6b3a7
movq %r14, %rdi
movq %r15, %rdx
callq 0x4b5d6
movl %r13d, -0x40(%rbp)
movl %eax, %r13d
movsd 0x10(%rbx), %xmm0
movq %r15, %rdi
movq %r12, %rsi
movb $0x1, %al
callq 0x8110
leaq 0x20ea6(%rip), %rsi     # 0x6c16b
movq %r14, %rdi
movq %r15, %rdx
callq 0x4b5d6
movl %eax, -0x5c(%rbp)
movq %r15, %rdi
movq %r12, %rsi
movsd -0x48(%rbp), %xmm0
movb $0x1, %al
callq 0x8110
leaq 0x200be(%rip), %rsi     # 0x6b3aa
movq %r14, %rdi
movq %r15, %rdx
callq 0x4b5d6
movl %eax, -0x48(%rbp)
movsd 0x20(%rbx), %xmm0
movsd %xmm0, -0x78(%rbp)
movq %r15, %rdi
movq %r12, %rsi
movb $0x1, %al
callq 0x8110
leaq 0x20095(%rip), %rsi     # 0x6b3ad
movq %r14, %rdi
movq %r15, %rdx
callq 0x4b5d6
movl %eax, %ebx
leaq -0xe0(%rbp), %rax
movsd 0x28(%rax), %xmm0
callq 0x8ac0
movq %r15, %rdi
movq %r12, %rsi
movb $0x1, %al
callq 0x8110
leaq 0x20066(%rip), %rsi     # 0x6b3b0
movq %r14, %rdi
movq %r15, %rdx
callq 0x4b5d6
movl %eax, -0x58(%rbp)
leaq 0x1fcb5(%rip), %rsi     # 0x6b014
movq %r15, %rdi
movl -0x2c(%rbp), %edx
xorl %eax, %eax
callq 0x8110
leaq 0x20040(%rip), %rsi     # 0x6b3b3
movq %r14, %rdi
movq %r15, %rdx
callq 0x4b5d6
movl %eax, -0x2c(%rbp)
leaq -0x6c(%rbp), %rax
movl (%rax), %edx
leaq 0x20028(%rip), %rsi     # 0x6b3b6
movq %r15, %rdi
xorl %eax, %eax
callq 0x8110
leaq 0x2001c(%rip), %rsi     # 0x6b3bb
movq %r14, %rdi
movq %r15, %rdx
callq 0x4b5d6
movl %eax, -0x54(%rbp)
movq %r15, %rdi
leaq 0x20db4(%rip), %rsi     # 0x6c16b
movl -0x30(%rbp), %edx
xorl %eax, %eax
callq 0x8110
leaq 0x1fff6(%rip), %rsi     # 0x6b3be
movq %r14, %rdi
movq %r15, %rdx
callq 0x4b5d6
movl %eax, %r12d
movq -0x80(%rbp), %rax
addl $0x61, %eax
movb %al, (%r15)
movb $0x0, 0x1(%r15)
leaq 0x1ffd5(%rip), %rsi     # 0x6b3c1
movq %r14, %rdi
movq %r15, %rdx
callq 0x4b5d6
movl %eax, -0x30(%rbp)
cvttsd2si -0x78(%rbp), %ecx
pushq $0xf
popq %rsi
movl %ecx, %eax
cltd
idivl %esi
subl %edx, %ecx
movq %r15, %rdi
leaq 0x15eea(%rip), %rsi     # 0x612fd
movl %ecx, %edx
xorl %eax, %eax
callq 0x8110
leaq 0x1ffa1(%rip), %rsi     # 0x6b3c4
movq %r14, %rdi
movq %r15, %rdx
callq 0x4b5d6
movl -0x50(%rbp), %ecx
orl -0x38(%rbp), %ecx
movl -0x64(%rbp), %edx
orl -0x68(%rbp), %edx
orl %ecx, %edx
orl -0x60(%rbp), %r13d
orl -0x5c(%rbp), %r13d
orl %edx, %r13d
orl -0x48(%rbp), %ebx
orl -0x58(%rbp), %ebx
orl -0x2c(%rbp), %ebx
orl %r13d, %ebx
orl -0x54(%rbp), %r12d
orl -0x30(%rbp), %r12d
orl %eax, %r12d
orl -0x40(%rbp), %r12d
orl %ebx, %r12d
jmp 0x4b5c1
leaq 0x1ff16(%rip), %rsi     # 0x6b387
movq %r14, %rdi
callq 0x8170
pushq $-0x1
popq %r12
testq %rax, %rax
jne 0x4b5c1
leaq 0x1fefe(%rip), %rsi     # 0x6b38b
movq %r14, %rdi
callq 0x8170
testq %rax, %rax
jne 0x4b5c1
leaq 0x1feea(%rip), %rsi     # 0x6b38f
movq %r14, %rdi
callq 0x8170
testq %rax, %rax
jne 0x4b5c1
leaq 0x1fedd(%rip), %rsi     # 0x6b39a
movq %r14, %rdi
callq 0x8170
testq %rax, %rax
jne 0x4b5c1
leaq 0x1fecf(%rip), %rsi     # 0x6b3a4
movq %r14, %rdi
callq 0x8170
testq %rax, %rax
jne 0x4b5c1
leaq 0x1feba(%rip), %rsi     # 0x6b3a7
movq %r14, %rdi
callq 0x8170
testq %rax, %rax
jne 0x4b5c1
leaq 0x20c66(%rip), %rsi     # 0x6c16b
movq %r14, %rdi
callq 0x8170
testq %rax, %rax
jne 0x4b5c1
leaq 0x1fe8d(%rip), %rsi     # 0x6b3aa
movq %r14, %rdi
callq 0x8170
testq %rax, %rax
jne 0x4b5c1
leaq 0x1fe78(%rip), %rsi     # 0x6b3ad
movq %r14, %rdi
callq 0x8170
testq %rax, %rax
jne 0x4b5c1
leaq 0x1fe67(%rip), %rsi     # 0x6b3b0
movq %r14, %rdi
callq 0x8170
testq %rax, %rax
jne 0x4b5c1
leaq 0x1fe56(%rip), %rsi     # 0x6b3b3
movq %r14, %rdi
callq 0x8170
testq %rax, %rax
jne 0x4b5c1
leaq 0x1fe4a(%rip), %rsi     # 0x6b3bb
movq %r14, %rdi
callq 0x8170
testq %rax, %rax
jne 0x4b5c1
leaq 0x1fe39(%rip), %rsi     # 0x6b3be
movq %r14, %rdi
callq 0x8170
testq %rax, %rax
jne 0x4b5c1
leaq 0x1fe28(%rip), %rsi     # 0x6b3c1
movq %r14, %rdi
callq 0x8170
testq %rax, %rax
jne 0x4b5c1
leaq 0x1fe17(%rip), %rsi     # 0x6b3c4
movq %r14, %rdi
callq 0x8170
xorl %r12d, %r12d
negq %rax
sbbl %r12d, %r12d
orl %r13d, %r12d
movl %r12d, %eax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq