#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*/ printf(char *, ...);
void c_fizzbuzz(unsigned int max) {
  int i;
  for (i = 1; i <= max; i++) {
    switch (i % 15) {
    case 0:
      printf("fizzbuzz\n");
      break;
    case 3:
    case 6:
    case 9:
    case 12:
      printf("fizz\n");
      break;
    case 5:
    case 10:
      printf("buzz\n");
      break;
    default:
      printf("%d\n", i);
      break;
    };
  };
}


x86 assembly (clang, -O0):
<c_fizzbuzz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
ja     122a <c_fizzbuzz+0x11a>
movslq -0x8(%rbp),%rcx
mov    %ecx,%eax
imul   $0xffffffff88888889,%rcx,%rcx
shr    $0x20,%rcx
mov    %ecx,%edx
add    %eax,%edx
mov    %edx,%ecx
shr    $0x1f,%ecx
sar    $0x3,%edx
add    %ecx,%edx
mov    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
mov    %edx,%ecx
lea    (%rcx,%rcx,2),%ecx
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
je     11cd <c_fizzbuzz+0xbd>
jmp    1167 <c_fizzbuzz+0x57>
mov    -0xc(%rbp),%eax
sub    $0x3,%eax
je     11e0 <c_fizzbuzz+0xd0>
jmp    1178 <c_fizzbuzz+0x68>
mov    -0xc(%rbp),%eax
sub    $0x5,%eax
je     11f3 <c_fizzbuzz+0xe3>
jmp    1189 <c_fizzbuzz+0x79>
mov    -0xc(%rbp),%eax
sub    $0x6,%eax
je     11e0 <c_fizzbuzz+0xd0>
jmp    119a <c_fizzbuzz+0x8a>
mov    -0xc(%rbp),%eax
sub    $0x9,%eax
je     11e0 <c_fizzbuzz+0xd0>
jmp    11ab <c_fizzbuzz+0x9b>
mov    -0xc(%rbp),%eax
sub    $0xa,%eax
je     11f3 <c_fizzbuzz+0xe3>
jmp    11bc <c_fizzbuzz+0xac>
mov    -0xc(%rbp),%eax
sub    $0xc,%eax
je     11e0 <c_fizzbuzz+0xd0>
jmp    1206 <c_fizzbuzz+0xf6>
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1217 <c_fizzbuzz+0x107>
lea    0xe23(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1217 <c_fizzbuzz+0x107>
lea    0xe0a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1217 <c_fizzbuzz+0x107>
mov    -0x8(%rbp),%esi
lea    0xe00(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    121c <c_fizzbuzz+0x10c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <c_fizzbuzz+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_fizzbuzz>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
je     11c6 <c_fizzbuzz+0xa6>
mov    %edi,%r14d
neg    %r14d
mov    $0x1,%ebx
mov    $0x88888889,%r15d
mov    $0x1248,%ebp
lea    0xeb4(%rip),%r12
mov    $0x420,%r13d
jmp    117b <c_fizzbuzz+0x5b>
nopl   0x0(%rax,%rax,1)
mov    %r12,%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     11c6 <c_fizzbuzz+0xa6>
mov    %ebx,%eax
imul   %r15,%rax
shr    $0x23,%rax
mov    %eax,%ecx
shl    $0x4,%ecx
sub    %ecx,%eax
add    %ebx,%eax
cmp    $0xc,%eax
ja     11b4 <c_fizzbuzz+0x94>
bt     %eax,%ebp
jb     1160 <c_fizzbuzz+0x40>
bt     %eax,%r13d
jae    11a7 <c_fizzbuzz+0x87>
lea    0xe68(%rip),%rdi
jmp    1163 <c_fizzbuzz+0x43>
test   %eax,%eax
jne    11b4 <c_fizzbuzz+0x94>
lea    0xe57(%rip),%rdi
jmp    1163 <c_fizzbuzz+0x43>
lea    0xe45(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1168 <c_fizzbuzz+0x48>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"fizzbuzz\0A\00"
@.str.1 = [6 x i8] c"fizz\0A\00"
@.str.2 = [6 x i8] c"buzz\0A\00"
@.str.3 = [4 x i8] c"%d\0A\00"
define void @c_fizzbuzz(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 1, i32* %3
br label %4
4: ; preds = %21, %1
%5 = load i32, i32* %3
%6 = load i32, i32* %2
%7 = icmp ule i32 %5, %6
br i1 %7, label %8, label %24
8: ; preds = %4
%9 = load i32, i32* %3
%10 = srem i32 %9, 15
switch i32 %10, label %17 [
i32 0, label %11
i32 3, label %13
i32 6, label %13
i32 9, label %13
i32 12, label %13
i32 5, label %15
i32 10, label %15
]
11: ; preds = %8
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %20
13: ; preds = %8, %8, %8, %8
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %20
15: ; preds = %8, %8
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %20
17: ; preds = %8
%18 = load i32, i32* %3
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %18)
br label %20
20: ; preds = %17, %15, %13, %11
br label %21
21: ; preds = %20
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %4
24: ; preds = %4
ret void
}

LLVM IR (-O2):
@.str.3 = [4 x i8] c"%d\0A\00"
@str = [5 x i8] c"buzz\00"
@str.4 = [5 x i8] c"fizz\00"
@str.5 = [9 x i8] c"fizzbuzz\00"
define void @c_fizzbuzz(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %17, label %3
3: ; preds = %1, %14
%4 = phi i32 [ %15, %14 ], [ 1, %1 ]
%5 = urem i32 %4, 15
switch i32 %5, label %12 [
i32 0, label %6
i32 3, label %8
i32 6, label %8
i32 9, label %8
i32 12, label %8
i32 5, label %10
i32 10, label %10
]
6: ; preds = %3
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.5, i64 0, i64 0))
br label %14
8: ; preds = %3, %3, %3, %3
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.4, i64 0, i64 0))
br label %14
10: ; preds = %3, %3
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
br label %14
12: ; preds = %3
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %4)
br label %14
14: ; preds = %6, %8, %10, %12
%15 = add nuw i32 %4, 1
%16 = icmp eq i32 %4, %0
br i1 %16, label %17, label %3
17: ; preds = %14, %1
ret void
}