#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 fizzbuzz(int n) {
  for (int i = 1; i <= n; i++) {
    if (i % 3 == 0 && i % 5 == 0) {
      printf("fizzbuzz %d \n", i);
    } else if (i % 3 == 0) {
      printf("fizz %d \n", i);
    } else if (i % 5 == 0) {
      printf("buzz %d \n", i);
    }
  }
}


x86 assembly (clang, -O0):
<fizzbuzz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     11d2 <fizzbuzz+0xc2>
mov    -0x8(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    116a <fizzbuzz+0x5a>
mov    -0x8(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    116a <fizzbuzz+0x5a>
mov    -0x8(%rbp),%esi
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
jmp    11bf <fizzbuzz+0xaf>
mov    -0x8(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1192 <fizzbuzz+0x82>
mov    -0x8(%rbp),%esi
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
jmp    11ba <fizzbuzz+0xaa>
mov    -0x8(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11b5 <fizzbuzz+0xa5>
mov    -0x8(%rbp),%esi
lea    0xe54(%rip),%rdi
call   1030 <printf@plt>
jmp    11ba <fizzbuzz+0xaa>
jmp    11bf <fizzbuzz+0xaf>
jmp    11c4 <fizzbuzz+0xb4>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <fizzbuzz+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fizzbuzz>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    11b0 <fizzbuzz+0xa0>
mov    %edi,%r14d
mov    $0x1,%ebx
xor    %ebp,%ebp
mov    $0xaaaaaaab,%r15d
mov    $0xcccccccd,%r12d
lea    0xec0(%rip),%r13
jmp    115f <fizzbuzz+0x4f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebp,%esi
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    %ebp,%r14d
je     11b0 <fizzbuzz+0xa0>
mov    %ebp,%edx
mov    %ebx,%eax
mov    %rax,%rcx
imul   %r15,%rcx
shr    $0x21,%rcx
lea    (%rcx,%rcx,2),%ecx
imul   %r12,%rax
shr    $0x22,%rax
lea    (%rax,%rax,4),%eax
neg    %ecx
add    %edx,%ecx
add    $0x1,%ecx
neg    %eax
add    %edx,%eax
add    $0x1,%eax
lea    0x1(%rdx),%ebp
mov    %ecx,%edx
or     %eax,%edx
mov    %r13,%rdi
je     1150 <fizzbuzz+0x40>
lea    0xe71(%rip),%rdi
test   %ecx,%ecx
je     11a8 <fizzbuzz+0x98>
lea    0xe5c(%rip),%rdi
je     1150 <fizzbuzz+0x40>
test   %eax,%eax
jne    1157 <fizzbuzz+0x47>
jmp    1150 <fizzbuzz+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"fizzbuzz %d \0A\00"
@.str.1 = [10 x i8] c"fizz %d \0A\00"
@.str.2 = [10 x i8] c"buzz %d \0A\00"
define void @fizzbuzz(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 1, i32* %3
br label %4
4: ; preds = %36, %1
%5 = load i32, i32* %3
%6 = load i32, i32* %2
%7 = icmp sle i32 %5, %6
br i1 %7, label %8, label %39
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 ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %17)
br label %35
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 ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %24)
br label %34
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 ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %31)
br label %33
33: ; preds = %30, %26
br label %34
34: ; preds = %33, %23
br label %35
35: ; preds = %34, %16
br label %36
36: ; preds = %35
%37 = load i32, i32* %3
%38 = add nsw i32 %37, 1
store i32 %38, i32* %3
br label %4
39: ; preds = %4
ret void
}

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