#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 check_convergence(double **, double *, double *);
int /*<<< orphan*/ print_vector(double *, int);
int /*<<< orphan*/ printf(char *, ...);
void gauss_seidel() {
  double A[3][3] = {{1.0, 1.0, 2.0}, {2.0, 3.0, 5.0}, {3.0, 3.0, 6.0}};
  double L[3][3] = {{1.0, 0.0, 0.0}, {2.0, 3.0, 0.0}, {3.0, 3.0, 6.0}};
  double L1[3][3] = {{1.0, 0.0, 0.0},
                     {-2.0 / 3.0, 1.0 / 3.0, 0.0},
                     {-1.0 / 6.0, -1.0 / 6.0, 1.0 / 6.0}};
  double U[3][3] = {{0.0, 1.0, 2.0}, {0.0, 0.0, 5.0}, {0.0, 0.0, 0.0}};
  double b[3] = {12.0, 27.0, 36.0};
  double x[3] = {0.0};
  double temp1[3] = {0};
  double temp2[3] = {0};
  double temp3[3] = {0};
  double b_check[3] = {0};
  int check = 0;
  int count = 0;
  int i, j;
  printf("\n----------Question2_Gauss-Seidel : ----------\n\n");
  while ((check == 0) && (count < 250)) {
    for (i = 0; i < 3; i++) {
      temp1[i] = 0.0;
      temp2[i] = 0.0;
      temp3[i] = 0.0;
    }
    for (i = 0; i < 3; i++) {
      for (j = 0; j < 3; j++) {
        temp1[i] = temp1[i] + U[i][j] * x[j];
      }
      temp2[i] = b[i] - temp1[i];
    }
    for (i = 0; i < 3; i++) {
      for (j = 0; j < 3; j++) {
        temp3[i] = temp3[i] + L1[i][j] * temp2[j];
      }
      x[i] = temp3[i];
    }
    count = count + 1;
    check = check_convergence(A, x, b);
  }
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 3; j++) {
      b_check[i] = b_check[i] + A[i][j] * x[j];
    }
  }
  if (count == 250) {
    printf(
        "Gauss-Seidel is failed! (Maximum number of iterations is reached)\n");
  } else {
    printf("Gauss-Seidel Method is converged in %d iterations.\n", count);
    printf("Solution,  x: \n");
    print_vector(x, 3);
  }
  printf("\n----------EndOfGauss_SeidelMethod----------\n\n");
}


