void find_max_min_tic(tmin, tmax, tic) double *tmin, *tmax, tic;
{
  double t1 = *tmin;
  t1 = tic * floor(*tmin / tic);
  if (t1 < *tmin)
    t1 += tic;
  *tmin = t1;
  t1 = tic * ceil(*tmax / tic);
  if (t1 > *tmax)
    t1 -= tic;
  *tmax = t1;
}


x86 assembly (clang, -O0):
<find_max_min_tic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
divsd  -0x18(%rbp),%xmm0
call   1040 <floor@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm1
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    1195 <find_max_min_tic+0x75>
movsd  -0x18(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
divsd  -0x18(%rbp),%xmm0
call   1030 <ceil@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
ucomisd (%rax),%xmm0
jbe    11f5 <find_max_min_tic+0xd5>
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_max_min_tic>:
push   %r14
push   %rbx
sub    $0x28,%rsp
movapd %xmm0,%xmm1
movapd %xmm0,0x10(%rsp)
mov    %rsi,%r14
mov    %rdi,%rbx
movsd  (%rdi),%xmm0
movsd  %xmm0,(%rsp)
divsd  %xmm1,%xmm0
call   1040 <floor@plt>
movapd 0x10(%rsp),%xmm3
mulsd  %xmm3,%xmm0
movapd %xmm0,%xmm1
cmpltsd (%rsp),%xmm1
movapd %xmm1,%xmm2
andpd  %xmm3,%xmm2
movapd %xmm3,%xmm4
movsd  0xe8f(%rip),%xmm3
andnpd %xmm3,%xmm1
orpd   %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rbx)
movsd  (%r14),%xmm0
movapd %xmm0,(%rsp)
divsd  %xmm4,%xmm0
call   1030 <ceil@plt>
movapd 0x10(%rsp),%xmm1
mulsd  %xmm1,%xmm0
movapd (%rsp),%xmm2
cmpltsd %xmm0,%xmm2
andpd  %xmm1,%xmm2
subsd  %xmm2,%xmm0
movsd  %xmm0,(%r14)
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @find_max_min_tic(double* %0, double* %1, double %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double
%7 = alloca double
store double* %0, double** %4
store double* %1, double** %5
store double %2, double* %6
%8 = load double*, double** %4
%9 = load double, double* %8
store double %9, double* %7
%10 = load double, double* %6
%11 = load double*, double** %4
%12 = load double, double* %11
%13 = load double, double* %6
%14 = fdiv double %12, %13
%15 = call double @llvm.floor.f64(double %14)
%16 = fmul double %10, %15
store double %16, double* %7
%17 = load double, double* %7
%18 = load double*, double** %4
%19 = load double, double* %18
%20 = fcmp olt double %17, %19
br i1 %20, label %21, label %25
21: ; preds = %3
%22 = load double, double* %6
%23 = load double, double* %7
%24 = fadd double %23, %22
store double %24, double* %7
br label %25
25: ; preds = %21, %3
%26 = load double, double* %7
%27 = load double*, double** %4
store double %26, double* %27
%28 = load double, double* %6
%29 = load double*, double** %5
%30 = load double, double* %29
%31 = load double, double* %6
%32 = fdiv double %30, %31
%33 = call double @llvm.ceil.f64(double %32)
%34 = fmul double %28, %33
store double %34, double* %7
%35 = load double, double* %7
%36 = load double*, double** %5
%37 = load double, double* %36
%38 = fcmp ogt double %35, %37
br i1 %38, label %39, label %43
39: ; preds = %25
%40 = load double, double* %6
%41 = load double, double* %7
%42 = fsub double %41, %40
store double %42, double* %7
br label %43
43: ; preds = %39, %25
%44 = load double, double* %7
%45 = load double*, double** %5
store double %44, double* %45
ret void
}

LLVM IR (-O2):
define void @find_max_min_tic(double* nocapture %0, double* nocapture %1, double %2) {
%4 = load double, double* %0
%5 = fdiv double %4, %2
%6 = tail call double @llvm.floor.f64(double %5)
%7 = fmul double %6, %2
%8 = fcmp olt double %7, %4
%9 = select i1 %8, double %2, double -0.000000e+00
%10 = fadd double %7, %9
store double %10, double* %0
%11 = load double, double* %1
%12 = fdiv double %11, %2
%13 = tail call double @llvm.ceil.f64(double %12)
%14 = fmul double %13, %2
%15 = fcmp ogt double %14, %11
%16 = select i1 %15, double %2, double 0.000000e+00
%17 = fsub double %14, %16
store double %17, double* %1
ret void
}