#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 atof(char *);
double convertTemp(char, char, float);
int getopt(int, char **, char *);
char *optarg;
int /*<<< orphan*/ printHilfe();
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  char *from, *to;
  from = NULL;
  to = NULL;
  float value = FLT_MAX;
  int ret;
  while ((ret = getopt(argc, argv, "f:t:v:")) != -1) {
    switch (ret) {
    case 'f':
      from = optarg;
      break;
    case 't':
      to = optarg;
      break;
    case 'v':
      value = atof(optarg);
      break;
    default:
      printHilfe();
      break;
    }
  }
  if (from != NULL && to != NULL && value < FLT_MAX) {
    float temp = convertTemp(*from, *to, value);
    if (temp < FLT_MAX) {
      printf("%.2f°%c entsprechen %.2f°%c.\n", value, *from,
             convertTemp(*from, *to, value), *to);
    } else {
      printf(
          "Fehler bei der Konvertierung! Quell- oder Zieleinheit unbekannt.\n");
      printHilfe();
      return -2;
    }
  } else {
    printf("Fehler. Du musst Quell- und Zieleinheit sowie einen Temperaturwert "
           "angeben!\n");
    printHilfe();
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    0x2e63(%rip),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x24(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe6c(%rip),%rdx
call   1070 <getopt@plt>
mov    %eax,-0x28(%rbp)
cmp    $0xffffffff,%eax
je     1226 <main+0xd6>
mov    -0x28(%rbp),%eax
mov    %eax,-0x30(%rbp)
sub    $0x66,%eax
je     11db <main+0x8b>
jmp    11b9 <main+0x69>
mov    -0x30(%rbp),%eax
sub    $0x74,%eax
je     11ee <main+0x9e>
jmp    11ca <main+0x7a>
mov    -0x30(%rbp),%eax
sub    $0x76,%eax
je     1201 <main+0xb1>
jmp    121a <main+0xca>
mov    0x2e16(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    1221 <main+0xd1>
mov    0x2e03(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    1221 <main+0xd1>
mov    0x2df0(%rip),%rax
mov    (%rax),%rdi
call   1030 <atof@plt>
movss  %xmm0,-0x24(%rbp)
jmp    1221 <main+0xd1>
mov    $0x0,%al
call   1050 <printHilfe@plt>
jmp    1186 <main+0x36>
cmpq   $0x0,-0x18(%rbp)
je     1312 <main+0x1c2>
cmpq   $0x0,-0x20(%rbp)
je     1312 <main+0x1c2>
movss  -0x24(%rbp),%xmm1
mov    0x2d98(%rip),%rax
movss  (%rax),%xmm0
ucomiss %xmm1,%xmm0
jbe    1312 <main+0x1c2>
mov    -0x18(%rbp),%rax
mov    (%rax),%cl
mov    -0x20(%rbp),%rax
mov    (%rax),%al
movss  -0x24(%rbp),%xmm0
movsbl %cl,%edi
movsbl %al,%esi
call   1060 <convertTemp@plt>
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x2c(%rbp),%xmm1
mov    0x2d5a(%rip),%rax
movss  (%rax),%xmm0
ucomiss %xmm1,%xmm0
jbe    12ec <main+0x19c>
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%cl
mov    -0x20(%rbp),%rax
mov    (%rax),%al
movss  -0x24(%rbp),%xmm0
movsbl %cl,%edi
movsbl %al,%esi
call   1060 <convertTemp@plt>
mov    -0x3c(%rbp),%esi
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsbl (%rax),%edx
lea    0xd27(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
jmp    130d <main+0x1bd>
lea    0xd34(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <printHilfe@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    133a <main+0x1ea>
jmp    1333 <main+0x1e3>
lea    0xd50(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <printHilfe@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    133a <main+0x1ea>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2e66(%rip),%rax
movss  (%rax),%xmm0
movss  %xmm0,0xc(%rsp)
lea    0xe75(%rip),%r14
mov    0x2e66(%rip),%r12
xor    %r15d,%r15d
xor    %r13d,%r13d
jmp    11a7 <main+0x47>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <printHilfe@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1080 <getopt@plt>
cmp    $0x73,%eax
jg     11d0 <main+0x70>
cmp    $0xffffffff,%eax
je     11f1 <main+0x91>
cmp    $0x66,%eax
jne    11a0 <main+0x40>
mov    (%r12),%r13
jmp    11a7 <main+0x47>
nopl   0x0(%rax)
cmp    $0x74,%eax
je     11eb <main+0x8b>
cmp    $0x76,%eax
jne    11a0 <main+0x40>
mov    (%r12),%rdi
call   1040 <atof@plt>
movss  %xmm0,0xc(%rsp)
jmp    11a7 <main+0x47>
mov    (%r12),%r15
jmp    11a7 <main+0x47>
test   %r13,%r13
movss  0xc(%rsp),%xmm0
mov    0x2ddf(%rip),%rbx
je     1276 <main+0x116>
test   %r15,%r15
je     1276 <main+0x116>
movss  (%rbx),%xmm1
ucomiss %xmm0,%xmm1
jbe    1276 <main+0x116>
movsbl 0x0(%r13),%edi
movsbl (%r15),%esi
movss  %xmm0,0xc(%rsp)
call   1070 <convertTemp@plt>
cvtsd2ss %xmm0,%xmm0
movss  (%rbx),%xmm1
ucomiss %xmm0,%xmm1
jbe    1290 <main+0x130>
movss  0xc(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
movsbl 0x0(%r13),%ebx
movsbl (%r15),%esi
mov    %ebx,%edi
call   1070 <convertTemp@plt>
movaps %xmm0,%xmm1
movsbl (%r15),%edx
lea    0xda4(%rip),%rdi
movsd  0x10(%rsp),%xmm0
mov    %ebx,%esi
mov    $0x2,%al
call   1050 <printf@plt>
xor    %eax,%eax
jmp    12a8 <main+0x148>
lea    0xdaa(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <printHilfe@plt>
mov    $0xffffffff,%eax
jmp    12a8 <main+0x148>
lea    0xddc(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <printHilfe@plt>
mov    $0xfffffffe,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@FLT_MAX = global float 0.000000e+00
@.str = [7 x i8] c"f:t:v:\00"
@optarg = global i8* null
@.str.1 = [32 x i8] c"%.2f\C2\B0%c entsprechen %.2f\C2\B0%c.\0A\00"
@.str.2 = [66 x i8] c"Fehler bei der Konvertierung! Quell- oder Zieleinheit unbekannt.\0A\00"
@.str.3 = [77 x i8] c"Fehler. Du musst Quell- und Zieleinheit sowie einen Temperaturwert angeben!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca float
%9 = alloca i32
%10 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
store i8* null, i8** %7
%11 = load float, float* @FLT_MAX
store float %11, float* %8
br label %12
12: ; preds = %28, %2
%13 = load i32, i32* %4
%14 = load i8**, i8*** %5
%15 = call i32 @getopt(i32 %13, i8** %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i32 %15, i32* %9
%16 = icmp ne i32 %15, -1
br i1 %16, label %17, label %29
17: ; preds = %12
%18 = load i32, i32* %9
switch i32 %18, label %26 [
i32 102, label %19
i32 116, label %21
i32 118, label %23
]
19: ; preds = %17
%20 = load i8*, i8** @optarg
store i8* %20, i8** %6
br label %28
21: ; preds = %17
%22 = load i8*, i8** @optarg
store i8* %22, i8** %7
br label %28
23: ; preds = %17
%24 = load i8*, i8** @optarg
%25 = call float @atof(i8* %24)
store float %25, float* %8
br label %28
26: ; preds = %17
%27 = call i32 (...) @printHilfe()
br label %28
28: ; preds = %26, %23, %21, %19
br label %12
29: ; preds = %12
%30 = load i8*, i8** %6
%31 = icmp ne i8* %30, null
br i1 %31, label %32, label %70
32: ; preds = %29
%33 = load i8*, i8** %7
%34 = icmp ne i8* %33, null
br i1 %34, label %35, label %70
35: ; preds = %32
%36 = load float, float* %8
%37 = load float, float* @FLT_MAX
%38 = fcmp olt float %36, %37
br i1 %38, label %39, label %70
39: ; preds = %35
%40 = load i8*, i8** %6
%41 = load i8, i8* %40
%42 = load i8*, i8** %7
%43 = load i8, i8* %42
%44 = load float, float* %8
%45 = call double @convertTemp(i8 signext %41, i8 signext %43, float %44)
%46 = fptrunc double %45 to float
store float %46, float* %10
%47 = load float, float* %10
%48 = load float, float* @FLT_MAX
%49 = fcmp olt float %47, %48
br i1 %49, label %50, label %66
50: ; preds = %39
%51 = load float, float* %8
%52 = fpext float %51 to double
%53 = load i8*, i8** %6
%54 = load i8, i8* %53
%55 = sext i8 %54 to i32
%56 = load i8*, i8** %6
%57 = load i8, i8* %56
%58 = load i8*, i8** %7
%59 = load i8, i8* %58
%60 = load float, float* %8
%61 = call double @convertTemp(i8 signext %57, i8 signext %59, float %60)
%62 = load i8*, i8** %7
%63 = load i8, i8* %62
%64 = sext i8 %63 to i32
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), double %52, i32 %55, double %61, i32 %64)
br label %69
66: ; preds = %39
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.2, i64 0, i64 0))
%68 = call i32 (...) @printHilfe()
store i32 -2, i32* %3
br label %74
69: ; preds = %50
br label %73
70: ; preds = %35, %32, %29
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.3, i64 0, i64 0))
%72 = call i32 (...) @printHilfe()
store i32 -1, i32* %3
br label %74
73: ; preds = %69
store i32 0, i32* %3
br label %74
74: ; preds = %73, %70, %66
%75 = load i32, i32* %3
ret i32 %75
}

LLVM IR (-O2):
@FLT_MAX = global float 0.000000e+00
@.str = [7 x i8] c"f:t:v:\00"
@optarg = global i8* null
@.str.1 = [32 x i8] c"%.2f\C2\B0%c entsprechen %.2f\C2\B0%c.\0A\00"
@str = [76 x i8] c"Fehler. Du musst Quell- und Zieleinheit sowie einen Temperaturwert angeben!\00"
@str.4 = [65 x i8] c"Fehler bei der Konvertierung! Quell- oder Zieleinheit unbekannt.\00"
define i32 @main(i32 %0, i8** %1) {
%3 = load float, float* @FLT_MAX
br label %4
4: ; preds = %17, %2
%5 = phi i8* [ %18, %17 ], [ null, %2 ]
%6 = phi float [ %9, %17 ], [ %3, %2 ]
%7 = phi i8* [ %12, %17 ], [ null, %2 ]
br label %8
8: ; preds = %4, %19
%9 = phi float [ %6, %4 ], [ %21, %19 ]
%10 = phi i8* [ %7, %4 ], [ %12, %19 ]
br label %11
11: ; preds = %8, %15
%12 = phi i8* [ %10, %8 ], [ %16, %15 ]
br label %13
13: ; preds = %11, %22
%14 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
switch i32 %14, label %22 [
i32 -1, label %24
i32 102, label %15
i32 116, label %17
i32 118, label %19
]
15: ; preds = %13
%16 = load i8*, i8** @optarg
br label %11
17: ; preds = %13
%18 = load i8*, i8** @optarg
br label %4
19: ; preds = %13
%20 = load i8*, i8** @optarg
%21 = tail call float @atof(i8* %20)
br label %8
22: ; preds = %13
%23 = tail call i32 (...) @printHilfe()
br label %13
24: ; preds = %13
%25 = icmp ne i8* %12, null
%26 = icmp ne i8* %5, null
%27 = select i1 %25, i1 %26, i1 false
%28 = load float, float* @FLT_MAX
%29 = fcmp olt float %9, %28
%30 = select i1 %27, i1 %29, i1 false
br i1 %30, label %31, label %41
31: ; preds = %24
%32 = load i8, i8* %12
%33 = load i8, i8* %5
%34 = tail call double @convertTemp(i8 signext %32, i8 signext %33, float %9)
%35 = fptrunc double %34 to float
%36 = load float, float* @FLT_MAX
%37 = fcmp ogt float %36, %35
br i1 %37, label %44, label %38
38: ; preds = %31
%39 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @str.4, i64 0, i64 0))
%40 = tail call i32 (...) @printHilfe()
br label %53
41: ; preds = %24
%42 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([76 x i8], [76 x i8]* @str, i64 0, i64 0))
%43 = tail call i32 (...) @printHilfe()
br label %53
44: ; preds = %31
%45 = fpext float %9 to double
%46 = load i8, i8* %12
%47 = sext i8 %46 to i32
%48 = load i8, i8* %5
%49 = tail call double @convertTemp(i8 signext %46, i8 signext %48, float %9)
%50 = load i8, i8* %5
%51 = sext i8 %50 to i32
%52 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), double %45, i32 %47, double %49, i32 %51)
br label %53
53: ; preds = %38, %44, %41
%54 = phi i32 [ 0, %44 ], [ -2, %38 ], [ -1, %41 ]
ret i32 %54
}