#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 omp_get_thread_num();
int /*<<< orphan*/ printf(char *, int, ...);
int main() {
  int i, np;
  int x = 1234;
#pragma omp parallel firstprivate(np, i, x)
  {
    np = omp_get_thread_num();
    printf("Soy el thread %d, antes de actualizar, con x=%d \n", np, x);
    x = np * 1111;
    printf("\t\tSoy el thread %d, despues de actualizar, con x=%d \n", np, x);
  }
  printf("\n Despues de pragma parallel x=%d \n\n", x);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x4d2,-0xc(%rbp)
mov    $0x0,%al
call   1030 <omp_get_thread_num@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
imul   $0x457,-0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xef3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <omp_get_thread_num@plt>
mov    %eax,%ebx
lea    0xecd(%rip),%rdi
mov    %eax,%esi
mov    $0x4d2,%edx
xor    %eax,%eax
call   1040 <printf@plt>
imul   $0x457,%ebx,%ebp
lea    0xee4(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf08(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [50 x i8] c"Soy el thread %d, antes de actualizar, con x=%d \0A\00"
@.str.1 = [54 x i8] c"\09\09Soy el thread %d, despues de actualizar, con x=%d \0A\00"
@.str.2 = [37 x i8] c"\0A Despues de pragma parallel x=%d \0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 1234, i32* %3
%4 = call i32 (...) @omp_get_thread_num()
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = load i32, i32* %3
%7 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
%8 = load i32, i32* %2
%9 = mul nsw i32 %8, 1111
store i32 %9, i32* %3
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0), i32 %10, i32 %11)
%13 = load i32, i32* %3
%14 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %13)
ret i32 0
}

LLVM IR (-O2):
@.str = [50 x i8] c"Soy el thread %d, antes de actualizar, con x=%d \0A\00"
@.str.1 = [54 x i8] c"\09\09Soy el thread %d, despues de actualizar, con x=%d \0A\00"
@.str.2 = [37 x i8] c"\0A Despues de pragma parallel x=%d \0A\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @omp_get_thread_num()
%2 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 %1, i32 1234)
%3 = mul nsw i32 %1, 1111
%4 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0), i32 %1, i32 %3)
%5 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i32 %3)
ret i32 0
}