#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*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main(void) {
  printf("From [temp][c|f|k]:");
  char from;
  double original;
  scanf("%lf%c", &original, &from);
  printf("To [c|f|k]:");
  getchar();
  char to;
  scanf("%c", &to);
  switch (from) {
  case 'c':
    switch (to) {
    case 'c':
      printf("%f", original);
      break;
    case 'f':
      printf("%f", (((original * 9) / 5) + 32));
      break;
    case 'k':
      printf("%f", (original + 273.15));
      break;
    default:
      printf("Incorrect Conversion Specifier");
      break;
    }
    break;
  case 'f':
    switch (to) {
    case 'c':
      printf("%f", (((original - 32) * 5) / 9));
      break;
    case 'f':
      printf("%f", original);
      break;
    case 'k':
      printf("%f", (((original - 32) / 1.8000) + 273.15));
      break;
    default:
      printf("Incorrect Conversion Specifier");
      break;
    }
    break;
  case 'k':
    switch (to) {
    case 'c':
      printf("%f", (original - 273.15));
      break;
    case 'f':
      printf("%f", (((original - 273.15) * 1.8000) + 32));
      break;
    case 'k':
      printf("%f", original);
      break;
    default:
      printf("Incorrect Conversion Specifier");
      break;
    }
    break;
  default:
    printf("Incorrect Temperature Specifier");
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xee2(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x19(%rbp)
call   1030 <printf@plt>
mov    -0x19(%rbp),%al
lea    0xee2(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x5(%rbp),%rdx
call   1050 <scanf@plt>
mov    -0x19(%rbp),%al
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x19(%rbp),%al
call   1040 <getchar@plt>
mov    -0x19(%rbp),%al
lea    0xeb7(%rip),%rdi
lea    -0x11(%rbp),%rsi
call   1050 <scanf@plt>
movsbl -0x5(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0x63,%eax
je     11c8 <main+0x98>
jmp    11a6 <main+0x76>
mov    -0x18(%rbp),%eax
sub    $0x66,%eax
je     1282 <main+0x152>
jmp    11b7 <main+0x87>
mov    -0x18(%rbp),%eax
sub    $0x6b,%eax
je     135c <main+0x22c>
jmp    141e <main+0x2ee>
movsbl -0x11(%rbp),%eax
mov    %eax,-0x20(%rbp)
sub    $0x63,%eax
je     11ff <main+0xcf>
jmp    11dd <main+0xad>
mov    -0x20(%rbp),%eax
sub    $0x66,%eax
je     1217 <main+0xe7>
jmp    11ee <main+0xbe>
mov    -0x20(%rbp),%eax
sub    $0x6b,%eax
je     124f <main+0x11f>
jmp    126f <main+0x13f>
movsd  -0x10(%rbp),%xmm0
lea    0xe43(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    127d <main+0x14d>
movsd  0xdf9(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  0xdf4(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xdd0(%rip),%xmm1
addsd  %xmm1,%xmm0
lea    0xe0b(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    127d <main+0x14d>
movsd  0xdb9(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
lea    0xdeb(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    127d <main+0x14d>
lea    0xddb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    142c <main+0x2fc>
movsbl -0x11(%rbp),%eax
mov    %eax,-0x24(%rbp)
sub    $0x63,%eax
je     12b9 <main+0x189>
jmp    1297 <main+0x167>
mov    -0x24(%rbp),%eax
sub    $0x66,%eax
je     12f5 <main+0x1c5>
jmp    12a8 <main+0x178>
mov    -0x24(%rbp),%eax
sub    $0x6b,%eax
je     130d <main+0x1dd>
jmp    1349 <main+0x219>
movsd  -0x10(%rbp),%xmm0
movsd  0xd42(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xd4e(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd3a(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xd65(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1357 <main+0x227>
movsd  -0x10(%rbp),%xmm0
lea    0xd4d(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1357 <main+0x227>
movsd  -0x10(%rbp),%xmm0
movsd  0xcee(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xcda(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xcde(%rip),%xmm1
addsd  %xmm1,%xmm0
lea    0xd11(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1357 <main+0x227>
lea    0xd01(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    142c <main+0x2fc>
movsbl -0x11(%rbp),%eax
mov    %eax,-0x28(%rbp)
sub    $0x63,%eax
je     1393 <main+0x263>
jmp    1371 <main+0x241>
mov    -0x28(%rbp),%eax
sub    $0x66,%eax
je     13b7 <main+0x287>
jmp    1382 <main+0x252>
mov    -0x28(%rbp),%eax
sub    $0x6b,%eax
je     13f3 <main+0x2c3>
jmp    140b <main+0x2db>
movsd  -0x10(%rbp),%xmm0
movsd  0xc70(%rip),%xmm1
subsd  %xmm1,%xmm0
lea    0xca3(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1419 <main+0x2e9>
movsd  -0x10(%rbp),%xmm0
movsd  0xc4c(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xc30(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xc2c(%rip),%xmm1
addsd  %xmm1,%xmm0
lea    0xc67(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1419 <main+0x2e9>
movsd  -0x10(%rbp),%xmm0
lea    0xc4f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1419 <main+0x2e9>
lea    0xc3f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    142c <main+0x2fc>
lea    0xc4b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xefd(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf03(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0xf(%rsp),%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xef1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
lea    0xed9(%rip),%rdi
lea    0xe(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movsbl 0xf(%rsp),%eax
cmp    $0x6b,%eax
je     11b8 <main+0x88>
cmp    $0x66,%eax
je     11e3 <main+0xb3>
cmp    $0x63,%eax
jne    121e <main+0xee>
movsbl 0xe(%rsp),%eax
cmp    $0x6b,%eax
je     1297 <main+0x167>
cmp    $0x66,%eax
je     123f <main+0x10f>
cmp    $0x63,%eax
jne    122f <main+0xff>
jmp    1227 <main+0xf7>
movsbl 0xe(%rsp),%eax
cmp    $0x6b,%eax
je     1227 <main+0xf7>
cmp    $0x66,%eax
je     125f <main+0x12f>
cmp    $0x63,%eax
jne    122f <main+0xff>
movsd  0x10(%rsp),%xmm0
addsd  0xe22(%rip),%xmm0
jmp    12a5 <main+0x175>
movsbl 0xe(%rsp),%eax
cmp    $0x6b,%eax
je     127f <main+0x14f>
cmp    $0x66,%eax
je     1227 <main+0xf7>
cmp    $0x63,%eax
jne    122f <main+0xff>
movsd  0x10(%rsp),%xmm0
addsd  0xe0f(%rip),%xmm0
mulsd  0xe17(%rip),%xmm0
divsd  0xe17(%rip),%xmm0
jmp    12a5 <main+0x175>
lea    0xe5b(%rip),%rdi
jmp    1236 <main+0x106>
movsd  0x10(%rsp),%xmm0
jmp    12a5 <main+0x175>
lea    0xe2b(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    12b3 <main+0x183>
movsd  0x10(%rsp),%xmm0
mulsd  0xde3(%rip),%xmm0
divsd  0xdd3(%rip),%xmm0
addsd  0xdb3(%rip),%xmm0
jmp    12a5 <main+0x175>
movsd  0x10(%rsp),%xmm0
addsd  0xd93(%rip),%xmm0
mulsd  0xd93(%rip),%xmm0
addsd  0xd93(%rip),%xmm0
jmp    12a5 <main+0x175>
movsd  0x10(%rsp),%xmm0
addsd  0xd8b(%rip),%xmm0
divsd  0xd73(%rip),%xmm0
jmp    129d <main+0x16d>
movsd  0x10(%rsp),%xmm0
addsd  0xd7b(%rip),%xmm0
lea    0xdb2(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"From [temp][c|f|k]:\00"
@.str.1 = [6 x i8] c"%lf%c\00"
@.str.2 = [12 x i8] c"To [c|f|k]:\00"
@.str.3 = [3 x i8] c"%c\00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [31 x i8] c"Incorrect Conversion Specifier\00"
@.str.6 = [32 x i8] c"Incorrect Temperature Specifier\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca double
%4 = alloca i8
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double* %3, i8* %2)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 (...) @getchar()
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%10 = load i8, i8* %2
%11 = sext i8 %10 to i32
switch i32 %11, label %70 [
i32 99, label %12
i32 102, label %31
i32 107, label %52
]
12: ; preds = %0
%13 = load i8, i8* %4
%14 = sext i8 %13 to i32
switch i32 %14, label %28 [
i32 99, label %15
i32 102, label %18
i32 107, label %24
]
15: ; preds = %12
%16 = load double, double* %3
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), double %16)
br label %30
18: ; preds = %12
%19 = load double, double* %3
%20 = fmul double %19, 9.000000e+00
%21 = fdiv double %20, 5.000000e+00
%22 = fadd double %21, 3.200000e+01
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), double %22)
br label %30
24: ; preds = %12
%25 = load double, double* %3
%26 = fadd double %25, 2.731500e+02
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), double %26)
br label %30
28: ; preds = %12
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
br label %30
30: ; preds = %28, %24, %18, %15
br label %72
31: ; preds = %0
%32 = load i8, i8* %4
%33 = sext i8 %32 to i32
switch i32 %33, label %49 [
i32 99, label %34
i32 102, label %40
i32 107, label %43
]
34: ; preds = %31
%35 = load double, double* %3
%36 = fsub double %35, 3.200000e+01
%37 = fmul double %36, 5.000000e+00
%38 = fdiv double %37, 9.000000e+00
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), double %38)
br label %51
40: ; preds = %31
%41 = load double, double* %3
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), double %41)
br label %51
43: ; preds = %31
%44 = load double, double* %3
%45 = fsub double %44, 3.200000e+01
%46 = fdiv double %45, 1.800000e+00
%47 = fadd double %46, 2.731500e+02
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), double %47)
br label %51
49: ; preds = %31
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
br label %51
51: ; preds = %49, %43, %40, %34
br label %72
52: ; preds = %0
%53 = load i8, i8* %4
%54 = sext i8 %53 to i32
switch i32 %54, label %67 [
i32 99, label %55
i32 102, label %59
i32 107, label %64
]
55: ; preds = %52
%56 = load double, double* %3
%57 = fsub double %56, 2.731500e+02
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), double %57)
br label %69
59: ; preds = %52
%60 = load double, double* %3
%61 = fsub double %60, 2.731500e+02
%62 = call double @llvm.fmuladd.f64(double %61, double 1.800000e+00, double 3.200000e+01)
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), double %62)
br label %69
64: ; preds = %52
%65 = load double, double* %3
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), double %65)
br label %69
67: ; preds = %52
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
br label %69
69: ; preds = %67, %64, %59, %55
br label %72
70: ; preds = %0
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0))
br label %72
72: ; preds = %70, %69, %51, %30
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"From [temp][c|f|k]:\00"
@.str.1 = [6 x i8] c"%lf%c\00"
@.str.2 = [12 x i8] c"To [c|f|k]:\00"
@.str.3 = [3 x i8] c"%c\00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [31 x i8] c"Incorrect Conversion Specifier\00"
@.str.6 = [32 x i8] c"Incorrect Temperature Specifier\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca double
%3 = alloca i8
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%5 = bitcast double* %2 to i8*
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double* %2, i8* %1)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 (...) @getchar()
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %3)
%10 = load i8, i8* %1
%11 = sext i8 %10 to i32
switch i32 %11, label %67 [
i32 99, label %12
i32 102, label %30
i32 107, label %50
]
12: ; preds = %0
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
switch i32 %14, label %28 [
i32 99, label %15
i32 102, label %18
i32 107, label %24
]
15: ; preds = %12
%16 = load double, double* %2
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), double %16)
br label %69
18: ; preds = %12
%19 = load double, double* %2
%20 = fmul double %19, 9.000000e+00
%21 = fdiv double %20, 5.000000e+00
%22 = fadd double %21, 3.200000e+01
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), double %22)
br label %69
24: ; preds = %12
%25 = load double, double* %2
%26 = fadd double %25, 2.731500e+02
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), double %26)
br label %69
28: ; preds = %12
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
br label %69
30: ; preds = %0
%31 = load i8, i8* %3
%32 = sext i8 %31 to i32
switch i32 %32, label %48 [
i32 99, label %33
i32 102, label %39
i32 107, label %42
]
33: ; preds = %30
%34 = load double, double* %2
%35 = fadd double %34, -3.200000e+01
%36 = fmul double %35, 5.000000e+00
%37 = fdiv double %36, 9.000000e+00
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), double %37)
br label %69
39: ; preds = %30
%40 = load double, double* %2
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), double %40)
br label %69
42: ; preds = %30
%43 = load double, double* %2
%44 = fadd double %43, -3.200000e+01
%45 = fdiv double %44, 1.800000e+00
%46 = fadd double %45, 2.731500e+02
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), double %46)
br label %69
48: ; preds = %30
%49 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
br label %69
50: ; preds = %0
%51 = load i8, i8* %3
%52 = sext i8 %51 to i32
switch i32 %52, label %65 [
i32 99, label %53
i32 102, label %57
i32 107, label %62
]
53: ; preds = %50
%54 = load double, double* %2
%55 = fadd double %54, -2.731500e+02
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), double %55)
br label %69
57: ; preds = %50
%58 = load double, double* %2
%59 = fadd double %58, -2.731500e+02
%60 = call double @llvm.fmuladd.f64(double %59, double 1.800000e+00, double 3.200000e+01)
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), double %60)
br label %69
62: ; preds = %50
%63 = load double, double* %2
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), double %63)
br label %69
65: ; preds = %50
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
br label %69
67: ; preds = %0
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0))
br label %69
69: ; preds = %53, %57, %62, %65, %33, %39, %42, %48, %15, %18, %24, %28, %67
ret i32 0
}