#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 */
void *calloc(int, int);
int /*<<< orphan*/ sprintf(char *, char *, int);
char *strdup(char *);
char **FizzBuzz(int n) {
  char **result = calloc(n, sizeof(char *));
  for (int i = 1; i <= n; i++) {
    if (i % 3 == 0) {
      if (i % 5 == 0) {
        result[i - 1] = strdup("FizzBuzz");
      } else {
        result[i - 1] = strdup("Fizz");
      }
    } else if (i % 5 == 0) {
      result[i - 1] = strdup("Buzz");
    } else {
      char *buffer = calloc(10, sizeof(char));
      sprintf(buffer, "%d", i);
      result[i - 1] = buffer;
    }
  }
  return result;
}


x86 assembly (clang, -O0):
<FizzBuzz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     125d <FizzBuzz+0x12d>
mov    -0x14(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11d1 <FizzBuzz+0xa1>
mov    -0x14(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11ac <FizzBuzz+0x7c>
lea    0xe72(%rip),%rdi
call   1050 <strdup@plt>
mov    %rax,%rdx
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %rdx,(%rax,%rcx,8)
jmp    11cc <FizzBuzz+0x9c>
lea    0xe56(%rip),%rdi
call   1050 <strdup@plt>
mov    %rax,%rdx
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %rdx,(%rax,%rcx,8)
jmp    124a <FizzBuzz+0x11a>
mov    -0x14(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    120a <FizzBuzz+0xda>
lea    0xe18(%rip),%rdi
call   1050 <strdup@plt>
mov    %rax,%rdx
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %rdx,(%rax,%rcx,8)
jmp    1245 <FizzBuzz+0x115>
mov    $0xa,%edi
mov    $0x1,%esi
call   1030 <calloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xde3(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x20(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %rdx,(%rax,%rcx,8)
jmp    124a <FizzBuzz+0x11a>
jmp    124f <FizzBuzz+0x11f>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1153 <FizzBuzz+0x23>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FizzBuzz>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edi,%r15d
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,%r14
test   %r15d,%r15d
jle    11f6 <FizzBuzz+0xc6>
add    $0x1,%r15d
mov    $0x1,%ebx
mov    $0xcccccccd,%ebp
mov    $0xaaaaaaab,%r12d
jmp    118d <FizzBuzz+0x5d>
nopw   0x0(%rax,%rax,1)
lea    0xe8d(%rip),%rdi
call   1050 <strdup@plt>
mov    %rax,%r13
mov    %r13,-0x8(%r14,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r15
je     11f6 <FizzBuzz+0xc6>
mov    %ebx,%eax
mov    %rax,%rcx
imul   %rbp,%rcx
shr    $0x22,%rcx
lea    (%rcx,%rcx,4),%ecx
imul   %r12,%rax
shr    $0x21,%rax
lea    (%rax,%rax,2),%edx
mov    %ebx,%eax
sub    %ecx,%eax
cmp    %edx,%ebx
je     11e0 <FizzBuzz+0xb0>
test   %eax,%eax
je     1170 <FizzBuzz+0x40>
mov    $0xa,%edi
mov    $0x1,%esi
call   1030 <calloc@plt>
mov    %rax,%r13
mov    %rax,%rdi
lea    0xe3e(%rip),%rsi
mov    %ebx,%edx
call   1040 <sprintf@plt>
jmp    117f <FizzBuzz+0x4f>
nopl   0x0(%rax)
test   %eax,%eax
je     11ed <FizzBuzz+0xbd>
lea    0xe1e(%rip),%rdi
jmp    1177 <FizzBuzz+0x47>
lea    0xe0c(%rip),%rdi
jmp    1177 <FizzBuzz+0x47>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
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 i8** @FizzBuzz(i32 %0) {
%2 = alloca i32
%3 = alloca i8**
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = call i8* @calloc(i32 %6, i32 8)
%8 = bitcast i8* %7 to i8**
store i8** %8, i8*** %3
store i32 1, i32* %4
br label %9
9: ; preds = %60, %1
%10 = load i32, i32* %4
%11 = load i32, i32* %2
%12 = icmp sle i32 %10, %11
br i1 %12, label %13, label %63
13: ; preds = %9
%14 = load i32, i32* %4
%15 = srem i32 %14, 3
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %36
17: ; preds = %13
%18 = load i32, i32* %4
%19 = srem i32 %18, 5
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %28
21: ; preds = %17
%22 = call i8* @strdup(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%23 = load i8**, i8*** %3
%24 = load i32, i32* %4
%25 = sub nsw i32 %24, 1
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %23, i64 %26
store i8* %22, i8** %27
br label %35
28: ; preds = %17
%29 = call i8* @strdup(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%30 = load i8**, i8*** %3
%31 = load i32, i32* %4
%32 = sub nsw i32 %31, 1
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8*, i8** %30, i64 %33
store i8* %29, i8** %34
br label %35
35: ; preds = %28, %21
br label %59
36: ; preds = %13
%37 = load i32, i32* %4
%38 = srem i32 %37, 5
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %47
40: ; preds = %36
%41 = call i8* @strdup(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%42 = load i8**, i8*** %3
%43 = load i32, i32* %4
%44 = sub nsw i32 %43, 1
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i8*, i8** %42, i64 %45
store i8* %41, i8** %46
br label %58
47: ; preds = %36
%48 = call i8* @calloc(i32 10, i32 1)
store i8* %48, i8** %5
%49 = load i8*, i8** %5
%50 = load i32, i32* %4
%51 = call i32 @sprintf(i8* %49, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %50)
%52 = load i8*, i8** %5
%53 = load i8**, i8*** %3
%54 = load i32, i32* %4
%55 = sub nsw i32 %54, 1
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i8*, i8** %53, i64 %56
store i8* %52, i8** %57
br label %58
58: ; preds = %47, %40
br label %59
59: ; preds = %58, %35
br label %60
60: ; preds = %59
%61 = load i32, i32* %4
%62 = add nsw i32 %61, 1
store i32 %62, i32* %4
br label %9
63: ; preds = %9
%64 = load i8**, i8*** %3
ret i8** %64
}

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 noalias i8** @FizzBuzz(i32 %0) {
%2 = tail call i8* @calloc(i32 %0, i32 8)
%3 = bitcast i8* %2 to i8**
%4 = icmp slt i32 %0, 1
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = add nuw i32 %0, 1
%7 = zext i32 %6 to i64
br label %9
8: ; preds = %27, %1
ret i8** %3
9: ; preds = %5, %27
%10 = phi i64 [ 1, %5 ], [ %31, %27 ]
%11 = trunc i64 %10 to i32
%12 = urem i32 %11, 3
%13 = icmp eq i32 %12, 0
%14 = urem i32 %11, 5
%15 = icmp eq i32 %14, 0
br i1 %13, label %16, label %21
16: ; preds = %9
br i1 %15, label %17, label %19
17: ; preds = %16
%18 = tail call dereferenceable_or_null(9) i8* @strdup(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %27
19: ; preds = %16
%20 = tail call dereferenceable_or_null(5) i8* @strdup(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %27
21: ; preds = %9
br i1 %15, label %22, label %24
22: ; preds = %21
%23 = tail call dereferenceable_or_null(5) i8* @strdup(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %27
24: ; preds = %21
%25 = tail call dereferenceable_or_null(10) i8* @calloc(i32 10, i32 1)
%26 = tail call i32 @sprintf(i8* dereferenceable(1) %25, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %11)
br label %27
27: ; preds = %19, %17, %24, %22
%28 = phi i8* [ %20, %19 ], [ %18, %17 ], [ %25, %24 ], [ %23, %22 ]
%29 = add nsw i64 %10, -1
%30 = getelementptr inbounds i8*, i8** %3, i64 %29
store i8* %28, i8** %30
%31 = add nuw nsw i64 %10, 1
%32 = icmp eq i64 %31, %7
br i1 %32, label %8, label %9
}