#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 i, sum;
  for (i = 0, sum = 0; i != 1000; i++) {
    sum += (i % 3 == 0 || i % 5 == 0) * i;
  }
  printf("%d\n", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
je     1187 <main+0x77>
mov    -0x8(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    $0x1,%al
cmp    $0x0,%edx
mov    %al,-0xd(%rbp)
je     1167 <main+0x57>
mov    -0x8(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
sete   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
imul   -0x8(%rbp),%eax
add    -0xc(%rbp),%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    0xe6f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movdqa 0xee6(%rip),%xmm8
pxor   %xmm0,%xmm0
mov    $0x3e8,%eax
movdqa 0xef4(%rip),%xmm10
movdqa 0xefc(%rip),%xmm4
movdqa 0xf03(%rip),%xmm13
pcmpeqd %xmm6,%xmm6
movdqa 0xf06(%rip),%xmm9
movdqa 0xf0d(%rip),%xmm14
movdqa 0xf14(%rip),%xmm15
movdqa 0xf1b(%rip),%xmm11
movdqa 0xf22(%rip),%xmm12
pxor   %xmm7,%xmm7
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movdqa %xmm8,%xmm5
pmuludq %xmm10,%xmm5
pshufd $0xe8,%xmm5,%xmm5
pshufd $0xf5,%xmm8,%xmm3
movdqa %xmm3,%xmm2
pmuludq %xmm10,%xmm2
pshufd $0xe8,%xmm2,%xmm2
punpckldq %xmm2,%xmm5
movdqa %xmm5,%xmm2
pxor   %xmm4,%xmm2
pcmpgtd %xmm13,%xmm2
pxor   %xmm6,%xmm2
movdqa %xmm8,%xmm1
pmuludq %xmm14,%xmm1
pshufd $0xe8,%xmm1,%xmm1
pmuludq %xmm14,%xmm3
pshufd $0xe8,%xmm3,%xmm3
punpckldq %xmm3,%xmm1
movdqa %xmm1,%xmm3
pxor   %xmm4,%xmm3
pcmpgtd %xmm15,%xmm3
pxor   %xmm6,%xmm3
por    %xmm2,%xmm3
paddd  %xmm9,%xmm5
pxor   %xmm4,%xmm5
pcmpgtd %xmm13,%xmm5
pxor   %xmm6,%xmm5
paddd  %xmm11,%xmm1
pxor   %xmm4,%xmm1
pcmpgtd %xmm15,%xmm1
pxor   %xmm6,%xmm1
por    %xmm5,%xmm1
movdqa %xmm8,%xmm2
paddd  0xdf1(%rip),%xmm2
pand   %xmm2,%xmm1
paddd  %xmm1,%xmm7
pand   %xmm8,%xmm3
paddd  %xmm3,%xmm0
paddd  %xmm12,%xmm8
add    $0xfffffff8,%eax
jne    1180 <main+0x70>
paddd  %xmm0,%xmm7
pshufd $0xee,%xmm7,%xmm0
paddd  %xmm7,%xmm0
pshufd $0x55,%xmm0,%xmm1
paddd  %xmm0,%xmm1
movd   %xmm1,%esi
lea    0xe41(%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() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %22, %0
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 1000
br i1 %6, label %7, label %25
7: ; preds = %4
%8 = load i32, i32* %2
%9 = srem i32 %8, 3
%10 = icmp eq i32 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %7
%12 = load i32, i32* %2
%13 = srem i32 %12, 5
%14 = icmp eq i32 %13, 0
br label %15
15: ; preds = %11, %7
%16 = phi i1 [ true, %7 ], [ %14, %11 ]
%17 = zext i1 %16 to i32
%18 = load i32, i32* %2
%19 = mul nsw i32 %17, %18
%20 = load i32, i32* %3
%21 = add nsw i32 %20, %19
store i32 %21, i32* %3
br label %22
22: ; preds = %15
%23 = load i32, i32* %2
%24 = add nsw i32 %23, 1
store i32 %24, i32* %2
br label %4
25: ; preds = %4
%26 = load i32, i32* %3
%27 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %26)
ret i32 0
}

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