#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 *gaussseidel(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("GAUSS SEIDEL 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 (j < i)
          solutionvectornew[i - 1] -=
              augmentedmatrix[i - 1][j - 1] * solutionvectornew[j - 1];
        else if (j > i)
          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):
<gaussseidel>:
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 <gaussseidel+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 <gaussseidel+0x97>
movl   $0x1,-0x2c(%rbp)
mov    -0x34(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
lea    0xdf1(%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    -0x30(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    12ee <gaussseidel+0x1ae>
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    -0x20(%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    1371 <gaussseidel+0x231>
mov    -0x30(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jle    136c <gaussseidel+0x22c>
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    1371 <gaussseidel+0x231>
jmp    1376 <gaussseidel+0x236>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
cmp    -0x4(%rbp),%eax
jle    126b <gaussseidel+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    0xbfb(%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 <gaussseidel+0xed>
lea    0xbd3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x0,-0x38(%rbp)
jne    11c9 <gaussseidel+0x89>
mov    -0x28(%rbp),%rdi
call   1040 <free@plt>
mov    -0x20(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gaussseidel>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
movsd  %xmm0,0x70(%rsp)
mov    %rsi,0x68(%rsp)
mov    %edi,%ebp
lea    0x1(%rbp),%eax
mov    %rax,0x60(%rsp)
lea    0x0(,%rbp,8),%r15d
mov    %r15d,%edi
call   1090 <malloc@plt>
mov    %rax,%r12
mov    %r15d,%edi
call   1090 <malloc@plt>
mov    %rax,%r15
cmp    $0x2,%ebp
mov    $0x1,%ebx
mov    $0x1,%r13d
cmovge %ebp,%r13d
lea    0x0(,%r13,8),%rdx
mov    %r12,%rdi
xor    %esi,%esi
call   1080 <memset@plt>
movslq %ebp,%rax
mov    %rax,0x58(%rsp)
lea    0xe29(%rip),%rdi
call   1060 <puts@plt>
lea    0x1(%r13),%rax
mov    %rax,0x10(%rsp)
lea    (%r15,%r13,8),%rax
lea    (%r12,%r13,8),%rcx
lea    -0x4(%r13),%rdx
mov    %rdx,0x48(%rsp)
shr    $0x2,%rdx
add    $0x1,%rdx
cmp    %rcx,%r15
setb   %cl
cmp    %rax,%r12
setb   %al
and    %cl,%al
mov    %al,0xb(%rsp)
mov    %r13d,%eax
and    $0x7ffffffc,%eax
mov    %rax,0x40(%rsp)
add    $0x1,%rax
mov    %rax,0x38(%rsp)
mov    %edx,%eax
and    $0x3,%eax
and    $0xfffffffffffffffc,%rdx
mov    %rdx,0x18(%rsp)
lea    0x10(%r15),%rcx
mov    %rcx,0x28(%rsp)
mov    %r12,%rcx
add    $0x10,%rcx
mov    %rcx,0x20(%rsp)
mov    %rax,0x30(%rsp)
mov    %rax,%rdi
shl    $0x5,%rdi
mov    %rdi,0x50(%rsp)
jmp    128f <gaussseidel+0x11f>
nopl   0x0(%rax)
mov    0xc(%rsp),%ebx
add    $0x1,%ebx
mov    $0xa,%edi
call   1050 <putchar@plt>
test   %r14d,%r14d
mov    0x50(%rsp),%rdi
je     1504 <gaussseidel+0x394>
cmp    $0x4,%r13d
setb   %al
or     0xb(%rsp),%al
mov    $0x1,%eax
jne    138f <gaussseidel+0x21f>
cmpq   $0xc,0x48(%rsp)
jae    12c0 <gaussseidel+0x150>
xor    %eax,%eax
jmp    133c <gaussseidel+0x1cc>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x18(%rsp),%rcx
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
movups (%r12,%rax,8),%xmm0
movups 0x10(%r12,%rax,8),%xmm1
movups %xmm0,(%r15,%rax,8)
movups %xmm1,0x10(%r15,%rax,8)
movups 0x20(%r12,%rax,8),%xmm0
movups 0x30(%r12,%rax,8),%xmm1
movups %xmm0,0x20(%r15,%rax,8)
movups %xmm1,0x30(%r15,%rax,8)
movups 0x40(%r12,%rax,8),%xmm0
movups 0x50(%r12,%rax,8),%xmm1
movups %xmm0,0x40(%r15,%rax,8)
movups %xmm1,0x50(%r15,%rax,8)
movupd 0x60(%r12,%rax,8),%xmm0
movupd 0x70(%r12,%rax,8),%xmm1
movupd %xmm0,0x60(%r15,%rax,8)
movupd %xmm1,0x70(%r15,%rax,8)
add    $0x10,%rax
add    $0xfffffffffffffffc,%rcx
jne    12d0 <gaussseidel+0x160>
cmpq   $0x0,0x30(%rsp)
je     137f <gaussseidel+0x20f>
mov    0x28(%rsp),%rcx
lea    (%rcx,%rax,8),%rcx
mov    0x20(%rsp),%rdx
lea    (%rdx,%rax,8),%rax
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
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,%rdi
jne    1360 <gaussseidel+0x1f0>
mov    0x38(%rsp),%rax
cmp    0x40(%rsp),%r13
je     141f <gaussseidel+0x2af>
mov    0x10(%rsp),%rsi
mov    %esi,%edx
sub    %eax,%edx
mov    %rax,%rcx
not    %rcx
add    %rsi,%rcx
and    $0x3,%rdx
je     13c8 <gaussseidel+0x258>
nopw   0x0(%rax,%rax,1)
movsd  -0x8(%r12,%rax,8),%xmm0
movsd  %xmm0,-0x8(%r15,%rax,8)
add    $0x1,%rax
add    $0xffffffffffffffff,%rdx
jne    13b0 <gaussseidel+0x240>
cmp    $0x3,%rcx
jb     141f <gaussseidel+0x2af>
add    $0xffffffffffffffff,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%r12,%rax,8),%xmm0
movsd  %xmm0,(%r15,%rax,8)
movsd  0x8(%r12,%rax,8),%xmm0
movsd  %xmm0,0x8(%r15,%rax,8)
movsd  0x10(%r12,%rax,8),%xmm0
movsd  %xmm0,0x10(%r15,%rax,8)
movsd  0x18(%r12,%rax,8),%xmm0
movsd  %xmm0,0x18(%r15,%rax,8)
add    $0x4,%rax
cmp    %rax,%r13
jne    13e0 <gaussseidel+0x270>
xor    %r14d,%r14d
lea    0xbd7(%rip),%rdi
mov    %ebx,0xc(%rsp)
mov    %ebx,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%ebp
jmp    148b <gaussseidel+0x31b>
nopl   (%rax)
divsd  -0x8(%rax,%rbp,8),%xmm0
movsd  %xmm0,-0x8(%r12,%rbp,8)
subsd  -0x8(%r15,%rbp,8),%xmm0
call   1030 <abslt@plt>
xor    %eax,%eax
ucomisd 0x70(%rsp),%xmm0
seta   %al
or     %eax,%r14d
movsd  -0x8(%r12,%rbp,8),%xmm0
lea    0xb91(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
add    $0x1,%rbp
cmp    0x10(%rsp),%rbp
je     1270 <gaussseidel+0x100>
lea    -0x1(%rbp),%rax
imul   0x60(%rsp),%rax
mov    0x68(%rsp),%rcx
lea    (%rcx,%rax,8),%rax
mov    0x58(%rsp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x8(%r12,%rbp,8)
mov    %r12,%rcx
xor    %edx,%edx
mov    $0x1,%esi
jmp    14e5 <gaussseidel+0x375>
nopl   0x0(%rax,%rax,1)
movsd  (%rax,%rdi,8),%xmm1
mulsd  (%rbx),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%r12,%rbp,8)
add    $0x1,%rsi
add    $0x8,%rcx
cmp    %rdx,%r13
je     1440 <gaussseidel+0x2d0>
mov    %rdx,%rdi
add    $0x1,%rdx
mov    %rcx,%rbx
cmp    %rbp,%rdx
jb     14c0 <gaussseidel+0x350>
jbe    14d4 <gaussseidel+0x364>
lea    -0x1(%rsi),%rdi
lea    (%r15,%rsi,8),%rbx
add    $0xfffffffffffffff8,%rbx
jmp    14c0 <gaussseidel+0x350>
mov    %r15,%rdi
call   1040 <free@plt>
mov    %r12,%rax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"GAUSS SEIDEL 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* @gaussseidel(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 ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %43
43: ; preds = %200, %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 = %193, %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 = %143, %65
%82 = load i32, i32* %10
%83 = load i32, i32* %9
%84 = icmp slt 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** %7
%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 %142
111: ; preds = %81
%112 = load i32, i32* %10
%113 = load i32, i32* %9
%114 = icmp sgt i32 %112, %113
br i1 %114, label %115, label %141
115: ; preds = %111
%116 = load double*, double** %5
%117 = load i32, i32* %9
%118 = sub nsw i32 %117, 1
%119 = sext i32 %118 to i64
%120 = mul nsw i64 %119, %17
%121 = getelementptr inbounds double, double* %116, i64 %120
%122 = load i32, i32* %10
%123 = sub nsw i32 %122, 1
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds double, double* %121, i64 %124
%126 = load double, double* %125
%127 = load double*, double** %8
%128 = load i32, i32* %10
%129 = sub nsw i32 %128, 1
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds double, double* %127, i64 %130
%132 = load double, double* %131
%133 = load double*, double** %7
%134 = load i32, i32* %9
%135 = sub nsw i32 %134, 1
%136 = sext i32 %135 to i64
%137 = getelementptr inbounds double, double* %133, i64 %136
%138 = load double, double* %137
%139 = fneg double %126
%140 = call double @llvm.fmuladd.f64(double %139, double %132, double %138)
store double %140, double* %137
br label %141
141: ; preds = %115, %111
br label %142
142: ; preds = %141, %85
br label %143
143: ; preds = %142
%144 = load i32, i32* %10
%145 = add nsw i32 %144, 1
store i32 %145, i32* %10
%146 = load i32, i32* %4
%147 = icmp sle i32 %145, %146
br i1 %147, label %81, label %148
148: ; preds = %143
%149 = load double*, double** %5
%150 = load i32, i32* %9
%151 = sub nsw i32 %150, 1
%152 = sext i32 %151 to i64
%153 = mul nsw i64 %152, %17
%154 = getelementptr inbounds double, double* %149, i64 %153
%155 = load i32, i32* %9
%156 = sub nsw i32 %155, 1
%157 = sext i32 %156 to i64
%158 = getelementptr inbounds double, double* %154, i64 %157
%159 = load double, double* %158
%160 = load double*, double** %7
%161 = load i32, i32* %9
%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 = fdiv double %165, %159
store double %166, double* %164
%167 = load double*, double** %7
%168 = load i32, i32* %9
%169 = sub nsw i32 %168, 1
%170 = sext i32 %169 to i64
%171 = getelementptr inbounds double, double* %167, i64 %170
%172 = load double, double* %171
%173 = load double*, double** %8
%174 = load i32, i32* %9
%175 = sub nsw i32 %174, 1
%176 = sext i32 %175 to i64
%177 = getelementptr inbounds double, double* %173, i64 %176
%178 = load double, double* %177
%179 = fsub double %172, %178
%180 = call double @abslt(double %179)
%181 = load double, double* %6
%182 = fcmp ogt double %180, %181
%183 = zext i1 %182 to i32
%184 = load i32, i32* %12
%185 = or i32 %184, %183
store i32 %185, i32* %12
%186 = load double*, double** %7
%187 = load i32, i32* %9
%188 = sub nsw i32 %187, 1
%189 = sext i32 %188 to i64
%190 = getelementptr inbounds double, double* %186, i64 %189
%191 = load double, double* %190
%192 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %191)
br label %193
193: ; preds = %148
%194 = load i32, i32* %9
%195 = add nsw i32 %194, 1
store i32 %195, i32* %9
%196 = load i32, i32* %4
%197 = icmp sle i32 %195, %196
br i1 %197, label %65, label %198
198: ; preds = %193
%199 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %200
200: ; preds = %198
%201 = load i32, i32* %12
%202 = icmp ne i32 %201, 0
br i1 %202, label %43, label %203
203: ; preds = %200
%204 = load double*, double** %8
%205 = call i32 @free(double* %204)
%206 = load double*, double** %7
ret double* %206
}

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