#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);
int main() {
  int numberOfThreads, threadID;
#pragma omp parallel private(threadID)
  {
#pragma omp sections
    {
#pragma omp section
      {
        threadID = omp_get_thread_num();
        numberOfThreads = omp_get_num_threads();
        printf("Thread %d of %d calculates section 1\n", threadID,
               numberOfThreads);
      }
#pragma omp section
      {
        threadID = omp_get_thread_num();
        numberOfThreads = omp_get_num_threads();
        printf("Thread %d of %d calculates section 2\n", threadID,
               numberOfThreads);
      }
#pragma omp section
      {
        threadID = omp_get_thread_num();
        numberOfThreads = omp_get_num_threads();
        printf("Thread %d of %d calculates section 3\n", threadID,
               numberOfThreads);
      }
#pragma omp section
      {
        threadID = omp_get_thread_num();
        numberOfThreads = omp_get_num_threads();
        printf("Thread %d of %d calculates section 4\n", threadID,
               numberOfThreads);
      }
    }
  }
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <omp_get_thread_num@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <omp_get_num_threads@plt>
lea    0xeb8(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <omp_get_thread_num@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <omp_get_num_threads@plt>
lea    0xebe(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <omp_get_thread_num@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <omp_get_num_threads@plt>
lea    0xec4(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <omp_get_thread_num@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <omp_get_num_threads@plt>
lea    0xeca(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [38 x i8] c"Thread %d of %d calculates section 1\0A\00"
@.str.1 = [38 x i8] c"Thread %d of %d calculates section 2\0A\00"
@.str.2 = [38 x i8] c"Thread %d of %d calculates section 3\0A\00"
@.str.3 = [38 x i8] c"Thread %d of %d calculates section 4\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (...) @omp_get_thread_num()
store i32 %4, i32* %3
%5 = call i32 (...) @omp_get_num_threads()
store i32 %5, i32* %2
%6 = load i32, i32* %3
%7 = load i32, i32* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
%9 = call i32 (...) @omp_get_thread_num()
store i32 %9, i32* %3
%10 = call i32 (...) @omp_get_num_threads()
store i32 %10, i32* %2
%11 = load i32, i32* %3
%12 = load i32, i32* %2
%13 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 %11, i32 %12)
%14 = call i32 (...) @omp_get_thread_num()
store i32 %14, i32* %3
%15 = call i32 (...) @omp_get_num_threads()
store i32 %15, i32* %2
%16 = load i32, i32* %3
%17 = load i32, i32* %2
%18 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 %16, i32 %17)
%19 = call i32 (...) @omp_get_thread_num()
store i32 %19, i32* %3
%20 = call i32 (...) @omp_get_num_threads()
store i32 %20, i32* %2
%21 = load i32, i32* %3
%22 = load i32, i32* %2
%23 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i32 %21, i32 %22)
ret i32 0
}

LLVM IR (-O2):
@.str = [38 x i8] c"Thread %d of %d calculates section 1\0A\00"
@.str.1 = [38 x i8] c"Thread %d of %d calculates section 2\0A\00"
@.str.2 = [38 x i8] c"Thread %d of %d calculates section 3\0A\00"
@.str.3 = [38 x i8] c"Thread %d of %d calculates section 4\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @omp_get_thread_num()
%2 = tail call i32 (...) @omp_get_num_threads()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
%4 = tail call i32 (...) @omp_get_thread_num()
%5 = tail call i32 (...) @omp_get_num_threads()
%6 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 %4, i32 %5)
%7 = tail call i32 (...) @omp_get_thread_num()
%8 = tail call i32 (...) @omp_get_num_threads()
%9 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 %8)
%10 = tail call i32 (...) @omp_get_thread_num()
%11 = tail call i32 (...) @omp_get_num_threads()
%12 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i32 %10, i32 %11)
ret i32 0
}