#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 EINVAL;
int /*<<< orphan*/ assert(int);
int *memalign(int, int);
int posix_memalign(void **, int, int);
int main(void) {
  int *p;
  int res;
  assert(sizeof(long int) == sizeof(void *));
  p = memalign(0, 100);
  assert(0 == (long)p % 8);
  p = memalign(1, 100);
  assert(0 == (long)p % 8);
  p = memalign(2, 100);
  assert(0 == (long)p % 8);
  p = memalign(3, 100);
  assert(0 == (long)p % 8);
  p = memalign(4, 100);
  assert(0 == (long)p % 8);
  p = memalign(5, 100);
  assert(0 == (long)p % 8);
  p = memalign(7, 100);
  assert(0 == (long)p % 8);
  p = memalign(8, 100);
  assert(0 == (long)p % 8);
  p = memalign(9, 100);
  assert(0 == (long)p % 16);
  p = memalign(31, 100);
  assert(0 == (long)p % 32);
  p = memalign(32, 100);
  assert(0 == (long)p % 32);
  p = memalign(33, 100);
  assert(0 == (long)p % 64);
  p = memalign(4095, 100);
  assert(0 == (long)p % 4096);
  p = memalign(4096, 100);
  assert(0 == (long)p % 4096);
  p = memalign(4097, 100);
  assert(0 == (long)p % 8192);
  res = posix_memalign((void **)&p, -1, 100);
  assert(EINVAL == res);
  res = posix_memalign((void **)&p, 0, 100);
  assert(0 == res && 0 == (long)p % 8);
  res = posix_memalign((void **)&p, 1, 100);
  assert(EINVAL == res);
  res = posix_memalign((void **)&p, 2, 100);
  assert(EINVAL == res);
  res = posix_memalign((void **)&p, 3, 100);
  assert(EINVAL == res);
  res = posix_memalign((void **)&p, sizeof(void *), 100);
  assert(0 == res && 0 == (long)p % sizeof(void *));
  res = posix_memalign((void **)&p, 31, 100);
  assert(EINVAL == res);
  res = posix_memalign((void **)&p, 32, 100);
  assert(0 == res && 0 == (long)p % 32);
  res = posix_memalign((void **)&p, 33, 100);
  assert(EINVAL == res);
  res = posix_memalign((void **)&p, 4095, 100);
  assert(EINVAL == res);
  res = posix_memalign((void **)&p, 4096, 100);
  assert(0 == res && 0 == (long)p % 4096);
  res = posix_memalign((void **)&p, 4097, 100);
  assert(EINVAL == res);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
call   1030 <assert@plt>
xor    %edi,%edi
mov    $0x64,%esi
call   1040 <memalign@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x8,%ecx
cqto
idiv   %rcx
xor    %eax,%eax
cmp    %rdx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
mov    $0x64,%esi
call   1040 <memalign@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x8,%ecx
cqto
idiv   %rcx
xor    %eax,%eax
cmp    %rdx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0x2,%edi
mov    $0x64,%esi
call   1040 <memalign@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x8,%ecx
cqto
idiv   %rcx
xor    %eax,%eax
cmp    %rdx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0x3,%edi
mov    $0x64,%esi
call   1040 <memalign@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x8,%ecx
cqto
idiv   %rcx
xor    %eax,%eax
cmp    %rdx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0x4,%edi
mov    $0x64,%esi
call   1040 <memalign@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x8,%ecx
cqto
idiv   %rcx
xor    %eax,%eax
cmp    %rdx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0x5,%edi
mov    $0x64,%esi
call   1040 <memalign@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x8,%ecx
cqto
idiv   %rcx
xor    %eax,%eax
cmp    %rdx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0x7,%edi
mov    $0x64,%esi
call   1040 <memalign@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x8,%ecx
cqto
idiv   %rcx
xor    %eax,%eax
cmp    %rdx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0x8,%edi
mov    $0x64,%esi
call   1040 <memalign@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x8,%ecx
cqto
idiv   %rcx
xor    %eax,%eax
cmp    %rdx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0x9,%edi
mov    $0x64,%esi
call   1040 <memalign@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x10,%ecx
cqto
idiv   %rcx
xor    %eax,%eax
cmp    %rdx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0x1f,%edi
mov    $0x64,%esi
call   1040 <memalign@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x20,%ecx
cqto
idiv   %rcx
xor    %eax,%eax
cmp    %rdx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0x20,%edi
mov    $0x64,%esi
call   1040 <memalign@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x20,%ecx
cqto
idiv   %rcx
xor    %eax,%eax
cmp    %rdx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0x21,%edi
mov    $0x64,%esi
call   1040 <memalign@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x40,%ecx
cqto
idiv   %rcx
xor    %eax,%eax
cmp    %rdx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0xfff,%edi
mov    $0x64,%esi
call   1040 <memalign@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x1000,%ecx
cqto
idiv   %rcx
xor    %eax,%eax
cmp    %rdx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0x1000,%edi
mov    $0x64,%esi
call   1040 <memalign@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x1000,%ecx
cqto
idiv   %rcx
xor    %eax,%eax
cmp    %rdx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0x1001,%edi
mov    $0x64,%esi
call   1040 <memalign@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x2000,%ecx
cqto
idiv   %rcx
xor    %eax,%eax
cmp    %rdx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    -0x10(%rbp),%rdi
mov    $0xffffffff,%esi
mov    $0x64,%edx
call   1050 <posix_memalign@plt>
mov    %eax,-0x14(%rbp)
mov    0x2b80(%rip),%rax
mov    (%rax),%eax
cmp    -0x14(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1050 <posix_memalign@plt>
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
xor    %ecx,%ecx
cmp    -0x14(%rbp),%ecx
mov    %al,-0x15(%rbp)
jne    14ae <main+0x37e>
mov    -0x10(%rbp),%rax
mov    $0x8,%ecx
cqto
idiv   %rcx
xor    %eax,%eax
cmp    %rdx,%rax
sete   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    -0x10(%rbp),%rdi
mov    $0x1,%esi
mov    $0x64,%edx
call   1050 <posix_memalign@plt>
mov    %eax,-0x14(%rbp)
mov    0x2b08(%rip),%rax
mov    (%rax),%eax
cmp    -0x14(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    -0x10(%rbp),%rdi
mov    $0x2,%esi
mov    $0x64,%edx
call   1050 <posix_memalign@plt>
mov    %eax,-0x14(%rbp)
mov    0x2ad9(%rip),%rax
mov    (%rax),%eax
cmp    -0x14(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    -0x10(%rbp),%rdi
mov    $0x3,%esi
mov    $0x64,%edx
call   1050 <posix_memalign@plt>
mov    %eax,-0x14(%rbp)
mov    0x2aaa(%rip),%rax
mov    (%rax),%eax
cmp    -0x14(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    -0x10(%rbp),%rdi
mov    $0x8,%esi
mov    $0x64,%edx
call   1050 <posix_memalign@plt>
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
xor    %ecx,%ecx
cmp    -0x14(%rbp),%ecx
mov    %al,-0x16(%rbp)
jne    1581 <main+0x451>
mov    -0x10(%rbp),%rcx
and    $0x7,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
sete   %al
mov    %al,-0x16(%rbp)
mov    -0x16(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    -0x10(%rbp),%rdi
mov    $0x1f,%esi
mov    $0x64,%edx
call   1050 <posix_memalign@plt>
mov    %eax,-0x14(%rbp)
mov    0x2a35(%rip),%rax
mov    (%rax),%eax
cmp    -0x14(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    -0x10(%rbp),%rdi
mov    $0x20,%esi
mov    $0x64,%edx
call   1050 <posix_memalign@plt>
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
xor    %ecx,%ecx
cmp    -0x14(%rbp),%ecx
mov    %al,-0x17(%rbp)
jne    15fc <main+0x4cc>
mov    -0x10(%rbp),%rax
mov    $0x20,%ecx
cqto
idiv   %rcx
xor    %eax,%eax
cmp    %rdx,%rax
sete   %al
mov    %al,-0x17(%rbp)
mov    -0x17(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    -0x10(%rbp),%rdi
mov    $0x21,%esi
mov    $0x64,%edx
call   1050 <posix_memalign@plt>
mov    %eax,-0x14(%rbp)
mov    0x29ba(%rip),%rax
mov    (%rax),%eax
cmp    -0x14(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    -0x10(%rbp),%rdi
mov    $0xfff,%esi
mov    $0x64,%edx
call   1050 <posix_memalign@plt>
mov    %eax,-0x14(%rbp)
mov    0x298b(%rip),%rax
mov    (%rax),%eax
cmp    -0x14(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    -0x10(%rbp),%rdi
mov    $0x1000,%esi
mov    $0x64,%edx
call   1050 <posix_memalign@plt>
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
xor    %ecx,%ecx
cmp    -0x14(%rbp),%ecx
mov    %al,-0x18(%rbp)
jne    16a6 <main+0x576>
mov    -0x10(%rbp),%rax
mov    $0x1000,%ecx
cqto
idiv   %rcx
xor    %eax,%eax
cmp    %rdx,%rax
sete   %al
mov    %al,-0x18(%rbp)
mov    -0x18(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
lea    -0x10(%rbp),%rdi
mov    $0x1001,%esi
mov    $0x64,%edx
call   1050 <posix_memalign@plt>
mov    %eax,-0x14(%rbp)
mov    0x2910(%rip),%rax
mov    (%rax),%eax
cmp    -0x14(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x1,%edi
call   1030 <assert@plt>
xor    %edi,%edi
mov    $0x64,%esi
call   1040 <memalign@plt>
xor    %edi,%edi
test   $0x7,%al
sete   %dil
call   1030 <assert@plt>
mov    $0x1,%edi
mov    $0x64,%esi
call   1040 <memalign@plt>
xor    %edi,%edi
test   $0x7,%al
sete   %dil
call   1030 <assert@plt>
mov    $0x2,%edi
mov    $0x64,%esi
call   1040 <memalign@plt>
xor    %edi,%edi
test   $0x7,%al
sete   %dil
call   1030 <assert@plt>
mov    $0x3,%edi
mov    $0x64,%esi
call   1040 <memalign@plt>
xor    %edi,%edi
test   $0x7,%al
sete   %dil
call   1030 <assert@plt>
mov    $0x4,%edi
mov    $0x64,%esi
call   1040 <memalign@plt>
xor    %edi,%edi
test   $0x7,%al
sete   %dil
call   1030 <assert@plt>
mov    $0x5,%edi
mov    $0x64,%esi
call   1040 <memalign@plt>
xor    %edi,%edi
test   $0x7,%al
sete   %dil
call   1030 <assert@plt>
mov    $0x7,%edi
mov    $0x64,%esi
call   1040 <memalign@plt>
xor    %edi,%edi
test   $0x7,%al
sete   %dil
call   1030 <assert@plt>
mov    $0x8,%edi
mov    $0x64,%esi
call   1040 <memalign@plt>
xor    %edi,%edi
test   $0x7,%al
sete   %dil
call   1030 <assert@plt>
mov    $0x9,%edi
mov    $0x64,%esi
call   1040 <memalign@plt>
xor    %edi,%edi
test   $0xf,%al
sete   %dil
call   1030 <assert@plt>
mov    $0x1f,%edi
mov    $0x64,%esi
call   1040 <memalign@plt>
xor    %edi,%edi
test   $0x1f,%al
sete   %dil
call   1030 <assert@plt>
mov    $0x20,%edi
mov    $0x64,%esi
call   1040 <memalign@plt>
xor    %edi,%edi
test   $0x1f,%al
sete   %dil
call   1030 <assert@plt>
mov    $0x21,%edi
mov    $0x64,%esi
call   1040 <memalign@plt>
xor    %edi,%edi
test   $0x3f,%al
sete   %dil
call   1030 <assert@plt>
mov    $0xfff,%edi
mov    $0x64,%esi
call   1040 <memalign@plt>
xor    %edi,%edi
test   $0xfff,%eax
sete   %dil
call   1030 <assert@plt>
mov    $0x1000,%edi
mov    $0x64,%esi
call   1040 <memalign@plt>
xor    %edi,%edi
test   $0xfff,%eax
sete   %dil
call   1030 <assert@plt>
mov    $0x1001,%edi
mov    $0x64,%esi
call   1040 <memalign@plt>
mov    %rax,(%rsp)
xor    %edi,%edi
test   $0x1fff,%eax
sete   %dil
call   1030 <assert@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xffffffff,%esi
mov    $0x64,%edx
call   1050 <posix_memalign@plt>
mov    0x2cd8(%rip),%r14
xor    %edi,%edi
cmp    %eax,(%r14)
sete   %dil
call   1030 <assert@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1050 <posix_memalign@plt>
test   %eax,%eax
sete   %al
testb  $0x7,(%rsp)
sete   %cl
and    %al,%cl
movzbl %cl,%edi
call   1030 <assert@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x64,%edx
call   1050 <posix_memalign@plt>
xor    %edi,%edi
cmp    %eax,(%r14)
sete   %dil
call   1030 <assert@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x64,%edx
call   1050 <posix_memalign@plt>
xor    %edi,%edi
cmp    %eax,(%r14)
sete   %dil
call   1030 <assert@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x64,%edx
call   1050 <posix_memalign@plt>
xor    %edi,%edi
cmp    %eax,(%r14)
sete   %dil
call   1030 <assert@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
mov    $0x64,%edx
call   1050 <posix_memalign@plt>
test   %eax,%eax
sete   %al
testb  $0x7,(%rsp)
sete   %cl
and    %al,%cl
movzbl %cl,%edi
call   1030 <assert@plt>
mov    %rbx,%rdi
mov    $0x1f,%esi
mov    $0x64,%edx
call   1050 <posix_memalign@plt>
xor    %edi,%edi
cmp    %eax,(%r14)
sete   %dil
call   1030 <assert@plt>
mov    %rbx,%rdi
mov    $0x20,%esi
mov    $0x64,%edx
call   1050 <posix_memalign@plt>
test   %eax,%eax
sete   %al
testb  $0x1f,(%rsp)
sete   %cl
and    %al,%cl
movzbl %cl,%edi
call   1030 <assert@plt>
mov    %rbx,%rdi
mov    $0x21,%esi
mov    $0x64,%edx
call   1050 <posix_memalign@plt>
xor    %edi,%edi
cmp    %eax,(%r14)
sete   %dil
call   1030 <assert@plt>
mov    %rbx,%rdi
mov    $0xfff,%esi
mov    $0x64,%edx
call   1050 <posix_memalign@plt>
xor    %edi,%edi
cmp    %eax,(%r14)
sete   %dil
call   1030 <assert@plt>
mov    %rbx,%rdi
mov    $0x1000,%esi
mov    $0x64,%edx
call   1050 <posix_memalign@plt>
test   %eax,%eax
sete   %al
testl  $0xfff,(%rsp)
sete   %cl
and    %al,%cl
movzbl %cl,%edi
call   1030 <assert@plt>
mov    %rbx,%rdi
mov    $0x1001,%esi
mov    $0x64,%edx
call   1050 <posix_memalign@plt>
xor    %edi,%edi
cmp    %eax,(%r14)
sete   %dil
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @assert(i32 1)
%5 = call i32* @memalign(i32 0, i32 100)
store i32* %5, i32** %2
%6 = load i32*, i32** %2
%7 = ptrtoint i32* %6 to i64
%8 = srem i64 %7, 8
%9 = icmp eq i64 0, %8
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = call i32* @memalign(i32 1, i32 100)
store i32* %12, i32** %2
%13 = load i32*, i32** %2
%14 = ptrtoint i32* %13 to i64
%15 = srem i64 %14, 8
%16 = icmp eq i64 0, %15
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
%19 = call i32* @memalign(i32 2, i32 100)
store i32* %19, i32** %2
%20 = load i32*, i32** %2
%21 = ptrtoint i32* %20 to i64
%22 = srem i64 %21, 8
%23 = icmp eq i64 0, %22
%24 = zext i1 %23 to i32
%25 = call i32 @assert(i32 %24)
%26 = call i32* @memalign(i32 3, i32 100)
store i32* %26, i32** %2
%27 = load i32*, i32** %2
%28 = ptrtoint i32* %27 to i64
%29 = srem i64 %28, 8
%30 = icmp eq i64 0, %29
%31 = zext i1 %30 to i32
%32 = call i32 @assert(i32 %31)
%33 = call i32* @memalign(i32 4, i32 100)
store i32* %33, i32** %2
%34 = load i32*, i32** %2
%35 = ptrtoint i32* %34 to i64
%36 = srem i64 %35, 8
%37 = icmp eq i64 0, %36
%38 = zext i1 %37 to i32
%39 = call i32 @assert(i32 %38)
%40 = call i32* @memalign(i32 5, i32 100)
store i32* %40, i32** %2
%41 = load i32*, i32** %2
%42 = ptrtoint i32* %41 to i64
%43 = srem i64 %42, 8
%44 = icmp eq i64 0, %43
%45 = zext i1 %44 to i32
%46 = call i32 @assert(i32 %45)
%47 = call i32* @memalign(i32 7, i32 100)
store i32* %47, i32** %2
%48 = load i32*, i32** %2
%49 = ptrtoint i32* %48 to i64
%50 = srem i64 %49, 8
%51 = icmp eq i64 0, %50
%52 = zext i1 %51 to i32
%53 = call i32 @assert(i32 %52)
%54 = call i32* @memalign(i32 8, i32 100)
store i32* %54, i32** %2
%55 = load i32*, i32** %2
%56 = ptrtoint i32* %55 to i64
%57 = srem i64 %56, 8
%58 = icmp eq i64 0, %57
%59 = zext i1 %58 to i32
%60 = call i32 @assert(i32 %59)
%61 = call i32* @memalign(i32 9, i32 100)
store i32* %61, i32** %2
%62 = load i32*, i32** %2
%63 = ptrtoint i32* %62 to i64
%64 = srem i64 %63, 16
%65 = icmp eq i64 0, %64
%66 = zext i1 %65 to i32
%67 = call i32 @assert(i32 %66)
%68 = call i32* @memalign(i32 31, i32 100)
store i32* %68, i32** %2
%69 = load i32*, i32** %2
%70 = ptrtoint i32* %69 to i64
%71 = srem i64 %70, 32
%72 = icmp eq i64 0, %71
%73 = zext i1 %72 to i32
%74 = call i32 @assert(i32 %73)
%75 = call i32* @memalign(i32 32, i32 100)
store i32* %75, i32** %2
%76 = load i32*, i32** %2
%77 = ptrtoint i32* %76 to i64
%78 = srem i64 %77, 32
%79 = icmp eq i64 0, %78
%80 = zext i1 %79 to i32
%81 = call i32 @assert(i32 %80)
%82 = call i32* @memalign(i32 33, i32 100)
store i32* %82, i32** %2
%83 = load i32*, i32** %2
%84 = ptrtoint i32* %83 to i64
%85 = srem i64 %84, 64
%86 = icmp eq i64 0, %85
%87 = zext i1 %86 to i32
%88 = call i32 @assert(i32 %87)
%89 = call i32* @memalign(i32 4095, i32 100)
store i32* %89, i32** %2
%90 = load i32*, i32** %2
%91 = ptrtoint i32* %90 to i64
%92 = srem i64 %91, 4096
%93 = icmp eq i64 0, %92
%94 = zext i1 %93 to i32
%95 = call i32 @assert(i32 %94)
%96 = call i32* @memalign(i32 4096, i32 100)
store i32* %96, i32** %2
%97 = load i32*, i32** %2
%98 = ptrtoint i32* %97 to i64
%99 = srem i64 %98, 4096
%100 = icmp eq i64 0, %99
%101 = zext i1 %100 to i32
%102 = call i32 @assert(i32 %101)
%103 = call i32* @memalign(i32 4097, i32 100)
store i32* %103, i32** %2
%104 = load i32*, i32** %2
%105 = ptrtoint i32* %104 to i64
%106 = srem i64 %105, 8192
%107 = icmp eq i64 0, %106
%108 = zext i1 %107 to i32
%109 = call i32 @assert(i32 %108)
%110 = bitcast i32** %2 to i8**
%111 = call i32 @posix_memalign(i8** %110, i32 -1, i32 100)
store i32 %111, i32* %3
%112 = load i32, i32* @EINVAL
%113 = load i32, i32* %3
%114 = icmp eq i32 %112, %113
%115 = zext i1 %114 to i32
%116 = call i32 @assert(i32 %115)
%117 = bitcast i32** %2 to i8**
%118 = call i32 @posix_memalign(i8** %117, i32 0, i32 100)
store i32 %118, i32* %3
%119 = load i32, i32* %3
%120 = icmp eq i32 0, %119
br i1 %120, label %121, label %126
121: ; preds = %0
%122 = load i32*, i32** %2
%123 = ptrtoint i32* %122 to i64
%124 = srem i64 %123, 8
%125 = icmp eq i64 0, %124
br label %126
126: ; preds = %121, %0
%127 = phi i1 [ false, %0 ], [ %125, %121 ]
%128 = zext i1 %127 to i32
%129 = call i32 @assert(i32 %128)
%130 = bitcast i32** %2 to i8**
%131 = call i32 @posix_memalign(i8** %130, i32 1, i32 100)
store i32 %131, i32* %3
%132 = load i32, i32* @EINVAL
%133 = load i32, i32* %3
%134 = icmp eq i32 %132, %133
%135 = zext i1 %134 to i32
%136 = call i32 @assert(i32 %135)
%137 = bitcast i32** %2 to i8**
%138 = call i32 @posix_memalign(i8** %137, i32 2, i32 100)
store i32 %138, i32* %3
%139 = load i32, i32* @EINVAL
%140 = load i32, i32* %3
%141 = icmp eq i32 %139, %140
%142 = zext i1 %141 to i32
%143 = call i32 @assert(i32 %142)
%144 = bitcast i32** %2 to i8**
%145 = call i32 @posix_memalign(i8** %144, i32 3, i32 100)
store i32 %145, i32* %3
%146 = load i32, i32* @EINVAL
%147 = load i32, i32* %3
%148 = icmp eq i32 %146, %147
%149 = zext i1 %148 to i32
%150 = call i32 @assert(i32 %149)
%151 = bitcast i32** %2 to i8**
%152 = call i32 @posix_memalign(i8** %151, i32 8, i32 100)
store i32 %152, i32* %3
%153 = load i32, i32* %3
%154 = icmp eq i32 0, %153
br i1 %154, label %155, label %160
155: ; preds = %126
%156 = load i32*, i32** %2
%157 = ptrtoint i32* %156 to i64
%158 = urem i64 %157, 8
%159 = icmp eq i64 0, %158
br label %160
160: ; preds = %155, %126
%161 = phi i1 [ false, %126 ], [ %159, %155 ]
%162 = zext i1 %161 to i32
%163 = call i32 @assert(i32 %162)
%164 = bitcast i32** %2 to i8**
%165 = call i32 @posix_memalign(i8** %164, i32 31, i32 100)
store i32 %165, i32* %3
%166 = load i32, i32* @EINVAL
%167 = load i32, i32* %3
%168 = icmp eq i32 %166, %167
%169 = zext i1 %168 to i32
%170 = call i32 @assert(i32 %169)
%171 = bitcast i32** %2 to i8**
%172 = call i32 @posix_memalign(i8** %171, i32 32, i32 100)
store i32 %172, i32* %3
%173 = load i32, i32* %3
%174 = icmp eq i32 0, %173
br i1 %174, label %175, label %180
175: ; preds = %160
%176 = load i32*, i32** %2
%177 = ptrtoint i32* %176 to i64
%178 = srem i64 %177, 32
%179 = icmp eq i64 0, %178
br label %180
180: ; preds = %175, %160
%181 = phi i1 [ false, %160 ], [ %179, %175 ]
%182 = zext i1 %181 to i32
%183 = call i32 @assert(i32 %182)
%184 = bitcast i32** %2 to i8**
%185 = call i32 @posix_memalign(i8** %184, i32 33, i32 100)
store i32 %185, i32* %3
%186 = load i32, i32* @EINVAL
%187 = load i32, i32* %3
%188 = icmp eq i32 %186, %187
%189 = zext i1 %188 to i32
%190 = call i32 @assert(i32 %189)
%191 = bitcast i32** %2 to i8**
%192 = call i32 @posix_memalign(i8** %191, i32 4095, i32 100)
store i32 %192, i32* %3
%193 = load i32, i32* @EINVAL
%194 = load i32, i32* %3
%195 = icmp eq i32 %193, %194
%196 = zext i1 %195 to i32
%197 = call i32 @assert(i32 %196)
%198 = bitcast i32** %2 to i8**
%199 = call i32 @posix_memalign(i8** %198, i32 4096, i32 100)
store i32 %199, i32* %3
%200 = load i32, i32* %3
%201 = icmp eq i32 0, %200
br i1 %201, label %202, label %207
202: ; preds = %180
%203 = load i32*, i32** %2
%204 = ptrtoint i32* %203 to i64
%205 = srem i64 %204, 4096
%206 = icmp eq i64 0, %205
br label %207
207: ; preds = %202, %180
%208 = phi i1 [ false, %180 ], [ %206, %202 ]
%209 = zext i1 %208 to i32
%210 = call i32 @assert(i32 %209)
%211 = bitcast i32** %2 to i8**
%212 = call i32 @posix_memalign(i8** %211, i32 4097, i32 100)
store i32 %212, i32* %3
%213 = load i32, i32* @EINVAL
%214 = load i32, i32* %3
%215 = icmp eq i32 %213, %214
%216 = zext i1 %215 to i32
%217 = call i32 @assert(i32 %216)
ret i32 0
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @main() {
%1 = alloca i32*
%2 = bitcast i32** %1 to i8*
%3 = tail call i32 @assert(i32 1)
%4 = tail call i32* @memalign(i32 0, i32 100)
%5 = ptrtoint i32* %4 to i64
%6 = and i64 %5, 7
%7 = icmp eq i64 %6, 0
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = tail call i32* @memalign(i32 1, i32 100)
%11 = ptrtoint i32* %10 to i64
%12 = and i64 %11, 7
%13 = icmp eq i64 %12, 0
%14 = zext i1 %13 to i32
%15 = tail call i32 @assert(i32 %14)
%16 = tail call i32* @memalign(i32 2, i32 100)
%17 = ptrtoint i32* %16 to i64
%18 = and i64 %17, 7
%19 = icmp eq i64 %18, 0
%20 = zext i1 %19 to i32
%21 = tail call i32 @assert(i32 %20)
%22 = tail call i32* @memalign(i32 3, i32 100)
%23 = ptrtoint i32* %22 to i64
%24 = and i64 %23, 7
%25 = icmp eq i64 %24, 0
%26 = zext i1 %25 to i32
%27 = tail call i32 @assert(i32 %26)
%28 = tail call i32* @memalign(i32 4, i32 100)
%29 = ptrtoint i32* %28 to i64
%30 = and i64 %29, 7
%31 = icmp eq i64 %30, 0
%32 = zext i1 %31 to i32
%33 = tail call i32 @assert(i32 %32)
%34 = tail call i32* @memalign(i32 5, i32 100)
%35 = ptrtoint i32* %34 to i64
%36 = and i64 %35, 7
%37 = icmp eq i64 %36, 0
%38 = zext i1 %37 to i32
%39 = tail call i32 @assert(i32 %38)
%40 = tail call i32* @memalign(i32 7, i32 100)
%41 = ptrtoint i32* %40 to i64
%42 = and i64 %41, 7
%43 = icmp eq i64 %42, 0
%44 = zext i1 %43 to i32
%45 = tail call i32 @assert(i32 %44)
%46 = tail call i32* @memalign(i32 8, i32 100)
%47 = ptrtoint i32* %46 to i64
%48 = and i64 %47, 7
%49 = icmp eq i64 %48, 0
%50 = zext i1 %49 to i32
%51 = tail call i32 @assert(i32 %50)
%52 = tail call i32* @memalign(i32 9, i32 100)
%53 = ptrtoint i32* %52 to i64
%54 = and i64 %53, 15
%55 = icmp eq i64 %54, 0
%56 = zext i1 %55 to i32
%57 = tail call i32 @assert(i32 %56)
%58 = tail call i32* @memalign(i32 31, i32 100)
%59 = ptrtoint i32* %58 to i64
%60 = and i64 %59, 31
%61 = icmp eq i64 %60, 0
%62 = zext i1 %61 to i32
%63 = tail call i32 @assert(i32 %62)
%64 = tail call i32* @memalign(i32 32, i32 100)
%65 = ptrtoint i32* %64 to i64
%66 = and i64 %65, 31
%67 = icmp eq i64 %66, 0
%68 = zext i1 %67 to i32
%69 = tail call i32 @assert(i32 %68)
%70 = tail call i32* @memalign(i32 33, i32 100)
%71 = ptrtoint i32* %70 to i64
%72 = and i64 %71, 63
%73 = icmp eq i64 %72, 0
%74 = zext i1 %73 to i32
%75 = tail call i32 @assert(i32 %74)
%76 = tail call i32* @memalign(i32 4095, i32 100)
%77 = ptrtoint i32* %76 to i64
%78 = and i64 %77, 4095
%79 = icmp eq i64 %78, 0
%80 = zext i1 %79 to i32
%81 = tail call i32 @assert(i32 %80)
%82 = tail call i32* @memalign(i32 4096, i32 100)
%83 = ptrtoint i32* %82 to i64
%84 = and i64 %83, 4095
%85 = icmp eq i64 %84, 0
%86 = zext i1 %85 to i32
%87 = tail call i32 @assert(i32 %86)
%88 = tail call i32* @memalign(i32 4097, i32 100)
store i32* %88, i32** %1
%89 = ptrtoint i32* %88 to i64
%90 = and i64 %89, 8191
%91 = icmp eq i64 %90, 0
%92 = zext i1 %91 to i32
%93 = tail call i32 @assert(i32 %92)
%94 = bitcast i32** %1 to i8**
%95 = call i32 @posix_memalign(i8** %94, i32 -1, i32 100)
%96 = load i32, i32* @EINVAL
%97 = icmp eq i32 %96, %95
%98 = zext i1 %97 to i32
%99 = call i32 @assert(i32 %98)
%100 = call i32 @posix_memalign(i8** %94, i32 0, i32 100)
%101 = icmp eq i32 %100, 0
%102 = load i32*, i32** %1
%103 = ptrtoint i32* %102 to i64
%104 = and i64 %103, 7
%105 = icmp eq i64 %104, 0
%106 = select i1 %101, i1 %105, i1 false
%107 = zext i1 %106 to i32
%108 = call i32 @assert(i32 %107)
%109 = call i32 @posix_memalign(i8** %94, i32 1, i32 100)
%110 = load i32, i32* @EINVAL
%111 = icmp eq i32 %110, %109
%112 = zext i1 %111 to i32
%113 = call i32 @assert(i32 %112)
%114 = call i32 @posix_memalign(i8** %94, i32 2, i32 100)
%115 = load i32, i32* @EINVAL
%116 = icmp eq i32 %115, %114
%117 = zext i1 %116 to i32
%118 = call i32 @assert(i32 %117)
%119 = call i32 @posix_memalign(i8** %94, i32 3, i32 100)
%120 = load i32, i32* @EINVAL
%121 = icmp eq i32 %120, %119
%122 = zext i1 %121 to i32
%123 = call i32 @assert(i32 %122)
%124 = call i32 @posix_memalign(i8** %94, i32 8, i32 100)
%125 = icmp eq i32 %124, 0
%126 = load i32*, i32** %1
%127 = ptrtoint i32* %126 to i64
%128 = and i64 %127, 7
%129 = icmp eq i64 %128, 0
%130 = select i1 %125, i1 %129, i1 false
%131 = zext i1 %130 to i32
%132 = call i32 @assert(i32 %131)
%133 = call i32 @posix_memalign(i8** %94, i32 31, i32 100)
%134 = load i32, i32* @EINVAL
%135 = icmp eq i32 %134, %133
%136 = zext i1 %135 to i32
%137 = call i32 @assert(i32 %136)
%138 = call i32 @posix_memalign(i8** %94, i32 32, i32 100)
%139 = icmp eq i32 %138, 0
%140 = load i32*, i32** %1
%141 = ptrtoint i32* %140 to i64
%142 = and i64 %141, 31
%143 = icmp eq i64 %142, 0
%144 = select i1 %139, i1 %143, i1 false
%145 = zext i1 %144 to i32
%146 = call i32 @assert(i32 %145)
%147 = call i32 @posix_memalign(i8** %94, i32 33, i32 100)
%148 = load i32, i32* @EINVAL
%149 = icmp eq i32 %148, %147
%150 = zext i1 %149 to i32
%151 = call i32 @assert(i32 %150)
%152 = call i32 @posix_memalign(i8** %94, i32 4095, i32 100)
%153 = load i32, i32* @EINVAL
%154 = icmp eq i32 %153, %152
%155 = zext i1 %154 to i32
%156 = call i32 @assert(i32 %155)
%157 = call i32 @posix_memalign(i8** %94, i32 4096, i32 100)
%158 = icmp eq i32 %157, 0
%159 = load i32*, i32** %1
%160 = ptrtoint i32* %159 to i64
%161 = and i64 %160, 4095
%162 = icmp eq i64 %161, 0
%163 = select i1 %158, i1 %162, i1 false
%164 = zext i1 %163 to i32
%165 = call i32 @assert(i32 %164)
%166 = call i32 @posix_memalign(i8** %94, i32 4097, i32 100)
%167 = load i32, i32* @EINVAL
%168 = icmp eq i32 %167, %166
%169 = zext i1 %168 to i32
%170 = call i32 @assert(i32 %169)
ret i32 0
}