#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();
void *acc_create(unsigned char *, int const);
int /*<<< orphan*/ acc_delete(unsigned char *, int const);
int acc_is_present(unsigned char *, int);
int /*<<< orphan*/ free(unsigned char *);
scalar_t__ malloc(int const);
int main(int argc, char **argv) {
  const int N = 256;
  int i;
  unsigned char *h;
  void *d;
  h = (unsigned char *)malloc(N);
  d = acc_create(h, N);
  if (!d)
    abort();
  for (i = 0; i < N; i++) {
    if (acc_is_present(h + i, 1) != 1)
      abort();
  }
  acc_delete(h, N);
  for (i = 0; i < N; i++) {
    if (acc_is_present(h + i, 1) != 0)
      abort();
  }
  d = acc_create(h, N);
  if (!d)
    abort();
  for (i = 0; i < N; i++) {
    if (acc_is_present(h + i, 1) != 1)
      abort();
  }
  acc_delete(h, N);
  for (i = 0; i < N; i++) {
    if (acc_is_present(h + i, 1) != 0)
      abort();
  }
  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   1070 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x100,%esi
call   1050 <acc_create@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    11af <main+0x4f>
mov    $0x0,%al
call   1040 <abort@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x100,-0x18(%rbp)
jge    11fb <main+0x9b>
mov    -0x20(%rbp),%rdi
movslq -0x18(%rbp),%rax
add    %rax,%rdi
mov    $0x1,%esi
call   1060 <acc_is_present@plt>
cmp    $0x1,%eax
je     11e8 <main+0x88>
mov    $0x0,%al
call   1040 <abort@plt>
jmp    11ed <main+0x8d>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11b6 <main+0x56>
mov    -0x20(%rbp),%rdi
mov    $0x100,%esi
call   1080 <acc_delete@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x100,-0x18(%rbp)
jge    1255 <main+0xf5>
mov    -0x20(%rbp),%rdi
movslq -0x18(%rbp),%rax
add    %rax,%rdi
mov    $0x1,%esi
call   1060 <acc_is_present@plt>
cmp    $0x0,%eax
je     1242 <main+0xe2>
mov    $0x0,%al
call   1040 <abort@plt>
jmp    1247 <main+0xe7>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1210 <main+0xb0>
mov    -0x20(%rbp),%rdi
mov    $0x100,%esi
call   1050 <acc_create@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1279 <main+0x119>
mov    $0x0,%al
call   1040 <abort@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x100,-0x18(%rbp)
jge    12c5 <main+0x165>
mov    -0x20(%rbp),%rdi
movslq -0x18(%rbp),%rax
add    %rax,%rdi
mov    $0x1,%esi
call   1060 <acc_is_present@plt>
cmp    $0x1,%eax
je     12b2 <main+0x152>
mov    $0x0,%al
call   1040 <abort@plt>
jmp    12b7 <main+0x157>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1280 <main+0x120>
mov    -0x20(%rbp),%rdi
mov    $0x100,%esi
call   1080 <acc_delete@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x100,-0x18(%rbp)
jge    131f <main+0x1bf>
mov    -0x20(%rbp),%rdi
movslq -0x18(%rbp),%rax
add    %rax,%rdi
mov    $0x1,%esi
call   1060 <acc_is_present@plt>
cmp    $0x0,%eax
je     130c <main+0x1ac>
mov    $0x0,%al
call   1040 <abort@plt>
jmp    1311 <main+0x1b1>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    12da <main+0x17a>
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   1070 <malloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
mov    $0x100,%esi
call   1050 <acc_create@plt>
test   %rax,%rax
je     1271 <main+0x111>
xor    %ebx,%ebx
nopl   0x0(%rax)
lea    (%r14,%rbx,1),%rdi
mov    $0x1,%esi
call   1060 <acc_is_present@plt>
cmp    $0x1,%eax
jne    1271 <main+0x111>
add    $0x1,%rbx
cmp    $0x100,%rbx
jne    1190 <main+0x30>
mov    %r14,%rdi
mov    $0x100,%esi
call   1080 <acc_delete@plt>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    (%r14,%rbx,1),%rdi
mov    $0x1,%esi
call   1060 <acc_is_present@plt>
test   %eax,%eax
jne    1271 <main+0x111>
add    $0x1,%rbx
cmp    $0x100,%rbx
jne    11d0 <main+0x70>
mov    %r14,%rdi
mov    $0x100,%esi
call   1050 <acc_create@plt>
test   %rax,%rax
je     1271 <main+0x111>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
lea    (%r14,%rbx,1),%rdi
mov    $0x1,%esi
call   1060 <acc_is_present@plt>
cmp    $0x1,%eax
jne    1271 <main+0x111>
add    $0x1,%rbx
cmp    $0x100,%rbx
jne    1210 <main+0xb0>
mov    %r14,%rdi
mov    $0x100,%esi
call   1080 <acc_delete@plt>
xor    %ebx,%ebx
nop
lea    (%r14,%rbx,1),%rdi
mov    $0x1,%esi
call   1060 <acc_is_present@plt>
test   %eax,%eax
jne    1271 <main+0x111>
add    $0x1,%rbx
cmp    $0x100,%rbx
jne    1240 <main+0xe0>
mov    %r14,%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 i32
%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** %8
%12 = load i8*, i8** %8
%13 = call i8* @acc_create(i8* %12, i32 256)
store i8* %13, i8** %9
%14 = load i8*, i8** %9
%15 = icmp ne i8* %14, null
br i1 %15, label %18, label %16
16: ; preds = %2
%17 = call i32 (...) @abort()
unreachable
18: ; preds = %2
store i32 0, i32* %7
br label %19
19: ; preds = %32, %18
%20 = load i32, i32* %7
%21 = icmp slt i32 %20, 256
br i1 %21, label %22, label %35
22: ; preds = %19
%23 = load i8*, i8** %8
%24 = load i32, i32* %7
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %23, i64 %25
%27 = call i32 @acc_is_present(i8* %26, i32 1)
%28 = icmp ne i32 %27, 1
br i1 %28, label %29, label %31
29: ; preds = %22
%30 = call i32 (...) @abort()
unreachable
31: ; preds = %22
br label %32
32: ; preds = %31
%33 = load i32, i32* %7
%34 = add nsw i32 %33, 1
store i32 %34, i32* %7
br label %19
35: ; preds = %19
%36 = load i8*, i8** %8
%37 = call i32 @acc_delete(i8* %36, i32 256)
store i32 0, i32* %7
br label %38
38: ; preds = %51, %35
%39 = load i32, i32* %7
%40 = icmp slt i32 %39, 256
br i1 %40, label %41, label %54
41: ; preds = %38
%42 = load i8*, i8** %8
%43 = load i32, i32* %7
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8, i8* %42, i64 %44
%46 = call i32 @acc_is_present(i8* %45, i32 1)
%47 = icmp ne i32 %46, 0
br i1 %47, label %48, label %50
48: ; preds = %41
%49 = call i32 (...) @abort()
unreachable
50: ; preds = %41
br label %51
51: ; preds = %50
%52 = load i32, i32* %7
%53 = add nsw i32 %52, 1
store i32 %53, i32* %7
br label %38
54: ; preds = %38
%55 = load i8*, i8** %8
%56 = call i8* @acc_create(i8* %55, i32 256)
store i8* %56, i8** %9
%57 = load i8*, i8** %9
%58 = icmp ne i8* %57, null
br i1 %58, label %61, label %59
59: ; preds = %54
%60 = call i32 (...) @abort()
unreachable
61: ; preds = %54
store i32 0, i32* %7
br label %62
62: ; preds = %75, %61
%63 = load i32, i32* %7
%64 = icmp slt i32 %63, 256
br i1 %64, label %65, label %78
65: ; preds = %62
%66 = load i8*, i8** %8
%67 = load i32, i32* %7
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds i8, i8* %66, i64 %68
%70 = call i32 @acc_is_present(i8* %69, i32 1)
%71 = icmp ne i32 %70, 1
br i1 %71, label %72, label %74
72: ; preds = %65
%73 = call i32 (...) @abort()
unreachable
74: ; preds = %65
br label %75
75: ; preds = %74
%76 = load i32, i32* %7
%77 = add nsw i32 %76, 1
store i32 %77, i32* %7
br label %62
78: ; preds = %62
%79 = load i8*, i8** %8
%80 = call i32 @acc_delete(i8* %79, i32 256)
store i32 0, i32* %7
br label %81
81: ; preds = %94, %78
%82 = load i32, i32* %7
%83 = icmp slt i32 %82, 256
br i1 %83, label %84, label %97
84: ; preds = %81
%85 = load i8*, i8** %8
%86 = load i32, i32* %7
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds i8, i8* %85, i64 %87
%89 = call i32 @acc_is_present(i8* %88, i32 1)
%90 = icmp ne i32 %89, 0
br i1 %90, label %91, label %93
91: ; preds = %84
%92 = call i32 (...) @abort()
unreachable
93: ; preds = %84
br label %94
94: ; preds = %93
%95 = load i32, i32* %7
%96 = add nsw i32 %95, 1
store i32 %96, i32* %7
br label %81
97: ; preds = %81
%98 = load i8*, i8** %8
%99 = call i32 @free(i8* %98)
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_create(i8* %4, i32 256)
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %12
7: ; preds = %2
%8 = tail call i32 (...) @abort()
unreachable
9: ; preds = %12
%10 = add nuw nsw i64 %13, 1
%11 = icmp eq i64 %10, 256
br i1 %11, label %19, label %12
12: ; preds = %2, %9
%13 = phi i64 [ %10, %9 ], [ 0, %2 ]
%14 = getelementptr inbounds i8, i8* %4, i64 %13
%15 = tail call i32 @acc_is_present(i8* %14, i32 1)
%16 = icmp eq i32 %15, 1
br i1 %16, label %9, label %17
17: ; preds = %12
%18 = tail call i32 (...) @abort()
unreachable
19: ; preds = %9
%20 = tail call i32 @acc_delete(i8* %4, i32 256)
br label %24
21: ; preds = %24
%22 = add nuw nsw i64 %25, 1
%23 = icmp eq i64 %22, 256
br i1 %23, label %31, label %24
24: ; preds = %19, %21
%25 = phi i64 [ 0, %19 ], [ %22, %21 ]
%26 = getelementptr inbounds i8, i8* %4, i64 %25
%27 = tail call i32 @acc_is_present(i8* %26, i32 1)
%28 = icmp eq i32 %27, 0
br i1 %28, label %21, label %29
29: ; preds = %24
%30 = tail call i32 (...) @abort()
unreachable
31: ; preds = %21
%32 = tail call i8* @acc_create(i8* %4, i32 256)
%33 = icmp eq i8* %32, null
br i1 %33, label %34, label %39
34: ; preds = %31
%35 = tail call i32 (...) @abort()
unreachable
36: ; preds = %39
%37 = add nuw nsw i64 %40, 1
%38 = icmp eq i64 %37, 256
br i1 %38, label %46, label %39
39: ; preds = %31, %36
%40 = phi i64 [ %37, %36 ], [ 0, %31 ]
%41 = getelementptr inbounds i8, i8* %4, i64 %40
%42 = tail call i32 @acc_is_present(i8* %41, i32 1)
%43 = icmp eq i32 %42, 1
br i1 %43, label %36, label %44
44: ; preds = %39
%45 = tail call i32 (...) @abort()
unreachable
46: ; preds = %36
%47 = tail call i32 @acc_delete(i8* %4, i32 256)
br label %51
48: ; preds = %51
%49 = add nuw nsw i64 %52, 1
%50 = icmp eq i64 %49, 256
br i1 %50, label %58, label %51
51: ; preds = %46, %48
%52 = phi i64 [ 0, %46 ], [ %49, %48 ]
%53 = getelementptr inbounds i8, i8* %4, i64 %52
%54 = tail call i32 @acc_is_present(i8* %53, i32 1)
%55 = icmp eq i32 %54, 0
br i1 %55, label %48, label %56
56: ; preds = %51
%57 = tail call i32 (...) @abort()
unreachable
58: ; preds = %48
%59 = tail call i32 @free(i8* %4)
ret i32 0
}