#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*/ free(int *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *);
int main() {
  int n = 10;
  int i;
  int *a;
  a = (int *)malloc(sizeof(int) * n);
#pragma acc data copy(a [0:n], n)
  {
#pragma acc parallel loop
    for (i = 0; i < n; i++) {
      a[i] = i * i;
    }
  }
  for (i = 0; i < n; i++) {
    if (a[i] != i * i) {
      return 1;
    }
  }
  free(a);
  printf("PASS\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movslq -0x8(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    118c <main+0x5c>
mov    -0xc(%rbp),%edx
imul   -0xc(%rbp),%edx
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1160 <main+0x30>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11d8 <main+0xa8>
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0xc(%rbp),%ecx
imul   -0xc(%rbp),%ecx
cmp    %ecx,%eax
je     11c5 <main+0x95>
movl   $0x1,-0x4(%rbp)
jmp    11f4 <main+0xc4>
jmp    11ca <main+0x9a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1193 <main+0x63>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
lea    0xe18(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x28,%edi
call   1050 <malloc@plt>
movaps 0xebe(%rip),%xmm0
movups %xmm0,(%rax)
movaps 0xec4(%rip),%xmm0
movups %xmm0,0x10(%rax)
movabs $0x5100000040,%rcx
mov    %rcx,0x20(%rax)
mov    %rax,%rdi
call   1030 <free@plt>
lea    0xeb3(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"PASS\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
store i32 0, i32* %1
store i32 10, i32* %2
%5 = load i32, i32* %2
%6 = sext i32 %5 to i64
%7 = mul i64 4, %6
%8 = trunc i64 %7 to i32
%9 = call i64 @malloc(i32 %8)
%10 = inttoptr i64 %9 to i32*
store i32* %10, i32** %4
store i32 0, i32* %3
br label %11
11: ; preds = %23, %0
%12 = load i32, i32* %3
%13 = load i32, i32* %2
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %26
15: ; preds = %11
%16 = load i32, i32* %3
%17 = load i32, i32* %3
%18 = mul nsw i32 %16, %17
%19 = load i32*, i32** %4
%20 = load i32, i32* %3
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %19, i64 %21
store i32 %18, i32* %22
br label %23
23: ; preds = %15
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
br label %11
26: ; preds = %11
store i32 0, i32* %3
br label %27
27: ; preds = %43, %26
%28 = load i32, i32* %3
%29 = load i32, i32* %2
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %46
31: ; preds = %27
%32 = load i32*, i32** %4
%33 = load i32, i32* %3
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i32, i32* %32, i64 %34
%36 = load i32, i32* %35
%37 = load i32, i32* %3
%38 = load i32, i32* %3
%39 = mul nsw i32 %37, %38
%40 = icmp ne i32 %36, %39
br i1 %40, label %41, label %42
41: ; preds = %31
store i32 1, i32* %1
br label %50
42: ; preds = %31
br label %43
43: ; preds = %42
%44 = load i32, i32* %3
%45 = add nsw i32 %44, 1
store i32 %45, i32* %3
br label %27
46: ; preds = %27
%47 = load i32*, i32** %4
%48 = call i32 @free(i32* %47)
%49 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %1
br label %50
50: ; preds = %46, %41
%51 = load i32, i32* %1
ret i32 %51
}

LLVM IR (-O2):
@str = [5 x i8] c"PASS\00"
define i32 @main() {
%1 = tail call i64 @malloc(i32 40)
%2 = inttoptr i64 %1 to i32*
%3 = inttoptr i64 %1 to <4 x i32>*
store <4 x i32> <i32 0, i32 1, i32 4, i32 9>, <4 x i32>* %3
%4 = getelementptr inbounds i32, i32* %2, i64 4
%5 = bitcast i32* %4 to <4 x i32>*
store <4 x i32> <i32 16, i32 25, i32 36, i32 49>, <4 x i32>* %5
%6 = getelementptr inbounds i32, i32* %2, i64 8
store i32 64, i32* %6
%7 = getelementptr inbounds i32, i32* %2, i64 9
store i32 81, i32* %7
%8 = tail call i32 @free(i32* %2)
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret i32 0
}