#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*/ acc_copyin(unsigned char *, int const);
int /*<<< orphan*/ acc_copyout(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 *h1, *h2;
  h1 = (unsigned char *)malloc(N);
  for (i = 0; i < N; i++) {
    h1[i] = 0xab;
  }
  (void)acc_copyin(h1, N);
  h2 = (unsigned char *)malloc(N);
  for (i = 0; i < N; i++) {
    h2[i] = 0xde;
  }
  (void)acc_copyin(h2, N);
  acc_copyout(h1, N + N);
  free(h1);
  free(h2);
  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   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x100,-0x18(%rbp)
jge    1199 <main+0x59>
mov    -0x20(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0xab,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1172 <main+0x32>
mov    -0x20(%rbp),%rdi
mov    $0x100,%esi
call   1040 <acc_copyin@plt>
mov    $0x100,%edi
call   1050 <malloc@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x100,-0x18(%rbp)
jge    11e3 <main+0xa3>
mov    -0x28(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0xde,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11bc <main+0x7c>
mov    -0x28(%rbp),%rdi
mov    $0x100,%esi
call   1040 <acc_copyin@plt>
mov    -0x20(%rbp),%rdi
mov    $0x200,%esi
call   1060 <acc_copyout@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%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   1050 <malloc@plt>
mov    %rax,%r14
movaps 0xea8(%rip),%xmm0
movups %xmm0,(%rax)
movups %xmm0,0x10(%rax)
movups %xmm0,0x20(%rax)
movups %xmm0,0x30(%rax)
movups %xmm0,0x40(%rax)
movups %xmm0,0x50(%rax)
movups %xmm0,0x60(%rax)
movups %xmm0,0x70(%rax)
movups %xmm0,0x80(%rax)
movups %xmm0,0x90(%rax)
movups %xmm0,0xa0(%rax)
movups %xmm0,0xb0(%rax)
movups %xmm0,0xc0(%rax)
movups %xmm0,0xd0(%rax)
movups %xmm0,0xe0(%rax)
movups %xmm0,0xf0(%rax)
mov    %rax,%rdi
mov    $0x100,%esi
call   1040 <acc_copyin@plt>
mov    $0x100,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
movaps 0xe40(%rip),%xmm0
movups %xmm0,(%rax)
movups %xmm0,0x10(%rax)
movups %xmm0,0x20(%rax)
movups %xmm0,0x30(%rax)
movups %xmm0,0x40(%rax)
movups %xmm0,0x50(%rax)
movups %xmm0,0x60(%rax)
movups %xmm0,0x70(%rax)
movups %xmm0,0x80(%rax)
movups %xmm0,0x90(%rax)
movups %xmm0,0xa0(%rax)
movups %xmm0,0xb0(%rax)
movups %xmm0,0xc0(%rax)
movups %xmm0,0xd0(%rax)
movups %xmm0,0xe0(%rax)
movups %xmm0,0xf0(%rax)
mov    %rax,%rdi
mov    $0x100,%esi
call   1040 <acc_copyin@plt>
mov    %r14,%rdi
mov    $0x200,%esi
call   1060 <acc_copyout@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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 = %20, %2
%13 = load i32, i32* %7
%14 = icmp slt i32 %13, 256
br i1 %14, label %15, label %23
15: ; preds = %12
%16 = load i8*, i8** %8
%17 = load i32, i32* %7
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
store i8 -85, i8* %19
br label %20
20: ; preds = %15
%21 = load i32, i32* %7
%22 = add nsw i32 %21, 1
store i32 %22, i32* %7
br label %12
23: ; preds = %12
%24 = load i8*, i8** %8
%25 = call i32 @acc_copyin(i8* %24, i32 256)
%26 = call i64 @malloc(i32 256)
%27 = inttoptr i64 %26 to i8*
store i8* %27, i8** %9
store i32 0, i32* %7
br label %28
28: ; preds = %36, %23
%29 = load i32, i32* %7
%30 = icmp slt i32 %29, 256
br i1 %30, label %31, label %39
31: ; preds = %28
%32 = load i8*, i8** %9
%33 = load i32, i32* %7
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %32, i64 %34
store i8 -34, i8* %35
br label %36
36: ; preds = %31
%37 = load i32, i32* %7
%38 = add nsw i32 %37, 1
store i32 %38, i32* %7
br label %28
39: ; preds = %28
%40 = load i8*, i8** %9
%41 = call i32 @acc_copyin(i8* %40, i32 256)
%42 = load i8*, i8** %8
%43 = call i32 @acc_copyout(i8* %42, i32 512)
%44 = load i8*, i8** %8
%45 = call i32 @free(i8* %44)
%46 = load i8*, i8** %9
%47 = call i32 @free(i8* %46)
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 i32 @acc_copyin(i8* %4, i32 256)
%6 = tail call i64 @malloc(i32 256)
%7 = inttoptr i64 %6 to i8*
%8 = tail call i32 @acc_copyin(i8* %7, i32 256)
%9 = tail call i32 @acc_copyout(i8* %4, i32 512)
%10 = tail call i32 @free(i8* %4)
%11 = tail call i32 @free(i8* %7)
ret i32 0
}