#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*/ free(char *);
int /*<<< orphan*/ jumped();
char *malloc(int);
int main(int argc, char *argv[]) {
  char *semi_big = NULL;
  char *big = NULL;
  char *small = NULL;
  char *other_small = NULL;
  int i;
  int j;
  semi_big = malloc(900000);
  big = malloc(1000001);
  free(semi_big);
  free(big);
  if (big[1000] > 0x0)
    jumped();
  if (semi_big[1000] > 0x0)
    jumped();
  small = malloc(10000);
  free(small);
  if (big[2000] > 0x0)
    jumped();
  if (semi_big[2000] > 0x0)
    jumped();
  big = NULL;
  {
    big = malloc(1000001);
    free(big);
    if (small[10] > 0x0)
      jumped();
    if (big[10] > 0x0)
      jumped();
  }
  for (i = 0; i < 100; i++) {
    other_small = malloc(10000);
    for (j = 0; j < 10000; j++)
      other_small[j] = 0x1;
  }
  if (small[10] > 0x0)
    jumped();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
mov    $0xdbba0,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    $0xf4241,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rax
movsbl 0x3e8(%rax),%eax
cmp    $0x0,%eax
jle    11af <main+0x7f>
mov    $0x0,%al
call   1040 <jumped@plt>
mov    -0x18(%rbp),%rax
movsbl 0x3e8(%rax),%eax
cmp    $0x0,%eax
jle    11ca <main+0x9a>
mov    $0x0,%al
call   1040 <jumped@plt>
mov    $0x2710,%edi
call   1050 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rax
movsbl 0x7d0(%rax),%eax
cmp    $0x0,%eax
jle    11fc <main+0xcc>
mov    $0x0,%al
call   1040 <jumped@plt>
mov    -0x18(%rbp),%rax
movsbl 0x7d0(%rax),%eax
cmp    $0x0,%eax
jle    1217 <main+0xe7>
mov    $0x0,%al
call   1040 <jumped@plt>
movq   $0x0,-0x20(%rbp)
mov    $0xf4241,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rax
movsbl 0xa(%rax),%eax
cmp    $0x0,%eax
jle    124e <main+0x11e>
mov    $0x0,%al
call   1040 <jumped@plt>
mov    -0x20(%rbp),%rax
movsbl 0xa(%rax),%eax
cmp    $0x0,%eax
jle    1266 <main+0x136>
mov    $0x0,%al
call   1040 <jumped@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0x64,-0x34(%rbp)
jge    12c6 <main+0x196>
mov    $0x2710,%edi
call   1050 <malloc@plt>
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x38(%rbp)
cmpl   $0x2710,-0x38(%rbp)
jge    12b3 <main+0x183>
mov    -0x30(%rbp),%rax
movslq -0x38(%rbp),%rcx
movb   $0x1,(%rax,%rcx,1)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    128c <main+0x15c>
jmp    12b8 <main+0x188>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    126d <main+0x13d>
mov    -0x28(%rbp),%rax
movsbl 0xa(%rax),%eax
cmp    $0x0,%eax
jle    12de <main+0x1ae>
mov    $0x0,%al
call   1040 <jumped@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0xdbba0,%edi
call   1050 <malloc@plt>
mov    %rax,%r14
mov    $0xf4241,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
cmpb   $0x0,0x3e8(%rbx)
jle    1171 <main+0x41>
xor    %eax,%eax
call   1040 <jumped@plt>
cmpb   $0x0,0x3e8(%r14)
jle    1182 <main+0x52>
xor    %eax,%eax
call   1040 <jumped@plt>
mov    $0x2710,%edi
call   1050 <malloc@plt>
mov    %rax,%r15
mov    %rax,%rdi
call   1030 <free@plt>
cmpb   $0x0,0x7d0(%rbx)
jle    11a7 <main+0x77>
xor    %eax,%eax
call   1040 <jumped@plt>
cmpb   $0x0,0x7d0(%r14)
jle    11b8 <main+0x88>
xor    %eax,%eax
call   1040 <jumped@plt>
mov    $0xf4241,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <free@plt>
mov    0xa(%r15),%bpl
test   %bpl,%bpl
jle    11dd <main+0xad>
xor    %eax,%eax
call   1040 <jumped@plt>
cmpb   $0x0,0xa(%rbx)
jle    11ea <main+0xba>
xor    %eax,%eax
call   1040 <jumped@plt>
test   %bpl,%bpl
jle    11f6 <main+0xc6>
xor    %eax,%eax
call   1040 <jumped@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
store i8* null, i8** %7
store i8* null, i8** %8
store i8* null, i8** %9
%12 = call i8* @malloc(i32 900000)
store i8* %12, i8** %6
%13 = call i8* @malloc(i32 1000001)
store i8* %13, i8** %7
%14 = load i8*, i8** %6
%15 = call i32 @free(i8* %14)
%16 = load i8*, i8** %7
%17 = call i32 @free(i8* %16)
%18 = load i8*, i8** %7
%19 = getelementptr inbounds i8, i8* %18, i64 1000
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp sgt i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %2
%24 = call i32 (...) @jumped()
br label %25
25: ; preds = %23, %2
%26 = load i8*, i8** %6
%27 = getelementptr inbounds i8, i8* %26, i64 1000
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp sgt i32 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %25
%32 = call i32 (...) @jumped()
br label %33
33: ; preds = %31, %25
%34 = call i8* @malloc(i32 10000)
store i8* %34, i8** %8
%35 = load i8*, i8** %8
%36 = call i32 @free(i8* %35)
%37 = load i8*, i8** %7
%38 = getelementptr inbounds i8, i8* %37, i64 2000
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = icmp sgt i32 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %33
%43 = call i32 (...) @jumped()
br label %44
44: ; preds = %42, %33
%45 = load i8*, i8** %6
%46 = getelementptr inbounds i8, i8* %45, i64 2000
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = icmp sgt i32 %48, 0
br i1 %49, label %50, label %52
50: ; preds = %44
%51 = call i32 (...) @jumped()
br label %52
52: ; preds = %50, %44
store i8* null, i8** %7
%53 = call i8* @malloc(i32 1000001)
store i8* %53, i8** %7
%54 = load i8*, i8** %7
%55 = call i32 @free(i8* %54)
%56 = load i8*, i8** %8
%57 = getelementptr inbounds i8, i8* %56, i64 10
%58 = load i8, i8* %57
%59 = sext i8 %58 to i32
%60 = icmp sgt i32 %59, 0
br i1 %60, label %61, label %63
61: ; preds = %52
%62 = call i32 (...) @jumped()
br label %63
63: ; preds = %61, %52
%64 = load i8*, i8** %7
%65 = getelementptr inbounds i8, i8* %64, i64 10
%66 = load i8, i8* %65
%67 = sext i8 %66 to i32
%68 = icmp sgt i32 %67, 0
br i1 %68, label %69, label %71
69: ; preds = %63
%70 = call i32 (...) @jumped()
br label %71
71: ; preds = %69, %63
store i32 0, i32* %10
br label %72
72: ; preds = %89, %71
%73 = load i32, i32* %10
%74 = icmp slt i32 %73, 100
br i1 %74, label %75, label %92
75: ; preds = %72
%76 = call i8* @malloc(i32 10000)
store i8* %76, i8** %9
store i32 0, i32* %11
br label %77
77: ; preds = %85, %75
%78 = load i32, i32* %11
%79 = icmp slt i32 %78, 10000
br i1 %79, label %80, label %88
80: ; preds = %77
%81 = load i8*, i8** %9
%82 = load i32, i32* %11
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds i8, i8* %81, i64 %83
store i8 1, i8* %84
br label %85
85: ; preds = %80
%86 = load i32, i32* %11
%87 = add nsw i32 %86, 1
store i32 %87, i32* %11
br label %77
88: ; preds = %77
br label %89
89: ; preds = %88
%90 = load i32, i32* %10
%91 = add nsw i32 %90, 1
store i32 %91, i32* %10
br label %72
92: ; preds = %72
%93 = load i8*, i8** %8
%94 = getelementptr inbounds i8, i8* %93, i64 10
%95 = load i8, i8* %94
%96 = sext i8 %95 to i32
%97 = icmp sgt i32 %96, 0
br i1 %97, label %98, label %100
98: ; preds = %92
%99 = call i32 (...) @jumped()
br label %100
100: ; preds = %98, %92
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call dereferenceable_or_null(900000) i8* @malloc(i32 900000)
%4 = tail call dereferenceable_or_null(1000001) i8* @malloc(i32 1000001)
%5 = tail call i32 @free(i8* %3)
%6 = tail call i32 @free(i8* %4)
%7 = getelementptr inbounds i8, i8* %4, i64 1000
%8 = load i8, i8* %7
%9 = icmp sgt i8 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = tail call i32 (...) @jumped()
br label %12
12: ; preds = %10, %2
%13 = getelementptr inbounds i8, i8* %3, i64 1000
%14 = load i8, i8* %13
%15 = icmp sgt i8 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = tail call i32 (...) @jumped()
br label %18
18: ; preds = %16, %12
%19 = tail call dereferenceable_or_null(10000) i8* @malloc(i32 10000)
%20 = tail call i32 @free(i8* %19)
%21 = getelementptr inbounds i8, i8* %4, i64 2000
%22 = load i8, i8* %21
%23 = icmp sgt i8 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %18
%25 = tail call i32 (...) @jumped()
br label %26
26: ; preds = %24, %18
%27 = getelementptr inbounds i8, i8* %3, i64 2000
%28 = load i8, i8* %27
%29 = icmp sgt i8 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = tail call i32 (...) @jumped()
br label %32
32: ; preds = %30, %26
%33 = tail call dereferenceable_or_null(1000001) i8* @malloc(i32 1000001)
%34 = tail call i32 @free(i8* %33)
%35 = getelementptr inbounds i8, i8* %19, i64 10
%36 = load i8, i8* %35
%37 = icmp sgt i8 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %32
%39 = tail call i32 (...) @jumped()
br label %40
40: ; preds = %38, %32
%41 = getelementptr inbounds i8, i8* %33, i64 10
%42 = load i8, i8* %41
%43 = icmp sgt i8 %42, 0
br i1 %43, label %44, label %46
44: ; preds = %40
%45 = tail call i32 (...) @jumped()
br label %46
46: ; preds = %44, %40
br i1 %37, label %47, label %49
47: ; preds = %46
%48 = tail call i32 (...) @jumped()
br label %49
49: ; preds = %47, %46
ret i32 0
}