#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_max_threads();
int omp_get_thread_num();
int /*<<< orphan*/ printf(char *, int, int, ...);
int main(int argc, char **argv) {
  int i = 0;
  int n = 0;
#pragma omp parallel shared(n) private(i)
  {
#pragma omp for
    for (i = 0; i < n; i++) {
      printf("Thread %d of %d - Iteration %d\n", omp_get_thread_num(),
             omp_get_max_threads(), i);
    }
#pragma omp single
    {
      printf("Thread %d of %d - Running Single Construct\n",
             omp_get_thread_num(), omp_get_max_threads());
    }
  }
  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   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    119c <main+0x6c>
mov    $0x0,%al
call   1030 <omp_get_thread_num@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1050 <omp_get_max_threads@plt>
mov    -0x1c(%rbp),%esi
mov    %eax,%edx
mov    -0x14(%rbp),%ecx
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115b <main+0x2b>
mov    $0x0,%al
call   1030 <omp_get_thread_num@plt>
mov    %eax,-0x20(%rbp)
mov    $0x0,%al
call   1050 <omp_get_max_threads@plt>
mov    -0x20(%rbp),%esi
mov    %eax,%edx
lea    0xe67(%rip),%rdi
mov    $0x0,%al
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>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <omp_get_max_threads@plt>
lea    0xeb8(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Thread %d of %d - Iteration %d\0A\00"
@.str.1 = [44 x i8] c"Thread %d of %d - Running Single Construct\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %6
br label %8
8: ; preds = %17, %2
%9 = load i32, i32* %6
%10 = load i32, i32* %7
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %20
12: ; preds = %8
%13 = call i32 (...) @omp_get_thread_num()
%14 = call i32 (...) @omp_get_max_threads()
%15 = load i32, i32* %6
%16 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %14, i32 %15)
br label %17
17: ; preds = %12
%18 = load i32, i32* %6
%19 = add nsw i32 %18, 1
store i32 %19, i32* %6
br label %8
20: ; preds = %8
%21 = call i32 (...) @omp_get_thread_num()
%22 = call i32 (...) @omp_get_max_threads()
%23 = call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), i32 %21, i32 %22)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [44 x i8] c"Thread %d of %d - Running Single Construct\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_max_threads()
%5 = tail call i32 (i8*, i32, i32, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), i32 %3, i32 %4)
ret i32 0
}