void jacobi(int n, double dx, double omega, double **u, double **f, double tol,
            int maxit) {
  int i, j, k;
  double error, resid, h2;
  double **uold;
  uold = dalloc_matrix(n, n);
  h2 = (dx * dx);
  error = 10.0 * tol;
  k = 1;
  while (k <= maxit && error > tol) {
#pragma omp parallel for private(i, j) collapse(2)
    for (i = 0; i < n; i++)
      for (j = 0; j < n; j++)
        (uold[i][j]) = (u[i][j]);
#pragma omp parallel for reduction(+ : error) private(i, j, resid) collapse(2)
    for (i = 1; i < n - 1; i++) {
      for (j = 1; j < n - 1; j++) {
        (u[i][j]) = (1.0 - omega) * (u[i][j]) +
                    omega *
                        ((u[i - 1][j]) + (u[i + 1][j]) + (u[i][j - 1]) +
                         (u[i][j + 1]) + h2 * (f[i][j])) /
                        4.0;
        resid = (u[i][j]) - (uold[i][j]);
        error += resid * resid;
      }
    }
    k++;
    error = sqrt(error);
  }
  printf("Numero total de iteracoes:  %d\n", k);
  printf("Error                  : %10.15f\n", error);
  dfree_matrix(uold, n);
}


