#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 */
struct timeval {
  double tv_sec;
  double tv_usec;
};

/* Variables and functions */
int abs(int);
int atoi(char *);
scalar_t__ calloc(int, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ free(double *);
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int /*<<< orphan*/ matvec(int, int, double *, double *, double *);
int /*<<< orphan*/ printf(char *, int, ...);
int main(int argc, char **argv) {
  int i, j, N = 50, b = 1;
  double *A, *v, *w;
  if (argc > 1) {
    if ((N = atoi(argv[1])) < 0)
      N = 50;
  }
  if (argc > 2) {
    if ((b = atoi(argv[2])) < 0)
      b = 1;
  }
  if (b >= N) {
    printf("Error: ancho de banda excesivo, N=%d, b=%d\n", N, b);
    exit(1);
  }
  A = (double *)calloc(N * N, sizeof(double));
  v = (double *)calloc(N, sizeof(double));
  w = (double *)calloc(N, sizeof(double));
  for (i = 0; i < N; i++)
    A[i * N + i] = 2 * b;
  for (i = 0; i < N; i++) {
    for (j = 0; j < N; j++) {
      if (i != j && abs(i - j) <= b)
        A[i * N + j] = -1.0;
    }
  }
  for (i = 0; i < N; i++)
    v[i] = 1.0;
  struct timeval t1, t2;
  double elapsedTime;
  gettimeofday(&t1, NULL);
  matvec(N, b, A, v, w);
  gettimeofday(&t2, NULL);
  elapsedTime =
      (t2.tv_sec - t1.tv_sec) + ((t2.tv_usec - t1.tv_usec) / (1000.0 * 1000.0));
  printf("TIME TAKEN : %f seconds\n", elapsedTime);
  for (i = 0; i < N; i++)
    printf("w[%d] = %g\n", i, w[i]);
  free(A);
  free(v);
  free(w);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x32,-0x1c(%rbp)
movl   $0x1,-0x20(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    11d3 <main+0x53>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0x0,%eax
jge    11ce <main+0x4e>
movl   $0x32,-0x1c(%rbp)
jmp    11d3 <main+0x53>
cmpl   $0x2,-0x8(%rbp)
jle    1202 <main+0x82>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x20(%rbp)
cmp    $0x0,%eax
jge    11fd <main+0x7d>
movl   $0x1,-0x20(%rbp)
jmp    1202 <main+0x82>
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jl     122c <main+0xac>
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
lea    0xdfd(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x1c(%rbp),%edi
imul   -0x1c(%rbp),%edi
mov    $0x8,%esi
call   1070 <calloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x1c(%rbp),%edi
mov    $0x8,%esi
call   1070 <calloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x1c(%rbp),%edi
mov    $0x8,%esi
call   1070 <calloc@plt>
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    12a4 <main+0x124>
mov    -0x20(%rbp),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
mov    -0x28(%rbp),%rax
mov    -0x14(%rbp),%ecx
imul   -0x1c(%rbp),%ecx
add    -0x14(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    126a <main+0xea>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    132e <main+0x1ae>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    131b <main+0x19b>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
je     1308 <main+0x188>
mov    -0x14(%rbp),%edi
sub    -0x18(%rbp),%edi
call   1040 <abs@plt>
cmp    -0x20(%rbp),%eax
jg     1308 <main+0x188>
mov    -0x28(%rbp),%rax
mov    -0x14(%rbp),%ecx
imul   -0x1c(%rbp),%ecx
add    -0x18(%rbp),%ecx
movslq %ecx,%rcx
movsd  0xd0d(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    130d <main+0x18d>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    12be <main+0x13e>
jmp    1320 <main+0x1a0>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    12ab <main+0x12b>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1364 <main+0x1e4>
mov    -0x30(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  0xcb7(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1335 <main+0x1b5>
lea    -0x48(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1060 <gettimeofday@plt>
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x38(%rbp),%r8
call   10a0 <matvec@plt>
lea    -0x58(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1060 <gettimeofday@plt>
movsd  -0x58(%rbp),%xmm0
subsd  -0x48(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
subsd  -0x40(%rbp),%xmm1
movsd  0xc4f(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
cvttsd2si -0x60(%rbp),%esi
lea    0xc7a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1410 <main+0x290>
mov    -0x14(%rbp),%esi
mov    -0x38(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xc62(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    13d8 <main+0x258>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
cmp    $0x2,%edi
jl     11e0 <main+0x70>
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x8(%rsi),%rdi
call   1070 <atoi@plt>
test   %eax,%eax
mov    $0x32,%r15d
cmovns %eax,%r15d
mov    $0x1,%r14d
cmp    $0x2,%ebp
je     11bd <main+0x4d>
mov    0x10(%rbx),%rdi
call   1070 <atoi@plt>
test   %eax,%eax
mov    $0x1,%r14d
cmovns %eax,%r14d
cmp    %r15d,%r14d
jb     11ec <main+0x7c>
lea    0xe4f(%rip),%rdi
mov    %r15d,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    $0x32,%r15d
mov    $0x1,%r14d
mov    %r15d,%edi
imul   %r15d,%edi
mov    $0x8,%esi
call   1060 <calloc@plt>
mov    %rax,%r12
mov    %r15d,%edi
mov    $0x8,%esi
call   1060 <calloc@plt>
mov    %rax,%r13
mov    %r15d,%edi
mov    $0x8,%esi
call   1060 <calloc@plt>
mov    %rax,0x18(%rsp)
lea    (%r14,%r14,1),%eax
cvtsi2sd %eax,%xmm0
mov    %r15d,%edi
lea    -0x1(%rdi),%rax
mov    %edi,%r11d
and    $0x3,%r11d
xor    %edx,%edx
mov    %rax,0x28(%rsp)
cmp    $0x3,%rax
mov    %rdi,(%rsp)
jb     12fd <main+0x18d>
lea    (%r15,%r15,1),%eax
lea    0x0(,%r15,4),%r10d
mov    %rdi,%rcx
lea    (%r15,%r15,2),%edi
and    $0xfffffffc,%ecx
neg    %rcx
mov    %rcx,0x20(%rsp)
mov    $0x2,%ebp
mov    $0x1,%ecx
mov    %r15,%r9
mov    %r12,%r15
mov    $0x3,%r12d
xor    %esi,%esi
mov    %r9,0x10(%rsp)
xor    %r8d,%r8d
nopl   0x0(%rax,%rax,1)
cltq
movslq %r9d,%r9
movslq %edx,%rdx
lea    (%r8,%rdx,1),%rbx
movsd  %xmm0,(%r15,%rbx,8)
lea    (%rcx,%r9,1),%rbx
movsd  %xmm0,(%r15,%rbx,8)
lea    0x0(%rbp,%rax,1),%rbx
movslq %edi,%rdi
movsd  %xmm0,(%r15,%rbx,8)
lea    (%r12,%rdi,1),%rbx
movsd  %xmm0,(%r15,%rbx,8)
add    $0x4,%r8
add    %r10d,%edx
add    $0x4,%rbp
add    %r10d,%eax
add    $0x4,%rcx
add    %r10d,%r9d
add    $0x4,%r12
add    %r10d,%edi
add    $0xfffffffffffffffc,%rsi
cmp    %rsi,0x20(%rsp)
jne    1290 <main+0x120>
neg    %rsi
mov    %rsi,%rdx
mov    %r15,%r12
mov    0x10(%rsp),%r15
mov    (%rsp),%rdi
test   %r11,%r11
je     1329 <main+0x1b9>
mov    %r15d,%eax
imul   %edx,%eax
nopl   0x0(%rax,%rax,1)
cltq
lea    (%rdx,%rax,1),%rcx
movsd  %xmm0,(%r12,%rcx,8)
add    $0x1,%rdx
add    %r15d,%eax
add    $0xffffffffffffffff,%r11
jne    1310 <main+0x1a0>
movslq %r15d,%r8
mov    %edi,%edx
and    $0xfffffffe,%edx
mov    %r12,%rsi
add    $0x8,%rsi
lea    0x0(,%r8,8),%r10
mov    $0xffffffff,%r11d
xor    %ecx,%ecx
movabs $0xbff0000000000000,%r9
jmp    1374 <main+0x204>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rcx
add    $0x1,%r11d
add    %r10,%rsi
cmp    %rdi,%rcx
je     1440 <main+0x2d0>
cmpq   $0x0,0x28(%rsp)
je     1400 <main+0x290>
mov    %r11d,%eax
xor    %edi,%edi
jmp    139c <main+0x22c>
nopw   0x0(%rax,%rax,1)
add    $0xfffffffe,%eax
add    $0x1,%rdi
cmp    %rdx,%rdi
je     13e0 <main+0x270>
mov    %rdi,%rbx
cmp    %rdi,%rcx
je     13b8 <main+0x248>
lea    0x1(%rax),%ebp
mov    %ebp,%edi
neg    %edi
cmovs  %ebp,%edi
cmp    %r14d,%edi
jg     13b8 <main+0x248>
mov    %r9,-0x8(%rsi,%rbx,8)
lea    0x1(%rbx),%rdi
cmp    %rdi,%rcx
je     1390 <main+0x220>
mov    %eax,%ebp
neg    %ebp
cmovs  %eax,%ebp
cmp    %r14d,%ebp
jg     1390 <main+0x220>
mov    %r9,(%rsi,%rbx,8)
jmp    1390 <main+0x220>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x2,%rbx
mov    (%rsp),%rdi
test   $0x1,%dil
jne    140c <main+0x29c>
jmp    1360 <main+0x1f0>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %ebx,%ebx
test   $0x1,%dil
je     1360 <main+0x1f0>
cmp    %rbx,%rcx
je     1360 <main+0x1f0>
mov    %ecx,%eax
sub    %ebx,%eax
mov    %eax,%edi
neg    %edi
cmovs  %eax,%edi
cmp    %r14d,%edi
mov    (%rsp),%rdi
jg     1360 <main+0x1f0>
mov    %rcx,%rax
imul   %r8,%rax
add    %rax,%rbx
mov    %r9,(%r12,%rbx,8)
jmp    1360 <main+0x1f0>
cmp    $0x4,%r15d
mov    %r12,0x8(%rsp)
jae    1452 <main+0x2e2>
xor    %eax,%eax
jmp    1569 <main+0x3f9>
mov    %edi,%eax
and    $0xfffffffc,%eax
lea    -0x4(%rax),%rsi
mov    %rsi,%rdx
shr    $0x2,%rdx
add    $0x1,%rdx
mov    %edx,%ecx
and    $0x7,%ecx
cmp    $0x1c,%rsi
jae    1478 <main+0x308>
xor    %esi,%esi
jmp    1526 <main+0x3b6>
and    $0xfffffffffffffff8,%rdx
xor    %esi,%esi
movapd 0xb7a(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
movupd %xmm0,0x0(%r13,%rsi,8)
movupd %xmm0,0x10(%r13,%rsi,8)
movupd %xmm0,0x20(%r13,%rsi,8)
movupd %xmm0,0x30(%r13,%rsi,8)
movupd %xmm0,0x40(%r13,%rsi,8)
movupd %xmm0,0x50(%r13,%rsi,8)
movupd %xmm0,0x60(%r13,%rsi,8)
movupd %xmm0,0x70(%r13,%rsi,8)
movupd %xmm0,0x80(%r13,%rsi,8)
movupd %xmm0,0x90(%r13,%rsi,8)
movupd %xmm0,0xa0(%r13,%rsi,8)
movupd %xmm0,0xb0(%r13,%rsi,8)
movupd %xmm0,0xc0(%r13,%rsi,8)
movupd %xmm0,0xd0(%r13,%rsi,8)
movupd %xmm0,0xe0(%r13,%rsi,8)
movupd %xmm0,0xf0(%r13,%rsi,8)
add    $0x20,%rsi
add    $0xfffffffffffffff8,%rdx
jne    1490 <main+0x320>
test   %rcx,%rcx
je     1564 <main+0x3f4>
lea    0x10(,%rsi,8),%rdx
add    %r13,%rdx
shl    $0x5,%rcx
xor    %esi,%esi
movapd 0xabc(%rip),%xmm0
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movupd %xmm0,-0x10(%rdx,%rsi,1)
movupd %xmm0,(%rdx,%rsi,1)
add    $0x20,%rsi
cmp    %rsi,%rcx
jne    1550 <main+0x3e0>
cmp    %rdi,%rax
je     158e <main+0x41e>
movabs $0x3ff0000000000000,%rcx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rcx,0x0(%r13,%rax,8)
add    $0x1,%rax
cmp    %rax,%rdi
jne    1580 <main+0x410>
xor    %ebp,%ebp
mov    %rdi,%r12
lea    0x40(%rsp),%rdi
xor    %esi,%esi
call   1050 <gettimeofday@plt>
mov    %r15d,%edi
mov    %r14d,%esi
mov    0x8(%rsp),%rdx
mov    %r13,%rcx
mov    0x18(%rsp),%rbx
mov    %rbx,%r8
call   1090 <matvec@plt>
lea    0x30(%rsp),%rdi
xor    %esi,%esi
call   1050 <gettimeofday@plt>
movapd 0x30(%rsp),%xmm0
subpd  0x40(%rsp),%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
divsd  0xa2e(%rip),%xmm1
addsd  %xmm0,%xmm1
cvttsd2si %xmm1,%esi
lea    0xa53(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xa5e(%rip),%r14
nop
movsd  (%rbx,%rbp,8),%xmm0
mov    %r14,%rdi
mov    %ebp,%esi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r12
jne    1600 <main+0x490>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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