#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*/ memcpy(char *, char *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
int main(int argc, char **argv) {
  char s[10];
  int spos = 0;
  for (int i = 1; i < 101; i++) {
    if (i % 3 == 0) {
      memcpy(s + spos, "fizz", 4);
      spos += 4;
    }
    if (i % 5 == 0) {
      memcpy(s + spos, "buzz", 4);
      spos += 4;
    }
    if (spos == 0) {
      sprintf(s, "%d\n", i);
    } else {
      s[spos++] = '\n';
      s[spos] = 0;
    }
    printf(s);
    spos = 0;
  }
  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   $0x0,-0x20(%rbp)
movl   $0x1,-0x24(%rbp)
cmpl   $0x65,-0x24(%rbp)
jge    122b <main+0xfb>
mov    -0x24(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1197 <main+0x67>
lea    -0x1a(%rbp),%rdi
movslq -0x20(%rbp),%rax
add    %rax,%rdi
lea    0xe7c(%rip),%rsi
mov    $0x4,%edx
call   1040 <memcpy@plt>
mov    -0x20(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x20(%rbp)
mov    -0x24(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11d0 <main+0xa0>
lea    -0x1a(%rbp),%rdi
movslq -0x20(%rbp),%rax
add    %rax,%rdi
lea    0xe48(%rip),%rsi
mov    $0x4,%edx
call   1040 <memcpy@plt>
mov    -0x20(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jne    11f2 <main+0xc2>
lea    -0x1a(%rbp),%rdi
mov    -0x24(%rbp),%edx
lea    0xe22(%rip),%rsi
call   1050 <sprintf@plt>
jmp    120d <main+0xdd>
mov    -0x20(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x20(%rbp)
cltq
movb   $0xa,-0x1a(%rbp,%rax,1)
movslq -0x20(%rbp),%rax
movb   $0x0,-0x1a(%rbp,%rax,1)
lea    -0x1a(%rbp),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1154 <main+0x24>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    $0x1,%ebx
lea    0xe(%rsp),%r15
lea    0xeb6(%rip),%r12
lea    0xeb4(%rip),%r13
jmp    1195 <main+0x65>
nopl   0x0(%rax,%rax,1)
xor    %ebp,%ebp
mov    %ebp,%eax
lea    (%rsp,%rax,1),%rdi
add    $0xe,%rdi
mov    %r12,%rsi
mov    $0x4,%edx
call   1040 <memcpy@plt>
add    $0x4,%ebp
mov    %ebp,%eax
movw   $0xa,0xe(%rsp,%rax,1)
mov    %r15,%rdi
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x65,%ebx
je     11f3 <main+0xc3>
movzbl %bl,%eax
imul   $0xcd,%eax,%ecx
shr    $0xa,%ecx
lea    (%rcx,%rcx,4),%r14d
neg    %r14d
imul   $0xab,%eax,%ecx
shr    $0x9,%ecx
lea    (%rcx,%rcx,2),%ecx
neg    %ecx
add    %cl,%al
je     11d0 <main+0xa0>
add    %bl,%r14b
je     1160 <main+0x30>
mov    %r15,%rdi
mov    %r13,%rsi
mov    %ebx,%edx
call   1050 <sprintf@plt>
jmp    1185 <main+0x55>
xchg   %ax,%ax
mov    $0x4,%ebp
mov    %r15,%rdi
lea    0xe21(%rip),%rsi
mov    $0x4,%edx
call   1040 <memcpy@plt>
add    %bl,%r14b
jne    117c <main+0x4c>
jmp    1162 <main+0x32>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"fizz\00"
@.str.1 = [5 x i8] c"buzz\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [10 x i8]
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
br label %6
5: ; preds = %33
ret i32 0
6: ; preds = %2, %33
%7 = phi i32 [ 1, %2 ], [ %35, %33 ]
%8 = trunc i32 %7 to i8
%9 = urem i8 %8, 3
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %6
%12 = call i32 @memcpy(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%13 = urem i8 %8, 5
%14 = icmp eq i8 %13, 0
br i1 %14, label %18, label %26
15: ; preds = %6
%16 = urem i8 %8, 5
%17 = icmp eq i8 %16, 0
br i1 %17, label %18, label %24
18: ; preds = %15, %11
%19 = phi i32 [ 0, %15 ], [ 4, %11 ]
%20 = zext i32 %19 to i64
%21 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 %20
%22 = call i32 @memcpy(i8* %21, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%23 = add nuw nsw i32 %19, 4
br label %26
24: ; preds = %15
%25 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %7)
br label %33
26: ; preds = %11, %18
%27 = phi i32 [ %23, %18 ], [ 4, %11 ]
%28 = add nuw nsw i32 %27, 1
%29 = zext i32 %27 to i64
%30 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 %29
store i8 10, i8* %30
%31 = zext i32 %28 to i64
%32 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 %31
store i8 0, i8* %32
br label %33
33: ; preds = %26, %24
%34 = call i32 @printf(i8* %4)
%35 = add nuw nsw i32 %7, 1
%36 = icmp eq i32 %35, 101
br i1 %36, label %5, label %6
}