#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 C_F(float);
float C_K(float);
float F_C(float);
float F_K(float);
float K_C(float);
float K_F(float);
int /*<<< orphan*/ printf(char *, ...);
int sscanf(char *, char *, float *);
int main(int argc, char *argv[]) {
  char my_type;
  float my_value;
  float C, K, F;
  if (argc <= 1)
    return 0;
  if (sscanf(argv[1], "%f", &my_value) == 1) {
    if (argc == 2)
      my_type = 'C';
    else {
      if (argc == 3) {
        my_type = argv[2][0];
      }
    }
  }
  switch (my_type) {
  case 'C':
  case 'c':
    C = my_value;
    F = C_F(C);
    K = C_K(C);
    printf("F = %.2f\n", F);
    printf("K = %.2f\n", K);
    break;
  case 'F':
  case 'f':
    F = my_value;
    C = F_C(F);
    K = F_K(F);
    printf("C = %.2f\n", C);
    printf("K = %.2f\n", K);
    break;
  case 'K':
  case 'k':
    K = my_value;
    C = K_C(K);
    F = K_F(K);
    printf("C = %.2f\n", C);
    printf("F = %.2f\n", F);
    break;
  default:
    printf("Error: Invalid type");
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jg     11ac <main+0x2c>
movl   $0x0,-0x4(%rbp)
jmp    1391 <main+0x211>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe45(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1090 <sscanf@plt>
cmp    $0x1,%eax
jne    1201 <main+0x81>
cmpl   $0x2,-0x8(%rbp)
jne    11e0 <main+0x60>
movb   $0x43,-0x11(%rbp)
jmp    11fc <main+0x7c>
cmpl   $0x3,-0x8(%rbp)
jne    11f7 <main+0x77>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
jmp    11fc <main+0x7c>
jmp    1201 <main+0x81>
movsbl -0x11(%rbp),%eax
mov    %eax,-0x28(%rbp)
sub    $0x43,%eax
je     126b <main+0xeb>
jmp    1216 <main+0x96>
mov    -0x28(%rbp),%eax
sub    $0x46,%eax
je     12c6 <main+0x146>
jmp    1227 <main+0xa7>
mov    -0x28(%rbp),%eax
sub    $0x4b,%eax
je     1321 <main+0x1a1>
jmp    1238 <main+0xb8>
mov    -0x28(%rbp),%eax
sub    $0x63,%eax
je     126b <main+0xeb>
jmp    1249 <main+0xc9>
mov    -0x28(%rbp),%eax
sub    $0x66,%eax
je     12c6 <main+0x146>
jmp    125a <main+0xda>
mov    -0x28(%rbp),%eax
sub    $0x6b,%eax
je     1321 <main+0x1a1>
jmp    137c <main+0x1fc>
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1030 <C_F@plt>
movss  %xmm0,-0x24(%rbp)
movss  -0x1c(%rbp),%xmm0
call   1080 <C_K@plt>
movss  %xmm0,-0x20(%rbp)
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd60(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd53(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    138a <main+0x20a>
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
call   1060 <F_C@plt>
movss  %xmm0,-0x1c(%rbp)
movss  -0x24(%rbp),%xmm0
call   1070 <F_K@plt>
movss  %xmm0,-0x20(%rbp)
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd19(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xcf8(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    138a <main+0x20a>
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
call   10a0 <K_C@plt>
movss  %xmm0,-0x1c(%rbp)
movss  -0x20(%rbp),%xmm0
call   1050 <K_F@plt>
movss  %xmm0,-0x24(%rbp)
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xcbe(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xc93(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    138a <main+0x20a>
lea    0xc9e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
cmp    $0x2,%edi
jl     12ca <main+0x14a>
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x8(%rsi),%rdi
lea    0xe61(%rip),%rsi
lea    0x14(%rsp),%rdx
call   1090 <sscanf@plt>
cmp    $0x1,%eax
jne    1262 <main+0xe2>
cmp    $0x2,%ebp
je     1272 <main+0xf2>
cmp    $0x3,%ebp
jne    1262 <main+0xe2>
mov    0x10(%rbx),%rax
movsbl (%rax),%eax
add    $0xffffffbd,%eax
cmp    $0x28,%eax
ja     1262 <main+0xe2>
movabs $0x100000001,%rcx
bt     %rax,%rcx
jb     1272 <main+0xf2>
movabs $0x800000008,%rcx
bt     %rax,%rcx
jb     12d3 <main+0x153>
movabs $0x10000000100,%rcx
bt     %rax,%rcx
jae    1262 <main+0xe2>
movss  0x14(%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
call   10a0 <K_C@plt>
movss  %xmm0,0x10(%rsp)
movss  0xc(%rsp),%xmm0
call   1050 <K_F@plt>
movss  %xmm0,0xc(%rsp)
movss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdcf(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xda3(%rip),%rdi
jmp    12c3 <main+0x143>
lea    0xdb8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    12ca <main+0x14a>
movss  0x14(%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
call   1030 <C_F@plt>
movss  %xmm0,0x10(%rsp)
movss  0xc(%rsp),%xmm0
call   1080 <C_K@plt>
movss  %xmm0,0xc(%rsp)
movss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd58(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd4a(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret
movss  0x14(%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
call   1060 <F_C@plt>
movss  %xmm0,0x10(%rsp)
movss  0xc(%rsp),%xmm0
call   1070 <F_K@plt>
movss  %xmm0,0xc(%rsp)
movss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd0b(%rip),%rdi
jmp    12ab <main+0x12b>

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
@.str.1 = [10 x i8] c"F = %.2f\0A\00"
@.str.2 = [10 x i8] c"K = %.2f\0A\00"
@.str.3 = [10 x i8] c"C = %.2f\0A\00"
@.str.4 = [20 x i8] c"Error: Invalid type\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp sle i32 %11, 1
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 0, i32* %3
br label %77
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @sscanf(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %7)
%19 = icmp eq i32 %18, 1
br i1 %19, label %20, label %35
20: ; preds = %14
%21 = load i32, i32* %4
%22 = icmp eq i32 %21, 2
br i1 %22, label %23, label %24
23: ; preds = %20
store i8 67, i8* %6
br label %34
24: ; preds = %20
%25 = load i32, i32* %4
%26 = icmp eq i32 %25, 3
br i1 %26, label %27, label %33
27: ; preds = %24
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 2
%30 = load i8*, i8** %29
%31 = getelementptr inbounds i8, i8* %30, i64 0
%32 = load i8, i8* %31
store i8 %32, i8* %6
br label %33
33: ; preds = %27, %24
br label %34
34: ; preds = %33, %23
br label %35
35: ; preds = %34, %14
%36 = load i8, i8* %6
%37 = sext i8 %36 to i32
switch i32 %37, label %74 [
i32 67, label %38
i32 99, label %38
i32 70, label %50
i32 102, label %50
i32 75, label %62
i32 107, label %62
]
38: ; preds = %35, %35
%39 = load float, float* %7
store float %39, float* %8
%40 = load float, float* %8
%41 = call float @C_F(float %40)
store float %41, float* %10
%42 = load float, float* %8
%43 = call float @C_K(float %42)
store float %43, float* %9
%44 = load float, float* %10
%45 = fpext float %44 to double
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double %45)
%47 = load float, float* %9
%48 = fpext float %47 to double
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), double %48)
br label %76
50: ; preds = %35, %35
%51 = load float, float* %7
store float %51, float* %10
%52 = load float, float* %10
%53 = call float @F_C(float %52)
store float %53, float* %8
%54 = load float, float* %10
%55 = call float @F_K(float %54)
store float %55, float* %9
%56 = load float, float* %8
%57 = fpext float %56 to double
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), double %57)
%59 = load float, float* %9
%60 = fpext float %59 to double
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), double %60)
br label %76
62: ; preds = %35, %35
%63 = load float, float* %7
store float %63, float* %9
%64 = load float, float* %9
%65 = call float @K_C(float %64)
store float %65, float* %8
%66 = load float, float* %9
%67 = call float @K_F(float %66)
store float %67, float* %10
%68 = load float, float* %8
%69 = fpext float %68 to double
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), double %69)
%71 = load float, float* %10
%72 = fpext float %71 to double
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double %72)
br label %76
74: ; preds = %35
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
br label %76
76: ; preds = %74, %62, %50, %38
store i32 0, i32* %3
br label %77
77: ; preds = %76, %13
%78 = load i32, i32* %3
ret i32 %78
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
@.str.1 = [10 x i8] c"F = %.2f\0A\00"
@.str.2 = [10 x i8] c"K = %.2f\0A\00"
@.str.3 = [10 x i8] c"C = %.2f\0A\00"
@.str.4 = [20 x i8] c"Error: Invalid type\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca float
%4 = bitcast float* %3 to i8*
%5 = icmp slt i32 %0, 2
br i1 %5, label %43, label %6
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = call i32 @sscanf(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %3)
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %41
11: ; preds = %6
switch i32 %0, label %41 [
i32 2, label %17
i32 3, label %12
]
12: ; preds = %11
%13 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = load i8*, i8** %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
switch i32 %16, label %41 [
i32 67, label %17
i32 99, label %17
i32 70, label %25
i32 102, label %25
i32 75, label %33
i32 107, label %33
]
17: ; preds = %11, %12, %12
%18 = load float, float* %3
%19 = call float @C_F(float %18)
%20 = call float @C_K(float %18)
%21 = fpext float %19 to double
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double %21)
%23 = fpext float %20 to double
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), double %23)
br label %43
25: ; preds = %12, %12
%26 = load float, float* %3
%27 = call float @F_C(float %26)
%28 = call float @F_K(float %26)
%29 = fpext float %27 to double
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), double %29)
%31 = fpext float %28 to double
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), double %31)
br label %43
33: ; preds = %12, %12
%34 = load float, float* %3
%35 = call float @K_C(float %34)
%36 = call float @K_F(float %34)
%37 = fpext float %35 to double
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), double %37)
%39 = fpext float %36 to double
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double %39)
br label %43
41: ; preds = %11, %6, %12
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
br label %43
43: ; preds = %17, %25, %33, %41, %2
ret i32 0
}