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


x86 assembly (clang, -O0):
<fb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1148 <fb+0x28>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1153 <fb+0x33>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
call   1030 <fb@plt>
mov    -0x4(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1191 <fb+0x71>
mov    -0x4(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1191 <fb+0x71>
mov    -0x4(%rbp),%esi
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1200 <fb+0xe0>
mov    -0x4(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11bb <fb+0x9b>
mov    -0x4(%rbp),%esi
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11fb <fb+0xdb>
mov    -0x4(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11e5 <fb+0xc5>
mov    -0x4(%rbp),%esi
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11f6 <fb+0xd6>
mov    -0x4(%rbp),%esi
lea    0xe33(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11fb <fb+0xdb>
jmp    1200 <fb+0xe0>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fb>:
push   %rbx
mov    %edi,%ebx
test   %edi,%edi
je     1141 <fb+0x11>
lea    -0x1(%rbx),%edi
call   1030 <fb@plt>
jmp    114d <fb+0x1d>
lea    0xedb(%rip),%rdi
call   1040 <puts@plt>
movslq %ebx,%rcx
imul   $0x55555556,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rax
add    %edx,%eax
lea    (%rax,%rax,2),%edx
mov    %ebx,%eax
sub    %edx,%eax
imul   $0x66666667,%rcx,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
mov    %ebx,%ecx
sub    %edx,%ecx
mov    %eax,%edx
or     %ecx,%edx
je     11a6 <fb+0x76>
test   %eax,%eax
je     11af <fb+0x7f>
test   %ecx,%ecx
lea    0xe7d(%rip),%rax
lea    0xe7f(%rip),%rdi
cmove  %rax,%rdi
jmp    11b6 <fb+0x86>
lea    0xe53(%rip),%rdi
jmp    11b6 <fb+0x86>
lea    0xe57(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
pop    %rbx
jmp    1050 <printf@plt>

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

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