#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_num_threads();
int omp_get_thread_num();
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  int numThreads, tid;
  int a, b;
#pragma omp parallel
  {
    a = 1;
    b = 3;
    a = 6;
    b = 8;
  }
  tid = omp_get_thread_num();
  tid = omp_get_thread_num();
#pragma omp parallel private(numThreads, tid)
  {
    tid = omp_get_thread_num();
    printf("Hello World from thread number %d\n", tid);
    if (tid == 0) {
      numThreads = omp_get_num_threads();
      printf("Number of threads is %d\n", numThreads);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x1c(%rbp)
movl   $0x3,-0x20(%rbp)
movl   $0x6,-0x1c(%rbp)
movl   $0x8,-0x20(%rbp)
mov    $0x0,%al
call   1030 <omp_get_thread_num@plt>
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <omp_get_thread_num@plt>
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <omp_get_thread_num@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe76(%rip),%rdi
call   1040 <printf@plt>
cmpl   $0x0,-0x18(%rbp)
jne    11b2 <main+0x82>
mov    $0x0,%al
call   1050 <omp_get_num_threads@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe76(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <omp_get_thread_num@plt>
xor    %eax,%eax
call   1030 <omp_get_thread_num@plt>
xor    %eax,%eax
call   1030 <omp_get_thread_num@plt>
mov    %eax,%ebx
lea    0xeb1(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
test   %ebx,%ebx
jne    116f <main+0x3f>
xor    %eax,%eax
call   1050 <omp_get_num_threads@plt>
lea    0xebb(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [35 x i8] c"Hello World from thread number %d\0A\00"
@.str.1 = [25 x i8] c"Number of threads is %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %8
store i32 3, i32* %9
store i32 6, i32* %8
store i32 8, i32* %9
%10 = call i32 (...) @omp_get_thread_num()
store i32 %10, i32* %7
%11 = call i32 (...) @omp_get_thread_num()
store i32 %11, i32* %7
%12 = call i32 (...) @omp_get_thread_num()
store i32 %12, i32* %7
%13 = load i32, i32* %7
%14 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = load i32, i32* %7
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %2
%18 = call i32 (...) @omp_get_num_threads()
store i32 %18, i32* %6
%19 = load i32, i32* %6
%20 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %19)
br label %21
21: ; preds = %17, %2
ret i32 0
}

LLVM IR (-O2):
@.str = [35 x i8] c"Hello World from thread number %d\0A\00"
@.str.1 = [25 x i8] c"Number of threads is %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @omp_get_thread_num()
%4 = tail call i32 (...) @omp_get_thread_num()
%5 = tail call i32 (...) @omp_get_thread_num()
%6 = tail call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = icmp eq i32 %5, 0
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = tail call i32 (...) @omp_get_num_threads()
%10 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %9)
br label %11
11: ; preds = %8, %2
ret i32 0
}