#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, char *argv[]) {
  int sum;
  int i;
  for (sum = 0, i = 1; i < 1000; ++i)
    sum += i * (((i % 5) == 0) || ((i % 3) == 0));
  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   $0x1,-0x18(%rbp)
cmpl   $0x3e8,-0x18(%rbp)
jge    1197 <main+0x87>
mov    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    $0x1,%al
cmp    $0x0,%edx
mov    %al,-0x19(%rbp)
je     1174 <main+0x64>
mov    -0x18(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x19(%rbp),%cl
and    $0x1,%cl
movzbl %cl,%ecx
imul   %ecx,%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1134 <main+0x24>
mov    -0x14(%rbp),%esi
lea    0xe5f(%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    $0x3e0,%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
add    $0xf8f,%esi
lea    0xe70(%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 1, i32* %7
br label %8
8: ; preds = %26, %2
%9 = load i32, i32* %7
%10 = icmp slt i32 %9, 1000
br i1 %10, label %11, label %29
11: ; preds = %8
%12 = load i32, i32* %7
%13 = load i32, i32* %7
%14 = srem i32 %13, 5
%15 = icmp eq i32 %14, 0
br i1 %15, label %20, label %16
16: ; preds = %11
%17 = load i32, i32* %7
%18 = srem i32 %17, 3
%19 = icmp eq i32 %18, 0
br label %20
20: ; preds = %16, %11
%21 = phi i1 [ true, %11 ], [ %19, %16 ]
%22 = zext i1 %21 to i32
%23 = mul nsw i32 %12, %22
%24 = load i32, i32* %6
%25 = add nsw i32 %24, %23
store i32 %25, i32* %6
br label %26
26: ; preds = %20
%27 = load i32, i32* %7
%28 = add nsw i32 %27, 1
store i32 %28, i32* %7
br label %8
29: ; preds = %8
%30 = load i32, i32* %6
%31 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %30)
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 1, i32 2, i32 3, i32 4>, %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 1, i16 2, i16 3, i16 4>, %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, 992
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 = add nuw nsw i32 %31, 3983
%33 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %32)
ret i32 0
}