#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_copyin(unsigned char *, int const);
int /*<<< orphan*/ acc_free(void *);
int acc_is_present(unsigned char *, int const);
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);
  for (i = 0; i < N; i++) {
    h[i] = i;
  }
  d = acc_copyin(h, N);
  if (acc_is_present(h, 1) != 1)
    abort();
  if (acc_is_present(h, N + 1) != 0)
    abort();
  if (acc_is_present(h + 1, N) != 0)
    abort();
  if (acc_is_present(h - 1, N) != 0)
    abort();
  if (acc_is_present(h - 1, N - 1) != 0)
    abort();
  if (acc_is_present(h + N, 0) != 0)
    abort();
  if (acc_is_present(h + N, N) != 0)
    abort();
  if (acc_is_present(0, N) != 0)
    abort();
  if (acc_is_present(h, 0) != 0)
    abort();
  acc_free(d);
  if (acc_is_present(h, 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)
movl   $0x0,-0x18(%rbp)
cmpl   $0x100,-0x18(%rbp)
jge    11bd <main+0x5d>
mov    -0x18(%rbp),%eax
mov    %al,%dl
mov    -0x20(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1192 <main+0x32>
mov    -0x20(%rbp),%rdi
mov    $0x100,%esi
call   1050 <acc_copyin@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x1,%esi
call   1060 <acc_is_present@plt>
cmp    $0x1,%eax
je     11ed <main+0x8d>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x20(%rbp),%rdi
mov    $0x101,%esi
call   1060 <acc_is_present@plt>
cmp    $0x0,%eax
je     120b <main+0xab>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x20(%rbp),%rdi
add    $0x1,%rdi
mov    $0x100,%esi
call   1060 <acc_is_present@plt>
cmp    $0x0,%eax
je     122d <main+0xcd>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x20(%rbp),%rdi
add    $0xffffffffffffffff,%rdi
mov    $0x100,%esi
call   1060 <acc_is_present@plt>
cmp    $0x0,%eax
je     124f <main+0xef>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x20(%rbp),%rdi
add    $0xffffffffffffffff,%rdi
mov    $0xff,%esi
call   1060 <acc_is_present@plt>
cmp    $0x0,%eax
je     1271 <main+0x111>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x20(%rbp),%rdi
add    $0x100,%rdi
xor    %esi,%esi
call   1060 <acc_is_present@plt>
cmp    $0x0,%eax
je     1293 <main+0x133>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x20(%rbp),%rdi
add    $0x100,%rdi
mov    $0x100,%esi
call   1060 <acc_is_present@plt>
cmp    $0x0,%eax
je     12b8 <main+0x158>
mov    $0x0,%al
call   1040 <abort@plt>
xor    %eax,%eax
mov    %eax,%edi
mov    $0x100,%esi
call   1060 <acc_is_present@plt>
cmp    $0x0,%eax
je     12d6 <main+0x176>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x20(%rbp),%rdi
xor    %esi,%esi
call   1060 <acc_is_present@plt>
cmp    $0x0,%eax
je     12f1 <main+0x191>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x28(%rbp),%rdi
call   1080 <acc_free@plt>
mov    -0x20(%rbp),%rdi
mov    $0x1,%esi
call   1060 <acc_is_present@plt>
cmp    $0x0,%eax
je     1318 <main+0x1b8>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0x100,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
movaps 0xe87(%rip),%xmm0
movups %xmm0,(%rax)
movaps 0xe8d(%rip),%xmm0
movups %xmm0,0x10(%rax)
movaps 0xe92(%rip),%xmm0
movups %xmm0,0x20(%rax)
movaps 0xe97(%rip),%xmm0
movups %xmm0,0x30(%rax)
movaps 0xe9c(%rip),%xmm0
movups %xmm0,0x40(%rax)
movaps 0xea1(%rip),%xmm0
movups %xmm0,0x50(%rax)
movaps 0xea6(%rip),%xmm0
movups %xmm0,0x60(%rax)
movaps 0xeab(%rip),%xmm0
movups %xmm0,0x70(%rax)
movaps 0xeb0(%rip),%xmm0
movups %xmm0,0x80(%rax)
movaps 0xeb2(%rip),%xmm0
movups %xmm0,0x90(%rax)
movaps 0xeb4(%rip),%xmm0
movups %xmm0,0xa0(%rax)
movaps 0xeb6(%rip),%xmm0
movups %xmm0,0xb0(%rax)
movaps 0xeb8(%rip),%xmm0
movups %xmm0,0xc0(%rax)
movaps 0xeba(%rip),%xmm0
movups %xmm0,0xd0(%rax)
movaps 0xebc(%rip),%xmm0
movups %xmm0,0xe0(%rax)
movaps 0xebe(%rip),%xmm0
movups %xmm0,0xf0(%rax)
mov    %rax,%rdi
mov    $0x100,%esi
call   1050 <acc_copyin@plt>
mov    %rax,%r14
mov    %rbx,%rdi
mov    $0x1,%esi
call   1060 <acc_is_present@plt>
cmp    $0x1,%eax
jne    1324 <main+0x1c4>
mov    %rbx,%rdi
mov    $0x101,%esi
call   1060 <acc_is_present@plt>
test   %eax,%eax
jne    1324 <main+0x1c4>
lea    0x1(%rbx),%rdi
mov    $0x100,%esi
call   1060 <acc_is_present@plt>
test   %eax,%eax
jne    1324 <main+0x1c4>
lea    -0x1(%rbx),%r15
mov    %r15,%rdi
mov    $0x100,%esi
call   1060 <acc_is_present@plt>
test   %eax,%eax
jne    1324 <main+0x1c4>
mov    %r15,%rdi
mov    $0xff,%esi
call   1060 <acc_is_present@plt>
test   %eax,%eax
jne    1324 <main+0x1c4>
mov    %rbx,%r15
add    $0x100,%r15
mov    %r15,%rdi
xor    %esi,%esi
call   1060 <acc_is_present@plt>
test   %eax,%eax
jne    1324 <main+0x1c4>
mov    %r15,%rdi
mov    $0x100,%esi
call   1060 <acc_is_present@plt>
test   %eax,%eax
jne    1324 <main+0x1c4>
xor    %edi,%edi
mov    $0x100,%esi
call   1060 <acc_is_present@plt>
test   %eax,%eax
jne    1324 <main+0x1c4>
mov    %rbx,%rdi
xor    %esi,%esi
call   1060 <acc_is_present@plt>
test   %eax,%eax
jne    1324 <main+0x1c4>
mov    %r14,%rdi
call   1080 <acc_free@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1060 <acc_is_present@plt>
test   %eax,%eax
jne    1324 <main+0x1c4>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
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
store i32 0, i32* %7
br label %12
12: ; preds = %22, %2
%13 = load i32, i32* %7
%14 = icmp slt i32 %13, 256
br i1 %14, label %15, label %25
15: ; preds = %12
%16 = load i32, i32* %7
%17 = trunc i32 %16 to i8
%18 = load i8*, i8** %8
%19 = load i32, i32* %7
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
store i8 %17, i8* %21
br label %22
22: ; preds = %15
%23 = load i32, i32* %7
%24 = add nsw i32 %23, 1
store i32 %24, i32* %7
br label %12
25: ; preds = %12
%26 = load i8*, i8** %8
%27 = call i8* @acc_copyin(i8* %26, i32 256)
store i8* %27, i8** %9
%28 = load i8*, i8** %8
%29 = call i32 @acc_is_present(i8* %28, i32 1)
%30 = icmp ne i32 %29, 1
br i1 %30, label %31, label %33
31: ; preds = %25
%32 = call i32 (...) @abort()
unreachable
33: ; preds = %25
%34 = load i8*, i8** %8
%35 = call i32 @acc_is_present(i8* %34, i32 257)
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %33
%38 = call i32 (...) @abort()
unreachable
39: ; preds = %33
%40 = load i8*, i8** %8
%41 = getelementptr inbounds i8, i8* %40, i64 1
%42 = call i32 @acc_is_present(i8* %41, i32 256)
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %46
44: ; preds = %39
%45 = call i32 (...) @abort()
unreachable
46: ; preds = %39
%47 = load i8*, i8** %8
%48 = getelementptr inbounds i8, i8* %47, i64 -1
%49 = call i32 @acc_is_present(i8* %48, i32 256)
%50 = icmp ne i32 %49, 0
br i1 %50, label %51, label %53
51: ; preds = %46
%52 = call i32 (...) @abort()
unreachable
53: ; preds = %46
%54 = load i8*, i8** %8
%55 = getelementptr inbounds i8, i8* %54, i64 -1
%56 = call i32 @acc_is_present(i8* %55, i32 255)
%57 = icmp ne i32 %56, 0
br i1 %57, label %58, label %60
58: ; preds = %53
%59 = call i32 (...) @abort()
unreachable
60: ; preds = %53
%61 = load i8*, i8** %8
%62 = getelementptr inbounds i8, i8* %61, i64 256
%63 = call i32 @acc_is_present(i8* %62, i32 0)
%64 = icmp ne i32 %63, 0
br i1 %64, label %65, label %67
65: ; preds = %60
%66 = call i32 (...) @abort()
unreachable
67: ; preds = %60
%68 = load i8*, i8** %8
%69 = getelementptr inbounds i8, i8* %68, i64 256
%70 = call i32 @acc_is_present(i8* %69, i32 256)
%71 = icmp ne i32 %70, 0
br i1 %71, label %72, label %74
72: ; preds = %67
%73 = call i32 (...) @abort()
unreachable
74: ; preds = %67
%75 = call i32 @acc_is_present(i8* null, i32 256)
%76 = icmp ne i32 %75, 0
br i1 %76, label %77, label %79
77: ; preds = %74
%78 = call i32 (...) @abort()
unreachable
79: ; preds = %74
%80 = load i8*, i8** %8
%81 = call i32 @acc_is_present(i8* %80, i32 0)
%82 = icmp ne i32 %81, 0
br i1 %82, label %83, label %85
83: ; preds = %79
%84 = call i32 (...) @abort()
unreachable
85: ; preds = %79
%86 = load i8*, i8** %9
%87 = call i32 @acc_free(i8* %86)
%88 = load i8*, i8** %8
%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 = %85
%92 = call i32 (...) @abort()
unreachable
93: ; preds = %85
%94 = load i8*, i8** %8
%95 = call i32 @free(i8* %94)
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 = inttoptr i64 %3 to <16 x i8>*
store <16 x i8> <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15>, <16 x i8>* %5
%6 = getelementptr inbounds i8, i8* %4, i64 16
%7 = bitcast i8* %6 to <16 x i8>*
store <16 x i8> <i8 16, i8 17, i8 18, i8 19, i8 20, i8 21, i8 22, i8 23, i8 24, i8 25, i8 26, i8 27, i8 28, i8 29, i8 30, i8 31>, <16 x i8>* %7
%8 = getelementptr inbounds i8, i8* %4, i64 32
%9 = bitcast i8* %8 to <16 x i8>*
store <16 x i8> <i8 32, i8 33, i8 34, i8 35, i8 36, i8 37, i8 38, i8 39, i8 40, i8 41, i8 42, i8 43, i8 44, i8 45, i8 46, i8 47>, <16 x i8>* %9
%10 = getelementptr inbounds i8, i8* %4, i64 48
%11 = bitcast i8* %10 to <16 x i8>*
store <16 x i8> <i8 48, i8 49, i8 50, i8 51, i8 52, i8 53, i8 54, i8 55, i8 56, i8 57, i8 58, i8 59, i8 60, i8 61, i8 62, i8 63>, <16 x i8>* %11
%12 = getelementptr inbounds i8, i8* %4, i64 64
%13 = bitcast i8* %12 to <16 x i8>*
store <16 x i8> <i8 64, i8 65, i8 66, i8 67, i8 68, i8 69, i8 70, i8 71, i8 72, i8 73, i8 74, i8 75, i8 76, i8 77, i8 78, i8 79>, <16 x i8>* %13
%14 = getelementptr inbounds i8, i8* %4, i64 80
%15 = bitcast i8* %14 to <16 x i8>*
store <16 x i8> <i8 80, i8 81, i8 82, i8 83, i8 84, i8 85, i8 86, i8 87, i8 88, i8 89, i8 90, i8 91, i8 92, i8 93, i8 94, i8 95>, <16 x i8>* %15
%16 = getelementptr inbounds i8, i8* %4, i64 96
%17 = bitcast i8* %16 to <16 x i8>*
store <16 x i8> <i8 96, i8 97, i8 98, i8 99, i8 100, i8 101, i8 102, i8 103, i8 104, i8 105, i8 106, i8 107, i8 108, i8 109, i8 110, i8 111>, <16 x i8>* %17
%18 = getelementptr inbounds i8, i8* %4, i64 112
%19 = bitcast i8* %18 to <16 x i8>*
store <16 x i8> <i8 112, i8 113, i8 114, i8 115, i8 116, i8 117, i8 118, i8 119, i8 120, i8 121, i8 122, i8 123, i8 124, i8 125, i8 126, i8 127>, <16 x i8>* %19
%20 = getelementptr inbounds i8, i8* %4, i64 128
%21 = bitcast i8* %20 to <16 x i8>*
store <16 x i8> <i8 -128, i8 -127, i8 -126, i8 -125, i8 -124, i8 -123, i8 -122, i8 -121, i8 -120, i8 -119, i8 -118, i8 -117, i8 -116, i8 -115, i8 -114, i8 -113>, <16 x i8>* %21
%22 = getelementptr inbounds i8, i8* %4, i64 144
%23 = bitcast i8* %22 to <16 x i8>*
store <16 x i8> <i8 -112, i8 -111, i8 -110, i8 -109, i8 -108, i8 -107, i8 -106, i8 -105, i8 -104, i8 -103, i8 -102, i8 -101, i8 -100, i8 -99, i8 -98, i8 -97>, <16 x i8>* %23
%24 = getelementptr inbounds i8, i8* %4, i64 160
%25 = bitcast i8* %24 to <16 x i8>*
store <16 x i8> <i8 -96, i8 -95, i8 -94, i8 -93, i8 -92, i8 -91, i8 -90, i8 -89, i8 -88, i8 -87, i8 -86, i8 -85, i8 -84, i8 -83, i8 -82, i8 -81>, <16 x i8>* %25
%26 = getelementptr inbounds i8, i8* %4, i64 176
%27 = bitcast i8* %26 to <16 x i8>*
store <16 x i8> <i8 -80, i8 -79, i8 -78, i8 -77, i8 -76, i8 -75, i8 -74, i8 -73, i8 -72, i8 -71, i8 -70, i8 -69, i8 -68, i8 -67, i8 -66, i8 -65>, <16 x i8>* %27
%28 = getelementptr inbounds i8, i8* %4, i64 192
%29 = bitcast i8* %28 to <16 x i8>*
store <16 x i8> <i8 -64, i8 -63, i8 -62, i8 -61, i8 -60, i8 -59, i8 -58, i8 -57, i8 -56, i8 -55, i8 -54, i8 -53, i8 -52, i8 -51, i8 -50, i8 -49>, <16 x i8>* %29
%30 = getelementptr inbounds i8, i8* %4, i64 208
%31 = bitcast i8* %30 to <16 x i8>*
store <16 x i8> <i8 -48, i8 -47, i8 -46, i8 -45, i8 -44, i8 -43, i8 -42, i8 -41, i8 -40, i8 -39, i8 -38, i8 -37, i8 -36, i8 -35, i8 -34, i8 -33>, <16 x i8>* %31
%32 = getelementptr inbounds i8, i8* %4, i64 224
%33 = bitcast i8* %32 to <16 x i8>*
store <16 x i8> <i8 -32, i8 -31, i8 -30, i8 -29, i8 -28, i8 -27, i8 -26, i8 -25, i8 -24, i8 -23, i8 -22, i8 -21, i8 -20, i8 -19, i8 -18, i8 -17>, <16 x i8>* %33
%34 = getelementptr inbounds i8, i8* %4, i64 240
%35 = bitcast i8* %34 to <16 x i8>*
store <16 x i8> <i8 -16, i8 -15, i8 -14, i8 -13, i8 -12, i8 -11, i8 -10, i8 -9, i8 -8, i8 -7, i8 -6, i8 -5, i8 -4, i8 -3, i8 -2, i8 -1>, <16 x i8>* %35
%36 = tail call i8* @acc_copyin(i8* %4, i32 256)
%37 = tail call i32 @acc_is_present(i8* %4, i32 1)
%38 = icmp eq i32 %37, 1
br i1 %38, label %41, label %39
39: ; preds = %2
%40 = tail call i32 (...) @abort()
unreachable
41: ; preds = %2
%42 = tail call i32 @acc_is_present(i8* %4, i32 257)
%43 = icmp eq i32 %42, 0
br i1 %43, label %46, label %44
44: ; preds = %41
%45 = tail call i32 (...) @abort()
unreachable
46: ; preds = %41
%47 = getelementptr inbounds i8, i8* %4, i64 1
%48 = tail call i32 @acc_is_present(i8* %47, i32 256)
%49 = icmp eq i32 %48, 0
br i1 %49, label %52, label %50
50: ; preds = %46
%51 = tail call i32 (...) @abort()
unreachable
52: ; preds = %46
%53 = getelementptr inbounds i8, i8* %4, i64 -1
%54 = tail call i32 @acc_is_present(i8* %53, i32 256)
%55 = icmp eq i32 %54, 0
br i1 %55, label %58, label %56
56: ; preds = %52
%57 = tail call i32 (...) @abort()
unreachable
58: ; preds = %52
%59 = tail call i32 @acc_is_present(i8* %53, i32 255)
%60 = icmp eq i32 %59, 0
br i1 %60, label %63, label %61
61: ; preds = %58
%62 = tail call i32 (...) @abort()
unreachable
63: ; preds = %58
%64 = getelementptr inbounds i8, i8* %4, i64 256
%65 = tail call i32 @acc_is_present(i8* %64, i32 0)
%66 = icmp eq i32 %65, 0
br i1 %66, label %69, label %67
67: ; preds = %63
%68 = tail call i32 (...) @abort()
unreachable
69: ; preds = %63
%70 = tail call i32 @acc_is_present(i8* %64, i32 256)
%71 = icmp eq i32 %70, 0
br i1 %71, label %74, label %72
72: ; preds = %69
%73 = tail call i32 (...) @abort()
unreachable
74: ; preds = %69
%75 = tail call i32 @acc_is_present(i8* null, i32 256)
%76 = icmp eq i32 %75, 0
br i1 %76, label %79, label %77
77: ; preds = %74
%78 = tail call i32 (...) @abort()
unreachable
79: ; preds = %74
%80 = tail call i32 @acc_is_present(i8* %4, i32 0)
%81 = icmp eq i32 %80, 0
br i1 %81, label %84, label %82
82: ; preds = %79
%83 = tail call i32 (...) @abort()
unreachable
84: ; preds = %79
%85 = tail call i32 @acc_free(i8* %36)
%86 = tail call i32 @acc_is_present(i8* %4, i32 1)
%87 = icmp eq i32 %86, 0
br i1 %87, label %90, label %88
88: ; preds = %84
%89 = tail call i32 (...) @abort()
unreachable
90: ; preds = %84
%91 = tail call i32 @free(i8* %4)
ret i32 0
}