#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 == 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     118f <main+0x4f>
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    11fa <main+0xba>
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    11a3 <main+0x63>
movl   $0x0,-0x64(%rbp)
cmpl   $0xa,-0x64(%rbp)
jge    1227 <main+0xe7>
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    1201 <main+0xc1>
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,%edi
call   1040 <assert@plt>
cmp    $0x1000,%rbx
sete   %al
cmp    $0x10000,%rbx
sete   %cl
or     %al,%cl
movzbl %cl,%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     11a9 <main+0x69>
xor    %edx,%edx
div    %rbx
jmp    11ad <main+0x6d>
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     11dd <main+0x9d>
xor    %edx,%edx
div    %rbx
jmp    11e1 <main+0xa1>
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     1211 <main+0xd1>
xor    %edx,%edx
div    %rbx
jmp    1215 <main+0xd5>
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     1245 <main+0x105>
xor    %edx,%edx
div    %rbx
jmp    1249 <main+0x109>
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     1278 <main+0x138>
xor    %edx,%edx
div    %rbx
jmp    127c <main+0x13c>
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     12aa <main+0x16a>
mov    %r14,%rax
xor    %edx,%edx
div    %rbx
jmp    12b1 <main+0x171>
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     12df <main+0x19f>
mov    %r15,%rax
xor    %edx,%edx
div    %rbx
jmp    12e6 <main+0x1a6>
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     1314 <main+0x1d4>
mov    %r12,%rax
xor    %edx,%edx
div    %rbx
jmp    131b <main+0x1db>
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     1349 <main+0x209>
mov    %r13,%rax
xor    %edx,%edx
div    %rbx
jmp    1350 <main+0x210>
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     1381 <main+0x241>
mov    %rbp,%rax
xor    %edx,%edx
div    %rbx
jmp    1387 <main+0x247>
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 %13, label %10
10: ; preds = %0
%11 = load i64, i64* %4
%12 = icmp eq i64 %11, 65536
br label %13
13: ; preds = %10, %0
%14 = phi i1 [ true, %0 ], [ %12, %10 ]
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
store i32 0, i32* %3
br label %17
17: ; preds = %38, %13
%18 = load i32, i32* %3
%19 = icmp slt i32 %18, 10
br i1 %19, label %20, label %41
20: ; preds = %17
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
%23 = mul nsw i32 11111, %22
%24 = call i8* @valloc(i32 %23)
%25 = load i32, i32* %3
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [10 x i8*], [10 x i8*]* %2, i64 0, i64 %26
store i8* %24, i8** %27
%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
%31 = load i8*, i8** %30
%32 = ptrtoint i8* %31 to i64
%33 = load i64, i64* %4
%34 = urem i64 %32, %33
%35 = icmp eq i64 %34, 0
%36 = zext i1 %35 to i32
%37 = call i32 @assert(i32 %36)
br label %38
38: ; preds = %20
%39 = load i32, i32* %3
%40 = add nsw i32 %39, 1
store i32 %40, i32* %3
br label %17
41: ; preds = %17
store i32 0, i32* %3
br label %42
42: ; preds = %51, %41
%43 = load i32, i32* %3
%44 = icmp slt i32 %43, 10
br i1 %44, label %45, label %54
45: ; preds = %42
%46 = load i32, i32* %3
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [10 x i8*], [10 x i8*]* %2, i64 0, i64 %47
%49 = load i8*, i8** %48
%50 = call i32 @free(i8* %49)
br label %51
51: ; preds = %45
%52 = load i32, i32* %3
%53 = add nsw i32 %52, 1
store i32 %53, i32* %3
br label %42
54: ; preds = %42
%55 = getelementptr inbounds [10 x i8*], [10 x i8*]* %2, i64 0, i64 9
%56 = load i8*, i8** %55
%57 = call i32 @free(i8* %56)
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 = icmp eq i64 %2, 4096
%5 = icmp eq i64 %2, 65536
%6 = or i1 %4, %5
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = tail call dereferenceable_or_null(11111) i8* @valloc(i32 11111)
%10 = ptrtoint i8* %9 to i64
%11 = urem i64 %10, %2
%12 = icmp eq i64 %11, 0
%13 = zext i1 %12 to i32
%14 = tail call i32 @assert(i32 %13)
%15 = tail call dereferenceable_or_null(22222) i8* @valloc(i32 22222)
%16 = ptrtoint i8* %15 to i64
%17 = urem i64 %16, %2
%18 = icmp eq i64 %17, 0
%19 = zext i1 %18 to i32
%20 = tail call i32 @assert(i32 %19)
%21 = tail call dereferenceable_or_null(33333) i8* @valloc(i32 33333)
%22 = ptrtoint i8* %21 to i64
%23 = urem i64 %22, %2
%24 = icmp eq i64 %23, 0
%25 = zext i1 %24 to i32
%26 = tail call i32 @assert(i32 %25)
%27 = tail call dereferenceable_or_null(44444) i8* @valloc(i32 44444)
%28 = ptrtoint i8* %27 to i64
%29 = urem i64 %28, %2
%30 = icmp eq i64 %29, 0
%31 = zext i1 %30 to i32
%32 = tail call i32 @assert(i32 %31)
%33 = tail call dereferenceable_or_null(55555) i8* @valloc(i32 55555)
%34 = ptrtoint i8* %33 to i64
%35 = urem i64 %34, %2
%36 = icmp eq i64 %35, 0
%37 = zext i1 %36 to i32
%38 = tail call i32 @assert(i32 %37)
%39 = tail call dereferenceable_or_null(66666) i8* @valloc(i32 66666)
%40 = ptrtoint i8* %39 to i64
%41 = urem i64 %40, %2
%42 = icmp eq i64 %41, 0
%43 = zext i1 %42 to i32
%44 = tail call i32 @assert(i32 %43)
%45 = tail call dereferenceable_or_null(77777) i8* @valloc(i32 77777)
%46 = ptrtoint i8* %45 to i64
%47 = urem i64 %46, %2
%48 = icmp eq i64 %47, 0
%49 = zext i1 %48 to i32
%50 = tail call i32 @assert(i32 %49)
%51 = tail call dereferenceable_or_null(88888) i8* @valloc(i32 88888)
%52 = ptrtoint i8* %51 to i64
%53 = urem i64 %52, %2
%54 = icmp eq i64 %53, 0
%55 = zext i1 %54 to i32
%56 = tail call i32 @assert(i32 %55)
%57 = tail call dereferenceable_or_null(99999) i8* @valloc(i32 99999)
%58 = ptrtoint i8* %57 to i64
%59 = urem i64 %58, %2
%60 = icmp eq i64 %59, 0
%61 = zext i1 %60 to i32
%62 = tail call i32 @assert(i32 %61)
%63 = tail call dereferenceable_or_null(111110) i8* @valloc(i32 111110)
%64 = ptrtoint i8* %63 to i64
%65 = urem i64 %64, %2
%66 = icmp eq i64 %65, 0
%67 = zext i1 %66 to i32
%68 = tail call i32 @assert(i32 %67)
%69 = tail call i32 @free(i8* %9)
%70 = tail call i32 @free(i8* %15)
%71 = tail call i32 @free(i8* %21)
%72 = tail call i32 @free(i8* %27)
%73 = tail call i32 @free(i8* %33)
%74 = tail call i32 @free(i8* %39)
%75 = tail call i32 @free(i8* %45)
%76 = tail call i32 @free(i8* %51)
%77 = tail call i32 @free(i8* %57)
%78 = tail call i32 @free(i8* %63)
%79 = tail call i32 @free(i8* %63)
ret i32 0
}