x86 assembly (clang, -O0):
<gauss_seidel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
lea    -0x50(%rbp),%rdi
lea    0xeea(%rip),%rsi
mov    $0x48,%edx
call   1060 <memcpy@plt>
lea    -0xa0(%rbp),%rdi
xor    %esi,%esi
mov    $0x48,%edx
call   1050 <memset@plt>
movsd  0xe85(%rip),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  0xe6d(%rip),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  0xe95(%rip),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  0xe88(%rip),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  0xe7b(%rip),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  0xe66(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
lea    -0xf0(%rbp),%rdi
xor    %esi,%esi
mov    $0x48,%edx
call   1050 <memset@plt>
movsd  0xe1e(%rip),%xmm0
movsd  %xmm0,-0xf0(%rbp)
ff
movsd  0xe2e(%rip),%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  0xe16(%rip),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  0xdfe(%rip),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  0xdee(%rip),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  0xdd6(%rip),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
lea    -0x140(%rbp),%rdi
xor    %esi,%esi
mov    $0x48,%edx
call   1050 <memset@plt>
movsd  0xdab(%rip),%xmm0
movsd  %xmm0,-0x138(%rbp)
ff
movsd  0xd93(%rip),%xmm0
movsd  %xmm0,-0x130(%rbp)
ff
movsd  0xd7b(%rip),%xmm0
movsd  %xmm0,-0x118(%rbp)
ff
mov    0xe0c(%rip),%rax
mov    %rax,-0x160(%rbp)
mov    0xe06(%rip),%rax
mov    %rax,-0x158(%rbp)
mov    0xe00(%rip),%rax
mov    %rax,-0x150(%rbp)
lea    -0x180(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1050 <memset@plt>
lea    -0x1a0(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1050 <memset@plt>
lea    -0x1c0(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1050 <memset@plt>
lea    -0x1e0(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1050 <memset@plt>
lea    -0x200(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1050 <memset@plt>
movl   $0x0,-0x204(%rbp)
movl   $0x0,-0x208(%rbp)
lea    0xd87(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
cmpl   $0x0,-0x204(%rbp)
mov    %al,-0x211(%rbp)
jne    1360 <gauss_seidel+0x210>
cmpl   $0xfa,-0x208(%rbp)
setl   %al
mov    %al,-0x211(%rbp)
mov    -0x211(%rbp),%al
test   $0x1,%al
jne    1373 <gauss_seidel+0x223>
jmp    15b6 <gauss_seidel+0x466>
movl   $0x0,-0x20c(%rbp)
cmpl   $0x3,-0x20c(%rbp)
jge    13d7 <gauss_seidel+0x287>
movslq -0x20c(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x1a0(%rbp,%rax,8)
ff ff
movslq -0x20c(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x1c0(%rbp,%rax,8)
ff ff
movslq -0x20c(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x1e0(%rbp,%rax,8)
ff ff
mov    -0x20c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20c(%rbp)
jmp    137d <gauss_seidel+0x22d>
movl   $0x0,-0x20c(%rbp)
cmpl   $0x3,-0x20c(%rbp)
jge    14b6 <gauss_seidel+0x366>
movl   $0x0,-0x210(%rbp)
cmpl   $0x3,-0x210(%rbp)
jge    1472 <gauss_seidel+0x322>
movslq -0x20c(%rbp),%rax
movsd  -0x1a0(%rbp,%rax,8),%xmm1
ff ff
movslq -0x20c(%rbp),%rcx
lea    -0x140(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x210(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movslq -0x210(%rbp),%rax
movsd  -0x180(%rbp,%rax,8),%xmm2
ff ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movslq -0x20c(%rbp),%rax
movsd  %xmm0,-0x1a0(%rbp,%rax,8)
ff ff
mov    -0x210(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x210(%rbp)
jmp    13f8 <gauss_seidel+0x2a8>
movslq -0x20c(%rbp),%rax
movsd  -0x160(%rbp,%rax,8),%xmm0
ff ff
movslq -0x20c(%rbp),%rax
subsd  -0x1a0(%rbp,%rax,8),%xmm0
ff ff
movslq -0x20c(%rbp),%rax
movsd  %xmm0,-0x1c0(%rbp,%rax,8)
ff ff
mov    -0x20c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20c(%rbp)
jmp    13e1 <gauss_seidel+0x291>
movl   $0x0,-0x20c(%rbp)
cmpl   $0x3,-0x20c(%rbp)
jge    1585 <gauss_seidel+0x435>
movl   $0x0,-0x210(%rbp)
cmpl   $0x3,-0x210(%rbp)
jge    1551 <gauss_seidel+0x401>
movslq -0x20c(%rbp),%rax
movsd  -0x1e0(%rbp,%rax,8),%xmm1
ff ff
movslq -0x20c(%rbp),%rcx
lea    -0xf0(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x210(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movslq -0x210(%rbp),%rax
movsd  -0x1c0(%rbp,%rax,8),%xmm2
ff ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movslq -0x20c(%rbp),%rax
movsd  %xmm0,-0x1e0(%rbp,%rax,8)
ff ff
mov    -0x210(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x210(%rbp)
jmp    14d7 <gauss_seidel+0x387>
movslq -0x20c(%rbp),%rax
movsd  -0x1e0(%rbp,%rax,8),%xmm0
ff ff
movslq -0x20c(%rbp),%rax
movsd  %xmm0,-0x180(%rbp,%rax,8)
ff ff
mov    -0x20c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20c(%rbp)
jmp    14c0 <gauss_seidel+0x370>
mov    -0x208(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x208(%rbp)
lea    -0x50(%rbp),%rdi
lea    -0x180(%rbp),%rsi
lea    -0x160(%rbp),%rdx
call   1030 <check_convergence@plt>
mov    %eax,-0x204(%rbp)
jmp    1338 <gauss_seidel+0x1e8>
movl   $0x0,-0x20c(%rbp)
cmpl   $0x3,-0x20c(%rbp)
jge    1667 <gauss_seidel+0x517>
movl   $0x0,-0x210(%rbp)
cmpl   $0x3,-0x210(%rbp)
jge    164e <gauss_seidel+0x4fe>
movslq -0x20c(%rbp),%rax
movsd  -0x200(%rbp,%rax,8),%xmm1
ff ff
movslq -0x20c(%rbp),%rcx
lea    -0x50(%rbp),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
movslq -0x210(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movslq -0x210(%rbp),%rax
movsd  -0x180(%rbp,%rax,8),%xmm2
ff ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movslq -0x20c(%rbp),%rax
movsd  %xmm0,-0x200(%rbp,%rax,8)
ff ff
mov    -0x210(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x210(%rbp)
jmp    15d7 <gauss_seidel+0x487>
jmp    1653 <gauss_seidel+0x503>
mov    -0x20c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20c(%rbp)
jmp    15c0 <gauss_seidel+0x470>
cmpl   $0xfa,-0x208(%rbp)
jne    168a <gauss_seidel+0x53a>
lea    0xa6b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    16bd <gauss_seidel+0x56d>
mov    -0x208(%rbp),%esi
lea    0xa95(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xabb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x180(%rbp),%rdi
mov    $0x3,%esi
call   1070 <print_vector@plt>
lea    0xaac(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gauss_seidel>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    0xf2b(%rip),%rax
mov    %rax,0x90(%rsp)
movaps 0xf0c(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0xeed(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xed1(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xeb5(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
mov    0xf09(%rip),%rax
mov    %rax,0x30(%rsp)
movaps 0xeed(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
lea    0xf2d(%rip),%rdi
call   1030 <puts@plt>
xor    %ebx,%ebx
movsd  0xe42(%rip),%xmm2
movsd  0xe42(%rip),%xmm0
movsd  0xe42(%rip),%xmm1
xorpd  %xmm3,%xmm3
movhpd 0xe4e(%rip),%xmm3
movapd %xmm3,0x40(%rsp)
lea    0x50(%rsp),%r14
mov    %rsp,%r15
lea    0x20(%rsp),%r12
xorpd  %xmm3,%xmm3
xorpd  %xmm4,%xmm4
xorpd  %xmm5,%xmm5
nopl   0x0(%rax)
xorpd  %xmm8,%xmm8
mulsd  %xmm8,%xmm5
addsd  %xmm8,%xmm5
movapd %xmm4,%xmm6
addsd  %xmm5,%xmm6
movapd %xmm3,%xmm7
addsd  %xmm3,%xmm7
addsd  %xmm6,%xmm7
subsd  %xmm7,%xmm2
mulsd  %xmm8,%xmm4
addsd  %xmm5,%xmm4
movapd %xmm3,%xmm5
mulsd  0xddc(%rip),%xmm5
addsd  %xmm4,%xmm5
subsd  %xmm5,%xmm0
mulsd  %xmm8,%xmm3
addsd  %xmm4,%xmm3
subsd  %xmm3,%xmm1
movapd %xmm2,%xmm3
addsd  %xmm8,%xmm3
movapd %xmm2,%xmm4
mulsd  0xdba(%rip),%xmm4
addsd  %xmm8,%xmm4
unpcklpd %xmm4,%xmm3
movapd %xmm0,%xmm4
unpcklpd %xmm0,%xmm4
mulpd  0x40(%rsp),%xmm4
addpd  %xmm3,%xmm4
movapd %xmm1,%xmm3
mulsd  %xmm8,%xmm3
unpcklpd %xmm3,%xmm3
addpd  %xmm4,%xmm3
movapd %xmm3,(%rsp)
movsd  0xd91(%rip),%xmm3
mulsd  %xmm3,%xmm2
addsd  %xmm8,%xmm2
mulsd  %xmm3,%xmm0
addsd  %xmm2,%xmm0
mulsd  0xd80(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1040 <check_convergence@plt>
test   %eax,%eax
jne    1307 <gauss_seidel+0x1c7>
cmp    $0xf8,%ebx
ja     1307 <gauss_seidel+0x1c7>
movsd  (%rsp),%xmm5
movsd  0x8(%rsp),%xmm4
movsd  0x10(%rsp),%xmm3
movsd  0x20(%rsp),%xmm2
movsd  0x28(%rsp),%xmm0
movsd  0x30(%rsp),%xmm1
add    $0x1,%ebx
jmp    1200 <gauss_seidel+0xc0>
cmp    $0xf9,%ebx
jne    131d <gauss_seidel+0x1dd>
lea    0xe33(%rip),%rdi
call   1030 <puts@plt>
jmp    1349 <gauss_seidel+0x209>
add    $0x1,%ebx
lea    0xd81(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xdd5(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rdi
mov    $0x3,%esi
call   1060 <print_vector@plt>
lea    0xdcb(%rip),%rdi
call   1030 <puts@plt>
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.gauss_seidel.A = [3 x [3 x double]] [[3 x double] [double 1.000000e+00, double 1.000000e+00, double 2.000000e+00], [3 x double] [double 2.000000e+00, double 3.000000e+00, double 5.000000e+00], [3 x double] [double 3.000000e+00, double 3.000000e+00, double 6.000000e+00]]
@__const.gauss_seidel.b = [3 x double] [double 1.200000e+01, double 2.700000e+01, double 3.600000e+01]
@.str = [49 x i8] c"\0A----------Question2_Gauss-Seidel : ----------\0A\0A\00"
@.str.1 = [67 x i8] c"Gauss-Seidel is failed! (Maximum number of iterations is reached)\0A\00"
@.str.2 = [52 x i8] c"Gauss-Seidel Method is converged in %d iterations.\0A\00"
@.str.3 = [16 x i8] c"Solution, x: \0A\00"
@.str.4 = [47 x i8] c"\0A----------EndOfGauss_SeidelMethod----------\0A\0A\00"
define void @gauss_seidel() {
%1 = alloca [3 x [3 x double]]
%2 = alloca [3 x [3 x double]]
%3 = alloca [3 x [3 x double]]
%4 = alloca [3 x [3 x double]]
%5 = alloca [3 x double]
%6 = alloca [3 x double]
%7 = alloca [3 x double]
%8 = alloca [3 x double]
%9 = alloca [3 x double]
%10 = alloca [3 x double]
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = bitcast [3 x [3 x double]]* %1 to i8*
%16 = bitcast [3 x [3 x double]]* %2 to i8*
%17 = bitcast i8* %16 to [3 x [3 x double]]*
%18 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %17, i32 0, i32 0
%19 = getelementptr inbounds [3 x double], [3 x double]* %18, i32 0, i32 0
store double 1.000000e+00, double* %19
%20 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %17, i32 0, i32 1
%21 = getelementptr inbounds [3 x double], [3 x double]* %20, i32 0, i32 0
store double 2.000000e+00, double* %21
%22 = getelementptr inbounds [3 x double], [3 x double]* %20, i32 0, i32 1
store double 3.000000e+00, double* %22
%23 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %17, i32 0, i32 2
%24 = getelementptr inbounds [3 x double], [3 x double]* %23, i32 0, i32 0
store double 3.000000e+00, double* %24
%25 = getelementptr inbounds [3 x double], [3 x double]* %23, i32 0, i32 1
store double 3.000000e+00, double* %25
%26 = getelementptr inbounds [3 x double], [3 x double]* %23, i32 0, i32 2
store double 6.000000e+00, double* %26
%27 = bitcast [3 x [3 x double]]* %3 to i8*
%28 = bitcast i8* %27 to [3 x [3 x double]]*
%29 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %28, i32 0, i32 0
%30 = getelementptr inbounds [3 x double], [3 x double]* %29, i32 0, i32 0
store double 1.000000e+00, double* %30
%31 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %28, i32 0, i32 1
%32 = getelementptr inbounds [3 x double], [3 x double]* %31, i32 0, i32 0
store double 0xBFE5555555555555, double* %32
%33 = getelementptr inbounds [3 x double], [3 x double]* %31, i32 0, i32 1
store double 0x3FD5555555555555, double* %33
%34 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %28, i32 0, i32 2
%35 = getelementptr inbounds [3 x double], [3 x double]* %34, i32 0, i32 0
store double 0xBFC5555555555555, double* %35
%36 = getelementptr inbounds [3 x double], [3 x double]* %34, i32 0, i32 1
store double 0xBFC5555555555555, double* %36
%37 = getelementptr inbounds [3 x double], [3 x double]* %34, i32 0, i32 2
store double 0x3FC5555555555555, double* %37
%38 = bitcast [3 x [3 x double]]* %4 to i8*
%39 = bitcast i8* %38 to [3 x [3 x double]]*
%40 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %39, i32 0, i32 0
%41 = getelementptr inbounds [3 x double], [3 x double]* %40, i32 0, i32 1
store double 1.000000e+00, double* %41
%42 = getelementptr inbounds [3 x double], [3 x double]* %40, i32 0, i32 2
store double 2.000000e+00, double* %42
%43 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %39, i32 0, i32 1
%44 = getelementptr inbounds [3 x double], [3 x double]* %43, i32 0, i32 2
store double 5.000000e+00, double* %44
%45 = bitcast [3 x double]* %5 to i8*
%46 = bitcast [3 x double]* %6 to i8*
%47 = bitcast [3 x double]* %7 to i8*
%48 = bitcast [3 x double]* %8 to i8*
%49 = bitcast [3 x double]* %9 to i8*
%50 = bitcast [3 x double]* %10 to i8*
store i32 0, i32* %11
store i32 0, i32* %12
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
br label %52
52: ; preds = %166, %0
%53 = load i32, i32* %11
%54 = icmp eq i32 %53, 0
br i1 %54, label %55, label %58
55: ; preds = %52
%56 = load i32, i32* %12
%57 = icmp slt i32 %56, 250
br label %58
58: ; preds = %55, %52
%59 = phi i1 [ false, %52 ], [ %57, %55 ]
br i1 %59, label %60, label %174
60: ; preds = %58
store i32 0, i32* %13
br label %61
61: ; preds = %74, %60
%62 = load i32, i32* %13
%63 = icmp slt i32 %62, 3
br i1 %63, label %64, label %77
64: ; preds = %61
%65 = load i32, i32* %13
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 %66
store double 0.000000e+00, double* %67
%68 = load i32, i32* %13
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 %69
store double 0.000000e+00, double* %70
%71 = load i32, i32* %13
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 %72
store double 0.000000e+00, double* %73
br label %74
74: ; preds = %64
%75 = load i32, i32* %13
%76 = add nsw i32 %75, 1
store i32 %76, i32* %13
br label %61
77: ; preds = %61
store i32 0, i32* %13
br label %78
78: ; preds = %121, %77
%79 = load i32, i32* %13
%80 = icmp slt i32 %79, 3
br i1 %80, label %81, label %124
81: ; preds = %78
store i32 0, i32* %14
br label %82
82: ; preds = %105, %81
%83 = load i32, i32* %14
%84 = icmp slt i32 %83, 3
br i1 %84, label %85, label %108
85: ; preds = %82
%86 = load i32, i32* %13
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 %87
%89 = load double, double* %88
%90 = load i32, i32* %13
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %4, i64 0, i64 %91
%93 = load i32, i32* %14
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds [3 x double], [3 x double]* %92, i64 0, i64 %94
%96 = load double, double* %95
%97 = load i32, i32* %14
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 %98
%100 = load double, double* %99
%101 = call double @llvm.fmuladd.f64(double %96, double %100, double %89)
%102 = load i32, i32* %13
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 %103
store double %101, double* %104
br label %105
105: ; preds = %85
%106 = load i32, i32* %14
%107 = add nsw i32 %106, 1
store i32 %107, i32* %14
br label %82
108: ; preds = %82
%109 = load i32, i32* %13
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 %110
%112 = load double, double* %111
%113 = load i32, i32* %13
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 %114
%116 = load double, double* %115
%117 = fsub double %112, %116
%118 = load i32, i32* %13
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 %119
store double %117, double* %120
br label %121
121: ; preds = %108
%122 = load i32, i32* %13
%123 = add nsw i32 %122, 1
store i32 %123, i32* %13
br label %78
124: ; preds = %78
store i32 0, i32* %13
br label %125
125: ; preds = %163, %124
%126 = load i32, i32* %13
%127 = icmp slt i32 %126, 3
br i1 %127, label %128, label %166
128: ; preds = %125
store i32 0, i32* %14
br label %129
129: ; preds = %152, %128
%130 = load i32, i32* %14
%131 = icmp slt i32 %130, 3
br i1 %131, label %132, label %155
132: ; preds = %129
%133 = load i32, i32* %13
%134 = sext i32 %133 to i64
%135 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 %134
%136 = load double, double* %135
%137 = load i32, i32* %13
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %3, i64 0, i64 %138
%140 = load i32, i32* %14
%141 = sext i32 %140 to i64
%142 = getelementptr inbounds [3 x double], [3 x double]* %139, i64 0, i64 %141
%143 = load double, double* %142
%144 = load i32, i32* %14
%145 = sext i32 %144 to i64
%146 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 %145
%147 = load double, double* %146
%148 = call double @llvm.fmuladd.f64(double %143, double %147, double %136)
%149 = load i32, i32* %13
%150 = sext i32 %149 to i64
%151 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 %150
store double %148, double* %151
br label %152
152: ; preds = %132
%153 = load i32, i32* %14
%154 = add nsw i32 %153, 1
store i32 %154, i32* %14
br label %129
155: ; preds = %129
%156 = load i32, i32* %13
%157 = sext i32 %156 to i64
%158 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 %157
%159 = load double, double* %158
%160 = load i32, i32* %13
%161 = sext i32 %160 to i64
%162 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 %161
store double %159, double* %162
br label %163
163: ; preds = %155
%164 = load i32, i32* %13
%165 = add nsw i32 %164, 1
store i32 %165, i32* %13
br label %125
166: ; preds = %125
%167 = load i32, i32* %12
%168 = add nsw i32 %167, 1
store i32 %168, i32* %12
%169 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %1, i64 0, i64 0
%170 = bitcast [3 x double]* %169 to double**
%171 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
%172 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
%173 = call i32 @check_convergence(double** %170, double* %171, double* %172)
store i32 %173, i32* %11
br label %52
174: ; preds = %58
store i32 0, i32* %13
br label %175
175: ; preds = %206, %174
%176 = load i32, i32* %13
%177 = icmp slt i32 %176, 3
br i1 %177, label %178, label %209
178: ; preds = %175
store i32 0, i32* %14
br label %179
179: ; preds = %202, %178
%180 = load i32, i32* %14
%181 = icmp slt i32 %180, 3
br i1 %181, label %182, label %205
182: ; preds = %179
%183 = load i32, i32* %13
%184 = sext i32 %183 to i64
%185 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 %184
%186 = load double, double* %185
%187 = load i32, i32* %13
%188 = sext i32 %187 to i64
%189 = getelementptr inbounds [3 x [3 x double]], [3 x [3 x double]]* %1, i64 0, i64 %188
%190 = load i32, i32* %14
%191 = sext i32 %190 to i64
%192 = getelementptr inbounds [3 x double], [3 x double]* %189, i64 0, i64 %191
%193 = load double, double* %192
%194 = load i32, i32* %14
%195 = sext i32 %194 to i64
%196 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 %195
%197 = load double, double* %196
%198 = call double @llvm.fmuladd.f64(double %193, double %197, double %186)
%199 = load i32, i32* %13
%200 = sext i32 %199 to i64
%201 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 %200
store double %198, double* %201
br label %202
202: ; preds = %182
%203 = load i32, i32* %14
%204 = add nsw i32 %203, 1
store i32 %204, i32* %14
br label %179
205: ; preds = %179
br label %206
206: ; preds = %205
%207 = load i32, i32* %13
%208 = add nsw i32 %207, 1
store i32 %208, i32* %13
br label %175
209: ; preds = %175
%210 = load i32, i32* %12
%211 = icmp eq i32 %210, 250
br i1 %211, label %212, label %214
212: ; preds = %209
%213 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.1, i64 0, i64 0))
br label %220
214: ; preds = %209
%215 = load i32, i32* %12
%216 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0), i32 %215)
%217 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%218 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
%219 = call i32 @print_vector(double* %218, i32 3)
br label %220
220: ; preds = %214, %212
%221 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__const.gauss_seidel.A = [3 x [3 x double]] [[3 x double] [double 1.000000e+00, double 1.000000e+00, double 2.000000e+00], [3 x double] [double 2.000000e+00, double 3.000000e+00, double 5.000000e+00], [3 x double] [double 3.000000e+00, double 3.000000e+00, double 6.000000e+00]]
@__const.gauss_seidel.b = [3 x double] [double 1.200000e+01, double 2.700000e+01, double 3.600000e+01]
@.str.2 = [52 x i8] c"Gauss-Seidel Method is converged in %d iterations.\0A\00"
@str = [48 x i8] c"\0A----------Question2_Gauss-Seidel : ----------\0A\00"
@str.5 = [15 x i8] c"Solution, x: \00"
@str.6 = [46 x i8] c"\0A----------EndOfGauss_SeidelMethod----------\0A\00"
@str.7 = [66 x i8] c"Gauss-Seidel is failed! (Maximum number of iterations is reached)\00"
define void @gauss_seidel() {
%1 = alloca [3 x [3 x double]]
%2 = alloca [3 x double]
%3 = alloca [3 x double]
%4 = bitcast [3 x [3 x double]]* %1 to i8*
%5 = bitcast [3 x double]* %2 to i8*
%6 = bitcast [3 x double]* %3 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
%8 = bitcast [3 x [3 x double]]* %1 to double**
%9 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 0
%10 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 0, i64 0
%11 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 1
%12 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 2
%13 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 0, i64 2
%14 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 0, i64 1
%15 = bitcast [3 x double]* %3 to <2 x double>*
br label %16
16: ; preds = %51, %0
%17 = phi double [ 3.600000e+01, %0 ], [ %57, %51 ]
%18 = phi double [ 2.700000e+01, %0 ], [ %56, %51 ]
%19 = phi double [ 1.200000e+01, %0 ], [ %55, %51 ]
%20 = phi double [ 0.000000e+00, %0 ], [ %54, %51 ]
%21 = phi double [ 0.000000e+00, %0 ], [ %53, %51 ]
%22 = phi double [ 0.000000e+00, %0 ], [ %52, %51 ]
%23 = phi i32 [ 0, %0 ], [ %46, %51 ]
%24 = call double @llvm.fmuladd.f64(double %22, double 0.000000e+00, double 0.000000e+00)
%25 = fadd double %21, %24
%26 = call double @llvm.fmuladd.f64(double %20, double 2.000000e+00, double %25)
%27 = fsub double %19, %26
%28 = call double @llvm.fmuladd.f64(double %21, double 0.000000e+00, double %24)
%29 = call double @llvm.fmuladd.f64(double %20, double 5.000000e+00, double %28)
%30 = fsub double %18, %29
%31 = call double @llvm.fmuladd.f64(double %20, double 0.000000e+00, double %28)
%32 = fsub double %17, %31
%33 = fadd double %27, 0.000000e+00
%34 = call double @llvm.fmuladd.f64(double %27, double 0xBFE5555555555555, double 0.000000e+00)
%35 = insertelement <2 x double> poison, double %30, i64 0
%36 = shufflevector <2 x double> %35, <2 x double> poison, <2 x i32> zeroinitializer
%37 = insertelement <2 x double> poison, double %33, i64 0
%38 = insertelement <2 x double> %37, double %34, i64 1
%39 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %36, <2 x double> <double 0.000000e+00, double 0x3FD5555555555555>, <2 x double> %38)
%40 = insertelement <2 x double> poison, double %32, i64 0
%41 = shufflevector <2 x double> %40, <2 x double> poison, <2 x i32> zeroinitializer
%42 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %41, <2 x double> zeroinitializer, <2 x double> %39)
store <2 x double> %42, <2 x double>* %15
%43 = call double @llvm.fmuladd.f64(double %27, double 0xBFC5555555555555, double 0.000000e+00)
%44 = call double @llvm.fmuladd.f64(double %30, double 0xBFC5555555555555, double %43)
%45 = call double @llvm.fmuladd.f64(double %32, double 0x3FC5555555555555, double %44)
store double %45, double* %12
%46 = add nuw nsw i32 %23, 1
%47 = call i32 @check_convergence(double** %8, double* %9, double* %10)
%48 = icmp eq i32 %47, 0
%49 = icmp ult i32 %23, 249
%50 = select i1 %48, i1 %49, i1 false
br i1 %50, label %51, label %58
51: ; preds = %16
%52 = load double, double* %9
%53 = load double, double* %11
%54 = load double, double* %12
%55 = load double, double* %10
%56 = load double, double* %14
%57 = load double, double* %13
br label %16
58: ; preds = %16
%59 = icmp eq i32 %46, 250
br i1 %59, label %60, label %62
60: ; preds = %58
%61 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @str.7, i64 0, i64 0))
br label %66
62: ; preds = %58
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0), i32 %46)
%64 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.5, i64 0, i64 0))
%65 = call i32 @print_vector(double* %9, i32 3)
br label %66
66: ; preds = %62, %60
%67 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.6, i64 0, i64 0))
ret void
}