#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 /*<<< orphan*/ scanf(char *, long long *);
int main() {
  long long int num;
  printf("Do you want to fizzbuzz up to what number? ");
  scanf("%lld", &num);
  for (int i = 1; i <= num; i++) {
    if (i % 15 == 0) {
      printf("Fizz Buzz \n");
    } else if (i % 5 == 0) {
      printf("Buzz \n");
    } else if (i % 3 == 0) {
      printf("Fizz \n");
    } else {
      printf("%d \n", i);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee8(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x14(%rbp)
movslq -0x14(%rbp),%rax
cmp    -0x10(%rbp),%rax
jg     1205 <main+0xe5>
mov    -0x14(%rbp),%eax
mov    $0xf,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1189 <main+0x69>
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f2 <main+0xd2>
mov    -0x14(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11b0 <main+0x90>
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ed <main+0xcd>
mov    -0x14(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11d7 <main+0xb7>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e8 <main+0xc8>
mov    -0x14(%rbp),%esi
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ed <main+0xcd>
jmp    11f2 <main+0xd2>
jmp    11f7 <main+0xd7>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1154 <main+0x34>
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
lea    0xebe(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xedc(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
cmpq   $0x0,(%rsp)
jle    1202 <main+0xd2>
mov    $0x1,%ebx
mov    $0xaaaaaaab,%ebp
mov    $0xcccccccd,%r12d
mov    $0x88888889,%r15d
lea    0xebc(%rip),%r14
lea    0xeaa(%rip),%r13
jmp    11a2 <main+0x72>
nopl   0x0(%rax)
mov    %r14,%rdi
call   1030 <puts@plt>
add    $0x1,%rbx
cmp    %rbx,(%rsp)
jl     1202 <main+0xd2>
mov    %ebx,%eax
mov    %rax,%rcx
imul   %r15,%rcx
shr    $0x23,%rcx
mov    %ecx,%edx
shl    $0x4,%edx
sub    %edx,%ecx
add    %ebx,%ecx
je     1190 <main+0x60>
mov    %rax,%rcx
imul   %r12,%rcx
shr    $0x22,%rcx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
add    %ebx,%ecx
je     11f0 <main+0xc0>
imul   %rbp,%rax
shr    $0x21,%rax
lea    (%rax,%rax,2),%eax
neg    %eax
add    %ebx,%eax
je     11f9 <main+0xc9>
mov    %r13,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1198 <main+0x68>
nopl   (%rax)
lea    0xe4a(%rip),%rdi
jmp    1193 <main+0x63>
lea    0xe36(%rip),%rdi
jmp    1193 <main+0x63>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [44 x i8] c"Do you want to fizzbuzz up to what number? \00"
@.str.1 = [5 x i8] c"%lld\00"
@.str.5 = [5 x i8] c"%d \0A\00"
@str = [6 x i8] c"Fizz \00"
@str.6 = [6 x i8] c"Buzz \00"
@str.7 = [11 x i8] c"Fizz Buzz \00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %1)
%5 = load i64, i64* %1
%6 = icmp slt i64 %5, 1
br i1 %6, label %7, label %8
7: ; preds = %27, %0
ret i32 0
8: ; preds = %0, %27
%9 = phi i64 [ %28, %27 ], [ 1, %0 ]
%10 = trunc i64 %9 to i32
%11 = urem i32 %10, 15
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %8
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.7, i64 0, i64 0))
br label %27
15: ; preds = %8
%16 = urem i32 %10, 5
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.6, i64 0, i64 0))
br label %27
20: ; preds = %15
%21 = urem i32 %10, 3
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
br label %27
25: ; preds = %20
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %10)
br label %27
27: ; preds = %13, %23, %25, %18
%28 = add nuw i64 %9, 1
%29 = load i64, i64* %1
%30 = icmp slt i64 %29, %28
br i1 %30, label %7, label %8
}