#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 EXIT_SUCCESS;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ printf(char *, int, ...);
int /*<<< orphan*/ sbrk(int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
char *strerror(int /*<<< orphan*/);
int strtol(char *, int /*<<< orphan*/ *, int);
int main(int argc, char *argv[]) {
  char *ptr[1000000];
  int free_min, free_step, free_max, block_size, n_alloc;
  if (argc < 3 || strcmp(argv[1], "--help") == 0) {
    fprintf(stderr, "Usage: %s num-allocs block-size [step [min [max]]]\n",
            argv[0]);
    exit(EXIT_FAILURE);
  }
  n_alloc = strtol(argv[1], NULL, 10);
  if (n_alloc > 1000000) {
    fprintf(stderr, "Err. num-alloc > %d\n", 1000000);
    exit(EXIT_FAILURE);
  }
  block_size = strtol(argv[2], NULL, 10);
  free_step = (argc > 3) ? strtol(argv[3], NULL, 10) : 1;
  free_min = (argc > 4) ? strtol(argv[4], NULL, 10) : 1;
  free_max = (argc > 5) ? strtol(argv[5], NULL, 10) : n_alloc;
  if (free_max > n_alloc) {
    fprintf(stderr, "Err. free_max > num_allocs\n");
    exit(EXIT_FAILURE);
  }
  printf("current Program break: %10p\n", sbrk(0));
  printf("Allocate %d*%d bytes\n", n_alloc, block_size);
  for (int i = 0; i < n_alloc; i++) {
    ptr[i] = malloc(block_size);
    if (ptr[i] == NULL) {
      fprintf(stderr, "Err. malloc(), %s\n", strerror(errno));
      exit(EXIT_FAILURE);
    }
  }
  printf("current Program break: %10p\n", sbrk(0));
  printf("free blocks from %d to %d in steps of %d\n", free_min, free_max,
         free_step);
  for (int i = free_min - 1; i < free_max; i += free_step)
    free(ptr[i]);
  printf("current Program break: %10p\n", sbrk(0));
  return (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)
cmpl   $0x3,-0x8(%rbp)
jl     11d1 <main+0x41>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe3e(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    11fd <main+0x6d>
mov    0x2e08(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe1f(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2dda(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1080 <strtol@plt>
mov    %eax,-0x7a1224(%rbp)
cmpl   $0xf4240,-0x7a1224(%rbp)
jle    1253 <main+0xc3>
mov    0x2db0(%rip),%rax
mov    (%rax),%edi
lea    0xe02(%rip),%rsi
mov    $0xf4240,%edx
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2d84(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1080 <strtol@plt>
mov    %eax,-0x7a1220(%rbp)
cmpl   $0x3,-0x8(%rbp)
jle    129a <main+0x10a>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1080 <strtol@plt>
mov    %eax,-0x7a1230(%rbp)
jmp    12aa <main+0x11a>
mov    $0x1,%eax
mov    %eax,-0x7a1230(%rbp)
jmp    12aa <main+0x11a>
mov    -0x7a1230(%rbp),%eax
mov    %eax,-0x7a1218(%rbp)
cmpl   $0x4,-0x8(%rbp)
jle    12e1 <main+0x151>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1080 <strtol@plt>
mov    %eax,-0x7a1234(%rbp)
jmp    12f1 <main+0x161>
mov    $0x1,%eax
mov    %eax,-0x7a1234(%rbp)
jmp    12f1 <main+0x161>
mov    -0x7a1234(%rbp),%eax
mov    %eax,-0x7a1214(%rbp)
cmpl   $0x5,-0x8(%rbp)
jle    1328 <main+0x198>
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1080 <strtol@plt>
mov    %eax,-0x7a1238(%rbp)
jmp    1334 <main+0x1a4>
mov    -0x7a1224(%rbp),%eax
mov    %eax,-0x7a1238(%rbp)
mov    -0x7a1238(%rbp),%eax
mov    %eax,-0x7a121c(%rbp)
mov    -0x7a121c(%rbp),%eax
cmp    -0x7a1224(%rbp),%eax
jle    1377 <main+0x1e7>
mov    0x2c87(%rip),%rax
mov    (%rax),%edi
lea    0xcee(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2c60(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
xor    %edi,%edi
call   1050 <sbrk@plt>
mov    %eax,%esi
lea    0xce5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x7a1224(%rbp),%esi
mov    -0x7a1220(%rbp),%edx
lea    0xce8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x7a1228(%rbp)
mov    -0x7a1228(%rbp),%eax
cmp    -0x7a1224(%rbp),%eax
jge    1452 <main+0x2c2>
mov    -0x7a1220(%rbp),%edi
call   1090 <malloc@plt>
mov    %rax,%rcx
movslq -0x7a1228(%rbp),%rax
mov    %rcx,-0x7a1210(%rbp,%rax,8)
ff
movslq -0x7a1228(%rbp),%rax
cmpq   $0x0,-0x7a1210(%rbp,%rax,8)
jne    1439 <main+0x2a9>
mov    0x2be2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x7a123c(%rbp)
mov    0x2bcb(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x7a123c(%rbp),%edi
mov    %rax,%rdx
lea    0xc7b(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2b9e(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
jmp    143e <main+0x2ae>
mov    -0x7a1228(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7a1228(%rbp)
jmp    13b2 <main+0x222>
xor    %edi,%edi
call   1050 <sbrk@plt>
mov    %eax,%esi
lea    0xc0a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x7a1214(%rbp),%esi
mov    -0x7a121c(%rbp),%edx
mov    -0x7a1218(%rbp),%ecx
lea    0xc30(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x7a1214(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x7a122c(%rbp)
mov    -0x7a122c(%rbp),%eax
cmp    -0x7a121c(%rbp),%eax
jge    14d5 <main+0x345>
movslq -0x7a122c(%rbp),%rax
mov    -0x7a1210(%rbp,%rax,8),%rdi
ff
call   1030 <free@plt>
mov    -0x7a1218(%rbp),%eax
add    -0x7a122c(%rbp),%eax
mov    %eax,-0x7a122c(%rbp)
jmp    1498 <main+0x308>
xor    %edi,%edi
call   1050 <sbrk@plt>
mov    %eax,%esi
lea    0xb87(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2ad5(%rip),%rax
mov    (%rax),%eax
add    $0x7a1240,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x7a1218,%rsp
mov    %rsi,%rbx
cmp    $0x3,%edi
jl     13ac <main+0x21c>
mov    %edi,%r12d
mov    0x8(%rbx),%rdi
lea    0xe45(%rip),%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     13ac <main+0x21c>
mov    0x8(%rbx),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1080 <strtol@plt>
cmp    $0xf4241,%eax
jge    13c1 <main+0x231>
mov    %eax,%r13d
mov    0x10(%rbx),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1080 <strtol@plt>
mov    %eax,%r14d
mov    $0x1,%r15d
cmp    $0x4,%r12d
jb     126f <main+0xdf>
mov    0x18(%rbx),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1080 <strtol@plt>
mov    %eax,%ebp
cmp    $0x4,%r12d
mov    %eax,0xc(%rsp)
je     127c <main+0xec>
mov    0x20(%rbx),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1080 <strtol@plt>
mov    %eax,%r15d
cmp    $0x6,%r12d
jb     127c <main+0xec>
mov    0x28(%rbx),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1080 <strtol@plt>
mov    %eax,%r12d
cmp    %r13d,%eax
jle    127f <main+0xef>
mov    0x2d86(%rip),%rax
mov    (%rax),%edi
lea    0xded(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    139e <main+0x20e>
mov    %r13d,%r12d
movl   $0x1,0xc(%rsp)
jmp    127f <main+0xef>
mov    %r13d,%r12d
xor    %edi,%edi
call   1050 <sbrk@plt>
lea    0xddf(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdec(%rip),%rdi
mov    %r13d,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
test   %r13d,%r13d
jle    12df <main+0x14f>
mov    %r13d,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14d,%edi
call   1090 <malloc@plt>
mov    %rax,0x10(%rsp,%rbp,8)
test   %rax,%rax
je     1374 <main+0x1e4>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    12c0 <main+0x130>
xor    %edi,%edi
call   1050 <sbrk@plt>
lea    0xd7f(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdb5(%rip),%rdi
mov    %r15d,%esi
mov    %r12d,%edx
mov    0xc(%rsp),%ebp
mov    %ebp,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %r12d,%r15d
jg     1342 <main+0x1b2>
add    $0xffffffff,%r15d
movslq %r15d,%rbx
movslq %ebp,%r14
movslq %r12d,%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x10(%rsp,%rbx,8),%rdi
call   1030 <free@plt>
add    %r14,%rbx
cmp    %rbp,%rbx
jl     1330 <main+0x1a0>
xor    %edi,%edi
call   1050 <sbrk@plt>
lea    0xd1c(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2c68(%rip),%rax
mov    (%rax),%eax
add    $0x7a1218,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c65(%rip),%rax
mov    (%rax),%ebx
mov    0x2c54(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
lea    0xd0d(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    0x2c2b(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
mov    0x2c2d(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xc48(%rip),%rsi
jmp    1397 <main+0x207>
mov    0x2c18(%rip),%rax
mov    (%rax),%edi
lea    0xc6a(%rip),%rsi
mov    $0xf4240,%edx
xor    %eax,%eax
call   1070 <fprintf@plt>
jmp    139e <main+0x20e>

LLVM IR (-O0):
@.str = [7 x i8] c"--help\00"
@stderr = global i32 0
@.str.1 = [52 x i8] c"Usage: %s num-allocs block-size [step [min [max]]]\0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [21 x i8] c"Err. num-alloc > %d\0A\00"
@.str.3 = [28 x i8] c"Err. free_max > num_allocs\0A\00"
@.str.4 = [29 x i8] c"current Program break: %10p\0A\00"
@.str.5 = [22 x i8] c"Allocate %d*%d bytes\0A\00"
@.str.6 = [19 x i8] c"Err. malloc(), %s\0A\00"
@errno = global i32 0
@.str.7 = [42 x i8] c"free blocks from %d to %d in steps of %d\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
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%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, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %30
22: ; preds = %16, %2
%23 = load i32, i32* @stderr
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 0
%26 = load i8*, i8** %25
%27 = call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0), i8* %26)
%28 = load i32, i32* @EXIT_FAILURE
%29 = call i32 @exit(i32 %28)
unreachable
30: ; preds = %16
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
%34 = call i32 @strtol(i8* %33, i32* null, i32 10)
store i32 %34, i32* %11
%35 = load i32, i32* %11
%36 = icmp sgt i32 %35, 1000000
br i1 %36, label %37, label %42
37: ; preds = %30
%38 = load i32, i32* @stderr
%39 = call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 1000000)
%40 = load i32, i32* @EXIT_FAILURE
%41 = call i32 @exit(i32 %40)
unreachable
42: ; preds = %30
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 2
%45 = load i8*, i8** %44
%46 = call i32 @strtol(i8* %45, i32* null, i32 10)
store i32 %46, i32* %10
%47 = load i32, i32* %4
%48 = icmp sgt i32 %47, 3
br i1 %48, label %49, label %54
49: ; preds = %42
%50 = load i8**, i8*** %5
%51 = getelementptr inbounds i8*, i8** %50, i64 3
%52 = load i8*, i8** %51
%53 = call i32 @strtol(i8* %52, i32* null, i32 10)
br label %55
54: ; preds = %42
br label %55
55: ; preds = %54, %49
%56 = phi i32 [ %53, %49 ], [ 1, %54 ]
store i32 %56, i32* %8
%57 = load i32, i32* %4
%58 = icmp sgt i32 %57, 4
br i1 %58, label %59, label %64
59: ; preds = %55
%60 = load i8**, i8*** %5
%61 = getelementptr inbounds i8*, i8** %60, i64 4
%62 = load i8*, i8** %61
%63 = call i32 @strtol(i8* %62, i32* null, i32 10)
br label %65
64: ; preds = %55
br label %65
65: ; preds = %64, %59
%66 = phi i32 [ %63, %59 ], [ 1, %64 ]
store i32 %66, i32* %7
%67 = load i32, i32* %4
%68 = icmp sgt i32 %67, 5
br i1 %68, label %69, label %74
69: ; preds = %65
%70 = load i8**, i8*** %5
%71 = getelementptr inbounds i8*, i8** %70, i64 5
%72 = load i8*, i8** %71
%73 = call i32 @strtol(i8* %72, i32* null, i32 10)
br label %76
74: ; preds = %65
%75 = load i32, i32* %11
br label %76
76: ; preds = %74, %69
%77 = phi i32 [ %73, %69 ], [ %75, %74 ]
store i32 %77, i32* %9
%78 = load i32, i32* %9
%79 = load i32, i32* %11
%80 = icmp sgt i32 %78, %79
br i1 %80, label %81, label %86
81: ; preds = %76
%82 = load i32, i32* @stderr
%83 = call i32 (i32, i8*, ...) @fprintf(i32 %82, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%84 = load i32, i32* @EXIT_FAILURE
%85 = call i32 @exit(i32 %84)
unreachable
86: ; preds = %76
%87 = call i32 @sbrk(i32 0)
%88 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i32 %87)
%89 = load i32, i32* %11
%90 = load i32, i32* %10
%91 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i32 %89, i32 %90)
store i32 0, i32* %12
br label %92
92: ; preds = %115, %86
%93 = load i32, i32* %12
%94 = load i32, i32* %11
%95 = icmp slt i32 %93, %94
br i1 %95, label %96, label %118
96: ; preds = %92
%97 = load i32, i32* %10
%98 = call i8* @malloc(i32 %97)
%99 = load i32, i32* %12
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds [1000000 x i8*], [1000000 x i8*]* %6, i64 0, i64 %100
store i8* %98, i8** %101
%102 = load i32, i32* %12
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds [1000000 x i8*], [1000000 x i8*]* %6, i64 0, i64 %103
%105 = load i8*, i8** %104
%106 = icmp eq i8* %105, null
br i1 %106, label %107, label %114
107: ; preds = %96
%108 = load i32, i32* @stderr
%109 = load i32, i32* @errno
%110 = call i8* @strerror(i32 %109)
%111 = call i32 (i32, i8*, ...) @fprintf(i32 %108, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8* %110)
%112 = load i32, i32* @EXIT_FAILURE
%113 = call i32 @exit(i32 %112)
unreachable
114: ; preds = %96
br label %115
115: ; preds = %114
%116 = load i32, i32* %12
%117 = add nsw i32 %116, 1
store i32 %117, i32* %12
br label %92
118: ; preds = %92
%119 = call i32 @sbrk(i32 0)
%120 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i32 %119)
%121 = load i32, i32* %7
%122 = load i32, i32* %9
%123 = load i32, i32* %8
%124 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0), i32 %121, i32 %122, i32 %123)
%125 = load i32, i32* %7
%126 = sub nsw i32 %125, 1
store i32 %126, i32* %13
br label %127
127: ; preds = %137, %118
%128 = load i32, i32* %13
%129 = load i32, i32* %9
%130 = icmp slt i32 %128, %129
br i1 %130, label %131, label %141
131: ; preds = %127
%132 = load i32, i32* %13
%133 = sext i32 %132 to i64
%134 = getelementptr inbounds [1000000 x i8*], [1000000 x i8*]* %6, i64 0, i64 %133
%135 = load i8*, i8** %134
%136 = call i32 @free(i8* %135)
br label %137
137: ; preds = %131
%138 = load i32, i32* %8
%139 = load i32, i32* %13
%140 = add nsw i32 %139, %138
store i32 %140, i32* %13
br label %127
141: ; preds = %127
%142 = call i32 @sbrk(i32 0)
%143 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i32 %142)
%144 = load i32, i32* @EXIT_SUCCESS
ret i32 %144
}

LLVM IR (-O2):
@.str = [7 x i8] c"--help\00"
@stderr = global i32 0
@.str.1 = [52 x i8] c"Usage: %s num-allocs block-size [step [min [max]]]\0A\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [21 x i8] c"Err. num-alloc > %d\0A\00"
@.str.3 = [28 x i8] c"Err. free_max > num_allocs\0A\00"
@.str.4 = [29 x i8] c"current Program break: %10p\0A\00"
@.str.5 = [22 x i8] c"Allocate %d*%d bytes\0A\00"
@.str.6 = [19 x i8] c"Err. malloc(), %s\0A\00"
@errno = global i32 0
@.str.7 = [42 x i8] c"free blocks from %d to %d in steps of %d\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 = icmp slt i32 %0, 3
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %17
11: ; preds = %6, %2
%12 = load i32, i32* @stderr
%13 = load i8*, i8** %1
%14 = tail call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0), i8* %13)
%15 = load i32, i32* @EXIT_FAILURE
%16 = tail call i32 @exit(i32 %15)
unreachable
17: ; preds = %6
%18 = load i8*, i8** %7
%19 = tail call i32 @strtol(i8* nocapture %18, i32* null, i32 10)
%20 = icmp sgt i32 %19, 1000000
br i1 %20, label %21, label %26
21: ; preds = %17
%22 = load i32, i32* @stderr
%23 = tail call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 1000000)
%24 = load i32, i32* @EXIT_FAILURE
%25 = tail call i32 @exit(i32 %24)
unreachable
26: ; preds = %17
%27 = getelementptr inbounds i8*, i8** %1, i64 2
%28 = load i8*, i8** %27
%29 = tail call i32 @strtol(i8* nocapture %28, i32* null, i32 10)
%30 = icmp ugt i32 %0, 3
br i1 %30, label %31, label %51
31: ; preds = %26
%32 = getelementptr inbounds i8*, i8** %1, i64 3
%33 = load i8*, i8** %32
%34 = tail call i32 @strtol(i8* nocapture %33, i32* null, i32 10)
%35 = icmp eq i32 %0, 4
br i1 %35, label %51, label %36
36: ; preds = %31
%37 = getelementptr inbounds i8*, i8** %1, i64 4
%38 = load i8*, i8** %37
%39 = tail call i32 @strtol(i8* nocapture %38, i32* null, i32 10)
%40 = icmp ugt i32 %0, 5
br i1 %40, label %41, label %51
41: ; preds = %36
%42 = getelementptr inbounds i8*, i8** %1, i64 5
%43 = load i8*, i8** %42
%44 = tail call i32 @strtol(i8* nocapture %43, i32* null, i32 10)
%45 = icmp sgt i32 %44, %19
br i1 %45, label %46, label %51
46: ; preds = %41
%47 = load i32, i32* @stderr
%48 = tail call i32 (i32, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%49 = load i32, i32* @EXIT_FAILURE
%50 = tail call i32 @exit(i32 %49)
unreachable
51: ; preds = %26, %31, %36, %41
%52 = phi i32 [ %44, %41 ], [ %19, %36 ], [ %19, %31 ], [ %19, %26 ]
%53 = phi i32 [ %34, %41 ], [ %34, %36 ], [ %34, %31 ], [ 1, %26 ]
%54 = phi i32 [ %39, %41 ], [ %39, %36 ], [ 1, %31 ], [ 1, %26 ]
%55 = tail call i32 @sbrk(i32 0)
%56 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i32 %55)
%57 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i32 %19, i32 %29)
%58 = icmp sgt i32 %19, 0
br i1 %58, label %59, label %63
59: ; preds = %51
%60 = zext i32 %19 to i64
br label %73
61: ; preds = %73
%62 = icmp eq i64 %78, %60
br i1 %62, label %63, label %73
63: ; preds = %61, %51
%64 = tail call i32 @sbrk(i32 0)
%65 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i32 %64)
%66 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0), i32 %54, i32 %52, i32 %53)
%67 = icmp sgt i32 %54, %52
br i1 %67, label %86, label %68
68: ; preds = %63
%69 = add i32 %54, -1
%70 = sext i32 %69 to i64
%71 = sext i32 %53 to i64
%72 = sext i32 %52 to i64
br label %90
73: ; preds = %59, %61
%74 = phi i64 [ 0, %59 ], [ %78, %61 ]
%75 = tail call i8* @malloc(i32 %29)
%76 = getelementptr inbounds [1000000 x i8*], [1000000 x i8*]* %3, i64 0, i64 %74
store i8* %75, i8** %76
%77 = icmp eq i8* %75, null
%78 = add nuw nsw i64 %74, 1
br i1 %77, label %79, label %61
79: ; preds = %73
%80 = load i32, i32* @stderr
%81 = load i32, i32* @errno
%82 = tail call i8* @strerror(i32 %81)
%83 = tail call i32 (i32, i8*, ...) @fprintf(i32 %80, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8* %82)
%84 = load i32, i32* @EXIT_FAILURE
%85 = tail call i32 @exit(i32 %84)
unreachable
86: ; preds = %90, %63
%87 = tail call i32 @sbrk(i32 0)
%88 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i32 %87)
%89 = load i32, i32* @EXIT_SUCCESS
ret i32 %89
90: ; preds = %68, %90
%91 = phi i64 [ %70, %68 ], [ %95, %90 ]
%92 = getelementptr inbounds [1000000 x i8*], [1000000 x i8*]* %3, i64 0, i64 %91
%93 = load i8*, i8** %92
%94 = tail call i32 @free(i8* %93)
%95 = add i64 %91, %71
%96 = icmp slt i64 %95, %72
br i1 %96, label %90, label %86
}