x86 assembly (clang, -O0):
<jacobi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
movsd  %xmm2,-0x30(%rbp)
mov    %ecx,-0x34(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    $0x0,%al
call   1040 <dalloc_matrix@plt>
cltq
mov    %rax,-0x60(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xe71(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movl   $0x1,-0x40(%rbp)
mov    -0x40(%rbp),%ecx
xor    %eax,%eax
cmp    -0x34(%rbp),%ecx
mov    %al,-0x61(%rbp)
jg     11c1 <jacobi+0x81>
movsd  -0x48(%rbp),%xmm0
ucomisd -0x30(%rbp),%xmm0
seta   %al
mov    %al,-0x61(%rbp)
mov    -0x61(%rbp),%al
test   $0x1,%al
jne    11d1 <jacobi+0x91>
jmp    13d9 <jacobi+0x299>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1242 <jacobi+0x102>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    122f <jacobi+0xef>
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x60(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x3c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11eb <jacobi+0xab>
jmp    1234 <jacobi+0xf4>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11d8 <jacobi+0x98>
movl   $0x1,-0x38(%rbp)
mov    -0x38(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    13bc <jacobi+0x27c>
movl   $0x1,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    13a9 <jacobi+0x269>
movsd  0xd96(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x18(%rbp),%xmm1
mov    -0x20(%rbp),%rax
mov    -0x38(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm4
mov    -0x20(%rbp),%rax
mov    -0x38(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x3c(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm4
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm4
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x3c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm4
movsd  -0x58(%rbp),%xmm3
mov    -0x28(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm5
mulsd  %xmm5,%xmm3
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm1
movsd  0xcd9(%rip),%xmm3
divsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x3c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x60(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x3c(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1261 <jacobi+0x121>
jmp    13ae <jacobi+0x26e>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1249 <jacobi+0x109>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
movsd  -0x48(%rbp),%xmm0
call   1060 <sqrt@plt>
movsd  %xmm0,-0x48(%rbp)
jmp    11a0 <jacobi+0x60>
mov    -0x40(%rbp),%esi
lea    0xc35(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  -0x48(%rbp),%xmm0
lea    0xc42(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x60(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    $0x0,%al
call   1050 <dfree_matrix@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jacobi>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %ecx,%ebx
movsd  %xmm2,0x30(%rsp)
mov    %rdx,0x28(%rsp)
mov    %rsi,%r12
movsd  %xmm1,0x20(%rsp)
movsd  %xmm0,0x10(%rsp)
mov    %rdi,0x8(%rsp)
mov    %edi,%esi
xor    %eax,%eax
call   1040 <dalloc_matrix@plt>
movsd  0x30(%rsp),%xmm8
movslq %eax,%r9
movsd  0xe76(%rip),%xmm4
mulsd  %xmm8,%xmm4
mov    $0x1,%esi
mov    %ebx,0x1c(%rsp)
test   %ebx,%ebx
jle    1520 <jacobi+0x3e0>
ucomisd %xmm8,%xmm4
jbe    1520 <jacobi+0x3e0>
movsd  0x10(%rsp),%xmm9
mulsd  %xmm9,%xmm9
mov    0x8(%rsp),%r8
lea    -0x1(%r8),%r11d
movsd  0xe40(%rip),%xmm5
movsd  0x20(%rsp),%xmm6
subsd  %xmm6,%xmm5
mov    %r8d,%r15d
mov    %r15d,%ebx
and    $0xfffffffc,%ebx
lea    -0x4(%rbx),%rax
mov    %rax,0x60(%rsp)
shr    $0x2,%rax
add    $0x1,%rax
mov    %eax,%r13d
and    $0x3,%r13d
and    $0xfffffffffffffffc,%rax
mov    %rax,0x50(%rsp)
mov    %r15d,%ebp
and    $0x3,%ebp
mov    %r13,0x58(%rsp)
shl    $0x5,%r13
lea    -0x8(,%r11,8),%r14
ff
mov    $0x1,%eax
movsd  0xdf0(%rip),%xmm7
xorpd  %xmm10,%xmm10
mov    0x28(%rsp),%r10
mov    %rbp,(%rsp)
movsd  %xmm9,0x10(%rsp)
movsd  %xmm5,0x40(%rsp)
mov    %rbx,0x48(%rsp)
mov    %rax,0x38(%rsp)
test   %r8d,%r8d
jle    13f0 <jacobi+0x2b0>
xor    %eax,%eax
jmp    126d <jacobi+0x12d>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%rax
cmp    %r15,%rax
je     13f0 <jacobi+0x2b0>
mov    (%r12,%rax,8),%rcx
mov    (%r9,%rax,8),%rdx
cmp    $0x4,%r8d
jb     1291 <jacobi+0x151>
lea    (%rcx,%r15,8),%rsi
cmp    %rsi,%rdx
jae    1310 <jacobi+0x1d0>
lea    (%rdx,%r15,8),%rsi
cmp    %rsi,%rcx
jae    1310 <jacobi+0x1d0>
xor    %esi,%esi
mov    %rsi,%rdi
not    %rdi
add    %r15,%rdi
test   %rbp,%rbp
je     12c4 <jacobi+0x184>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  (%rcx,%rsi,8),%xmm0
movsd  %xmm0,(%rdx,%rsi,8)
add    $0x1,%rsi
add    $0xffffffffffffffff,%rbp
jne    12b0 <jacobi+0x170>
cmp    $0x3,%rdi
mov    (%rsp),%rbp
jb     1260 <jacobi+0x120>
xchg   %ax,%ax
movsd  (%rcx,%rsi,8),%xmm0
movsd  %xmm0,(%rdx,%rsi,8)
movsd  0x8(%rcx,%rsi,8),%xmm0
movsd  %xmm0,0x8(%rdx,%rsi,8)
movsd  0x10(%rcx,%rsi,8),%xmm0
movsd  %xmm0,0x10(%rdx,%rsi,8)
movsd  0x18(%rcx,%rsi,8),%xmm0
movsd  %xmm0,0x18(%rdx,%rsi,8)
add    $0x4,%rsi
cmp    %rsi,%r15
jne    12d0 <jacobi+0x190>
jmp    1260 <jacobi+0x120>
nopl   0x0(%rax)
cmpq   $0xc,0x60(%rsp)
jae    131c <jacobi+0x1dc>
xor    %esi,%esi
jmp    138c <jacobi+0x24c>
mov    0x50(%rsp),%rdi
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movups (%rcx,%rsi,8),%xmm0
movups 0x10(%rcx,%rsi,8),%xmm1
movups %xmm0,(%rdx,%rsi,8)
movups %xmm1,0x10(%rdx,%rsi,8)
movups 0x20(%rcx,%rsi,8),%xmm0
movups 0x30(%rcx,%rsi,8),%xmm1
movups %xmm0,0x20(%rdx,%rsi,8)
movups %xmm1,0x30(%rdx,%rsi,8)
movups 0x40(%rcx,%rsi,8),%xmm0
movups 0x50(%rcx,%rsi,8),%xmm1
movups %xmm0,0x40(%rdx,%rsi,8)
movups %xmm1,0x50(%rdx,%rsi,8)
movupd 0x60(%rcx,%rsi,8),%xmm0
movupd 0x70(%rcx,%rsi,8),%xmm1
movupd %xmm0,0x60(%rdx,%rsi,8)
movupd %xmm1,0x70(%rdx,%rsi,8)
add    $0x10,%rsi
add    $0xfffffffffffffffc,%rdi
jne    1330 <jacobi+0x1f0>
cmpq   $0x0,0x58(%rsp)
je     13cf <jacobi+0x28f>
lea    (%rdx,%rsi,8),%rdi
add    $0x10,%rdi
lea    (%rcx,%rsi,8),%rsi
add    $0x10,%rsi
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
movupd -0x10(%rsi,%rbp,1),%xmm0
movupd (%rsi,%rbp,1),%xmm1
movupd %xmm0,-0x10(%rdi,%rbp,1)
movupd %xmm1,(%rdi,%rbp,1)
add    $0x20,%rbp
cmp    %rbp,%r13
jne    13b0 <jacobi+0x270>
mov    %rbx,%rsi
cmp    %r15,%rbx
mov    (%rsp),%rbp
je     1260 <jacobi+0x120>
jmp    1293 <jacobi+0x153>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    $0x3,%r8d
jl     1497 <jacobi+0x357>
mov    $0x1,%eax
nop
mov    -0x8(%r12,%rax,8),%rcx
mov    (%r12,%rax,8),%rdx
mov    0x8(%r12,%rax,8),%rsi
mov    (%r10,%rax,8),%rdi
mov    (%r9,%rax,8),%rbx
add    $0x1,%rax
movsd  (%rdx),%xmm0
movsd  0x8(%rdx),%xmm1
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mulsd  %xmm5,%xmm1
movsd  0x8(%rcx,%rbp,1),%xmm2
addsd  0x8(%rsi,%rbp,1),%xmm2
addsd  %xmm0,%xmm2
movsd  0x10(%rdx,%rbp,1),%xmm3
addsd  %xmm3,%xmm2
movsd  0x8(%rdi,%rbp,1),%xmm0
mulsd  %xmm9,%xmm0
addsd  %xmm2,%xmm0
mulsd  %xmm6,%xmm0
mulsd  %xmm7,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rdx,%rbp,1)
movapd %xmm0,%xmm1
subsd  0x8(%rbx,%rbp,1),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm1,%xmm4
add    $0x8,%rbp
movapd %xmm3,%xmm1
cmp    %rbp,%r14
jne    1430 <jacobi+0x2f0>
cmp    %r11,%rax
jne    1400 <jacobi+0x2c0>
ucomisd %xmm10,%xmm4
jb     14b0 <jacobi+0x370>
sqrtsd %xmm4,%xmm4
jmp    14fa <jacobi+0x3ba>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movapd %xmm4,%xmm0
mov    %r9,%rbx
mov    %r11,%rbp
call   1060 <sqrt@plt>
xorpd  %xmm10,%xmm10
movsd  0xb44(%rip),%xmm7
movsd  0x40(%rsp),%xmm5
mov    %rbp,%r11
movsd  0x10(%rsp),%xmm9
movsd  0x20(%rsp),%xmm6
mov    0x28(%rsp),%r10
movsd  0x30(%rsp),%xmm8
mov    %rbx,%r9
mov    0x8(%rsp),%r8
movapd %xmm0,%xmm4
mov    0x38(%rsp),%rax
lea    0x1(%rax),%esi
cmp    0x1c(%rsp),%eax
mov    0x48(%rsp),%rbx
mov    (%rsp),%rbp
jge    1525 <jacobi+0x3e5>
ucomisd %xmm8,%xmm4
mov    %esi,%eax
ja     1240 <jacobi+0x100>
jmp    1525 <jacobi+0x3e5>
mov    0x8(%rsp),%r8
movsd  %xmm4,(%rsp)
lea    0xae7(%rip),%rdi
xor    %eax,%eax
mov    %r8,%rbx
mov    %r9,%rbp
call   1030 <printf@plt>
lea    0xaf3(%rip),%rdi
movsd  (%rsp),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    %ebx,%esi
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <dfree_matrix@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"Numero total de iteracoes: %d\0A\00"
@.str.1 = [34 x i8] c"Error : %10.15f\0A\00"
define void @jacobi(i32 %0, double %1, double %2, double** %3, double** %4, double %5, i32 %6) {
%8 = alloca i32
%9 = alloca double
%10 = alloca double
%11 = alloca double**
%12 = alloca double**
%13 = alloca double
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double**
store i32 %0, i32* %8
store double %1, double* %9
store double %2, double* %10
store double** %3, double*** %11
store double** %4, double*** %12
store double %5, double* %13
store i32 %6, i32* %14
%22 = load i32, i32* %8
%23 = load i32, i32* %8
%24 = call i32 (i32, i32, ...) bitcast (i32 (...)* @dalloc_matrix to i32 (i32, i32, ...)*)(i32 %22, i32 %23)
%25 = sext i32 %24 to i64
%26 = inttoptr i64 %25 to double**
store double** %26, double*** %21
%27 = load double, double* %9
%28 = load double, double* %9
%29 = fmul double %27, %28
store double %29, double* %20
%30 = load double, double* %13
%31 = fmul double 1.000000e+01, %30
store double %31, double* %18
store i32 1, i32* %17
br label %32
32: ; preds = %197, %7
%33 = load i32, i32* %17
%34 = load i32, i32* %14
%35 = icmp sle i32 %33, %34
br i1 %35, label %36, label %40
36: ; preds = %32
%37 = load double, double* %18
%38 = load double, double* %13
%39 = fcmp ogt double %37, %38
br label %40
40: ; preds = %36, %32
%41 = phi i1 [ false, %32 ], [ %39, %36 ]
br i1 %41, label %42, label %202
42: ; preds = %40
store i32 0, i32* %15
br label %43
43: ; preds = %74, %42
%44 = load i32, i32* %15
%45 = load i32, i32* %8
%46 = icmp slt i32 %44, %45
br i1 %46, label %47, label %77
47: ; preds = %43
store i32 0, i32* %16
br label %48
48: ; preds = %70, %47
%49 = load i32, i32* %16
%50 = load i32, i32* %8
%51 = icmp slt i32 %49, %50
br i1 %51, label %52, label %73
52: ; preds = %48
%53 = load double**, double*** %11
%54 = load i32, i32* %15
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds double*, double** %53, i64 %55
%57 = load double*, double** %56
%58 = load i32, i32* %16
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds double, double* %57, i64 %59
%61 = load double, double* %60
%62 = load double**, double*** %21
%63 = load i32, i32* %15
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds double*, double** %62, i64 %64
%66 = load double*, double** %65
%67 = load i32, i32* %16
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds double, double* %66, i64 %68
store double %61, double* %69
br label %70
70: ; preds = %52
%71 = load i32, i32* %16
%72 = add nsw i32 %71, 1
store i32 %72, i32* %16
br label %48
73: ; preds = %48
br label %74
74: ; preds = %73
%75 = load i32, i32* %15
%76 = add nsw i32 %75, 1
store i32 %76, i32* %15
br label %43
77: ; preds = %43
store i32 1, i32* %15
br label %78
78: ; preds = %194, %77
%79 = load i32, i32* %15
%80 = load i32, i32* %8
%81 = sub nsw i32 %80, 1
%82 = icmp slt i32 %79, %81
br i1 %82, label %83, label %197
83: ; preds = %78
store i32 1, i32* %16
br label %84
84: ; preds = %190, %83
%85 = load i32, i32* %16
%86 = load i32, i32* %8
%87 = sub nsw i32 %86, 1
%88 = icmp slt i32 %85, %87
br i1 %88, label %89, label %193
89: ; preds = %84
%90 = load double, double* %10
%91 = fsub double 1.000000e+00, %90
%92 = load double**, double*** %11
%93 = load i32, i32* %15
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds double*, double** %92, i64 %94
%96 = load double*, double** %95
%97 = load i32, i32* %16
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds double, double* %96, i64 %98
%100 = load double, double* %99
%101 = load double, double* %10
%102 = load double**, double*** %11
%103 = load i32, i32* %15
%104 = sub nsw i32 %103, 1
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds double*, double** %102, i64 %105
%107 = load double*, double** %106
%108 = load i32, i32* %16
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds double, double* %107, i64 %109
%111 = load double, double* %110
%112 = load double**, double*** %11
%113 = load i32, i32* %15
%114 = add nsw i32 %113, 1
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds double*, double** %112, i64 %115
%117 = load double*, double** %116
%118 = load i32, i32* %16
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds double, double* %117, i64 %119
%121 = load double, double* %120
%122 = fadd double %111, %121
%123 = load double**, double*** %11
%124 = load i32, i32* %15
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds double*, double** %123, i64 %125
%127 = load double*, double** %126
%128 = load i32, i32* %16
%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 = fadd double %122, %132
%134 = load double**, double*** %11
%135 = load i32, i32* %15
%136 = sext i32 %135 to i64
%137 = getelementptr inbounds double*, double** %134, i64 %136
%138 = load double*, double** %137
%139 = load i32, i32* %16
%140 = add nsw i32 %139, 1
%141 = sext i32 %140 to i64
%142 = getelementptr inbounds double, double* %138, i64 %141
%143 = load double, double* %142
%144 = fadd double %133, %143
%145 = load double, double* %20
%146 = load double**, double*** %12
%147 = load i32, i32* %15
%148 = sext i32 %147 to i64
%149 = getelementptr inbounds double*, double** %146, i64 %148
%150 = load double*, double** %149
%151 = load i32, i32* %16
%152 = sext i32 %151 to i64
%153 = getelementptr inbounds double, double* %150, i64 %152
%154 = load double, double* %153
%155 = call double @llvm.fmuladd.f64(double %145, double %154, double %144)
%156 = fmul double %101, %155
%157 = fdiv double %156, 4.000000e+00
%158 = call double @llvm.fmuladd.f64(double %91, double %100, double %157)
%159 = load double**, double*** %11
%160 = load i32, i32* %15
%161 = sext i32 %160 to i64
%162 = getelementptr inbounds double*, double** %159, i64 %161
%163 = load double*, double** %162
%164 = load i32, i32* %16
%165 = sext i32 %164 to i64
%166 = getelementptr inbounds double, double* %163, i64 %165
store double %158, double* %166
%167 = load double**, double*** %11
%168 = load i32, i32* %15
%169 = sext i32 %168 to i64
%170 = getelementptr inbounds double*, double** %167, i64 %169
%171 = load double*, double** %170
%172 = load i32, i32* %16
%173 = sext i32 %172 to i64
%174 = getelementptr inbounds double, double* %171, i64 %173
%175 = load double, double* %174
%176 = load double**, double*** %21
%177 = load i32, i32* %15
%178 = sext i32 %177 to i64
%179 = getelementptr inbounds double*, double** %176, i64 %178
%180 = load double*, double** %179
%181 = load i32, i32* %16
%182 = sext i32 %181 to i64
%183 = getelementptr inbounds double, double* %180, i64 %182
%184 = load double, double* %183
%185 = fsub double %175, %184
store double %185, double* %19
%186 = load double, double* %19
%187 = load double, double* %19
%188 = load double, double* %18
%189 = call double @llvm.fmuladd.f64(double %186, double %187, double %188)
store double %189, double* %18
br label %190
190: ; preds = %89
%191 = load i32, i32* %16
%192 = add nsw i32 %191, 1
store i32 %192, i32* %16
br label %84
193: ; preds = %84
br label %194
194: ; preds = %193
%195 = load i32, i32* %15
%196 = add nsw i32 %195, 1
store i32 %196, i32* %15
br label %78
197: ; preds = %78
%198 = load i32, i32* %17
%199 = add nsw i32 %198, 1
store i32 %199, i32* %17
%200 = load double, double* %18
%201 = call double @sqrt(double %200)
store double %201, double* %18
br label %32
202: ; preds = %40
%203 = load i32, i32* %17
%204 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %203)
%205 = load double, double* %18
%206 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), double %205)
%207 = load double**, double*** %21
%208 = load i32, i32* %8
%209 = call i32 (double**, i32, ...) bitcast (i32 (...)* @dfree_matrix to i32 (double**, i32, ...)*)(double** %207, i32 %208)
ret void
}

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