// File: DoubleString[P]RtConverter/src/Rtklib/stream.cpp
// Function: bamboo::nextdltime(int const*, int)
static gtime_t nextdltime(const int *topts, int stat)
	{
		gtime_t time;
		double tow;
		int week, tint;

		tracet(3, "nextdltime: topts=%d %d %d %d stat=%d\n", topts[0], topts[1],
			topts[2], topts[3], stat);

		/* current time (gpst) */
		time = utc2gpst(timeget());
		tow = time2gpst(time, &week);

		/* next retry time */
		if (stat == 0 && topts[3] > 0) {
			tow = (floor((tow - topts[2]) / topts[3]) + 1.0)*topts[3] + topts[2];
			return gpst2time(week, tow);
		}
		/* next interval time */
		tint = topts[1] <= 0 ? 3600 : topts[1];
		tow = (floor((tow - topts[2]) / tint) + 1.0)*tint + topts[2];
		time = gpst2time(week, tow);

		return time;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x18(%rbp)
movl %esi, -0x1c(%rbp)
movq -0x18(%rbp), %rax
movl (%rax), %edx
movq -0x18(%rbp), %rax
movl 0x4(%rax), %ecx
movq -0x18(%rbp), %rax
movl 0x8(%rax), %r8d
movq -0x18(%rbp), %rax
movl 0xc(%rax), %r9d
movl -0x1c(%rbp), %eax
movl $0x3, %edi
leaq 0x2206f(%rip), %rsi     # 0xc9efd
movl %eax, (%rsp)
movb $0x0, %al
callq 0x95890
callq 0x8e920
movq %rax, -0x60(%rbp)
movsd %xmm0, -0x58(%rbp)
movq -0x60(%rbp), %rdi
movsd -0x58(%rbp), %xmm0
callq 0x8f0a0
movq %rax, -0x50(%rbp)
movsd %xmm0, -0x48(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x70(%rbp), %rdi
movsd -0x68(%rbp), %xmm0
leaq -0x3c(%rbp), %rsi
callq 0x8e540
movsd %xmm0, -0x38(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0xa7f6e
movq -0x18(%rbp), %rax
cmpl $0x0, 0xc(%rax)
jle 0xa7f6e
movsd -0x38(%rbp), %xmm0
movq -0x18(%rbp), %rax
cvtsi2sdl 0x8(%rax), %xmm1
subsd %xmm1, %xmm0
movq -0x18(%rbp), %rax
cvtsi2sdl 0xc(%rax), %xmm1
divsd %xmm1, %xmm0
callq 0x9c90
movsd 0x13f30(%rip), %xmm1    # 0xbbe60
addsd %xmm1, %xmm0
movq -0x18(%rbp), %rax
cvtsi2sdl 0xc(%rax), %xmm2
movq -0x18(%rbp), %rax
cvtsi2sdl 0x8(%rax), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
movl -0x3c(%rbp), %edi
movsd -0x38(%rbp), %xmm0
callq 0x8e4a0
movq %rax, -0x10(%rbp)
movsd %xmm0, -0x8(%rbp)
jmp 0xa8018
movq -0x18(%rbp), %rax
cmpl $0x0, 0x4(%rax)
jg 0xa7f85
movl $0xe10, %eax            # imm = 0xE10
movl %eax, -0x84(%rbp)
jmp 0xa7f92
movq -0x18(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x84(%rbp)
movl -0x84(%rbp), %eax
movl %eax, -0x40(%rbp)
movsd -0x38(%rbp), %xmm0
movq -0x18(%rbp), %rax
cvtsi2sdl 0x8(%rax), %xmm1
subsd %xmm1, %xmm0
cvtsi2sdl -0x40(%rbp), %xmm1
divsd %xmm1, %xmm0
callq 0x9c90
movsd 0x13e9d(%rip), %xmm1    # 0xbbe60
addsd %xmm1, %xmm0
cvtsi2sdl -0x40(%rbp), %xmm2
movq -0x18(%rbp), %rax
cvtsi2sdl 0x8(%rax), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
movl -0x3c(%rbp), %edi
movsd -0x38(%rbp), %xmm0
callq 0x8e4a0
movq %rax, -0x80(%rbp)
movsd %xmm0, -0x78(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x10(%rbp), %rax
movsd -0x8(%rbp), %xmm0
addq $0x90, %rsp
popq %rbp
retq
nopw (%rax,%rax)