#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 == 16384 || 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     11a2 <main+0x62>
mov    $0x1,%al
cmpq   $0x4000,-0x70(%rbp)
mov    %al,-0x71(%rbp)
je     11a2 <main+0x62>
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    120d <main+0xcd>
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    11b6 <main+0x76>
movl   $0x0,-0x64(%rbp)
cmpl   $0xa,-0x64(%rbp)
jge    123a <main+0xfa>
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    1214 <main+0xd4>
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>
cmp    $0x1000,%rbx
je     118d <main+0x4d>
cmp    $0x4000,%rbx
je     118d <main+0x4d>
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     11b6 <main+0x76>
xor    %edx,%edx
div    %rbx
jmp    11ba <main+0x7a>
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     11ea <main+0xaa>
xor    %edx,%edx
div    %rbx
jmp    11ee <main+0xae>
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     121e <main+0xde>
xor    %edx,%edx
div    %rbx
jmp    1222 <main+0xe2>
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     1252 <main+0x112>
xor    %edx,%edx
div    %rbx
jmp    1256 <main+0x116>
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     1285 <main+0x145>
xor    %edx,%edx
div    %rbx
jmp    1289 <main+0x149>
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     12b7 <main+0x177>
mov    %r14,%rax
xor    %edx,%edx
div    %rbx
jmp    12be <main+0x17e>
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     12ec <main+0x1ac>
mov    %r15,%rax
xor    %edx,%edx
div    %rbx
jmp    12f3 <main+0x1b3>
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     1321 <main+0x1e1>
mov    %r12,%rax
xor    %edx,%edx
div    %rbx
jmp    1328 <main+0x1e8>
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     1356 <main+0x216>
mov    %r13,%rax
xor    %edx,%edx
div    %rbx
jmp    135d <main+0x21d>
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     138e <main+0x24e>
mov    %rbp,%rax
xor    %edx,%edx
div    %rbx
jmp    1394 <main+0x254>
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 %16, label %10
10: ; preds = %0
%11 = load i64, i64* %4
%12 = icmp eq i64 %11, 16384
br i1 %12, label %16, label %13
13: ; preds = %10
%14 = load i64, i64* %4
%15 = icmp eq i64 %14, 65536
br label %16
16: ; preds = %13, %10, %0
%17 = phi i1 [ true, %10 ], [ true, %0 ], [ %15, %13 ]
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
store i32 0, i32* %3
br label %20
20: ; preds = %41, %16
%21 = load i32, i32* %3
%22 = icmp slt i32 %21, 10
br i1 %22, label %23, label %44
23: ; preds = %20
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
%26 = mul nsw i32 11111, %25
%27 = call i8* @valloc(i32 %26)
%28 = load i32, i32* %3
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [10 x i8*], [10 x i8*]* %2, i64 0, i64 %29
store i8* %27, i8** %30
%31 = load i32, i32* %3
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [10 x i8*], [10 x i8*]* %2, i64 0, i64 %32
%34 = load i8*, i8** %33
%35 = ptrtoint i8* %34 to i64
%36 = load i64, i64* %4
%37 = urem i64 %35, %36
%38 = icmp eq i64 %37, 0
%39 = zext i1 %38 to i32
%40 = call i32 @assert(i32 %39)
br label %41
41: ; preds = %23
%42 = load i32, i32* %3
%43 = add nsw i32 %42, 1
store i32 %43, i32* %3
br label %20
44: ; preds = %20
store i32 0, i32* %3
br label %45
45: ; preds = %54, %44
%46 = load i32, i32* %3
%47 = icmp slt i32 %46, 10
br i1 %47, label %48, label %57
48: ; preds = %45
%49 = load i32, i32* %3
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [10 x i8*], [10 x i8*]* %2, i64 0, i64 %50
%52 = load i8*, i8** %51
%53 = call i32 @free(i8* %52)
br label %54
54: ; preds = %48
%55 = load i32, i32* %3
%56 = add nsw i32 %55, 1
store i32 %56, i32* %3
br label %45
57: ; preds = %45
%58 = getelementptr inbounds [10 x i8*], [10 x i8*]* %2, i64 0, i64 9
%59 = load i8*, i8** %58
%60 = call i32 @free(i8* %59)
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)
switch i64 %2, label %4 [
i64 16384, label %7
i64 4096, label %7
]
4: ; preds = %0
%5 = icmp eq i64 %2, 65536
%6 = zext i1 %5 to i32
br label %7
7: ; preds = %0, %0, %4
%8 = phi i32 [ 1, %0 ], [ %6, %4 ], [ 1, %0 ]
%9 = tail call i32 @assert(i32 %8)
%10 = tail call dereferenceable_or_null(11111) i8* @valloc(i32 11111)
%11 = ptrtoint i8* %10 to i64
%12 = urem i64 %11, %2
%13 = icmp eq i64 %12, 0
%14 = zext i1 %13 to i32
%15 = tail call i32 @assert(i32 %14)
%16 = tail call dereferenceable_or_null(22222) i8* @valloc(i32 22222)
%17 = ptrtoint i8* %16 to i64
%18 = urem i64 %17, %2
%19 = icmp eq i64 %18, 0
%20 = zext i1 %19 to i32
%21 = tail call i32 @assert(i32 %20)
%22 = tail call dereferenceable_or_null(33333) i8* @valloc(i32 33333)
%23 = ptrtoint i8* %22 to i64
%24 = urem i64 %23, %2
%25 = icmp eq i64 %24, 0
%26 = zext i1 %25 to i32
%27 = tail call i32 @assert(i32 %26)
%28 = tail call dereferenceable_or_null(44444) i8* @valloc(i32 44444)
%29 = ptrtoint i8* %28 to i64
%30 = urem i64 %29, %2
%31 = icmp eq i64 %30, 0
%32 = zext i1 %31 to i32
%33 = tail call i32 @assert(i32 %32)
%34 = tail call dereferenceable_or_null(55555) i8* @valloc(i32 55555)
%35 = ptrtoint i8* %34 to i64
%36 = urem i64 %35, %2
%37 = icmp eq i64 %36, 0
%38 = zext i1 %37 to i32
%39 = tail call i32 @assert(i32 %38)
%40 = tail call dereferenceable_or_null(66666) i8* @valloc(i32 66666)
%41 = ptrtoint i8* %40 to i64
%42 = urem i64 %41, %2
%43 = icmp eq i64 %42, 0
%44 = zext i1 %43 to i32
%45 = tail call i32 @assert(i32 %44)
%46 = tail call dereferenceable_or_null(77777) i8* @valloc(i32 77777)
%47 = ptrtoint i8* %46 to i64
%48 = urem i64 %47, %2
%49 = icmp eq i64 %48, 0
%50 = zext i1 %49 to i32
%51 = tail call i32 @assert(i32 %50)
%52 = tail call dereferenceable_or_null(88888) i8* @valloc(i32 88888)
%53 = ptrtoint i8* %52 to i64
%54 = urem i64 %53, %2
%55 = icmp eq i64 %54, 0
%56 = zext i1 %55 to i32
%57 = tail call i32 @assert(i32 %56)
%58 = tail call dereferenceable_or_null(99999) i8* @valloc(i32 99999)
%59 = ptrtoint i8* %58 to i64
%60 = urem i64 %59, %2
%61 = icmp eq i64 %60, 0
%62 = zext i1 %61 to i32
%63 = tail call i32 @assert(i32 %62)
%64 = tail call dereferenceable_or_null(111110) i8* @valloc(i32 111110)
%65 = ptrtoint i8* %64 to i64
%66 = urem i64 %65, %2
%67 = icmp eq i64 %66, 0
%68 = zext i1 %67 to i32
%69 = tail call i32 @assert(i32 %68)
%70 = tail call i32 @free(i8* %10)
%71 = tail call i32 @free(i8* %16)
%72 = tail call i32 @free(i8* %22)
%73 = tail call i32 @free(i8* %28)
%74 = tail call i32 @free(i8* %34)
%75 = tail call i32 @free(i8* %40)
%76 = tail call i32 @free(i8* %46)
%77 = tail call i32 @free(i8* %52)
%78 = tail call i32 @free(i8* %58)
%79 = tail call i32 @free(i8* %64)
%80 = tail call i32 @free(i8* %64)
ret i32 0
}