#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 *, int);
int main() {
  int num = 1, count = 0;
  while (num <= 1000) {
    if (num % 5 == 0) {
      count++;
    }
    num++;
  }
  printf("There are %d numbers between 1 and 1000 that are multiples of 5. \n",
         count);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jg     1165 <main+0x55>
mov    -0x8(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1157 <main+0x47>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112d <main+0x1d>
mov    -0xc(%rbp),%esi
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movdqa 0xee7(%rip),%xmm2
pxor   %xmm1,%xmm1
mov    $0x3e8,%eax
movdqa 0xee5(%rip),%xmm8
movdqa 0xeed(%rip),%xmm3
movdqa 0xef5(%rip),%xmm5
movdqa 0xefc(%rip),%xmm9
movdqa 0xf03(%rip),%xmm10
pxor   %xmm7,%xmm7
pxor   %xmm4,%xmm4
cs nopw 0x0(%rax,%rax,1)
nop
movdqa %xmm2,%xmm6
pmullw %xmm8,%xmm6
movdqa %xmm6,%xmm0
psubusw %xmm3,%xmm0
pcmpeqw %xmm1,%xmm0
punpcklwd %xmm0,%xmm0
pand   %xmm5,%xmm0
paddd  %xmm0,%xmm7
paddw  %xmm9,%xmm6
psubusw %xmm3,%xmm6
pcmpeqw %xmm1,%xmm6
punpcklwd %xmm6,%xmm6
pand   %xmm5,%xmm6
paddd  %xmm6,%xmm4
paddw  %xmm10,%xmm2
add    $0xfffffff8,%eax
jne    1160 <main+0x50>
paddd  %xmm7,%xmm4
pshufd $0xee,%xmm4,%xmm0
paddd  %xmm4,%xmm0
pshufd $0x55,%xmm0,%xmm1
paddd  %xmm0,%xmm1
movd   %xmm1,%esi
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [67 x i8] c"There are %d numbers between 1 and 1000 that are multiples of 5. \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %14, %0
%5 = load i32, i32* %2
%6 = icmp sle i32 %5, 1000
br i1 %6, label %7, label %17
7: ; preds = %4
%8 = load i32, i32* %2
%9 = srem i32 %8, 5
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
br label %14
14: ; preds = %11, %7
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %4
17: ; preds = %4
%18 = load i32, i32* %3
%19 = call i32 @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0), i32 %18)
ret i32 0
}

LLVM IR (-O2):
@.str = [67 x i8] c"There are %d numbers between 1 and 1000 that are multiples of 5. \0A\00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = phi i32 [ 0, %0 ], [ %15, %1 ]
%3 = phi <4 x i32> [ zeroinitializer, %0 ], [ %13, %1 ]
%4 = phi <4 x i32> [ zeroinitializer, %0 ], [ %14, %1 ]
%5 = phi <4 x i16> [ <i16 1, i16 2, i16 3, i16 4>, %0 ], [ %16, %1 ]
%6 = add <4 x i16> %5, <i16 4, i16 4, i16 4, i16 4>
%7 = urem <4 x i16> %5, <i16 5, i16 5, i16 5, i16 5>
%8 = urem <4 x i16> %6, <i16 5, i16 5, i16 5, i16 5>
%9 = icmp eq <4 x i16> %7, zeroinitializer
%10 = icmp eq <4 x i16> %8, zeroinitializer
%11 = zext <4 x i1> %9 to <4 x i32>
%12 = zext <4 x i1> %10 to <4 x i32>
%13 = add <4 x i32> %3, %11
%14 = add <4 x i32> %4, %12
%15 = add nuw i32 %2, 8
%16 = add <4 x i16> %5, <i16 8, i16 8, i16 8, i16 8>
%17 = icmp eq i32 %15, 1000
br i1 %17, label %18, label %1
18: ; preds = %1
%19 = add <4 x i32> %14, %13
%20 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %19)
%21 = tail call i32 @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0), i32 %20)
ret i32 0
}