#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 */
scalar_t__ malloc(int);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strncpy(char *, char *, int const);
char **fizzBuzz(int n, int *returnSize) {
  char **array;
  char *buf;
  int i;
  const int bufLen = 11;
  array = (char **)malloc(sizeof(char *) * n);
  *returnSize = n;
  for (i = 1; i <= n; i++) {
    buf = (char *)malloc(sizeof(char) * bufLen);
    array[i - 1] = buf;
    if (i % 3) {
      if (i % 5) {
        sprintf(buf, "%d", i);
      } else {
        strncpy(buf, "Buzz", bufLen);
      }
    } else {
      if (i % 5) {
        strncpy(buf, "Fizz", bufLen);
      } else {
        strncpy(buf, "FizzBuzz", bufLen);
      }
    }
  }
  return array;
}


x86 assembly (clang, -O0):
<fizzBuzz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xb,-0x28(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     124d <fizzBuzz+0x11d>
mov    $0xb,%edi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     11f2 <fizzBuzz+0xc2>
mov    -0x24(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     11d8 <fizzBuzz+0xa8>
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%edx
lea    0xe32(%rip),%rsi
call   1050 <sprintf@plt>
jmp    11ed <fizzBuzz+0xbd>
mov    -0x20(%rbp),%rdi
lea    0xe29(%rip),%rsi
mov    $0xb,%edx
call   1030 <strncpy@plt>
jmp    123a <fizzBuzz+0x10a>
mov    -0x24(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1220 <fizzBuzz+0xf0>
mov    -0x20(%rbp),%rdi
lea    0xdf2(%rip),%rsi
mov    $0xb,%edx
call   1030 <strncpy@plt>
jmp    1235 <fizzBuzz+0x105>
mov    -0x20(%rbp),%rdi
lea    0xddd(%rip),%rsi
mov    $0xb,%edx
call   1030 <strncpy@plt>
jmp    123a <fizzBuzz+0x10a>
jmp    123f <fizzBuzz+0x10f>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1169 <fizzBuzz+0x39>
mov    -0x18(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fizzBuzz>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%r15d
lea    0x0(,%r15,8),%edi
call   1040 <malloc@plt>
mov    %rax,%r14
mov    %r15d,(%rbx)
test   %r15d,%r15d
jle    11f6 <fizzBuzz+0xc6>
add    $0x1,%r15d
mov    $0x1,%ebx
mov    $0xaaaaaaab,%ebp
jmp    118a <fizzBuzz+0x5a>
nopl   (%rax)
lea    0xe95(%rip),%rsi
mov    $0xb,%edx
call   1030 <strncpy@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
je     11f6 <fizzBuzz+0xc6>
mov    %ebx,%eax
mov    %rax,%rcx
mov    $0xcccccccd,%edx
imul   %rdx,%rcx
shr    $0x22,%rcx
lea    (%rcx,%rcx,4),%r12d
imul   %rbp,%rax
shr    $0x21,%rax
lea    (%rax,%rax,2),%r13d
mov    $0xb,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%r14,%rbx,8)
mov    %ebx,%ecx
sub    %r12d,%ecx
mov    %rax,%rdi
cmp    %r13d,%ebx
je     11e0 <fizzBuzz+0xb0>
test   %ecx,%ecx
je     1170 <fizzBuzz+0x40>
lea    0xe2d(%rip),%rsi
mov    %ebx,%edx
call   1050 <sprintf@plt>
jmp    1181 <fizzBuzz+0x51>
nopl   0x0(%rax)
test   %ecx,%ecx
je     11ed <fizzBuzz+0xbd>
lea    0xe18(%rip),%rsi
jmp    1177 <fizzBuzz+0x47>
lea    0xe14(%rip),%rsi
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 = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"Buzz\00"
@.str.2 = [5 x i8] c"Fizz\00"
@.str.3 = [9 x i8] c"FizzBuzz\00"
define i8** @fizzBuzz(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %3
store i32* %1, i32** %4
store i32 11, i32* %8
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = mul i64 8, %10
%12 = trunc i64 %11 to i32
%13 = call i64 @malloc(i32 %12)
%14 = inttoptr i64 %13 to i8**
store i8** %14, i8*** %5
%15 = load i32, i32* %3
%16 = load i32*, i32** %4
store i32 %15, i32* %16
store i32 1, i32* %7
br label %17
17: ; preds = %57, %2
%18 = load i32, i32* %7
%19 = load i32, i32* %3
%20 = icmp sle i32 %18, %19
br i1 %20, label %21, label %60
21: ; preds = %17
%22 = call i64 @malloc(i32 11)
%23 = inttoptr i64 %22 to i8*
store i8* %23, i8** %6
%24 = load i8*, i8** %6
%25 = load i8**, i8*** %5
%26 = load i32, i32* %7
%27 = sub nsw i32 %26, 1
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8*, i8** %25, i64 %28
store i8* %24, i8** %29
%30 = load i32, i32* %7
%31 = srem i32 %30, 3
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %45
33: ; preds = %21
%34 = load i32, i32* %7
%35 = srem i32 %34, 5
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %41
37: ; preds = %33
%38 = load i8*, i8** %6
%39 = load i32, i32* %7
%40 = call i32 @sprintf(i8* %38, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %39)
br label %44
41: ; preds = %33
%42 = load i8*, i8** %6
%43 = call i32 @strncpy(i8* %42, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 11)
br label %44
44: ; preds = %41, %37
br label %56
45: ; preds = %21
%46 = load i32, i32* %7
%47 = srem i32 %46, 5
%48 = icmp ne i32 %47, 0
br i1 %48, label %49, label %52
49: ; preds = %45
%50 = load i8*, i8** %6
%51 = call i32 @strncpy(i8* %50, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 11)
br label %55
52: ; preds = %45
%53 = load i8*, i8** %6
%54 = call i32 @strncpy(i8* %53, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 11)
br label %55
55: ; preds = %52, %49
br label %56
56: ; preds = %55, %44
br label %57
57: ; preds = %56
%58 = load i32, i32* %7
%59 = add nsw i32 %58, 1
store i32 %59, i32* %7
br label %17
60: ; preds = %17
%61 = load i8**, i8*** %5
ret i8** %61
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"Buzz\00"
@.str.2 = [5 x i8] c"Fizz\00"
@.str.3 = [9 x i8] c"FizzBuzz\00"
define i8** @fizzBuzz(i32 %0, i32* nocapture writeonly %1) {
%3 = shl i32 %0, 3
%4 = tail call i64 @malloc(i32 %3)
%5 = inttoptr i64 %4 to i8**
store i32 %0, i32* %1
%6 = icmp slt i32 %0, 1
br i1 %6, label %34, label %7
7: ; preds = %2
%8 = add nuw i32 %0, 1
%9 = zext i32 %8 to i64
br label %10
10: ; preds = %7, %31
%11 = phi i64 [ 1, %7 ], [ %32, %31 ]
%12 = tail call i64 @malloc(i32 11)
%13 = inttoptr i64 %12 to i8*
%14 = add nsw i64 %11, -1
%15 = getelementptr inbounds i8*, i8** %5, i64 %14
store i8* %13, i8** %15
%16 = trunc i64 %11 to i32
%17 = urem i32 %16, 3
%18 = icmp eq i32 %17, 0
%19 = urem i32 %16, 5
%20 = icmp eq i32 %19, 0
br i1 %18, label %26, label %21
21: ; preds = %10
br i1 %20, label %24, label %22
22: ; preds = %21
%23 = tail call i32 @sprintf(i8* dereferenceable(1) %13, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %16)
br label %31
24: ; preds = %21
%25 = tail call i32 @strncpy(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 11)
br label %31
26: ; preds = %10
br i1 %20, label %29, label %27
27: ; preds = %26
%28 = tail call i32 @strncpy(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 11)
br label %31
29: ; preds = %26
%30 = tail call i32 @strncpy(i8* %13, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 11)
br label %31
31: ; preds = %24, %22, %29, %27
%32 = add nuw nsw i64 %11, 1
%33 = icmp eq i64 %32, %9
br i1 %33, label %34, label %10
34: ; preds = %31, %2
ret i8** %5
}