#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_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ exitErr(char *);
int /*<<< orphan*/ free(char *);
int getInt(char *);
char *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sbrk(int /*<<< orphan*/);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ usage(char *);
int main(int argc, char **argv) {
  char *ptr[1000000];
  int freeStep, freeMin, freeMax, blockSize, numAllocs, j;
  printf("\n");
  if (argc < 3 || strcmp(argv[1], "--help") == 0)
    usage(argv[0]);
  numAllocs = getInt(argv[1]);
  if (numAllocs > 1000000)
    exitErr("num-allocs > max");
  blockSize = getInt(argv[2]);
  freeStep = (argc > 3) ? getInt(argv[3]) : 1;
  freeMin = (argc > 4) ? getInt(argv[4]) : 1;
  freeMax = (argc > 5) ? getInt(argv[5]) : numAllocs;
  if (freeMax > numAllocs)
    exitErr("free-max > num-allocs");
  printf("Initial program break: %10p\n", sbrk(0));
  printf("Allocating %d * %d bytes\n", numAllocs, blockSize);
  for (j = 0; j < numAllocs; j++) {
    ptr[j] = malloc(blockSize);
    printf("Program break is now: %10p\n", sbrk(0));
    if (ptr[j] == NULL)
      exitErr("malloc");
  }
  printf("Finished allocation.\nProgram break is now: %10p\n", sbrk(0));
  printf("Freeing blocks from %d to %d in steps of %d\n", freeMin, freeMax,
         freeStep);
  for (j = freeMin; j < freeMax; j += freeStep)
    free(ptr[j]);
  printf("After free(), program break is: %10p\n", sbrk(0));
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x7a1240,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xf18(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x3,-0x8(%rbp)
jl     11df <main+0x4f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe30(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    11eb <main+0x5b>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1090 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10a0 <getInt@plt>
mov    %eax,-0x7a1224(%rbp)
cmpl   $0xf4240,-0x7a1224(%rbp)
jle    121a <main+0x8a>
lea    0xdf2(%rip),%rdi
call   1040 <exitErr@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10a0 <getInt@plt>
mov    %eax,-0x7a1220(%rbp)
cmpl   $0x3,-0x8(%rbp)
jle    124f <main+0xbf>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10a0 <getInt@plt>
mov    %eax,-0x7a122c(%rbp)
jmp    125f <main+0xcf>
mov    $0x1,%eax
mov    %eax,-0x7a122c(%rbp)
jmp    125f <main+0xcf>
mov    -0x7a122c(%rbp),%eax
mov    %eax,-0x7a1214(%rbp)
cmpl   $0x4,-0x8(%rbp)
jle    128d <main+0xfd>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   10a0 <getInt@plt>
mov    %eax,-0x7a1230(%rbp)
jmp    129d <main+0x10d>
mov    $0x1,%eax
mov    %eax,-0x7a1230(%rbp)
jmp    129d <main+0x10d>
mov    -0x7a1230(%rbp),%eax
mov    %eax,-0x7a1218(%rbp)
cmpl   $0x5,-0x8(%rbp)
jle    12cb <main+0x13b>
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
call   10a0 <getInt@plt>
mov    %eax,-0x7a1234(%rbp)
jmp    12d7 <main+0x147>
mov    -0x7a1224(%rbp),%eax
mov    %eax,-0x7a1234(%rbp)
mov    -0x7a1234(%rbp),%eax
mov    %eax,-0x7a121c(%rbp)
mov    -0x7a121c(%rbp),%eax
cmp    -0x7a1224(%rbp),%eax
jle    1301 <main+0x171>
lea    0xd1c(%rip),%rdi
call   1040 <exitErr@plt>
xor    %edi,%edi
call   1060 <sbrk@plt>
mov    %eax,%esi
lea    0xd1d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x7a1224(%rbp),%esi
mov    -0x7a1220(%rbp),%edx
lea    0xd20(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x7a1228(%rbp)
mov    -0x7a1228(%rbp),%eax
cmp    -0x7a1224(%rbp),%eax
jge    13bd <main+0x22d>
mov    -0x7a1220(%rbp),%edi
call   1080 <malloc@plt>
mov    %rax,%rcx
movslq -0x7a1228(%rbp),%rax
mov    %rcx,-0x7a1210(%rbp,%rax,8)
ff
xor    %edi,%edi
call   1060 <sbrk@plt>
mov    %eax,%esi
lea    0xd06(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movslq -0x7a1228(%rbp),%rax
cmpq   $0x0,-0x7a1210(%rbp,%rax,8)
jne    13a4 <main+0x214>
lea    0xcc6(%rip),%rdi
call   1040 <exitErr@plt>
jmp    13a9 <main+0x219>
mov    -0x7a1228(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7a1228(%rbp)
jmp    133c <main+0x1ac>
xor    %edi,%edi
call   1060 <sbrk@plt>
mov    %eax,%esi
lea    0xc9f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x7a1218(%rbp),%esi
mov    -0x7a121c(%rbp),%edx
mov    -0x7a1214(%rbp),%ecx
lea    0xcb0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x7a1218(%rbp),%eax
mov    %eax,-0x7a1228(%rbp)
mov    -0x7a1228(%rbp),%eax
cmp    -0x7a121c(%rbp),%eax
jge    143d <main+0x2ad>
movslq -0x7a1228(%rbp),%rax
mov    -0x7a1210(%rbp,%rax,8),%rdi
ff
call   1030 <free@plt>
mov    -0x7a1214(%rbp),%eax
add    -0x7a1228(%rbp),%eax
mov    %eax,-0x7a1228(%rbp)
jmp    1400 <main+0x270>
xor    %edi,%edi
call   1060 <sbrk@plt>
mov    %eax,%esi
lea    0xc7d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2b85(%rip),%rax
mov    (%rax),%edi
call   10b0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x7a1218,%rsp
mov    %rsi,%rbx
mov    %edi,%r12d
mov    $0xa,%edi
call   1040 <putchar@plt>
cmp    $0x3,%r12d
jl     11dc <main+0x3c>
mov    0x8(%rbx),%rdi
lea    0xe2e(%rip),%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
jne    11e4 <main+0x44>
mov    (%rbx),%rdi
call   10a0 <usage@plt>
mov    0x8(%rbx),%rdi
call   10b0 <getInt@plt>
mov    %eax,%r13d
cmp    $0xf4241,%eax
jl     1203 <main+0x63>
lea    0xe09(%rip),%rdi
call   1050 <exitErr@plt>
mov    0x10(%rbx),%rdi
call   10b0 <getInt@plt>
mov    %eax,%ebp
cmp    $0x4,%r12d
jl     123d <main+0x9d>
mov    0x18(%rbx),%rdi
call   10b0 <getInt@plt>
mov    %eax,%r14d
cmp    $0x4,%r12d
mov    %eax,0xc(%rsp)
jne    1357 <main+0x1b7>
movl   $0x1,0x8(%rsp)
mov    %r13d,0x4(%rsp)
jmp    1252 <main+0xb2>
movl   $0x1,0x8(%rsp)
mov    %r13d,0x4(%rsp)
movl   $0x1,0xc(%rsp)
xor    %edi,%edi
call   1070 <sbrk@plt>
lea    0xdce(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xddb(%rip),%rdi
mov    %r13d,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1060 <printf@plt>
test   %r13d,%r13d
jle    12da <main+0x13a>
mov    %r13d,%r15d
lea    0xdf6(%rip),%rbx
lea    0xdd3(%rip),%r13
xor    %r12d,%r12d
jmp    12a9 <main+0x109>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r12
cmp    %r12,%r15
je     12da <main+0x13a>
mov    %ebp,%edi
call   1090 <malloc@plt>
mov    %rax,%r14
mov    %rax,0x10(%rsp,%r12,8)
xor    %edi,%edi
call   1070 <sbrk@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
test   %r14,%r14
jne    12a0 <main+0x100>
mov    %r13,%rdi
call   1050 <exitErr@plt>
jmp    12a0 <main+0x100>
xor    %edi,%edi
call   1070 <sbrk@plt>
lea    0xd84(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xda5(%rip),%rdi
mov    0x8(%rsp),%ebx
mov    %ebx,%esi
mov    0x4(%rsp),%ebp
mov    %ebp,%edx
mov    0xc(%rsp),%r14d
mov    %r14d,%ecx
xor    %eax,%eax
call   1060 <printf@plt>
cmp    %ebp,%ebx
jge    1332 <main+0x192>
movslq %ebx,%rbx
movslq %r14d,%r14
movslq %ebp,%rbp
mov    0x10(%rsp,%rbx,8),%rdi
call   1030 <free@plt>
add    %r14,%rbx
cmp    %rbp,%rbx
jl     1320 <main+0x180>
xor    %edi,%edi
call   1070 <sbrk@plt>
lea    0xd8a(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x2c90(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
mov    0x20(%rbx),%rdi
call   10b0 <getInt@plt>
cmp    $0x6,%r12d
mov    %eax,0x8(%rsp)
jb     1391 <main+0x1f1>
mov    0x28(%rbx),%rdi
call   10b0 <getInt@plt>
mov    %eax,0x4(%rsp)
cmp    %r13d,%eax
jle    1252 <main+0xb2>
lea    0xc91(%rip),%rdi
call   1050 <exitErr@plt>
jmp    1252 <main+0xb2>
mov    %r13d,0x4(%rsp)
jmp    1252 <main+0xb2>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [7 x i8] c"--help\00"
@.str.2 = [17 x i8] c"num-allocs > max\00"
@.str.3 = [22 x i8] c"free-max > num-allocs\00"
@.str.4 = [29 x i8] c"Initial program break: %10p\0A\00"
@.str.5 = [26 x i8] c"Allocating %d * %d bytes\0A\00"
@.str.6 = [28 x i8] c"Program break is now: %10p\0A\00"
@.str.7 = [7 x i8] c"malloc\00"
@.str.8 = [49 x i8] c"Finished allocation.\0AProgram break is now: %10p\0A\00"
@.str.9 = [45 x i8] c"Freeing blocks from %d to %d in steps of %d\0A\00"
@.str.10 = [38 x i8] c"After free(), program break is: %10p\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1000000 x i8*]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 3
br i1 %15, label %22, label %16
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %27
22: ; preds = %16, %2
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 0
%25 = load i8*, i8** %24
%26 = call i32 @usage(i8* %25)
br label %27
27: ; preds = %22, %16
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = call i32 @getInt(i8* %30)
store i32 %31, i32* %11
%32 = load i32, i32* %11
%33 = icmp sgt i32 %32, 1000000
br i1 %33, label %34, label %36
34: ; preds = %27
%35 = call i32 @exitErr(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %36
36: ; preds = %34, %27
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 2
%39 = load i8*, i8** %38
%40 = call i32 @getInt(i8* %39)
store i32 %40, i32* %10
%41 = load i32, i32* %4
%42 = icmp sgt i32 %41, 3
br i1 %42, label %43, label %48
43: ; preds = %36
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 3
%46 = load i8*, i8** %45
%47 = call i32 @getInt(i8* %46)
br label %49
48: ; preds = %36
br label %49
49: ; preds = %48, %43
%50 = phi i32 [ %47, %43 ], [ 1, %48 ]
store i32 %50, i32* %7
%51 = load i32, i32* %4
%52 = icmp sgt i32 %51, 4
br i1 %52, label %53, label %58
53: ; preds = %49
%54 = load i8**, i8*** %5
%55 = getelementptr inbounds i8*, i8** %54, i64 4
%56 = load i8*, i8** %55
%57 = call i32 @getInt(i8* %56)
br label %59
58: ; preds = %49
br label %59
59: ; preds = %58, %53
%60 = phi i32 [ %57, %53 ], [ 1, %58 ]
store i32 %60, i32* %8
%61 = load i32, i32* %4
%62 = icmp sgt i32 %61, 5
br i1 %62, label %63, label %68
63: ; preds = %59
%64 = load i8**, i8*** %5
%65 = getelementptr inbounds i8*, i8** %64, i64 5
%66 = load i8*, i8** %65
%67 = call i32 @getInt(i8* %66)
br label %70
68: ; preds = %59
%69 = load i32, i32* %11
br label %70
70: ; preds = %68, %63
%71 = phi i32 [ %67, %63 ], [ %69, %68 ]
store i32 %71, i32* %9
%72 = load i32, i32* %9
%73 = load i32, i32* %11
%74 = icmp sgt i32 %72, %73
br i1 %74, label %75, label %77
75: ; preds = %70
%76 = call i32 @exitErr(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
br label %77
77: ; preds = %75, %70
%78 = call i32 @sbrk(i32 0)
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i32 %78)
%80 = load i32, i32* %11
%81 = load i32, i32* %10
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i32 %80, i32 %81)
store i32 0, i32* %12
br label %83
83: ; preds = %103, %77
%84 = load i32, i32* %12
%85 = load i32, i32* %11
%86 = icmp slt i32 %84, %85
br i1 %86, label %87, label %106
87: ; preds = %83
%88 = load i32, i32* %10
%89 = call i8* @malloc(i32 %88)
%90 = load i32, i32* %12
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds [1000000 x i8*], [1000000 x i8*]* %6, i64 0, i64 %91
store i8* %89, i8** %92
%93 = call i32 @sbrk(i32 0)
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i32 %93)
%95 = load i32, i32* %12
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds [1000000 x i8*], [1000000 x i8*]* %6, i64 0, i64 %96
%98 = load i8*, i8** %97
%99 = icmp eq i8* %98, null
br i1 %99, label %100, label %102
100: ; preds = %87
%101 = call i32 @exitErr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
br label %102
102: ; preds = %100, %87
br label %103
103: ; preds = %102
%104 = load i32, i32* %12
%105 = add nsw i32 %104, 1
store i32 %105, i32* %12
br label %83
106: ; preds = %83
%107 = call i32 @sbrk(i32 0)
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.8, i64 0, i64 0), i32 %107)
%109 = load i32, i32* %8
%110 = load i32, i32* %9
%111 = load i32, i32* %7
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.9, i64 0, i64 0), i32 %109, i32 %110, i32 %111)
%113 = load i32, i32* %8
store i32 %113, i32* %12
br label %114
114: ; preds = %124, %106
%115 = load i32, i32* %12
%116 = load i32, i32* %9
%117 = icmp slt i32 %115, %116
br i1 %117, label %118, label %128
118: ; preds = %114
%119 = load i32, i32* %12
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds [1000000 x i8*], [1000000 x i8*]* %6, i64 0, i64 %120
%122 = load i8*, i8** %121
%123 = call i32 @free(i8* %122)
br label %124
124: ; preds = %118
%125 = load i32, i32* %7
%126 = load i32, i32* %12
%127 = add nsw i32 %126, %125
store i32 %127, i32* %12
br label %114
128: ; preds = %114
%129 = call i32 @sbrk(i32 0)
%130 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.10, i64 0, i64 0), i32 %129)
%131 = load i32, i32* @EXIT_SUCCESS
%132 = call i32 @exit(i32 %131)
unreachable
}

LLVM IR (-O2):
@.str.1 = [7 x i8] c"--help\00"
@.str.2 = [17 x i8] c"num-allocs > max\00"
@.str.3 = [22 x i8] c"free-max > num-allocs\00"
@.str.4 = [29 x i8] c"Initial program break: %10p\0A\00"
@.str.5 = [26 x i8] c"Allocating %d * %d bytes\0A\00"
@.str.6 = [28 x i8] c"Program break is now: %10p\0A\00"
@.str.7 = [7 x i8] c"malloc\00"
@.str.8 = [49 x i8] c"Finished allocation.\0AProgram break is now: %10p\0A\00"
@.str.9 = [45 x i8] c"Freeing blocks from %d to %d in steps of %d\0A\00"
@.str.10 = [38 x i8] c"After free(), program break is: %10p\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1000000 x i8*]
%4 = bitcast [1000000 x i8*]* %3 to i8*
%5 = tail call i32 @putchar(i32 10)
%6 = icmp slt i32 %0, 3
br i1 %6, label %12, label %7
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %7, %2
%13 = load i8*, i8** %1
%14 = tail call i32 @usage(i8* %13)
br label %15
15: ; preds = %12, %7
%16 = getelementptr inbounds i8*, i8** %1, i64 1
%17 = load i8*, i8** %16
%18 = tail call i32 @getInt(i8* %17)
%19 = icmp sgt i32 %18, 1000000
br i1 %19, label %20, label %22
20: ; preds = %15
%21 = tail call i32 @exitErr(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %22
22: ; preds = %20, %15
%23 = getelementptr inbounds i8*, i8** %1, i64 2
%24 = load i8*, i8** %23
%25 = tail call i32 @getInt(i8* %24)
%26 = icmp sgt i32 %0, 3
br i1 %26, label %27, label %44
27: ; preds = %22
%28 = getelementptr inbounds i8*, i8** %1, i64 3
%29 = load i8*, i8** %28
%30 = tail call i32 @getInt(i8* %29)
%31 = icmp eq i32 %0, 4
br i1 %31, label %44, label %32
32: ; preds = %27
%33 = getelementptr inbounds i8*, i8** %1, i64 4
%34 = load i8*, i8** %33
%35 = tail call i32 @getInt(i8* %34)
%36 = icmp ugt i32 %0, 5
br i1 %36, label %37, label %44
37: ; preds = %32
%38 = getelementptr inbounds i8*, i8** %1, i64 5
%39 = load i8*, i8** %38
%40 = tail call i32 @getInt(i8* %39)
%41 = icmp sgt i32 %40, %18
br i1 %41, label %42, label %44
42: ; preds = %37
%43 = tail call i32 @exitErr(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
br label %44
44: ; preds = %22, %27, %32, %42, %37
%45 = phi i32 [ %40, %42 ], [ %40, %37 ], [ %18, %32 ], [ %18, %27 ], [ %18, %22 ]
%46 = phi i32 [ %30, %42 ], [ %30, %37 ], [ %30, %32 ], [ %30, %27 ], [ 1, %22 ]
%47 = phi i32 [ %35, %42 ], [ %35, %37 ], [ %35, %32 ], [ 1, %27 ], [ 1, %22 ]
%48 = tail call i32 @sbrk(i32 0)
%49 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i32 %48)
%50 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i32 %18, i32 %25)
%51 = icmp sgt i32 %18, 0
br i1 %51, label %52, label %66
52: ; preds = %44
%53 = zext i32 %18 to i64
br label %54
54: ; preds = %52, %63
%55 = phi i64 [ 0, %52 ], [ %64, %63 ]
%56 = tail call i8* @malloc(i32 %25)
%57 = getelementptr inbounds [1000000 x i8*], [1000000 x i8*]* %3, i64 0, i64 %55
store i8* %56, i8** %57
%58 = tail call i32 @sbrk(i32 0)
%59 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i32 %58)
%60 = icmp eq i8* %56, null
br i1 %60, label %61, label %63
61: ; preds = %54
%62 = tail call i32 @exitErr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
br label %63
63: ; preds = %54, %61
%64 = add nuw nsw i64 %55, 1
%65 = icmp eq i64 %64, %53
br i1 %65, label %66, label %54
66: ; preds = %63, %44
%67 = tail call i32 @sbrk(i32 0)
%68 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.8, i64 0, i64 0), i32 %67)
%69 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.9, i64 0, i64 0), i32 %47, i32 %45, i32 %46)
%70 = icmp slt i32 %47, %45
br i1 %70, label %71, label %82
71: ; preds = %66
%72 = sext i32 %47 to i64
%73 = sext i32 %46 to i64
%74 = sext i32 %45 to i64
br label %75
75: ; preds = %71, %75
%76 = phi i64 [ %72, %71 ], [ %80, %75 ]
%77 = getelementptr inbounds [1000000 x i8*], [1000000 x i8*]* %3, i64 0, i64 %76
%78 = load i8*, i8** %77
%79 = tail call i32 @free(i8* %78)
%80 = add i64 %76, %73
%81 = icmp slt i64 %80, %74
br i1 %81, label %75, label %82
82: ; preds = %75, %66
%83 = tail call i32 @sbrk(i32 0)
%84 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.10, i64 0, i64 0), i32 %83)
%85 = load i32, i32* @EXIT_SUCCESS
%86 = tail call i32 @exit(i32 %85)
unreachable
}