#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*/ sprintf(char *, char *, ...);
void fizzbuzz(int number, char *string) {
  if (number % 15 == 0) {
    sprintf(string, "Fizz Buzz");
  } else if (number % 3 == 0) {
    sprintf(string, "Fizz");
  } else if (number % 5 == 0) {
    sprintf(string, "Buzz");
  } else {
    sprintf(string, "%i", number);
  }
}


x86 assembly (clang, -O0):
<fizzbuzz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xf,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    114a <fizzbuzz+0x3a>
mov    -0x10(%rbp),%rdi
lea    0xec2(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    11bf <fizzbuzz+0xaf>
mov    -0x4(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1175 <fizzbuzz+0x65>
mov    -0x10(%rbp),%rdi
lea    0xea1(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    11ba <fizzbuzz+0xaa>
mov    -0x4(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11a0 <fizzbuzz+0x90>
mov    -0x10(%rbp),%rdi
lea    0xe71(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    11b5 <fizzbuzz+0xa5>
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xe61(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    11ba <fizzbuzz+0xaa>
jmp    11bf <fizzbuzz+0xaf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fizzbuzz>:
imul   $0xeeeeeeef,%edi,%eax
add    $0x8888888,%eax
cmp    $0x11111110,%eax
jbe    115c <fizzbuzz+0x4c>
mov    %edi,%edx
imul   $0xaaaaaaab,%edi,%eax
add    $0x2aaaaaaa,%eax
cmp    $0x55555554,%eax
jbe    1170 <fizzbuzz+0x60>
imul   $0xcccccccd,%edx,%eax
add    $0x19999999,%eax
cmp    $0x33333332,%eax
jbe    117b <fizzbuzz+0x6b>
lea    0xec0(%rip),%rax
mov    %rsi,%rdi
mov    %rax,%rsi
xor    %eax,%eax
jmp    1030 <sprintf@plt>
movabs $0x7a7542207a7a6946,%rax
42 75 7a
mov    %rax,(%rsi)
movw   $0x7a,0x8(%rsi)
ret
movb   $0x0,0x4(%rsi)
movl   $0x7a7a6946,(%rsi)
ret
movb   $0x0,0x4(%rsi)
movl   $0x7a7a7542,(%rsi)
ret

LLVM IR (-O0):
@.str = [10 x i8] c"Fizz Buzz\00"
@.str.1 = [5 x i8] c"Fizz\00"
@.str.2 = [5 x i8] c"Buzz\00"
@.str.3 = [3 x i8] c"%i\00"
define void @fizzbuzz(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = srem i32 %5, 15
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i8*, i8** %4
%10 = call i32 (i8*, i8*, ...) @sprintf(i8* %9, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %31
11: ; preds = %2
%12 = load i32, i32* %3
%13 = srem i32 %12, 3
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %11
%16 = load i8*, i8** %4
%17 = call i32 (i8*, i8*, ...) @sprintf(i8* %16, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %30
18: ; preds = %11
%19 = load i32, i32* %3
%20 = srem i32 %19, 5
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %18
%23 = load i8*, i8** %4
%24 = call i32 (i8*, i8*, ...) @sprintf(i8* %23, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %29
25: ; preds = %18
%26 = load i8*, i8** %4
%27 = load i32, i32* %3
%28 = call i32 (i8*, i8*, ...) @sprintf(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %27)
br label %29
29: ; preds = %25, %22
br label %30
30: ; preds = %29, %15
br label %31
31: ; preds = %30, %8
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"Fizz Buzz\00"
@.str.1 = [5 x i8] c"Fizz\00"
@.str.2 = [5 x i8] c"Buzz\00"
@.str.3 = [3 x i8] c"%i\00"
define void @fizzbuzz(i32 %0, i8* nocapture writeonly %1) {
%3 = srem i32 %0, 15
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(10) %1, i8* align 1 dereferenceable(10) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i64 10, i1 false)
br label %16
6: ; preds = %2
%7 = srem i32 %0, 3
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %6
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(5) %1, i8* align 1 dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64 5, i1 false)
br label %16
10: ; preds = %6
%11 = srem i32 %0, 5
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %10
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(5) %1, i8* align 1 dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i64 5, i1 false)
br label %16
14: ; preds = %10
%15 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %0)
br label %16
16: ; preds = %9, %14, %13, %5
ret void
}