#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 */
double atof(char *);
int atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(double *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, double);
int rand();
int /*<<< orphan*/ srand(unsigned int);
int /*<<< orphan*/ stderr;
scalar_t__ time(int /*<<< orphan*/ *);
double white_noise(double, double);
int main(int argc, char **argv) {
  int k, t, s;
  double *x, *z, *a, *e, *u;
  int max_points = 10000;
  int outlier_point;
  double ar1_coeff = 0.6;
  double ar2_coeff = 0.5;
  int change_point_time = 1000;
  double expected_change_total = 5.0;
  double decrease_change_value = 0.5;
  double expected_value = 0.0;
  double variance_value = 1.0;
  srand((unsigned)time(NULL));
  outlier_point = rand() % max_points;
  if (argc != 9) {
    fprintf(stderr,
            "Usage : %s number_of_data ar1_coeff ar2_coeff "
            "change_point_time change_point_total "
            "change_point_decrease expected_value_for_white_noise "
            "variance_value_white_noise\n",
            argv[0]);
    exit(1);
  }
  if ((x = (double *)malloc((max_points + 1) * sizeof(double))) == NULL)
    goto MALLOC_ERROR;
  if ((z = (double *)malloc((max_points + 1) * sizeof(double))) == NULL)
    goto MALLOC_ERROR;
  if ((a = (double *)malloc((k + 1) * sizeof(double))) == NULL)
    goto MALLOC_ERROR;
  if ((e = (double *)malloc((max_points + 1) * sizeof(double))) == NULL)
    goto MALLOC_ERROR;
  if ((u = (double *)malloc((max_points + 1) * sizeof(double))) == NULL)
    goto MALLOC_ERROR;
  k = 2;
  max_points = atoi(argv[1]);
  ar1_coeff = atof(argv[2]);
  ar2_coeff = atof(argv[3]);
  change_point_time = atoi(argv[4]);
  expected_change_total = atof(argv[5]);
  decrease_change_value = atof(argv[6]);
  expected_value = atof(argv[7]);
  variance_value = atof(argv[8]);
  a[0] = 0;
  a[1] = ar1_coeff;
  a[2] = ar2_coeff;
  u[0] = expected_change_total;
  t = 1;
  s = 1;
  while (t <= max_points) {
    if (t > 2) {
      u[t] = u[t - 1];
      e[t] = white_noise(expected_value, variance_value);
      z[t] = a[1] * z[t - 1] - a[2] * z[t - 2] + e[t];
      x[t] = z[t] + u[t];
      if (t == change_point_time * s) {
        u[t] += u[0] - decrease_change_value;
        u[0] -= decrease_change_value;
        s++;
      }
    } else {
      u[t] = u[t - 1];
      e[t] = white_noise(expected_value, variance_value);
      x[t] = e[t];
    }
    if (t == outlier_point) {
      printf("% lf\n", x[t] + expected_change_total);
    } else {
      printf("% lf\n", x[t]);
    }
    t++;
  }
  free(x);
  free(z);
  free(a);
  free(e);
  free(u);
  return 0;
MALLOC_ERROR:
  fprintf(stderr, "Unable to malloc memory – fatal !\n");
  exit(-1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x2710,-0x4c(%rbp)
movsd  0xe40(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xe23(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
movl   $0x3e8,-0x64(%rbp)
movsd  0xe17(%rip),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  0xe02(%rip),%xmm0
movsd  %xmm0,-0x78(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  0xde5(%rip),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
xor    %eax,%eax
mov    %eax,%edi
call   1090 <time@plt>
mov    %eax,%edi
call   1070 <srand@plt>
mov    $0x0,%al
call   10d0 <rand@plt>
cltd
idivl  -0x4c(%rbp)
mov    %edx,-0x50(%rbp)
cmpl   $0x9,-0x8(%rbp)
je     1273 <main+0xc3>
mov    0x2d8e(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdbe(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    1299 <main+0xe9>
jmp    162d <main+0x47d>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
jne    12bf <main+0x10f>
jmp    162d <main+0x47d>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
jne    12e5 <main+0x135>
jmp    162d <main+0x47d>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
jne    130b <main+0x15b>
jmp    162d <main+0x47d>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x48(%rbp)
cmp    $0x0,%rax
jne    1331 <main+0x181>
jmp    162d <main+0x47d>
movl   $0x2,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1040 <atof@plt>
movsd  %xmm0,-0x58(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1040 <atof@plt>
movsd  %xmm0,-0x60(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x64(%rbp)
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
call   1040 <atof@plt>
movsd  %xmm0,-0x70(%rbp)
mov    -0x10(%rbp),%rax
mov    0x30(%rax),%rdi
call   1040 <atof@plt>
movsd  %xmm0,-0x78(%rbp)
mov    -0x10(%rbp),%rax
mov    0x38(%rax),%rdi
call   1040 <atof@plt>
movsd  %xmm0,-0x80(%rbp)
mov    -0x10(%rbp),%rax
mov    0x40(%rax),%rdi
call   1040 <atof@plt>
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x38(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
movsd  -0x58(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  -0x60(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movsd  -0x70(%rbp),%xmm0
mov    -0x48(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x1,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x4c(%rbp),%eax
jg     15f5 <main+0x445>
cmpl   $0x2,-0x18(%rbp)
jle    1547 <main+0x397>
mov    -0x48(%rbp),%rax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x48(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x80(%rbp),%xmm0
movsd  -0x88(%rbp),%xmm1
ff
call   1050 <white_noise@plt>
mov    -0x40(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x38(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x38(%rbp),%rax
movsd  0x10(%rax),%xmm1
mov    -0x30(%rbp),%rax
mov    -0x18(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
movslq -0x18(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x48(%rbp),%rax
movslq -0x18(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
mov    -0x64(%rbp),%ecx
imul   -0x1c(%rbp),%ecx
cmp    %ecx,%eax
jne    1542 <main+0x392>
mov    -0x48(%rbp),%rax
movsd  (%rax),%xmm0
subsd  -0x78(%rbp),%xmm0
mov    -0x48(%rbp),%rax
movslq -0x18(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x78(%rbp),%xmm1
mov    -0x48(%rbp),%rax
movsd  (%rax),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    159f <main+0x3ef>
mov    -0x48(%rbp),%rax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x48(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x80(%rbp),%xmm0
movsd  -0x88(%rbp),%xmm1
ff
call   1050 <white_noise@plt>
mov    -0x40(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x40(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
cmp    -0x50(%rbp),%eax
jne    15ce <main+0x41e>
mov    -0x28(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x70(%rbp),%xmm0
lea    0xb00(%rip),%rdi
call   1060 <printf@plt>
jmp    15e7 <main+0x437>
mov    -0x28(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xae2(%rip),%rdi
call   1060 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1409 <main+0x259>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret
mov    0x29ac(%rip),%rax
mov    (%rax),%edi
lea    0xa8d(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0xffffffff,%edi
call   10c0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rsi,%rbp
mov    %edi,%ebx
xor    %edi,%edi
call   1090 <time@plt>
mov    %eax,%edi
call   1070 <srand@plt>
xor    %eax,%eax
call   10d0 <rand@plt>
cmp    $0x9,%ebx
jne    1497 <main+0x2e7>
mov    %eax,%r14d
mov    $0x13888,%edi
call   10a0 <malloc@plt>
test   %rax,%rax
je     1476 <main+0x2c6>
mov    %rax,%r13
mov    $0x13888,%edi
call   10a0 <malloc@plt>
mov    %rax,0x30(%rsp)
test   %rax,%rax
je     1476 <main+0x2c6>
mov    $0x18,%edi
call   10a0 <malloc@plt>
mov    %rax,0x10(%rsp)
test   %rax,%rax
je     1476 <main+0x2c6>
mov    $0x13888,%edi
call   10a0 <malloc@plt>
mov    %rax,0x38(%rsp)
test   %rax,%rax
je     1476 <main+0x2c6>
mov    $0x13888,%edi
call   10a0 <malloc@plt>
test   %rax,%rax
je     1476 <main+0x2c6>
mov    %rax,%rbx
mov    0x8(%rbp),%rdi
call   10b0 <atoi@plt>
mov    %eax,%r15d
mov    0x10(%rbp),%rdi
call   1040 <atof@plt>
movsd  %xmm0,0x18(%rsp)
mov    0x18(%rbp),%rdi
call   1040 <atof@plt>
movsd  %xmm0,0x8(%rsp)
mov    0x20(%rbp),%rdi
call   10b0 <atoi@plt>
mov    %eax,0x24(%rsp)
mov    0x28(%rbp),%rdi
call   1040 <atof@plt>
movsd  %xmm0,0x28(%rsp)
mov    0x30(%rbp),%rdi
call   1040 <atof@plt>
movsd  %xmm0,0x40(%rsp)
mov    0x38(%rbp),%rdi
call   1040 <atof@plt>
movsd  %xmm0,0x50(%rsp)
mov    0x40(%rbp),%rdi
call   1040 <atof@plt>
movsd  %xmm0,0x48(%rsp)
mov    0x10(%rsp),%rax
movq   $0x0,(%rax)
movsd  0x18(%rsp),%xmm0
movsd  %xmm0,0x8(%rax)
movsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x10(%rax)
movsd  0x28(%rsp),%xmm0
movsd  %xmm0,(%rbx)
test   %r15d,%r15d
jle    1437 <main+0x287>
movslq %r14d,%rax
imul   $0x68db8bad,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x2c,%rcx
add    %edx,%ecx
imul   $0x2710,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,%ecx
mov    %r15d,%eax
mov    %rax,0x18(%rsp)
mov    %rcx,%rax
mov    %rcx,0x8(%rsp)
lea    -0x1(%rcx),%r12
mov    $0x1,%r15d
xor    %r14d,%r14d
jmp    1361 <main+0x1b1>
movsd  0x8(%r13,%r14,8),%xmm0
lea    0xd56(%rip),%rdi
call   1060 <printf@plt>
mov    %rbp,%r14
cmp    %rbp,0x18(%rsp)
je     1437 <main+0x287>
lea    0x1(%r14),%rbp
movsd  (%rbx,%r14,8),%xmm0
movsd  %xmm0,0x8(%rbx,%r14,8)
movsd  0x50(%rsp),%xmm0
movsd  0x48(%rsp),%xmm1
call   1050 <white_noise@plt>
mov    0x38(%rsp),%rax
movsd  %xmm0,0x8(%rax,%r14,8)
cmp    $0x3,%rbp
jb     1410 <main+0x260>
lea    -0x1(%r14),%eax
mov    0x30(%rsp),%rcx
movsd  (%rcx,%rax,8),%xmm1
mov    0x10(%rsp),%rax
mulsd  0x10(%rax),%xmm1
movsd  0x8(%rax),%xmm2
mulsd  (%rcx,%r14,8),%xmm2
subsd  %xmm1,%xmm2
addsd  %xmm2,%xmm0
movsd  %xmm0,0x8(%rcx,%r14,8)
addsd  0x8(%rbx,%r14,8),%xmm0
movsd  %xmm0,0x8(%r13,%r14,8)
mov    %r15d,%eax
imul   0x24(%rsp),%eax
cmp    %rax,%rbp
jne    1417 <main+0x267>
movsd  (%rbx),%xmm0
subsd  0x40(%rsp),%xmm0
movsd  0x8(%rbx,%r14,8),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rbx,%r14,8)
movsd  %xmm0,(%rbx)
add    $0x1,%r15d
jmp    1417 <main+0x267>
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,0x8(%r13,%r14,8)
cmp    %r14,%r12
jne    1340 <main+0x190>
mov    0x8(%rsp),%rax
movsd  0x0(%r13,%rax,8),%xmm0
addsd  0x28(%rsp),%xmm0
jmp    1347 <main+0x197>
mov    %r13,%rdi
call   1030 <free@plt>
mov    0x30(%rsp),%rdi
call   1030 <free@plt>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
mov    0x38(%rsp),%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2b63(%rip),%rax
mov    (%rax),%edi
lea    0xc24(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0xffffffff,%edi
call   10c0 <exit@plt>
mov    0x2b42(%rip),%rax
mov    (%rax),%edi
mov    0x0(%rbp),%rdx
lea    0xb55(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [164 x i8] c"Usage : %s number_of_data ar1_coeff ar2_coeff change_point_time change_point_total change_point_decrease expected_value_for_white_noise variance_value_white_noise\0A\00"
@.str.1 = [6 x i8] c"% lf\0A\00"
@.str.2 = [37 x i8] c"Unable to malloc memory \E2\80\93 fatal !\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca double*
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
%13 = alloca double*
%14 = alloca i32
%15 = alloca i32
%16 = alloca double
%17 = alloca double
%18 = alloca i32
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 10000, i32* %14
store double 6.000000e-01, double* %16
store double 5.000000e-01, double* %17
store i32 1000, i32* %18
store double 5.000000e+00, double* %19
store double 5.000000e-01, double* %20
store double 0.000000e+00, double* %21
store double 1.000000e+00, double* %22
%23 = call i64 @time(i32* null)
%24 = trunc i64 %23 to i32
%25 = call i32 @srand(i32 %24)
%26 = call i32 (...) @rand()
%27 = load i32, i32* %14
%28 = srem i32 %26, %27
store i32 %28, i32* %15
%29 = load i32, i32* %4
%30 = icmp ne i32 %29, 9
br i1 %30, label %31, label %38
31: ; preds = %2
%32 = load i32, i32* @stderr
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 0
%35 = load i8*, i8** %34
%36 = call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([164 x i8], [164 x i8]* @.str, i64 0, i64 0), i8* %35)
%37 = call i32 @exit(i32 1)
unreachable
38: ; preds = %2
%39 = load i32, i32* %14
%40 = add nsw i32 %39, 1
%41 = sext i32 %40 to i64
%42 = mul i64 %41, 8
%43 = trunc i64 %42 to i32
%44 = call i64 @malloc(i32 %43)
%45 = inttoptr i64 %44 to double*
store double* %45, double** %9
%46 = icmp eq double* %45, null
br i1 %46, label %47, label %48
47: ; preds = %38
br label %289
48: ; preds = %38
%49 = load i32, i32* %14
%50 = add nsw i32 %49, 1
%51 = sext i32 %50 to i64
%52 = mul i64 %51, 8
%53 = trunc i64 %52 to i32
%54 = call i64 @malloc(i32 %53)
%55 = inttoptr i64 %54 to double*
store double* %55, double** %10
%56 = icmp eq double* %55, null
br i1 %56, label %57, label %58
57: ; preds = %48
br label %289
58: ; preds = %48
%59 = load i32, i32* %6
%60 = add nsw i32 %59, 1
%61 = sext i32 %60 to i64
%62 = mul i64 %61, 8
%63 = trunc i64 %62 to i32
%64 = call i64 @malloc(i32 %63)
%65 = inttoptr i64 %64 to double*
store double* %65, double** %11
%66 = icmp eq double* %65, null
br i1 %66, label %67, label %68
67: ; preds = %58
br label %289
68: ; preds = %58
%69 = load i32, i32* %14
%70 = add nsw i32 %69, 1
%71 = sext i32 %70 to i64
%72 = mul i64 %71, 8
%73 = trunc i64 %72 to i32
%74 = call i64 @malloc(i32 %73)
%75 = inttoptr i64 %74 to double*
store double* %75, double** %12
%76 = icmp eq double* %75, null
br i1 %76, label %77, label %78
77: ; preds = %68
br label %289
78: ; preds = %68
%79 = load i32, i32* %14
%80 = add nsw i32 %79, 1
%81 = sext i32 %80 to i64
%82 = mul i64 %81, 8
%83 = trunc i64 %82 to i32
%84 = call i64 @malloc(i32 %83)
%85 = inttoptr i64 %84 to double*
store double* %85, double** %13
%86 = icmp eq double* %85, null
br i1 %86, label %87, label %88
87: ; preds = %78
br label %289
88: ; preds = %78
store i32 2, i32* %6
%89 = load i8**, i8*** %5
%90 = getelementptr inbounds i8*, i8** %89, i64 1
%91 = load i8*, i8** %90
%92 = call i32 @atoi(i8* %91)
store i32 %92, i32* %14
%93 = load i8**, i8*** %5
%94 = getelementptr inbounds i8*, i8** %93, i64 2
%95 = load i8*, i8** %94
%96 = call double @atof(i8* %95)
store double %96, double* %16
%97 = load i8**, i8*** %5
%98 = getelementptr inbounds i8*, i8** %97, i64 3
%99 = load i8*, i8** %98
%100 = call double @atof(i8* %99)
store double %100, double* %17
%101 = load i8**, i8*** %5
%102 = getelementptr inbounds i8*, i8** %101, i64 4
%103 = load i8*, i8** %102
%104 = call i32 @atoi(i8* %103)
store i32 %104, i32* %18
%105 = load i8**, i8*** %5
%106 = getelementptr inbounds i8*, i8** %105, i64 5
%107 = load i8*, i8** %106
%108 = call double @atof(i8* %107)
store double %108, double* %19
%109 = load i8**, i8*** %5
%110 = getelementptr inbounds i8*, i8** %109, i64 6
%111 = load i8*, i8** %110
%112 = call double @atof(i8* %111)
store double %112, double* %20
%113 = load i8**, i8*** %5
%114 = getelementptr inbounds i8*, i8** %113, i64 7
%115 = load i8*, i8** %114
%116 = call double @atof(i8* %115)
store double %116, double* %21
%117 = load i8**, i8*** %5
%118 = getelementptr inbounds i8*, i8** %117, i64 8
%119 = load i8*, i8** %118
%120 = call double @atof(i8* %119)
store double %120, double* %22
%121 = load double*, double** %11
%122 = getelementptr inbounds double, double* %121, i64 0
store double 0.000000e+00, double* %122
%123 = load double, double* %16
%124 = load double*, double** %11
%125 = getelementptr inbounds double, double* %124, i64 1
store double %123, double* %125
%126 = load double, double* %17
%127 = load double*, double** %11
%128 = getelementptr inbounds double, double* %127, i64 2
store double %126, double* %128
%129 = load double, double* %19
%130 = load double*, double** %13
%131 = getelementptr inbounds double, double* %130, i64 0
store double %129, double* %131
store i32 1, i32* %7
store i32 1, i32* %8
br label %132
132: ; preds = %275, %88
%133 = load i32, i32* %7
%134 = load i32, i32* %14
%135 = icmp sle i32 %133, %134
br i1 %135, label %136, label %278
136: ; preds = %132
%137 = load i32, i32* %7
%138 = icmp sgt i32 %137, 2
br i1 %138, label %139, label %228
139: ; preds = %136
%140 = load double*, double** %13
%141 = load i32, i32* %7
%142 = sub nsw i32 %141, 1
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds double, double* %140, i64 %143
%145 = load double, double* %144
%146 = load double*, double** %13
%147 = load i32, i32* %7
%148 = sext i32 %147 to i64
%149 = getelementptr inbounds double, double* %146, i64 %148
store double %145, double* %149
%150 = load double, double* %21
%151 = load double, double* %22
%152 = call double @white_noise(double %150, double %151)
%153 = load double*, double** %12
%154 = load i32, i32* %7
%155 = sext i32 %154 to i64
%156 = getelementptr inbounds double, double* %153, i64 %155
store double %152, double* %156
%157 = load double*, double** %11
%158 = getelementptr inbounds double, double* %157, i64 1
%159 = load double, double* %158
%160 = load double*, double** %10
%161 = load i32, i32* %7
%162 = sub nsw i32 %161, 1
%163 = sext i32 %162 to i64
%164 = getelementptr inbounds double, double* %160, i64 %163
%165 = load double, double* %164
%166 = load double*, double** %11
%167 = getelementptr inbounds double, double* %166, i64 2
%168 = load double, double* %167
%169 = load double*, double** %10
%170 = load i32, i32* %7
%171 = sub nsw i32 %170, 2
%172 = sext i32 %171 to i64
%173 = getelementptr inbounds double, double* %169, i64 %172
%174 = load double, double* %173
%175 = fmul double %168, %174
%176 = fneg double %175
%177 = call double @llvm.fmuladd.f64(double %159, double %165, double %176)
%178 = load double*, double** %12
%179 = load i32, i32* %7
%180 = sext i32 %179 to i64
%181 = getelementptr inbounds double, double* %178, i64 %180
%182 = load double, double* %181
%183 = fadd double %177, %182
%184 = load double*, double** %10
%185 = load i32, i32* %7
%186 = sext i32 %185 to i64
%187 = getelementptr inbounds double, double* %184, i64 %186
store double %183, double* %187
%188 = load double*, double** %10
%189 = load i32, i32* %7
%190 = sext i32 %189 to i64
%191 = getelementptr inbounds double, double* %188, i64 %190
%192 = load double, double* %191
%193 = load double*, double** %13
%194 = load i32, i32* %7
%195 = sext i32 %194 to i64
%196 = getelementptr inbounds double, double* %193, i64 %195
%197 = load double, double* %196
%198 = fadd double %192, %197
%199 = load double*, double** %9
%200 = load i32, i32* %7
%201 = sext i32 %200 to i64
%202 = getelementptr inbounds double, double* %199, i64 %201
store double %198, double* %202
%203 = load i32, i32* %7
%204 = load i32, i32* %18
%205 = load i32, i32* %8
%206 = mul nsw i32 %204, %205
%207 = icmp eq i32 %203, %206
br i1 %207, label %208, label %227
208: ; preds = %139
%209 = load double*, double** %13
%210 = getelementptr inbounds double, double* %209, i64 0
%211 = load double, double* %210
%212 = load double, double* %20
%213 = fsub double %211, %212
%214 = load double*, double** %13
%215 = load i32, i32* %7
%216 = sext i32 %215 to i64
%217 = getelementptr inbounds double, double* %214, i64 %216
%218 = load double, double* %217
%219 = fadd double %218, %213
store double %219, double* %217
%220 = load double, double* %20
%221 = load double*, double** %13
%222 = getelementptr inbounds double, double* %221, i64 0
%223 = load double, double* %222
%224 = fsub double %223, %220
store double %224, double* %222
%225 = load i32, i32* %8
%226 = add nsw i32 %225, 1
store i32 %226, i32* %8
br label %227
227: ; preds = %208, %139
br label %255
228: ; preds = %136
%229 = load double*, double** %13
%230 = load i32, i32* %7
%231 = sub nsw i32 %230, 1
%232 = sext i32 %231 to i64
%233 = getelementptr inbounds double, double* %229, i64 %232
%234 = load double, double* %233
%235 = load double*, double** %13
%236 = load i32, i32* %7
%237 = sext i32 %236 to i64
%238 = getelementptr inbounds double, double* %235, i64 %237
store double %234, double* %238
%239 = load double, double* %21
%240 = load double, double* %22
%241 = call double @white_noise(double %239, double %240)
%242 = load double*, double** %12
%243 = load i32, i32* %7
%244 = sext i32 %243 to i64
%245 = getelementptr inbounds double, double* %242, i64 %244
store double %241, double* %245
%246 = load double*, double** %12
%247 = load i32, i32* %7
%248 = sext i32 %247 to i64
%249 = getelementptr inbounds double, double* %246, i64 %248
%250 = load double, double* %249
%251 = load double*, double** %9
%252 = load i32, i32* %7
%253 = sext i32 %252 to i64
%254 = getelementptr inbounds double, double* %251, i64 %253
store double %250, double* %254
br label %255
255: ; preds = %228, %227
%256 = load i32, i32* %7
%257 = load i32, i32* %15
%258 = icmp eq i32 %256, %257
br i1 %258, label %259, label %268
259: ; preds = %255
%260 = load double*, double** %9
%261 = load i32, i32* %7
%262 = sext i32 %261 to i64
%263 = getelementptr inbounds double, double* %260, i64 %262
%264 = load double, double* %263
%265 = load double, double* %19
%266 = fadd double %264, %265
%267 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %266)
br label %275
268: ; preds = %255
%269 = load double*, double** %9
%270 = load i32, i32* %7
%271 = sext i32 %270 to i64
%272 = getelementptr inbounds double, double* %269, i64 %271
%273 = load double, double* %272
%274 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %273)
br label %275
275: ; preds = %268, %259
%276 = load i32, i32* %7
%277 = add nsw i32 %276, 1
store i32 %277, i32* %7
br label %132
278: ; preds = %132
%279 = load double*, double** %9
%280 = call i32 @free(double* %279)
%281 = load double*, double** %10
%282 = call i32 @free(double* %281)
%283 = load double*, double** %11
%284 = call i32 @free(double* %283)
%285 = load double*, double** %12
%286 = call i32 @free(double* %285)
%287 = load double*, double** %13
%288 = call i32 @free(double* %287)
ret i32 0
289: ; preds = %87, %77, %67, %57, %47
%290 = load i32, i32* @stderr
%291 = call i32 (i32, i8*, ...) @fprintf(i32 %290, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
%292 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [164 x i8] c"Usage : %s number_of_data ar1_coeff ar2_coeff change_point_time change_point_total change_point_decrease expected_value_for_white_noise variance_value_white_noise\0A\00"
@.str.1 = [6 x i8] c"% lf\0A\00"
@.str.2 = [37 x i8] c"Unable to malloc memory \E2\80\93 fatal !\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i64 @time(i32* null)
%4 = trunc i64 %3 to i32
%5 = tail call i32 @srand(i32 %4)
%6 = tail call i32 (...) @rand()
%7 = srem i32 %6, 10000
%8 = icmp eq i32 %0, 9
br i1 %8, label %14, label %9
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = load i8*, i8** %1
%12 = tail call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([164 x i8], [164 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = tail call i32 @exit(i32 1)
unreachable
14: ; preds = %2
%15 = tail call i64 @malloc(i32 80008)
%16 = inttoptr i64 %15 to double*
%17 = icmp eq i64 %15, 0
br i1 %17, label %125, label %18
18: ; preds = %14
%19 = tail call i64 @malloc(i32 80008)
%20 = inttoptr i64 %19 to double*
%21 = icmp eq i64 %19, 0
br i1 %21, label %125, label %22
22: ; preds = %18
%23 = tail call i64 @malloc(i32 24)
%24 = inttoptr i64 %23 to double*
%25 = icmp eq i64 %23, 0
br i1 %25, label %125, label %26
26: ; preds = %22
%27 = tail call i64 @malloc(i32 80008)
%28 = inttoptr i64 %27 to double*
%29 = icmp eq i64 %27, 0
br i1 %29, label %125, label %30
30: ; preds = %26
%31 = tail call i64 @malloc(i32 80008)
%32 = inttoptr i64 %31 to double*
%33 = icmp eq i64 %31, 0
br i1 %33, label %125, label %34
34: ; preds = %30
%35 = getelementptr inbounds i8*, i8** %1, i64 1
%36 = load i8*, i8** %35
%37 = tail call i32 @atoi(i8* %36)
%38 = getelementptr inbounds i8*, i8** %1, i64 2
%39 = load i8*, i8** %38
%40 = tail call double @atof(i8* %39)
%41 = getelementptr inbounds i8*, i8** %1, i64 3
%42 = load i8*, i8** %41
%43 = tail call double @atof(i8* %42)
%44 = getelementptr inbounds i8*, i8** %1, i64 4
%45 = load i8*, i8** %44
%46 = tail call i32 @atoi(i8* %45)
%47 = getelementptr inbounds i8*, i8** %1, i64 5
%48 = load i8*, i8** %47
%49 = tail call double @atof(i8* %48)
%50 = getelementptr inbounds i8*, i8** %1, i64 6
%51 = load i8*, i8** %50
%52 = tail call double @atof(i8* %51)
%53 = getelementptr inbounds i8*, i8** %1, i64 7
%54 = load i8*, i8** %53
%55 = tail call double @atof(i8* %54)
%56 = getelementptr inbounds i8*, i8** %1, i64 8
%57 = load i8*, i8** %56
%58 = tail call double @atof(i8* %57)
store double 0.000000e+00, double* %24
%59 = getelementptr inbounds double, double* %24, i64 1
store double %40, double* %59
%60 = getelementptr inbounds double, double* %24, i64 2
store double %43, double* %60
store double %49, double* %32
%61 = icmp slt i32 %37, 1
br i1 %61, label %119, label %62
62: ; preds = %34
%63 = zext i32 %7 to i64
%64 = add nuw i32 %37, 1
%65 = zext i32 %64 to i64
%66 = getelementptr inbounds double, double* %16, i64 %63
br label %67
67: ; preds = %62, %114
%68 = phi i64 [ 1, %62 ], [ %117, %114 ]
%69 = phi i32 [ 1, %62 ], [ %106, %114 ]
%70 = icmp ugt i64 %68, 2
%71 = add nsw i64 %68, -1
%72 = getelementptr inbounds double, double* %32, i64 %71
%73 = load double, double* %72
%74 = getelementptr inbounds double, double* %32, i64 %68
store double %73, double* %74
%75 = tail call double @white_noise(double %55, double %58)
%76 = getelementptr inbounds double, double* %28, i64 %68
store double %75, double* %76
br i1 %70, label %77, label %103
77: ; preds = %67
%78 = load double, double* %59
%79 = getelementptr inbounds double, double* %20, i64 %71
%80 = load double, double* %79
%81 = load double, double* %60
%82 = add nuw i64 %68, 4294967294
%83 = and i64 %82, 4294967295
%84 = getelementptr inbounds double, double* %20, i64 %83
%85 = load double, double* %84
%86 = fneg double %81
%87 = fmul double %85, %86
%88 = tail call double @llvm.fmuladd.f64(double %78, double %80, double %87)
%89 = fadd double %75, %88
%90 = getelementptr inbounds double, double* %20, i64 %68
store double %89, double* %90
%91 = load double, double* %74
%92 = fadd double %91, %89
%93 = getelementptr inbounds double, double* %16, i64 %68
store double %92, double* %93
%94 = mul nsw i32 %69, %46
%95 = zext i32 %94 to i64
%96 = icmp eq i64 %68, %95
br i1 %96, label %97, label %105
97: ; preds = %77
%98 = load double, double* %32
%99 = fsub double %98, %52
%100 = load double, double* %74
%101 = fadd double %100, %99
store double %101, double* %74
store double %99, double* %32
%102 = add nsw i32 %69, 1
br label %105
103: ; preds = %67
%104 = getelementptr inbounds double, double* %16, i64 %68
store double %75, double* %104
br label %105
105: ; preds = %77, %97, %103
%106 = phi i32 [ %102, %97 ], [ %69, %77 ], [ %69, %103 ]
%107 = icmp eq i64 %68, %63
br i1 %107, label %108, label %111
108: ; preds = %105
%109 = load double, double* %66
%110 = fadd double %49, %109
br label %114
111: ; preds = %105
%112 = getelementptr inbounds double, double* %16, i64 %68
%113 = load double, double* %112
br label %114
114: ; preds = %111, %108
%115 = phi double [ %113, %111 ], [ %110, %108 ]
%116 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %115)
%117 = add nuw nsw i64 %68, 1
%118 = icmp eq i64 %117, %65
br i1 %118, label %119, label %67
119: ; preds = %114, %34
%120 = tail call i32 @free(double* %16)
%121 = tail call i32 @free(double* %20)
%122 = tail call i32 @free(double* %24)
%123 = tail call i32 @free(double* %28)
%124 = tail call i32 @free(double* %32)
ret i32 0
125: ; preds = %30, %26, %22, %18, %14
%126 = load i32, i32* @stderr
%127 = tail call i32 (i32, i8*, ...) @fprintf(i32 %126, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
%128 = tail call i32 @exit(i32 -1)
unreachable
}