#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*/ abort();
int /*<<< orphan*/ acc_delete(unsigned char *, int const);
void *acc_present_or_create(unsigned char *, int const);
int /*<<< orphan*/ free(unsigned char *);
scalar_t__ malloc(int const);
int main(int argc, char **argv) {
  const int N = 256;
  unsigned char *h;
  void *d1, *d2;
  h = (unsigned char *)malloc(N);
  d1 = acc_present_or_create(h, N);
  if (!d1)
    abort();
  d2 = acc_present_or_create(h + 2, N);
  if (!d2)
    abort();
  if (d1 != d2)
    abort();
  acc_delete(h, N);
  free(h);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x100,-0x14(%rbp)
mov    $0x100,%edi
call   1060 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x100,%esi
call   1050 <acc_present_or_create@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    119f <main+0x4f>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x20(%rbp),%rdi
add    $0x2,%rdi
mov    $0x100,%esi
call   1050 <acc_present_or_create@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    11c7 <main+0x77>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x28(%rbp),%rax
cmp    -0x30(%rbp),%rax
je     11dc <main+0x8c>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x20(%rbp),%rdi
mov    $0x100,%esi
call   1070 <acc_delete@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x100,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x100,%esi
call   1050 <acc_present_or_create@plt>
test   %rax,%rax
je     11ad <main+0x5d>
mov    %rax,%r14
lea    0x2(%rbx),%rdi
mov    $0x100,%esi
call   1050 <acc_present_or_create@plt>
test   %rax,%rax
je     11ad <main+0x5d>
cmp    %rax,%r14
jne    11ad <main+0x5d>
mov    %rbx,%rdi
mov    $0x100,%esi
call   1070 <acc_delete@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
xor    %eax,%eax
call   1040 <abort@plt>

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 256, i32* %6
%10 = call i64 @malloc(i32 256)
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** %7
%12 = load i8*, i8** %7
%13 = call i8* @acc_present_or_create(i8* %12, i32 256)
store i8* %13, i8** %8
%14 = load i8*, i8** %8
%15 = icmp ne i8* %14, null
br i1 %15, label %18, label %16
16: ; preds = %2
%17 = call i32 (...) @abort()
unreachable
18: ; preds = %2
%19 = load i8*, i8** %7
%20 = getelementptr inbounds i8, i8* %19, i64 2
%21 = call i8* @acc_present_or_create(i8* %20, i32 256)
store i8* %21, i8** %9
%22 = load i8*, i8** %9
%23 = icmp ne i8* %22, null
br i1 %23, label %26, label %24
24: ; preds = %18
%25 = call i32 (...) @abort()
unreachable
26: ; preds = %18
%27 = load i8*, i8** %8
%28 = load i8*, i8** %9
%29 = icmp ne i8* %27, %28
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = call i32 (...) @abort()
unreachable
32: ; preds = %26
%33 = load i8*, i8** %7
%34 = call i32 @acc_delete(i8* %33, i32 256)
%35 = load i8*, i8** %7
%36 = call i32 @free(i8* %35)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 @malloc(i32 256)
%4 = inttoptr i64 %3 to i8*
%5 = tail call i8* @acc_present_or_create(i8* %4, i32 256)
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32 (...) @abort()
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8, i8* %4, i64 2
%11 = tail call i8* @acc_present_or_create(i8* %10, i32 256)
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = tail call i32 (...) @abort()
unreachable
15: ; preds = %9
%16 = icmp eq i8* %5, %11
br i1 %16, label %19, label %17
17: ; preds = %15
%18 = tail call i32 (...) @abort()
unreachable
19: ; preds = %15
%20 = tail call i32 @acc_delete(i8* %4, i32 256)
%21 = tail call i32 @free(i8* %4)
ret i32 0
}