#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
float atof(char *);
float compareArr(float *, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
char getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int main(int argc, char *argv[]) {
  static char fileName[1024];
  float max = 0;
  int counter = 0;
  float arr[10000];
  FILE *file;
  char line[128];
  if (argc < 2) {
    printf("Bitte geben sie den Dateinamen ein: ");
    do {
      scanf("%s", &fileName[0]);
    } while (getchar() != '\n');
    file = fopen(fileName, "r");
  } else {
    file = fopen(argv[1], "r");
  }
  if (file == NULL) {
    return EXIT_FAILURE;
  }
  while (fgets(line, sizeof line, file) != NULL) {
    arr[counter] = atof(line);
    counter++;
  }
  fclose(file);
  max = compareArr(arr, 10000);
  printf("Die größte Floatzahl lautet: %0.2f", max);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x9cf0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1205 <main+0x85>
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe5e(%rip),%rdi
lea    0x2ea2(%rip),%rsi
call   1090 <scanf@plt>
mov    $0x0,%al
call   1080 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
jne    11c0 <main+0x40>
lea    0x2e83(%rip),%rdi
lea    0xe34(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x9c68(%rbp)
jmp    1220 <main+0xa0>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe14(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x9c68(%rbp)
cmpq   $0x0,-0x9c68(%rbp)
jne    123f <main+0xbf>
mov    0x2dab(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12d2 <main+0x152>
jmp    1244 <main+0xc4>
lea    -0x9cf0(%rbp),%rdi
mov    -0x9c68(%rbp),%rdx
mov    $0x80,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
je     128d <main+0x10d>
lea    -0x9cf0(%rbp),%rdi
call   1030 <atof@plt>
movslq -0x18(%rbp),%rax
movss  %xmm0,-0x9c60(%rbp,%rax,4)
ff ff
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1244 <main+0xc4>
mov    -0x9c68(%rbp),%rdi
call   1040 <fclose@plt>
lea    -0x9c60(%rbp),%rdi
mov    $0x2710,%esi
call   1070 <compareArr@plt>
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd6b(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    0x2d0b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x9cf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x9cc0,%rsp
cmp    $0x1,%edi
jg     11c8 <main+0x48>
lea    0xe68(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe7f(%rip),%r14
lea    0x2ec3(%rip),%rbx
nopl   (%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1090 <scanf@plt>
xor    %eax,%eax
call   1080 <getchar@plt>
cmp    $0xa,%al
jne    11b0 <main+0x30>
jmp    11cc <main+0x4c>
mov    0x8(%rsi),%rbx
lea    0xe55(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <fopen@plt>
test   %rax,%rax
je     126a <main+0xea>
mov    %rax,%r14
mov    %rsp,%rdi
mov    $0x80,%esi
mov    %rax,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     1235 <main+0xb5>
lea    0x80(%rsp),%rbx
mov    %rsp,%r15
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1030 <atof@plt>
movss  %xmm0,(%rbx)
mov    %r15,%rdi
mov    $0x80,%esi
mov    %r14,%rdx
call   1060 <fgets@plt>
add    $0x4,%rbx
test   %rax,%rax
jne    1210 <main+0x90>
mov    %r14,%rdi
call   1040 <fclose@plt>
lea    0x80(%rsp),%rdi
mov    $0x2710,%esi
call   1070 <compareArr@plt>
cvtss2sd %xmm0,%xmm0
lea    0xdd0(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    0x2d70(%rip),%rax
jmp    1271 <main+0xf1>
mov    0x2d6f(%rip),%rax
mov    (%rax),%eax
add    $0x9cc0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@main.fileName = internal global [1024 x i8] zeroinitializer
@.str = [37 x i8] c"Bitte geben sie den Dateinamen ein: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [2 x i8] c"r\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [37 x i8] c"Die gr\C3\B6\C3\9Fte Floatzahl lautet: %0.2f\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca float
%7 = alloca i32
%8 = alloca [10000 x float]
%9 = alloca i32*
%10 = alloca [128 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store float 0.000000e+00, float* %6
store i32 0, i32* %7
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 2
br i1 %12, label %13, label %23
13: ; preds = %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %17, %13
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @main.fileName, i64 0, i64 0))
br label %17
17: ; preds = %15
%18 = call signext i8 (...) @getchar()
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %19, 10
br i1 %20, label %15, label %21
21: ; preds = %17
%22 = call i32* @fopen(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @main.fileName, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %22, i32** %9
br label %28
23: ; preds = %2
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call i32* @fopen(i8* %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %27, i32** %9
br label %28
28: ; preds = %23, %21
%29 = load i32*, i32** %9
%30 = icmp eq i32* %29, null
br i1 %30, label %31, label %33
31: ; preds = %28
%32 = load i32, i32* @EXIT_FAILURE
store i32 %32, i32* %3
br label %56
33: ; preds = %28
br label %34
34: ; preds = %39, %33
%35 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%36 = load i32*, i32** %9
%37 = call i32* @fgets(i8* %35, i32 128, i32* %36)
%38 = icmp ne i32* %37, null
br i1 %38, label %39, label %47
39: ; preds = %34
%40 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%41 = call float @atof(i8* %40)
%42 = load i32, i32* %7
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [10000 x float], [10000 x float]* %8, i64 0, i64 %43
store float %41, float* %44
%45 = load i32, i32* %7
%46 = add nsw i32 %45, 1
store i32 %46, i32* %7
br label %34
47: ; preds = %34
%48 = load i32*, i32** %9
%49 = call i32 @fclose(i32* %48)
%50 = getelementptr inbounds [10000 x float], [10000 x float]* %8, i64 0, i64 0
%51 = call float @compareArr(float* %50, i32 10000)
store float %51, float* %6
%52 = load float, float* %6
%53 = fpext float %52 to double
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), double %53)
%55 = load i32, i32* @EXIT_SUCCESS
store i32 %55, i32* %3
br label %56
56: ; preds = %47, %31
%57 = load i32, i32* %3
ret i32 %57
}

LLVM IR (-O2):
@main.fileName = internal global [1024 x i8] zeroinitializer
@.str = [37 x i8] c"Bitte geben sie den Dateinamen ein: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [2 x i8] c"r\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [37 x i8] c"Die gr\C3\B6\C3\9Fte Floatzahl lautet: %0.2f\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [10000 x float]
%4 = alloca [128 x i8]
%5 = bitcast [10000 x float]* %3 to i8*
%6 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%7 = icmp slt i32 %0, 2
br i1 %7, label %8, label %14
8: ; preds = %2
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %10, %8
%11 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @main.fileName, i64 0, i64 0))
%12 = tail call signext i8 (...) @getchar()
%13 = icmp eq i8 %12, 10
br i1 %13, label %17, label %10
14: ; preds = %2
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
br label %17
17: ; preds = %10, %14
%18 = phi i8* [ %16, %14 ], [ getelementptr inbounds ([1024 x i8], [1024 x i8]* @main.fileName, i64 0, i64 0), %10 ]
%19 = tail call i32* @fopen(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%20 = icmp eq i32* %19, null
br i1 %20, label %37, label %21
21: ; preds = %17
%22 = call i32* @fgets(i8* %6, i32 128, i32* %19)
%23 = icmp eq i32* %22, null
br i1 %23, label %31, label %24
24: ; preds = %21, %24
%25 = phi i64 [ %28, %24 ], [ 0, %21 ]
%26 = call float @atof(i8* %6)
%27 = getelementptr inbounds [10000 x float], [10000 x float]* %3, i64 0, i64 %25
store float %26, float* %27
%28 = add nuw i64 %25, 1
%29 = call i32* @fgets(i8* %6, i32 128, i32* %19)
%30 = icmp eq i32* %29, null
br i1 %30, label %31, label %24
31: ; preds = %24, %21
%32 = call i32 @fclose(i32* %19)
%33 = getelementptr inbounds [10000 x float], [10000 x float]* %3, i64 0, i64 0
%34 = call float @compareArr(float* %33, i32 10000)
%35 = fpext float %34 to double
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), double %35)
br label %37
37: ; preds = %17, %31
%38 = phi i32* [ @EXIT_SUCCESS, %31 ], [ @EXIT_FAILURE, %17 ]
%39 = load i32, i32* %38
ret i32 %39
}