int calcTEDSound(int x) {
  switch (x & 48) {
  case 0:
    x = 0;
    break;
  case 16:
  case 32:
    x = (x & 15) * 10 - 4;
    x = (x > 0 ? (x < 75 ? x : 75) : 0);
    break;
  case 48:
    x = (x & 15) * 10 - 4;
    x = (x > 0 ? (x < 75 ? x : 75) : 0);
    x = x * 2;
    break;
  }
  return (x * 2);
}


x86 assembly (clang, -O0):
<calcTEDSound>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x30,%eax
mov    %eax,-0x8(%rbp)
je     114e <calcTEDSound+0x4e>
jmp    111b <calcTEDSound+0x1b>
mov    -0x8(%rbp),%eax
sub    $0x10,%eax
je     115a <calcTEDSound+0x5a>
jmp    112c <calcTEDSound+0x2c>
mov    -0x8(%rbp),%eax
sub    $0x20,%eax
je     115a <calcTEDSound+0x5a>
jmp    113d <calcTEDSound+0x3d>
mov    -0x8(%rbp),%eax
sub    $0x30,%eax
je     11b5 <calcTEDSound+0xb5>
jmp    1214 <calcTEDSound+0x114>
movl   $0x0,-0x4(%rbp)
jmp    1214 <calcTEDSound+0x114>
mov    -0x4(%rbp),%eax
and    $0xf,%eax
imul   $0xa,%eax,%eax
sub    $0x4,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    11a0 <calcTEDSound+0xa0>
cmpl   $0x4b,-0x4(%rbp)
jge    1188 <calcTEDSound+0x88>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1195 <calcTEDSound+0x95>
mov    $0x4b,%eax
mov    %eax,-0xc(%rbp)
jmp    1195 <calcTEDSound+0x95>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    11aa <calcTEDSound+0xaa>
xor    %eax,%eax
mov    %eax,-0x10(%rbp)
jmp    11aa <calcTEDSound+0xaa>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1214 <calcTEDSound+0x114>
mov    -0x4(%rbp),%eax
and    $0xf,%eax
imul   $0xa,%eax,%eax
sub    $0x4,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    11fb <calcTEDSound+0xfb>
cmpl   $0x4b,-0x4(%rbp)
jge    11e3 <calcTEDSound+0xe3>
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11f0 <calcTEDSound+0xf0>
mov    $0x4b,%eax
mov    %eax,-0x14(%rbp)
jmp    11f0 <calcTEDSound+0xf0>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1205 <calcTEDSound+0x105>
xor    %eax,%eax
mov    %eax,-0x18(%rbp)
jmp    1205 <calcTEDSound+0x105>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<calcTEDSound>:
mov    %edi,%eax
shr    $0x4,%eax
and    $0x3,%eax
lea    -0x1(%rax),%ecx
cmp    $0x2,%ecx
jae    1134 <calcTEDSound+0x34>
and    $0xf,%edi
add    %edi,%edi
lea    (%rdi,%rdi,4),%eax
cmp    $0x4f,%eax
mov    $0x4f,%ecx
cmovb  %eax,%ecx
cmp    $0x5,%ecx
mov    $0x4,%eax
cmovae %ecx,%eax
add    $0xfffffffc,%eax
add    %eax,%eax
ret
test   %eax,%eax
je     1131 <calcTEDSound+0x31>
and    $0xf,%edi
add    %edi,%edi
lea    (%rdi,%rdi,4),%eax
cmp    $0x4f,%eax
mov    $0x4f,%ecx
cmovb  %eax,%ecx
cmp    $0x5,%ecx
mov    $0x4,%eax
cmovae %ecx,%eax
add    %eax,%eax
add    $0xfffffff8,%eax
add    %eax,%eax
ret

LLVM IR (-O0):
define i32 @calcTEDSound(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 48
switch i32 %4, label %44 [
i32 0, label %5
i32 16, label %6
i32 32, label %6
i32 48, label %24
]
5: ; preds = %1
store i32 0, i32* %2
br label %44
6: ; preds = %1, %1
%7 = load i32, i32* %2
%8 = and i32 %7, 15
%9 = mul nsw i32 %8, 10
%10 = sub nsw i32 %9, 4
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %21
13: ; preds = %6
%14 = load i32, i32* %2
%15 = icmp slt i32 %14, 75
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = load i32, i32* %2
br label %19
18: ; preds = %13
br label %19
19: ; preds = %18, %16
%20 = phi i32 [ %17, %16 ], [ 75, %18 ]
br label %22
21: ; preds = %6
br label %22
22: ; preds = %21, %19
%23 = phi i32 [ %20, %19 ], [ 0, %21 ]
store i32 %23, i32* %2
br label %44
24: ; preds = %1
%25 = load i32, i32* %2
%26 = and i32 %25, 15
%27 = mul nsw i32 %26, 10
%28 = sub nsw i32 %27, 4
store i32 %28, i32* %2
%29 = load i32, i32* %2
%30 = icmp sgt i32 %29, 0
br i1 %30, label %31, label %39
31: ; preds = %24
%32 = load i32, i32* %2
%33 = icmp slt i32 %32, 75
br i1 %33, label %34, label %36
34: ; preds = %31
%35 = load i32, i32* %2
br label %37
36: ; preds = %31
br label %37
37: ; preds = %36, %34
%38 = phi i32 [ %35, %34 ], [ 75, %36 ]
br label %40
39: ; preds = %24
br label %40
40: ; preds = %39, %37
%41 = phi i32 [ %38, %37 ], [ 0, %39 ]
store i32 %41, i32* %2
%42 = load i32, i32* %2
%43 = mul nsw i32 %42, 2
store i32 %43, i32* %2
br label %44
44: ; preds = %1, %40, %22, %5
%45 = load i32, i32* %2
%46 = mul nsw i32 %45, 2
ret i32 %46
}

LLVM IR (-O2):
define i32 @calcTEDSound(i32 %0) {
%2 = lshr i32 %0, 4
%3 = and i32 %2, 3
switch i32 %3, label %21 [
i32 0, label %22
i32 1, label %4
i32 2, label %4
i32 3, label %12
]
4: ; preds = %1, %1
%5 = and i32 %0, 15
%6 = mul nuw nsw i32 %5, 10
%7 = icmp ult i32 %6, 79
%8 = select i1 %7, i32 %6, i32 79
%9 = icmp ugt i32 %8, 4
%10 = select i1 %9, i32 %8, i32 4
%11 = add nsw i32 %10, -4
br label %22
12: ; preds = %1
%13 = and i32 %0, 15
%14 = mul nuw nsw i32 %13, 10
%15 = icmp ult i32 %14, 79
%16 = select i1 %15, i32 %14, i32 79
%17 = icmp ugt i32 %16, 4
%18 = select i1 %17, i32 %16, i32 4
%19 = shl nuw nsw i32 %18, 1
%20 = add nsw i32 %19, -8
br label %22
21: ; preds = %1
unreachable
22: ; preds = %1, %12, %4
%23 = phi i32 [ %20, %12 ], [ %11, %4 ], [ %3, %1 ]
%24 = shl nuw nsw i32 %23, 1
ret i32 %24
}