#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 abslt(double);
int /*<<< orphan*/ free(double *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
double *jacobi(int rank, double augmentedmatrix[rank][rank + 1],
               double accuracy) {
  double *solutionvectornew = (double *)malloc(rank * sizeof(double));
  double *solutionvectorold = (double *)malloc(rank * sizeof(double));
  int i = 1, j, k = 1, check;
  do
    solutionvectornew[i - 1] = 0;
  while (++i <= rank);
  printf("JACOBI METHOD:\n\n");
  do {
    check = 0;
    i = 1;
    do
      solutionvectorold[i - 1] = solutionvectornew[i - 1];
    while (++i <= rank);
    i = 1;
    printf("%02d\t", k++);
    do {
      solutionvectornew[i - 1] = augmentedmatrix[i - 1][rank];
      j = 1;
      do
        if (i != j)
          solutionvectornew[i - 1] -=
              augmentedmatrix[i - 1][j - 1] * solutionvectorold[j - 1];
      while (++j <= rank);
      solutionvectornew[i - 1] /= augmentedmatrix[i - 1][i - 1];
      check |=
          abslt(solutionvectornew[i - 1] - solutionvectorold[i - 1]) > accuracy;
      printf("%+09g\t", solutionvectornew[i - 1]);
    } while (++i <= rank);
    printf("\n");
  } while (check);
  free(solutionvectorold);
  return solutionvectornew;
}


x86 assembly (clang, -O0):
<jacobi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,%eax
mov    %rax,-0x40(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x20(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x28(%rbp)
movl   $0x1,-0x2c(%rbp)
movl   $0x1,-0x34(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
cmp    -0x4(%rbp),%eax
jle    1194 <jacobi+0x54>
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x38(%rbp)
movl   $0x1,-0x2c(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
cmp    -0x4(%rbp),%eax
jle    11d7 <jacobi+0x97>
movl   $0x1,-0x2c(%rbp)
mov    -0x34(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
lea    0xdeb(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x40(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
imul   %rdx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x1,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x30(%rbp),%eax
je     12e9 <jacobi+0x1a9>
mov    -0x40(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
imul   %rdx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    -0x30(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x30(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x20(%rbp),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
movq   %xmm0,%rdx
movabs $0x8000000000000000,%rsi
xor    %rsi,%rdx
movq   %rdx,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    12ee <jacobi+0x1ae>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
cmp    -0x4(%rbp),%eax
jle    126b <jacobi+0x12b>
mov    -0x40(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
imul   %rdx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x20(%rbp),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
subsd  (%rax,%rcx,8),%xmm0
call   1030 <abslt@plt>
ucomisd -0x18(%rbp),%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
or     -0x38(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xc7d(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
cmp    -0x4(%rbp),%eax
jle    122d <jacobi+0xed>
lea    0xc55(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x0,-0x38(%rbp)
jne    11c9 <jacobi+0x89>
mov    -0x28(%rbp),%rdi
call   1040 <free@plt>
mov    -0x20(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jacobi>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
movsd  %xmm0,0x80(%rsp)
mov    %rsi,0x20(%rsp)
mov    %edi,%r13d
lea    0x1(%r13),%r14d
lea    0x0(,%r13,8),%r15d
mov    %r15d,%edi
call   1090 <malloc@plt>
mov    %rax,%rbx
mov    %r15d,%edi
call   1090 <malloc@plt>
mov    %rax,%r15
cmp    $0x2,%r13d
mov    $0x1,%r12d
mov    $0x1,%ebp
cmovge %r13d,%ebp
lea    0x0(,%rbp,8),%rdx
mov    %rbx,%rdi
xor    %esi,%esi
call   1080 <memset@plt>
movslq %r13d,%rax
mov    %rax,0x70(%rsp)
lea    0xe25(%rip),%rdi
call   1060 <puts@plt>
mov    %rbp,%rsi
lea    0x1(%rbp),%rdi
lea    (%r15,%rbp,8),%rax
lea    (%rbx,%rbp,8),%rcx
lea    -0x4(%rbp),%rdx
mov    %rdx,0x58(%rsp)
shr    $0x2,%rdx
add    $0x1,%rdx
cmp    %rcx,%r15
setb   %cl
cmp    %rax,%rbx
setb   %al
and    %cl,%al
mov    %al,0x3(%rsp)
mov    %esi,%eax
and    $0x7ffffffc,%eax
mov    %rax,0x50(%rsp)
add    $0x1,%rax
mov    %rax,0x48(%rsp)
mov    %edx,%eax
and    $0x3,%eax
and    $0xfffffffffffffffc,%rdx
mov    %rdx,0x28(%rsp)
mov    %esi,%r13d
and    $0x7ffffffe,%r13d
mov    %r15,%rcx
add    $0x10,%rcx
mov    %rcx,0x38(%rsp)
mov    %rbx,%rcx
add    $0x10,%rcx
mov    %rcx,0x30(%rsp)
mov    %rax,0x40(%rsp)
mov    %rax,%rbp
shl    $0x5,%rbp
mov    %r14,0x78(%rsp)
lea    0x0(,%r14,8),%rax
mov    %rax,0x68(%rsp)
mov    %rsi,0x8(%rsp)
mov    %rdi,0x10(%rsp)
mov    %rbp,0x60(%rsp)
jmp    12cd <jacobi+0x15d>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x1c(%rsp),%r12d
add    $0x1,%r12d
mov    $0xa,%edi
call   1050 <putchar@plt>
mov    0x10(%rsp),%rdi
cmpl   $0x0,0x4(%rsp)
mov    0x8(%rsp),%rsi
mov    0x60(%rsp),%rbp
je     1592 <jacobi+0x422>
cmp    $0x4,%esi
setb   %al
or     0x3(%rsp),%al
mov    $0x1,%eax
jne    13af <jacobi+0x23f>
cmpq   $0xc,0x58(%rsp)
jae    12f0 <jacobi+0x180>
xor    %eax,%eax
jmp    1364 <jacobi+0x1f4>
xchg   %ax,%ax
mov    0x28(%rsp),%rcx
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
movups (%rbx,%rax,8),%xmm0
movups 0x10(%rbx,%rax,8),%xmm1
movups %xmm0,(%r15,%rax,8)
movups %xmm1,0x10(%r15,%rax,8)
movups 0x20(%rbx,%rax,8),%xmm0
movups 0x30(%rbx,%rax,8),%xmm1
movups %xmm0,0x20(%r15,%rax,8)
movups %xmm1,0x30(%r15,%rax,8)
movups 0x40(%rbx,%rax,8),%xmm0
movups 0x50(%rbx,%rax,8),%xmm1
movups %xmm0,0x40(%r15,%rax,8)
movups %xmm1,0x50(%r15,%rax,8)
movupd 0x60(%rbx,%rax,8),%xmm0
movupd 0x70(%rbx,%rax,8),%xmm1
movupd %xmm0,0x60(%r15,%rax,8)
movupd %xmm1,0x70(%r15,%rax,8)
add    $0x10,%rax
add    $0xfffffffffffffffc,%rcx
jne    1300 <jacobi+0x190>
cmpq   $0x0,0x40(%rsp)
je     139f <jacobi+0x22f>
mov    0x38(%rsp),%rcx
lea    (%rcx,%rax,8),%rcx
mov    0x30(%rsp),%rdx
lea    (%rdx,%rax,8),%rax
xor    %edx,%edx
movupd -0x10(%rax,%rdx,1),%xmm0
movupd (%rax,%rdx,1),%xmm1
movupd %xmm0,-0x10(%rcx,%rdx,1)
movupd %xmm1,(%rcx,%rdx,1)
add    $0x20,%rdx
cmp    %rdx,%rbp
jne    1380 <jacobi+0x210>
mov    0x48(%rsp),%rax
cmp    0x50(%rsp),%rsi
je     143b <jacobi+0x2cb>
mov    %edi,%edx
sub    %eax,%edx
mov    %rax,%rcx
not    %rcx
add    %rdi,%rcx
and    $0x3,%rdx
je     13e7 <jacobi+0x277>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  -0x8(%rbx,%rax,8),%xmm0
movsd  %xmm0,-0x8(%r15,%rax,8)
add    $0x1,%rax
add    $0xffffffffffffffff,%rdx
jne    13d0 <jacobi+0x260>
cmp    $0x3,%rcx
jb     143b <jacobi+0x2cb>
add    $0xffffffffffffffff,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  (%rbx,%rax,8),%xmm0
movsd  %xmm0,(%r15,%rax,8)
movsd  0x8(%rbx,%rax,8),%xmm0
movsd  %xmm0,0x8(%r15,%rax,8)
movsd  0x10(%rbx,%rax,8),%xmm0
movsd  %xmm0,0x10(%r15,%rax,8)
movsd  0x18(%rbx,%rax,8),%xmm0
movsd  %xmm0,0x18(%r15,%rax,8)
add    $0x4,%rax
cmp    %rax,%rsi
jne    1400 <jacobi+0x290>
xor    %ebp,%ebp
lea    0xbbc(%rip),%rdi
mov    %r12d,0x1c(%rsp)
mov    %r12d,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x10(%rsp),%rdx
mov    $0x1,%r12d
mov    0x20(%rsp),%r14
movl   $0x0,0x4(%rsp)
jmp    14cc <jacobi+0x35c>
nopl   (%rax)
divsd  -0x8(%rax,%r12,8),%xmm0
movsd  %xmm0,-0x8(%rbx,%r12,8)
subsd  -0x8(%r15,%r12,8),%xmm0
call   1030 <abslt@plt>
xor    %eax,%eax
ucomisd 0x80(%rsp),%xmm0
seta   %al
or     %eax,0x4(%rsp)
movsd  -0x8(%rbx,%r12,8),%xmm0
lea    0xb5c(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
add    $0x1,%r12
add    0x68(%rsp),%r14
add    $0xffffffffffffffff,%rbp
mov    0x10(%rsp),%rdx
cmp    %rdx,%r12
je     12a0 <jacobi+0x130>
lea    -0x1(%r12),%rax
imul   0x78(%rsp),%rax
mov    0x20(%rsp),%rcx
lea    (%rcx,%rax,8),%rax
mov    0x70(%rsp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x8(%rbx,%r12,8)
mov    $0x1,%ecx
cmp    $0x2,%edx
jne    1530 <jacobi+0x3c0>
mov    0x8(%rsp),%rdi
test   $0x1,%dil
je     1470 <jacobi+0x300>
cmp    %rcx,%r12
je     1470 <jacobi+0x300>
movsd  -0x8(%rax,%rcx,8),%xmm1
mulsd  -0x8(%r15,%rcx,8),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbx,%r12,8)
jmp    1470 <jacobi+0x300>
xor    %edx,%edx
mov    0x8(%rsp),%rdi
jmp    154d <jacobi+0x3dd>
nopl   0x0(%rax)
add    $0x2,%rcx
add    $0x2,%rdx
cmp    %r13,%rdx
je     1500 <jacobi+0x390>
lea    (%rcx,%rbp,1),%rsi
cmp    $0x1,%rsi
je     1570 <jacobi+0x400>
movsd  -0x8(%r14,%rcx,8),%xmm1
mulsd  -0x8(%r15,%rcx,8),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbx,%r12,8)
lea    0x1(%rcx),%rsi
cmp    %rsi,%r12
je     1540 <jacobi+0x3d0>
movsd  (%r14,%rcx,8),%xmm1
mulsd  (%r15,%rcx,8),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbx,%r12,8)
jmp    1540 <jacobi+0x3d0>
mov    %r15,%rdi
call   1040 <free@plt>
mov    %rbx,%rax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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