double lix(int *grade, int words, int longwords, int sentences) {
  double idx =
      ((double)words) / sentences + 100.0 * ((double)longwords) / words;
  if (idx < 34)
    *grade = 0;
  else if (idx < 38)
    *grade = 5;
  else if (idx < 41)
    *grade = 6;
  else if (idx < 44)
    *grade = 7;
  else if (idx < 48)
    *grade = 8;
  else if (idx < 51)
    *grade = 9;
  else if (idx < 54)
    *grade = 10;
  else if (idx < 57)
    *grade = 11;
  else
    *grade = 99;
  return idx;
}


x86 assembly (clang, -O0):
<lix>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvtsi2sdl -0x10(%rbp),%xmm2
movsd  0xedc(%rip),%xmm1
mulsd  %xmm2,%xmm1
cvtsi2sdl -0xc(%rbp),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xeb6(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1164 <lix+0x64>
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
jmp    127f <lix+0x17f>
movsd  0xea4(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1186 <lix+0x86>
mov    -0x8(%rbp),%rax
movl   $0x5,(%rax)
jmp    127a <lix+0x17a>
movsd  0xe8a(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    11a8 <lix+0xa8>
mov    -0x8(%rbp),%rax
movl   $0x6,(%rax)
jmp    1275 <lix+0x175>
movsd  0xe70(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    11ca <lix+0xca>
mov    -0x8(%rbp),%rax
movl   $0x7,(%rax)
jmp    1270 <lix+0x170>
movsd  0xe56(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    11ec <lix+0xec>
mov    -0x8(%rbp),%rax
movl   $0x8,(%rax)
jmp    126b <lix+0x16b>
movsd  0xe3c(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    120e <lix+0x10e>
mov    -0x8(%rbp),%rax
movl   $0x9,(%rax)
jmp    1266 <lix+0x166>
movsd  0xe22(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1230 <lix+0x130>
mov    -0x8(%rbp),%rax
movl   $0xa,(%rax)
jmp    1261 <lix+0x161>
movsd  0xe08(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1252 <lix+0x152>
mov    -0x8(%rbp),%rax
movl   $0xb,(%rax)
jmp    125c <lix+0x15c>
mov    -0x8(%rbp),%rax
movl   $0x63,(%rax)
jmp    1261 <lix+0x161>
jmp    1266 <lix+0x166>
jmp    126b <lix+0x16b>
jmp    1270 <lix+0x170>
jmp    1275 <lix+0x175>
jmp    127a <lix+0x17a>
jmp    127f <lix+0x17f>
movsd  -0x20(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<lix>:
movd   %esi,%xmm0
movd   %ecx,%xmm1
punpckldq %xmm0,%xmm1
cvtdq2pd %xmm1,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %edx,%xmm1
mulsd  0xee1(%rip),%xmm1
movapd %xmm0,%xmm2
shufpd $0x1,%xmm1,%xmm2
divpd  %xmm0,%xmm2
movapd %xmm2,%xmm0
unpckhpd %xmm2,%xmm0
addsd  %xmm2,%xmm0
xor    %eax,%eax
movsd  0xec6(%rip),%xmm1
ucomisd %xmm0,%xmm1
ja     11d7 <lix+0xd7>
mov    $0x5,%eax
movsd  0xeb7(%rip),%xmm1
ucomisd %xmm0,%xmm1
ja     11d7 <lix+0xd7>
mov    $0x6,%eax
movsd  0xeac(%rip),%xmm1
ucomisd %xmm0,%xmm1
ja     11d7 <lix+0xd7>
mov    $0x7,%eax
movsd  0xea1(%rip),%xmm1
ucomisd %xmm0,%xmm1
ja     11d7 <lix+0xd7>
mov    $0x8,%eax
movsd  0xe96(%rip),%xmm1
ucomisd %xmm0,%xmm1
ja     11d7 <lix+0xd7>
mov    $0x9,%eax
movsd  0xe8b(%rip),%xmm1
ucomisd %xmm0,%xmm1
ja     11d7 <lix+0xd7>
mov    $0xa,%eax
movsd  0xe80(%rip),%xmm1
ucomisd %xmm0,%xmm1
ja     11d7 <lix+0xd7>
movsd  0xe7a(%rip),%xmm1
ucomisd %xmm0,%xmm1
mov    $0xb,%ecx
mov    $0x63,%eax
cmova  %ecx,%eax
mov    %eax,(%rdi)
ret

LLVM IR (-O0):
define double @lix(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i32, i32* %6
%11 = sitofp i32 %10 to double
%12 = load i32, i32* %8
%13 = sitofp i32 %12 to double
%14 = fdiv double %11, %13
%15 = load i32, i32* %7
%16 = sitofp i32 %15 to double
%17 = fmul double 1.000000e+02, %16
%18 = load i32, i32* %6
%19 = sitofp i32 %18 to double
%20 = fdiv double %17, %19
%21 = fadd double %14, %20
store double %21, double* %9
%22 = load double, double* %9
%23 = fcmp olt double %22, 3.400000e+01
br i1 %23, label %24, label %26
24: ; preds = %4
%25 = load i32*, i32** %5
store i32 0, i32* %25
br label %70
26: ; preds = %4
%27 = load double, double* %9
%28 = fcmp olt double %27, 3.800000e+01
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = load i32*, i32** %5
store i32 5, i32* %30
br label %69
31: ; preds = %26
%32 = load double, double* %9
%33 = fcmp olt double %32, 4.100000e+01
br i1 %33, label %34, label %36
34: ; preds = %31
%35 = load i32*, i32** %5
store i32 6, i32* %35
br label %68
36: ; preds = %31
%37 = load double, double* %9
%38 = fcmp olt double %37, 4.400000e+01
br i1 %38, label %39, label %41
39: ; preds = %36
%40 = load i32*, i32** %5
store i32 7, i32* %40
br label %67
41: ; preds = %36
%42 = load double, double* %9
%43 = fcmp olt double %42, 4.800000e+01
br i1 %43, label %44, label %46
44: ; preds = %41
%45 = load i32*, i32** %5
store i32 8, i32* %45
br label %66
46: ; preds = %41
%47 = load double, double* %9
%48 = fcmp olt double %47, 5.100000e+01
br i1 %48, label %49, label %51
49: ; preds = %46
%50 = load i32*, i32** %5
store i32 9, i32* %50
br label %65
51: ; preds = %46
%52 = load double, double* %9
%53 = fcmp olt double %52, 5.400000e+01
br i1 %53, label %54, label %56
54: ; preds = %51
%55 = load i32*, i32** %5
store i32 10, i32* %55
br label %64
56: ; preds = %51
%57 = load double, double* %9
%58 = fcmp olt double %57, 5.700000e+01
br i1 %58, label %59, label %61
59: ; preds = %56
%60 = load i32*, i32** %5
store i32 11, i32* %60
br label %63
61: ; preds = %56
%62 = load i32*, i32** %5
store i32 99, i32* %62
br label %63
63: ; preds = %61, %59
br label %64
64: ; preds = %63, %54
br label %65
65: ; preds = %64, %49
br label %66
66: ; preds = %65, %44
br label %67
67: ; preds = %66, %39
br label %68
68: ; preds = %67, %34
br label %69
69: ; preds = %68, %29
br label %70
70: ; preds = %69, %24
%71 = load double, double* %9
ret double %71
}

LLVM IR (-O2):
define double @lix(i32* nocapture writeonly %0, i32 %1, i32 %2, i32 %3) {
%5 = insertelement <2 x i32> poison, i32 %3, i64 0
%6 = insertelement <2 x i32> %5, i32 %1, i64 1
%7 = sitofp <2 x i32> %6 to <2 x double>
%8 = sitofp i32 %2 to double
%9 = fmul double %8, 1.000000e+02
%10 = extractelement <2 x double> %7, i64 1
%11 = insertelement <2 x double> poison, double %10, i64 0
%12 = insertelement <2 x double> %11, double %9, i64 1
%13 = fdiv <2 x double> %12, %7
%14 = shufflevector <2 x double> %13, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%15 = fadd <2 x double> %13, %14
%16 = extractelement <2 x double> %15, i64 0
%17 = fcmp olt double %16, 3.400000e+01
br i1 %17, label %33, label %18
18: ; preds = %4
%19 = fcmp olt double %16, 3.800000e+01
br i1 %19, label %33, label %20
20: ; preds = %18
%21 = fcmp olt double %16, 4.100000e+01
br i1 %21, label %33, label %22
22: ; preds = %20
%23 = fcmp olt double %16, 4.400000e+01
br i1 %23, label %33, label %24
24: ; preds = %22
%25 = fcmp olt double %16, 4.800000e+01
br i1 %25, label %33, label %26
26: ; preds = %24
%27 = fcmp olt double %16, 5.100000e+01
br i1 %27, label %33, label %28
28: ; preds = %26
%29 = fcmp olt double %16, 5.400000e+01
br i1 %29, label %33, label %30
30: ; preds = %28
%31 = fcmp olt double %16, 5.700000e+01
%32 = select i1 %31, i32 11, i32 99
br label %33
33: ; preds = %30, %28, %26, %24, %22, %20, %18, %4
%34 = phi i32 [ 0, %4 ], [ 5, %18 ], [ 6, %20 ], [ 7, %22 ], [ 8, %24 ], [ 9, %26 ], [ 10, %28 ], [ %32, %30 ]
store i32 %34, i32* %0
ret double %16
}