#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 /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ printf(char *, double, int);
void evoTemp(double *Arrivee, double *Depart, double D) {
  FILE *evolFile = fopen("output/evolValue.m", "w");
  fprintf(evolFile, "function [x] = evolValue()\nx = [");
  int a = 0, d = 0;
  int currantCliantNumber = 0;
  double currantTime = 0.0;
  while ((Arrivee[a] != 0.0 || Depart[d] != 0.0) && currantTime < D) {
    printf(" -at time %f there are %d client on server\n", currantTime,
           currantCliantNumber);
    fprintf(evolFile, " %f %d;", currantTime, currantCliantNumber);
    if (Arrivee[a] == 0.0) {
      currantCliantNumber--;
      currantTime = Depart[d];
      d++;
    } else if (Arrivee[a] > Depart[d]) {
      currantCliantNumber--;
      currantTime = Depart[d];
      d++;
    } else {
      currantCliantNumber++;
      currantTime = Arrivee[a];
      a++;
    }
  }
  fprintf(evolFile, "]\nend");
}


x86 assembly (clang, -O0):
<evoTemp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
lea    0xeb4(%rip),%rdi
lea    0xec0(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xeae(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11d5 <evoTemp+0xa5>
jp     11d5 <evoTemp+0xa5>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
xor    %eax,%eax
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x39(%rbp)
jne    11d5 <evoTemp+0xa5>
jp     11d5 <evoTemp+0xa5>
jmp    11e9 <evoTemp+0xb9>
movsd  -0x38(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
mov    %al,-0x39(%rbp)
mov    -0x39(%rbp),%al
test   $0x1,%al
jne    11f9 <evoTemp+0xc9>
jmp    12e7 <evoTemp+0x1b7>
movsd  -0x38(%rbp),%xmm0
mov    -0x2c(%rbp),%esi
lea    0xe2e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rdi
movsd  -0x38(%rbp),%xmm0
mov    -0x2c(%rbp),%edx
lea    0xe42(%rip),%rsi
mov    $0x1,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1270 <evoTemp+0x140>
jp     1270 <evoTemp+0x140>
mov    -0x2c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    12e2 <evoTemp+0x1b2>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jbe    12b9 <evoTemp+0x189>
mov    -0x2c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    12dd <evoTemp+0x1ad>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    12e2 <evoTemp+0x1b2>
jmp    118b <evoTemp+0x5b>
mov    -0x20(%rbp),%rdi
lea    0xd78(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<evoTemp>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movsd  %xmm0,0x8(%rsp)
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xe9f(%rip),%rdi
lea    0xeab(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%r15
lea    0xe9e(%rip),%rdi
mov    $0x20,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1060 <fwrite@plt>
xorpd  %xmm1,%xmm1
xor    %r12d,%r12d
xor    %r13d,%r13d
xor    %ebp,%ebp
xorpd  %xmm0,%xmm0
mov    %r12d,%r12d
movslq %r13d,%r13
movapd %xmm0,%xmm2
jmp    11bd <evoTemp+0x7d>
cs nopw 0x0(%rax,%rax,1)
nop
movsd  (%r14,%r13,8),%xmm2
add    $0xffffffff,%ebp
add    $0x1,%r13
movsd  (%rbx,%r12,8),%xmm0
ucomisd %xmm1,%xmm0
jne    11d9 <evoTemp+0x99>
jp     11d9 <evoTemp+0x99>
movsd  (%r14,%r13,8),%xmm0
ucomisd %xmm1,%xmm0
jne    11d9 <evoTemp+0x99>
jnp    1240 <evoTemp+0x100>
movsd  0x8(%rsp),%xmm0
ucomisd %xmm2,%xmm0
jbe    1240 <evoTemp+0x100>
lea    0xe4a(%rip),%rdi
movapd %xmm2,%xmm0
mov    %ebp,%esi
movsd  %xmm2,0x10(%rsp)
call   1030 <printf@plt>
mov    %r15,%rdi
lea    0xe5b(%rip),%rsi
movsd  0x10(%rsp),%xmm0
mov    %ebp,%edx
mov    $0x1,%al
call   1040 <fprintf@plt>
xorpd  %xmm1,%xmm1
movsd  (%rbx,%r12,8),%xmm0
ucomisd %xmm1,%xmm0
jne    1228 <evoTemp+0xe8>
jnp    11b0 <evoTemp+0x70>
movsd  (%r14,%r13,8),%xmm2
ucomisd %xmm2,%xmm0
ja     11b6 <evoTemp+0x76>
add    $0x1,%ebp
add    $0x1,%r12d
jmp    1199 <evoTemp+0x59>
lea    0xe23(%rip),%rdi
mov    $0x5,%esi
mov    $0x1,%edx
mov    %r15,%rcx
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <fwrite@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"output/evolValue.m\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [33 x i8] c"function [x] = evolValue()\0Ax = [\00"
@.str.3 = [44 x i8] c" -at time %f there are %d client on server\0A\00"
@.str.4 = [8 x i8] c" %f %d;\00"
@.str.5 = [6 x i8] c"]\0Aend\00"
define void @evoTemp(double* %0, double* %1, double %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca double
store double* %0, double** %4
store double* %1, double** %5
store double %2, double* %6
%12 = call i32* @fopen(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %12, i32** %7
%13 = load i32*, i32** %7
%14 = call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
store double 0.000000e+00, double* %11
br label %15
15: ; preds = %92, %3
%16 = load double*, double** %4
%17 = load i32, i32* %8
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds double, double* %16, i64 %18
%20 = load double, double* %19
%21 = fcmp une double %20, 0.000000e+00
br i1 %21, label %29, label %22
22: ; preds = %15
%23 = load double*, double** %5
%24 = load i32, i32* %9
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds double, double* %23, i64 %25
%27 = load double, double* %26
%28 = fcmp une double %27, 0.000000e+00
br i1 %28, label %29, label %33
29: ; preds = %22, %15
%30 = load double, double* %11
%31 = load double, double* %6
%32 = fcmp olt double %30, %31
br label %33
33: ; preds = %29, %22
%34 = phi i1 [ false, %22 ], [ %32, %29 ]
br i1 %34, label %35, label %93
35: ; preds = %33
%36 = load double, double* %11
%37 = load i32, i32* %10
%38 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), double %36, i32 %37)
%39 = load i32*, i32** %7
%40 = load double, double* %11
%41 = load i32, i32* %10
%42 = call i32 (i32*, i8*, ...) @fprintf(i32* %39, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), double %40, i32 %41)
%43 = load double*, double** %4
%44 = load i32, i32* %8
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds double, double* %43, i64 %45
%47 = load double, double* %46
%48 = fcmp oeq double %47, 0.000000e+00
br i1 %48, label %49, label %59
49: ; preds = %35
%50 = load i32, i32* %10
%51 = add nsw i32 %50, -1
store i32 %51, i32* %10
%52 = load double*, double** %5
%53 = load i32, i32* %9
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds double, double* %52, i64 %54
%56 = load double, double* %55
store double %56, double* %11
%57 = load i32, i32* %9
%58 = add nsw i32 %57, 1
store i32 %58, i32* %9
br label %92
59: ; preds = %35
%60 = load double*, double** %4
%61 = load i32, i32* %8
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds double, double* %60, i64 %62
%64 = load double, double* %63
%65 = load double*, double** %5
%66 = load i32, i32* %9
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds double, double* %65, i64 %67
%69 = load double, double* %68
%70 = fcmp ogt double %64, %69
br i1 %70, label %71, label %81
71: ; preds = %59
%72 = load i32, i32* %10
%73 = add nsw i32 %72, -1
store i32 %73, i32* %10
%74 = load double*, double** %5
%75 = load i32, i32* %9
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds double, double* %74, i64 %76
%78 = load double, double* %77
store double %78, double* %11
%79 = load i32, i32* %9
%80 = add nsw i32 %79, 1
store i32 %80, i32* %9
br label %91
81: ; preds = %59
%82 = load i32, i32* %10
%83 = add nsw i32 %82, 1
store i32 %83, i32* %10
%84 = load double*, double** %4
%85 = load i32, i32* %8
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds double, double* %84, i64 %86
%88 = load double, double* %87
store double %88, double* %11
%89 = load i32, i32* %8
%90 = add nsw i32 %89, 1
store i32 %90, i32* %8
br label %91
91: ; preds = %81, %71
br label %92
92: ; preds = %91, %49
br label %15
93: ; preds = %33
%94 = load i32*, i32** %7
%95 = call i32 (i32*, i8*, ...) @fprintf(i32* %94, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"output/evolValue.m\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [33 x i8] c"function [x] = evolValue()\0Ax = [\00"
@.str.3 = [44 x i8] c" -at time %f there are %d client on server\0A\00"
@.str.4 = [8 x i8] c" %f %d;\00"
@.str.5 = [6 x i8] c"]\0Aend\00"
define void @evoTemp(double* nocapture %0, double* nocapture %1, double %2) {
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i64 @fwrite(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i64 32, i64 1, i32* %4)
br label %6
6: ; preds = %46, %3
%7 = phi i32 [ %48, %46 ], [ 0, %3 ]
%8 = phi i32 [ %14, %46 ], [ 0, %3 ]
%9 = phi i32 [ %47, %46 ], [ 0, %3 ]
%10 = phi double [ %31, %46 ], [ 0.000000e+00, %3 ]
%11 = zext i32 %7 to i64
%12 = getelementptr inbounds double, double* %0, i64 %11
br label %13
13: ; preds = %42, %6
%14 = phi i32 [ %8, %6 ], [ %45, %42 ]
%15 = phi i32 [ %9, %6 ], [ %44, %42 ]
%16 = phi double [ %10, %6 ], [ %43, %42 ]
%17 = load double, double* %12
%18 = fcmp une double %17, 0.000000e+00
br i1 %18, label %26, label %19
19: ; preds = %13
%20 = sext i32 %14 to i64
%21 = getelementptr inbounds double, double* %1, i64 %20
%22 = load double, double* %21
%23 = fcmp une double %22, 0.000000e+00
%24 = fcmp olt double %16, %2
%25 = select i1 %23, i1 %24, i1 false
br i1 %25, label %28, label %49
26: ; preds = %13
%27 = fcmp olt double %16, %2
br i1 %27, label %28, label %49
28: ; preds = %19, %26
%29 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), double %16, i32 %15)
%30 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), double %16, i32 %15)
%31 = load double, double* %12
%32 = fcmp oeq double %31, 0.000000e+00
br i1 %32, label %33, label %37
33: ; preds = %28
%34 = sext i32 %14 to i64
%35 = getelementptr inbounds double, double* %1, i64 %34
%36 = load double, double* %35
br label %42
37: ; preds = %28
%38 = sext i32 %14 to i64
%39 = getelementptr inbounds double, double* %1, i64 %38
%40 = load double, double* %39
%41 = fcmp ogt double %31, %40
br i1 %41, label %42, label %46
42: ; preds = %37, %33
%43 = phi double [ %36, %33 ], [ %40, %37 ]
%44 = add nsw i32 %15, -1
%45 = add nsw i32 %14, 1
br label %13
46: ; preds = %37
%47 = add nsw i32 %15, 1
%48 = add nuw nsw i32 %7, 1
br label %6
49: ; preds = %19, %26
%50 = tail call i64 @fwrite(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i64 5, i64 1, i32* %4)
ret void
}