#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 atoi(char *);
int omp_get_thread_num();
scalar_t__ omp_quiesce();
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  int nthreads = 4;
  if (argc >= 2)
    nthreads = (atoi(argv[1]));
#pragma omp parallel num_threads(nthreads)
  { int tid = omp_get_thread_num(); }
  if (omp_quiesce() == 0) {
    printf("omp_quiesce() return successfully\n");
  };
#pragma omp parallel num_threads(nthreads)
  { int tid = omp_get_thread_num(); }
  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   $0x4,-0x14(%rbp)
cmpl   $0x2,-0x8(%rbp)
jl     1177 <main+0x37>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1030 <omp_get_thread_num@plt>
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1060 <omp_quiesce@plt>
cmp    $0x0,%rax
jne    119e <main+0x5e>
lea    0xe67(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <omp_get_thread_num@plt>
mov    %eax,-0x1c(%rbp)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <omp_get_thread_num@plt>
xor    %eax,%eax
call   1050 <omp_quiesce@plt>
test   %rax,%rax
jne    1150 <main+0x20>
lea    0xeb5(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <omp_get_thread_num@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [35 x i8] c"omp_quiesce() return successfully\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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 4, i32* %6
%9 = load i32, i32* %4
%10 = icmp sge i32 %9, 2
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @atoi(i8* %14)
store i32 %15, i32* %6
br label %16
16: ; preds = %11, %2
%17 = call i32 (...) @omp_get_thread_num()
store i32 %17, i32* %7
%18 = call i64 (...) @omp_quiesce()
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
br label %22
22: ; preds = %20, %16
%23 = call i32 (...) @omp_get_thread_num()
store i32 %23, i32* %8
ret i32 0
}

LLVM IR (-O2):
@str = [34 x i8] c"omp_quiesce() return successfully\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @omp_get_thread_num()
%4 = tail call i64 (...) @omp_quiesce()
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
br label %8
8: ; preds = %6, %2
%9 = tail call i32 (...) @omp_get_thread_num()
ret i32 0
}