#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 */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int);
int /*<<< orphan*/ free(double *);
scalar_t__ malloc(unsigned int const);
int /*<<< orphan*/ memcpy(double *, double *, unsigned int const);
int /*<<< orphan*/ stderr;
void matrix_transpose(double M[], const unsigned int m, const unsigned int n) {
  unsigned int i, j;
  double *buffer;
  if (m == n) {
    double swap;
    for (i = 0; i < n; ++i) {
      for (j = i + 1; j < n; ++j) {
        swap = M[i * n + j];
        M[i * n + j] = M[j * n + i];
        M[j * n + i] = swap;
      }
    }
    return;
  }
  buffer = (double *)malloc(n * m * sizeof(double));
  if (NULL == buffer) {
    fprintf(stderr, "Cannot allocate memory [%s:%d]\n",
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/erpicci/cp151602/refs/heads/master/src/"
            "algorithms/basic_la.c",
            125);
    exit(EXIT_FAILURE);
  }
  for (i = 0; i < n; ++i) {
    for (j = 0; j < m; ++j) {
      buffer[i * m + j] = M[j * n + i];
    }
  }
  memcpy(M, buffer, n * m * sizeof(double));
  free(buffer);
}


x86 assembly (clang, -O0):
<matrix_transpose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    121a <matrix_transpose+0xca>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jae    1215 <matrix_transpose+0xc5>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jae    1202 <matrix_transpose+0xb2>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
imul   -0x10(%rbp),%ecx
add    -0x18(%rbp),%ecx
mov    %ecx,%ecx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
imul   -0x10(%rbp),%ecx
add    -0x14(%rbp),%ecx
mov    %ecx,%ecx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
imul   -0x10(%rbp),%ecx
add    -0x18(%rbp),%ecx
mov    %ecx,%ecx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x28(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
imul   -0x10(%rbp),%ecx
add    -0x14(%rbp),%ecx
mov    %ecx,%ecx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    118a <matrix_transpose+0x3a>
jmp    1207 <matrix_transpose+0xb7>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1175 <matrix_transpose+0x25>
jmp    1303 <matrix_transpose+0x1b3>
mov    -0x10(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,%eax
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
cmp    -0x20(%rbp),%rax
jne    126d <matrix_transpose+0x11d>
mov    0x2d9b(%rip),%rax
mov    (%rax),%edi
lea    0xdb2(%rip),%rsi
lea    0xdcb(%rip),%rdx
mov    $0x7d,%ecx
call   1040 <fprintf@plt>
mov    0x2d72(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jae    12de <matrix_transpose+0x18e>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    12cb <matrix_transpose+0x17b>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
imul   -0x10(%rbp),%ecx
add    -0x14(%rbp),%ecx
mov    %ecx,%ecx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x14(%rbp),%ecx
imul   -0xc(%rbp),%ecx
add    -0x18(%rbp),%ecx
mov    %ecx,%ecx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1287 <matrix_transpose+0x137>
jmp    12d0 <matrix_transpose+0x180>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1274 <matrix_transpose+0x124>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,%eax
shl    $0x3,%rax
mov    %eax,%edx
call   1050 <memcpy@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matrix_transpose>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %esi,%r12d
mov    %rdi,%rbx
cmp    %edx,%esi
jne    1424 <matrix_transpose+0x2d4>
test   %r12d,%r12d
je     16cd <matrix_transpose+0x57d>
lea    -0x2(%r12),%r9d
mov    %r12d,%r13d
neg    %r13d
lea    (%r12,%r12,4),%eax
mov    %eax,0x20(%rsp)
lea    0x1(%r12),%eax
mov    %eax,0x58(%rsp)
lea    0x0(,%r12,8),%eax
mov    %eax,0x64(%rsp)
lea    (%r12,%r12,1),%r8d
mov    $0x1,%r14d
movl   $0x5,0x10(%rsp)
xor    %r15d,%r15d
mov    %r9d,0x18(%rsp)
mov    %r12d,%r11d
xor    %eax,%eax
mov    %r13d,0x30(%rsp)
mov    %r9d,0x28(%rsp)
mov    %r12,0x50(%rsp)
jmp    11f8 <matrix_transpose+0xa8>
nopl   (%rax)
add    $0x1,%r14
mov    0x58(%rsp),%eax
add    %eax,0x20(%rsp)
add    %eax,0x10(%rsp)
add    %eax,%r11d
addl   $0xffffffff,0x18(%rsp)
add    %r12d,%r15d
mov    0x8(%rsp),%eax
cmp    %r12d,%eax
je     16cd <matrix_transpose+0x57d>
mov    %eax,%edi
lea    0x1(%rdi),%eax
mov    %eax,0x8(%rsp)
cmp    %r12d,%eax
jae    11d0 <matrix_transpose+0x80>
mov    %r9d,%edx
sub    %edi,%edx
mov    %edi,%eax
imul   %r12d,%eax
mov    %r14,%r10
cmp    $0x3,%edx
jb     1380 <matrix_transpose+0x230>
mov    %r14,%r10
cmp    $0x1,%r12d
jne    1380 <matrix_transpose+0x230>
mov    %edi,%ecx
not    %ecx
add    %ecx,%ecx
mov    %r14,%r10
cmp    %edx,%ecx
jb     1380 <matrix_transpose+0x230>
mov    %rax,0x40(%rsp)
mov    %rdi,0x48(%rsp)
add    $0x1,%rdx
mov    %rdx,0x38(%rsp)
mov    %rdx,%r10
movabs $0x1fffffffc,%rcx
and    %rcx,%r10
lea    -0x4(%r10),%rcx
mov    %rcx,%rax
shr    $0x2,%rax
add    $0x1,%rax
test   %rcx,%rcx
je     1316 <matrix_transpose+0x1c6>
mov    0x18(%rsp),%r13d
add    $0x1,%r13
and    $0xfffffffffffffffc,%r13
add    $0xfffffffffffffffc,%r13
shr    $0x2,%r13
add    $0x1,%r13
and    $0xfffffffffffffffe,%r13
mov    %r11d,%edx
mov    0x10(%rsp),%ecx
mov    0x20(%rsp),%r12d
xor    %r9d,%r9d
mov    0x64(%rsp),%edi
cs nopw 0x0(%rax,%rax,1)
lea    -0x4(%rcx),%esi
movups (%rbx,%rsi,8),%xmm0
movups 0x10(%rbx,%rsi,8),%xmm1
mov    %edx,%ebp
movups (%rbx,%rbp,8),%xmm2
movups 0x10(%rbx,%rbp,8),%xmm3
movups %xmm2,(%rbx,%rsi,8)
movups %xmm3,0x10(%rbx,%rsi,8)
movups %xmm0,(%rbx,%rbp,8)
movups %xmm1,0x10(%rbx,%rbp,8)
mov    %ecx,%esi
movups (%rbx,%rsi,8),%xmm0
movups 0x10(%rbx,%rsi,8),%xmm1
mov    %r12d,%ebp
movups (%rbx,%rbp,8),%xmm2
movups 0x10(%rbx,%rbp,8),%xmm3
movups %xmm2,(%rbx,%rsi,8)
movups %xmm3,0x10(%rbx,%rsi,8)
movups %xmm0,(%rbx,%rbp,8)
movups %xmm1,0x10(%rbx,%rbp,8)
add    $0x8,%r9
add    %edi,%r12d
add    $0x8,%ecx
add    %edi,%edx
add    $0xfffffffffffffffe,%r13
jne    12b0 <matrix_transpose+0x160>
jmp    1319 <matrix_transpose+0x1c9>
xor    %r9d,%r9d
test   $0x1,%al
mov    0x50(%rsp),%r12
mov    0x48(%rsp),%rdi
mov    0x40(%rsp),%rax
je     1362 <matrix_transpose+0x212>
add    %r14d,%r9d
lea    (%rax,%r9,1),%ecx
movups (%rbx,%rcx,8),%xmm0
movups 0x10(%rbx,%rcx,8),%xmm1
imul   %r12d,%r9d
add    %edi,%r9d
movups (%rbx,%r9,8),%xmm2
movups 0x10(%rbx,%r9,8),%xmm3
movups %xmm2,(%rbx,%rcx,8)
movups %xmm3,0x10(%rbx,%rcx,8)
movups %xmm0,(%rbx,%r9,8)
movups %xmm1,0x10(%rbx,%r9,8)
cmp    %r10,0x38(%rsp)
mov    0x28(%rsp),%r9d
mov    0x30(%rsp),%r13d
je     11d0 <matrix_transpose+0x80>
add    %r14,%r10
nopw   0x0(%rax,%rax,1)
mov    %r12d,%ecx
sub    %r10d,%ecx
test   $0x1,%cl
jne    1390 <matrix_transpose+0x240>
mov    %r10,%rdx
jmp    13b7 <matrix_transpose+0x267>
add    %r10d,%eax
movsd  (%rbx,%rax,8),%xmm0
mov    %r10d,%ecx
imul   %r12d,%ecx
add    %edi,%ecx
movsd  (%rbx,%rcx,8),%xmm1
movsd  %xmm1,(%rbx,%rax,8)
movsd  %xmm0,(%rbx,%rcx,8)
mov    %r10,%rdx
add    $0x1,%rdx
not    %r10d
cmp    %r13d,%r10d
je     11d0 <matrix_transpose+0x80>
lea    (%r15,%rdx,1),%ecx
lea    0x1(%rdx),%ebp
imul   %r12d,%ebp
add    %edi,%ebp
mov    %r12d,%esi
sub    %edx,%esi
imul   %r12d,%edx
add    %edi,%edx
nopl   0x0(%rax,%rax,1)
mov    %ecx,%edi
movsd  (%rbx,%rdi,8),%xmm0
mov    %edx,%eax
movsd  (%rbx,%rax,8),%xmm1
movsd  %xmm1,(%rbx,%rdi,8)
movsd  %xmm0,(%rbx,%rax,8)
lea    0x1(%rcx),%eax
movsd  (%rbx,%rax,8),%xmm0
mov    %ebp,%edi
movsd  (%rbx,%rdi,8),%xmm1
movsd  %xmm1,(%rbx,%rax,8)
movsd  %xmm0,(%rbx,%rdi,8)
add    $0x2,%ecx
add    %r8d,%ebp
add    %r8d,%edx
add    $0xfffffffe,%esi
jne    13e0 <matrix_transpose+0x290>
jmp    11d0 <matrix_transpose+0x80>
mov    %edx,%r15d
mov    %r12d,%edi
imul   %edx,%edi
shl    $0x3,%edi
mov    %edi,0x38(%rsp)
call   1060 <malloc@plt>
test   %rax,%rax
je     1701 <matrix_transpose+0x5b1>
mov    %rax,%rbp
test   %r15d,%r15d
je     16dc <matrix_transpose+0x58c>
mov    %r12d,%eax
lea    -0x1(%rax),%rcx
mov    %rcx,0x10(%rsp)
lea    0x0(,%rax,8),%rcx
add    %rbp,%rcx
mov    %rcx,0x18(%rsp)
mov    %eax,%ecx
and    $0xfffffffc,%ecx
mov    %rcx,0x58(%rsp)
add    $0xfffffffffffffffc,%rcx
mov    %rcx,0x48(%rsp)
mov    %rcx,%rdx
shr    $0x2,%rdx
add    $0x1,%rdx
mov    %rdx,%rcx
mov    %rdx,0x40(%rsp)
and    $0xfffffffffffffffe,%rdx
mov    %rdx,0x30(%rsp)
mov    %rax,0x8(%rsp)
neg    %rax
mov    %rax,0x20(%rsp)
lea    0x0(,%r15,4),%eax
mov    %rax,0x28(%rsp)
lea    0x0(,%r15,8),%r14d
lea    (%r15,%r15,1),%r8d
mov    $0x4,%r9d
xor    %r10d,%r10d
xor    %r11d,%r11d
mov    %r12,0x50(%rsp)
jmp    14f3 <matrix_transpose+0x3a3>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%r11
add    %r12d,%r9d
add    %r12d,%r10d
cmp    %r15d,%r11d
je     16dc <matrix_transpose+0x58c>
test   %r12d,%r12d
je     14e0 <matrix_transpose+0x390>
mov    %r11d,%r13d
imul   %r12d,%r13d
cmp    $0x4,%r12d
jb     1580 <matrix_transpose+0x430>
mov    %r13d,%eax
mov    0x10(%rsp),%rdx
add    %edx,%eax
setb   %cl
mov    %r11d,%eax
add    %edx,%eax
setb   %al
cmp    $0x1,%r15d
jne    1580 <matrix_transpose+0x430>
test   %cl,%cl
jne    1580 <matrix_transpose+0x430>
mov    0x10(%rsp),%rcx
shr    $0x20,%rcx
jne    1580 <matrix_transpose+0x430>
test   %al,%al
jne    1580 <matrix_transpose+0x430>
mov    $0x0,%edx
test   %rcx,%rcx
jne    1582 <matrix_transpose+0x432>
mov    0x8(%rsp),%rax
add    %r11,%rax
lea    0x0(,%r13,8),%rcx
add    %rbp,%rcx
lea    (%rbx,%rax,8),%rax
cmp    %rax,%rcx
jae    1613 <matrix_transpose+0x4c3>
mov    0x18(%rsp),%rax
lea    (%rax,%r13,8),%rax
lea    (%rbx,%r11,8),%rcx
cmp    %rax,%rcx
jae    1613 <matrix_transpose+0x4c3>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %edx,%edx
mov    %rdx,%rsi
testb  $0x1,0x8(%rsp)
je     15ab <matrix_transpose+0x45b>
add    %edx,%r13d
mov    %edx,%eax
imul   %r15d,%eax
add    %r11d,%eax
movsd  (%rbx,%rax,8),%xmm0
movsd  %xmm0,0x0(%rbp,%r13,8)
mov    %rdx,%rsi
or     $0x1,%rsi
not    %rdx
cmp    0x20(%rsp),%rdx
je     14e0 <matrix_transpose+0x390>
lea    0x1(%rsi),%edx
imul   %r15d,%edx
add    %r11d,%edx
lea    (%r10,%rsi,1),%ecx
mov    0x8(%rsp),%rax
sub    %rsi,%rax
mov    %r15d,%edi
imul   %esi,%edi
add    %r11d,%edi
nopl   0x0(%rax,%rax,1)
mov    %edi,%esi
movsd  (%rbx,%rsi,8),%xmm0
mov    %ecx,%esi
movsd  %xmm0,0x0(%rbp,%rsi,8)
mov    %edx,%esi
movsd  (%rbx,%rsi,8),%xmm0
lea    0x1(%rcx),%esi
movsd  %xmm0,0x0(%rbp,%rsi,8)
add    %r8d,%edx
add    $0x2,%ecx
add    %r8d,%edi
add    $0xfffffffffffffffe,%rax
jne    15e0 <matrix_transpose+0x490>
jmp    14e0 <matrix_transpose+0x390>
cmpq   $0x0,0x48(%rsp)
je     16c2 <matrix_transpose+0x572>
mov    0x30(%rsp),%r12
mov    %r9d,%eax
mov    %r11d,%ecx
xor    %edx,%edx
mov    0x28(%rsp),%rdi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ecx,%esi
movups (%rbx,%rsi,8),%xmm0
movups 0x10(%rbx,%rsi,8),%xmm1
lea    -0x4(%rax),%esi
movups %xmm0,0x0(%rbp,%rsi,8)
movups %xmm1,0x10(%rbp,%rsi,8)
lea    (%rdi,%rcx,1),%esi
movups (%rbx,%rsi,8),%xmm0
movups 0x10(%rbx,%rsi,8),%xmm1
mov    %eax,%esi
movups %xmm0,0x0(%rbp,%rsi,8)
movups %xmm1,0x10(%rbp,%rsi,8)
add    $0x8,%rdx
add    %r14d,%ecx
add    $0x8,%eax
add    $0xfffffffffffffffe,%r12
jne    1640 <matrix_transpose+0x4f0>
testb  $0x1,0x40(%rsp)
je     16a5 <matrix_transpose+0x555>
lea    (%rdx,%r13,1),%eax
imul   %r15d,%edx
add    %r11d,%edx
movups (%rbx,%rdx,8),%xmm0
movups 0x10(%rbx,%rdx,8),%xmm1
movups %xmm0,0x0(%rbp,%rax,8)
movups %xmm1,0x10(%rbp,%rax,8)
mov    0x58(%rsp),%rax
mov    %rax,%rdx
cmp    0x8(%rsp),%rax
mov    0x50(%rsp),%r12
je     14e0 <matrix_transpose+0x390>
jmp    1582 <matrix_transpose+0x432>
xor    %edx,%edx
testb  $0x1,0x40(%rsp)
jne    1687 <matrix_transpose+0x537>
jmp    16a5 <matrix_transpose+0x555>
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    0x38(%rsp),%edx
call   1050 <memcpy@plt>
mov    %rbp,%rdi
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>
mov    0x28d8(%rip),%rax
mov    (%rax),%edi
lea    0x8ef(%rip),%rsi
lea    0x908(%rip),%rdx
mov    $0x7d,%ecx
call   1040 <fprintf@plt>
mov    0x28af(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [32 x i8] c"Cannot allocate memory [%s:%d]\0A\00"
@.str.1 = [151 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/erpicci/cp151602/refs/heads/master/src/algorithms/basic_la.c\00"
@EXIT_FAILURE = global i32 0
define void @matrix_transpose(double* %0, i32 %1, i32 %2) {
%4 = alloca double*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca double*
%10 = alloca double
store double* %0, double** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = icmp eq i32 %11, %12
br i1 %13, label %14, label %70
14: ; preds = %3
store i32 0, i32* %7
br label %15
15: ; preds = %66, %14
%16 = load i32, i32* %7
%17 = load i32, i32* %6
%18 = icmp ult i32 %16, %17
br i1 %18, label %19, label %69
19: ; preds = %15
%20 = load i32, i32* %7
%21 = add i32 %20, 1
store i32 %21, i32* %8
br label %22
22: ; preds = %62, %19
%23 = load i32, i32* %8
%24 = load i32, i32* %6
%25 = icmp ult i32 %23, %24
br i1 %25, label %26, label %65
26: ; preds = %22
%27 = load double*, double** %4
%28 = load i32, i32* %7
%29 = load i32, i32* %6
%30 = mul i32 %28, %29
%31 = load i32, i32* %8
%32 = add i32 %30, %31
%33 = zext i32 %32 to i64
%34 = getelementptr inbounds double, double* %27, i64 %33
%35 = load double, double* %34
store double %35, double* %10
%36 = load double*, double** %4
%37 = load i32, i32* %8
%38 = load i32, i32* %6
%39 = mul i32 %37, %38
%40 = load i32, i32* %7
%41 = add i32 %39, %40
%42 = zext i32 %41 to i64
%43 = getelementptr inbounds double, double* %36, i64 %42
%44 = load double, double* %43
%45 = load double*, double** %4
%46 = load i32, i32* %7
%47 = load i32, i32* %6
%48 = mul i32 %46, %47
%49 = load i32, i32* %8
%50 = add i32 %48, %49
%51 = zext i32 %50 to i64
%52 = getelementptr inbounds double, double* %45, i64 %51
store double %44, double* %52
%53 = load double, double* %10
%54 = load double*, double** %4
%55 = load i32, i32* %8
%56 = load i32, i32* %6
%57 = mul i32 %55, %56
%58 = load i32, i32* %7
%59 = add i32 %57, %58
%60 = zext i32 %59 to i64
%61 = getelementptr inbounds double, double* %54, i64 %60
store double %53, double* %61
br label %62
62: ; preds = %26
%63 = load i32, i32* %8
%64 = add i32 %63, 1
store i32 %64, i32* %8
br label %22
65: ; preds = %22
br label %66
66: ; preds = %65
%67 = load i32, i32* %7
%68 = add i32 %67, 1
store i32 %68, i32* %7
br label %15
69: ; preds = %15
br label %133
70: ; preds = %3
%71 = load i32, i32* %6
%72 = load i32, i32* %5
%73 = mul i32 %71, %72
%74 = zext i32 %73 to i64
%75 = mul i64 %74, 8
%76 = trunc i64 %75 to i32
%77 = call i64 @malloc(i32 %76)
%78 = inttoptr i64 %77 to double*
store double* %78, double** %9
%79 = load double*, double** %9
%80 = icmp eq double* null, %79
br i1 %80, label %81, label %86
81: ; preds = %70
%82 = load i32, i32* @stderr
%83 = call i32 @fprintf(i32 %82, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str.1, i64 0, i64 0), i32 125)
%84 = load i32, i32* @EXIT_FAILURE
%85 = call i32 @exit(i32 %84)
unreachable
86: ; preds = %70
store i32 0, i32* %7
br label %87
87: ; preds = %118, %86
%88 = load i32, i32* %7
%89 = load i32, i32* %6
%90 = icmp ult i32 %88, %89
br i1 %90, label %91, label %121
91: ; preds = %87
store i32 0, i32* %8
br label %92
92: ; preds = %114, %91
%93 = load i32, i32* %8
%94 = load i32, i32* %5
%95 = icmp ult i32 %93, %94
br i1 %95, label %96, label %117
96: ; preds = %92
%97 = load double*, double** %4
%98 = load i32, i32* %8
%99 = load i32, i32* %6
%100 = mul i32 %98, %99
%101 = load i32, i32* %7
%102 = add i32 %100, %101
%103 = zext i32 %102 to i64
%104 = getelementptr inbounds double, double* %97, i64 %103
%105 = load double, double* %104
%106 = load double*, double** %9
%107 = load i32, i32* %7
%108 = load i32, i32* %5
%109 = mul i32 %107, %108
%110 = load i32, i32* %8
%111 = add i32 %109, %110
%112 = zext i32 %111 to i64
%113 = getelementptr inbounds double, double* %106, i64 %112
store double %105, double* %113
br label %114
114: ; preds = %96
%115 = load i32, i32* %8
%116 = add i32 %115, 1
store i32 %116, i32* %8
br label %92
117: ; preds = %92
br label %118
118: ; preds = %117
%119 = load i32, i32* %7
%120 = add i32 %119, 1
store i32 %120, i32* %7
br label %87
121: ; preds = %87
%122 = load double*, double** %4
%123 = load double*, double** %9
%124 = load i32, i32* %6
%125 = load i32, i32* %5
%126 = mul i32 %124, %125
%127 = zext i32 %126 to i64
%128 = mul i64 %127, 8
%129 = trunc i64 %128 to i32
%130 = call i32 @memcpy(double* %122, double* %123, i32 %129)
%131 = load double*, double** %9
%132 = call i32 @free(double* %131)
br label %133
133: ; preds = %121, %69
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [32 x i8] c"Cannot allocate memory [%s:%d]\0A\00"
@.str.1 = [151 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/erpicci/cp151602/refs/heads/master/src/algorithms/basic_la.c\00"
@EXIT_FAILURE = global i32 0
define void @matrix_transpose(double* %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %1, %2
br i1 %4, label %5, label %175
5: ; preds = %3
%6 = icmp eq i32 %1, 0
br i1 %6, label %345, label %7
7: ; preds = %5
%8 = add i32 %1, -2
%9 = icmp ne i32 %1, 1
%10 = sub i32 0, %1
br label %14
11: ; preds = %146, %149, %125, %14
%12 = add nuw nsw i64 %15, 1
%13 = icmp eq i32 %28, %1
br i1 %13, label %345, label %14
14: ; preds = %7, %11
%15 = phi i64 [ %12, %11 ], [ 1, %7 ]
%16 = phi i32 [ %28, %11 ], [ 0, %7 ]
%17 = sub i32 %8, %16
%18 = zext i32 %17 to i64
%19 = add nuw nsw i64 %18, 1
%20 = and i64 %19, 8589934588
%21 = add nsw i64 %20, -4
%22 = lshr exact i64 %21, 2
%23 = add nuw nsw i64 %22, 1
%24 = sub i32 %8, %16
%25 = zext i32 %24 to i64
%26 = add nuw nsw i64 %25, 1
%27 = sub i32 %8, %16
%28 = add nuw i32 %16, 1
%29 = icmp ult i32 %28, %1
br i1 %29, label %30, label %11
30: ; preds = %14
%31 = mul i32 %16, %1
%32 = icmp ult i32 %24, 3
br i1 %32, label %127, label %33
33: ; preds = %30
%34 = xor i32 %16, -1
%35 = shl i32 %34, 1
%36 = icmp ult i32 %35, %27
%37 = or i1 %9, %36
br i1 %37, label %127, label %38
38: ; preds = %33
%39 = and i64 %26, 8589934588
%40 = add nuw i64 %15, %39
%41 = and i64 %23, 1
%42 = icmp eq i64 %21, 0
br i1 %42, label %98, label %43
43: ; preds = %38
%44 = and i64 %23, 9223372036854775806
br label %45
45: ; preds = %45, %43
%46 = phi i64 [ 0, %43 ], [ %95, %45 ]
%47 = phi i64 [ 0, %43 ], [ %96, %45 ]
%48 = add i64 %15, %46
%49 = trunc i64 %48 to i32
%50 = add i32 %31, %49
%51 = zext i32 %50 to i64
%52 = getelementptr inbounds double, double* %0, i64 %51
%53 = bitcast double* %52 to <2 x double>*
%54 = load <2 x double>, <2 x double>* %53
%55 = getelementptr inbounds double, double* %52, i64 2
%56 = bitcast double* %55 to <2 x double>*
%57 = load <2 x double>, <2 x double>* %56
%58 = mul i32 %49, %1
%59 = add i32 %58, %16
%60 = zext i32 %59 to i64
%61 = getelementptr inbounds double, double* %0, i64 %60
%62 = bitcast double* %61 to <2 x double>*
%63 = load <2 x double>, <2 x double>* %62
%64 = getelementptr inbounds double, double* %61, i64 2
%65 = bitcast double* %64 to <2 x double>*
%66 = load <2 x double>, <2 x double>* %65
%67 = bitcast double* %52 to <2 x double>*
store <2 x double> %63, <2 x double>* %67
%68 = bitcast double* %55 to <2 x double>*
store <2 x double> %66, <2 x double>* %68
%69 = bitcast double* %61 to <2 x double>*
store <2 x double> %54, <2 x double>* %69
%70 = bitcast double* %64 to <2 x double>*
store <2 x double> %57, <2 x double>* %70
%71 = or i64 %46, 4
%72 = add i64 %15, %71
%73 = trunc i64 %72 to i32
%74 = add i32 %31, %73
%75 = zext i32 %74 to i64
%76 = getelementptr inbounds double, double* %0, i64 %75
%77 = bitcast double* %76 to <2 x double>*
%78 = load <2 x double>, <2 x double>* %77
%79 = getelementptr inbounds double, double* %76, i64 2
%80 = bitcast double* %79 to <2 x double>*
%81 = load <2 x double>, <2 x double>* %80
%82 = mul i32 %73, %1
%83 = add i32 %82, %16
%84 = zext i32 %83 to i64
%85 = getelementptr inbounds double, double* %0, i64 %84
%86 = bitcast double* %85 to <2 x double>*
%87 = load <2 x double>, <2 x double>* %86
%88 = getelementptr inbounds double, double* %85, i64 2
%89 = bitcast double* %88 to <2 x double>*
%90 = load <2 x double>, <2 x double>* %89
%91 = bitcast double* %76 to <2 x double>*
store <2 x double> %87, <2 x double>* %91
%92 = bitcast double* %79 to <2 x double>*
store <2 x double> %90, <2 x double>* %92
%93 = bitcast double* %85 to <2 x double>*
store <2 x double> %78, <2 x double>* %93
%94 = bitcast double* %88 to <2 x double>*
store <2 x double> %81, <2 x double>* %94
%95 = add nuw i64 %46, 8
%96 = add i64 %47, 2
%97 = icmp eq i64 %96, %44
br i1 %97, label %98, label %45
98: ; preds = %45, %38
%99 = phi i64 [ 0, %38 ], [ %95, %45 ]
%100 = icmp eq i64 %41, 0
br i1 %100, label %125, label %101
101: ; preds = %98
%102 = add i64 %15, %99
%103 = trunc i64 %102 to i32
%104 = add i32 %31, %103
%105 = zext i32 %104 to i64
%106 = getelementptr inbounds double, double* %0, i64 %105
%107 = bitcast double* %106 to <2 x double>*
%108 = load <2 x double>, <2 x double>* %107
%109 = getelementptr inbounds double, double* %106, i64 2
%110 = bitcast double* %109 to <2 x double>*
%111 = load <2 x double>, <2 x double>* %110
%112 = mul i32 %103, %1
%113 = add i32 %112, %16
%114 = zext i32 %113 to i64
%115 = getelementptr inbounds double, double* %0, 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 = bitcast double* %106 to <2 x double>*
store <2 x double> %117, <2 x double>* %121
%122 = bitcast double* %109 to <2 x double>*
store <2 x double> %120, <2 x double>* %122
%123 = bitcast double* %115 to <2 x double>*
store <2 x double> %108, <2 x double>* %123
%124 = bitcast double* %118 to <2 x double>*
store <2 x double> %111, <2 x double>* %124
br label %125
125: ; preds = %98, %101
%126 = icmp eq i64 %26, %39
br i1 %126, label %11, label %127
127: ; preds = %33, %30, %125
%128 = phi i64 [ %15, %33 ], [ %15, %30 ], [ %40, %125 ]
%129 = trunc i64 %128 to i32
%130 = sub i32 %1, %129
%131 = xor i32 %129, -1
%132 = and i32 %130, 1
%133 = icmp eq i32 %132, 0
br i1 %133, label %146, label %134
134: ; preds = %127
%135 = trunc i64 %128 to i32
%136 = add i32 %31, %135
%137 = zext i32 %136 to i64
%138 = getelementptr inbounds double, double* %0, i64 %137
%139 = load double, double* %138
%140 = mul i32 %135, %1
%141 = add i32 %140, %16
%142 = zext i32 %141 to i64
%143 = getelementptr inbounds double, double* %0, i64 %142
%144 = load double, double* %143
store double %144, double* %138
store double %139, double* %143
%145 = add nuw nsw i64 %128, 1
br label %146
146: ; preds = %134, %127
%147 = phi i64 [ %128, %127 ], [ %145, %134 ]
%148 = icmp eq i32 %131, %10
br i1 %148, label %11, label %149
149: ; preds = %146, %149
%150 = phi i64 [ %172, %149 ], [ %147, %146 ]
%151 = trunc i64 %150 to i32
%152 = add i32 %31, %151
%153 = zext i32 %152 to i64
%154 = getelementptr inbounds double, double* %0, i64 %153
%155 = load double, double* %154
%156 = mul i32 %151, %1
%157 = add i32 %156, %16
%158 = zext i32 %157 to i64
%159 = getelementptr inbounds double, double* %0, i64 %158
%160 = load double, double* %159
store double %160, double* %154
store double %155, double* %159
%161 = trunc i64 %150 to i32
%162 = add i32 %161, 1
%163 = add i32 %31, %162
%164 = zext i32 %163 to i64
%165 = getelementptr inbounds double, double* %0, i64 %164
%166 = load double, double* %165
%167 = mul i32 %162, %1
%168 = add i32 %167, %16
%169 = zext i32 %168 to i64
%170 = getelementptr inbounds double, double* %0, i64 %169
%171 = load double, double* %170
store double %171, double* %165
store double %166, double* %170
%172 = add nuw nsw i64 %150, 2
%173 = trunc i64 %172 to i32
%174 = icmp eq i32 %173, %1
br i1 %174, label %11, label %149
175: ; preds = %3
%176 = shl i32 %1, 3
%177 = mul i32 %176, %2
%178 = tail call i64 @malloc(i32 %177)
%179 = inttoptr i64 %178 to double*
%180 = icmp eq i64 %178, 0
br i1 %180, label %207, label %181
181: ; preds = %175
%182 = icmp eq i32 %2, 0
br i1 %182, label %342, label %183
183: ; preds = %181
%184 = icmp eq i32 %1, 0
%185 = zext i32 %1 to i64
%186 = add nsw i64 %185, -1
%187 = getelementptr double, double* %179, i64 %185
%188 = and i64 %185, 4294967292
%189 = add nsw i64 %188, -4
%190 = lshr exact i64 %189, 2
%191 = add nuw nsw i64 %190, 1
%192 = icmp ult i32 %1, 4
%193 = icmp ne i32 %2, 1
%194 = trunc i64 %186 to i32
%195 = icmp ugt i64 %186, 4294967295
%196 = trunc i64 %186 to i32
%197 = icmp ugt i64 %186, 4294967295
%198 = and i64 %185, 4294967292
%199 = and i64 %191, 1
%200 = icmp eq i64 %189, 0
%201 = and i64 %191, 9223372036854775806
%202 = icmp eq i64 %199, 0
%203 = icmp eq i64 %198, %185
%204 = and i64 %185, 1
%205 = icmp eq i64 %204, 0
%206 = sub nsw i64 0, %185
br label %212
207: ; preds = %175
%208 = load i32, i32* @stderr
%209 = tail call i32 @fprintf(i32 %208, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str.1, i64 0, i64 0), i32 125)
%210 = load i32, i32* @EXIT_FAILURE
%211 = tail call i32 @exit(i32 %210)
unreachable
212: ; preds = %183, %338
%213 = phi i64 [ 0, %183 ], [ %341, %338 ]
%214 = phi i32 [ 0, %183 ], [ %339, %338 ]
%215 = mul i32 %214, %1
%216 = zext i32 %215 to i64
%217 = getelementptr double, double* %179, i64 %216
%218 = getelementptr double, double* %187, i64 %216
%219 = getelementptr double, double* %0, i64 %213
%220 = add i64 %213, %185
%221 = getelementptr double, double* %0, i64 %220
%222 = mul i32 %214, %1
br i1 %184, label %338, label %223
223: ; preds = %212
%224 = mul i32 %214, %1
br i1 %192, label %298, label %225
225: ; preds = %223
%226 = xor i32 %222, -1
%227 = icmp ult i32 %226, %194
%228 = or i1 %227, %195
%229 = xor i32 %214, -1
%230 = icmp ult i32 %229, %196
%231 = or i1 %230, %197
%232 = or i1 %193, %228
%233 = or i1 %232, %231
br i1 %233, label %298, label %234
234: ; preds = %225
%235 = icmp ult double* %217, %221
%236 = icmp ult double* %219, %218
%237 = and i1 %235, %236
br i1 %237, label %298, label %238
238: ; preds = %234
br i1 %200, label %278, label %239
239: ; preds = %238, %239
%240 = phi i64 [ %275, %239 ], [ 0, %238 ]
%241 = phi i64 [ %276, %239 ], [ 0, %238 ]
%242 = trunc i64 %240 to i32
%243 = mul i32 %242, %2
%244 = add i32 %243, %214
%245 = zext i32 %244 to i64
%246 = getelementptr inbounds double, double* %0, i64 %245
%247 = bitcast double* %246 to <2 x double>*
%248 = load <2 x double>, <2 x double>* %247
%249 = getelementptr inbounds double, double* %246, i64 2
%250 = bitcast double* %249 to <2 x double>*
%251 = load <2 x double>, <2 x double>* %250
%252 = add i32 %224, %242
%253 = zext i32 %252 to i64
%254 = getelementptr inbounds double, double* %179, i64 %253
%255 = bitcast double* %254 to <2 x double>*
store <2 x double> %248, <2 x double>* %255
%256 = getelementptr inbounds double, double* %254, i64 2
%257 = bitcast double* %256 to <2 x double>*
store <2 x double> %251, <2 x double>* %257
%258 = trunc i64 %240 to i32
%259 = or i32 %258, 4
%260 = mul i32 %259, %2
%261 = add i32 %260, %214
%262 = zext i32 %261 to i64
%263 = getelementptr inbounds double, double* %0, i64 %262
%264 = bitcast double* %263 to <2 x double>*
%265 = load <2 x double>, <2 x double>* %264
%266 = getelementptr inbounds double, double* %263, i64 2
%267 = bitcast double* %266 to <2 x double>*
%268 = load <2 x double>, <2 x double>* %267
%269 = add i32 %224, %259
%270 = zext i32 %269 to i64
%271 = getelementptr inbounds double, double* %179, i64 %270
%272 = bitcast double* %271 to <2 x double>*
store <2 x double> %265, <2 x double>* %272
%273 = getelementptr inbounds double, double* %271, i64 2
%274 = bitcast double* %273 to <2 x double>*
store <2 x double> %268, <2 x double>* %274
%275 = add nuw i64 %240, 8
%276 = add i64 %241, 2
%277 = icmp eq i64 %276, %201
br i1 %277, label %278, label %239
278: ; preds = %239, %238
%279 = phi i64 [ 0, %238 ], [ %275, %239 ]
br i1 %202, label %297, label %280
280: ; preds = %278
%281 = trunc i64 %279 to i32
%282 = mul i32 %281, %2
%283 = add i32 %282, %214
%284 = zext i32 %283 to i64
%285 = getelementptr inbounds double, double* %0, i64 %284
%286 = bitcast double* %285 to <2 x double>*
%287 = load <2 x double>, <2 x double>* %286
%288 = getelementptr inbounds double, double* %285, i64 2
%289 = bitcast double* %288 to <2 x double>*
%290 = load <2 x double>, <2 x double>* %289
%291 = add i32 %224, %281
%292 = zext i32 %291 to i64
%293 = getelementptr inbounds double, double* %179, i64 %292
%294 = bitcast double* %293 to <2 x double>*
store <2 x double> %287, <2 x double>* %294
%295 = getelementptr inbounds double, double* %293, i64 2
%296 = bitcast double* %295 to <2 x double>*
store <2 x double> %290, <2 x double>* %296
br label %297
297: ; preds = %278, %280
br i1 %203, label %338, label %298
298: ; preds = %234, %225, %223, %297
%299 = phi i64 [ 0, %234 ], [ 0, %225 ], [ 0, %223 ], [ %198, %297 ]
%300 = xor i64 %299, -1
br i1 %205, label %312, label %301
301: ; preds = %298
%302 = trunc i64 %299 to i32
%303 = mul i32 %302, %2
%304 = add i32 %303, %214
%305 = zext i32 %304 to i64
%306 = getelementptr inbounds double, double* %0, i64 %305
%307 = load double, double* %306
%308 = add i32 %224, %302
%309 = zext i32 %308 to i64
%310 = getelementptr inbounds double, double* %179, i64 %309
store double %307, double* %310
%311 = or i64 %299, 1
br label %312
312: ; preds = %301, %298
%313 = phi i64 [ %299, %298 ], [ %311, %301 ]
%314 = icmp eq i64 %300, %206
br i1 %314, label %338, label %315
315: ; preds = %312, %315
%316 = phi i64 [ %336, %315 ], [ %313, %312 ]
%317 = trunc i64 %316 to i32
%318 = mul i32 %317, %2
%319 = add i32 %318, %214
%320 = zext i32 %319 to i64
%321 = getelementptr inbounds double, double* %0, i64 %320
%322 = load double, double* %321
%323 = add i32 %224, %317
%324 = zext i32 %323 to i64
%325 = getelementptr inbounds double, double* %179, i64 %324
store double %322, double* %325
%326 = trunc i64 %316 to i32
%327 = add i32 %326, 1
%328 = mul i32 %327, %2
%329 = add i32 %328, %214
%330 = zext i32 %329 to i64
%331 = getelementptr inbounds double, double* %0, i64 %330
%332 = load double, double* %331
%333 = add i32 %224, %327
%334 = zext i32 %333 to i64
%335 = getelementptr inbounds double, double* %179, i64 %334
store double %332, double* %335
%336 = add nuw nsw i64 %316, 2
%337 = icmp eq i64 %336, %185
br i1 %337, label %338, label %315
338: ; preds = %312, %315, %297, %212
%339 = add nuw i32 %214, 1
%340 = icmp eq i32 %339, %2
%341 = add i64 %213, 1
br i1 %340, label %342, label %212
342: ; preds = %338, %181
%343 = tail call i32 @memcpy(double* %0, double* %179, i32 %177)
%344 = tail call i32 @free(double* %179)
br label %345
345: ; preds = %11, %5, %342
ret void
}