#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  double x;
  x = 5.2;
  switch ((int)(x * 10.0)) {
  case 50:
    printf("5.0\n");
    break;
  case 51:
    printf("5.1\n");
    break;
  case 52:
    printf("5.2\n");
    break;
  case 53:
    printf("5.3\n");
    break;
  case 54:
    printf("5.4\n");
    break;
  default:
    printf("I don't know\n");
    break;
  };
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movabs $0x4014cccccccccccd,%rax
cc 14 40
mov    %rax,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xec6(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
add    $0xffffffce,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x4,%eax
ja     11bd <main+0xad>
mov    -0x18(%rbp),%rax
lea    0xea9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
jmp    11c9 <main+0xb9>
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
jmp    11c9 <main+0xb9>
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
jmp    11c9 <main+0xb9>
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
jmp    11c9 <main+0xb9>
lea    0xe7d(%rip),%rdi
call   1030 <printf@plt>
jmp    11c9 <main+0xb9>
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"5.0\0A\00"
@.str.1 = [5 x i8] c"5.1\0A\00"
@.str.2 = [5 x i8] c"5.2\0A\00"
@.str.3 = [5 x i8] c"5.3\0A\00"
@.str.4 = [5 x i8] c"5.4\0A\00"
@.str.5 = [14 x i8] c"I don't know\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
store i32 0, i32* %1
store double 5.200000e+00, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 1.000000e+01
%5 = fptosi double %4 to i32
switch i32 %5, label %16 [
i32 50, label %6
i32 51, label %8
i32 52, label %10
i32 53, label %12
i32 54, label %14
]
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %18
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %18
10: ; preds = %0
%11 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %18
12: ; preds = %0
%13 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %18
14: ; preds = %0
%15 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %18
16: ; preds = %0
%17 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
br label %18
18: ; preds = %16, %14, %12, %10, %8, %6
ret i32 0
}

LLVM IR (-O2):
@str = [4 x i8] c"5.2\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
ret i32 0
}