#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 *, ...);
int line(int num, char *out) {
  if (num % 15 == 0) {
    sprintf(out, "FizzBuzz");
  } else if (num % 3 == 0) {
    sprintf(out, "Fizz");
  } else if (num % 5 == 0) {
    sprintf(out, "Buzz");
  } else {
    sprintf(out, "%d", num);
  }
}


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

x86 assembly (clang, -O2):
<line>:
push   %rax
imul   $0xeeeeeeef,%edi,%eax
add    $0x8888888,%eax
cmp    $0x11111110,%eax
jbe    115f <line+0x4f>
mov    %edi,%edx
imul   $0xaaaaaaab,%edi,%eax
add    $0x2aaaaaaa,%eax
cmp    $0x55555554,%eax
jbe    1172 <line+0x62>
imul   $0xcccccccd,%edx,%eax
add    $0x19999999,%eax
cmp    $0x33333332,%eax
jbe    117e <line+0x6e>
lea    0xebe(%rip),%rax
mov    %rsi,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <sprintf@plt>
pop    %rcx
ret
movabs $0x7a7a75427a7a6946,%rax
75 7a 7a
mov    %rax,(%rsi)
movb   $0x0,0x8(%rsi)
pop    %rcx
ret
movb   $0x0,0x4(%rsi)
movl   $0x7a7a6946,(%rsi)
pop    %rcx
ret
movb   $0x0,0x4(%rsi)
movl   $0x7a7a7542,(%rsi)
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [9 x i8] c"FizzBuzz\00"
@.str.1 = [5 x i8] c"Fizz\00"
@.str.2 = [5 x i8] c"Buzz\00"
@.str.3 = [3 x i8] c"%d\00"
define i32 @line(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(9) %1, i8* align 1 dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i64 9, 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 i32 undef
}