#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 isPrime(unsigned long long);
int /*<<< orphan*/ printf(char *, ...);
void fibonacciBuzzFizz(int n) {
  int i;
  int prime;
  unsigned long long first = 0;
  unsigned long long second = 1;
  unsigned long long fibonacci = 0;
  for (i = 0; i <= n; i++) {
    if (second > 18446744073709551615ULL - first) {
      printf("f(%d) too big for unsigned long long. Stopping.\n", i);
      return;
    } else {
      if (i < 2) {
        fibonacci = i;
      } else {
        fibonacci = first + second;
        first = second;
        second = fibonacci;
      }
      prime = isPrime(fibonacci);
      printf("f(%d) = %llu%s : ", i, fibonacci, (prime ? ", prime" : ""));
      if (prime || fibonacci % 3 == 0) {
        printf("Buzz");
      }
      if (prime || fibonacci % 5 == 0) {
        printf("Fizz");
      }
      if (!prime && fibonacci % 3 && fibonacci % 5) {
        printf("%llu", fibonacci);
      }
      printf("\n");
    }
  }
}


x86 assembly (clang, -O0):
<fibonacciBuzzFizz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x1,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     12bd <fibonacciBuzzFizz+0x19d>
mov    -0x20(%rbp),%rax
mov    $0xffffffffffffffff,%rcx
sub    -0x18(%rbp),%rcx
cmp    %rcx,%rax
jbe    1184 <fibonacciBuzzFizz+0x64>
mov    -0x8(%rbp),%esi
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12bd <fibonacciBuzzFizz+0x19d>
cmpl   $0x2,-0x8(%rbp)
jge    119b <fibonacciBuzzFizz+0x7b>
movslq -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    11b7 <fibonacciBuzzFizz+0x97>
mov    -0x18(%rbp),%rax
add    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rdi
call   1040 <isPrime@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    -0xc(%rbp),%edi
lea    0xe5c(%rip),%rcx
lea    0xe68(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%rcx
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0xc(%rbp)
jne    1212 <fibonacciBuzzFizz+0xf2>
mov    -0x28(%rbp),%rax
mov    $0x3,%ecx
xor    %edx,%edx
div    %rcx
cmp    $0x0,%rdx
jne    1220 <fibonacciBuzzFizz+0x100>
lea    0xe32(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0xc(%rbp)
jne    1242 <fibonacciBuzzFizz+0x122>
mov    -0x28(%rbp),%rax
mov    $0x5,%ecx
xor    %edx,%edx
div    %rcx
cmp    $0x0,%rdx
jne    1250 <fibonacciBuzzFizz+0x130>
lea    0xe07(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0xc(%rbp)
jne    129c <fibonacciBuzzFizz+0x17c>
mov    -0x28(%rbp),%rax
mov    $0x3,%ecx
xor    %edx,%edx
div    %rcx
cmp    $0x0,%rdx
je     129c <fibonacciBuzzFizz+0x17c>
mov    -0x28(%rbp),%rax
mov    $0x5,%ecx
xor    %edx,%edx
div    %rcx
cmp    $0x0,%rdx
je     129c <fibonacciBuzzFizz+0x17c>
mov    -0x28(%rbp),%rsi
lea    0xdc0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12af <fibonacciBuzzFizz+0x18f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114a <fibonacciBuzzFizz+0x2a>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fibonacciBuzzFizz>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,0x8(%rsp)
test   %edi,%edi
js     1278 <fibonacciBuzzFizz+0x148>
mov    0x8(%rsp),%rax
add    $0x1,%eax
mov    %rax,0x8(%rsp)
mov    $0x1,%r13d
xor    %ebx,%ebx
xor    %eax,%eax
jmp    118e <fibonacciBuzzFizz+0x5e>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,0x8(%rsp)
mov    0x10(%rsp),%rax
je     1278 <fibonacciBuzzFizz+0x148>
mov    %rax,%r12
add    %r13,%r12
jb     1287 <fibonacciBuzzFizz+0x157>
cmp    $0x2,%rbx
cmovae %r13,%rax
mov    %rax,0x10(%rsp)
cmovae %r12,%r13
cmovb  %rbx,%r12
mov    %r12,%rdi
call   1050 <isPrime@plt>
test   %eax,%eax
setne  %r14b
lea    0xe7f(%rip),%rcx
lea    0xe65(%rip),%rax
cmove  %rax,%rcx
lea    0xe5b(%rip),%rdi
mov    %ebx,%esi
mov    %r12,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rax
movabs $0xaaaaaaaaaaaaaaab,%rcx
aa aa aa
imul   %rcx,%rax
movabs $0x5555555555555556,%rcx
55 55 55
cmp    %rcx,%rax
setb   %r15b
or     %r14b,%r15b
cmp    $0x1,%r15b
jne    121b <fibonacciBuzzFizz+0xeb>
lea    0xe37(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rax
movabs $0xcccccccccccccccd,%rcx
cc cc cc
mul    %rcx
shr    $0x2,%rdx
lea    (%rdx,%rdx,4),%rax
mov    %r12,%rbp
sub    %rax,%rbp
setne  %al
xor    $0x1,%r14b
test   %r14b,%al
jne    1253 <fibonacciBuzzFizz+0x123>
lea    0xe04(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %rbp,%rbp
sete   %al
or     %r15b,%al
jne    1170 <fibonacciBuzzFizz+0x40>
lea    0xdec(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1170 <fibonacciBuzzFizz+0x40>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd72(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [49 x i8] c"f(%d) too big for unsigned long long. Stopping.\0A\00"
@.str.1 = [18 x i8] c"f(%d) = %llu%s : \00"
@.str.2 = [8 x i8] c", prime\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [5 x i8] c"Buzz\00"
@.str.5 = [5 x i8] c"Fizz\00"
@.str.6 = [5 x i8] c"%llu\00"
@.str.7 = [2 x i8] c"\0A\00"
define void @fibonacciBuzzFizz(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
store i32 %0, i32* %2
store i64 0, i64* %5
store i64 1, i64* %6
store i64 0, i64* %7
store i32 0, i32* %3
br label %8
8: ; preds = %76, %1
%9 = load i32, i32* %3
%10 = load i32, i32* %2
%11 = icmp sle i32 %9, %10
br i1 %11, label %12, label %79
12: ; preds = %8
%13 = load i64, i64* %6
%14 = load i64, i64* %5
%15 = sub i64 -1, %14
%16 = icmp ugt i64 %13, %15
br i1 %16, label %17, label %20
17: ; preds = %12
%18 = load i32, i32* %3
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i32 %18)
br label %79
20: ; preds = %12
%21 = load i32, i32* %3
%22 = icmp slt i32 %21, 2
br i1 %22, label %23, label %26
23: ; preds = %20
%24 = load i32, i32* %3
%25 = sext i32 %24 to i64
store i64 %25, i64* %7
br label %32
26: ; preds = %20
%27 = load i64, i64* %5
%28 = load i64, i64* %6
%29 = add i64 %27, %28
store i64 %29, i64* %7
%30 = load i64, i64* %6
store i64 %30, i64* %5
%31 = load i64, i64* %7
store i64 %31, i64* %6
br label %32
32: ; preds = %26, %23
%33 = load i64, i64* %7
%34 = call i32 @isPrime(i64 %33)
store i32 %34, i32* %4
%35 = load i32, i32* %3
%36 = load i64, i64* %7
%37 = load i32, i32* %4
%38 = icmp ne i32 %37, 0
%39 = zext i1 %38 to i64
%40 = select i1 %38, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0)
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %35, i64 %36, i8* %40)
%42 = load i32, i32* %4
%43 = icmp ne i32 %42, 0
br i1 %43, label %48, label %44
44: ; preds = %32
%45 = load i64, i64* %7
%46 = urem i64 %45, 3
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %50
48: ; preds = %44, %32
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %50
50: ; preds = %48, %44
%51 = load i32, i32* %4
%52 = icmp ne i32 %51, 0
br i1 %52, label %57, label %53
53: ; preds = %50
%54 = load i64, i64* %7
%55 = urem i64 %54, 5
%56 = icmp eq i64 %55, 0
br i1 %56, label %57, label %59
57: ; preds = %53, %50
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
br label %59
59: ; preds = %57, %53
%60 = load i32, i32* %4
%61 = icmp ne i32 %60, 0
br i1 %61, label %73, label %62
62: ; preds = %59
%63 = load i64, i64* %7
%64 = urem i64 %63, 3
%65 = icmp ne i64 %64, 0
br i1 %65, label %66, label %73
66: ; preds = %62
%67 = load i64, i64* %7
%68 = urem i64 %67, 5
%69 = icmp ne i64 %68, 0
br i1 %69, label %70, label %73
70: ; preds = %66
%71 = load i64, i64* %7
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i64 %71)
br label %73
73: ; preds = %70, %66, %62, %59
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %75
75: ; preds = %73
br label %76
76: ; preds = %75
%77 = load i32, i32* %3
%78 = add nsw i32 %77, 1
store i32 %78, i32* %3
br label %8
79: ; preds = %17, %8
ret void
}

LLVM IR (-O2):
@.str = [49 x i8] c"f(%d) too big for unsigned long long. Stopping.\0A\00"
@.str.1 = [18 x i8] c"f(%d) = %llu%s : \00"
@.str.2 = [8 x i8] c", prime\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [5 x i8] c"Buzz\00"
@.str.5 = [5 x i8] c"Fizz\00"
@.str.6 = [5 x i8] c"%llu\00"
define void @fibonacciBuzzFizz(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %46, label %3
3: ; preds = %1
%4 = add nuw i32 %0, 1
%5 = zext i32 %4 to i64
br label %6
6: ; preds = %3, %42
%7 = phi i64 [ 0, %3 ], [ %44, %42 ]
%8 = phi i64 [ 1, %3 ], [ %19, %42 ]
%9 = phi i64 [ 0, %3 ], [ %18, %42 ]
%10 = xor i64 %9, -1
%11 = icmp ugt i64 %8, %10
br i1 %11, label %12, label %15
12: ; preds = %6
%13 = trunc i64 %7 to i32
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i32 %13)
br label %46
15: ; preds = %6
%16 = icmp ult i64 %7, 2
%17 = add i64 %8, %9
%18 = select i1 %16, i64 %9, i64 %8
%19 = select i1 %16, i64 %8, i64 %17
%20 = select i1 %16, i64 %7, i64 %17
%21 = tail call i32 @isPrime(i64 %20)
%22 = icmp eq i32 %21, 0
%23 = select i1 %22, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0)
%24 = trunc i64 %7 to i32
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %24, i64 %20, i8* %23)
%26 = xor i1 %22, true
%27 = urem i64 %20, 3
%28 = icmp eq i64 %27, 0
%29 = or i1 %28, %26
br i1 %29, label %30, label %32
30: ; preds = %15
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %32
32: ; preds = %15, %30
%33 = urem i64 %20, 5
%34 = icmp eq i64 %33, 0
%35 = or i1 %34, %26
br i1 %35, label %36, label %38
36: ; preds = %32
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
br label %38
38: ; preds = %32, %36
%39 = or i1 %34, %29
br i1 %39, label %42, label %40
40: ; preds = %38
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i64 %20)
br label %42
42: ; preds = %40, %38
%43 = tail call i32 @putchar(i32 10)
%44 = add nuw nsw i64 %7, 1
%45 = icmp eq i64 %44, %5
br i1 %45, label %46, label %6
46: ; preds = %42, %1, %12
ret void
}