#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 *, ...);
void convert(double t, char type) {
  switch (type) {
  case 'C':
  case 'c':
    if (t < -273.15) {
      printf("Temperature < abs.0");
      break;
    } else {
      double k = t + 273.15;
      double f = (t * 9 / 5) + 32;
      printf("%.2f C:\n", t);
      printf("%.2f K:\n", k);
      printf("%.2f F:\n", f);
      break;
    }
  case 'K':
  case 'k':
    if (t < 0) {
      printf("Temperature < abs.0");
      break;
    } else {
      double c = t - 273.15;
      double f = (t / 5 * 9) - 459.67;
      printf("%.2f K: \n", t);
      printf("%.2f C: \n", c);
      printf("%.2f F: \n", f);
      break;
    }
  case 'F':
  case 'f':
    if (t < -459.67) {
      printf("Temperature < abs.0");
      break;
    } else {
      double c = (t - 32) * 5 / 9;
      double k = (t + 459.67) * 5 / 9;
      printf("%.2f F: \n", t);
      printf("%.2f C: \n", c);
      printf("%.2f K: \n", k);
      break;
    }
  default:
    printf("Error");
    break;
  }
}


x86 assembly (clang, -O0):
<convert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %dil,%al
movsd  %xmm0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
mov    %eax,-0x44(%rbp)
sub    $0x43,%eax
je     118d <convert+0x7d>
jmp    1138 <convert+0x28>
mov    -0x44(%rbp),%eax
sub    $0x46,%eax
je     12d0 <convert+0x1c0>
jmp    1149 <convert+0x39>
mov    -0x44(%rbp),%eax
sub    $0x4b,%eax
je     122d <convert+0x11d>
jmp    115a <convert+0x4a>
mov    -0x44(%rbp),%eax
sub    $0x63,%eax
je     118d <convert+0x7d>
jmp    116b <convert+0x5b>
mov    -0x44(%rbp),%eax
sub    $0x66,%eax
je     12d0 <convert+0x1c0>
jmp    117c <convert+0x6c>
mov    -0x44(%rbp),%eax
sub    $0x6b,%eax
je     122d <convert+0x11d>
jmp    138c <convert+0x27c>
movsd  0xe9b(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    11b3 <convert+0xa3>
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    139a <convert+0x28a>
movsd  0xe6d(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe3b(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xe36(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe3a(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    0xe51(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x18(%rbp),%xmm0
lea    0xe47(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x20(%rbp),%xmm0
lea    0xe3d(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    139a <convert+0x28a>
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    124e <convert+0x13e>
lea    0xdf6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    139a <convert+0x28a>
movsd  -0x8(%rbp),%xmm0
movsd  0xdcd(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xd9f(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xd8b(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd77(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    0xdc9(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x28(%rbp),%xmm0
lea    0xdc0(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x30(%rbp),%xmm0
lea    0xdb7(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    139a <convert+0x28a>
movsd  0xd28(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    12f6 <convert+0x1e6>
lea    0xd4e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    139a <convert+0x28a>
movsd  -0x8(%rbp),%xmm0
movsd  0xd1d(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xd01(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xced(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xcec(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  0xcd7(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xcc3(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    0xd21(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x38(%rbp),%xmm0
lea    0xd04(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x40(%rbp),%xmm0
lea    0xce7(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    139a <convert+0x28a>
lea    0xcf2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert>:
sub    $0x18,%rsp
add    $0xffffffbd,%edi
cmp    $0x28,%edi
ja     126d <convert+0x15d>
movabs $0x100000001,%rax
bt     %rdi,%rax
jb     1256 <convert+0x146>
movabs $0x800000008,%rax
bt     %rdi,%rax
jb     11d2 <convert+0xc2>
movabs $0x10000000100,%rax
bt     %rdi,%rax
jae    126d <convert+0x15d>
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
ja     1264 <convert+0x154>
movsd  0xeb6(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movapd %xmm0,%xmm1
divsd  0xe88(%rip),%xmm1
mulsd  0xe88(%rip),%xmm1
addsd  0xe68(%rip),%xmm1
movsd  %xmm1,0x10(%rsp)
lea    0xeca(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xec6(%rip),%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xebc(%rip),%rdi
movsd  0x10(%rsp),%xmm0
jmp    12e2 <convert+0x1d2>
movsd  0xe26(%rip),%xmm1
ucomisd %xmm0,%xmm1
ja     1264 <convert+0x154>
movsd  0xe1c(%rip),%xmm3
addsd  %xmm0,%xmm3
movsd  0xe18(%rip),%xmm1
mulsd  %xmm1,%xmm3
movsd  0xe14(%rip),%xmm2
divsd  %xmm2,%xmm3
movsd  %xmm3,0x10(%rsp)
movsd  0xe0a(%rip),%xmm3
addsd  %xmm0,%xmm3
mulsd  %xmm1,%xmm3
divsd  %xmm2,%xmm3
movsd  %xmm3,0x8(%rsp)
lea    0xe54(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe3c(%rip),%rdi
movsd  0x10(%rsp),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe1e(%rip),%rdi
jmp    12dc <convert+0x1cc>
movsd  0xdca(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    127f <convert+0x16f>
lea    0xdd5(%rip),%rdi
jmp    1274 <convert+0x164>
lea    0xe19(%rip),%rdi
xor    %eax,%eax
add    $0x18,%rsp
jmp    1030 <printf@plt>
movsd  0xda9(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  0xd7f(%rip),%xmm1
mulsd  %xmm0,%xmm1
divsd  0xd6b(%rip),%xmm1
addsd  0xd8b(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
lea    0xd9a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xd95(%rip),%rdi
movsd  0x10(%rsp),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xd8a(%rip),%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x1,%al
add    $0x18,%rsp
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [20 x i8] c"Temperature < abs.0\00"
@.str.1 = [9 x i8] c"%.2f C:\0A\00"
@.str.2 = [9 x i8] c"%.2f K:\0A\00"
@.str.3 = [9 x i8] c"%.2f F:\0A\00"
@.str.4 = [10 x i8] c"%.2f K: \0A\00"
@.str.5 = [10 x i8] c"%.2f C: \0A\00"
@.str.6 = [10 x i8] c"%.2f F: \0A\00"
@.str.7 = [6 x i8] c"Error\00"
define void @convert(double %0, i8 signext %1) {
%3 = sext i8 %1 to i32
switch i32 %3, label %41 [
i32 67, label %4
i32 99, label %4
i32 75, label %16
i32 107, label %16
i32 70, label %27
i32 102, label %27
]
4: ; preds = %2, %2
%5 = fcmp olt double %0, -2.731500e+02
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %43
8: ; preds = %4
%9 = fadd double %0, 2.731500e+02
%10 = fmul double %0, 9.000000e+00
%11 = fdiv double %10, 5.000000e+00
%12 = fadd double %11, 3.200000e+01
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), double %0)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), double %9)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), double %12)
br label %43
16: ; preds = %2, %2
%17 = fcmp olt double %0, 0.000000e+00
br i1 %17, label %18, label %20
18: ; preds = %16
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %43
20: ; preds = %16
%21 = fadd double %0, -2.731500e+02
%22 = fdiv double %0, 5.000000e+00
%23 = tail call double @llvm.fmuladd.f64(double %22, double 9.000000e+00, double -4.596700e+02)
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), double %0)
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), double %21)
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), double %23)
br label %43
27: ; preds = %2, %2
%28 = fcmp olt double %0, -4.596700e+02
br i1 %28, label %29, label %31
29: ; preds = %27
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %43
31: ; preds = %27
%32 = fadd double %0, -3.200000e+01
%33 = fmul double %32, 5.000000e+00
%34 = fdiv double %33, 9.000000e+00
%35 = fadd double %0, 4.596700e+02
%36 = fmul double %35, 5.000000e+00
%37 = fdiv double %36, 9.000000e+00
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), double %0)
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), double %34)
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), double %37)
br label %43
41: ; preds = %2
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
br label %43
43: ; preds = %41, %31, %29, %20, %18, %8, %6
ret void
}