#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*/ assert(int);
int /*<<< orphan*/ printf(char *);
unsigned long fizzbuzz(unsigned long i) {
  assert(i > 0);
  if (!(i % 3))
    printf("fizz");
  if (!(i % 5))
    printf("buzz");
  return (i % 3) * (i % 5);
}


x86 assembly (clang, -O0):
<fizzbuzz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
seta   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rax
mov    $0x3,%ecx
xor    %edx,%edx
div    %rcx
cmp    $0x0,%rdx
jne    1162 <fizzbuzz+0x42>
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    $0x5,%ecx
xor    %edx,%edx
div    %rcx
cmp    $0x0,%rdx
jne    1186 <fizzbuzz+0x66>
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    $0x3,%ecx
xor    %edx,%edx
div    %rcx
mov    %rdx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x5,%ecx
xor    %edx,%edx
div    %rcx
mov    -0x10(%rbp),%rax
imul   %rdx,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fizzbuzz>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1040 <assert@plt>
movabs $0xaaaaaaaaaaaaaaab,%rcx
aa aa aa
mov    %rbx,%rax
mul    %rcx
shr    %rdx
lea    (%rdx,%rdx,2),%rax
mov    %rbx,%r14
sub    %rax,%r14
jne    1160 <fizzbuzz+0x40>
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
movabs $0xcccccccccccccccd,%rcx
cc cc cc
mov    %rbx,%rax
mul    %rcx
shr    $0x2,%rdx
lea    (%rdx,%rdx,4),%rax
sub    %rax,%rbx
jne    1189 <fizzbuzz+0x69>
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
imul   %rbx,%r14
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"fizz\00"
@.str.1 = [5 x i8] c"buzz\00"
define i64 @fizzbuzz(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp ugt i64 %3, 0
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
%7 = load i64, i64* %2
%8 = urem i64 %7, 3
%9 = icmp ne i64 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %1
%11 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %1
%13 = load i64, i64* %2
%14 = urem i64 %13, 5
%15 = icmp ne i64 %14, 0
br i1 %15, label %18, label %16
16: ; preds = %12
%17 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %16, %12
%19 = load i64, i64* %2
%20 = urem i64 %19, 3
%21 = load i64, i64* %2
%22 = urem i64 %21, 5
%23 = mul i64 %20, %22
ret i64 %23
}

LLVM IR (-O2):
@.str = [5 x i8] c"fizz\00"
@.str.1 = [5 x i8] c"buzz\00"
define i64 @fizzbuzz(i64 %0) {
%2 = icmp ne i64 %0, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = urem i64 %0, 3
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
%10 = urem i64 %0, 5
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %12, %9
%15 = mul nuw nsw i64 %5, %10
ret i64 %15
}