#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*/ test_omp_taskloop_num_tasks();
int main() {
  int i;
  int num_failed = 0;
  for (i = 0; i < 10; i++) {
    if (!test_omp_taskloop_num_tasks()) {
      num_failed++;
    }
  }
  return num_failed;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1163 <main+0x53>
mov    $0x0,%al
call   1030 <test_omp_taskloop_num_tasks@plt>
cmp    $0x0,%eax
jne    1150 <main+0x40>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1155 <main+0x45>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112d <main+0x1d>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
xor    %eax,%eax
call   1030 <test_omp_taskloop_num_tasks@plt>
mov    %eax,(%rsp)
xor    %eax,%eax
call   1030 <test_omp_taskloop_num_tasks@plt>
mov    %eax,%r15d
xor    %eax,%eax
call   1030 <test_omp_taskloop_num_tasks@plt>
mov    %eax,%r12d
xor    %eax,%eax
call   1030 <test_omp_taskloop_num_tasks@plt>
mov    %eax,%r13d
xor    %eax,%eax
call   1030 <test_omp_taskloop_num_tasks@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <test_omp_taskloop_num_tasks@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1030 <test_omp_taskloop_num_tasks@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1030 <test_omp_taskloop_num_tasks@plt>
movd   %ebx,%xmm2
movd   %ebp,%xmm0
punpckldq %xmm0,%xmm2
movd   %r14d,%xmm0
movd   %eax,%xmm1
punpckldq %xmm1,%xmm0
punpcklqdq %xmm0,%xmm2
movdqa %xmm2,0x10(%rsp)
movd   (%rsp),%xmm2
movd   %r15d,%xmm0
punpckldq %xmm0,%xmm2
movd   %r12d,%xmm0
movd   %r13d,%xmm1
punpckldq %xmm1,%xmm0
punpcklqdq %xmm0,%xmm2
movdqa %xmm2,(%rsp)
xor    %eax,%eax
call   1030 <test_omp_taskloop_num_tasks@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <test_omp_taskloop_num_tasks@plt>
movdqa (%rsp),%xmm0
pxor   %xmm2,%xmm2
pcmpeqd %xmm2,%xmm0
movdqa 0x10(%rsp),%xmm1
pcmpeqd %xmm2,%xmm1
packssdw %xmm1,%xmm0
packsswb %xmm0,%xmm0
pmovmskb %xmm0,%ecx
mov    %ecx,%edx
shr    %dl
and    $0x55,%dl
sub    %dl,%cl
mov    %ecx,%edx
and    $0x33,%dl
shr    $0x2,%cl
and    $0x33,%cl
add    %dl,%cl
mov    %ecx,%edx
shr    $0x4,%dl
add    %cl,%dl
and    $0xf,%dl
movzbl %dl,%ecx
cmp    $0x1,%ebx
adc    $0x0,%ecx
cmp    $0x1,%eax
adc    $0x0,%ecx
mov    %ecx,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %2
br label %4
4: ; preds = %14, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 10
br i1 %6, label %7, label %17
7: ; preds = %4
%8 = call i32 (...) @test_omp_taskloop_num_tasks()
%9 = icmp ne i32 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1
store i32 %12, i32* %3
br label %13
13: ; preds = %10, %7
br label %14
14: ; preds = %13
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %4
17: ; preds = %4
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_omp_taskloop_num_tasks()
%2 = tail call i32 (...) @test_omp_taskloop_num_tasks()
%3 = tail call i32 (...) @test_omp_taskloop_num_tasks()
%4 = tail call i32 (...) @test_omp_taskloop_num_tasks()
%5 = tail call i32 (...) @test_omp_taskloop_num_tasks()
%6 = tail call i32 (...) @test_omp_taskloop_num_tasks()
%7 = tail call i32 (...) @test_omp_taskloop_num_tasks()
%8 = tail call i32 (...) @test_omp_taskloop_num_tasks()
%9 = insertelement <8 x i32> poison, i32 %1, i64 0
%10 = insertelement <8 x i32> %9, i32 %2, i64 1
%11 = insertelement <8 x i32> %10, i32 %3, i64 2
%12 = insertelement <8 x i32> %11, i32 %4, i64 3
%13 = insertelement <8 x i32> %12, i32 %5, i64 4
%14 = insertelement <8 x i32> %13, i32 %6, i64 5
%15 = insertelement <8 x i32> %14, i32 %7, i64 6
%16 = insertelement <8 x i32> %15, i32 %8, i64 7
%17 = icmp eq <8 x i32> %16, zeroinitializer
%18 = tail call i32 (...) @test_omp_taskloop_num_tasks()
%19 = icmp eq i32 %18, 0
%20 = zext i1 %19 to i32
%21 = tail call i32 (...) @test_omp_taskloop_num_tasks()
%22 = icmp eq i32 %21, 0
%23 = zext i1 %22 to i32
%24 = bitcast <8 x i1> %17 to i8
%25 = call i8 @llvm.ctpop.i8(i8 %24)
%26 = zext i8 %25 to i32
%27 = add nuw nsw i32 %26, %20
%28 = add nuw nsw i32 %27, %23
ret i32 %28
}