#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
double DBL_EPSILON;
int /*<<< orphan*/ exit(int);
double fabs(double);
double norma_inf(double **, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ swap_rows(double **, int, int, int);
double lupp(int n, double **A, double *B, int *p) {
  int i = 0;
  int j = 0;
  int k = 0;
  int temp = 0;
  double detA = 1;
  double norma = norma_inf(A, n);
  double mult = 0;
  double dtemp = 0;
  printf("epsilon=%.60lf\n", DBL_EPSILON * norma);
  for (k = 0; k < n - 1; k++) {
    i = k;
    while (i < n && fabs(A[i][k]) < DBL_EPSILON * norma)
      i++;
    if (i != k) {
      swap_rows(A, i, k, n);
      temp = p[i];
      p[i] = p[k];
      p[k] = temp;
      dtemp = B[i];
      B[i] = B[k];
      B[k] = dtemp;
      detA *= -1;
    }
    printf("Etapa %d: %d <-> %d\n", k, k, i);
    detA *= A[k][k];
    if (detA == 0) {
      printf("La matriu A és singular.\n");
      exit(1);
    }
    for (i = k + 1; i < n; i++) {
      mult = A[i][k] / A[k][k];
      for (j = k + 1; j < n; j++) {
        A[i][j] -= mult * A[k][j];
      }
      B[i] -= mult * B[k];
      A[i][k] = 0;
    }
  }
  detA *= A[n - 1][n - 1];
  if (detA == 0) {
    printf("La matriu A és singular.\n");
    exit(1);
  }
  return detA;
}


x86 assembly (clang, -O0):
<lupp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
movsd  0xe85(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1050 <norma_inf@plt>
movsd  %xmm0,-0x40(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    0x2e40(%rip),%rax
movsd  (%rax),%xmm0
mulsd  -0x40(%rbp),%xmm0
lea    0xe68(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1482 <lupp+0x342>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%ecx
xor    %eax,%eax
cmp    -0x4(%rbp),%ecx
mov    %al,-0x51(%rbp)
jge    1228 <lupp+0xe8>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movaps 0xe06(%rip),%xmm0
pand   %xmm0,%xmm1
mov    0x2dd3(%rip),%rax
movsd  (%rax),%xmm0
mulsd  -0x40(%rbp),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
mov    %al,-0x51(%rbp)
mov    -0x51(%rbp),%al
test   $0x1,%al
jne    1238 <lupp+0xf8>
jmp    1246 <lupp+0x106>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11dd <lupp+0x9d>
mov    -0x24(%rbp),%eax
cmp    -0x2c(%rbp),%eax
je     12e6 <lupp+0x1a6>
mov    -0x10(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    -0x4(%rbp),%ecx
call   1040 <swap_rows@plt>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x30(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x30(%rbp),%edx
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x50(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  0xd2c(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x2c(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    -0x24(%rbp),%ecx
lea    0xd3a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    134c <lupp+0x20c>
jp     134c <lupp+0x20c>
lea    0xd0a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    146f <lupp+0x32f>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x2c(%rbp),%rcx
divsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1406 <lupp+0x2c6>
movsd  -0x48(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movq   %xmm0,%rdx
movabs $0x8000000000000000,%rsi
xor    %rsi,%rdx
movq   %rdx,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1399 <lupp+0x259>
movsd  -0x48(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movq   %xmm0,%rdx
movabs $0x8000000000000000,%rsi
xor    %rsi,%rdx
movq   %rdx,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x2c(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1355 <lupp+0x215>
jmp    1474 <lupp+0x334>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11c6 <lupp+0x86>
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    14db <lupp+0x39b>
jp     14db <lupp+0x39b>
lea    0xb7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
movsd  -0x38(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lupp>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    %rcx,0x58(%rsp)
mov    %rdx,%r15
mov    %edi,%ebp
mov    %rsi,0x10(%rsp)
mov    %rsi,%rdi
mov    %ebp,%esi
call   1060 <norma_inf@plt>
movapd %xmm0,%xmm1
mov    0x2e63(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm1,0x50(%rsp)
mulsd  %xmm1,%xmm0
lea    0xe96(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    -0x1(%rbp),%eax
cmp    $0x2,%ebp
mov    %eax,0x1c(%rsp)
jl     15ba <lupp+0x46a>
mov    %rbp,0x48(%rsp)
mov    %ebp,%r12d
mov    %eax,%eax
mov    %rax,0x60(%rsp)
mov    %r12,%rax
neg    %rax
mov    %rax,0x38(%rsp)
lea    -0x5(%r12),%rax
mov    %rax,0x30(%rsp)
movsd  0xe23(%rip),%xmm0
mov    $0x1,%r10d
mov    $0x7,%eax
mov    %rax,0x8(%rsp)
movapd 0xe1b(%rip),%xmm3
xor    %ebp,%ebp
mov    0x10(%rsp),%rdi
jmp    1228 <lupp+0xd8>
xchg   %ax,%ax
add    $0x1,%r10
addq   $0x1,0x8(%rsp)
addq   $0xffffffffffffffff,0x30(%rsp)
mov    0x68(%rsp),%rbp
cmp    0x60(%rsp),%rbp
movapd 0xdee(%rip),%xmm3
je     15c7 <lupp+0x477>
mov    %ebp,%eax
cmp    %r12,%rbp
jae    126f <lupp+0x11f>
mov    0x2db2(%rip),%rax
movsd  (%rax),%xmm2
mulsd  0x50(%rsp),%xmm2
mov    %rbp,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%rdi,%rax,8),%rcx
movsd  (%rcx,%rbp,8),%xmm1
andpd  %xmm3,%xmm1
ucomisd %xmm1,%xmm2
jbe    126f <lupp+0x11f>
add    $0x1,%rax
cmp    %rax,%r12
jne    1250 <lupp+0x100>
mov    %r12d,%eax
mov    %r10,0x40(%rsp)
mov    %eax,%r13d
cmp    %r13,%rbp
movapd %xmm0,0x20(%rsp)
jne    1290 <lupp+0x140>
mov    %rdi,%r14
jmp    12e1 <lupp+0x191>
nopw   0x0(%rax,%rax,1)
mov    %r13d,%esi
mov    %ebp,%edx
mov    0x48(%rsp),%rcx
mov    %rdi,%r14
call   1050 <swap_rows@plt>
mov    0x58(%rsp),%rdx
mov    (%rdx,%r13,4),%eax
mov    (%rdx,%rbp,4),%ecx
mov    %ecx,(%rdx,%r13,4)
mov    %eax,(%rdx,%rbp,4)
movsd  (%r15,%r13,8),%xmm0
movsd  (%r15,%rbp,8),%xmm1
movsd  %xmm1,(%r15,%r13,8)
movsd  %xmm0,(%r15,%rbp,8)
movapd 0x20(%rsp),%xmm0
xorpd  0xd45(%rip),%xmm0
movapd %xmm0,0x20(%rsp)
lea    0xd58(%rip),%rdi
mov    %ebp,%esi
mov    %ebp,%edx
mov    %r13d,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%r14,%rbp,8),%rcx
movsd  (%rcx,%rbp,8),%xmm1
movapd 0x20(%rsp),%xmm0
mulsd  %xmm1,%xmm0
ucomisd 0xcf7(%rip),%xmm0
jne    1319 <lupp+0x1c9>
jnp    15f3 <lupp+0x4a3>
mov    %r14,%rdi
lea    0x1(%rbp),%rax
mov    %rax,0x68(%rsp)
cmp    %r12,%rax
mov    0x38(%rsp),%r9
mov    0x40(%rsp),%r10
movapd 0xce5(%rip),%xmm8
jae    1200 <lupp+0xb0>
mov    0x30(%rsp),%rax
shr    $0x2,%rax
add    $0x1,%rax
mov    %rbp,%rbx
not    %rbx
lea    (%rbx,%r12,1),%rdx
add    $0xfffffffffffffffc,%rdx
mov    %rdx,0x90(%rsp)
shr    $0x2,%rdx
and    $0xfffffffffffffffe,%rax
mov    %rax,0x70(%rsp)
add    %r12,%rbx
add    $0x1,%rdx
mov    %rdx,0x88(%rsp)
lea    (%rcx,%r10,8),%rax
mov    %rax,0x20(%rsp)
lea    (%rcx,%r12,8),%r11
mov    %rbx,%rax
and    $0xfffffffffffffffc,%rax
mov    %rax,0x80(%rsp)
add    %r10,%rax
mov    %rax,0x78(%rsp)
mov    0x8(%rsp),%rax
lea    (%rcx,%rax,8),%r8
mov    %r10,%r14
mov    (%rdi,%r14,8),%r13
movsd  0x0(%r13,%rbp,8),%xmm7
xorpd  %xmm8,%xmm7
divsd  %xmm1,%xmm7
mov    %r10,%rsi
cmp    $0x4,%rbx
jb     1520 <lupp+0x3d0>
lea    0x0(,%r10,8),%rax
add    %r13,%rax
cmp    %r11,%rax
jae    13fa <lupp+0x2aa>
lea    0x0(,%r12,8),%rax
add    %r13,%rax
mov    %r10,%rsi
cmp    %rax,0x20(%rsp)
jb     1520 <lupp+0x3d0>
mov    %r11,%rdx
movapd %xmm7,%xmm1
unpcklpd %xmm7,%xmm1
cmpq   $0x4,0x90(%rsp)
jae    1418 <lupp+0x2c8>
xor    %r9d,%r9d
jmp    14ab <lupp+0x35b>
mov    0x8(%rsp),%rax
lea    0x0(,%rax,8),%r10
add    %r13,%r10
mov    0x70(%rsp),%r11
xor    %r9d,%r9d
movupd -0x30(%r8,%r9,8),%xmm2
movupd -0x20(%r8,%r9,8),%xmm3
mulpd  %xmm1,%xmm2
movupd -0x30(%r10,%r9,8),%xmm4
addpd  %xmm2,%xmm4
movupd -0x20(%r10,%r9,8),%xmm2
movupd -0x10(%r10,%r9,8),%xmm5
movupd (%r10,%r9,8),%xmm6
mulpd  %xmm1,%xmm3
addpd  %xmm2,%xmm3
movupd %xmm4,-0x30(%r10,%r9,8)
movupd %xmm3,-0x20(%r10,%r9,8)
movupd -0x10(%r8,%r9,8),%xmm2
movupd (%r8,%r9,8),%xmm3
mulpd  %xmm1,%xmm2
addpd  %xmm5,%xmm2
mulpd  %xmm1,%xmm3
addpd  %xmm6,%xmm3
movupd %xmm2,-0x10(%r10,%r9,8)
movupd %xmm3,(%r10,%r9,8)
add    $0x8,%r9
add    $0xfffffffffffffffe,%r11
jne    1430 <lupp+0x2e0>
testb  $0x1,0x88(%rsp)
01
mov    0x40(%rsp),%r10
mov    %rdx,%r11
je     14f9 <lupp+0x3a9>
add    %r10,%r9
movupd (%rcx,%r9,8),%xmm2
movupd 0x10(%rcx,%r9,8),%xmm3
movupd 0x0(%r13,%r9,8),%xmm4
movupd 0x10(%r13,%r9,8),%xmm5
mulpd  %xmm1,%xmm2
addpd  %xmm4,%xmm2
mulpd  %xmm1,%xmm3
addpd  %xmm5,%xmm3
movupd %xmm2,0x0(%r13,%r9,8)
movupd %xmm3,0x10(%r13,%r9,8)
mov    0x78(%rsp),%rsi
cmp    0x80(%rsp),%rbx
mov    0x10(%rsp),%rdi
mov    0x38(%rsp),%r9
je     1588 <lupp+0x438>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r12d,%edx
sub    %esi,%edx
mov    %rsi,%rax
test   $0x1,%dl
je     1548 <lupp+0x3f8>
movsd  (%rcx,%rsi,8),%xmm1
mulsd  %xmm7,%xmm1
addsd  0x0(%r13,%rsi,8),%xmm1
movsd  %xmm1,0x0(%r13,%rsi,8)
lea    0x1(%rsi),%rax
not    %rsi
cmp    %r9,%rsi
je     1588 <lupp+0x438>
movsd  (%rcx,%rax,8),%xmm1
mulsd  %xmm7,%xmm1
addsd  0x0(%r13,%rax,8),%xmm1
movsd  %xmm1,0x0(%r13,%rax,8)
movsd  0x8(%rcx,%rax,8),%xmm1
mulsd  %xmm7,%xmm1
addsd  0x8(%r13,%rax,8),%xmm1
movsd  %xmm1,0x8(%r13,%rax,8)
add    $0x2,%rax
cmp    %rax,%r12
jne    1550 <lupp+0x400>
mulsd  (%r15,%rbp,8),%xmm7
addsd  (%r15,%r14,8),%xmm7
movsd  %xmm7,(%r15,%r14,8)
movq   $0x0,0x0(%r13,%rbp,8)
add    $0x1,%r14
cmp    %r12,%r14
je     1200 <lupp+0xb0>
movsd  (%rcx,%rbp,8),%xmm1
jmp    13b0 <lupp+0x260>
movsd  0xa3e(%rip),%xmm0
mov    0x10(%rsp),%rdi
movslq 0x1c(%rsp),%rax
mov    (%rdi,%rax,8),%rcx
mulsd  (%rcx,%rax,8),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    15e1 <lupp+0x491>
jnp    15f3 <lupp+0x4a3>
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xa5b(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"epsilon=%.60lf\0A\00"
@DBL_EPSILON = global double 0.000000e+00
@.str.1 = [21 x i8] c"Etapa %d: %d <-> %d\0A\00"
@.str.2 = [27 x i8] c"La matriu A \C3\A9s singular.\0A\00"
define double @lupp(i32 %0, double** %1, double* %2, i32* %3) {
%5 = alloca i32
%6 = alloca double**
%7 = alloca double*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
store i32 %0, i32* %5
store double** %1, double*** %6
store double* %2, double** %7
store i32* %3, i32** %8
store i32 0, i32* %9
store i32 0, i32* %10
store i32 0, i32* %11
store i32 0, i32* %12
store double 1.000000e+00, double* %13
%17 = load double**, double*** %6
%18 = load i32, i32* %5
%19 = call double @norma_inf(double** %17, i32 %18)
store double %19, double* %14
store double 0.000000e+00, double* %15
store double 0.000000e+00, double* %16
%20 = load double, double* @DBL_EPSILON
%21 = load double, double* %14
%22 = fmul double %20, %21
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), double %22)
store i32 0, i32* %11
br label %24
24: ; preds = %210, %4
%25 = load i32, i32* %11
%26 = load i32, i32* %5
%27 = sub nsw i32 %26, 1
%28 = icmp slt i32 %25, %27
br i1 %28, label %29, label %213
29: ; preds = %24
%30 = load i32, i32* %11
store i32 %30, i32* %9
br label %31
31: ; preds = %52, %29
%32 = load i32, i32* %9
%33 = load i32, i32* %5
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %50
35: ; preds = %31
%36 = load double**, double*** %6
%37 = load i32, i32* %9
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds double*, double** %36, i64 %38
%40 = load double*, double** %39
%41 = load i32, i32* %11
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds double, double* %40, i64 %42
%44 = load double, double* %43
%45 = call double @llvm.fabs.f64(double %44)
%46 = load double, double* @DBL_EPSILON
%47 = load double, double* %14
%48 = fmul double %46, %47
%49 = fcmp olt double %45, %48
br label %50
50: ; preds = %35, %31
%51 = phi i1 [ false, %31 ], [ %49, %35 ]
br i1 %51, label %52, label %55
52: ; preds = %50
%53 = load i32, i32* %9
%54 = add nsw i32 %53, 1
store i32 %54, i32* %9
br label %31
55: ; preds = %50
%56 = load i32, i32* %9
%57 = load i32, i32* %11
%58 = icmp ne i32 %56, %57
br i1 %58, label %59, label %105
59: ; preds = %55
%60 = load double**, double*** %6
%61 = load i32, i32* %9
%62 = load i32, i32* %11
%63 = load i32, i32* %5
%64 = call i32 @swap_rows(double** %60, i32 %61, i32 %62, i32 %63)
%65 = load i32*, i32** %8
%66 = load i32, i32* %9
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds i32, i32* %65, i64 %67
%69 = load i32, i32* %68
store i32 %69, i32* %12
%70 = load i32*, i32** %8
%71 = load i32, i32* %11
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds i32, i32* %70, i64 %72
%74 = load i32, i32* %73
%75 = load i32*, i32** %8
%76 = load i32, i32* %9
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds i32, i32* %75, i64 %77
store i32 %74, i32* %78
%79 = load i32, i32* %12
%80 = load i32*, i32** %8
%81 = load i32, i32* %11
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds i32, i32* %80, i64 %82
store i32 %79, i32* %83
%84 = load double*, double** %7
%85 = load i32, i32* %9
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds double, double* %84, i64 %86
%88 = load double, double* %87
store double %88, double* %16
%89 = load double*, double** %7
%90 = load i32, i32* %11
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds double, double* %89, i64 %91
%93 = load double, double* %92
%94 = load double*, double** %7
%95 = load i32, i32* %9
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds double, double* %94, i64 %96
store double %93, double* %97
%98 = load double, double* %16
%99 = load double*, double** %7
%100 = load i32, i32* %11
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds double, double* %99, i64 %101
store double %98, double* %102
%103 = load double, double* %13
%104 = fmul double %103, -1.000000e+00
store double %104, double* %13
br label %105
105: ; preds = %59, %55
%106 = load i32, i32* %11
%107 = load i32, i32* %11
%108 = load i32, i32* %9
%109 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %106, i32 %107, i32 %108)
%110 = load double**, double*** %6
%111 = load i32, i32* %11
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds double*, double** %110, i64 %112
%114 = load double*, double** %113
%115 = load i32, i32* %11
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds double, double* %114, i64 %116
%118 = load double, double* %117
%119 = load double, double* %13
%120 = fmul double %119, %118
store double %120, double* %13
%121 = load double, double* %13
%122 = fcmp oeq double %121, 0.000000e+00
br i1 %122, label %123, label %126
123: ; preds = %105
%124 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%125 = call i32 @exit(i32 1)
unreachable
126: ; preds = %105
%127 = load i32, i32* %11
%128 = add nsw i32 %127, 1
store i32 %128, i32* %9
br label %129
129: ; preds = %206, %126
%130 = load i32, i32* %9
%131 = load i32, i32* %5
%132 = icmp slt i32 %130, %131
br i1 %132, label %133, label %209
133: ; preds = %129
%134 = load double**, double*** %6
%135 = load i32, i32* %9
%136 = sext i32 %135 to i64
%137 = getelementptr inbounds double*, double** %134, i64 %136
%138 = load double*, double** %137
%139 = load i32, i32* %11
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds double, double* %138, i64 %140
%142 = load double, double* %141
%143 = load double**, double*** %6
%144 = load i32, i32* %11
%145 = sext i32 %144 to i64
%146 = getelementptr inbounds double*, double** %143, i64 %145
%147 = load double*, double** %146
%148 = load i32, i32* %11
%149 = sext i32 %148 to i64
%150 = getelementptr inbounds double, double* %147, i64 %149
%151 = load double, double* %150
%152 = fdiv double %142, %151
store double %152, double* %15
%153 = load i32, i32* %11
%154 = add nsw i32 %153, 1
store i32 %154, i32* %10
br label %155
155: ; preds = %181, %133
%156 = load i32, i32* %10
%157 = load i32, i32* %5
%158 = icmp slt i32 %156, %157
br i1 %158, label %159, label %184
159: ; preds = %155
%160 = load double, double* %15
%161 = load double**, double*** %6
%162 = load i32, i32* %11
%163 = sext i32 %162 to i64
%164 = getelementptr inbounds double*, double** %161, i64 %163
%165 = load double*, double** %164
%166 = load i32, i32* %10
%167 = sext i32 %166 to i64
%168 = getelementptr inbounds double, double* %165, i64 %167
%169 = load double, double* %168
%170 = load double**, double*** %6
%171 = load i32, i32* %9
%172 = sext i32 %171 to i64
%173 = getelementptr inbounds double*, double** %170, i64 %172
%174 = load double*, double** %173
%175 = load i32, i32* %10
%176 = sext i32 %175 to i64
%177 = getelementptr inbounds double, double* %174, i64 %176
%178 = load double, double* %177
%179 = fneg double %160
%180 = call double @llvm.fmuladd.f64(double %179, double %169, double %178)
store double %180, double* %177
br label %181
181: ; preds = %159
%182 = load i32, i32* %10
%183 = add nsw i32 %182, 1
store i32 %183, i32* %10
br label %155
184: ; preds = %155
%185 = load double, double* %15
%186 = load double*, double** %7
%187 = load i32, i32* %11
%188 = sext i32 %187 to i64
%189 = getelementptr inbounds double, double* %186, i64 %188
%190 = load double, double* %189
%191 = load double*, double** %7
%192 = load i32, i32* %9
%193 = sext i32 %192 to i64
%194 = getelementptr inbounds double, double* %191, i64 %193
%195 = load double, double* %194
%196 = fneg double %185
%197 = call double @llvm.fmuladd.f64(double %196, double %190, double %195)
store double %197, double* %194
%198 = load double**, double*** %6
%199 = load i32, i32* %9
%200 = sext i32 %199 to i64
%201 = getelementptr inbounds double*, double** %198, i64 %200
%202 = load double*, double** %201
%203 = load i32, i32* %11
%204 = sext i32 %203 to i64
%205 = getelementptr inbounds double, double* %202, i64 %204
store double 0.000000e+00, double* %205
br label %206
206: ; preds = %184
%207 = load i32, i32* %9
%208 = add nsw i32 %207, 1
store i32 %208, i32* %9
br label %129
209: ; preds = %129
br label %210
210: ; preds = %209
%211 = load i32, i32* %11
%212 = add nsw i32 %211, 1
store i32 %212, i32* %11
br label %24
213: ; preds = %24
%214 = load double**, double*** %6
%215 = load i32, i32* %5
%216 = sub nsw i32 %215, 1
%217 = sext i32 %216 to i64
%218 = getelementptr inbounds double*, double** %214, i64 %217
%219 = load double*, double** %218
%220 = load i32, i32* %5
%221 = sub nsw i32 %220, 1
%222 = sext i32 %221 to i64
%223 = getelementptr inbounds double, double* %219, i64 %222
%224 = load double, double* %223
%225 = load double, double* %13
%226 = fmul double %225, %224
store double %226, double* %13
%227 = load double, double* %13
%228 = fcmp oeq double %227, 0.000000e+00
br i1 %228, label %229, label %232
229: ; preds = %213
%230 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%231 = call i32 @exit(i32 1)
unreachable
232: ; preds = %213
%233 = load double, double* %13
ret double %233
}

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