#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, double, double);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *);
double rand();
int /*<<< orphan*/ srand(int);
int /*<<< orphan*/ stderr;
bool verifyResultJacobi1D(double *result, int problemSize, int seed,
                          int steps) {
  int lowerBound = 1;
  int upperBound = lowerBound + problemSize - 1;
  int x;
  int t, read = 0, write = 1;
  double *space[2];
  bool failed = false;
  space[0] = (double *)malloc((problemSize + 2) * sizeof(double));
  space[1] = (double *)malloc((problemSize + 2) * sizeof(double));
  if (space[0] == NULL || space[1] == NULL) {
    printf("Could not allocate space array\n");
    exit(-1);
  }
  srand(seed);
  for (x = lowerBound; x <= upperBound; ++x) {
    space[0][x] = rand() / (double)rand();
  }
  space[0][0] = 0;
  space[0][upperBound + 1] = 0;
  space[1][0] = 0;
  space[1][upperBound + 1] = 0;
  for (t = 1; t <= steps; ++t) {
    for (x = lowerBound; x <= upperBound; ++x) {
      space[write][x] =
          (space[read][x - 1] + space[read][x] + space[read][x + 1]) / 3;
    }
    read = write;
    write = 1 - write;
  }
  for (x = lowerBound; x <= upperBound; ++x) {
    if (space[read][x] != result[x]) {
      fprintf(stderr, "Position: %d, values: %f, %f\n", x, space[read][x],
              result[x]);
      failed = true;
      break;
    }
  }
  return !failed;
}


