#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 atoi(char *);
int /*<<< orphan*/ fizzbuzz(char *, size_t, int);
size_t fizzbuzz_bufsiz(int);
int /*<<< orphan*/ free(char *);
char *malloc(size_t);
int /*<<< orphan*/ puts(char *);
int main(int argc, char **argv) {
  int max = 100;
  size_t bufsiz = fizzbuzz_bufsiz(max);
  char *buf = malloc(bufsiz);
  if (argc > 1) {
    max = atoi(argv[1]);
  }
  {
    int i = 0;
    for (; i <= max; i++) {
      fizzbuzz(buf, bufsiz, i);
      puts(buf);
    }
  }
  free(buf);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x64,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <fizzbuzz_bufsiz@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1070 <malloc@plt>
mov    %rax,-0x28(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    11b0 <main+0x50>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     11ea <main+0x8a>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x2c(%rbp),%edx
call   1060 <fizzbuzz@plt>
mov    -0x28(%rbp),%rdi
call   1040 <puts@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11b7 <main+0x57>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r12
mov    %edi,%ebp
mov    $0x64,%r15d
mov    $0x64,%edi
call   1050 <fizzbuzz_bufsiz@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1070 <malloc@plt>
mov    %rax,%rbx
cmp    $0x2,%ebp
jl     11a1 <main+0x41>
mov    0x8(%r12),%rdi
call   1080 <atoi@plt>
mov    %eax,%r15d
test   %eax,%eax
js     11cd <main+0x6d>
add    $0x1,%r15d
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1060 <fizzbuzz@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
add    $0x1,%ebp
cmp    %ebp,%r15d
jne    11b0 <main+0x50>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 100, i32* %6
%10 = load i32, i32* %6
%11 = call i64 @fizzbuzz_bufsiz(i32 %10)
store i64 %11, i64* %7
%12 = load i64, i64* %7
%13 = call i8* @malloc(i64 %12)
store i8* %13, i8** %8
%14 = load i32, i32* %4
%15 = icmp sgt i32 %14, 1
br i1 %15, label %16, label %21
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @atoi(i8* %19)
store i32 %20, i32* %6
br label %21
21: ; preds = %16, %2
store i32 0, i32* %9
br label %22
22: ; preds = %33, %21
%23 = load i32, i32* %9
%24 = load i32, i32* %6
%25 = icmp sle i32 %23, %24
br i1 %25, label %26, label %36
26: ; preds = %22
%27 = load i8*, i8** %8
%28 = load i64, i64* %7
%29 = load i32, i32* %9
%30 = call i32 @fizzbuzz(i8* %27, i64 %28, i32 %29)
%31 = load i8*, i8** %8
%32 = call i32 @puts(i8* %31)
br label %33
33: ; preds = %26
%34 = load i32, i32* %9
%35 = add nsw i32 %34, 1
store i32 %35, i32* %9
br label %22
36: ; preds = %22
%37 = load i8*, i8** %8
%38 = call i32 @free(i8* %37)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i64 @fizzbuzz_bufsiz(i32 100)
%4 = tail call i8* @malloc(i64 %3)
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %11
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @atoi(i8* %8)
%10 = icmp slt i32 %9, 0
br i1 %10, label %19, label %11
11: ; preds = %2, %6
%12 = phi i32 [ %9, %6 ], [ 100, %2 ]
br label %13
13: ; preds = %11, %13
%14 = phi i32 [ %17, %13 ], [ 0, %11 ]
%15 = tail call i32 @fizzbuzz(i8* %4, i64 %3, i32 %14)
%16 = tail call i32 @puts(i8* dereferenceable(1) %4)
%17 = add nuw i32 %14, 1
%18 = icmp eq i32 %14, %12
br i1 %18, label %19, label %13
19: ; preds = %13, %6
%20 = tail call i32 @free(i8* %4)
ret i32 0
}