main(i) {
  while (i < 101)
    printf("%d\r%s%s\n", i, i % 3 ? "" : "Fizz", i++ % 5 ? "" : "Buzz");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
cmpl   $0x65,-0x8(%rbp)
jge    1194 <main+0x84>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
lea    0xec8(%rip),%rax
lea    0xec0(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
mov    -0x10(%rbp),%rdx
lea    0xe9b(%rip),%rcx
lea    0xe8e(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%rcx
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1122 <main+0x12>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
cmp    $0x64,%edi
jg     1186 <main+0x76>
mov    %edi,%esi
lea    0xee3(%rip),%r14
lea    0xedb(%rip),%r15
lea    0xeda(%rip),%r12
lea    0xec5(%rip),%rbx
jmp    1151 <main+0x41>
nopl   (%rax)
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebp,%esi
cmp    $0x65,%ebp
je     1186 <main+0x76>
imul   $0xaaaaaaab,%esi,%eax
add    $0x2aaaaaaa,%eax
mov    %r14,%rdx
cmp    $0x55555555,%eax
jb     1169 <main+0x59>
mov    %r15,%rdx
lea    0x1(%rsi),%ebp
imul   $0xcccccccd,%esi,%eax
add    $0x19999999,%eax
mov    %r12,%rcx
cmp    $0x33333333,%eax
jb     1140 <main+0x30>
mov    %r15,%rcx
jmp    1140 <main+0x30>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%d\0D%s%s\0A\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [5 x i8] c"Fizz\00"
@.str.3 = [5 x i8] c"Buzz\00"
define i32 @main(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %2
store i32 %0, i32* %3
br label %4
4: ; preds = %7, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 101
br i1 %6, label %7, label %21
7: ; preds = %4
%8 = load i32, i32* %3
%9 = load i32, i32* %3
%10 = srem i32 %9, 3
%11 = icmp ne i32 %10, 0
%12 = zext i1 %11 to i64
%13 = select i1 %11, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 1
store i32 %15, i32* %3
%16 = srem i32 %14, 5
%17 = icmp ne i32 %16, 0
%18 = zext i1 %17 to i64
%19 = select i1 %17, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %8, i8* %13, i8* %19)
br label %4
21: ; preds = %4
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
@.str = [9 x i8] c"%d\0D%s%s\0A\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [5 x i8] c"Fizz\00"
@.str.3 = [5 x i8] c"Buzz\00"
define i32 @main(i32 %0) {
%2 = icmp slt i32 %0, 101
br i1 %2, label %3, label %14
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ %0, %1 ]
%5 = srem i32 %4, 3
%6 = icmp eq i32 %5, 0
%7 = select i1 %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0)
%8 = add i32 %4, 1
%9 = srem i32 %4, 5
%10 = icmp eq i32 %9, 0
%11 = select i1 %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %4, i8* %7, i8* %11)
%13 = icmp eq i32 %8, 101
br i1 %13, label %14, label %3
14: ; preds = %3, %1
ret i32 0
}