#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 /*<<< orphan*/ exit(int /*<<< orphan*/);
int omp_get_max_threads();
int /*<<< orphan*/ omp_set_dynamic(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
main() {
  int lp, thds;
  thds = omp_get_max_threads();
  if (thds == 1) {
    printf("should be run this program on multi threads.\n");
    exit(0);
  }
  omp_set_dynamic(0);
#pragma omp parallel for nowait
  for (lp = 0; lp < thds; lp++) {
  }
  printf("err_parallel_for 020 : FAILED, can not compile this program.\n");
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <omp_get_max_threads@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    1176 <main+0x36>
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>
xor    %edi,%edi
call   1040 <omp_set_dynamic@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11a3 <main+0x63>
jmp    1195 <main+0x55>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1184 <main+0x44>
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <omp_get_max_threads@plt>
cmp    $0x1,%eax
je     1167 <main+0x27>
xor    %edi,%edi
call   1040 <omp_set_dynamic@plt>
lea    0xea5(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
pop    %rcx
ret
lea    0xecf(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [46 x i8] c"should be run this program on multi threads.\0A\00"
@.str.1 = [62 x i8] c"err_parallel_for 020 : FAILED, can not compile this program.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (...) @omp_get_max_threads()
store i32 %4, i32* %3
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @exit(i32 0)
unreachable
10: ; preds = %0
%11 = call i32 @omp_set_dynamic(i32 0)
store i32 0, i32* %2
br label %12
12: ; preds = %17, %10
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %20
16: ; preds = %12
br label %17
17: ; preds = %16
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 1
store i32 %19, i32* %2
br label %12
20: ; preds = %12
%21 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
@str = [61 x i8] c"err_parallel_for 020 : FAILED, can not compile this program.\00"
@str.2 = [45 x i8] c"should be run this program on multi threads.\00"
define i32 @main() {
%1 = tail call i32 (...) @omp_get_max_threads()
%2 = icmp eq i32 %1, 1
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.2, i64 0, i64 0))
%5 = tail call i32 @exit(i32 0)
unreachable
6: ; preds = %0
%7 = tail call i32 @omp_set_dynamic(i32 0)
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @str, i64 0, i64 0))
ret i32 1
}