float calc_indexing_factor(int dob, int year) {
  float indexing_factor = 0.0;
  int age_60 = dob + 60;
  if (year >= age_60) {
    indexing_factor = 1.0;
    printf("%s(): dob %d : year %d : age_60 %d.\n", __func__, dob, year,
           age_60);
  } else {
    float awi_60 = average_wage_index_get(age_60);
    float awi = average_wage_index_get(year);
    indexing_factor = awi_60 / awi;
    printf("%s(): dob %d : year %d : awi_60 %f : awi %f : indexing_factor %f\n",
           __func__, dob, year, awi_60, awi, indexing_factor);
  }
  return indexing_factor;
}


x86 assembly (clang, -O0):
<calc_indexing_factor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    $0x3c,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jl     117c <calc_indexing_factor+0x5c>
movss  0xead(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
mov    -0x10(%rbp),%r8d
lea    0xe9b(%rip),%rdi
lea    0xeb9(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e7 <calc_indexing_factor+0xc7>
mov    -0x10(%rbp),%edi
mov    $0x0,%al
call   1040 <average_wage_index_get@plt>
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1040 <average_wage_index_get@plt>
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
divss  -0x18(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x18(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0xc(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xe65(%rip),%rdi
lea    0xe49(%rip),%rsi
mov    $0x3,%al
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_indexing_factor>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%r14d
lea    0x3c(%r14),%r8d
cmp    %esi,%r8d
jle    1194 <calc_indexing_factor+0x74>
mov    %r8d,%edi
xor    %eax,%eax
call   1040 <average_wage_index_get@plt>
cvtsi2ss %eax,%xmm0
movss  %xmm0,0x4(%rsp)
mov    %ebx,%edi
xor    %eax,%eax
call   1040 <average_wage_index_get@plt>
cvtsi2ss %eax,%xmm1
movss  0x4(%rsp),%xmm2
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
divss  %xmm1,%xmm2
movss  %xmm2,0x4(%rsp)
cvtss2sd %xmm1,%xmm1
cvtss2sd %xmm2,%xmm2
lea    0xec5(%rip),%rdi
lea    0xea9(%rip),%rsi
mov    %r14d,%edx
mov    %ebx,%ecx
mov    $0x3,%al
call   1030 <printf@plt>
movss  0x4(%rsp),%xmm0
jmp    11b6 <calc_indexing_factor+0x96>
lea    0xe69(%rip),%rdi
lea    0xe87(%rip),%rsi
mov    %r14d,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
movss  0xe4a(%rip),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [37 x i8] c"%s(): dob %d : year %d : age_60 %d.\0A\00"
@__func__.calc_indexing_factor = [21 x i8] c"calc_indexing_factor\00"
@.str.1 = [66 x i8] c"%s(): dob %d : year %d : awi_60 %f : awi %f : indexing_factor %f\0A\00"
define float @calc_indexing_factor(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
%6 = alloca i32
%7 = alloca float
%8 = alloca float
store i32 %0, i32* %3
store i32 %1, i32* %4
store float 0.000000e+00, float* %5
%9 = load i32, i32* %3
%10 = add nsw i32 %9, 60
store i32 %10, i32* %6
%11 = load i32, i32* %4
%12 = load i32, i32* %6
%13 = icmp sge i32 %11, %12
br i1 %13, label %14, label %19
14: ; preds = %2
store float 1.000000e+00, float* %5
%15 = load i32, i32* %3
%16 = load i32, i32* %4
%17 = load i32, i32* %6
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__func__.calc_indexing_factor, i64 0, i64 0), i32 %15, i32 %16, i32 %17)
br label %38
19: ; preds = %2
%20 = load i32, i32* %6
%21 = call i32 (i32, ...) bitcast (i32 (...)* @average_wage_index_get to i32 (i32, ...)*)(i32 %20)
%22 = sitofp i32 %21 to float
store float %22, float* %7
%23 = load i32, i32* %4
%24 = call i32 (i32, ...) bitcast (i32 (...)* @average_wage_index_get to i32 (i32, ...)*)(i32 %23)
%25 = sitofp i32 %24 to float
store float %25, float* %8
%26 = load float, float* %7
%27 = load float, float* %8
%28 = fdiv float %26, %27
store float %28, float* %5
%29 = load i32, i32* %3
%30 = load i32, i32* %4
%31 = load float, float* %7
%32 = fpext float %31 to double
%33 = load float, float* %8
%34 = fpext float %33 to double
%35 = load float, float* %5
%36 = fpext float %35 to double
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__func__.calc_indexing_factor, i64 0, i64 0), i32 %29, i32 %30, double %32, double %34, double %36)
br label %38
38: ; preds = %19, %14
%39 = load float, float* %5
ret float %39
}

LLVM IR (-O2):
@.str = [37 x i8] c"%s(): dob %d : year %d : age_60 %d.\0A\00"
@__func__.calc_indexing_factor = [21 x i8] c"calc_indexing_factor\00"
@.str.1 = [66 x i8] c"%s(): dob %d : year %d : awi_60 %f : awi %f : indexing_factor %f\0A\00"
define float @calc_indexing_factor(i32 %0, i32 %1) {
%3 = add nsw i32 %0, 60
%4 = icmp sgt i32 %3, %1
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__func__.calc_indexing_factor, i64 0, i64 0), i32 %0, i32 %1, i32 %3)
br label %17
7: ; preds = %2
%8 = tail call i32 (i32, ...) bitcast (i32 (...)* @average_wage_index_get to i32 (i32, ...)*)(i32 %3)
%9 = sitofp i32 %8 to float
%10 = tail call i32 (i32, ...) bitcast (i32 (...)* @average_wage_index_get to i32 (i32, ...)*)(i32 %1)
%11 = sitofp i32 %10 to float
%12 = fdiv float %9, %11
%13 = fpext float %9 to double
%14 = fpext float %11 to double
%15 = fpext float %12 to double
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__func__.calc_indexing_factor, i64 0, i64 0), i32 %0, i32 %1, double %13, double %14, double %15)
br label %17
17: ; preds = %7, %5
%18 = phi float [ 1.000000e+00, %5 ], [ %12, %7 ]
ret float %18
}