#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 */
float FLT_MAX;
float convertTemp(char from, char to, float value) {
  float ret = FLT_MAX;
  switch (from) {
  case 'C':
    ret = value;
    break;
  case 'D':
    ret = 100 - value * 2.0 / 3.0;
    break;
  case 'F':
    ret = (value - 32.0) / 1.8;
    break;
  case 'K':
    ret = value - 273.15;
    break;
  case 'R':
    ret = (value / 1.8) - 273.15;
    break;
  default:
    return FLT_MAX;
  }
  switch (to) {
  case 'C':
    break;
  case 'D':
    ret = (100 - ret) * 1.5;
    break;
  case 'F':
    ret = ret * 1.8 + 32.0;
    break;
  case 'K':
    ret = ret + 273.15;
    break;
  case 'R':
    ret = (ret + 273.15) * 1.8;
    break;
  default:
    return FLT_MAX;
  }
  return ret;
}


x86 assembly (clang, -O0):
<convertTemp>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x5(%rbp)
mov    %al,-0x6(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    0x2ecc(%rip),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x10(%rbp)
movsbl -0x5(%rbp),%eax
add    $0xffffffbd,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0xf,%eax
ja     121a <convertTemp+0x11a>
mov    -0x18(%rbp),%rax
lea    0xef6(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    122f <convertTemp+0x12f>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xeb9(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xea5(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xe91(%rip),%xmm0
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    122f <convertTemp+0x12f>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe66(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe52(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    122f <convertTemp+0x12f>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe27(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    122f <convertTemp+0x12f>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe0c(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xdf8(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    122f <convertTemp+0x12f>
mov    0x2dc7(%rip),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1329 <convertTemp+0x229>
movsbl -0x6(%rbp),%eax
add    $0xffffffbd,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0xf,%eax
ja     130a <convertTemp+0x20a>
mov    -0x20(%rbp),%rax
lea    0xe2c(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    131f <convertTemp+0x21f>
movss  0xdd2(%rip),%xmm0
subss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdb9(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    131f <convertTemp+0x21f>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd6e(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd6a(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    131f <convertTemp+0x21f>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd37(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    131f <convertTemp+0x21f>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd14(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xd10(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    131f <convertTemp+0x21f>
mov    0x2cd7(%rip),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1329 <convertTemp+0x229>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<convertTemp>:
add    $0xffffffbd,%edi
cmp    $0xf,%edi
ja     119e <convertTemp+0x9e>
lea    0xf2d(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
cvtss2sd %xmm0,%xmm0
addsd  %xmm0,%xmm0
divsd  0xeec(%rip),%xmm0
addsd  0xeec(%rip),%xmm0
jmp    1166 <convertTemp+0x66>
cvtss2sd %xmm0,%xmm0
addsd  0xece(%rip),%xmm0
divsd  0xeb6(%rip),%xmm0
jmp    1166 <convertTemp+0x66>
cvtss2sd %xmm0,%xmm0
jmp    115e <convertTemp+0x5e>
cvtss2sd %xmm0,%xmm0
divsd  0xea2(%rip),%xmm0
addsd  0xea2(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movsbl %sil,%eax
add    $0xffffffbd,%eax
cmp    $0xf,%eax
ja     119e <convertTemp+0x9e>
lea    0xf03(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  0xeaa(%rip),%xmm1
subss  %xmm0,%xmm1
mulss  0xea2(%rip),%xmm1
movaps %xmm1,%xmm0
ret
mov    0x2e43(%rip),%rax
movss  (%rax),%xmm0
ret
cvtss2sd %xmm0,%xmm0
mulsd  0xe4a(%rip),%xmm0
addsd  0xe72(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret
cvtss2sd %xmm0,%xmm0
addsd  0xe59(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret
cvtss2sd %xmm0,%xmm0
addsd  0xe48(%rip),%xmm0
mulsd  0xe18(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
@FLT_MAX = global float 0.000000e+00
define float @convertTemp(i8 signext %0, i8 signext %1, float %2) {
%4 = alloca float
%5 = alloca i8
%6 = alloca i8
%7 = alloca float
%8 = alloca float
store i8 %0, i8* %5
store i8 %1, i8* %6
store float %2, float* %7
%9 = load float, float* @FLT_MAX
store float %9, float* %8
%10 = load i8, i8* %5
%11 = sext i8 %10 to i32
switch i32 %11, label %38 [
i32 67, label %12
i32 68, label %14
i32 70, label %21
i32 75, label %27
i32 82, label %32
]
12: ; preds = %3
%13 = load float, float* %7
store float %13, float* %8
br label %40
14: ; preds = %3
%15 = load float, float* %7
%16 = fpext float %15 to double
%17 = fmul double %16, 2.000000e+00
%18 = fdiv double %17, 3.000000e+00
%19 = fsub double 1.000000e+02, %18
%20 = fptrunc double %19 to float
store float %20, float* %8
br label %40
21: ; preds = %3
%22 = load float, float* %7
%23 = fpext float %22 to double
%24 = fsub double %23, 3.200000e+01
%25 = fdiv double %24, 1.800000e+00
%26 = fptrunc double %25 to float
store float %26, float* %8
br label %40
27: ; preds = %3
%28 = load float, float* %7
%29 = fpext float %28 to double
%30 = fsub double %29, 2.731500e+02
%31 = fptrunc double %30 to float
store float %31, float* %8
br label %40
32: ; preds = %3
%33 = load float, float* %7
%34 = fpext float %33 to double
%35 = fdiv double %34, 1.800000e+00
%36 = fsub double %35, 2.731500e+02
%37 = fptrunc double %36 to float
store float %37, float* %8
br label %40
38: ; preds = %3
%39 = load float, float* @FLT_MAX
store float %39, float* %4
br label %70
40: ; preds = %32, %27, %21, %14, %12
%41 = load i8, i8* %6
%42 = sext i8 %41 to i32
switch i32 %42, label %66 [
i32 67, label %43
i32 68, label %44
i32 70, label %50
i32 75, label %55
i32 82, label %60
]
43: ; preds = %40
br label %68
44: ; preds = %40
%45 = load float, float* %8
%46 = fsub float 1.000000e+02, %45
%47 = fpext float %46 to double
%48 = fmul double %47, 1.500000e+00
%49 = fptrunc double %48 to float
store float %49, float* %8
br label %68
50: ; preds = %40
%51 = load float, float* %8
%52 = fpext float %51 to double
%53 = call double @llvm.fmuladd.f64(double %52, double 1.800000e+00, double 3.200000e+01)
%54 = fptrunc double %53 to float
store float %54, float* %8
br label %68
55: ; preds = %40
%56 = load float, float* %8
%57 = fpext float %56 to double
%58 = fadd double %57, 2.731500e+02
%59 = fptrunc double %58 to float
store float %59, float* %8
br label %68
60: ; preds = %40
%61 = load float, float* %8
%62 = fpext float %61 to double
%63 = fadd double %62, 2.731500e+02
%64 = fmul double %63, 1.800000e+00
%65 = fptrunc double %64 to float
store float %65, float* %8
br label %68
66: ; preds = %40
%67 = load float, float* @FLT_MAX
store float %67, float* %4
br label %70
68: ; preds = %60, %55, %50, %44, %43
%69 = load float, float* %8
store float %69, float* %4
br label %70
70: ; preds = %68, %66, %38
%71 = load float, float* %4
ret float %71
}

LLVM IR (-O2):
@FLT_MAX = global float 0.000000e+00
define float @convertTemp(i8 signext %0, i8 signext %1, float %2) {
%4 = sext i8 %0 to i32
switch i32 %4, label %25 [
i32 67, label %27
i32 68, label %5
i32 70, label %11
i32 75, label %16
i32 82, label %20
]
5: ; preds = %3
%6 = fpext float %2 to double
%7 = fmul double %6, 2.000000e+00
%8 = fdiv double %7, 3.000000e+00
%9 = fsub double 1.000000e+02, %8
%10 = fptrunc double %9 to float
br label %27
11: ; preds = %3
%12 = fpext float %2 to double
%13 = fadd double %12, -3.200000e+01
%14 = fdiv double %13, 1.800000e+00
%15 = fptrunc double %14 to float
br label %27
16: ; preds = %3
%17 = fpext float %2 to double
%18 = fadd double %17, -2.731500e+02
%19 = fptrunc double %18 to float
br label %27
20: ; preds = %3
%21 = fpext float %2 to double
%22 = fdiv double %21, 1.800000e+00
%23 = fadd double %22, -2.731500e+02
%24 = fptrunc double %23 to float
br label %27
25: ; preds = %3
%26 = load float, float* @FLT_MAX
br label %48
27: ; preds = %3, %20, %16, %11, %5
%28 = phi float [ %24, %20 ], [ %19, %16 ], [ %15, %11 ], [ %10, %5 ], [ %2, %3 ]
%29 = sext i8 %1 to i32
switch i32 %29, label %46 [
i32 67, label %48
i32 68, label %30
i32 70, label %33
i32 75, label %37
i32 82, label %41
]
30: ; preds = %27
%31 = fsub float 1.000000e+02, %28
%32 = fmul float %31, 1.500000e+00
br label %48
33: ; preds = %27
%34 = fpext float %28 to double
%35 = tail call double @llvm.fmuladd.f64(double %34, double 1.800000e+00, double 3.200000e+01)
%36 = fptrunc double %35 to float
br label %48
37: ; preds = %27
%38 = fpext float %28 to double
%39 = fadd double %38, 2.731500e+02
%40 = fptrunc double %39 to float
br label %48
41: ; preds = %27
%42 = fpext float %28 to double
%43 = fadd double %42, 2.731500e+02
%44 = fmul double %43, 1.800000e+00
%45 = fptrunc double %44 to float
br label %48
46: ; preds = %27
%47 = load float, float* @FLT_MAX
br label %48
48: ; preds = %27, %30, %33, %37, %41, %46, %25
%49 = phi float [ %26, %25 ], [ %47, %46 ], [ %45, %41 ], [ %40, %37 ], [ %36, %33 ], [ %32, %30 ], [ %28, %27 ]
ret float %49
}