#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*/ printf(char *, int);
void fb(int num) {
  for (int i = 0; i <= num; i++) {
    if (i % 3 == 0 && i % 5 == 0) {
      printf("%d FizzBuzz\n", i);
    } else if (i % 3 == 0) {
      printf("%d Fizz\n", i);
    } else if (i % 5 == 0) {
      printf("%d Buzz\n", i);
    } else {
      printf("%d\n", i);
    }
  }
}


x86 assembly (clang, -O0):
<fb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     11e6 <fb+0xd6>
mov    -0x8(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    116a <fb+0x5a>
mov    -0x8(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    116a <fb+0x5a>
mov    -0x8(%rbp),%esi
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
jmp    11d3 <fb+0xc3>
mov    -0x8(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1192 <fb+0x82>
mov    -0x8(%rbp),%esi
lea    0xe85(%rip),%rdi
call   1030 <printf@plt>
jmp    11ce <fb+0xbe>
mov    -0x8(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11ba <fb+0xaa>
mov    -0x8(%rbp),%esi
lea    0xe66(%rip),%rdi
call   1030 <printf@plt>
jmp    11c9 <fb+0xb9>
mov    -0x8(%rbp),%esi
lea    0xe5b(%rip),%rdi
call   1030 <printf@plt>
jmp    11ce <fb+0xbe>
jmp    11d3 <fb+0xc3>
jmp    11d8 <fb+0xc8>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <fb+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fb>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
js     11a5 <fb+0x95>
mov    %edi,%ebx
add    $0x1,%ebx
xor    %ebp,%ebp
mov    $0xaaaaaaab,%r14d
mov    $0xcccccccd,%r15d
lea    0xec3(%rip),%r12
lea    0xec9(%rip),%r13
jmp    115e <fb+0x4e>
cs nopw 0x0(%rax,%rax,1)
mov    %ebp,%esi
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
je     11a5 <fb+0x95>
mov    %ebp,%eax
mov    %rax,%rcx
imul   %r14,%rcx
shr    $0x21,%rcx
lea    (%rcx,%rcx,2),%edx
imul   %r15,%rax
shr    $0x22,%rax
lea    (%rax,%rax,4),%esi
mov    %ebp,%ecx
sub    %edx,%ecx
mov    %ebp,%eax
sub    %esi,%eax
mov    %ecx,%edx
or     %eax,%edx
mov    %r12,%rdi
je     1150 <fb+0x40>
mov    %r13,%rdi
test   %ecx,%ecx
je     1150 <fb+0x40>
lea    0xe7e(%rip),%rdi
test   %eax,%eax
je     1150 <fb+0x40>
lea    0xe7c(%rip),%rdi
jmp    1150 <fb+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"%d FizzBuzz\0A\00"
@.str.1 = [9 x i8] c"%d Fizz\0A\00"
@.str.2 = [9 x i8] c"%d Buzz\0A\00"
@.str.3 = [4 x i8] c"%d\0A\00"
define void @fb(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %39, %1
%5 = load i32, i32* %3
%6 = load i32, i32* %2
%7 = icmp sle i32 %5, %6
br i1 %7, label %8, label %42
8: ; preds = %4
%9 = load i32, i32* %3
%10 = srem i32 %9, 3
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %19
12: ; preds = %8
%13 = load i32, i32* %3
%14 = srem i32 %13, 5
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %12
%17 = load i32, i32* %3
%18 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %17)
br label %38
19: ; preds = %12, %8
%20 = load i32, i32* %3
%21 = srem i32 %20, 3
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %19
%24 = load i32, i32* %3
%25 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %24)
br label %37
26: ; preds = %19
%27 = load i32, i32* %3
%28 = srem i32 %27, 5
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %26
%31 = load i32, i32* %3
%32 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %31)
br label %36
33: ; preds = %26
%34 = load i32, i32* %3
%35 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %34)
br label %36
36: ; preds = %33, %30
br label %37
37: ; preds = %36, %23
br label %38
38: ; preds = %37, %16
br label %39
39: ; preds = %38
%40 = load i32, i32* %3
%41 = add nsw i32 %40, 1
store i32 %41, i32* %3
br label %4
42: ; preds = %4
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"%d FizzBuzz\0A\00"
@.str.1 = [9 x i8] c"%d Fizz\0A\00"
@.str.2 = [9 x i8] c"%d Buzz\0A\00"
@.str.3 = [4 x i8] c"%d\0A\00"
define void @fb(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %3, label %4
3: ; preds = %15, %1
ret void
4: ; preds = %1, %15
%5 = phi i32 [ %18, %15 ], [ 0, %1 ]
%6 = urem i32 %5, 3
%7 = urem i32 %5, 5
%8 = icmp eq i32 %7, 0
%9 = or i32 %6, %7
%10 = icmp eq i32 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %4
%12 = icmp eq i32 %6, 0
br i1 %12, label %15, label %13
13: ; preds = %11
%14 = select i1 %8, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0)
br label %15
15: ; preds = %13, %11, %4
%16 = phi i8* [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), %4 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), %11 ], [ %14, %13 ]
%17 = tail call i32 @printf(i8* %16, i32 %5)
%18 = add nuw i32 %5, 1
%19 = icmp eq i32 %5, %0
br i1 %19, label %3, label %4
}