#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 fizzbuzz(int n) {
  for (int i = 1; i <= n; i++) {
    int m3 = i % 3, m5 = i % 5;
    if (!m3 && !m5)
      printf("fizzbuzz\n");
    else if (!m3)
      printf("fizz\n");
    else if (!m5)
      printf("buzz\n");
    else
      printf("%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     11d9 <fizzbuzz+0xc9>
mov    -0x8(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1171 <fizzbuzz+0x61>
cmpl   $0x0,-0x10(%rbp)
jne    1171 <fizzbuzz+0x61>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c6 <fizzbuzz+0xb6>
cmpl   $0x0,-0xc(%rbp)
jne    118e <fizzbuzz+0x7e>
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c1 <fizzbuzz+0xb1>
cmpl   $0x0,-0x10(%rbp)
jne    11ab <fizzbuzz+0x9b>
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11bc <fizzbuzz+0xac>
mov    -0x8(%rbp),%esi
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c1 <fizzbuzz+0xb1>
jmp    11c6 <fizzbuzz+0xb6>
jmp    11cb <fizzbuzz+0xbb>
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    11e2 <fizzbuzz+0xc2>
mov    %edi,%ebx
mov    $0x1,%r12d
mov    $0xaaaaaaab,%r15d
mov    $0xcccccccd,%r13d
lea    0xeb6(%rip),%r14
xor    %ebp,%ebp
jmp    1170 <fizzbuzz+0x50>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
call   1030 <puts@plt>
add    $0x1,%r12d
cmp    %ebp,%ebx
je     11e2 <fizzbuzz+0xc2>
mov    %ebp,%edx
mov    %r12d,%eax
mov    %rax,%rcx
imul   %r15,%rcx
shr    $0x21,%rcx
lea    (%rcx,%rcx,2),%ecx
imul   %r13,%rax
shr    $0x22,%rax
lea    (%rax,%rax,4),%esi
neg    %ecx
lea    (%rdx,%rcx,1),%eax
add    $0x1,%eax
neg    %esi
lea    (%rdx,%rsi,1),%ecx
add    $0x1,%ecx
lea    0x1(%rdx),%ebp
mov    %eax,%edx
or     %ecx,%edx
je     1160 <fizzbuzz+0x40>
test   %eax,%eax
je     11d0 <fizzbuzz+0xb0>
test   %ecx,%ecx
je     11d9 <fizzbuzz+0xb9>
lea    0xe4a(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1168 <fizzbuzz+0x48>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0xe36(%rip),%rdi
jmp    1163 <fizzbuzz+0x43>
lea    0xe28(%rip),%rdi
jmp    1163 <fizzbuzz+0x43>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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