#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 */
typedef int i;

/* Variables and functions */
double *dalloc_matrix(int, int);
int /*<<< orphan*/ dfree_matrix(double *);
int /*<<< orphan*/ printf(char *, double);
double sqrt(double);
void jacobi(int n, double dx, double dy, double omega, double *u, double *f,
            double tol, int maxit) {
  int i, j, k;
  double error, resid, h2, b;
  double *uold;
  double *up;
  double *uoldp;
  uold = dalloc_matrix(n, n);
  h2 = (dx * dx);
  error = 10.0 * tol;
  k = 1;
  while (k <= maxit && error > tol) {
    error = 0.0;
    uoldp = uold;
    up = u;
    for (j = 0; j < n; j++)
      for (i = 0; i < n; i++)
        *uoldp++ = *up++;
    for (i = 1; i < n - 1; i++)
      for (j = 1; j < n - 1; j++) {
        (*(u + n * (i) + (j))) =
            (1.0 - omega) * (*(u + n * (i) + (j))) +
            omega *
                ((*(u + n * (i - 1) + (j))) + (*(u + n * (i + 1) + (j))) +
                 (*(u + n * (i) + (j - 1))) + (*(u + n * (i) + (j + 1))) +
                 h2 * (*(f + n * (i) + (j)))) /
                4.0;
        resid = (*(u + n * (i) + (j))) - (*(uold + n * (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);
}


x86 assembly (clang, -O0):
<jacobi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
mov    %rdx,-0x30(%rbp)
movsd  %xmm3,-0x38(%rbp)
mov    %ecx,-0x3c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1040 <dalloc_matrix@plt>
mov    %rax,-0x70(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xe6d(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x1,-0x48(%rbp)
mov    -0x48(%rbp),%ecx
xor    %eax,%eax
cmp    -0x3c(%rbp),%ecx
mov    %al,-0x81(%rbp)
jg     11cb <jacobi+0x8b>
movsd  -0x50(%rbp),%xmm0
ucomisd -0x38(%rbp),%xmm0
seta   %al
mov    %al,-0x81(%rbp)
mov    -0x81(%rbp),%al
test   $0x1,%al
jne    11de <jacobi+0x9e>
jmp    144b <jacobi+0x30b>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x70(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x78(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1263 <jacobi+0x123>
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1250 <jacobi+0x110>
mov    -0x78(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x78(%rbp)
movsd  (%rax),%xmm0
mov    -0x80(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x80(%rbp)
movsd  %xmm0,(%rax)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    1210 <jacobi+0xd0>
jmp    1255 <jacobi+0x115>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11fd <jacobi+0xbd>
movl   $0x1,-0x40(%rbp)
mov    -0x40(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    142e <jacobi+0x2ee>
movl   $0x1,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    141b <jacobi+0x2db>
movsd  0xd75(%rip),%xmm0
subsd  -0x20(%rbp),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x4(%rbp),%ecx
imul   -0x40(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x20(%rbp),%xmm1
mov    -0x28(%rbp),%rax
mov    -0x4(%rbp),%ecx
mov    -0x40(%rbp),%edx
sub    $0x1,%edx
imul   %edx,%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm4
mov    -0x28(%rbp),%rax
mov    -0x4(%rbp),%ecx
mov    -0x40(%rbp),%edx
add    $0x1,%edx
imul   %edx,%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x44(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm4
mov    -0x28(%rbp),%rax
mov    -0x4(%rbp),%ecx
imul   -0x40(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm4
mov    -0x28(%rbp),%rax
mov    -0x4(%rbp),%ecx
imul   -0x40(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    -0x44(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm4
movsd  -0x60(%rbp),%xmm3
mov    -0x30(%rbp),%rax
mov    -0x4(%rbp),%ecx
imul   -0x40(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm5
mulsd  %xmm5,%xmm3
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm1
movsd  0xc82(%rip),%xmm3
divsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
mov    -0x4(%rbp),%ecx
imul   -0x40(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
mov    -0x4(%rbp),%ecx
imul   -0x40(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x70(%rbp),%rax
mov    -0x4(%rbp),%ecx
imul   -0x40(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x44(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1282 <jacobi+0x142>
jmp    1420 <jacobi+0x2e0>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    126a <jacobi+0x12a>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
movsd  -0x50(%rbp),%xmm0
call   1060 <sqrt@plt>
movsd  %xmm0,-0x50(%rbp)
jmp    11a4 <jacobi+0x64>
cvtsi2sdl -0x48(%rbp),%xmm0
lea    0xbc1(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x50(%rbp),%xmm0
lea    0xbd0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x70(%rbp),%rdi
call   1050 <dfree_matrix@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jacobi>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    %ecx,%ebx
movsd  %xmm3,0x38(%rsp)
mov    %rdx,%rbp
mov    %rsi,0x30(%rsp)
movsd  %xmm2,0x28(%rsp)
movsd  %xmm0,0x8(%rsp)
mov    %edi,%r13d
mov    %edi,%esi
call   1040 <dalloc_matrix@plt>
movsd  0x38(%rsp),%xmm8
mov    %rax,0x10(%rsp)
movsd  0xe75(%rip),%xmm1
mulsd  %xmm8,%xmm1
movsd  0xe70(%rip),%xmm0
mov    %ebx,0x24(%rsp)
test   %ebx,%ebx
jle    15f8 <jacobi+0x4b8>
ucomisd %xmm8,%xmm1
jbe    15f8 <jacobi+0x4b8>
movsd  0x8(%rsp),%xmm9
mulsd  %xmm9,%xmm9
lea    -0x1(%r13),%r10d
movsd  0xe41(%rip),%xmm5
movsd  0x28(%rsp),%xmm6
subsd  %xmm6,%xmm5
movslq %r13d,%r11
lea    0x1(%r10),%r8
mov    %r8,%rax
and    $0xfffffffffffffffc,%rax
mov    %rax,0x18(%rsp)
add    $0xfffffffffffffffc,%rax
mov    %rax,0x90(%rsp)
shr    $0x2,%rax
add    $0x1,%rax
mov    %eax,%r12d
and    $0x3,%r12d
and    $0xfffffffffffffffc,%rax
mov    %rax,0x80(%rsp)
mov    %r12,0x88(%rsp)
shl    $0x5,%r12
mov    0x10(%rsp),%rax
lea    (%rax,%r11,8),%rax
add    $0x8,%rax
mov    %rax,0x68(%rsp)
lea    0x0(,%r11,8),%r15
lea    0x8(,%r11,8),%rax
add    %rbp,%rax
mov    %rax,0x60(%rsp)
mov    %r11,%rax
shl    $0x4,%rax
mov    0x30(%rsp),%r9
add    %r9,%rax
add    $0x8,%rax
mov    %rax,0x58(%rsp)
lea    0x8(%r9),%rax
mov    %rax,0x50(%rsp)
lea    0x10(%r9,%r11,8),%rax
mov    %rax,0x48(%rsp)
lea    -0x8(,%r10,8),%r14
ff
movsd  0xd94(%rip),%xmm7
xorpd  %xmm10,%xmm10
mov    $0x1,%ecx
movsd  %xmm9,0x8(%rsp)
movsd  %xmm5,0x70(%rsp)
mov    %r8,0x78(%rsp)
nopl   0x0(%rax,%rax,1)
mov    %rcx,0x40(%rsp)
test   %r13d,%r13d
jle    14a0 <jacobi+0x360>
xor    %eax,%eax
mov    0x10(%rsp),%rcx
mov    %r9,%rdx
jmp    12cc <jacobi+0x18c>
nopw   0x0(%rax,%rax,1)
add    $0x1,%eax
cmp    %r13d,%eax
je     14a0 <jacobi+0x360>
cmp    $0x3,%r10d
jb     12ec <jacobi+0x1ac>
lea    (%rdx,%r8,8),%rsi
cmp    %rsi,%rcx
jae    13c0 <jacobi+0x280>
lea    (%rcx,%r8,8),%rsi
cmp    %rsi,%rdx
jae    13c0 <jacobi+0x280>
xor    %esi,%esi
mov    %r13d,%ebp
sub    %esi,%ebp
mov    %esi,%edi
not    %edi
add    %r13d,%edi
and    $0x7,%ebp
je     1329 <jacobi+0x1e9>
neg    %ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  (%rdx),%xmm0
add    $0x8,%rdx
movsd  %xmm0,(%rcx)
add    $0x8,%rcx
add    $0xffffffff,%ebx
cmp    %ebx,%ebp
jne    1310 <jacobi+0x1d0>
sub    %ebx,%esi
cmp    $0x7,%edi
jb     12c0 <jacobi+0x180>
mov    %r13d,%edi
sub    %esi,%edi
xor    %ebp,%ebp
xor    %esi,%esi
nopw   0x0(%rax,%rax,1)
movsd  (%rdx,%rbp,8),%xmm0
movsd  %xmm0,(%rcx,%rbp,8)
movsd  0x8(%rdx,%rbp,8),%xmm0
movsd  %xmm0,0x8(%rcx,%rbp,8)
movsd  0x10(%rdx,%rbp,8),%xmm0
movsd  %xmm0,0x10(%rcx,%rbp,8)
movsd  0x18(%rdx,%rbp,8),%xmm0
movsd  %xmm0,0x18(%rcx,%rbp,8)
movsd  0x20(%rdx,%rbp,8),%xmm0
movsd  %xmm0,0x20(%rcx,%rbp,8)
movsd  0x28(%rdx,%rbp,8),%xmm0
movsd  %xmm0,0x28(%rcx,%rbp,8)
movsd  0x30(%rdx,%rbp,8),%xmm0
movsd  %xmm0,0x30(%rcx,%rbp,8)
movsd  0x38(%rdx,%rbp,8),%xmm0
movsd  %xmm0,0x38(%rcx,%rbp,8)
add    $0xffffffffffffffc0,%rsi
add    $0x8,%rbp
cmp    %ebp,%edi
jne    1340 <jacobi+0x200>
sub    %rsi,%rcx
sub    %rsi,%rdx
jmp    12c0 <jacobi+0x180>
cs nopw 0x0(%rax,%rax,1)
nop
cmpq   $0xc,0x90(%rsp)
jae    13cf <jacobi+0x28f>
xor    %esi,%esi
jmp    143c <jacobi+0x2fc>
mov    0x80(%rsp),%rdi
xor    %esi,%esi
nopl   0x0(%rax)
movups (%rdx,%rsi,8),%xmm0
movups 0x10(%rdx,%rsi,8),%xmm1
movups %xmm0,(%rcx,%rsi,8)
movups %xmm1,0x10(%rcx,%rsi,8)
movups 0x20(%rdx,%rsi,8),%xmm0
movups 0x30(%rdx,%rsi,8),%xmm1
movups %xmm0,0x20(%rcx,%rsi,8)
movups %xmm1,0x30(%rcx,%rsi,8)
movups 0x40(%rdx,%rsi,8),%xmm0
movups 0x50(%rdx,%rsi,8),%xmm1
movups %xmm0,0x40(%rcx,%rsi,8)
movups %xmm1,0x50(%rcx,%rsi,8)
movupd 0x60(%rdx,%rsi,8),%xmm0
movupd 0x70(%rdx,%rsi,8),%xmm1
movupd %xmm0,0x60(%rcx,%rsi,8)
movupd %xmm1,0x70(%rcx,%rsi,8)
add    $0x10,%rsi
add    $0xfffffffffffffffc,%rdi
jne    13e0 <jacobi+0x2a0>
cmpq   $0x0,0x88(%rsp)
je     147f <jacobi+0x33f>
lea    (%rdx,%rsi,8),%rdi
add    $0x10,%rdi
lea    (%rcx,%rsi,8),%rsi
add    $0x10,%rsi
xor    %ebp,%ebp
nopl   0x0(%rax)
movupd -0x10(%rdi,%rbp,1),%xmm0
movupd (%rdi,%rbp,1),%xmm1
movupd %xmm0,-0x10(%rsi,%rbp,1)
movupd %xmm1,(%rsi,%rbp,1)
add    $0x20,%rbp
cmp    %rbp,%r12
jne    1460 <jacobi+0x320>
mov    0x18(%rsp),%rdi
lea    (%rcx,%rdi,8),%rcx
lea    (%rdx,%rdi,8),%rdx
mov    %edi,%esi
cmp    %rdi,%r8
je     12c0 <jacobi+0x180>
jmp    12ee <jacobi+0x1ae>
nopl   0x0(%rax)
xorpd  %xmm0,%xmm0
cmp    $0x3,%r13d
jl     1571 <jacobi+0x431>
xorpd  %xmm0,%xmm0
mov    $0x1,%r8d
mov    0x48(%rsp),%rcx
mov    0x50(%rsp),%rdx
mov    0x58(%rsp),%rsi
mov    0x60(%rsp),%rdi
mov    0x68(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r8,%rax
imul   %r11,%rax
add    $0x1,%r8
movsd  (%r9,%rax,8),%xmm1
movsd  0x8(%r9,%rax,8),%xmm2
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mulsd  %xmm5,%xmm2
movsd  (%rdx,%rbp,1),%xmm3
addsd  (%rsi,%rbp,1),%xmm3
addsd  %xmm1,%xmm3
movsd  (%rcx,%rbp,1),%xmm4
addsd  %xmm4,%xmm3
movsd  (%rdi,%rbp,1),%xmm1
mulsd  %xmm9,%xmm1
addsd  %xmm3,%xmm1
mulsd  %xmm6,%xmm1
mulsd  %xmm7,%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm1,-0x8(%rcx,%rbp,1)
movapd %xmm1,%xmm2
subsd  (%rbx,%rbp,1),%xmm2
mulsd  %xmm2,%xmm2
addsd  %xmm2,%xmm0
add    $0x8,%rbp
movapd %xmm4,%xmm2
cmp    %rbp,%r14
jne    1500 <jacobi+0x3c0>
add    %r15,%rbx
add    %r15,%rdi
add    %r15,%rsi
add    %r15,%rdx
add    %r15,%rcx
cmp    %r10,%r8
jne    14e0 <jacobi+0x3a0>
ucomisd %xmm10,%xmm0
jb     1590 <jacobi+0x450>
xorps  %xmm1,%xmm1
sqrtsd %xmm0,%xmm1
jmp    15d1 <jacobi+0x491>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r10,%rbx
mov    %r11,%rbp
call   1060 <sqrt@plt>
xorpd  %xmm10,%xmm10
movsd  0xa68(%rip),%xmm7
mov    %rbp,%r11
movsd  0x70(%rsp),%xmm5
mov    %rbx,%r10
movsd  0x8(%rsp),%xmm9
movsd  0x28(%rsp),%xmm6
mov    0x30(%rsp),%r9
movsd  0x38(%rsp),%xmm8
movapd %xmm0,%xmm1
mov    0x40(%rsp),%rcx
lea    0x1(%rcx),%eax
cmp    0x24(%rsp),%ecx
mov    0x78(%rsp),%r8
jge    15f1 <jacobi+0x4b1>
ucomisd %xmm8,%xmm1
mov    %eax,%ecx
ja     12a0 <jacobi+0x160>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm1,0x18(%rsp)
lea    0xa13(%rip),%rdi
call   1030 <printf@plt>
lea    0xa27(%rip),%rdi
movsd  0x18(%rsp),%xmm0
call   1030 <printf@plt>
mov    0x10(%rsp),%rdi
add    $0x98,%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, double %6, i32 %7) {
%9 = alloca i32
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double*
%14 = alloca double*
%15 = alloca double
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double*
%25 = alloca double*
%26 = alloca double*
store i32 %0, i32* %9
store double %1, double* %10
store double %2, double* %11
store double %3, double* %12
store double* %4, double** %13
store double* %5, double** %14
store double %6, double* %15
store i32 %7, i32* %16
%27 = load i32, i32* %9
%28 = load i32, i32* %9
%29 = call double* @dalloc_matrix(i32 %27, i32 %28)
store double* %29, double** %24
%30 = load double, double* %10
%31 = load double, double* %10
%32 = fmul double %30, %31
store double %32, double* %22
%33 = load double, double* %15
%34 = fmul double 1.000000e+01, %33
store double %34, double* %20
store i32 1, i32* %19
br label %35
35: ; preds = %199, %8
%36 = load i32, i32* %19
%37 = load i32, i32* %16
%38 = icmp sle i32 %36, %37
br i1 %38, label %39, label %43
39: ; preds = %35
%40 = load double, double* %20
%41 = load double, double* %15
%42 = fcmp ogt double %40, %41
br label %43
43: ; preds = %39, %35
%44 = phi i1 [ false, %35 ], [ %42, %39 ]
br i1 %44, label %45, label %204
45: ; preds = %43
store double 0.000000e+00, double* %20
%46 = load double*, double** %24
store double* %46, double** %26
%47 = load double*, double** %13
store double* %47, double** %25
store i32 0, i32* %18
br label %48
48: ; preds = %67, %45
%49 = load i32, i32* %18
%50 = load i32, i32* %9
%51 = icmp slt i32 %49, %50
br i1 %51, label %52, label %70
52: ; preds = %48
store i32 0, i32* %17
br label %53
53: ; preds = %63, %52
%54 = load i32, i32* %17
%55 = load i32, i32* %9
%56 = icmp slt i32 %54, %55
br i1 %56, label %57, label %66
57: ; preds = %53
%58 = load double*, double** %25
%59 = getelementptr inbounds double, double* %58, i32 1
store double* %59, double** %25
%60 = load double, double* %58
%61 = load double*, double** %26
%62 = getelementptr inbounds double, double* %61, i32 1
store double* %62, double** %26
store double %60, double* %61
br label %63
63: ; preds = %57
%64 = load i32, i32* %17
%65 = add nsw i32 %64, 1
store i32 %65, i32* %17
br label %53
66: ; preds = %53
br label %67
67: ; preds = %66
%68 = load i32, i32* %18
%69 = add nsw i32 %68, 1
store i32 %69, i32* %18
br label %48
70: ; preds = %48
store i32 1, i32* %17
br label %71
71: ; preds = %196, %70
%72 = load i32, i32* %17
%73 = load i32, i32* %9
%74 = sub nsw i32 %73, 1
%75 = icmp slt i32 %72, %74
br i1 %75, label %76, label %199
76: ; preds = %71
store i32 1, i32* %18
br label %77
77: ; preds = %192, %76
%78 = load i32, i32* %18
%79 = load i32, i32* %9
%80 = sub nsw i32 %79, 1
%81 = icmp slt i32 %78, %80
br i1 %81, label %82, label %195
82: ; preds = %77
%83 = load double, double* %12
%84 = fsub double 1.000000e+00, %83
%85 = load double*, double** %13
%86 = load i32, i32* %9
%87 = load i32, i32* %17
%88 = mul nsw i32 %86, %87
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds double, double* %85, i64 %89
%91 = load i32, i32* %18
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds double, double* %90, i64 %92
%94 = load double, double* %93
%95 = load double, double* %12
%96 = load double*, double** %13
%97 = load i32, i32* %9
%98 = load i32, i32* %17
%99 = sub nsw i32 %98, 1
%100 = mul nsw i32 %97, %99
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds double, double* %96, i64 %101
%103 = load i32, i32* %18
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds double, double* %102, i64 %104
%106 = load double, double* %105
%107 = load double*, double** %13
%108 = load i32, i32* %9
%109 = load i32, i32* %17
%110 = add nsw i32 %109, 1
%111 = mul nsw i32 %108, %110
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds double, double* %107, i64 %112
%114 = load i32, i32* %18
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds double, double* %113, i64 %115
%117 = load double, double* %116
%118 = fadd double %106, %117
%119 = load double*, double** %13
%120 = load i32, i32* %9
%121 = load i32, i32* %17
%122 = mul nsw i32 %120, %121
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds double, double* %119, i64 %123
%125 = load i32, i32* %18
%126 = sub nsw i32 %125, 1
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds double, double* %124, i64 %127
%129 = load double, double* %128
%130 = fadd double %118, %129
%131 = load double*, double** %13
%132 = load i32, i32* %9
%133 = load i32, i32* %17
%134 = mul nsw i32 %132, %133
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds double, double* %131, i64 %135
%137 = load i32, i32* %18
%138 = add nsw i32 %137, 1
%139 = sext i32 %138 to i64
%140 = getelementptr inbounds double, double* %136, i64 %139
%141 = load double, double* %140
%142 = fadd double %130, %141
%143 = load double, double* %22
%144 = load double*, double** %14
%145 = load i32, i32* %9
%146 = load i32, i32* %17
%147 = mul nsw i32 %145, %146
%148 = sext i32 %147 to i64
%149 = getelementptr inbounds double, double* %144, i64 %148
%150 = load i32, i32* %18
%151 = sext i32 %150 to i64
%152 = getelementptr inbounds double, double* %149, i64 %151
%153 = load double, double* %152
%154 = call double @llvm.fmuladd.f64(double %143, double %153, double %142)
%155 = fmul double %95, %154
%156 = fdiv double %155, 4.000000e+00
%157 = call double @llvm.fmuladd.f64(double %84, double %94, double %156)
%158 = load double*, double** %13
%159 = load i32, i32* %9
%160 = load i32, i32* %17
%161 = mul nsw i32 %159, %160
%162 = sext i32 %161 to i64
%163 = getelementptr inbounds double, double* %158, i64 %162
%164 = load i32, i32* %18
%165 = sext i32 %164 to i64
%166 = getelementptr inbounds double, double* %163, i64 %165
store double %157, double* %166
%167 = load double*, double** %13
%168 = load i32, i32* %9
%169 = load i32, i32* %17
%170 = mul nsw i32 %168, %169
%171 = sext i32 %170 to i64
%172 = getelementptr inbounds double, double* %167, i64 %171
%173 = load i32, i32* %18
%174 = sext i32 %173 to i64
%175 = getelementptr inbounds double, double* %172, i64 %174
%176 = load double, double* %175
%177 = load double*, double** %24
%178 = load i32, i32* %9
%179 = load i32, i32* %17
%180 = mul nsw i32 %178, %179
%181 = sext i32 %180 to i64
%182 = getelementptr inbounds double, double* %177, i64 %181
%183 = load i32, i32* %18
%184 = sext i32 %183 to i64
%185 = getelementptr inbounds double, double* %182, i64 %184
%186 = load double, double* %185
%187 = fsub double %176, %186
store double %187, double* %21
%188 = load double, double* %21
%189 = load double, double* %21
%190 = load double, double* %20
%191 = call double @llvm.fmuladd.f64(double %188, double %189, double %190)
store double %191, double* %20
br label %192
192: ; preds = %82
%193 = load i32, i32* %18
%194 = add nsw i32 %193, 1
store i32 %194, i32* %18
br label %77
195: ; preds = %77
br label %196
196: ; preds = %195
%197 = load i32, i32* %17
%198 = add nsw i32 %197, 1
store i32 %198, i32* %17
br label %71
199: ; preds = %71
%200 = load i32, i32* %19
%201 = add nsw i32 %200, 1
store i32 %201, i32* %19
%202 = load double, double* %20
%203 = call double @sqrt(double %202)
store double %203, double* %20
br label %35
204: ; preds = %43
%205 = load i32, i32* %19
%206 = sitofp i32 %205 to double
%207 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), double %206)
%208 = load double, double* %20
%209 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), double %208)
%210 = load double*, double** %24
%211 = call i32 @dfree_matrix(double* %210)
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 %3, double* nocapture %4, double* nocapture %5, double %6, i32 %7) {
%9 = tail call double* @dalloc_matrix(i32 %0, i32 %0)
%10 = fmul double %1, %1
%11 = fmul double %6, 1.000000e+01
%12 = icmp sgt i32 %7, 0
%13 = fcmp ogt double %11, %6
%14 = and i1 %12, %13
br i1 %14, label %15, label %236
15: ; preds = %8
%16 = icmp sgt i32 %0, 0
%17 = add i32 %0, -1
%18 = icmp sgt i32 %0, 2
%19 = fsub double 1.000000e+00, %3
%20 = sext i32 %0 to i64
%21 = zext i32 %17 to i64
%22 = add nuw nsw i64 %21, 1
%23 = add nuw nsw i64 %21, 1
%24 = and i64 %23, 8589934588
%25 = add nsw i64 %24, -4
%26 = lshr exact i64 %25, 2
%27 = add nuw nsw i64 %26, 1
%28 = icmp ult i32 %17, 3
%29 = and i64 %23, 8589934588
%30 = trunc i64 %29 to i32
%31 = and i64 %27, 3
%32 = icmp ult i64 %25, 12
%33 = and i64 %27, 9223372036854775804
%34 = icmp eq i64 %31, 0
%35 = icmp eq i64 %23, %29
br label %36
36: ; preds = %15, %227
%37 = phi i32 [ 1, %15 ], [ %229, %227 ]
br i1 %16, label %39, label %38
38: ; preds = %177, %36
br i1 %18, label %182, label %227
39: ; preds = %36, %177
%40 = phi double* [ %179, %177 ], [ %9, %36 ]
%41 = phi double* [ %178, %177 ], [ %4, %36 ]
%42 = phi i32 [ %180, %177 ], [ 0, %36 ]
br i1 %28, label %120, label %43
43: ; preds = %39
%44 = getelementptr double, double* %40, i64 %22
%45 = getelementptr double, double* %41, i64 %22
%46 = icmp ult double* %40, %45
%47 = icmp ult double* %41, %44
%48 = and i1 %46, %47
br i1 %48, label %120, label %49
49: ; preds = %43
%50 = getelementptr double, double* %40, i64 %29
%51 = getelementptr double, double* %41, i64 %29
br i1 %32, label %101, label %52
52: ; preds = %49, %52
%53 = phi i64 [ %98, %52 ], [ 0, %49 ]
%54 = phi i64 [ %99, %52 ], [ 0, %49 ]
%55 = getelementptr double, double* %40, i64 %53
%56 = getelementptr double, double* %41, i64 %53
%57 = bitcast double* %56 to <2 x double>*
%58 = load <2 x double>, <2 x double>* %57
%59 = getelementptr double, double* %56, i64 2
%60 = bitcast double* %59 to <2 x double>*
%61 = load <2 x double>, <2 x double>* %60
%62 = bitcast double* %55 to <2 x double>*
store <2 x double> %58, <2 x double>* %62
%63 = getelementptr double, double* %55, i64 2
%64 = bitcast double* %63 to <2 x double>*
store <2 x double> %61, <2 x double>* %64
%65 = or i64 %53, 4
%66 = getelementptr double, double* %40, i64 %65
%67 = getelementptr double, double* %41, i64 %65
%68 = bitcast double* %67 to <2 x double>*
%69 = load <2 x double>, <2 x double>* %68
%70 = getelementptr double, double* %67, i64 2
%71 = bitcast double* %70 to <2 x double>*
%72 = load <2 x double>, <2 x double>* %71
%73 = bitcast double* %66 to <2 x double>*
store <2 x double> %69, <2 x double>* %73
%74 = getelementptr double, double* %66, i64 2
%75 = bitcast double* %74 to <2 x double>*
store <2 x double> %72, <2 x double>* %75
%76 = or i64 %53, 8
%77 = getelementptr double, double* %40, i64 %76
%78 = getelementptr double, double* %41, i64 %76
%79 = bitcast double* %78 to <2 x double>*
%80 = load <2 x double>, <2 x double>* %79
%81 = getelementptr double, double* %78, i64 2
%82 = bitcast double* %81 to <2 x double>*
%83 = load <2 x double>, <2 x double>* %82
%84 = bitcast double* %77 to <2 x double>*
store <2 x double> %80, <2 x double>* %84
%85 = getelementptr double, double* %77, i64 2
%86 = bitcast double* %85 to <2 x double>*
store <2 x double> %83, <2 x double>* %86
%87 = or i64 %53, 12
%88 = getelementptr double, double* %40, i64 %87
%89 = getelementptr double, double* %41, i64 %87
%90 = bitcast double* %89 to <2 x double>*
%91 = load <2 x double>, <2 x double>* %90
%92 = getelementptr double, double* %89, i64 2
%93 = bitcast double* %92 to <2 x double>*
%94 = load <2 x double>, <2 x double>* %93
%95 = bitcast double* %88 to <2 x double>*
store <2 x double> %91, <2 x double>* %95
%96 = getelementptr double, double* %88, i64 2
%97 = bitcast double* %96 to <2 x double>*
store <2 x double> %94, <2 x double>* %97
%98 = add nuw i64 %53, 16
%99 = add nuw i64 %54, 4
%100 = icmp eq i64 %99, %33
br i1 %100, label %101, label %52
101: ; preds = %52, %49
%102 = phi i64 [ 0, %49 ], [ %98, %52 ]
br i1 %34, label %119, label %103
103: ; preds = %101, %103
%104 = phi i64 [ %116, %103 ], [ %102, %101 ]
%105 = phi i64 [ %117, %103 ], [ 0, %101 ]
%106 = getelementptr double, double* %40, i64 %104
%107 = getelementptr double, double* %41, i64 %104
%108 = bitcast double* %107 to <2 x double>*
%109 = load <2 x double>, <2 x double>* %108
%110 = getelementptr double, double* %107, i64 2
%111 = bitcast double* %110 to <2 x double>*
%112 = load <2 x double>, <2 x double>* %111
%113 = bitcast double* %106 to <2 x double>*
store <2 x double> %109, <2 x double>* %113
%114 = getelementptr double, double* %106, i64 2
%115 = bitcast double* %114 to <2 x double>*
store <2 x double> %112, <2 x double>* %115
%116 = add nuw i64 %104, 4
%117 = add i64 %105, 1
%118 = icmp eq i64 %117, %31
br i1 %118, label %119, label %103
119: ; preds = %103, %101
br i1 %35, label %177, label %120
120: ; preds = %43, %39, %119
%121 = phi double* [ %40, %43 ], [ %40, %39 ], [ %50, %119 ]
%122 = phi double* [ %41, %43 ], [ %41, %39 ], [ %51, %119 ]
%123 = phi i32 [ 0, %43 ], [ 0, %39 ], [ %30, %119 ]
%124 = sub i32 %0, %123
%125 = xor i32 %123, -1
%126 = add i32 %125, %0
%127 = and i32 %124, 7
%128 = icmp eq i32 %127, 0
br i1 %128, label %140, label %129
129: ; preds = %120, %129
%130 = phi double* [ %136, %129 ], [ %121, %120 ]
%131 = phi double* [ %134, %129 ], [ %122, %120 ]
%132 = phi i32 [ %137, %129 ], [ %123, %120 ]
%133 = phi i32 [ %138, %129 ], [ 0, %120 ]
%134 = getelementptr inbounds double, double* %131, i64 1
%135 = load double, double* %131
%136 = getelementptr inbounds double, double* %130, i64 1
store double %135, double* %130
%137 = add nuw nsw i32 %132, 1
%138 = add i32 %133, 1
%139 = icmp eq i32 %138, %127
br i1 %139, label %140, label %129
140: ; preds = %129, %120
%141 = phi double* [ undef, %120 ], [ %134, %129 ]
%142 = phi double* [ undef, %120 ], [ %136, %129 ]
%143 = phi double* [ %121, %120 ], [ %136, %129 ]
%144 = phi double* [ %122, %120 ], [ %134, %129 ]
%145 = phi i32 [ %123, %120 ], [ %137, %129 ]
%146 = icmp ult i32 %126, 7
br i1 %146, label %177, label %147
147: ; preds = %140, %147
%148 = phi double* [ %174, %147 ], [ %143, %140 ]
%149 = phi double* [ %172, %147 ], [ %144, %140 ]
%150 = phi i32 [ %175, %147 ], [ %145, %140 ]
%151 = getelementptr inbounds double, double* %149, i64 1
%152 = load double, double* %149
%153 = getelementptr inbounds double, double* %148, i64 1
store double %152, double* %148
%154 = getelementptr inbounds double, double* %149, i64 2
%155 = load double, double* %151
%156 = getelementptr inbounds double, double* %148, i64 2
store double %155, double* %153
%157 = getelementptr inbounds double, double* %149, i64 3
%158 = load double, double* %154
%159 = getelementptr inbounds double, double* %148, i64 3
store double %158, double* %156
%160 = getelementptr inbounds double, double* %149, i64 4
%161 = load double, double* %157
%162 = getelementptr inbounds double, double* %148, i64 4
store double %161, double* %159
%163 = getelementptr inbounds double, double* %149, i64 5
%164 = load double, double* %160
%165 = getelementptr inbounds double, double* %148, i64 5
store double %164, double* %162
%166 = getelementptr inbounds double, double* %149, i64 6
%167 = load double, double* %163
%168 = getelementptr inbounds double, double* %148, i64 6
store double %167, double* %165
%169 = getelementptr inbounds double, double* %149, i64 7
%170 = load double, double* %166
%171 = getelementptr inbounds double, double* %148, i64 7
store double %170, double* %168
%172 = getelementptr inbounds double, double* %149, i64 8
%173 = load double, double* %169
%174 = getelementptr inbounds double, double* %148, i64 8
store double %173, double* %171
%175 = add nuw nsw i32 %150, 8
%176 = icmp eq i32 %175, %0
br i1 %176, label %177, label %147
177: ; preds = %140, %147, %119
%178 = phi double* [ %51, %119 ], [ %141, %140 ], [ %172, %147 ]
%179 = phi double* [ %50, %119 ], [ %142, %140 ], [ %174, %147 ]
%180 = add nuw nsw i32 %42, 1
%181 = icmp eq i32 %180, %0
br i1 %181, label %38, label %39
182: ; preds = %38, %225
%183 = phi i64 [ %190, %225 ], [ 1, %38 ]
%184 = phi double [ %223, %225 ], [ 0.000000e+00, %38 ]
%185 = mul nsw i64 %183, %20
%186 = getelementptr inbounds double, double* %4, i64 %185
%187 = add nsw i64 %183, -1
%188 = mul nsw i64 %187, %20
%189 = getelementptr inbounds double, double* %4, i64 %188
%190 = add nuw nsw i64 %183, 1
%191 = mul nsw i64 %190, %20
%192 = getelementptr inbounds double, double* %4, i64 %191
%193 = getelementptr inbounds double, double* %5, i64 %185
%194 = getelementptr inbounds double, double* %9, i64 %185
%195 = getelementptr inbounds double, double* %186, i64 1
%196 = load double, double* %195
%197 = load double, double* %186
br label %198
198: ; preds = %182, %198
%199 = phi double [ %197, %182 ], [ %219, %198 ]
%200 = phi double [ %196, %182 ], [ %212, %198 ]
%201 = phi i64 [ 1, %182 ], [ %210, %198 ]
%202 = phi double [ %184, %182 ], [ %223, %198 ]
%203 = getelementptr inbounds double, double* %186, i64 %201
%204 = getelementptr inbounds double, double* %189, i64 %201
%205 = load double, double* %204
%206 = getelementptr inbounds double, double* %192, i64 %201
%207 = load double, double* %206
%208 = fadd double %205, %207
%209 = fadd double %208, %199
%210 = add nuw nsw i64 %201, 1
%211 = getelementptr inbounds double, double* %186, i64 %210
%212 = load double, double* %211
%213 = fadd double %209, %212
%214 = getelementptr inbounds double, double* %193, i64 %201
%215 = load double, double* %214
%216 = tail call double @llvm.fmuladd.f64(double %10, double %215, double %213)
%217 = fmul double %216, %3
%218 = fmul double %217, 2.500000e-01
%219 = tail call double @llvm.fmuladd.f64(double %19, double %200, double %218)
store double %219, double* %203
%220 = getelementptr inbounds double, double* %194, i64 %201
%221 = load double, double* %220
%222 = fsub double %219, %221
%223 = tail call double @llvm.fmuladd.f64(double %222, double %222, double %202)
%224 = icmp eq i64 %210, %21
br i1 %224, label %225, label %198
225: ; preds = %198
%226 = icmp eq i64 %190, %21
br i1 %226, label %227, label %182
227: ; preds = %225, %38
%228 = phi double [ 0.000000e+00, %38 ], [ %223, %225 ]
%229 = add nuw nsw i32 %37, 1
%230 = tail call double @sqrt(double %228)
%231 = icmp slt i32 %37, %7
%232 = fcmp ogt double %230, %6
%233 = select i1 %231, i1 %232, i1 false
br i1 %233, label %36, label %234
234: ; preds = %227
%235 = sitofp i32 %229 to double
br label %236
236: ; preds = %234, %8
%237 = phi double [ %11, %8 ], [ %230, %234 ]
%238 = phi double [ 1.000000e+00, %8 ], [ %235, %234 ]
%239 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), double %238)
%240 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), double %237)
%241 = tail call i32 @dfree_matrix(double* %9)
ret void
}