x86 assembly (clang, -O0):
<verifyResultJacobi1D>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x1,-0x2c(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0xc(%rbp),%eax
add    $0x2,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x40(%rbp)
mov    -0xc(%rbp),%eax
add    $0x2,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x40(%rbp)
je     11e1 <verifyResultJacobi1D+0x81>
cmpq   $0x0,-0x38(%rbp)
jne    11f7 <verifyResultJacobi1D+0x97>
lea    0xe20(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%edi
call   1040 <srand@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jg     124b <verifyResultJacobi1D+0xeb>
mov    $0x0,%al
call   1080 <rand@plt>
movsd  %xmm0,-0x50(%rbp)
mov    $0x0,%al
call   1080 <rand@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
divsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1205 <verifyResultJacobi1D+0xa5>
mov    -0x40(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x40(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x38(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x38(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     133b <verifyResultJacobi1D+0x1db>
mov    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jg     131c <verifyResultJacobi1D+0x1bc>
movslq -0x28(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rax
mov    -0x20(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movslq -0x28(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rax
movslq -0x20(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movslq -0x28(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rax
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  0xd08(%rip),%xmm1
divsd  %xmm1,%xmm0
movslq -0x2c(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rax
movslq -0x20(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    12a4 <verifyResultJacobi1D+0x144>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    $0x1,%eax
sub    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1292 <verifyResultJacobi1D+0x132>
mov    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jg     13d3 <verifyResultJacobi1D+0x273>
movslq -0x28(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
ucomisd (%rax,%rcx,8),%xmm0
jne    137d <verifyResultJacobi1D+0x21d>
jp     137d <verifyResultJacobi1D+0x21d>
jmp    13c0 <verifyResultJacobi1D+0x260>
mov    0x2c5c(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%edx
movslq -0x28(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
lea    0xc79(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x44(%rbp)
jmp    13d3 <verifyResultJacobi1D+0x273>
jmp    13c5 <verifyResultJacobi1D+0x265>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1341 <verifyResultJacobi1D+0x1e1>
cmpl   $0x0,-0x44(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<verifyResultJacobi1D>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %ecx,%r15d
mov    %edx,%r13d
mov    %esi,%r14d
mov    %rdi,0x20(%rsp)
lea    0x10(,%r14,8),%ebx
mov    %ebx,%edi
call   1060 <malloc@plt>
mov    %rax,%rbp
mov    %rax,0x10(%rsp)
mov    %ebx,%edi
call   1060 <malloc@plt>
mov    %rax,0x18(%rsp)
test   %rbp,%rbp
je     14db <verifyResultJacobi1D+0x37b>
mov    %rax,%r12
test   %rax,%rax
je     14db <verifyResultJacobi1D+0x37b>
lea    0x1(%r14),%ebx
mov    %r13d,%edi
call   1040 <srand@plt>
mov    %ebx,(%rsp)
mov    %ebx,%ebx
test   %r14d,%r14d
jle    11fe <verifyResultJacobi1D+0x9e>
mov    $0x1,%r13d
xor    %eax,%eax
call   1080 <rand@plt>
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1080 <rand@plt>
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x0(%rbp,%r13,8)
add    $0x1,%r13
cmp    %r13,%rbx
jne    11d0 <verifyResultJacobi1D+0x70>
movq   $0x0,0x0(%rbp)
movslq (%rsp),%rax
movq   $0x0,0x0(%rbp,%rax,8)
movq   $0x0,(%r12)
movq   $0x0,(%r12,%rax,8)
test   %r15d,%r15d
jle    1436 <verifyResultJacobi1D+0x2d6>
lea    0x1(%rbx),%r12
lea    -0x1(%rbx),%r10
lea    -0x3(%rbx),%r13
mov    %r13,0x8(%rsp)
shr    %r13
add    $0x1,%r13
mov    %r10,%rax
and    $0xfffffffffffffffe,%rax
mov    %rax,(%rsp)
mov    %r10,%rax
or     $0x1,%rax
mov    %rax,0x30(%rsp)
mov    %r13,%rax
and    $0xfffffffffffffffe,%rax
mov    %rax,0x28(%rsp)
mov    %rbx,%r8
neg    %r8
xor    %r11d,%r11d
mov    $0x1,%eax
movsd  0xd93(%rip),%xmm0
movapd 0xd7b(%rip),%xmm1
movapd 0xd73(%rip),%xmm2
mov    $0x1,%edx
jmp    12b6 <verifyResultJacobi1D+0x156>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x1,%eax
sub    %r11d,%eax
lea    0x1(%rdx),%ecx
cmp    %r15d,%edx
mov    %ecx,%edx
je     1439 <verifyResultJacobi1D+0x2d9>
mov    %r11d,%ecx
mov    %eax,%r11d
test   %r14d,%r14d
jle    12a0 <verifyResultJacobi1D+0x140>
mov    %ecx,%eax
mov    0x10(%rsp,%rax,8),%rax
mov    %r11d,%ecx
mov    0x10(%rsp,%rcx,8),%rsi
mov    $0x1,%ecx
cmp    $0x2,%r10
jb     13b0 <verifyResultJacobi1D+0x250>
lea    0x8(%rsi),%rdi
lea    (%rax,%r12,8),%rbp
cmp    %rbp,%rdi
jae    12f9 <verifyResultJacobi1D+0x199>
lea    (%rsi,%rbx,8),%rdi
cmp    %rdi,%rax
jb     13b0 <verifyResultJacobi1D+0x250>
cmpq   $0x2,0x8(%rsp)
jae    1306 <verifyResultJacobi1D+0x1a6>
xor    %r9d,%r9d
jmp    1369 <verifyResultJacobi1D+0x209>
mov    0x28(%rsp),%rcx
xor    %r9d,%r9d
xchg   %ax,%ax
movupd (%rax,%r9,8),%xmm3
movupd 0x8(%rax,%r9,8),%xmm4
addpd  %xmm3,%xmm4
movupd 0x10(%rax,%r9,8),%xmm3
addpd  %xmm4,%xmm3
divpd  %xmm2,%xmm3
movupd %xmm3,0x8(%rsi,%r9,8)
movupd 0x10(%rax,%r9,8),%xmm3
movupd 0x18(%rax,%r9,8),%xmm4
addpd  %xmm3,%xmm4
movupd 0x20(%rax,%r9,8),%xmm3
addpd  %xmm4,%xmm3
divpd  %xmm2,%xmm3
movupd %xmm3,0x18(%rsi,%r9,8)
add    $0x4,%r9
add    $0xfffffffffffffffe,%rcx
jne    1310 <verifyResultJacobi1D+0x1b0>
test   $0x1,%r13b
je     139e <verifyResultJacobi1D+0x23e>
lea    0x0(,%r9,8),%rcx
or     $0x8,%rcx
movupd (%rax,%rcx,1),%xmm3
movupd (%rax,%r9,8),%xmm4
addpd  %xmm3,%xmm4
movupd 0x10(%rax,%r9,8),%xmm3
addpd  %xmm4,%xmm3
divpd  %xmm1,%xmm3
movupd %xmm3,(%rsi,%rcx,1)
mov    0x30(%rsp),%rcx
cmp    (%rsp),%r10
je     12a0 <verifyResultJacobi1D+0x140>
nopl   (%rax)
mov    %rcx,%rdi
test   $0x1,%bl
jne    13d6 <verifyResultJacobi1D+0x276>
movsd  -0x8(%rax,%rcx,8),%xmm3
addsd  (%rax,%rcx,8),%xmm3
lea    0x1(%rcx),%rdi
addsd  0x8(%rax,%rcx,8),%xmm3
divsd  %xmm0,%xmm3
movsd  %xmm3,(%rsi,%rcx,8)
not    %rcx
cmp    %r8,%rcx
je     12a0 <verifyResultJacobi1D+0x140>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  -0x8(%rax,%rdi,8),%xmm3
addsd  (%rax,%rdi,8),%xmm3
addsd  0x8(%rax,%rdi,8),%xmm3
divsd  %xmm0,%xmm3
movsd  %xmm3,(%rsi,%rdi,8)
movsd  (%rax,%rdi,8),%xmm3
addsd  0x8(%rax,%rdi,8),%xmm3
addsd  0x10(%rax,%rdi,8),%xmm3
divsd  %xmm0,%xmm3
movsd  %xmm3,0x8(%rsi,%rdi,8)
lea    0x2(%rdi),%rcx
mov    %rcx,%rdi
cmp    %rcx,%rbx
jne    13f0 <verifyResultJacobi1D+0x290>
jmp    12a0 <verifyResultJacobi1D+0x140>
xor    %r11d,%r11d
test   %r14d,%r14d
jle    1466 <verifyResultJacobi1D+0x306>
mov    %r11d,%eax
mov    0x10(%rsp,%rax,8),%rax
movsd  0x8(%rax),%xmm0
mov    0x20(%rsp),%rbp
movsd  0x8(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jne    145d <verifyResultJacobi1D+0x2fd>
jnp    146a <verifyResultJacobi1D+0x30a>
mov    $0x1,%edx
xor    %ebx,%ebx
jmp    14ac <verifyResultJacobi1D+0x34c>
mov    $0x1,%bl
jmp    14c1 <verifyResultJacobi1D+0x361>
mov    %r14d,%ecx
mov    $0x2,%esi
sub    %rbx,%rsi
mov    $0x1,%edx
nopw   0x0(%rax,%rax,1)
lea    (%rsi,%rdx,1),%rdi
cmp    $0x1,%rdi
je     14d3 <verifyResultJacobi1D+0x373>
movsd  0x8(%rax,%rdx,8),%xmm0
movsd  0x8(%rbp,%rdx,8),%xmm1
add    $0x1,%rdx
ucomisd %xmm1,%xmm0
jne    14a2 <verifyResultJacobi1D+0x342>
jnp    1480 <verifyResultJacobi1D+0x320>
lea    -0x1(%rdx),%rax
cmp    %rcx,%rax
setae  %bl
mov    0x2b2d(%rip),%rax
mov    (%rax),%edi
lea    0xb5c(%rip),%rsi
call   1050 <fprintf@plt>
movzbl %bl,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
cmp    %rcx,%rdx
setae  %bl
jmp    14c1 <verifyResultJacobi1D+0x361>
lea    0xb54(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"Could not allocate space array\0A\00"
@stderr = global i32 0
@.str.1 = [30 x i8] c"Position: %d, values: %f, %f\0A\00"
define i32 @verifyResultJacobi1D(double* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca double*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca [2 x double*]
%16 = alloca i32
store double* %0, double** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store i32 1, i32* %9
%17 = load i32, i32* %9
%18 = load i32, i32* %6
%19 = add nsw i32 %17, %18
%20 = sub nsw i32 %19, 1
store i32 %20, i32* %10
store i32 0, i32* %13
store i32 1, i32* %14
store i32 0, i32* %16
%21 = load i32, i32* %6
%22 = add nsw i32 %21, 2
%23 = sext i32 %22 to i64
%24 = mul i64 %23, 8
%25 = trunc i64 %24 to i32
%26 = call i64 @malloc(i32 %25)
%27 = inttoptr i64 %26 to double*
%28 = getelementptr inbounds [2 x double*], [2 x double*]* %15, i64 0, i64 0
store double* %27, double** %28
%29 = load i32, i32* %6
%30 = add nsw i32 %29, 2
%31 = sext i32 %30 to i64
%32 = mul i64 %31, 8
%33 = trunc i64 %32 to i32
%34 = call i64 @malloc(i32 %33)
%35 = inttoptr i64 %34 to double*
%36 = getelementptr inbounds [2 x double*], [2 x double*]* %15, i64 0, i64 1
store double* %35, double** %36
%37 = getelementptr inbounds [2 x double*], [2 x double*]* %15, i64 0, i64 0
%38 = load double*, double** %37
%39 = icmp eq double* %38, null
br i1 %39, label %44, label %40
40: ; preds = %4
%41 = getelementptr inbounds [2 x double*], [2 x double*]* %15, i64 0, i64 1
%42 = load double*, double** %41
%43 = icmp eq double* %42, null
br i1 %43, label %44, label %47
44: ; preds = %40, %4
%45 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%46 = call i32 @exit(i32 -1)
unreachable
47: ; preds = %40
%48 = load i32, i32* %7
%49 = call i32 @srand(i32 %48)
%50 = load i32, i32* %9
store i32 %50, i32* %11
br label %51
51: ; preds = %64, %47
%52 = load i32, i32* %11
%53 = load i32, i32* %10
%54 = icmp sle i32 %52, %53
br i1 %54, label %55, label %67
55: ; preds = %51
%56 = call double (...) @rand()
%57 = call double (...) @rand()
%58 = fdiv double %56, %57
%59 = getelementptr inbounds [2 x double*], [2 x double*]* %15, i64 0, i64 0
%60 = load double*, double** %59
%61 = load i32, i32* %11
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds double, double* %60, i64 %62
store double %58, double* %63
br label %64
64: ; preds = %55
%65 = load i32, i32* %11
%66 = add nsw i32 %65, 1
store i32 %66, i32* %11
br label %51
67: ; preds = %51
%68 = getelementptr inbounds [2 x double*], [2 x double*]* %15, i64 0, i64 0
%69 = load double*, double** %68
%70 = getelementptr inbounds double, double* %69, i64 0
store double 0.000000e+00, double* %70
%71 = getelementptr inbounds [2 x double*], [2 x double*]* %15, i64 0, i64 0
%72 = load double*, double** %71
%73 = load i32, i32* %10
%74 = add nsw i32 %73, 1
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds double, double* %72, i64 %75
store double 0.000000e+00, double* %76
%77 = getelementptr inbounds [2 x double*], [2 x double*]* %15, i64 0, i64 1
%78 = load double*, double** %77
%79 = getelementptr inbounds double, double* %78, i64 0
store double 0.000000e+00, double* %79
%80 = getelementptr inbounds [2 x double*], [2 x double*]* %15, i64 0, i64 1
%81 = load double*, double** %80
%82 = load i32, i32* %10
%83 = add nsw i32 %82, 1
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds double, double* %81, i64 %84
store double 0.000000e+00, double* %85
store i32 1, i32* %12
br label %86
86: ; preds = %140, %67
%87 = load i32, i32* %12
%88 = load i32, i32* %8
%89 = icmp sle i32 %87, %88
br i1 %89, label %90, label %143
90: ; preds = %86
%91 = load i32, i32* %9
store i32 %91, i32* %11
br label %92
92: ; preds = %133, %90
%93 = load i32, i32* %11
%94 = load i32, i32* %10
%95 = icmp sle i32 %93, %94
br i1 %95, label %96, label %136
96: ; preds = %92
%97 = load i32, i32* %13
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds [2 x double*], [2 x double*]* %15, i64 0, i64 %98
%100 = load double*, double** %99
%101 = load i32, i32* %11
%102 = sub nsw i32 %101, 1
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds double, double* %100, i64 %103
%105 = load double, double* %104
%106 = load i32, i32* %13
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds [2 x double*], [2 x double*]* %15, i64 0, i64 %107
%109 = load double*, double** %108
%110 = load i32, i32* %11
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds double, double* %109, i64 %111
%113 = load double, double* %112
%114 = fadd double %105, %113
%115 = load i32, i32* %13
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds [2 x double*], [2 x double*]* %15, i64 0, i64 %116
%118 = load double*, double** %117
%119 = load i32, i32* %11
%120 = add nsw i32 %119, 1
%121 = sext i32 %120 to i64
%122 = getelementptr inbounds double, double* %118, i64 %121
%123 = load double, double* %122
%124 = fadd double %114, %123
%125 = fdiv double %124, 3.000000e+00
%126 = load i32, i32* %14
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds [2 x double*], [2 x double*]* %15, i64 0, i64 %127
%129 = load double*, double** %128
%130 = load i32, i32* %11
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds double, double* %129, i64 %131
store double %125, double* %132
br label %133
133: ; preds = %96
%134 = load i32, i32* %11
%135 = add nsw i32 %134, 1
store i32 %135, i32* %11
br label %92
136: ; preds = %92
%137 = load i32, i32* %14
store i32 %137, i32* %13
%138 = load i32, i32* %14
%139 = sub nsw i32 1, %138
store i32 %139, i32* %14
br label %140
140: ; preds = %136
%141 = load i32, i32* %12
%142 = add nsw i32 %141, 1
store i32 %142, i32* %12
br label %86
143: ; preds = %86
%144 = load i32, i32* %9
store i32 %144, i32* %11
br label %145
145: ; preds = %182, %143
%146 = load i32, i32* %11
%147 = load i32, i32* %10
%148 = icmp sle i32 %146, %147
br i1 %148, label %149, label %185
149: ; preds = %145
%150 = load i32, i32* %13
%151 = sext i32 %150 to i64
%152 = getelementptr inbounds [2 x double*], [2 x double*]* %15, i64 0, i64 %151
%153 = load double*, double** %152
%154 = load i32, i32* %11
%155 = sext i32 %154 to i64
%156 = getelementptr inbounds double, double* %153, i64 %155
%157 = load double, double* %156
%158 = load double*, double** %5
%159 = load i32, i32* %11
%160 = sext i32 %159 to i64
%161 = getelementptr inbounds double, double* %158, i64 %160
%162 = load double, double* %161
%163 = fcmp une double %157, %162
br i1 %163, label %164, label %181
164: ; preds = %149
%165 = load i32, i32* @stderr
%166 = load i32, i32* %11
%167 = load i32, i32* %13
%168 = sext i32 %167 to i64
%169 = getelementptr inbounds [2 x double*], [2 x double*]* %15, i64 0, i64 %168
%170 = load double*, double** %169
%171 = load i32, i32* %11
%172 = sext i32 %171 to i64
%173 = getelementptr inbounds double, double* %170, i64 %172
%174 = load double, double* %173
%175 = load double*, double** %5
%176 = load i32, i32* %11
%177 = sext i32 %176 to i64
%178 = getelementptr inbounds double, double* %175, i64 %177
%179 = load double, double* %178
%180 = call i32 @fprintf(i32 %165, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %166, double %174, double %179)
store i32 1, i32* %16
br label %185
181: ; preds = %149
br label %182
182: ; preds = %181
%183 = load i32, i32* %11
%184 = add nsw i32 %183, 1
store i32 %184, i32* %11
br label %145
185: ; preds = %164, %145
%186 = load i32, i32* %16
%187 = icmp ne i32 %186, 0
%188 = xor i1 %187, true
%189 = zext i1 %188 to i32
ret i32 %189
}

LLVM IR (-O2):
@stderr = global i32 0
@.str.1 = [30 x i8] c"Position: %d, values: %f, %f\0A\00"
@str = [31 x i8] c"Could not allocate space array\00"
define i32 @verifyResultJacobi1D(double* nocapture %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca [2 x double*]
%6 = add i32 %1, 1
%7 = bitcast [2 x double*]* %5 to i8*
%8 = shl i32 %1, 3
%9 = add i32 %8, 16
%10 = tail call i64 @malloc(i32 %9)
%11 = inttoptr i64 %10 to double*
%12 = getelementptr inbounds [2 x double*], [2 x double*]* %5, i64 0, i64 0
store double* %11, double** %12
%13 = tail call i64 @malloc(i32 %9)
%14 = inttoptr i64 %13 to double*
%15 = getelementptr inbounds [2 x double*], [2 x double*]* %5, i64 0, i64 1
store double* %14, double** %15
%16 = icmp eq i64 %10, 0
%17 = icmp eq i64 %13, 0
%18 = select i1 %16, i1 true, i1 %17
br i1 %18, label %19, label %22
19: ; preds = %4
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%21 = tail call i32 @exit(i32 -1)
unreachable
22: ; preds = %4
%23 = tail call i32 @srand(i32 %2)
%24 = icmp slt i32 %1, 1
br i1 %24, label %35, label %25
25: ; preds = %22
%26 = zext i32 %6 to i64
br label %27
27: ; preds = %25, %27
%28 = phi i64 [ 1, %25 ], [ %33, %27 ]
%29 = tail call double (...) @rand()
%30 = tail call double (...) @rand()
%31 = fdiv double %29, %30
%32 = getelementptr inbounds double, double* %11, i64 %28
store double %31, double* %32
%33 = add nuw nsw i64 %28, 1
%34 = icmp eq i64 %33, %26
br i1 %34, label %35, label %27
35: ; preds = %27, %22
store double 0.000000e+00, double* %11
%36 = sext i32 %6 to i64
%37 = getelementptr inbounds double, double* %11, i64 %36
store double 0.000000e+00, double* %37
store double 0.000000e+00, double* %14
%38 = getelementptr inbounds double, double* %14, i64 %36
store double 0.000000e+00, double* %38
%39 = icmp slt i32 %3, 1
br i1 %39, label %155, label %40
40: ; preds = %35
%41 = zext i32 %6 to i64
%42 = add nuw nsw i64 %41, 1
%43 = add nsw i64 %41, -1
%44 = add nsw i64 %41, -3
%45 = lshr i64 %44, 1
%46 = add nuw i64 %45, 1
%47 = icmp ult i64 %43, 2
%48 = and i64 %43, -2
%49 = or i64 %43, 1
%50 = and i64 %46, 1
%51 = icmp ult i64 %44, 2
%52 = and i64 %46, -2
%53 = icmp eq i64 %50, 0
%54 = icmp eq i64 %43, %48
%55 = and i64 %41, 1
%56 = icmp eq i64 %55, 0
%57 = sub nsw i64 0, %41
br label %58
58: ; preds = %40, %194
%59 = phi i32 [ 1, %40 ], [ %195, %194 ]
%60 = phi i32 [ 0, %40 ], [ %59, %194 ]
%61 = phi i32 [ 1, %40 ], [ %196, %194 ]
br i1 %24, label %194, label %62
62: ; preds = %58
%63 = zext i32 %60 to i64
%64 = getelementptr inbounds [2 x double*], [2 x double*]* %5, i64 0, i64 %63
%65 = load double*, double** %64
%66 = zext i32 %59 to i64
%67 = getelementptr inbounds [2 x double*], [2 x double*]* %5, i64 0, i64 %66
%68 = load double*, double** %67
br i1 %47, label %136, label %69
69: ; preds = %62
%70 = getelementptr double, double* %68, i64 1
%71 = getelementptr double, double* %68, i64 %41
%72 = getelementptr double, double* %65, i64 %42
%73 = icmp ult double* %70, %72
%74 = icmp ult double* %65, %71
%75 = and i1 %73, %74
br i1 %75, label %136, label %76
76: ; preds = %69
br i1 %51, label %116, label %77
77: ; preds = %76, %77
%78 = phi i64 [ %113, %77 ], [ 0, %76 ]
%79 = phi i64 [ %114, %77 ], [ 0, %76 ]
%80 = or i64 %78, 1
%81 = getelementptr inbounds double, double* %65, i64 %78
%82 = bitcast double* %81 to <2 x double>*
%83 = load <2 x double>, <2 x double>* %82
%84 = getelementptr inbounds double, double* %65, i64 %80
%85 = bitcast double* %84 to <2 x double>*
%86 = load <2 x double>, <2 x double>* %85
%87 = fadd <2 x double> %83, %86
%88 = or i64 %78, 2
%89 = getelementptr inbounds double, double* %65, i64 %88
%90 = bitcast double* %89 to <2 x double>*
%91 = load <2 x double>, <2 x double>* %90
%92 = fadd <2 x double> %87, %91
%93 = fdiv <2 x double> %92, <double 3.000000e+00, double 3.000000e+00>
%94 = getelementptr inbounds double, double* %68, i64 %80
%95 = bitcast double* %94 to <2 x double>*
store <2 x double> %93, <2 x double>* %95
%96 = or i64 %78, 2
%97 = or i64 %78, 3
%98 = getelementptr inbounds double, double* %65, i64 %96
%99 = bitcast double* %98 to <2 x double>*
%100 = load <2 x double>, <2 x double>* %99
%101 = getelementptr inbounds double, double* %65, i64 %97
%102 = bitcast double* %101 to <2 x double>*
%103 = load <2 x double>, <2 x double>* %102
%104 = fadd <2 x double> %100, %103
%105 = add i64 %78, 4
%106 = getelementptr inbounds double, double* %65, i64 %105
%107 = bitcast double* %106 to <2 x double>*
%108 = load <2 x double>, <2 x double>* %107
%109 = fadd <2 x double> %104, %108
%110 = fdiv <2 x double> %109, <double 3.000000e+00, double 3.000000e+00>
%111 = getelementptr inbounds double, double* %68, i64 %97
%112 = bitcast double* %111 to <2 x double>*
store <2 x double> %110, <2 x double>* %112
%113 = add nuw i64 %78, 4
%114 = add nuw i64 %79, 2
%115 = icmp eq i64 %114, %52
br i1 %115, label %116, label %77
116: ; preds = %77, %76
%117 = phi i64 [ 0, %76 ], [ %113, %77 ]
br i1 %53, label %135, label %118
118: ; preds = %116
%119 = or i64 %117, 1
%120 = getelementptr inbounds double, double* %65, i64 %117
%121 = bitcast double* %120 to <2 x double>*
%122 = load <2 x double>, <2 x double>* %121
%123 = getelementptr inbounds double, double* %65, i64 %119
%124 = bitcast double* %123 to <2 x double>*
%125 = load <2 x double>, <2 x double>* %124
%126 = fadd <2 x double> %122, %125
%127 = add i64 %117, 2
%128 = getelementptr inbounds double, double* %65, i64 %127
%129 = bitcast double* %128 to <2 x double>*
%130 = load <2 x double>, <2 x double>* %129
%131 = fadd <2 x double> %126, %130
%132 = fdiv <2 x double> %131, <double 3.000000e+00, double 3.000000e+00>
%133 = getelementptr inbounds double, double* %68, i64 %119
%134 = bitcast double* %133 to <2 x double>*
store <2 x double> %132, <2 x double>* %134
br label %135
135: ; preds = %116, %118
br i1 %54, label %194, label %136
136: ; preds = %69, %62, %135
%137 = phi i64 [ 1, %69 ], [ 1, %62 ], [ %49, %135 ]
%138 = xor i64 %137, -1
br i1 %56, label %139, label %152
139: ; preds = %136
%140 = add nsw i64 %137, -1
%141 = getelementptr inbounds double, double* %65, i64 %140
%142 = load double, double* %141
%143 = getelementptr inbounds double, double* %65, i64 %137
%144 = load double, double* %143
%145 = fadd double %142, %144
%146 = add nuw nsw i64 %137, 1
%147 = getelementptr inbounds double, double* %65, i64 %146
%148 = load double, double* %147
%149 = fadd double %145, %148
%150 = fdiv double %149, 3.000000e+00
%151 = getelementptr inbounds double, double* %68, i64 %137
store double %150, double* %151
br label %152
152: ; preds = %139, %136
%153 = phi i64 [ %137, %136 ], [ %146, %139 ]
%154 = icmp eq i64 %138, %57
br i1 %154, label %194, label %168
155: ; preds = %194, %35
%156 = phi i32 [ 0, %35 ], [ %59, %194 ]
br i1 %24, label %220, label %157
157: ; preds = %155
%158 = zext i32 %156 to i64
%159 = getelementptr inbounds [2 x double*], [2 x double*]* %5, i64 0, i64 %158
%160 = load double*, double** %159
%161 = zext i32 %1 to i64
%162 = zext i32 %6 to i64
%163 = getelementptr inbounds double, double* %160, i64 1
%164 = load double, double* %163
%165 = getelementptr inbounds double, double* %0, i64 1
%166 = load double, double* %165
%167 = fcmp une double %164, %166
br i1 %167, label %207, label %214
168: ; preds = %152, %168
%169 = phi i64 [ %187, %168 ], [ %153, %152 ]
%170 = add nsw i64 %169, -1
%171 = getelementptr inbounds double, double* %65, i64 %170
%172 = load double, double* %171
%173 = getelementptr inbounds double, double* %65, i64 %169
%174 = load double, double* %173
%175 = fadd double %172, %174
%176 = add nuw nsw i64 %169, 1
%177 = getelementptr inbounds double, double* %65, i64 %176
%178 = load double, double* %177
%179 = fadd double %175, %178
%180 = fdiv double %179, 3.000000e+00
%181 = getelementptr inbounds double, double* %68, i64 %169
store double %180, double* %181
%182 = getelementptr inbounds double, double* %65, i64 %169
%183 = load double, double* %182
%184 = getelementptr inbounds double, double* %65, i64 %176
%185 = load double, double* %184
%186 = fadd double %183, %185
%187 = add nuw nsw i64 %169, 2
%188 = getelementptr inbounds double, double* %65, i64 %187
%189 = load double, double* %188
%190 = fadd double %186, %189
%191 = fdiv double %190, 3.000000e+00
%192 = getelementptr inbounds double, double* %68, i64 %176
store double %191, double* %192
%193 = icmp eq i64 %187, %41
br i1 %193, label %194, label %168
194: ; preds = %152, %168, %135, %58
%195 = sub nsw i32 1, %59
%196 = add nuw i32 %61, 1
%197 = icmp eq i32 %61, %3
br i1 %197, label %155, label %58
198: ; preds = %214
%199 = getelementptr inbounds double, double* %160, i64 %216
%200 = load double, double* %199
%201 = getelementptr inbounds double, double* %0, i64 %216
%202 = load double, double* %201
%203 = fcmp une double %200, %202
br i1 %203, label %204, label %214
204: ; preds = %198
%205 = icmp uge i64 %215, %161
%206 = trunc i64 %216 to i32
br label %207
207: ; preds = %204, %157
%208 = phi i32 [ %206, %204 ], [ 1, %157 ]
%209 = phi i1 [ %205, %204 ], [ false, %157 ]
%210 = phi double [ %200, %204 ], [ %164, %157 ]
%211 = phi double [ %202, %204 ], [ %166, %157 ]
%212 = load i32, i32* @stderr
%213 = tail call i32 @fprintf(i32 %212, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %208, double %210, double %211)
br label %220
214: ; preds = %157, %198
%215 = phi i64 [ %216, %198 ], [ 1, %157 ]
%216 = add nuw nsw i64 %215, 1
%217 = icmp eq i64 %216, %162
br i1 %217, label %218, label %198
218: ; preds = %214
%219 = icmp uge i64 %215, %161
br label %220
220: ; preds = %218, %155, %207
%221 = phi i1 [ %209, %207 ], [ true, %155 ], [ %219, %218 ]
%222 = zext i1 %221 to i32
ret i32 %222
}