double set_tic(l10, guide)
double l10;
int guide;
{
  double xnorm, tics, posns;
  int fl = (int)floor(l10);
  xnorm = pow(10.0, l10 - fl);
  posns = guide / xnorm;
  if (posns > 40)
    tics = 0.05;
  else if (posns > 20)
    tics = 0.1;
  else if (posns > 10)
    tics = 0.2;
  else if (posns > 4)
    tics = 0.5;
  else if (posns > 1)
    tics = 1;
  else if (posns > 0.5)
    tics = 2;
  else
    tics = ceil(xnorm);
  return (tics * dbl_raise(10.0, fl));
}


x86 assembly (clang, -O0):
<set_tic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1060 <floor@plt>
cvttsd2si %xmm0,%eax
mov    %eax,-0x2c(%rbp)
movsd  -0x8(%rbp),%xmm1
cvtsi2sdl -0x2c(%rbp),%xmm0
subsd  %xmm0,%xmm1
movsd  0xe91(%rip),%xmm0
call   1050 <pow@plt>
movsd  %xmm0,-0x18(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xe63(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11b9 <set_tic+0x79>
movsd  0xe99(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    12ae <set_tic+0x16e>
movsd  -0x28(%rbp),%xmm0
movsd  0xe4a(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11e2 <set_tic+0xa2>
movsd  0xe68(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    12a9 <set_tic+0x169>
movsd  -0x28(%rbp),%xmm0
movsd  0xe19(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    120b <set_tic+0xcb>
movsd  0xe37(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    12a4 <set_tic+0x164>
movsd  -0x28(%rbp),%xmm0
movsd  0xe00(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1234 <set_tic+0xf4>
movsd  0xdfe(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    129f <set_tic+0x15f>
movsd  -0x28(%rbp),%xmm0
movsd  0xddf(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    125d <set_tic+0x11d>
movsd  0xdcd(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    129a <set_tic+0x15a>
movsd  -0x28(%rbp),%xmm0
movsd  0xdbe(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1286 <set_tic+0x146>
movsd  0xdb4(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1295 <set_tic+0x155>
movsd  -0x18(%rbp),%xmm0
call   1030 <ceil@plt>
movsd  %xmm0,-0x20(%rbp)
jmp    129a <set_tic+0x15a>
jmp    129f <set_tic+0x15f>
jmp    12a4 <set_tic+0x164>
jmp    12a9 <set_tic+0x169>
jmp    12ae <set_tic+0x16e>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x2c(%rbp),%edi
movsd  0xd45(%rip),%xmm0
mov    $0x1,%al
call   1040 <dbl_raise@plt>
movsd  -0x38(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_tic>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
movsd  %xmm0,(%rsp)
call   1060 <floor@plt>
cvttsd2si %xmm0,%ebx
cvttpd2dq %xmm0,%xmm0
cvtdq2pd %xmm0,%xmm0
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  0xe94(%rip),%xmm0
call   1050 <pow@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %ebp,%xmm1
divsd  %xmm0,%xmm1
ucomisd 0xe8c(%rip),%xmm1
jbe    1190 <set_tic+0x50>
movsd  0xe7a(%rip),%xmm2
jmp    11f7 <set_tic+0xb7>
ucomisd 0xe88(%rip),%xmm1
jbe    11a4 <set_tic+0x64>
movsd  0xe76(%rip),%xmm2
jmp    11f7 <set_tic+0xb7>
ucomisd 0xe54(%rip),%xmm1
jbe    11b8 <set_tic+0x78>
movsd  0xe72(%rip),%xmm2
jmp    11f7 <set_tic+0xb7>
ucomisd 0xe78(%rip),%xmm1
jbe    11cc <set_tic+0x8c>
movsd  0xe66(%rip),%xmm2
jmp    11f7 <set_tic+0xb7>
movsd  0xe6c(%rip),%xmm2
ucomisd %xmm2,%xmm1
ja     11f7 <set_tic+0xb7>
ucomisd 0xe4e(%rip),%xmm1
jbe    11ee <set_tic+0xae>
movsd  0xe5c(%rip),%xmm2
jmp    11f7 <set_tic+0xb7>
call   1030 <ceil@plt>
movapd %xmm0,%xmm2
movsd  %xmm2,(%rsp)
movsd  0xdfc(%rip),%xmm0
mov    %ebx,%edi
mov    $0x1,%al
call   1040 <dbl_raise@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  (%rsp),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define double @set_tic(double %0, i32 %1) {
%3 = tail call double @llvm.floor.f64(double %0)
%4 = fptosi double %3 to i32
%5 = sitofp i32 %4 to double
%6 = fsub double %0, %5
%7 = tail call double @pow(double 1.000000e+01, double %6)
%8 = sitofp i32 %1 to double
%9 = fdiv double %8, %7
%10 = fcmp ogt double %9, 4.000000e+01
br i1 %10, label %23, label %11
11: ; preds = %2
%12 = fcmp ogt double %9, 2.000000e+01
br i1 %12, label %23, label %13
13: ; preds = %11
%14 = fcmp ogt double %9, 1.000000e+01
br i1 %14, label %23, label %15
15: ; preds = %13
%16 = fcmp ogt double %9, 4.000000e+00
br i1 %16, label %23, label %17
17: ; preds = %15
%18 = fcmp ogt double %9, 1.000000e+00
br i1 %18, label %23, label %19
19: ; preds = %17
%20 = fcmp ogt double %9, 5.000000e-01
br i1 %20, label %23, label %21
21: ; preds = %19
%22 = tail call double @llvm.ceil.f64(double %7)
br label %23
23: ; preds = %19, %17, %15, %13, %11, %2, %21
%24 = phi double [ %22, %21 ], [ 5.000000e-02, %2 ], [ 1.000000e-01, %11 ], [ 2.000000e-01, %13 ], [ 5.000000e-01, %15 ], [ 1.000000e+00, %17 ], [ 2.000000e+00, %19 ]
%25 = tail call i32 (double, i32, ...) bitcast (i32 (...)* @dbl_raise to i32 (double, i32, ...)*)(double 1.000000e+01, i32 %4)
%26 = sitofp i32 %25 to double
%27 = fmul double %24, %26
ret double %27
}