#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 /*<<< orphan*/, int, int);
int /*<<< orphan*/ clear(int *, int);
int place();
int vector_2(int *ary, int size) {
  clear(ary, size);
#pragma acc parallel num_workers(32) vector_length(32) copy(ary [0:size])      \
    firstprivate(size)
  {
#pragma acc loop worker
    for (int jx = 0; jx < size / 64; jx++)
#pragma acc loop auto
      for (int ix = 0; ix < 64; ix++)
        ary[ix + jx * 64] = place();
  }
  return check(ary, size, 0, 1, 1);
}


x86 assembly (clang, -O0):
<vector_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1050 <clear@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x40,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jge    11c0 <vector_2+0x90>
movl   $0x0,-0x14(%rbp)
cmpl   $0x40,-0x14(%rbp)
jge    11ad <vector_2+0x7d>
mov    $0x0,%al
call   1030 <place@plt>
mov    %eax,%edx
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%esi
shl    $0x6,%esi
add    %esi,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1177 <vector_2+0x47>
jmp    11b2 <vector_2+0x82>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1152 <vector_2+0x22>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
xor    %edx,%edx
mov    $0x1,%r8d
mov    %r8d,%ecx
call   1040 <check@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vector_2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r15d
mov    %rdi,%r14
call   1050 <clear@plt>
cmp    $0x40,%r15d
jl     1195 <vector_2+0x65>
mov    %r15d,%r12d
shr    $0x6,%r12d
mov    %r14,%rbp
xor    %r13d,%r13d
nopl   0x0(%rax)
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    $0x40,%rbx
jne    1170 <vector_2+0x40>
add    $0x1,%r13
add    $0x100,%rbp
cmp    %r12,%r13
jne    1160 <vector_2+0x30>
mov    %r14,%rdi
mov    %r15d,%esi
xor    %edx,%edx
mov    $0x1,%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 @vector_2(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%7 = load i32*, i32** %3
%8 = load i32, i32* %4
%9 = call i32 @clear(i32* %7, i32 %8)
store i32 0, i32* %5
br label %10
10: ; preds = %32, %2
%11 = load i32, i32* %5
%12 = load i32, i32* %4
%13 = sdiv i32 %12, 64
%14 = icmp slt i32 %11, %13
br i1 %14, label %15, label %35
15: ; preds = %10
store i32 0, i32* %6
br label %16
16: ; preds = %28, %15
%17 = load i32, i32* %6
%18 = icmp slt i32 %17, 64
br i1 %18, label %19, label %31
19: ; preds = %16
%20 = call i32 (...) @place()
%21 = load i32*, i32** %3
%22 = load i32, i32* %6
%23 = load i32, i32* %5
%24 = mul nsw i32 %23, 64
%25 = add nsw i32 %22, %24
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %21, i64 %26
store i32 %20, i32* %27
br label %28
28: ; preds = %19
%29 = load i32, i32* %6
%30 = add nsw i32 %29, 1
store i32 %30, i32* %6
br label %16
31: ; preds = %16
br label %32
32: ; preds = %31
%33 = load i32, i32* %5
%34 = add nsw i32 %33, 1
store i32 %34, i32* %5
br label %10
35: ; preds = %10
%36 = load i32*, i32** %3
%37 = load i32, i32* %4
%38 = call i32 @check(i32* %36, i32 %37, i32 0, i32 1, i32 1)
ret i32 %38
}

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