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


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     11c7 <fizzbuzz+0xb7>
mov    -0x8(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1150 <fizzbuzz+0x40>
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1172 <fizzbuzz+0x62>
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     11ab <fizzbuzz+0x9b>
mov    -0x8(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     11ab <fizzbuzz+0x9b>
mov    -0x8(%rbp),%esi
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
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    11e7 <fizzbuzz+0xc7>
mov    %edi,%r14d
neg    %r14d
mov    $0x1,%ebx
mov    $0xffffffff,%ebp
mov    $0xcccccccd,%r13d
mov    $0xaaaaaaab,%r12d
jmp    118e <fizzbuzz+0x6e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0xe9e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
lea    (%r14,%rbx,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
je     11e7 <fizzbuzz+0xc7>
mov    %ebx,%eax
mov    %rax,%rcx
imul   %r13,%rcx
shr    $0x22,%rcx
lea    (%rcx,%rcx,4),%r15d
add    %ebp,%r15d
imul   %r12,%rax
shr    $0x21,%rax
lea    (%rax,%rax,2),%eax
cmp    %eax,%ebx
jne    11d0 <fizzbuzz+0xb0>
lea    0xe48(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r15d,%r15d
jne    116e <fizzbuzz+0x4e>
jmp    1160 <fizzbuzz+0x40>
cs nopw 0x0(%rax,%rax,1)
test   %r15d,%r15d
je     1160 <fizzbuzz+0x40>
lea    0xe2e(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    116e <fizzbuzz+0x4e>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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