#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 /*<<< orphan*/, int);
int /*<<< orphan*/ clear(int *, int);
int place();
int gang_vector_2a(int *ary, int size) {
  if (size % 256)
    return 1;
  clear(ary, size);
#pragma acc parallel vector_length(32) num_gangs(32) copy(ary [0:size])        \
    firstprivate(size)
  {
#pragma acc loop tile(64, 64) gang vector
    for (int jx = 0; jx < size / 256; jx++)
      for (int ix = 0; ix < 256; ix++)
        ary[jx * 256 + ix] = place();
  }
  return check(ary, size, 1, 0, 1);
}


x86 assembly (clang, -O0):
<gang_vector_2a>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     115f <gang_vector_2a+0x2f>
movl   $0x1,-0x4(%rbp)
jmp    11fb <gang_vector_2a+0xcb>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <clear@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
cmp    %ecx,%eax
jge    11e1 <gang_vector_2a+0xb1>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x100,-0x1c(%rbp)
jge    11ce <gang_vector_2a+0x9e>
mov    $0x0,%al
call   1030 <place@plt>
mov    %eax,%edx
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
shl    $0x8,%ecx
add    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1197 <gang_vector_2a+0x67>
jmp    11d3 <gang_vector_2a+0xa3>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1172 <gang_vector_2a+0x42>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    $0x1,%r8d
xor    %ecx,%ecx
mov    %r8d,%edx
call   1040 <check@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gang_vector_2a>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r15d
test   %r15b,%r15b
je     1157 <gang_vector_2a+0x27>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rdi,%r14
mov    %r15d,%esi
call   1050 <clear@plt>
cmp    $0x100,%r15d
jl     11b8 <gang_vector_2a+0x88>
mov    %r15d,%r12d
shr    $0x8,%r12d
mov    %r14,%rbp
xor    %r13d,%r13d
nopl   0x0(%rax,%rax,1)
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <place@plt>
mov    %eax,0x0(%rbp,%rbx,4)
add    $0x1,%rbx
cmp    $0x100,%rbx
jne    1190 <gang_vector_2a+0x60>
add    $0x1,%r13
add    $0x400,%rbp
cmp    %r12,%r13
jne    1180 <gang_vector_2a+0x50>
mov    %r14,%rdi
mov    %r15d,%esi
mov    $0x1,%edx
xor    %ecx,%ecx
mov    $0x1,%r8d
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <check@plt>

LLVM IR (-O0):
define i32 @gang_vector_2a(i32* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
%8 = load i32, i32* %5
%9 = srem i32 %8, 256
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 1, i32* %3
br label %45
12: ; preds = %2
%13 = load i32*, i32** %4
%14 = load i32, i32* %5
%15 = call i32 @clear(i32* %13, i32 %14)
store i32 0, i32* %6
br label %16
16: ; preds = %38, %12
%17 = load i32, i32* %6
%18 = load i32, i32* %5
%19 = sdiv i32 %18, 256
%20 = icmp slt i32 %17, %19
br i1 %20, label %21, label %41
21: ; preds = %16
store i32 0, i32* %7
br label %22
22: ; preds = %34, %21
%23 = load i32, i32* %7
%24 = icmp slt i32 %23, 256
br i1 %24, label %25, label %37
25: ; preds = %22
%26 = call i32 (...) @place()
%27 = load i32*, i32** %4
%28 = load i32, i32* %6
%29 = mul nsw i32 %28, 256
%30 = load i32, i32* %7
%31 = add nsw i32 %29, %30
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i32, i32* %27, i64 %32
store i32 %26, i32* %33
br label %34
34: ; preds = %25
%35 = load i32, i32* %7
%36 = add nsw i32 %35, 1
store i32 %36, i32* %7
br label %22
37: ; preds = %22
br label %38
38: ; preds = %37
%39 = load i32, i32* %6
%40 = add nsw i32 %39, 1
store i32 %40, i32* %6
br label %16
41: ; preds = %16
%42 = load i32*, i32** %4
%43 = load i32, i32* %5
%44 = call i32 @check(i32* %42, i32 %43, i32 1, i32 0, i32 1)
store i32 %44, i32* %3
br label %45
45: ; preds = %41, %11
%46 = load i32, i32* %3
ret i32 %46
}

LLVM IR (-O2):
define i32 @gang_vector_2a(i32* %0, i32 %1) {
%3 = and i32 %1, 255
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %26
5: ; preds = %2
%6 = tail call i32 @clear(i32* %0, i32 %1)
%7 = icmp sgt i32 %1, 255
br i1 %7, label %8, label %14
8: ; preds = %5
%9 = lshr i32 %1, 8
%10 = zext i32 %9 to i64
br label %11
11: ; preds = %8, %16
%12 = phi i64 [ 0, %8 ], [ %17, %16 ]
%13 = shl nsw i64 %12, 8
br label %19
14: ; preds = %16, %5
%15 = tail call i32 @check(i32* %0, i32 %1, i32 1, i32 0, i32 1)
br label %26
16: ; preds = %19
%17 = add nuw nsw i64 %12, 1
%18 = icmp eq i64 %17, %10
br i1 %18, label %14, label %11
19: ; preds = %11, %19
%20 = phi i64 [ 0, %11 ], [ %24, %19 ]
%21 = tail call i32 (...) @place()
%22 = add nuw nsw i64 %20, %13
%23 = getelementptr inbounds i32, i32* %0, i64 %22
store i32 %21, i32* %23
%24 = add nuw nsw i64 %20, 1
%25 = icmp eq i64 %24, 256
br i1 %25, label %16, label %19
26: ; preds = %2, %14
%27 = phi i32 [ %15, %14 ], [ 1, %2 ]
ret i32 %27
}