#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_procs();
int omp_get_num_threads();
scalar_t__ omp_get_thread_num();
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i;
#pragma omp parallel for
  for (i = 0; i <= 15; i++) {
    if (omp_get_thread_num() == 0) {
      printf("%d\n", omp_get_num_procs());
      printf("%d\n", omp_get_num_threads());
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xf,-0x8(%rbp)
jg     11ae <main+0x6e>
mov    $0x0,%al
call   1030 <omp_get_thread_num@plt>
cmp    $0x0,%rax
jne    119b <main+0x5b>
mov    $0x0,%al
call   1060 <omp_get_num_procs@plt>
mov    %eax,%esi
lea    0xe7f(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <omp_get_num_threads@plt>
mov    %eax,%esi
lea    0xe6a(%rip),%rdi
call   1040 <printf@plt>
jmp    11a0 <main+0x60>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1156 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0x10,%ebp
lea    0xeb1(%rip),%rbx
jmp    1165 <main+0x25>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0xffffffff,%ebp
je     1195 <main+0x55>
xor    %eax,%eax
call   1030 <omp_get_thread_num@plt>
test   %rax,%rax
jne    1160 <main+0x20>
xor    %eax,%eax
call   1060 <omp_get_num_procs@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <omp_get_num_threads@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
jmp    1160 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %15, %0
%4 = load i32, i32* %2
%5 = icmp sle i32 %4, 15
br i1 %5, label %6, label %18
6: ; preds = %3
%7 = call i64 (...) @omp_get_thread_num()
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %6
%10 = call i32 (...) @omp_get_num_procs()
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = call i32 (...) @omp_get_num_threads()
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %9, %6
br label %15
15: ; preds = %14
%16 = load i32, i32* %2
%17 = add nsw i32 %16, 1
store i32 %17, i32* %2
br label %3
18: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %10
%2 = phi i32 [ 0, %0 ], [ %11, %10 ]
%3 = tail call i64 (...) @omp_get_thread_num()
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %1
%6 = tail call i32 (...) @omp_get_num_procs()
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = tail call i32 (...) @omp_get_num_threads()
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
br label %10
10: ; preds = %1, %5
%11 = add nuw nsw i32 %2, 1
%12 = icmp eq i32 %11, 16
br i1 %12, label %13, label %1
13: ; preds = %10
ret i32 0
}