#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*/ qfits_memory_free(int *, char *, int);
int *qfits_memory_malloc(int, char *, int);
void stress2(void) {
  int i;
  int *ip[100];
  for (i = 0; i < 100; i++) {
    ip[i] = qfits_memory_malloc(
        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_stress.c",
        91);
  }
  for (i = 0; i < 100 / 2; i++) {
    qfits_memory_free(ip[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_stress.c",
                      94);
  }
  for (i = 0; i < 100 / 2; i++) {
    ip[i] = qfits_memory_malloc(
        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_stress.c",
        97);
  }
  for (i = 0; i < 100; i++) {
    qfits_memory_free(ip[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_stress.c",
                      100);
  }
}


x86 assembly (clang, -O0):
<stress2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x330,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x64,-0x4(%rbp)
jge    116f <stress2+0x4f>
mov    $0x4,%edi
lea    0xeb8(%rip),%rsi
mov    $0x5b,%edx
call   1030 <qfits_memory_malloc@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
mov    %rcx,-0x330(%rbp,%rax,8)
ff
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1132 <stress2+0x12>
movl   $0x0,-0x4(%rbp)
cmpl   $0x32,-0x4(%rbp)
jge    11ab <stress2+0x8b>
movslq -0x4(%rbp),%rax
mov    -0x330(%rbp,%rax,8),%rdi
ff
lea    0xe6d(%rip),%rsi
mov    $0x5e,%edx
call   1040 <qfits_memory_free@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1176 <stress2+0x56>
movl   $0x0,-0x4(%rbp)
cmpl   $0x32,-0x4(%rbp)
jge    11ef <stress2+0xcf>
mov    $0x4,%edi
lea    0xe38(%rip),%rsi
mov    $0x61,%edx
call   1030 <qfits_memory_malloc@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
mov    %rcx,-0x330(%rbp,%rax,8)
ff
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11b2 <stress2+0x92>
movl   $0x0,-0x4(%rbp)
cmpl   $0x64,-0x4(%rbp)
jge    122b <stress2+0x10b>
movslq -0x4(%rbp),%rax
mov    -0x330(%rbp,%rax,8),%rdi
ff
lea    0xded(%rip),%rsi
mov    $0x64,%edx
call   1040 <qfits_memory_free@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11f6 <stress2+0xd6>
add    $0x330,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stress2>:
push   %r14
push   %rbx
sub    $0x328,%rsp
xor    %ebx,%ebx
lea    0xecd(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x4,%edi
mov    %r14,%rsi
mov    $0x5b,%edx
call   1030 <qfits_memory_malloc@plt>
mov    %rax,(%rsp,%rbx,8)
add    $0x1,%rbx
cmp    $0x64,%rbx
jne    1140 <stress2+0x20>
xor    %ebx,%ebx
lea    0xe97(%rip),%r14
nopl   0x0(%rax)
mov    (%rsp,%rbx,8),%rdi
mov    %r14,%rsi
mov    $0x5e,%edx
call   1040 <qfits_memory_free@plt>
add    $0x1,%rbx
cmp    $0x32,%rbx
jne    1170 <stress2+0x50>
xor    %ebx,%ebx
lea    0xe6c(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0x4,%edi
mov    %r14,%rsi
mov    $0x61,%edx
call   1030 <qfits_memory_malloc@plt>
mov    %rax,(%rsp,%rbx,8)
add    $0x1,%rbx
cmp    $0x32,%rbx
jne    11a0 <stress2+0x80>
xor    %ebx,%ebx
lea    0xe37(%rip),%r14
nopl   0x0(%rax)
mov    (%rsp,%rbx,8),%rdi
mov    %r14,%rsi
mov    $0x64,%edx
call   1040 <qfits_memory_free@plt>
add    $0x1,%rbx
cmp    $0x64,%rbx
jne    11d0 <stress2+0xb0>
add    $0x328,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [161 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_stress.c\00"
define void @stress2() {
%1 = alloca i32
%2 = alloca [100 x i32*]
store i32 0, i32* %1
br label %3
3: ; preds = %11, %0
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 100
br i1 %5, label %6, label %14
6: ; preds = %3
%7 = call i32* @qfits_memory_malloc(i32 4, i8* getelementptr inbounds ([161 x i8], [161 x i8]* @.str, i64 0, i64 0), i32 91)
%8 = load i32, i32* %1
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [100 x i32*], [100 x i32*]* %2, i64 0, i64 %9
store i32* %7, i32** %10
br label %11
11: ; preds = %6
%12 = load i32, i32* %1
%13 = add nsw i32 %12, 1
store i32 %13, i32* %1
br label %3
14: ; preds = %3
store i32 0, i32* %1
br label %15
15: ; preds = %24, %14
%16 = load i32, i32* %1
%17 = icmp slt i32 %16, 50
br i1 %17, label %18, label %27
18: ; preds = %15
%19 = load i32, i32* %1
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [100 x i32*], [100 x i32*]* %2, i64 0, i64 %20
%22 = load i32*, i32** %21
%23 = call i32 @qfits_memory_free(i32* %22, i8* getelementptr inbounds ([161 x i8], [161 x i8]* @.str, i64 0, i64 0), i32 94)
br label %24
24: ; preds = %18
%25 = load i32, i32* %1
%26 = add nsw i32 %25, 1
store i32 %26, i32* %1
br label %15
27: ; preds = %15
store i32 0, i32* %1
br label %28
28: ; preds = %36, %27
%29 = load i32, i32* %1
%30 = icmp slt i32 %29, 50
br i1 %30, label %31, label %39
31: ; preds = %28
%32 = call i32* @qfits_memory_malloc(i32 4, i8* getelementptr inbounds ([161 x i8], [161 x i8]* @.str, i64 0, i64 0), i32 97)
%33 = load i32, i32* %1
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [100 x i32*], [100 x i32*]* %2, i64 0, i64 %34
store i32* %32, i32** %35
br label %36
36: ; preds = %31
%37 = load i32, i32* %1
%38 = add nsw i32 %37, 1
store i32 %38, i32* %1
br label %28
39: ; preds = %28
store i32 0, i32* %1
br label %40
40: ; preds = %49, %39
%41 = load i32, i32* %1
%42 = icmp slt i32 %41, 100
br i1 %42, label %43, label %52
43: ; preds = %40
%44 = load i32, i32* %1
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [100 x i32*], [100 x i32*]* %2, i64 0, i64 %45
%47 = load i32*, i32** %46
%48 = call i32 @qfits_memory_free(i32* %47, i8* getelementptr inbounds ([161 x i8], [161 x i8]* @.str, i64 0, i64 0), i32 100)
br label %49
49: ; preds = %43
%50 = load i32, i32* %1
%51 = add nsw i32 %50, 1
store i32 %51, i32* %1
br label %40
52: ; preds = %40
ret void
}

LLVM IR (-O2):
@.str = [161 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_stress.c\00"
define void @stress2() {
%1 = alloca [100 x i32*]
%2 = bitcast [100 x i32*]* %1 to i8*
br label %3
3: ; preds = %0, %3
%4 = phi i64 [ 0, %0 ], [ %7, %3 ]
%5 = tail call i32* @qfits_memory_malloc(i32 4, i8* getelementptr inbounds ([161 x i8], [161 x i8]* @.str, i64 0, i64 0), i32 91)
%6 = getelementptr inbounds [100 x i32*], [100 x i32*]* %1, i64 0, i64 %4
store i32* %5, i32** %6
%7 = add nuw nsw i64 %4, 1
%8 = icmp eq i64 %7, 100
br i1 %8, label %9, label %3
9: ; preds = %3, %9
%10 = phi i64 [ %14, %9 ], [ 0, %3 ]
%11 = getelementptr inbounds [100 x i32*], [100 x i32*]* %1, i64 0, i64 %10
%12 = load i32*, i32** %11
%13 = tail call i32 @qfits_memory_free(i32* %12, i8* getelementptr inbounds ([161 x i8], [161 x i8]* @.str, i64 0, i64 0), i32 94)
%14 = add nuw nsw i64 %10, 1
%15 = icmp eq i64 %14, 50
br i1 %15, label %16, label %9
16: ; preds = %9, %16
%17 = phi i64 [ %20, %16 ], [ 0, %9 ]
%18 = tail call i32* @qfits_memory_malloc(i32 4, i8* getelementptr inbounds ([161 x i8], [161 x i8]* @.str, i64 0, i64 0), i32 97)
%19 = getelementptr inbounds [100 x i32*], [100 x i32*]* %1, i64 0, i64 %17
store i32* %18, i32** %19
%20 = add nuw nsw i64 %17, 1
%21 = icmp eq i64 %20, 50
br i1 %21, label %22, label %16
22: ; preds = %16, %22
%23 = phi i64 [ %27, %22 ], [ 0, %16 ]
%24 = getelementptr inbounds [100 x i32*], [100 x i32*]* %1, i64 0, i64 %23
%25 = load i32*, i32** %24
%26 = tail call i32 @qfits_memory_free(i32* %25, i8* getelementptr inbounds ([161 x i8], [161 x i8]* @.str, i64 0, i64 0), i32 100)
%27 = add nuw nsw i64 %23, 1
%28 = icmp eq i64 %27, 100
br i1 %28, label %29, label %22
29: ; preds = %22
ret void
}