#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*/ check(unsigned int *);
int /*<<< orphan*/ init(unsigned int *, unsigned int *);
int main(void) {
  unsigned results[1000];
  unsigned pData[1000];
  unsigned coeff = 2;
  init(&results[0], &pData[0]);
#pragma omp parallel for
  for (int idx = 0; idx < (int)1000; idx++)
    results[idx] = coeff * pData[idx];
  check(&results[0]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1f60,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2,-0x1f54(%rbp)
lea    -0xfb0(%rbp),%rdi
lea    -0x1f50(%rbp),%rsi
call   1030 <init@plt>
movl   $0x0,-0x1f58(%rbp)
cmpl   $0x3e8,-0x1f58(%rbp)
jge    11a0 <main+0x80>
mov    -0x1f54(%rbp),%ecx
movslq -0x1f58(%rbp),%rax
imul   -0x1f50(%rbp,%rax,4),%ecx
ff
movslq -0x1f58(%rbp),%rax
mov    %ecx,-0xfb0(%rbp,%rax,4)
mov    -0x1f58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1f58(%rbp)
jmp    1159 <main+0x39>
lea    -0xfb0(%rbp),%rdi
call   1040 <check@plt>
xor    %eax,%eax
add    $0x1f60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x1f48,%rsp
mov    %rsp,%rdi
lea    0xfa0(%rsp),%rsi
call   1030 <init@plt>
mov    $0xc,%eax
nopl   0x0(%rax)
movdqa 0xf70(%rsp,%rax,4),%xmm0
movdqa 0xf80(%rsp,%rax,4),%xmm1
paddd  %xmm0,%xmm0
paddd  %xmm1,%xmm1
movdqa %xmm0,-0x30(%rsp,%rax,4)
movdqa %xmm1,-0x20(%rsp,%rax,4)
cmp    $0x3ec,%rax
je     1199 <main+0x79>
movdqa 0xf90(%rsp,%rax,4),%xmm0
movdqa 0xfa0(%rsp,%rax,4),%xmm1
paddd  %xmm0,%xmm0
paddd  %xmm1,%xmm1
movdqa %xmm0,-0x10(%rsp,%rax,4)
movdqa %xmm1,(%rsp,%rax,4)
add    $0x10,%rax
jmp    1140 <main+0x20>
mov    %rsp,%rdi
call   1040 <check@plt>
xor    %eax,%eax
add    $0x1f48,%rsp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [1000 x i32]
%3 = alloca [1000 x i32]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 2, i32* %4
%6 = getelementptr inbounds [1000 x i32], [1000 x i32]* %2, i64 0, i64 0
%7 = getelementptr inbounds [1000 x i32], [1000 x i32]* %3, i64 0, i64 0
%8 = call i32 @init(i32* %6, i32* %7)
store i32 0, i32* %5
br label %9
9: ; preds = %22, %0
%10 = load i32, i32* %5
%11 = icmp slt i32 %10, 1000
br i1 %11, label %12, label %25
12: ; preds = %9
%13 = load i32, i32* %4
%14 = load i32, i32* %5
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [1000 x i32], [1000 x i32]* %3, i64 0, i64 %15
%17 = load i32, i32* %16
%18 = mul i32 %13, %17
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [1000 x i32], [1000 x i32]* %2, i64 0, i64 %20
store i32 %18, i32* %21
br label %22
22: ; preds = %12
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
store i32 %24, i32* %5
br label %9
25: ; preds = %9
%26 = getelementptr inbounds [1000 x i32], [1000 x i32]* %2, i64 0, i64 0
%27 = call i32 @check(i32* %26)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [1000 x i32]
%2 = alloca [1000 x i32]
%3 = bitcast [1000 x i32]* %1 to i8*
%4 = bitcast [1000 x i32]* %2 to i8*
%5 = getelementptr inbounds [1000 x i32], [1000 x i32]* %1, i64 0, i64 0
%6 = getelementptr inbounds [1000 x i32], [1000 x i32]* %2, i64 0, i64 0
%7 = call i32 @init(i32* %5, i32* %6)
br label %8
8: ; preds = %24, %0
%9 = phi i64 [ 0, %0 ], [ %37, %24 ]
%10 = getelementptr inbounds [1000 x i32], [1000 x i32]* %2, i64 0, i64 %9
%11 = bitcast i32* %10 to <4 x i32>*
%12 = load <4 x i32>, <4 x i32>* %11
%13 = getelementptr inbounds i32, i32* %10, i64 4
%14 = bitcast i32* %13 to <4 x i32>*
%15 = load <4 x i32>, <4 x i32>* %14
%16 = shl <4 x i32> %12, <i32 1, i32 1, i32 1, i32 1>
%17 = shl <4 x i32> %15, <i32 1, i32 1, i32 1, i32 1>
%18 = getelementptr inbounds [1000 x i32], [1000 x i32]* %1, i64 0, i64 %9
%19 = bitcast i32* %18 to <4 x i32>*
store <4 x i32> %16, <4 x i32>* %19
%20 = getelementptr inbounds i32, i32* %18, i64 4
%21 = bitcast i32* %20 to <4 x i32>*
store <4 x i32> %17, <4 x i32>* %21
%22 = or i64 %9, 8
%23 = icmp eq i64 %22, 1000
br i1 %23, label %38, label %24
24: ; preds = %8
%25 = getelementptr inbounds [1000 x i32], [1000 x i32]* %2, i64 0, i64 %22
%26 = bitcast i32* %25 to <4 x i32>*
%27 = load <4 x i32>, <4 x i32>* %26
%28 = getelementptr inbounds i32, i32* %25, i64 4
%29 = bitcast i32* %28 to <4 x i32>*
%30 = load <4 x i32>, <4 x i32>* %29
%31 = shl <4 x i32> %27, <i32 1, i32 1, i32 1, i32 1>
%32 = shl <4 x i32> %30, <i32 1, i32 1, i32 1, i32 1>
%33 = getelementptr inbounds [1000 x i32], [1000 x i32]* %1, i64 0, i64 %22
%34 = bitcast i32* %33 to <4 x i32>*
store <4 x i32> %31, <4 x i32>* %34
%35 = getelementptr inbounds i32, i32* %33, i64 4
%36 = bitcast i32* %35 to <4 x i32>*
store <4 x i32> %32, <4 x i32>* %36
%37 = add nuw nsw i64 %9, 16
br label %8
38: ; preds = %8
%39 = call i32 @check(i32* %5)
ret i32 0
}