#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 argc, const char *argv[]) {
  int sum = 0;
  int i;
  for (i = 0; i < 1000; i++) {
    if (i % 5 == 0 || i % 3 == 0)
      sum += i;
  }
  printf("%d\n", sum);
  return 0;
}


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)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x3e8,-0x18(%rbp)
jge    1185 <main+0x75>
mov    -0x18(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1169 <main+0x59>
mov    -0x18(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1172 <main+0x62>
mov    -0x18(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1177 <main+0x67>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1134 <main+0x24>
mov    -0x14(%rbp),%esi
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movdqa 0xee6(%rip),%xmm8
pxor   %xmm1,%xmm1
movdqa 0xeea(%rip),%xmm2
mov    $0x3e8,%eax
movdqa 0xf0c(%rip),%xmm15
movdqa 0xf13(%rip),%xmm10
movdqa 0xf1a(%rip),%xmm11
movdqa 0xf22(%rip),%xmm3
movdqa 0xf29(%rip),%xmm12
movdqa 0xf30(%rip),%xmm13
movdqa 0xf37(%rip),%xmm14
pxor   %xmm7,%xmm7
pxor   %xmm6,%xmm6
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movdqa %xmm8,%xmm0
pmullw 0xea3(%rip),%xmm0
movdqa %xmm0,%xmm5
psubusw %xmm15,%xmm5
pcmpeqw %xmm1,%xmm5
movdqa %xmm8,%xmm4
pmullw %xmm11,%xmm4
movdqa %xmm4,%xmm9
psubusw %xmm3,%xmm9
pcmpeqw %xmm1,%xmm9
por    %xmm5,%xmm9
paddw  %xmm10,%xmm0
psubusw %xmm15,%xmm0
pcmpeqw %xmm1,%xmm0
paddw  %xmm12,%xmm4
psubusw %xmm3,%xmm4
pcmpeqw %xmm1,%xmm4
por    %xmm0,%xmm4
movdqa %xmm2,%xmm0
paddd  0xe3d(%rip),%xmm0
punpcklwd %xmm4,%xmm4
psrad  $0x10,%xmm4
pand   %xmm0,%xmm4
paddd  %xmm4,%xmm6
punpcklwd %xmm9,%xmm0
psrad  $0x10,%xmm0
pand   %xmm2,%xmm0
paddd  %xmm0,%xmm7
paddd  %xmm13,%xmm2
paddw  %xmm14,%xmm8
add    $0xfffffff8,%eax
jne    1180 <main+0x70>
paddd  %xmm7,%xmm6
pshufd $0xee,%xmm6,%xmm0
paddd  %xmm6,%xmm0
pshufd $0x55,%xmm0,%xmm1
paddd  %xmm0,%xmm1
movd   %xmm1,%esi
lea    0xe76(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [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 i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
br label %8
8: ; preds = %24, %2
%9 = load i32, i32* %7
%10 = icmp slt i32 %9, 1000
br i1 %10, label %11, label %27
11: ; preds = %8
%12 = load i32, i32* %7
%13 = srem i32 %12, 5
%14 = icmp eq i32 %13, 0
br i1 %14, label %19, label %15
15: ; preds = %11
%16 = load i32, i32* %7
%17 = srem i32 %16, 3
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %15, %11
%20 = load i32, i32* %7
%21 = load i32, i32* %6
%22 = add nsw i32 %21, %20
store i32 %22, i32* %6
br label %23
23: ; preds = %19, %15
br label %24
24: ; preds = %23
%25 = load i32, i32* %7
%26 = add nsw i32 %25, 1
store i32 %26, i32* %7
br label %8
27: ; preds = %8
%28 = load i32, i32* %6
%29 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %28)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i32 [ 0, %2 ], [ %25, %3 ]
%5 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %2 ], [ %26, %3 ]
%6 = phi <4 x i32> [ zeroinitializer, %2 ], [ %23, %3 ]
%7 = phi <4 x i32> [ zeroinitializer, %2 ], [ %24, %3 ]
%8 = phi <4 x i16> [ <i16 0, i16 1, i16 2, i16 3>, %2 ], [ %27, %3 ]
%9 = add <4 x i32> %5, <i32 4, i32 4, i32 4, i32 4>
%10 = add <4 x i16> %8, <i16 4, i16 4, i16 4, i16 4>
%11 = urem <4 x i16> %8, <i16 5, i16 5, i16 5, i16 5>
%12 = urem <4 x i16> %10, <i16 5, i16 5, i16 5, i16 5>
%13 = icmp eq <4 x i16> %11, zeroinitializer
%14 = icmp eq <4 x i16> %12, zeroinitializer
%15 = urem <4 x i16> %8, <i16 3, i16 3, i16 3, i16 3>
%16 = urem <4 x i16> %10, <i16 3, i16 3, i16 3, i16 3>
%17 = icmp eq <4 x i16> %15, zeroinitializer
%18 = icmp eq <4 x i16> %16, zeroinitializer
%19 = or <4 x i1> %13, %17
%20 = or <4 x i1> %14, %18
%21 = select <4 x i1> %19, <4 x i32> %5, <4 x i32> zeroinitializer
%22 = select <4 x i1> %20, <4 x i32> %9, <4 x i32> zeroinitializer
%23 = add <4 x i32> %21, %6
%24 = add <4 x i32> %22, %7
%25 = add nuw i32 %4, 8
%26 = add <4 x i32> %5, <i32 8, i32 8, i32 8, i32 8>
%27 = add <4 x i16> %8, <i16 8, i16 8, i16 8, i16 8>
%28 = icmp eq i32 %25, 1000
br i1 %28, label %29, label %3
29: ; preds = %3
%30 = add <4 x i32> %24, %23
%31 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %30)
%32 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %31)
ret i32 0
}