#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 */
scalar_t__ isFibonacci(int);
scalar_t__ isPalindrome(int);
scalar_t__ isPrime(int);
int omp_get_num_procs();
int /*<<< orphan*/ omp_set_dynamic(int /*<<< orphan*/);
int /*<<< orphan*/ omp_set_num_threads(int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, const char *argv[]) {
  omp_set_dynamic(0);
  omp_set_num_threads(omp_get_num_procs());
  int i, j = 0;
#pragma omp parallel
  {
#pragma omp single
    for (i = 1; i <= 1000000; i++) {
      if (isFibonacci(i))
        printf("Fibbits ");
      if (isPalindrome(i))
        printf("BitstiB ");
      if (isPrime(i))
        printf("BitsForEveryone! ");
      if (i % 3 == 0 ? 1 : 0) {
        printf("CrowdOfBits ");
        j += i;
      }
      if (i % 5 == 0 ? 1 : 0) {
        printf("MuchBits ");
        j += i;
      }
    }
  }
  printf("\n%d\n", j);
  printf("Num CPUs: %d\n", omp_get_num_procs());
}


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)
xor    %edi,%edi
call   1050 <omp_set_dynamic@plt>
mov    $0x0,%al
call   1070 <omp_get_num_procs@plt>
mov    %eax,%edi
call   1080 <omp_set_num_threads@plt>
movl   $0x0,-0x18(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0xf4240,-0x14(%rbp)
jg     12bb <main+0x14b>
mov    -0x14(%rbp),%edi
call   1040 <isFibonacci@plt>
cmp    $0x0,%rax
je     11d6 <main+0x66>
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
call   1090 <isPalindrome@plt>
cmp    $0x0,%rax
je     11f6 <main+0x86>
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
call   1060 <isPrime@plt>
cmp    $0x0,%rax
je     1216 <main+0xa6>
lea    0xe03(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1239 <main+0xc9>
mov    $0x1,%al
test   $0x1,%al
jne    1248 <main+0xd8>
jmp    125f <main+0xef>
xor    %eax,%eax
test   $0x1,%al
jne    1248 <main+0xd8>
jmp    125f <main+0xef>
lea    0xdd5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1282 <main+0x112>
mov    $0x1,%al
test   $0x1,%al
jne    1291 <main+0x121>
jmp    12a8 <main+0x138>
xor    %eax,%eax
test   $0x1,%al
jne    1291 <main+0x121>
jmp    12a8 <main+0x138>
lea    0xd99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    12ad <main+0x13d>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11a9 <main+0x39>
mov    -0x18(%rbp),%esi
lea    0xd76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1070 <omp_get_num_procs@plt>
mov    %eax,%esi
lea    0xd64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %edi,%edi
call   1050 <omp_set_dynamic@plt>
xor    %eax,%eax
call   1070 <omp_get_num_procs@plt>
mov    %eax,%edi
call   1080 <omp_set_num_threads@plt>
mov    $0x1,%r12d
xor    %r15d,%r15d
jmp    11b1 <main+0x41>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r12d
cmp    $0xf4241,%r12d
je     1274 <main+0x104>
mov    %r12d,%r14d
mov    %r14,%r13
mov    $0xaaaaaaab,%eax
imul   %rax,%r13
mov    %r12d,%edi
call   1040 <isFibonacci@plt>
test   %rax,%rax
je     11db <main+0x6b>
lea    0xe2c(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0xcccccccd,%eax
imul   %rax,%r14
shr    $0x21,%r13
mov    %r12d,%edi
call   1090 <isPalindrome@plt>
test   %rax,%rax
je     1203 <main+0x93>
lea    0xe0d(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
shr    $0x22,%r14
lea    0x0(%r13,%r13,2),%eax
mov    $0x1,%ebp
sub    %eax,%ebp
mov    %r12d,%edi
call   1060 <isPrime@plt>
test   %rax,%rax
je     122e <main+0xbe>
lea    0xdeb(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    (%r14,%r14,4),%eax
mov    $0x1,%ebx
sub    %eax,%ebx
add    %r12d,%ebp
cmp    $0x1,%ebp
jne    1252 <main+0xe2>
lea    0xddc(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    %r12d,%r15d
add    %r12d,%ebx
cmp    $0x1,%ebx
jne    11a0 <main+0x30>
lea    0xdcc(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    %r12d,%r15d
jmp    11a0 <main+0x30>
lea    0xdc0(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1070 <omp_get_num_procs@plt>
lea    0xdad(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"Fibbits \00"
@.str.1 = [9 x i8] c"BitstiB \00"
@.str.2 = [18 x i8] c"BitsForEveryone! \00"
@.str.3 = [13 x i8] c"CrowdOfBits \00"
@.str.4 = [10 x i8] c"MuchBits \00"
@.str.5 = [5 x i8] c"\0A%d\0A\00"
@.str.6 = [14 x i8] c"Num CPUs: %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 @omp_set_dynamic(i32 0)
%9 = call i32 (...) @omp_get_num_procs()
%10 = call i32 @omp_set_num_threads(i32 %9)
store i32 0, i32* %7
store i32 1, i32* %6
br label %11
11: ; preds = %55, %2
%12 = load i32, i32* %6
%13 = icmp sle i32 %12, 1000000
br i1 %13, label %14, label %58
14: ; preds = %11
%15 = load i32, i32* %6
%16 = call i64 @isFibonacci(i32 %15)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %20
20: ; preds = %18, %14
%21 = load i32, i32* %6
%22 = call i64 @isPalindrome(i32 %21)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %20
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %26
26: ; preds = %24, %20
%27 = load i32, i32* %6
%28 = call i64 @isPrime(i32 %27)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
br label %32
32: ; preds = %30, %26
%33 = load i32, i32* %6
%34 = srem i32 %33, 3
%35 = icmp eq i32 %34, 0
br i1 %35, label %36, label %37
36: ; preds = %32
br i1 true, label %38, label %43
37: ; preds = %32
br i1 false, label %38, label %43
38: ; preds = %37, %36
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%40 = load i32, i32* %6
%41 = load i32, i32* %7
%42 = add nsw i32 %41, %40
store i32 %42, i32* %7
br label %43
43: ; preds = %38, %37, %36
%44 = load i32, i32* %6
%45 = srem i32 %44, 5
%46 = icmp eq i32 %45, 0
br i1 %46, label %47, label %48
47: ; preds = %43
br i1 true, label %49, label %54
48: ; preds = %43
br i1 false, label %49, label %54
49: ; preds = %48, %47
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%51 = load i32, i32* %6
%52 = load i32, i32* %7
%53 = add nsw i32 %52, %51
store i32 %53, i32* %7
br label %54
54: ; preds = %49, %48, %47
br label %55
55: ; preds = %54
%56 = load i32, i32* %6
%57 = add nsw i32 %56, 1
store i32 %57, i32* %6
br label %11
58: ; preds = %11
%59 = load i32, i32* %7
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %59)
%61 = call i32 (...) @omp_get_num_procs()
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i32 %61)
%63 = load i32, i32* %3
ret i32 %63
}

LLVM IR (-O2):
@.str = [9 x i8] c"Fibbits \00"
@.str.1 = [9 x i8] c"BitstiB \00"
@.str.2 = [18 x i8] c"BitsForEveryone! \00"
@.str.3 = [13 x i8] c"CrowdOfBits \00"
@.str.4 = [10 x i8] c"MuchBits \00"
@.str.5 = [5 x i8] c"\0A%d\0A\00"
@.str.6 = [14 x i8] c"Num CPUs: %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @omp_set_dynamic(i32 0)
%4 = tail call i32 (...) @omp_get_num_procs()
%5 = tail call i32 @omp_set_num_threads(i32 %4)
br label %6
6: ; preds = %2, %36
%7 = phi i32 [ 0, %2 ], [ %37, %36 ]
%8 = phi i32 [ 1, %2 ], [ %38, %36 ]
%9 = tail call i64 @isFibonacci(i32 %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %6
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %6
%14 = tail call i64 @isPalindrome(i32 %8)
%15 = icmp eq i64 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %13
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %16, %13
%19 = tail call i64 @isPrime(i32 %8)
%20 = icmp eq i64 %19, 0
br i1 %20, label %23, label %21
21: ; preds = %18
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
br label %23
23: ; preds = %21, %18
%24 = urem i32 %8, 3
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %23
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%28 = add nsw i32 %7, %8
br label %29
29: ; preds = %23, %26
%30 = phi i32 [ %28, %26 ], [ %7, %23 ]
%31 = urem i32 %8, 5
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %29
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%35 = add nsw i32 %30, %8
br label %36
36: ; preds = %33, %29
%37 = phi i32 [ %35, %33 ], [ %30, %29 ]
%38 = add nuw nsw i32 %8, 1
%39 = icmp eq i32 %38, 1000001
br i1 %39, label %40, label %6
40: ; preds = %36
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %37)
%42 = tail call i32 (...) @omp_get_num_procs()
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i32 %42)
ret i32 0
}