#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*/ _SC_PAGE_SIZE;
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ free(void *);
unsigned long sysconf(int /*<<< orphan*/);
void *valloc(int);
int main(void) {
  void *a[10];
  int i;
  unsigned long pszB = sysconf(_SC_PAGE_SIZE);
  assert(sizeof(long) == sizeof(void *));
  assert(pszB == 4096 || pszB == 8192 || pszB == 16384 || pszB == 32768 ||
         pszB == 65536);
  for (i = 0; i < 10; i++) {
    a[i] = valloc(11111 * (i + 1));
    assert((((unsigned long)(a[i])) % pszB) == 0);
  }
  for (i = 0; i < 10; i++) {
    free(a[i]);
  }
  free(a[9]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e87(%rip),%rax
mov    (%rax),%edi
call   1060 <sysconf@plt>
mov    %rax,-0x70(%rbp)
mov    $0x1,%edi
call   1040 <assert@plt>
mov    $0x1,%al
cmpq   $0x1000,-0x70(%rbp)
mov    %al,-0x71(%rbp)
je     11c8 <main+0x88>
mov    $0x1,%al
cmpq   $0x2000,-0x70(%rbp)
mov    %al,-0x71(%rbp)
je     11c8 <main+0x88>
mov    $0x1,%al
cmpq   $0x4000,-0x70(%rbp)
mov    %al,-0x71(%rbp)
je     11c8 <main+0x88>
mov    $0x1,%al
cmpq   $0x8000,-0x70(%rbp)
mov    %al,-0x71(%rbp)
je     11c8 <main+0x88>
cmpq   $0x10000,-0x70(%rbp)
sete   %al
mov    %al,-0x71(%rbp)
mov    -0x71(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movl   $0x0,-0x64(%rbp)
cmpl   $0xa,-0x64(%rbp)
jge    1233 <main+0xf3>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
imul   $0x2b67,%eax,%edi
call   1050 <valloc@plt>
mov    %rax,%rcx
movslq -0x64(%rbp),%rax
mov    %rcx,-0x60(%rbp,%rax,8)
movslq -0x64(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x70(%rbp)
cmp    $0x0,%rdx
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    11dc <main+0x9c>
movl   $0x0,-0x64(%rbp)
cmpl   $0xa,-0x64(%rbp)
jge    1260 <main+0x120>
movslq -0x64(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%rdi
call   1030 <free@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    123a <main+0xfa>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    0x2e8b(%rip),%rax
mov    (%rax),%edi
call   1060 <sysconf@plt>
mov    %rax,%rbx
mov    $0x1,%ebp
mov    $0x1,%edi
call   1040 <assert@plt>
lea    -0x1000(%rbx),%rax
rol    $0x34,%rax
cmp    $0x8,%rax
jae    1189 <main+0x49>
mov    $0x8b,%ecx
bt     %eax,%ecx
jb     1196 <main+0x56>
xor    %ebp,%ebp
cmp    $0x10000,%rbx
sete   %bpl
mov    %ebp,%edi
call   1040 <assert@plt>
mov    $0x2b67,%edi
call   1050 <valloc@plt>
mov    %rax,%rcx
or     %rbx,%rcx
shr    $0x20,%rcx
mov    %rax,0x20(%rsp)
je     11bf <main+0x7f>
xor    %edx,%edx
div    %rbx
jmp    11c3 <main+0x83>
xor    %edx,%edx
div    %ebx
xor    %edi,%edi
test   %rdx,%rdx
sete   %dil
call   1040 <assert@plt>
mov    $0x56ce,%edi
call   1050 <valloc@plt>
mov    %rax,%rcx
or     %rbx,%rcx
shr    $0x20,%rcx
mov    %rax,0x18(%rsp)
je     11f3 <main+0xb3>
xor    %edx,%edx
div    %rbx
jmp    11f7 <main+0xb7>
xor    %edx,%edx
div    %ebx
xor    %edi,%edi
test   %rdx,%rdx
sete   %dil
call   1040 <assert@plt>
mov    $0x8235,%edi
call   1050 <valloc@plt>
mov    %rax,%rcx
or     %rbx,%rcx
shr    $0x20,%rcx
mov    %rax,0x10(%rsp)
je     1227 <main+0xe7>
xor    %edx,%edx
div    %rbx
jmp    122b <main+0xeb>
xor    %edx,%edx
div    %ebx
xor    %edi,%edi
test   %rdx,%rdx
sete   %dil
call   1040 <assert@plt>
mov    $0xad9c,%edi
call   1050 <valloc@plt>
mov    %rax,%rcx
or     %rbx,%rcx
shr    $0x20,%rcx
mov    %rax,0x8(%rsp)
je     125b <main+0x11b>
xor    %edx,%edx
div    %rbx
jmp    125f <main+0x11f>
xor    %edx,%edx
div    %ebx
xor    %edi,%edi
test   %rdx,%rdx
sete   %dil
call   1040 <assert@plt>
mov    $0xd903,%edi
call   1050 <valloc@plt>
mov    %rax,%rcx
or     %rbx,%rcx
shr    $0x20,%rcx
mov    %rax,(%rsp)
je     128e <main+0x14e>
xor    %edx,%edx
div    %rbx
jmp    1292 <main+0x152>
xor    %edx,%edx
div    %ebx
xor    %edi,%edi
test   %rdx,%rdx
sete   %dil
call   1040 <assert@plt>
mov    $0x1046a,%edi
call   1050 <valloc@plt>
mov    %rax,%r14
or     %rbx,%rax
shr    $0x20,%rax
je     12c0 <main+0x180>
mov    %r14,%rax
xor    %edx,%edx
div    %rbx
jmp    12c7 <main+0x187>
mov    %r14d,%eax
xor    %edx,%edx
div    %ebx
xor    %edi,%edi
test   %rdx,%rdx
sete   %dil
call   1040 <assert@plt>
mov    $0x12fd1,%edi
call   1050 <valloc@plt>
mov    %rax,%r15
or     %rbx,%rax
shr    $0x20,%rax
je     12f5 <main+0x1b5>
mov    %r15,%rax
xor    %edx,%edx
div    %rbx
jmp    12fc <main+0x1bc>
mov    %r15d,%eax
xor    %edx,%edx
div    %ebx
xor    %edi,%edi
test   %rdx,%rdx
sete   %dil
call   1040 <assert@plt>
mov    $0x15b38,%edi
call   1050 <valloc@plt>
mov    %rax,%r12
or     %rbx,%rax
shr    $0x20,%rax
je     132a <main+0x1ea>
mov    %r12,%rax
xor    %edx,%edx
div    %rbx
jmp    1331 <main+0x1f1>
mov    %r12d,%eax
xor    %edx,%edx
div    %ebx
xor    %edi,%edi
test   %rdx,%rdx
sete   %dil
call   1040 <assert@plt>
mov    $0x1869f,%edi
call   1050 <valloc@plt>
mov    %rax,%r13
or     %rbx,%rax
shr    $0x20,%rax
je     135f <main+0x21f>
mov    %r13,%rax
xor    %edx,%edx
div    %rbx
jmp    1366 <main+0x226>
mov    %r13d,%eax
xor    %edx,%edx
div    %ebx
xor    %edi,%edi
test   %rdx,%rdx
sete   %dil
call   1040 <assert@plt>
mov    $0x1b206,%edi
call   1050 <valloc@plt>
mov    %rax,%rbp
mov    %rbx,%rax
or     %rbp,%rax
shr    $0x20,%rax
je     1397 <main+0x257>
mov    %rbp,%rax
xor    %edx,%edx
div    %rbx
jmp    139d <main+0x25d>
mov    %ebp,%eax
xor    %edx,%edx
div    %ebx
xor    %edi,%edi
test   %rdx,%rdx
sete   %dil
call   1040 <assert@plt>
mov    0x20(%rsp),%rdi
call   1030 <free@plt>
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    (%rsp),%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@_SC_PAGE_SIZE = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8*]
%3 = alloca i32
%4 = alloca i64
store i32 0, i32* %1
%5 = load i32, i32* @_SC_PAGE_SIZE
%6 = call i64 @sysconf(i32 %5)
store i64 %6, i64* %4
%7 = call i32 @assert(i32 1)
%8 = load i64, i64* %4
%9 = icmp eq i64 %8, 4096
br i1 %9, label %22, label %10
10: ; preds = %0
%11 = load i64, i64* %4
%12 = icmp eq i64 %11, 8192
br i1 %12, label %22, label %13
13: ; preds = %10
%14 = load i64, i64* %4
%15 = icmp eq i64 %14, 16384
br i1 %15, label %22, label %16
16: ; preds = %13
%17 = load i64, i64* %4
%18 = icmp eq i64 %17, 32768
br i1 %18, label %22, label %19
19: ; preds = %16
%20 = load i64, i64* %4
%21 = icmp eq i64 %20, 65536
br label %22
22: ; preds = %19, %16, %13, %10, %0
%23 = phi i1 [ true, %16 ], [ true, %13 ], [ true, %10 ], [ true, %0 ], [ %21, %19 ]
%24 = zext i1 %23 to i32
%25 = call i32 @assert(i32 %24)
store i32 0, i32* %3
br label %26
26: ; preds = %47, %22
%27 = load i32, i32* %3
%28 = icmp slt i32 %27, 10
br i1 %28, label %29, label %50
29: ; preds = %26
%30 = load i32, i32* %3
%31 = add nsw i32 %30, 1
%32 = mul nsw i32 11111, %31
%33 = call i8* @valloc(i32 %32)
%34 = load i32, i32* %3
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [10 x i8*], [10 x i8*]* %2, i64 0, i64 %35
store i8* %33, i8** %36
%37 = load i32, i32* %3
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [10 x i8*], [10 x i8*]* %2, i64 0, i64 %38
%40 = load i8*, i8** %39
%41 = ptrtoint i8* %40 to i64
%42 = load i64, i64* %4
%43 = urem i64 %41, %42
%44 = icmp eq i64 %43, 0
%45 = zext i1 %44 to i32
%46 = call i32 @assert(i32 %45)
br label %47
47: ; preds = %29
%48 = load i32, i32* %3
%49 = add nsw i32 %48, 1
store i32 %49, i32* %3
br label %26
50: ; preds = %26
store i32 0, i32* %3
br label %51
51: ; preds = %60, %50
%52 = load i32, i32* %3
%53 = icmp slt i32 %52, 10
br i1 %53, label %54, label %63
54: ; preds = %51
%55 = load i32, i32* %3
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [10 x i8*], [10 x i8*]* %2, i64 0, i64 %56
%58 = load i8*, i8** %57
%59 = call i32 @free(i8* %58)
br label %60
60: ; preds = %54
%61 = load i32, i32* %3
%62 = add nsw i32 %61, 1
store i32 %62, i32* %3
br label %51
63: ; preds = %51
%64 = getelementptr inbounds [10 x i8*], [10 x i8*]* %2, i64 0, i64 9
%65 = load i8*, i8** %64
%66 = call i32 @free(i8* %65)
ret i32 0
}

LLVM IR (-O2):
@_SC_PAGE_SIZE = global i32 0
define i32 @main() {
%1 = load i32, i32* @_SC_PAGE_SIZE
%2 = tail call i64 @sysconf(i32 %1)
%3 = tail call i32 @assert(i32 1)
%4 = add i64 %2, -4096
%5 = tail call i64 @llvm.fshl.i64(i64 %4, i64 %4, i64 52)
%6 = icmp ult i64 %5, 8
br i1 %6, label %10, label %7
7: ; preds = %10, %0
%8 = icmp eq i64 %2, 65536
%9 = zext i1 %8 to i32
br label %15
10: ; preds = %0
%11 = trunc i64 %5 to i8
%12 = lshr i8 -117, %11
%13 = and i8 %12, 1
%14 = icmp eq i8 %13, 0
br i1 %14, label %7, label %15
15: ; preds = %10, %7
%16 = phi i32 [ %9, %7 ], [ 1, %10 ]
%17 = tail call i32 @assert(i32 %16)
%18 = tail call dereferenceable_or_null(11111) i8* @valloc(i32 11111)
%19 = ptrtoint i8* %18 to i64
%20 = urem i64 %19, %2
%21 = icmp eq i64 %20, 0
%22 = zext i1 %21 to i32
%23 = tail call i32 @assert(i32 %22)
%24 = tail call dereferenceable_or_null(22222) i8* @valloc(i32 22222)
%25 = ptrtoint i8* %24 to i64
%26 = urem i64 %25, %2
%27 = icmp eq i64 %26, 0
%28 = zext i1 %27 to i32
%29 = tail call i32 @assert(i32 %28)
%30 = tail call dereferenceable_or_null(33333) i8* @valloc(i32 33333)
%31 = ptrtoint i8* %30 to i64
%32 = urem i64 %31, %2
%33 = icmp eq i64 %32, 0
%34 = zext i1 %33 to i32
%35 = tail call i32 @assert(i32 %34)
%36 = tail call dereferenceable_or_null(44444) i8* @valloc(i32 44444)
%37 = ptrtoint i8* %36 to i64
%38 = urem i64 %37, %2
%39 = icmp eq i64 %38, 0
%40 = zext i1 %39 to i32
%41 = tail call i32 @assert(i32 %40)
%42 = tail call dereferenceable_or_null(55555) i8* @valloc(i32 55555)
%43 = ptrtoint i8* %42 to i64
%44 = urem i64 %43, %2
%45 = icmp eq i64 %44, 0
%46 = zext i1 %45 to i32
%47 = tail call i32 @assert(i32 %46)
%48 = tail call dereferenceable_or_null(66666) i8* @valloc(i32 66666)
%49 = ptrtoint i8* %48 to i64
%50 = urem i64 %49, %2
%51 = icmp eq i64 %50, 0
%52 = zext i1 %51 to i32
%53 = tail call i32 @assert(i32 %52)
%54 = tail call dereferenceable_or_null(77777) i8* @valloc(i32 77777)
%55 = ptrtoint i8* %54 to i64
%56 = urem i64 %55, %2
%57 = icmp eq i64 %56, 0
%58 = zext i1 %57 to i32
%59 = tail call i32 @assert(i32 %58)
%60 = tail call dereferenceable_or_null(88888) i8* @valloc(i32 88888)
%61 = ptrtoint i8* %60 to i64
%62 = urem i64 %61, %2
%63 = icmp eq i64 %62, 0
%64 = zext i1 %63 to i32
%65 = tail call i32 @assert(i32 %64)
%66 = tail call dereferenceable_or_null(99999) i8* @valloc(i32 99999)
%67 = ptrtoint i8* %66 to i64
%68 = urem i64 %67, %2
%69 = icmp eq i64 %68, 0
%70 = zext i1 %69 to i32
%71 = tail call i32 @assert(i32 %70)
%72 = tail call dereferenceable_or_null(111110) i8* @valloc(i32 111110)
%73 = ptrtoint i8* %72 to i64
%74 = urem i64 %73, %2
%75 = icmp eq i64 %74, 0
%76 = zext i1 %75 to i32
%77 = tail call i32 @assert(i32 %76)
%78 = tail call i32 @free(i8* %18)
%79 = tail call i32 @free(i8* %24)
%80 = tail call i32 @free(i8* %30)
%81 = tail call i32 @free(i8* %36)
%82 = tail call i32 @free(i8* %42)
%83 = tail call i32 @free(i8* %48)
%84 = tail call i32 @free(i8* %54)
%85 = tail call i32 @free(i8* %60)
%86 = tail call i32 @free(i8* %66)
%87 = tail call i32 @free(i8* %72)
%88 = tail call i32 @free(i8* %72)
ret i32 0
}