double make_tics(tmin, tmax)
double tmin, tmax;
{
  register double xr, xnorm, tics, tic, l10;
  xr = fabs(tmin - tmax);
  l10 = log10(xr);
  xnorm = pow(10.0, l10 - (double)((l10 >= 0.0) ? (int)l10 : ((int)l10 - 1)));
  if (xnorm <= 2)
    tics = 0.2;
  else if (xnorm <= 5)
    tics = 0.5;
  else
    tics = 1.0;
  tic = tics * dbl_raise(10.0, (l10 >= 0.0) ? (int)l10 : ((int)l10 - 1));
  return (tic);
}


x86 assembly (clang, -O0):
<make_tics>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movaps 0xead(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1050 <log10@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1194 <make_tics+0x64>
cvttsd2si -0x38(%rbp),%eax
mov    %eax,-0x44(%rbp)
jmp    119f <make_tics+0x6f>
cvttsd2si -0x38(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x44(%rbp)
movsd  -0x40(%rbp),%xmm1
mov    -0x44(%rbp),%eax
cvtsi2sd %eax,%xmm0
subsd  %xmm0,%xmm1
movsd  0xe61(%rip),%xmm0
call   1040 <pow@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  0xe47(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jb     11e6 <make_tics+0xb6>
movsd  0xe5c(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    121d <make_tics+0xed>
movsd  0xe32(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jb     120b <make_tics+0xdb>
movsd  0xe2f(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1218 <make_tics+0xe8>
movsd  0xe15(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    121d <make_tics+0xed>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x38(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1246 <make_tics+0x116>
cvttsd2si -0x38(%rbp),%eax
mov    %eax,-0x54(%rbp)
jmp    1251 <make_tics+0x121>
cvttsd2si -0x38(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x54(%rbp)
mov    -0x54(%rbp),%edi
movsd  0xdbc(%rip),%xmm0
mov    $0x1,%al
call   1030 <dbl_raise@plt>
movsd  -0x50(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_tics>:
push   %rbx
sub    $0x10,%rsp
subsd  %xmm1,%xmm0
andpd  0xebf(%rip),%xmm0
call   1050 <log10@plt>
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
cvttsd2si %xmm1,%ebx
sbb    $0x0,%ebx
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
subsd  %xmm0,%xmm1
movsd  0xeb4(%rip),%xmm0
call   1040 <pow@plt>
movsd  0xeaf(%rip),%xmm1
xor    %eax,%eax
ucomisd %xmm0,%xmm1
setb   %al
lea    0xe87(%rip),%rcx
movsd  (%rcx,%rax,8),%xmm2
cmpnlesd 0xe99(%rip),%xmm0
andpd  %xmm0,%xmm2
movsd  0xe95(%rip),%xmm1
andnpd %xmm1,%xmm0
orpd   %xmm2,%xmm0
movapd %xmm0,(%rsp)
movsd  0xe68(%rip),%xmm0
mov    %ebx,%edi
mov    $0x1,%al
call   1030 <dbl_raise@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  (%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @make_tics(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double %0, double* %3
store double %1, double* %4
%10 = load double, double* %3
%11 = load double, double* %4
%12 = fsub double %10, %11
%13 = call double @llvm.fabs.f64(double %12)
store double %13, double* %5
%14 = load double, double* %5
%15 = call double @log10(double %14)
store double %15, double* %9
%16 = load double, double* %9
%17 = load double, double* %9
%18 = fcmp oge double %17, 0.000000e+00
br i1 %18, label %19, label %22
19: ; preds = %2
%20 = load double, double* %9
%21 = fptosi double %20 to i32
br label %26
22: ; preds = %2
%23 = load double, double* %9
%24 = fptosi double %23 to i32
%25 = sub nsw i32 %24, 1
br label %26
26: ; preds = %22, %19
%27 = phi i32 [ %21, %19 ], [ %25, %22 ]
%28 = sitofp i32 %27 to double
%29 = fsub double %16, %28
%30 = call double @pow(double 1.000000e+01, double %29)
store double %30, double* %6
%31 = load double, double* %6
%32 = fcmp ole double %31, 2.000000e+00
br i1 %32, label %33, label %34
33: ; preds = %26
store double 2.000000e-01, double* %7
br label %40
34: ; preds = %26
%35 = load double, double* %6
%36 = fcmp ole double %35, 5.000000e+00
br i1 %36, label %37, label %38
37: ; preds = %34
store double 5.000000e-01, double* %7
br label %39
38: ; preds = %34
store double 1.000000e+00, double* %7
br label %39
39: ; preds = %38, %37
br label %40
40: ; preds = %39, %33
%41 = load double, double* %7
%42 = load double, double* %9
%43 = fcmp oge double %42, 0.000000e+00
br i1 %43, label %44, label %47
44: ; preds = %40
%45 = load double, double* %9
%46 = fptosi double %45 to i32
br label %51
47: ; preds = %40
%48 = load double, double* %9
%49 = fptosi double %48 to i32
%50 = sub nsw i32 %49, 1
br label %51
51: ; preds = %47, %44
%52 = phi i32 [ %46, %44 ], [ %50, %47 ]
%53 = call i32 (double, i32, ...) bitcast (i32 (...)* @dbl_raise to i32 (double, i32, ...)*)(double 1.000000e+01, i32 %52)
%54 = sitofp i32 %53 to double
%55 = fmul double %41, %54
store double %55, double* %8
%56 = load double, double* %8
ret double %56
}

LLVM IR (-O2):
define double @make_tics(double %0, double %1) {
%3 = fsub double %0, %1
%4 = tail call double @llvm.fabs.f64(double %3)
%5 = tail call double @log10(double %4)
%6 = fcmp ult double %5, 0.000000e+00
%7 = fptosi double %5 to i32
%8 = sext i1 %6 to i32
%9 = add nsw i32 %8, %7
%10 = sitofp i32 %9 to double
%11 = fsub double %5, %10
%12 = tail call double @pow(double 1.000000e+01, double %11)
%13 = fcmp ugt double %12, 2.000000e+00
%14 = fcmp ugt double %12, 5.000000e+00
%15 = select i1 %14, double 1.000000e+00, double 5.000000e-01
%16 = select i1 %13, double %15, double 2.000000e-01
%17 = tail call i32 (double, i32, ...) bitcast (i32 (...)* @dbl_raise to i32 (double, i32, ...)*)(double 1.000000e+01, i32 %9)
%18 = sitofp i32 %17 to double
%19 = fmul double %16, %18
ret double %19
}