#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 *, ...);
int fit_print(double *dat) {
  printf("Fitdaten fuer Gerade f = m*x+n:\n");
  printf("m: %f +- %f\n", dat[0], dat[1]);
  printf("n: %f +- %f\n", dat[2], dat[3]);
  printf("Ausgewertet nach %.0f Iterationen, letzte Aenderung: %.5e\n", dat[6],
         dat[7]);
  printf("Guete des Fits (Chi square / r.o.f): %f\n", dat[8]);
  printf("Abbruchkriterium der Iteration: ");
  switch ((int)dat[5]) {
  case 1:
    printf("Maximale Anzahl Iterationen erreicht.");
    break;
  case 2:
    printf("Letzte Aenderung klein genug.");
    break;
  case 3:
    printf("Daten haben sich eingependelt.");
    break;
  case 4:
    printf("Speicherzuweisung fehlgeschlagen.");
    break;
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<fit_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xeed(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x11(%rbp)
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0x8(%rax),%xmm1
lea    0xef0(%rip),%rdi
mov    $0x2,%al
mov    %al,-0x12(%rbp)
call   1030 <printf@plt>
mov    -0x12(%rbp),%al
mov    -0x8(%rbp),%rcx
movsd  0x10(%rcx),%xmm0
movsd  0x18(%rcx),%xmm1
lea    0xedb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x12(%rbp),%al
mov    -0x8(%rbp),%rcx
movsd  0x30(%rcx),%xmm0
movsd  0x38(%rcx),%xmm1
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movsd  0x40(%rax),%xmm0
lea    0xef1(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x11(%rbp),%al
lea    0xf09(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
cvttsd2si 0x28(%rax),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     1221 <fit_print+0x111>
mov    -0x10(%rbp),%rax
lea    0xe2f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeef(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1221 <fit_print+0x111>
lea    0xf02(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1221 <fit_print+0x111>
lea    0xf0d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1221 <fit_print+0x111>
lea    0xf19(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe07(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fit_print>:
push   %rbx
mov    %rdi,%rbx
lea    0xfe9(%rip),%rdi
call   1040 <puts@plt>
movsd  (%rbx),%xmm0
movsd  0x8(%rbx),%xmm1
lea    0xeb0(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
movsd  0x10(%rbx),%xmm0
movsd  0x18(%rbx),%xmm1
lea    0xea5(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
movsd  0x30(%rbx),%xmm0
movsd  0x38(%rbx),%xmm1
lea    0xe9a(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
movsd  0x40(%rbx),%xmm0
lea    0xec2(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xedd(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cvttsd2si 0x28(%rbx),%eax
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     11cc <fit_print+0x9c>
cltq
lea    0xf86(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Fitdaten fuer Gerade f = m*x+n:\0A\00"
@.str.1 = [13 x i8] c"m: %f +- %f\0A\00"
@.str.2 = [13 x i8] c"n: %f +- %f\0A\00"
@.str.3 = [59 x i8] c"Ausgewertet nach %.0f Iterationen, letzte Aenderung: %.5e\0A\00"
@.str.4 = [41 x i8] c"Guete des Fits (Chi square / r.o.f): %f\0A\00"
@.str.5 = [33 x i8] c"Abbruchkriterium der Iteration: \00"
@.str.6 = [38 x i8] c"Maximale Anzahl Iterationen erreicht.\00"
@.str.7 = [30 x i8] c"Letzte Aenderung klein genug.\00"
@.str.8 = [31 x i8] c"Daten haben sich eingependelt.\00"
@.str.9 = [34 x i8] c"Speicherzuweisung fehlgeschlagen.\00"
@.str.10 = [2 x i8] c"\0A\00"
define i32 @fit_print(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%4 = load double*, double** %2
%5 = getelementptr inbounds double, double* %4, i64 0
%6 = load double, double* %5
%7 = load double*, double** %2
%8 = getelementptr inbounds double, double* %7, i64 1
%9 = load double, double* %8
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), double %6, double %9)
%11 = load double*, double** %2
%12 = getelementptr inbounds double, double* %11, i64 2
%13 = load double, double* %12
%14 = load double*, double** %2
%15 = getelementptr inbounds double, double* %14, i64 3
%16 = load double, double* %15
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), double %13, double %16)
%18 = load double*, double** %2
%19 = getelementptr inbounds double, double* %18, i64 6
%20 = load double, double* %19
%21 = load double*, double** %2
%22 = getelementptr inbounds double, double* %21, i64 7
%23 = load double, double* %22
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0), double %20, double %23)
%25 = load double*, double** %2
%26 = getelementptr inbounds double, double* %25, i64 8
%27 = load double, double* %26
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), double %27)
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0))
%30 = load double*, double** %2
%31 = getelementptr inbounds double, double* %30, i64 5
%32 = load double, double* %31
%33 = fptosi double %32 to i32
switch i32 %33, label %42 [
i32 1, label %34
i32 2, label %36
i32 3, label %38
i32 4, label %40
]
34: ; preds = %1
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0))
br label %42
36: ; preds = %1
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0))
br label %42
38: ; preds = %1
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0))
br label %42
40: ; preds = %1
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0))
br label %42
42: ; preds = %1, %40, %38, %36, %34
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [13 x i8] c"m: %f +- %f\0A\00"
@.str.2 = [13 x i8] c"n: %f +- %f\0A\00"
@.str.3 = [59 x i8] c"Ausgewertet nach %.0f Iterationen, letzte Aenderung: %.5e\0A\00"
@.str.4 = [41 x i8] c"Guete des Fits (Chi square / r.o.f): %f\0A\00"
@.str.5 = [33 x i8] c"Abbruchkriterium der Iteration: \00"
@.str.6 = [38 x i8] c"Maximale Anzahl Iterationen erreicht.\00"
@.str.7 = [30 x i8] c"Letzte Aenderung klein genug.\00"
@.str.8 = [31 x i8] c"Daten haben sich eingependelt.\00"
@.str.9 = [34 x i8] c"Speicherzuweisung fehlgeschlagen.\00"
@str = [32 x i8] c"Fitdaten fuer Gerade f = m*x+n:\00"
@reltable.fit_print = [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([38 x i8]* @.str.6 to i64), i64 ptrtoint ([4 x i32]* @reltable.fit_print to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([30 x i8]* @.str.7 to i64), i64 ptrtoint ([4 x i32]* @reltable.fit_print to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([31 x i8]* @.str.8 to i64), i64 ptrtoint ([4 x i32]* @reltable.fit_print to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([34 x i8]* @.str.9 to i64), i64 ptrtoint ([4 x i32]* @reltable.fit_print to i64)) to i32)]
define i32 @fit_print(double* nocapture %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%3 = load double, double* %0
%4 = getelementptr inbounds double, double* %0, i64 1
%5 = load double, double* %4
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), double %3, double %5)
%7 = getelementptr inbounds double, double* %0, i64 2
%8 = load double, double* %7
%9 = getelementptr inbounds double, double* %0, i64 3
%10 = load double, double* %9
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), double %8, double %10)
%12 = getelementptr inbounds double, double* %0, i64 6
%13 = load double, double* %12
%14 = getelementptr inbounds double, double* %0, i64 7
%15 = load double, double* %14
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0), double %13, double %15)
%17 = getelementptr inbounds double, double* %0, i64 8
%18 = load double, double* %17
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), double %18)
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0))
%21 = getelementptr inbounds double, double* %0, i64 5
%22 = load double, double* %21
%23 = fptosi double %22 to i32
%24 = add i32 %23, -1
%25 = icmp ult i32 %24, 4
br i1 %25, label %26, label %31
26: ; preds = %1
%27 = sext i32 %24 to i64
%28 = shl i64 %27, 2
%29 = call i8* @llvm.load.relative.i64(i8* bitcast ([4 x i32]* @reltable.fit_print to i8*), i64 %28)
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %29)
br label %31
31: ; preds = %1, %26
%32 = tail call i32 @putchar(i32 10)
ret i32 0
}