#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 check(int *, int, int, int, int);
int coord();
int test_1(int gp, int wp, int vp) {
  int ary[(32 * 32 * 32)];
  int exit = 0;
#pragma acc parallel copyout(ary)
  {
#pragma acc loop gang(static : 1)
    for (int ix = 0; ix < (32 * 32 * 32); ix++)
      ary[ix] = coord();
  }
  exit |= check(ary, (32 * 32 * 32), gp, 1, 1);
#pragma acc parallel copyout(ary)
  {
#pragma acc loop worker
    for (int ix = 0; ix < (32 * 32 * 32); ix++)
      ary[ix] = coord();
  }
  exit |= check(ary, (32 * 32 * 32), 1, wp, 1);
#pragma acc parallel copyout(ary)
  {
#pragma acc loop vector
    for (int ix = 0; ix < (32 * 32 * 32); ix++)
      ary[ix] = coord();
  }
  exit |= check(ary, (32 * 32 * 32), 1, 1, vp);
  return exit;
}


x86 assembly (clang, -O0):
<test_1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20020,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movl   $0x0,-0x20014(%rbp)
movl   $0x0,-0x20018(%rbp)
cmpl   $0x8000,-0x20018(%rbp)
jge    1183 <test_1+0x63>
mov    $0x0,%al
call   1040 <coord@plt>
mov    %eax,%ecx
movslq -0x20018(%rbp),%rax
mov    %ecx,-0x20010(%rbp,%rax,4)
mov    -0x20018(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20018(%rbp)
jmp    1148 <test_1+0x28>
lea    -0x20010(%rbp),%rdi
mov    -0x4(%rbp),%edx
mov    $0x8000,%esi
mov    $0x1,%r8d
mov    %r8d,%ecx
call   1030 <check@plt>
or     -0x20014(%rbp),%eax
mov    %eax,-0x20014(%rbp)
movl   $0x0,-0x2001c(%rbp)
cmpl   $0x8000,-0x2001c(%rbp)
jge    11f1 <test_1+0xd1>
mov    $0x0,%al
call   1040 <coord@plt>
mov    %eax,%ecx
movslq -0x2001c(%rbp),%rax
mov    %ecx,-0x20010(%rbp,%rax,4)
mov    -0x2001c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2001c(%rbp)
jmp    11b6 <test_1+0x96>
lea    -0x20010(%rbp),%rdi
mov    -0x8(%rbp),%ecx
mov    $0x8000,%esi
mov    $0x1,%r8d
mov    %r8d,%edx
call   1030 <check@plt>
or     -0x20014(%rbp),%eax
mov    %eax,-0x20014(%rbp)
movl   $0x0,-0x20020(%rbp)
cmpl   $0x8000,-0x20020(%rbp)
jge    125f <test_1+0x13f>
mov    $0x0,%al
call   1040 <coord@plt>
mov    %eax,%ecx
movslq -0x20020(%rbp),%rax
mov    %ecx,-0x20010(%rbp,%rax,4)
mov    -0x20020(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20020(%rbp)
jmp    1224 <test_1+0x104>
lea    -0x20010(%rbp),%rdi
mov    -0xc(%rbp),%r8d
mov    $0x8000,%esi
mov    $0x1,%ecx
mov    %ecx,%edx
call   1030 <check@plt>
or     -0x20014(%rbp),%eax
mov    %eax,-0x20014(%rbp)
mov    -0x20014(%rbp),%eax
add    $0x20020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_1>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20000,%rsp
mov    %edx,%r14d
mov    %esi,%r15d
mov    %edi,%ebx
xor    %ebp,%ebp
nopl   0x0(%rax)
xor    %eax,%eax
call   1040 <coord@plt>
mov    %eax,(%rsp,%rbp,4)
add    $0x1,%rbp
cmp    $0x8000,%rbp
jne    1140 <test_1+0x20>
mov    %rsp,%rdi
mov    $0x8000,%esi
mov    %ebx,%edx
mov    $0x1,%ecx
mov    $0x1,%r8d
call   1030 <check@plt>
mov    %eax,%r12d
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <coord@plt>
mov    %eax,(%rsp,%rbp,4)
add    $0x1,%rbp
cmp    $0x8000,%rbp
jne    1180 <test_1+0x60>
mov    %rsp,%rdi
mov    $0x8000,%esi
mov    $0x1,%edx
mov    %r15d,%ecx
mov    $0x1,%r8d
call   1030 <check@plt>
mov    %eax,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <coord@plt>
mov    %eax,(%rsp,%rbx,4)
add    $0x1,%rbx
cmp    $0x8000,%rbx
jne    11c0 <test_1+0xa0>
or     %r12d,%ebp
mov    %rsp,%rdi
mov    $0x8000,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
mov    %r14d,%r8d
call   1030 <check@plt>
or     %ebp,%eax
add    $0x20000,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @test_1(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [32768 x i32]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %8
store i32 0, i32* %9
br label %12
12: ; preds = %20, %3
%13 = load i32, i32* %9
%14 = icmp slt i32 %13, 32768
br i1 %14, label %15, label %23
15: ; preds = %12
%16 = call i32 (...) @coord()
%17 = load i32, i32* %9
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [32768 x i32], [32768 x i32]* %7, i64 0, i64 %18
store i32 %16, i32* %19
br label %20
20: ; preds = %15
%21 = load i32, i32* %9
%22 = add nsw i32 %21, 1
store i32 %22, i32* %9
br label %12
23: ; preds = %12
%24 = getelementptr inbounds [32768 x i32], [32768 x i32]* %7, i64 0, i64 0
%25 = load i32, i32* %4
%26 = call i32 @check(i32* %24, i32 32768, i32 %25, i32 1, i32 1)
%27 = load i32, i32* %8
%28 = or i32 %27, %26
store i32 %28, i32* %8
store i32 0, i32* %10
br label %29
29: ; preds = %37, %23
%30 = load i32, i32* %10
%31 = icmp slt i32 %30, 32768
br i1 %31, label %32, label %40
32: ; preds = %29
%33 = call i32 (...) @coord()
%34 = load i32, i32* %10
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [32768 x i32], [32768 x i32]* %7, i64 0, i64 %35
store i32 %33, i32* %36
br label %37
37: ; preds = %32
%38 = load i32, i32* %10
%39 = add nsw i32 %38, 1
store i32 %39, i32* %10
br label %29
40: ; preds = %29
%41 = getelementptr inbounds [32768 x i32], [32768 x i32]* %7, i64 0, i64 0
%42 = load i32, i32* %5
%43 = call i32 @check(i32* %41, i32 32768, i32 1, i32 %42, i32 1)
%44 = load i32, i32* %8
%45 = or i32 %44, %43
store i32 %45, i32* %8
store i32 0, i32* %11
br label %46
46: ; preds = %54, %40
%47 = load i32, i32* %11
%48 = icmp slt i32 %47, 32768
br i1 %48, label %49, label %57
49: ; preds = %46
%50 = call i32 (...) @coord()
%51 = load i32, i32* %11
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [32768 x i32], [32768 x i32]* %7, i64 0, i64 %52
store i32 %50, i32* %53
br label %54
54: ; preds = %49
%55 = load i32, i32* %11
%56 = add nsw i32 %55, 1
store i32 %56, i32* %11
br label %46
57: ; preds = %46
%58 = getelementptr inbounds [32768 x i32], [32768 x i32]* %7, i64 0, i64 0
%59 = load i32, i32* %6
%60 = call i32 @check(i32* %58, i32 32768, i32 1, i32 1, i32 %59)
%61 = load i32, i32* %8
%62 = or i32 %61, %60
store i32 %62, i32* %8
%63 = load i32, i32* %8
ret i32 %63
}

LLVM IR (-O2):
define i32 @test_1(i32 %0, i32 %1, i32 %2) {
%4 = alloca [32768 x i32]
%5 = bitcast [32768 x i32]* %4 to i8*
br label %9
6: ; preds = %9
%7 = getelementptr inbounds [32768 x i32], [32768 x i32]* %4, i64 0, i64 0
%8 = call i32 @check(i32* %7, i32 32768, i32 %0, i32 1, i32 1)
br label %17
9: ; preds = %3, %9
%10 = phi i64 [ 0, %3 ], [ %13, %9 ]
%11 = tail call i32 (...) @coord()
%12 = getelementptr inbounds [32768 x i32], [32768 x i32]* %4, i64 0, i64 %10
store i32 %11, i32* %12
%13 = add nuw nsw i64 %10, 1
%14 = icmp eq i64 %13, 32768
br i1 %14, label %6, label %9
15: ; preds = %17
%16 = call i32 @check(i32* %7, i32 32768, i32 1, i32 %1, i32 1)
br label %27
17: ; preds = %6, %17
%18 = phi i64 [ 0, %6 ], [ %21, %17 ]
%19 = call i32 (...) @coord()
%20 = getelementptr inbounds [32768 x i32], [32768 x i32]* %4, i64 0, i64 %18
store i32 %19, i32* %20
%21 = add nuw nsw i64 %18, 1
%22 = icmp eq i64 %21, 32768
br i1 %22, label %15, label %17
23: ; preds = %27
%24 = or i32 %16, %8
%25 = call i32 @check(i32* %7, i32 32768, i32 1, i32 1, i32 %2)
%26 = or i32 %24, %25
ret i32 %26
27: ; preds = %15, %27
%28 = phi i64 [ 0, %15 ], [ %31, %27 ]
%29 = call i32 (...) @coord()
%30 = getelementptr inbounds [32768 x i32], [32768 x i32]* %4, i64 0, i64 %28
store i32 %29, i32* %30
%31 = add nuw nsw i64 %28, 1
%32 = icmp eq i64 %31, 32768
br i1 %32, label %23, label %27
}