#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 */
scalar_t__ Mem_Alloc(int);
int /*<<< orphan*/ Mem_Dump();
scalar_t__ Mem_Init(int);
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int main() {
  assert(Mem_Init(4096) == 0);
  int *ptr[4];
  ptr[0] = (int *)Mem_Alloc(4);
  ptr[1] = (int *)Mem_Alloc(8);
  ptr[2] = (int *)Mem_Alloc(16);
  ptr[3] = (int *)Mem_Alloc(4);
  assert((int)(ptr[0]) % 4 == 0);
  assert((int)(ptr[1]) % 4 == 0);
  assert((int)(ptr[2]) % 4 == 0);
  assert((int)(ptr[3]) % 4 == 0);
  Mem_Dump();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1000,%edi
call   1030 <Mem_Init@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0x4,%edi
call   1060 <Mem_Alloc@plt>
mov    %rax,-0x30(%rbp)
mov    $0x8,%edi
call   1060 <Mem_Alloc@plt>
mov    %rax,-0x28(%rbp)
mov    $0x10,%edi
call   1060 <Mem_Alloc@plt>
mov    %rax,-0x20(%rbp)
mov    $0x4,%edi
call   1060 <Mem_Alloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x30(%rbp),%rax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x28(%rbp),%rax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x20(%rbp),%rax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x18(%rbp),%rax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0x0,%al
call   1040 <Mem_Dump@plt>
xor    %edi,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    $0x1000,%edi
call   1030 <Mem_Init@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1050 <assert@plt>
mov    $0x4,%edi
call   1060 <Mem_Alloc@plt>
mov    %rax,%rbx
mov    $0x8,%edi
call   1060 <Mem_Alloc@plt>
mov    %rax,%r15
mov    $0x10,%edi
call   1060 <Mem_Alloc@plt>
mov    %rax,%r12
mov    $0x4,%edi
call   1060 <Mem_Alloc@plt>
mov    %rax,%r14
xor    %edi,%edi
test   $0x3,%bl
sete   %dil
call   1050 <assert@plt>
xor    %edi,%edi
test   $0x3,%r15b
sete   %dil
call   1050 <assert@plt>
xor    %edi,%edi
test   $0x3,%r12b
sete   %dil
call   1050 <assert@plt>
xor    %edi,%edi
test   $0x3,%r14b
sete   %dil
call   1050 <assert@plt>
xor    %eax,%eax
call   1040 <Mem_Dump@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i32*]
store i32 0, i32* %1
%3 = call i64 @Mem_Init(i32 4096)
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
%7 = call i64 @Mem_Alloc(i32 4)
%8 = inttoptr i64 %7 to i32*
%9 = getelementptr inbounds [4 x i32*], [4 x i32*]* %2, i64 0, i64 0
store i32* %8, i32** %9
%10 = call i64 @Mem_Alloc(i32 8)
%11 = inttoptr i64 %10 to i32*
%12 = getelementptr inbounds [4 x i32*], [4 x i32*]* %2, i64 0, i64 1
store i32* %11, i32** %12
%13 = call i64 @Mem_Alloc(i32 16)
%14 = inttoptr i64 %13 to i32*
%15 = getelementptr inbounds [4 x i32*], [4 x i32*]* %2, i64 0, i64 2
store i32* %14, i32** %15
%16 = call i64 @Mem_Alloc(i32 4)
%17 = inttoptr i64 %16 to i32*
%18 = getelementptr inbounds [4 x i32*], [4 x i32*]* %2, i64 0, i64 3
store i32* %17, i32** %18
%19 = getelementptr inbounds [4 x i32*], [4 x i32*]* %2, i64 0, i64 0
%20 = load i32*, i32** %19
%21 = ptrtoint i32* %20 to i32
%22 = srem i32 %21, 4
%23 = icmp eq i32 %22, 0
%24 = zext i1 %23 to i32
%25 = call i32 @assert(i32 %24)
%26 = getelementptr inbounds [4 x i32*], [4 x i32*]* %2, i64 0, i64 1
%27 = load i32*, i32** %26
%28 = ptrtoint i32* %27 to i32
%29 = srem i32 %28, 4
%30 = icmp eq i32 %29, 0
%31 = zext i1 %30 to i32
%32 = call i32 @assert(i32 %31)
%33 = getelementptr inbounds [4 x i32*], [4 x i32*]* %2, i64 0, i64 2
%34 = load i32*, i32** %33
%35 = ptrtoint i32* %34 to i32
%36 = srem i32 %35, 4
%37 = icmp eq i32 %36, 0
%38 = zext i1 %37 to i32
%39 = call i32 @assert(i32 %38)
%40 = getelementptr inbounds [4 x i32*], [4 x i32*]* %2, i64 0, i64 3
%41 = load i32*, i32** %40
%42 = ptrtoint i32* %41 to i32
%43 = srem i32 %42, 4
%44 = icmp eq i32 %43, 0
%45 = zext i1 %44 to i32
%46 = call i32 @assert(i32 %45)
%47 = call i32 (...) @Mem_Dump()
%48 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @Mem_Init(i32 4096)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i64 @Mem_Alloc(i32 4)
%6 = tail call i64 @Mem_Alloc(i32 8)
%7 = tail call i64 @Mem_Alloc(i32 16)
%8 = tail call i64 @Mem_Alloc(i32 4)
%9 = and i64 %5, 3
%10 = icmp eq i64 %9, 0
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = and i64 %6, 3
%14 = icmp eq i64 %13, 0
%15 = zext i1 %14 to i32
%16 = tail call i32 @assert(i32 %15)
%17 = and i64 %7, 3
%18 = icmp eq i64 %17, 0
%19 = zext i1 %18 to i32
%20 = tail call i32 @assert(i32 %19)
%21 = and i64 %8, 3
%22 = icmp eq i64 %21, 0
%23 = zext i1 %22 to i32
%24 = tail call i32 @assert(i32 %23)
%25 = tail call i32 (...) @Mem_Dump()
%26 = tail call i32 @exit(i32 0)
unreachable
}