#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*/ printf(char *, int, int);
int /*<<< orphan*/ puts(char *);
int main(int argc, char *argv[]) {
  if (argc == 1) {
    puts("./fizzbuzz [max_num]");
    return 0;
  }
  const int max_num = atoi(argv[1]);
  for (int i = 1; i <= max_num; i = i + 1) {
    if (i % 15 == 0) {
      puts("fizzbuzz");
    } else if (i % 5 == 0) {
      puts("buzz");
    } else if (i % 3 == 0) {
      puts("fizz");
    } else {
      printf("%d%c", i, 0xa);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1168 <main+0x38>
lea    0xea9(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
jmp    122b <main+0xfb>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     122b <main+0xfb>
mov    -0x18(%rbp),%eax
mov    $0xf,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11b0 <main+0x80>
lea    0xe6f(%rip),%rdi
call   1030 <puts@plt>
jmp    1218 <main+0xe8>
mov    -0x18(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11d5 <main+0xa5>
lea    0xe4e(%rip),%rdi
call   1030 <puts@plt>
jmp    1213 <main+0xe3>
mov    -0x18(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11fa <main+0xca>
lea    0xe2e(%rip),%rdi
call   1030 <puts@plt>
jmp    120e <main+0xde>
mov    -0x18(%rbp),%esi
lea    0xe1f(%rip),%rdi
mov    $0xa,%edx
call   1040 <printf@plt>
jmp    1213 <main+0xe3>
jmp    1218 <main+0xe8>
jmp    121d <main+0xed>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    117f <main+0x4f>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x1,%edi
jne    1151 <main+0x21>
lea    0xeb9(%rip),%rdi
call   1030 <puts@plt>
jmp    1232 <main+0x102>
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
test   %eax,%eax
jle    1232 <main+0x102>
mov    %eax,%r14d
neg    %r14d
mov    $0x1,%ebx
mov    $0x88888889,%r13d
mov    $0xcccccccd,%ebp
lea    0xe96(%rip),%r15
lea    0xe93(%rip),%r12
jmp    11af <main+0x7f>
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1030 <puts@plt>
lea    (%r14,%rbx,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
je     1232 <main+0x102>
mov    %ebx,%eax
mov    %rax,%rcx
imul   %r13,%rcx
shr    $0x23,%rcx
lea    (%rcx,%rcx,4),%ecx
lea    (%rcx,%rcx,2),%ecx
cmp    %ecx,%ebx
je     1190 <main+0x60>
mov    %rax,%rcx
imul   %rbp,%rcx
shr    $0x22,%rcx
lea    (%rcx,%rcx,4),%ecx
mov    $0x1,%edx
sub    %ecx,%edx
add    %ebx,%edx
cmp    $0x1,%edx
jne    11f0 <main+0xc0>
mov    %r12,%rdi
jmp    1193 <main+0x63>
nopw   0x0(%rax,%rax,1)
mov    $0xaaaaaaab,%ecx
imul   %rcx,%rax
shr    $0x21,%rax
lea    (%rax,%rax,2),%eax
mov    $0x1,%ecx
sub    %eax,%ecx
add    %ebx,%ecx
cmp    $0x1,%ecx
jne    121a <main+0xea>
lea    0xe09(%rip),%rdi
jmp    1193 <main+0x63>
lea    0xe02(%rip),%rdi
mov    %ebx,%esi
mov    $0xa,%edx
call   1040 <printf@plt>
jmp    1198 <main+0x68>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"./fizzbuzz [max_num]\00"
@.str.1 = [9 x i8] c"fizzbuzz\00"
@.str.2 = [5 x i8] c"buzz\00"
@.str.3 = [5 x i8] c"fizz\00"
@.str.4 = [5 x i8] c"%d%c\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 @puts(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %48
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @atoi(i8* %15)
store i32 %16, i32* %6
store i32 1, i32* %7
br label %17
17: ; preds = %45, %12
%18 = load i32, i32* %7
%19 = load i32, i32* %6
%20 = icmp sle i32 %18, %19
br i1 %20, label %21, label %48
21: ; preds = %17
%22 = load i32, i32* %7
%23 = srem i32 %22, 15
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = call i32 @puts(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %44
27: ; preds = %21
%28 = load i32, i32* %7
%29 = srem i32 %28, 5
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %43
33: ; preds = %27
%34 = load i32, i32* %7
%35 = srem i32 %34, 3
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %33
%38 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %42
39: ; preds = %33
%40 = load i32, i32* %7
%41 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %40, i32 10)
br label %42
42: ; preds = %39, %37
br label %43
43: ; preds = %42, %31
br label %44
44: ; preds = %43, %25
br label %45
45: ; preds = %44
%46 = load i32, i32* %7
%47 = add nsw i32 %46, 1
store i32 %47, i32* %7
br label %17
48: ; preds = %10, %17
%49 = load i32, i32* %3
ret i32 %49
}

LLVM IR (-O2):
@.str = [21 x i8] c"./fizzbuzz [max_num]\00"
@.str.1 = [9 x i8] c"fizzbuzz\00"
@.str.2 = [5 x i8] c"buzz\00"
@.str.3 = [5 x i8] c"fizz\00"
@.str.4 = [5 x i8] c"%d%c\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %32
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, 1
br i1 %10, label %32, label %11
11: ; preds = %6, %29
%12 = phi i32 [ %30, %29 ], [ 1, %6 ]
%13 = urem i32 %12, 15
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %29
17: ; preds = %11
%18 = urem i32 %12, 5
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %29
22: ; preds = %17
%23 = urem i32 %12, 3
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %29
27: ; preds = %22
%28 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %12, i32 10)
br label %29
29: ; preds = %15, %25, %27, %20
%30 = add nuw i32 %12, 1
%31 = icmp eq i32 %12, %9
br i1 %31, label %32, label %11
32: ; preds = %29, %6, %4
ret i32 0
}