#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*/ printf(char *, ...);
main() {
  int i, n = 7;
  int a[n], suma = 50;
  for (i = 0; i < n; i++)
    a[i] = i;
#pragma omp parallel private(suma)
  {
    suma = 0;
#pragma omp for
    for (i = 0; i < n; i++) {
      suma = suma + a[i];
      printf("thread %d suma a[%d] / ", 0, i);
    }
    printf("\n* thread %d suma= %d", 0, suma);
  }
  printf("\n");
  printf("suma=%d \n", suma);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x7,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
movl   $0x32,-0x24(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1183 <main+0x73>
mov    -0x30(%rbp),%rax
mov    -0x8(%rbp),%edx
movslq -0x8(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    115b <main+0x4b>
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11cf <main+0xbf>
mov    -0x30(%rbp),%rcx
mov    -0x24(%rbp),%eax
movslq -0x8(%rbp),%rdx
add    (%rcx,%rdx,4),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%edx
lea    0xe48(%rip),%rdi
xor    %esi,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1191 <main+0x81>
mov    -0x24(%rbp),%edx
lea    0xe3f(%rip),%rdi
xor    %esi,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x2,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x3,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x4,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x5,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x6,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe75(%rip),%rdi
xor    %esi,%esi
mov    $0x15,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe6c(%rip),%rdi
mov    $0x15,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [24 x i8] c"thread %d suma a[%d] / \00"
@.str.1 = [22 x i8] c"\0A* thread %d suma= %d\00"
@.str.3 = [10 x i8] c"suma=%d \0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 0, i32 0)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 0, i32 1)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 0, i32 2)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 0, i32 3)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 0, i32 4)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 0, i32 5)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 0, i32 6)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 21)
%9 = tail call i32 @putchar(i32 10)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 21)
ret i32 0
}