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

/* Forward declarations */

/* Type definitions */
typedef scalar_t__ clock_t;

/* Variables and functions */
scalar_t__ CLOCKS_PER_SEC;
scalar_t__ clock();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ qfits_memory_free(int *, char *, int);
int *qfits_memory_malloc(int, char *, int);
int /*<<< orphan*/ qfits_memory_status();
int main(void) {
  int *array[20000];
  int *ptr[5];
  clock_t chrono;
  double elapsed_time;
  int i, j;
  chrono = clock();
  printf("----- RAM allocation\n");
  for (i = 0; i < 20000; i++) {
    array[i] = qfits_memory_malloc(
        10 * sizeof(int),
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/blackball/an-test6/refs/heads/main/"
        "qfits-6.2.0/test/test_xmem.c",
        67);
    array[i][0] = i;
  }
  elapsed_time = (double)(clock() - chrono) / (double)CLOCKS_PER_SEC;
  printf("\tFor allocation: %4.2f sec\n", elapsed_time);
  for (i = 0; i < 3; i++) {
    printf("a[%d][0]=%d\n", i, array[i][0]);
  }
  printf("...\n");
  for (i = 20000 - 3; i < 20000; i++) {
    printf("a[%d][0]=%d\n", i, array[i][0]);
  }
  chrono = clock();
  for (i = 0; i < 5000; i++) {
    for (j = 0; j < 5; j++) {
      ptr[j] = qfits_memory_malloc(
          10 * sizeof(int),
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/blackball/an-test6/refs/heads/main/"
          "qfits-6.2.0/test/test_xmem.c",
          90);
    }
    for (j = 0; j < 5; j++) {
      qfits_memory_free(ptr[j],
                        "/scratch/repos/new/home/jordi_armengol_estape/"
                        "c-scraper/outputs/2022-01-22/02-19-57/repos/blackball/"
                        "an-test6/refs/heads/main/qfits-6.2.0/test/test_xmem.c",
                        93);
    }
  }
  elapsed_time = (double)(clock() - chrono) / (double)CLOCKS_PER_SEC;
  printf("\tFor the alloc/dealloc loop: %4.2f sec\n", elapsed_time);
  chrono = clock();
  printf("----- RAM deallocation\n");
  for (i = 0; i < 20000; i++)
    qfits_memory_free(array[i],
                      "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                      "outputs/2022-01-22/02-19-57/repos/blackball/an-test6/"
                      "refs/heads/main/qfits-6.2.0/test/test_xmem.c",
                      106);
  elapsed_time = (double)(clock() - chrono) / (double)CLOCKS_PER_SEC;
  printf("\tFor deallocation: %4.2f sec\n", elapsed_time);
  qfits_memory_status();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x27160,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x27148(%rbp)
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x27154(%rbp)
cmpl   $0x4e20,-0x27154(%rbp)
jge    11eb <main+0x9b>
mov    $0x28,%edi
lea    0xe72(%rip),%rsi
mov    $0x43,%edx
call   1060 <qfits_memory_malloc@plt>
mov    %rax,%rcx
movslq -0x27154(%rbp),%rax
mov    %rcx,-0x27110(%rbp,%rax,8)
ff
mov    -0x27154(%rbp),%ecx
movslq -0x27154(%rbp),%rax
mov    -0x27110(%rbp,%rax,8),%rax
ff
mov    %ecx,(%rax)
mov    -0x27154(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x27154(%rbp)
jmp    1188 <main+0x38>
mov    $0x0,%al
call   1030 <clock@plt>
sub    -0x27148(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2de3(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x27150(%rbp)
ff
movsd  -0x27150(%rbp),%xmm0
ff
lea    0xe8b(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movl   $0x0,-0x27154(%rbp)
cmpl   $0x3,-0x27154(%rbp)
jge    127c <main+0x12c>
mov    -0x27154(%rbp),%esi
movslq -0x27154(%rbp),%rax
mov    -0x27110(%rbp,%rax,8),%rax
ff
mov    (%rax),%edx
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x27154(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x27154(%rbp)
jmp    1236 <main+0xe6>
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x4e1d,-0x27154(%rbp)
cmpl   $0x4e20,-0x27154(%rbp)
jge    12dd <main+0x18d>
mov    -0x27154(%rbp),%esi
movslq -0x27154(%rbp),%rax
mov    -0x27110(%rbp,%rax,8),%rax
ff
mov    (%rax),%edx
lea    0xe0a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x27154(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x27154(%rbp)
jmp    1294 <main+0x144>
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x27148(%rbp)
movl   $0x0,-0x27154(%rbp)
cmpl   $0x1388,-0x27154(%rbp)
jge    13bc <main+0x26c>
movl   $0x0,-0x27158(%rbp)
cmpl   $0x5,-0x27158(%rbp)
jge    1358 <main+0x208>
mov    $0x28,%edi
lea    0xcee(%rip),%rsi
mov    $0x5a,%edx
call   1060 <qfits_memory_malloc@plt>
mov    %rax,%rcx
movslq -0x27158(%rbp),%rax
mov    %rcx,-0x27140(%rbp,%rax,8)
ff
mov    -0x27158(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x27158(%rbp)
jmp    130f <main+0x1bf>
movl   $0x0,-0x27158(%rbp)
cmpl   $0x5,-0x27158(%rbp)
jge    13a3 <main+0x253>
movslq -0x27158(%rbp),%rax
mov    -0x27140(%rbp,%rax,8),%rdi
ff
lea    0xc91(%rip),%rsi
mov    $0x5d,%edx
call   1070 <qfits_memory_free@plt>
mov    -0x27158(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x27158(%rbp)
jmp    1362 <main+0x212>
jmp    13a8 <main+0x258>
mov    -0x27154(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x27154(%rbp)
jmp    12f5 <main+0x1a5>
mov    $0x0,%al
call   1030 <clock@plt>
sub    -0x27148(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2c12(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x27150(%rbp)
ff
movsd  -0x27150(%rbp),%xmm0
ff
lea    0xce8(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <clock@plt>
mov    %rax,-0x27148(%rbp)
lea    0xcf4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x27154(%rbp)
cmpl   $0x4e20,-0x27154(%rbp)
jge    1467 <main+0x317>
movslq -0x27154(%rbp),%rax
mov    -0x27110(%rbp,%rax,8),%rdi
ff
lea    0xbcd(%rip),%rsi
mov    $0x6a,%edx
call   1070 <qfits_memory_free@plt>
mov    -0x27154(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x27154(%rbp)
jmp    1423 <main+0x2d3>
mov    $0x0,%al
call   1030 <clock@plt>
sub    -0x27148(%rbp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2b67(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x27150(%rbp)
ff
movsd  -0x27150(%rbp),%xmm0
ff
lea    0xc7d(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <qfits_memory_status@plt>
xor    %eax,%eax
add    $0x27160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x27128,%rsp
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <clock@plt>
mov    %rax,%r14
lea    0xf85(%rip),%rdi
call   1030 <puts@plt>
lea    0xe70(%rip),%rbx
mov    $0x28,%edi
mov    %rbx,%rsi
mov    $0x43,%edx
call   1070 <qfits_memory_malloc@plt>
mov    %rax,0x20(%rsp,%rbp,8)
mov    %ebp,(%rax)
add    $0x1,%rbp
cmp    $0x4e20,%rbp
jne    1190 <main+0x30>
xor    %eax,%eax
call   1040 <clock@plt>
sub    %r14,%rax
cvtsi2sd %rax,%xmm0
mov    0x2e1c(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
lea    0xebe(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    0x20(%rsp),%rax
mov    %rax,0x10(%rsp)
mov    (%rax),%edx
lea    0xec0(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x28(%rsp),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x30(%rsp),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xee9(%rip),%rdi
call   1030 <puts@plt>
mov    0x27108(%rsp),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    $0x4e1d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x27110(%rsp),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    $0x4e1e,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x27118(%rsp),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    $0x4e1f,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1040 <clock@plt>
mov    %rax,0x8(%rsp)
mov    $0x1388,%r12d
lea    0xd62(%rip),%rbx
xchg   %ax,%ax
mov    $0x28,%edi
mov    %rbx,%rsi
mov    $0x5a,%edx
call   1070 <qfits_memory_malloc@plt>
mov    %rax,0x18(%rsp)
mov    $0x28,%edi
mov    %rbx,%rsi
mov    $0x5a,%edx
call   1070 <qfits_memory_malloc@plt>
mov    %rax,%r13
mov    $0x28,%edi
mov    %rbx,%rsi
mov    $0x5a,%edx
call   1070 <qfits_memory_malloc@plt>
mov    %rax,%rbp
mov    $0x28,%edi
mov    %rbx,%rsi
mov    $0x5a,%edx
call   1070 <qfits_memory_malloc@plt>
mov    %rax,%r14
mov    $0x28,%edi
mov    %rbx,%rsi
mov    $0x5a,%edx
call   1070 <qfits_memory_malloc@plt>
mov    %rax,%r15
mov    0x18(%rsp),%rdi
mov    %rbx,%rsi
mov    $0x5d,%edx
call   1080 <qfits_memory_free@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
mov    $0x5d,%edx
call   1080 <qfits_memory_free@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    $0x5d,%edx
call   1080 <qfits_memory_free@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x5d,%edx
call   1080 <qfits_memory_free@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x5d,%edx
call   1080 <qfits_memory_free@plt>
add    $0xffffffff,%r12d
jne    12a0 <main+0x140>
xor    %eax,%eax
call   1040 <clock@plt>
sub    0x8(%rsp),%rax
cvtsi2sd %rax,%xmm0
mov    0x2c69(%rip),%r14
cvtsi2sdq (%r14),%xmm1
divsd  %xmm1,%xmm0
lea    0xd34(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
call   1040 <clock@plt>
mov    %rax,%r15
lea    0xd7b(%rip),%rdi
call   1030 <puts@plt>
lea    0xc4d(%rip),%rbx
mov    0x10(%rsp),%rdi
mov    %rbx,%rsi
mov    $0x6a,%edx
call   1080 <qfits_memory_free@plt>
mov    $0x1,%ebp
nopw   0x0(%rax,%rax,1)
mov    0x20(%rsp,%rbp,8),%rdi
mov    %rbx,%rsi
mov    $0x6a,%edx
call   1080 <qfits_memory_free@plt>
add    $0x1,%rbp
cmp    $0x4e20,%rbp
jne    13d0 <main+0x270>
xor    %eax,%eax
call   1040 <clock@plt>
sub    %r15,%rax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdq (%r14),%xmm1
divsd  %xmm1,%xmm0
lea    0xcd7(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
call   1060 <qfits_memory_status@plt>
xor    %eax,%eax
add    $0x27128,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"----- RAM allocation\0A\00"
@.str.1 = [154 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/blackball/an-test6/refs/heads/main/qfits-6.2.0/test/test_xmem.c\00"
@CLOCKS_PER_SEC = global i64 0
@.str.2 = [28 x i8] c"\09For allocation: %4.2f sec\0A\00"
@.str.3 = [13 x i8] c"a[%d][0]=%d\0A\00"
@.str.4 = [5 x i8] c"...\0A\00"
@.str.5 = [40 x i8] c"\09For the alloc/dealloc loop: %4.2f sec\0A\00"
@.str.6 = [24 x i8] c"----- RAM deallocation\0A\00"
@.str.7 = [30 x i8] c"\09For deallocation: %4.2f sec\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20000 x i32*]
%3 = alloca [5 x i32*]
%4 = alloca i64
%5 = alloca double
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call i64 (...) @clock()
store i64 %8, i64* %4
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %6
br label %10
10: ; preds = %24, %0
%11 = load i32, i32* %6
%12 = icmp slt i32 %11, 20000
br i1 %12, label %13, label %27
13: ; preds = %10
%14 = call i32* @qfits_memory_malloc(i32 40, i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str.1, i64 0, i64 0), i32 67)
%15 = load i32, i32* %6
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [20000 x i32*], [20000 x i32*]* %2, i64 0, i64 %16
store i32* %14, i32** %17
%18 = load i32, i32* %6
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [20000 x i32*], [20000 x i32*]* %2, i64 0, i64 %20
%22 = load i32*, i32** %21
%23 = getelementptr inbounds i32, i32* %22, i64 0
store i32 %18, i32* %23
br label %24
24: ; preds = %13
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
store i32 %26, i32* %6
br label %10
27: ; preds = %10
%28 = call i64 (...) @clock()
%29 = load i64, i64* %4
%30 = sub nsw i64 %28, %29
%31 = sitofp i64 %30 to double
%32 = load i64, i64* @CLOCKS_PER_SEC
%33 = sitofp i64 %32 to double
%34 = fdiv double %31, %33
store double %34, double* %5
%35 = load double, double* %5
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), double %35)
store i32 0, i32* %6
br label %37
37: ; preds = %49, %27
%38 = load i32, i32* %6
%39 = icmp slt i32 %38, 3
br i1 %39, label %40, label %52
40: ; preds = %37
%41 = load i32, i32* %6
%42 = load i32, i32* %6
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [20000 x i32*], [20000 x i32*]* %2, i64 0, i64 %43
%45 = load i32*, i32** %44
%46 = getelementptr inbounds i32, i32* %45, i64 0
%47 = load i32, i32* %46
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %41, i32 %47)
br label %49
49: ; preds = %40
%50 = load i32, i32* %6
%51 = add nsw i32 %50, 1
store i32 %51, i32* %6
br label %37
52: ; preds = %37
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
store i32 19997, i32* %6
br label %54
54: ; preds = %66, %52
%55 = load i32, i32* %6
%56 = icmp slt i32 %55, 20000
br i1 %56, label %57, label %69
57: ; preds = %54
%58 = load i32, i32* %6
%59 = load i32, i32* %6
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [20000 x i32*], [20000 x i32*]* %2, i64 0, i64 %60
%62 = load i32*, i32** %61
%63 = getelementptr inbounds i32, i32* %62, i64 0
%64 = load i32, i32* %63
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %58, i32 %64)
br label %66
66: ; preds = %57
%67 = load i32, i32* %6
%68 = add nsw i32 %67, 1
store i32 %68, i32* %6
br label %54
69: ; preds = %54
%70 = call i64 (...) @clock()
store i64 %70, i64* %4
store i32 0, i32* %6
br label %71
71: ; preds = %100, %69
%72 = load i32, i32* %6
%73 = icmp slt i32 %72, 5000
br i1 %73, label %74, label %103
74: ; preds = %71
store i32 0, i32* %7
br label %75
75: ; preds = %83, %74
%76 = load i32, i32* %7
%77 = icmp slt i32 %76, 5
br i1 %77, label %78, label %86
78: ; preds = %75
%79 = call i32* @qfits_memory_malloc(i32 40, i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str.1, i64 0, i64 0), i32 90)
%80 = load i32, i32* %7
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds [5 x i32*], [5 x i32*]* %3, i64 0, i64 %81
store i32* %79, i32** %82
br label %83
83: ; preds = %78
%84 = load i32, i32* %7
%85 = add nsw i32 %84, 1
store i32 %85, i32* %7
br label %75
86: ; preds = %75
store i32 0, i32* %7
br label %87
87: ; preds = %96, %86
%88 = load i32, i32* %7
%89 = icmp slt i32 %88, 5
br i1 %89, label %90, label %99
90: ; preds = %87
%91 = load i32, i32* %7
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds [5 x i32*], [5 x i32*]* %3, i64 0, i64 %92
%94 = load i32*, i32** %93
%95 = call i32 @qfits_memory_free(i32* %94, i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str.1, i64 0, i64 0), i32 93)
br label %96
96: ; preds = %90
%97 = load i32, i32* %7
%98 = add nsw i32 %97, 1
store i32 %98, i32* %7
br label %87
99: ; preds = %87
br label %100
100: ; preds = %99
%101 = load i32, i32* %6
%102 = add nsw i32 %101, 1
store i32 %102, i32* %6
br label %71
103: ; preds = %71
%104 = call i64 (...) @clock()
%105 = load i64, i64* %4
%106 = sub nsw i64 %104, %105
%107 = sitofp i64 %106 to double
%108 = load i64, i64* @CLOCKS_PER_SEC
%109 = sitofp i64 %108 to double
%110 = fdiv double %107, %109
store double %110, double* %5
%111 = load double, double* %5
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0), double %111)
%113 = call i64 (...) @clock()
store i64 %113, i64* %4
%114 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %6
br label %115
115: ; preds = %124, %103
%116 = load i32, i32* %6
%117 = icmp slt i32 %116, 20000
br i1 %117, label %118, label %127
118: ; preds = %115
%119 = load i32, i32* %6
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds [20000 x i32*], [20000 x i32*]* %2, i64 0, i64 %120
%122 = load i32*, i32** %121
%123 = call i32 @qfits_memory_free(i32* %122, i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str.1, i64 0, i64 0), i32 106)
br label %124
124: ; preds = %118
%125 = load i32, i32* %6
%126 = add nsw i32 %125, 1
store i32 %126, i32* %6
br label %115
127: ; preds = %115
%128 = call i64 (...) @clock()
%129 = load i64, i64* %4
%130 = sub nsw i64 %128, %129
%131 = sitofp i64 %130 to double
%132 = load i64, i64* @CLOCKS_PER_SEC
%133 = sitofp i64 %132 to double
%134 = fdiv double %131, %133
store double %134, double* %5
%135 = load double, double* %5
%136 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), double %135)
%137 = call i32 (...) @qfits_memory_status()
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [154 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/blackball/an-test6/refs/heads/main/qfits-6.2.0/test/test_xmem.c\00"
@CLOCKS_PER_SEC = global i64 0
@.str.2 = [28 x i8] c"\09For allocation: %4.2f sec\0A\00"
@.str.3 = [13 x i8] c"a[%d][0]=%d\0A\00"
@.str.5 = [40 x i8] c"\09For the alloc/dealloc loop: %4.2f sec\0A\00"
@.str.7 = [30 x i8] c"\09For deallocation: %4.2f sec\0A\00"
@str = [21 x i8] c"----- RAM allocation\00"
@str.8 = [4 x i8] c"...\00"
@str.9 = [23 x i8] c"----- RAM deallocation\00"
define i32 @main() {
%1 = alloca [20000 x i32*]
%2 = bitcast [20000 x i32*]* %1 to i8*
%3 = tail call i64 (...) @clock()
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
br label %5
5: ; preds = %0, %5
%6 = phi i64 [ 0, %0 ], [ %10, %5 ]
%7 = tail call i32* @qfits_memory_malloc(i32 40, i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str.1, i64 0, i64 0), i32 67)
%8 = getelementptr inbounds [20000 x i32*], [20000 x i32*]* %1, i64 0, i64 %6
store i32* %7, i32** %8
%9 = trunc i64 %6 to i32
store i32 %9, i32* %7
%10 = add nuw nsw i64 %6, 1
%11 = icmp eq i64 %10, 20000
br i1 %11, label %12, label %5
12: ; preds = %5
%13 = tail call i64 (...) @clock()
%14 = sub nsw i64 %13, %3
%15 = sitofp i64 %14 to double
%16 = load i64, i64* @CLOCKS_PER_SEC
%17 = sitofp i64 %16 to double
%18 = fdiv double %15, %17
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), double %18)
%20 = getelementptr inbounds [20000 x i32*], [20000 x i32*]* %1, i64 0, i64 0
%21 = load i32*, i32** %20
%22 = load i32, i32* %21
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 0, i32 %22)
%24 = getelementptr inbounds [20000 x i32*], [20000 x i32*]* %1, i64 0, i64 1
%25 = load i32*, i32** %24
%26 = load i32, i32* %25
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 1, i32 %26)
%28 = getelementptr inbounds [20000 x i32*], [20000 x i32*]* %1, i64 0, i64 2
%29 = load i32*, i32** %28
%30 = load i32, i32* %29
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 2, i32 %30)
%32 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.8, i64 0, i64 0))
%33 = getelementptr inbounds [20000 x i32*], [20000 x i32*]* %1, i64 0, i64 19997
%34 = load i32*, i32** %33
%35 = load i32, i32* %34
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 19997, i32 %35)
%37 = getelementptr inbounds [20000 x i32*], [20000 x i32*]* %1, i64 0, i64 19998
%38 = load i32*, i32** %37
%39 = load i32, i32* %38
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 19998, i32 %39)
%41 = getelementptr inbounds [20000 x i32*], [20000 x i32*]* %1, i64 0, i64 19999
%42 = load i32*, i32** %41
%43 = load i32, i32* %42
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 19999, i32 %43)
%45 = tail call i64 (...) @clock()
br label %46
46: ; preds = %12, %46
%47 = phi i32 [ 0, %12 ], [ %58, %46 ]
%48 = tail call i32* @qfits_memory_malloc(i32 40, i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str.1, i64 0, i64 0), i32 90)
%49 = tail call i32* @qfits_memory_malloc(i32 40, i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str.1, i64 0, i64 0), i32 90)
%50 = tail call i32* @qfits_memory_malloc(i32 40, i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str.1, i64 0, i64 0), i32 90)
%51 = tail call i32* @qfits_memory_malloc(i32 40, i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str.1, i64 0, i64 0), i32 90)
%52 = tail call i32* @qfits_memory_malloc(i32 40, i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str.1, i64 0, i64 0), i32 90)
%53 = tail call i32 @qfits_memory_free(i32* %48, i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str.1, i64 0, i64 0), i32 93)
%54 = tail call i32 @qfits_memory_free(i32* %49, i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str.1, i64 0, i64 0), i32 93)
%55 = tail call i32 @qfits_memory_free(i32* %50, i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str.1, i64 0, i64 0), i32 93)
%56 = tail call i32 @qfits_memory_free(i32* %51, i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str.1, i64 0, i64 0), i32 93)
%57 = tail call i32 @qfits_memory_free(i32* %52, i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str.1, i64 0, i64 0), i32 93)
%58 = add nuw nsw i32 %47, 1
%59 = icmp eq i32 %58, 5000
br i1 %59, label %60, label %46
60: ; preds = %46
%61 = tail call i64 (...) @clock()
%62 = sub nsw i64 %61, %45
%63 = sitofp i64 %62 to double
%64 = load i64, i64* @CLOCKS_PER_SEC
%65 = sitofp i64 %64 to double
%66 = fdiv double %63, %65
%67 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0), double %66)
%68 = tail call i64 (...) @clock()
%69 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.9, i64 0, i64 0))
%70 = tail call i32 @qfits_memory_free(i32* %21, i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str.1, i64 0, i64 0), i32 106)
br label %71
71: ; preds = %60, %71
%72 = phi i64 [ 1, %60 ], [ %76, %71 ]
%73 = getelementptr inbounds [20000 x i32*], [20000 x i32*]* %1, i64 0, i64 %72
%74 = load i32*, i32** %73
%75 = tail call i32 @qfits_memory_free(i32* %74, i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str.1, i64 0, i64 0), i32 106)
%76 = add nuw nsw i64 %72, 1
%77 = icmp eq i64 %76, 20000
br i1 %77, label %78, label %71
78: ; preds = %71
%79 = tail call i64 (...) @clock()
%80 = sub nsw i64 %79, %68
%81 = sitofp i64 %80 to double
%82 = load i64, i64* @CLOCKS_PER_SEC
%83 = sitofp i64 %82 to double
%84 = fdiv double %81, %83
%85 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), double %84)
%86 = tail call i32 (...) @qfits_memory_status()
ret i32 0
}