#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 */
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ memset(int *, int /*<<< orphan*/, int);
int omp_get_max_threads();
int /*<<< orphan*/ omp_set_dynamic(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
main() {
  int thds;
  int buf[3];
  thds = omp_get_max_threads();
  if (thds == 1) {
    printf("should be run this program on multi threads.\n");
    exit(0);
  }
  omp_set_dynamic(0);
  memset(buf, 0, sizeof(buf));
#pragma omp parallel sections
  {
    {
#pragma omp section
      buf[0] += 1;
      buf[1] += 2;
#pragma omp section
      buf[2] += 3;
    }
  }
  printf("err_parallel_sections 003 : FAILED, can not compile this program.\n");
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <omp_get_max_threads@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1186 <main+0x36>
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>
xor    %edi,%edi
call   1050 <omp_set_dynamic@plt>
lea    -0x14(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1040 <memset@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0xc(%rbp)
lea    0xe6f(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
xor    %eax,%eax
call   1060 <omp_get_max_threads@plt>
cmp    $0x1,%eax
je     119d <main+0x4d>
xor    %edi,%edi
call   1050 <omp_set_dynamic@plt>
lea    0xc(%rsp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1040 <memset@plt>
addl   $0x1,0xc(%rsp)
addl   $0x2,0x10(%rsp)
addl   $0x3,0x14(%rsp)
lea    0xe72(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
add    $0x18,%rsp
ret
lea    0xe9e(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [46 x i8] c"should be run this program on multi threads.\0A\00"
@.str.1 = [67 x i8] c"err_parallel_sections 003 : FAILED, can not compile this program.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [3 x i32]
store i32 0, i32* %1
%4 = call i32 (...) @omp_get_max_threads()
store i32 %4, i32* %2
%5 = load i32, i32* %2
%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)
%12 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%13 = call i32 @memset(i32* %12, i32 0, i32 12)
%14 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%15 = load i32, i32* %14
%16 = add nsw i32 %15, 1
store i32 %16, i32* %14
%17 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 1
%18 = load i32, i32* %17
%19 = add nsw i32 %18, 2
store i32 %19, i32* %17
%20 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 2
%21 = load i32, i32* %20
%22 = add nsw i32 %21, 3
store i32 %22, i32* %20
%23 = call i32 @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.1, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
@str = [66 x i8] c"err_parallel_sections 003 : 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 = alloca [3 x i32]
%2 = bitcast [3 x i32]* %1 to i8*
%3 = tail call i32 (...) @omp_get_max_threads()
%4 = icmp eq i32 %3, 1
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.2, i64 0, i64 0))
%7 = tail call i32 @exit(i32 0)
unreachable
8: ; preds = %0
%9 = tail call i32 @omp_set_dynamic(i32 0)
%10 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%11 = call i32 @memset(i32* %10, i32 0, i32 12)
%12 = load i32, i32* %10
%13 = add nsw i32 %12, 1
store i32 %13, i32* %10
%14 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 1
%15 = load i32, i32* %14
%16 = add nsw i32 %15, 2
store i32 %16, i32* %14
%17 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 2
%18 = load i32, i32* %17
%19 = add nsw i32 %18, 3
store i32 %19, i32* %17
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @str, i64 0, i64 0))
ret i32 1
}