int test_omp_section_private() {
  int sum;
  int sum0;
  int i;
  int known_sum;
  sum = 7;
  sum0 = 0;
#pragma omp parallel
  {
#pragma omp sections private(sum0, i)
    {
#pragma omp section
      {
        sum0 = 0;
        for (i = 1; i < 400; i++)
          sum0 = sum0 + i;
#pragma omp critical
        { sum = sum + sum0; }
      }
#pragma omp section
      {
        sum0 = 0;
        for (i = 400; i < 700; i++)
          sum0 = sum0 + i;
#pragma omp critical
        { sum = sum + sum0; }
      }
#pragma omp section
      {
        sum0 = 0;
        for (i = 700; i < 1000; i++)
          sum0 = sum0 + i;
#pragma omp critical
        { sum = sum + sum0; }
      }
    }
  }
  known_sum = (999 * 1000) / 2 + 7;
  return (known_sum == sum);
}


x86 assembly (clang, -O0):
<test_omp_section_private>:
push   %rbp
mov    %rsp,%rbp
movl   $0x7,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x190,-0xc(%rbp)
jge    1144 <test_omp_section_private+0x44>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1120 <test_omp_section_private+0x20>
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x190,-0xc(%rbp)
cmpl   $0x2bc,-0xc(%rbp)
jge    117f <test_omp_section_private+0x7f>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115b <test_omp_section_private+0x5b>
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x2bc,-0xc(%rbp)
cmpl   $0x3e8,-0xc(%rbp)
jge    11ba <test_omp_section_private+0xba>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1196 <test_omp_section_private+0x96>
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
movl   $0x79f33,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x4(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_omp_section_private>:
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @test_omp_section_private() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 7, i32* %1
store i32 0, i32* %2
store i32 0, i32* %2
store i32 1, i32* %3
br label %5
5: ; preds = %12, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 400
br i1 %7, label %8, label %15
8: ; preds = %5
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = add nsw i32 %9, %10
store i32 %11, i32* %2
br label %12
12: ; preds = %8
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %5
15: ; preds = %5
%16 = load i32, i32* %1
%17 = load i32, i32* %2
%18 = add nsw i32 %16, %17
store i32 %18, i32* %1
store i32 0, i32* %2
store i32 400, i32* %3
br label %19
19: ; preds = %26, %15
%20 = load i32, i32* %3
%21 = icmp slt i32 %20, 700
br i1 %21, label %22, label %29
22: ; preds = %19
%23 = load i32, i32* %2
%24 = load i32, i32* %3
%25 = add nsw i32 %23, %24
store i32 %25, i32* %2
br label %26
26: ; preds = %22
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 1
store i32 %28, i32* %3
br label %19
29: ; preds = %19
%30 = load i32, i32* %1
%31 = load i32, i32* %2
%32 = add nsw i32 %30, %31
store i32 %32, i32* %1
store i32 0, i32* %2
store i32 700, i32* %3
br label %33
33: ; preds = %40, %29
%34 = load i32, i32* %3
%35 = icmp slt i32 %34, 1000
br i1 %35, label %36, label %43
36: ; preds = %33
%37 = load i32, i32* %2
%38 = load i32, i32* %3
%39 = add nsw i32 %37, %38
store i32 %39, i32* %2
br label %40
40: ; preds = %36
%41 = load i32, i32* %3
%42 = add nsw i32 %41, 1
store i32 %42, i32* %3
br label %33
43: ; preds = %33
%44 = load i32, i32* %1
%45 = load i32, i32* %2
%46 = add nsw i32 %44, %45
store i32 %46, i32* %1
store i32 499507, i32* %4
%47 = load i32, i32* %4
%48 = load i32, i32* %1
%49 = icmp eq i32 %47, %48
%50 = zext i1 %49 to i32
ret i32 %50
}

LLVM IR (-O2):
define i32 @test_omp_section_private() {
ret i32 1
}