#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*/ assert(void *);
int /*<<< orphan*/ free(void *);
void *malloc(unsigned int);
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char **argv) {
  assert(argc == 2);
  if (!strcmp(argv[1], "pointers")) {
    void *p = malloc(1U << 16);
    assert(p);
    free((void *)((uintptr_t)p | 1));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
movslq %eax,%rdi
call   1050 <assert@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe87(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11ab <main+0x6b>
mov    $0x10000,%edi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <assert@plt>
mov    -0x18(%rbp),%rdi
or     $0x1,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
xor    %eax,%eax
cmp    $0x2,%edi
sete   %al
mov    %rax,%rdi
call   1050 <assert@plt>
mov    0x8(%rbx),%rdi
lea    0xea1(%rip),%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
jne    1189 <main+0x49>
mov    $0x10000,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <assert@plt>
or     $0x1,%rbx
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"pointers\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 2
%9 = zext i1 %8 to i32
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i8*
%12 = call i32 @assert(i8* %11)
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @strcmp(i8* %15, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%17 = icmp ne i32 %16, 0
br i1 %17, label %27, label %18
18: ; preds = %2
%19 = call i8* @malloc(i32 65536)
store i8* %19, i8** %6
%20 = load i8*, i8** %6
%21 = call i32 @assert(i8* %20)
%22 = load i8*, i8** %6
%23 = ptrtoint i8* %22 to i64
%24 = or i64 %23, 1
%25 = inttoptr i64 %24 to i8*
%26 = call i32 @free(i8* %25)
br label %27
27: ; preds = %18, %2
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"pointers\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
%4 = zext i1 %3 to i64
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 @assert(i8* %5)
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @strcmp(i8* dereferenceable(1) %8, i8* dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %18
11: ; preds = %2
%12 = tail call dereferenceable_or_null(65536) i8* @malloc(i32 65536)
%13 = tail call i32 @assert(i8* %12)
%14 = ptrtoint i8* %12 to i64
%15 = or i64 %14, 1
%16 = inttoptr i64 %15 to i8*
%17 = tail call i32 @free(i8* %16)
br label %18
18: ; preds = %11, %2
ret i32 0
}