#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 *, double, ...);
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);
  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     122e <main+0xae>
cvtsi2sdl -0x1c(%rbp),%xmm0
mov    -0x20(%rbp),%esi
lea    0xdfb(%rip),%rdi
mov    $0x1,%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    12a6 <main+0x126>
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    126c <main+0xec>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1330 <main+0x1b0>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    131d <main+0x19d>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
je     130a <main+0x18a>
mov    -0x14(%rbp),%edi
sub    -0x18(%rbp),%edi
call   1040 <abs@plt>
cmp    -0x20(%rbp),%eax
jg     130a <main+0x18a>
mov    -0x28(%rbp),%rax
mov    -0x14(%rbp),%ecx
imul   -0x1c(%rbp),%ecx
add    -0x18(%rbp),%ecx
movslq %ecx,%rcx
movsd  0xd0b(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    130f <main+0x18f>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    12c0 <main+0x140>
jmp    1322 <main+0x1a2>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    12ad <main+0x12d>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1366 <main+0x1e6>
mov    -0x30(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  0xcb5(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1337 <main+0x1b7>
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  0xc4d(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
lea    0xc78(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
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     11e2 <main+0x72>
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x8(%rsi),%rdi
call   1070 <atoi@plt>
test   %eax,%eax
mov    $0x32,%r13d
cmovns %eax,%r13d
mov    $0x1,%r15d
cmp    $0x2,%ebp
je     11bd <main+0x4d>
mov    0x10(%rbx),%rdi
call   1070 <atoi@plt>
test   %eax,%eax
mov    $0x1,%r15d
cmovns %eax,%r15d
cmp    %r13d,%r15d
jb     11ee <main+0x7e>
cvtsi2sd %r13d,%xmm0
lea    0xe4a(%rip),%rdi
mov    %r15d,%esi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    $0x32,%r13d
mov    $0x1,%r15d
mov    %r13d,%edi
imul   %r13d,%edi
mov    $0x8,%esi
call   1060 <calloc@plt>
mov    %rax,%rbx
mov    %r13d,%edi
mov    $0x8,%esi
call   1060 <calloc@plt>
mov    %rax,%r12
mov    %r13d,%edi
mov    $0x8,%esi
call   1060 <calloc@plt>
lea    (%r15,%r15,1),%ecx
cvtsi2sd %ecx,%xmm0
mov    %r13d,%r11d
lea    -0x1(%r11),%rcx
mov    %r11d,%edx
and    $0x3,%edx
xor    %esi,%esi
mov    %rcx,0x28(%rsp)
cmp    $0x3,%rcx
mov    %rax,0x10(%rsp)
jb     12ff <main+0x18f>
lea    0x0(%r13,%r13,1),%ecx
lea    0x0(,%r13,4),%r10d
lea    0x0(%r13,%r13,2),%ebp
mov    %r11,0x18(%rsp)
and    $0xfffffffc,%r11d
neg    %r11
mov    %r11,0x8(%rsp)
mov    $0x2,%eax
mov    %r13,%r9
mov    $0x1,%r13d
mov    %rbx,%r11
mov    $0x3,%r14d
xor    %edi,%edi
mov    %r9,0x20(%rsp)
xor    %r8d,%r8d
xchg   %ax,%ax
movslq %ecx,%rcx
movslq %r9d,%r9
movslq %esi,%rsi
lea    (%r8,%rsi,1),%rbx
movsd  %xmm0,(%r11,%rbx,8)
lea    0x0(%r13,%r9,1),%rbx
movsd  %xmm0,(%r11,%rbx,8)
lea    (%rax,%rcx,1),%rbx
movslq %ebp,%rbp
movsd  %xmm0,(%r11,%rbx,8)
lea    (%r14,%rbp,1),%rbx
movsd  %xmm0,(%r11,%rbx,8)
add    $0x4,%r8
add    %r10d,%esi
add    $0x4,%rax
add    %r10d,%ecx
add    $0x4,%r13
add    %r10d,%r9d
add    $0x4,%r14
add    %r10d,%ebp
add    $0xfffffffffffffffc,%rdi
cmp    %rdi,0x8(%rsp)
jne    1290 <main+0x120>
neg    %rdi
mov    %rdi,%rsi
mov    0x20(%rsp),%r13
mov    %r11,%rbx
mov    0x18(%rsp),%r11
test   %rdx,%rdx
je     1328 <main+0x1b8>
mov    %r13d,%eax
imul   %esi,%eax
nopw   0x0(%rax,%rax,1)
cltq
lea    (%rsi,%rax,1),%rcx
movsd  %xmm0,(%rbx,%rcx,8)
add    $0x1,%rsi
add    %r13d,%eax
add    $0xffffffffffffffff,%rdx
jne    1310 <main+0x1a0>
movslq %r13d,%r8
mov    %r11d,%esi
and    $0xfffffffe,%esi
mov    %rbx,0x8(%rsp)
mov    %rbx,%rdi
add    $0x8,%rdi
lea    0x0(,%r8,8),%r10
mov    $0xffffffff,%r14d
xor    %ecx,%ecx
movabs $0xbff0000000000000,%r9
jmp    1374 <main+0x204>
nopl   0x0(%rax)
add    $0x1,%rcx
add    $0x1,%r14d
add    %r10,%rdi
cmp    %r11,%rcx
je     1431 <main+0x2c1>
cmpq   $0x0,0x28(%rsp)
je     13f0 <main+0x280>
mov    %r14d,%ebp
xor    %eax,%eax
jmp    139c <main+0x22c>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0xfffffffe,%ebp
add    $0x1,%rax
cmp    %rsi,%rax
je     13e0 <main+0x270>
mov    %rax,%rbx
cmp    %rax,%rcx
je     13b8 <main+0x248>
lea    0x1(%rbp),%edx
mov    %edx,%eax
neg    %eax
cmovs  %edx,%eax
cmp    %r15d,%eax
jg     13b8 <main+0x248>
mov    %r9,-0x8(%rdi,%rbx,8)
lea    0x1(%rbx),%rax
cmp    %rax,%rcx
je     1390 <main+0x220>
mov    %ebp,%edx
neg    %edx
cmovs  %ebp,%edx
cmp    %r15d,%edx
jg     1390 <main+0x220>
mov    %r9,(%rdi,%rbx,8)
jmp    1390 <main+0x220>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x2,%rbx
test   $0x1,%r11b
jne    13fc <main+0x28c>
jmp    1360 <main+0x1f0>
nop
xor    %ebx,%ebx
test   $0x1,%r11b
je     1360 <main+0x1f0>
cmp    %rbx,%rcx
je     1360 <main+0x1f0>
mov    %ecx,%eax
sub    %ebx,%eax
mov    %eax,%edx
neg    %edx
cmovs  %eax,%edx
cmp    %r15d,%edx
jg     1360 <main+0x1f0>
mov    %rcx,%rax
imul   %r8,%rax
add    %rax,%rbx
mov    0x8(%rsp),%rax
mov    %r9,(%rax,%rbx,8)
jmp    1360 <main+0x1f0>
cmp    $0x4,%r13d
jae    1448 <main+0x2d8>
xor    %ecx,%ecx
mov    0x8(%rsp),%rbx
mov    0x10(%rsp),%rbp
jmp    1559 <main+0x3e9>
mov    %r11d,%ecx
and    $0xfffffffc,%ecx
lea    -0x4(%rcx),%rsi
mov    %rsi,%rdx
shr    $0x2,%rdx
add    $0x1,%rdx
mov    %edx,%eax
and    $0x7,%eax
cmp    $0x1c,%rsi
mov    0x8(%rsp),%rbx
mov    0x10(%rsp),%rbp
jae    1479 <main+0x309>
xor    %esi,%esi
jmp    1525 <main+0x3b5>
and    $0xfffffffffffffff8,%rdx
xor    %esi,%esi
movapd 0xb79(%rip),%xmm0
nopw   0x0(%rax,%rax,1)
movupd %xmm0,(%r12,%rsi,8)
movupd %xmm0,0x10(%r12,%rsi,8)
movupd %xmm0,0x20(%r12,%rsi,8)
movupd %xmm0,0x30(%r12,%rsi,8)
movupd %xmm0,0x40(%r12,%rsi,8)
movupd %xmm0,0x50(%r12,%rsi,8)
movupd %xmm0,0x60(%r12,%rsi,8)
movupd %xmm0,0x70(%r12,%rsi,8)
movupd %xmm0,0x80(%r12,%rsi,8)
movupd %xmm0,0x90(%r12,%rsi,8)
movupd %xmm0,0xa0(%r12,%rsi,8)
movupd %xmm0,0xb0(%r12,%rsi,8)
movupd %xmm0,0xc0(%r12,%rsi,8)
movupd %xmm0,0xd0(%r12,%rsi,8)
movupd %xmm0,0xe0(%r12,%rsi,8)
movupd %xmm0,0xf0(%r12,%rsi,8)
add    $0x20,%rsi
add    $0xfffffffffffffff8,%rdx
jne    1490 <main+0x320>
test   %rax,%rax
je     1554 <main+0x3e4>
lea    (%r12,%rsi,8),%rdx
add    $0x10,%rdx
shl    $0x5,%rax
xor    %esi,%esi
movapd 0xac0(%rip),%xmm0
movupd %xmm0,-0x10(%rdx,%rsi,1)
movupd %xmm0,(%rdx,%rsi,1)
add    $0x20,%rsi
cmp    %rsi,%rax
jne    1540 <main+0x3d0>
cmp    %r11,%rcx
je     157d <main+0x40d>
movabs $0x3ff0000000000000,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rax,(%r12,%rcx,8)
add    $0x1,%rcx
cmp    %rcx,%r11
jne    1570 <main+0x400>
lea    0x40(%rsp),%rdi
xor    %esi,%esi
call   1050 <gettimeofday@plt>
mov    %r13d,%edi
mov    %r15d,%esi
mov    %rbx,%rdx
mov    %r12,%rcx
mov    %rbp,%r8
call   1090 <matvec@plt>
lea    0x30(%rsp),%rdi
xor    %esi,%esi
call   1050 <gettimeofday@plt>
movapd 0x30(%rsp),%xmm1
subpd  0x40(%rsp),%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
divsd  0xa4b(%rip),%xmm0
addsd  %xmm1,%xmm0
lea    0xa74(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %rbp,%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"
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 %47
41: ; preds = %37
%42 = load i32, i32* %8
%43 = sitofp i32 %42 to double
%44 = load i32, i32* %9
%45 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), double %43, i32 %44)
%46 = call i32 @exit(i32 1)
unreachable
47: ; preds = %37
%48 = load i32, i32* %8
%49 = load i32, i32* %8
%50 = mul nsw i32 %48, %49
%51 = call i64 @calloc(i32 %50, i32 8)
%52 = inttoptr i64 %51 to double*
store double* %52, double** %10
%53 = load i32, i32* %8
%54 = call i64 @calloc(i32 %53, i32 8)
%55 = inttoptr i64 %54 to double*
store double* %55, double** %11
%56 = load i32, i32* %8
%57 = call i64 @calloc(i32 %56, i32 8)
%58 = inttoptr i64 %57 to double*
store double* %58, double** %12
store i32 0, i32* %6
br label %59
59: ; preds = %75, %47
%60 = load i32, i32* %6
%61 = load i32, i32* %8
%62 = icmp slt i32 %60, %61
br i1 %62, label %63, label %78
63: ; preds = %59
%64 = load i32, i32* %9
%65 = mul nsw i32 2, %64
%66 = sitofp i32 %65 to double
%67 = load double*, double** %10
%68 = load i32, i32* %6
%69 = load i32, i32* %8
%70 = mul nsw i32 %68, %69
%71 = load i32, i32* %6
%72 = add nsw i32 %70, %71
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds double, double* %67, i64 %73
store double %66, double* %74
br label %75
75: ; preds = %63
%76 = load i32, i32* %6
%77 = add nsw i32 %76, 1
store i32 %77, i32* %6
br label %59
78: ; preds = %59
store i32 0, i32* %6
br label %79
79: ; preds = %113, %78
%80 = load i32, i32* %6
%81 = load i32, i32* %8
%82 = icmp slt i32 %80, %81
br i1 %82, label %83, label %116
83: ; preds = %79
store i32 0, i32* %7
br label %84
84: ; preds = %109, %83
%85 = load i32, i32* %7
%86 = load i32, i32* %8
%87 = icmp slt i32 %85, %86
br i1 %87, label %88, label %112
88: ; preds = %84
%89 = load i32, i32* %6
%90 = load i32, i32* %7
%91 = icmp ne i32 %89, %90
br i1 %91, label %92, label %108
92: ; preds = %88
%93 = load i32, i32* %6
%94 = load i32, i32* %7
%95 = sub nsw i32 %93, %94
%96 = call i32 @abs(i32 %95)
%97 = load i32, i32* %9
%98 = icmp sle i32 %96, %97
br i1 %98, label %99, label %108
99: ; preds = %92
%100 = load double*, double** %10
%101 = load i32, i32* %6
%102 = load i32, i32* %8
%103 = mul nsw i32 %101, %102
%104 = load i32, i32* %7
%105 = add nsw i32 %103, %104
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds double, double* %100, i64 %106
store double -1.000000e+00, double* %107
br label %108
108: ; preds = %99, %92, %88
br label %109
109: ; preds = %108
%110 = load i32, i32* %7
%111 = add nsw i32 %110, 1
store i32 %111, i32* %7
br label %84
112: ; preds = %84
br label %113
113: ; preds = %112
%114 = load i32, i32* %6
%115 = add nsw i32 %114, 1
store i32 %115, i32* %6
br label %79
116: ; preds = %79
store i32 0, i32* %6
br label %117
117: ; preds = %126, %116
%118 = load i32, i32* %6
%119 = load i32, i32* %8
%120 = icmp slt i32 %118, %119
br i1 %120, label %121, label %129
121: ; preds = %117
%122 = load double*, double** %11
%123 = load i32, i32* %6
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds double, double* %122, i64 %124
store double 1.000000e+00, double* %125
br label %126
126: ; preds = %121
%127 = load i32, i32* %6
%128 = add nsw i32 %127, 1
store i32 %128, i32* %6
br label %117
129: ; preds = %117
%130 = call i32 @gettimeofday(%struct.timeval* %13, i32* null)
%131 = load i32, i32* %8
%132 = load i32, i32* %9
%133 = load double*, double** %10
%134 = load double*, double** %11
%135 = load double*, double** %12
%136 = call i32 @matvec(i32 %131, i32 %132, double* %133, double* %134, double* %135)
%137 = call i32 @gettimeofday(%struct.timeval* %14, i32* null)
%138 = getelementptr inbounds %struct.timeval, %struct.timeval* %14, i32 0, i32 0
%139 = load double, double* %138
%140 = getelementptr inbounds %struct.timeval, %struct.timeval* %13, i32 0, i32 0
%141 = load double, double* %140
%142 = fsub double %139, %141
%143 = getelementptr inbounds %struct.timeval, %struct.timeval* %14, i32 0, i32 1
%144 = load double, double* %143
%145 = getelementptr inbounds %struct.timeval, %struct.timeval* %13, i32 0, i32 1
%146 = load double, double* %145
%147 = fsub double %144, %146
%148 = fdiv double %147, 1.000000e+06
%149 = fadd double %142, %148
store double %149, double* %15
%150 = load double, double* %15
%151 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), double %150)
%152 = load double*, double** %10
%153 = call i32 @free(double* %152)
%154 = load double*, double** %11
%155 = call i32 @free(double* %154)
%156 = load double*, double** %12
%157 = call i32 @free(double* %156)
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"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca <2 x double>
%4 = alloca <2 x double>
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %26
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @atoi(i8* %8)
%10 = icmp slt i32 %9, 0
%11 = select i1 %10, i32 50, i32 %9
%12 = icmp eq i32 %0, 2
br i1 %12, label %19, label %13
13: ; preds = %6
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = tail call i32 @atoi(i8* %15)
%17 = icmp slt i32 %16, 0
%18 = select i1 %17, i32 1, i32 %16
br label %19
19: ; preds = %13, %6
%20 = phi i32 [ %18, %13 ], [ 1, %6 ]
%21 = icmp ult i32 %20, %11
br i1 %21, label %26, label %22
22: ; preds = %19
%23 = sitofp i32 %11 to double
%24 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), double %23, i32 %20)
%25 = tail call i32 @exit(i32 1)
unreachable
26: ; preds = %19, %2
%27 = phi i32 [ %20, %19 ], [ 1, %2 ]
%28 = phi i32 [ %11, %19 ], [ 50, %2 ]
%29 = mul nsw i32 %28, %28
%30 = tail call i64 @calloc(i32 %29, i32 8)
%31 = inttoptr i64 %30 to double*
%32 = tail call i64 @calloc(i32 %28, i32 8)
%33 = inttoptr i64 %32 to double*
%34 = tail call i64 @calloc(i32 %28, i32 8)
%35 = inttoptr i64 %34 to double*
%36 = shl nuw nsw i32 %27, 1
%37 = sitofp i32 %36 to double
%38 = zext i32 %28 to i64
%39 = add nsw i64 %38, -1
%40 = and i64 %38, 3
%41 = icmp ult i64 %39, 3
br i1 %41, label %44, label %42
42: ; preds = %26
%43 = and i64 %38, 4294967292
br label %65
44: ; preds = %65, %26
%45 = phi i64 [ 0, %26 ], [ %91, %65 ]
%46 = icmp eq i64 %40, 0
br i1 %46, label %58, label %47
47: ; preds = %44, %47
%48 = phi i64 [ %55, %47 ], [ %45, %44 ]
%49 = phi i64 [ %56, %47 ], [ 0, %44 ]
%50 = trunc i64 %48 to i32
%51 = mul nsw i32 %28, %50
%52 = sext i32 %51 to i64
%53 = add nsw i64 %48, %52
%54 = getelementptr inbounds double, double* %31, i64 %53
store double %37, double* %54
%55 = add nuw nsw i64 %48, 1
%56 = add i64 %49, 1
%57 = icmp eq i64 %56, %40
br i1 %57, label %58, label %47
58: ; preds = %47, %44
%59 = sext i32 %28 to i64
%60 = zext i32 %28 to i64
%61 = and i64 %38, 1
%62 = icmp eq i64 %39, 0
%63 = and i64 %38, 4294967294
%64 = icmp eq i64 %61, 0
br label %94
65: ; preds = %65, %42
%66 = phi i64 [ 0, %42 ], [ %91, %65 ]
%67 = phi i64 [ 0, %42 ], [ %92, %65 ]
%68 = trunc i64 %66 to i32
%69 = mul nsw i32 %28, %68
%70 = sext i32 %69 to i64
%71 = add nsw i64 %66, %70
%72 = getelementptr inbounds double, double* %31, i64 %71
store double %37, double* %72
%73 = or i64 %66, 1
%74 = trunc i64 %73 to i32
%75 = mul nsw i32 %28, %74
%76 = sext i32 %75 to i64
%77 = add nsw i64 %73, %76
%78 = getelementptr inbounds double, double* %31, i64 %77
store double %37, double* %78
%79 = or i64 %66, 2
%80 = trunc i64 %79 to i32
%81 = mul nsw i32 %28, %80
%82 = sext i32 %81 to i64
%83 = add nsw i64 %79, %82
%84 = getelementptr inbounds double, double* %31, i64 %83
store double %37, double* %84
%85 = or i64 %66, 3
%86 = trunc i64 %85 to i32
%87 = mul nsw i32 %28, %86
%88 = sext i32 %87 to i64
%89 = add nsw i64 %85, %88
%90 = getelementptr inbounds double, double* %31, i64 %89
store double %37, double* %90
%91 = add nuw nsw i64 %66, 4
%92 = add i64 %67, 4
%93 = icmp eq i64 %92, %43
br i1 %93, label %44, label %65
94: ; preds = %210, %58
%95 = phi i64 [ 0, %58 ], [ %211, %210 ]
%96 = mul nsw i64 %95, %59
br i1 %62, label %198, label %171
97: ; preds = %210
%98 = zext i32 %28 to i64
%99 = icmp ult i32 %28, 4
br i1 %99, label %169, label %100
100: ; preds = %97
%101 = and i64 %38, 4294967292
%102 = add nsw i64 %101, -4
%103 = lshr exact i64 %102, 2
%104 = add nuw nsw i64 %103, 1
%105 = and i64 %104, 7
%106 = icmp ult i64 %102, 28
br i1 %106, label %154, label %107
107: ; preds = %100
%108 = and i64 %104, 9223372036854775800
br label %109
109: ; preds = %109, %107
%110 = phi i64 [ 0, %107 ], [ %151, %109 ]
%111 = phi i64 [ 0, %107 ], [ %152, %109 ]
%112 = getelementptr inbounds double, double* %33, i64 %110
%113 = bitcast double* %112 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %113
%114 = getelementptr inbounds double, double* %112, i64 2
%115 = bitcast double* %114 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %115
%116 = or i64 %110, 4
%117 = getelementptr inbounds double, double* %33, i64 %116
%118 = bitcast double* %117 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %118
%119 = getelementptr inbounds double, double* %117, i64 2
%120 = bitcast double* %119 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %120
%121 = or i64 %110, 8
%122 = getelementptr inbounds double, double* %33, i64 %121
%123 = bitcast double* %122 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %123
%124 = getelementptr inbounds double, double* %122, i64 2
%125 = bitcast double* %124 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %125
%126 = or i64 %110, 12
%127 = getelementptr inbounds double, double* %33, i64 %126
%128 = bitcast double* %127 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %128
%129 = getelementptr inbounds double, double* %127, i64 2
%130 = bitcast double* %129 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %130
%131 = or i64 %110, 16
%132 = getelementptr inbounds double, double* %33, i64 %131
%133 = bitcast double* %132 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %133
%134 = getelementptr inbounds double, double* %132, i64 2
%135 = bitcast double* %134 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %135
%136 = or i64 %110, 20
%137 = getelementptr inbounds double, double* %33, i64 %136
%138 = bitcast double* %137 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %138
%139 = getelementptr inbounds double, double* %137, i64 2
%140 = bitcast double* %139 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %140
%141 = or i64 %110, 24
%142 = getelementptr inbounds double, double* %33, i64 %141
%143 = bitcast double* %142 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %143
%144 = getelementptr inbounds double, double* %142, i64 2
%145 = bitcast double* %144 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %145
%146 = or i64 %110, 28
%147 = getelementptr inbounds double, double* %33, i64 %146
%148 = bitcast double* %147 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %148
%149 = getelementptr inbounds double, double* %147, i64 2
%150 = bitcast double* %149 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %150
%151 = add nuw i64 %110, 32
%152 = add i64 %111, 8
%153 = icmp eq i64 %152, %108
br i1 %153, label %154, label %109
154: ; preds = %109, %100
%155 = phi i64 [ 0, %100 ], [ %151, %109 ]
%156 = icmp eq i64 %105, 0
br i1 %156, label %167, label %157
157: ; preds = %154, %157
%158 = phi i64 [ %164, %157 ], [ %155, %154 ]
%159 = phi i64 [ %165, %157 ], [ 0, %154 ]
%160 = getelementptr inbounds double, double* %33, i64 %158
%161 = bitcast double* %160 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %161
%162 = getelementptr inbounds double, double* %160, i64 2
%163 = bitcast double* %162 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 1.000000e+00>, <2 x double>* %163
%164 = add nuw i64 %158, 4
%165 = add i64 %159, 1
%166 = icmp eq i64 %165, %105
br i1 %166, label %167, label %157
167: ; preds = %157, %154
%168 = icmp eq i64 %101, %38
br i1 %168, label %218, label %169
169: ; preds = %97, %167
%170 = phi i64 [ 0, %97 ], [ %101, %167 ]
br label %213
171: ; preds = %94, %194
%172 = phi i64 [ %195, %194 ], [ 0, %94 ]
%173 = phi i64 [ %196, %194 ], [ 0, %94 ]
%174 = icmp eq i64 %95, %172
br i1 %174, label %183, label %175
175: ; preds = %171
%176 = sub nsw i64 %95, %172
%177 = trunc i64 %176 to i32
%178 = tail call i32 @llvm.abs.i32(i32 %177, i1 true)
%179 = icmp sgt i32 %178, %27
br i1 %179, label %183, label %180
180: ; preds = %175
%181 = add nsw i64 %172, %96
%182 = getelementptr inbounds double, double* %31, i64 %181
store double -1.000000e+00, double* %182
br label %183
183: ; preds = %171, %175, %180
%184 = or i64 %172, 1
%185 = icmp eq i64 %95, %184
br i1 %185, label %194, label %186
186: ; preds = %183
%187 = sub nsw i64 %95, %184
%188 = trunc i64 %187 to i32
%189 = tail call i32 @llvm.abs.i32(i32 %188, i1 true)
%190 = icmp sgt i32 %189, %27
br i1 %190, label %194, label %191
191: ; preds = %186
%192 = add nsw i64 %184, %96
%193 = getelementptr inbounds double, double* %31, i64 %192
store double -1.000000e+00, double* %193
br label %194
194: ; preds = %191, %186, %183
%195 = add nuw nsw i64 %172, 2
%196 = add i64 %173, 2
%197 = icmp eq i64 %196, %63
br i1 %197, label %198, label %171
198: ; preds = %194, %94
%199 = phi i64 [ 0, %94 ], [ %195, %194 ]
%200 = icmp eq i64 %95, %199
%201 = select i1 %64, i1 true, i1 %200
br i1 %201, label %210, label %202
202: ; preds = %198
%203 = sub nsw i64 %95, %199
%204 = trunc i64 %203 to i32
%205 = tail call i32 @llvm.abs.i32(i32 %204, i1 true)
%206 = icmp sgt i32 %205, %27
br i1 %206, label %210, label %207
207: ; preds = %202
%208 = add nsw i64 %199, %96
%209 = getelementptr inbounds double, double* %31, i64 %208
store double -1.000000e+00, double* %209
br label %210
210: ; preds = %202, %207, %198
%211 = add nuw nsw i64 %95, 1
%212 = icmp eq i64 %211, %60
br i1 %212, label %97, label %94
213: ; preds = %169, %213
%214 = phi i64 [ %216, %213 ], [ %170, %169 ]
%215 = getelementptr inbounds double, double* %33, i64 %214
store double 1.000000e+00, double* %215
%216 = add nuw nsw i64 %214, 1
%217 = icmp eq i64 %216, %98
br i1 %217, label %218, label %213
218: ; preds = %213, %167
%219 = bitcast <2 x double>* %3 to %struct.timeval*
%220 = bitcast <2 x double>* %4 to %struct.timeval*
%221 = bitcast <2 x double>* %3 to i8*
%222 = bitcast <2 x double>* %4 to i8*
%223 = call i32 @gettimeofday(%struct.timeval* %219, i32* null)
%224 = tail call i32 @matvec(i32 %28, i32 %27, double* %31, double* %33, double* %35)
%225 = call i32 @gettimeofday(%struct.timeval* %220, i32* null)
%226 = load <2 x double>, <2 x double>* %4
%227 = load <2 x double>, <2 x double>* %3
%228 = fsub <2 x double> %226, %227
%229 = extractelement <2 x double> %228, i64 1
%230 = fdiv double %229, 1.000000e+06
%231 = extractelement <2 x double> %228, i64 0
%232 = fadd double %231, %230
%233 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), double %232)
%234 = tail call i32 @free(double* %31)
%235 = tail call i32 @free(double* %33)
%236 = tail call i32 @free(double* %35)
ret i32 0
}