#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 i, s = 0;
  for (i = 0; i < 1000; i++) {
    if (i % 3 == 0 || i % 5 == 0) {
      s += i;
    }
  }
  printf("%d\n", s);
  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,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x3e8,-0x14(%rbp)
jge    1185 <main+0x75>
mov    -0x14(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1169 <main+0x59>
mov    -0x14(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1172 <main+0x62>
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1177 <main+0x67>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1134 <main+0x24>
mov    -0x18(%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
movdqa 0xeee(%rip),%xmm1
pxor   %xmm2,%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   %xmm6,%xmm6
pxor   %xmm4,%xmm4
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 %xmm2,%xmm5
movdqa %xmm8,%xmm7
pmullw %xmm11,%xmm7
movdqa %xmm7,%xmm9
psubusw %xmm3,%xmm9
pcmpeqw %xmm2,%xmm9
por    %xmm5,%xmm9
paddw  %xmm10,%xmm0
psubusw %xmm15,%xmm0
pcmpeqw %xmm2,%xmm0
paddw  %xmm12,%xmm7
psubusw %xmm3,%xmm7
pcmpeqw %xmm2,%xmm7
por    %xmm0,%xmm7
movdqa %xmm1,%xmm0
paddd  0xe3d(%rip),%xmm0
punpcklwd %xmm7,%xmm5
psrad  $0x10,%xmm5
pand   %xmm0,%xmm5
paddd  %xmm5,%xmm4
punpcklwd %xmm9,%xmm0
psrad  $0x10,%xmm0
pand   %xmm1,%xmm0
paddd  %xmm0,%xmm6
paddd  %xmm13,%xmm1
paddw  %xmm14,%xmm8
add    $0xfffffff8,%eax
jne    1180 <main+0x70>
paddd  %xmm6,%xmm4
pshufd $0xee,%xmm4,%xmm0
paddd  %xmm4,%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* %7
store i32 0, i32* %6
br label %8
8: ; preds = %24, %2
%9 = load i32, i32* %6
%10 = icmp slt i32 %9, 1000
br i1 %10, label %11, label %27
11: ; preds = %8
%12 = load i32, i32* %6
%13 = srem i32 %12, 3
%14 = icmp eq i32 %13, 0
br i1 %14, label %19, label %15
15: ; preds = %11
%16 = load i32, i32* %6
%17 = srem i32 %16, 5
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %15, %11
%20 = load i32, i32* %6
%21 = load i32, i32* %7
%22 = add nsw i32 %21, %20
store i32 %22, i32* %7
br label %23
23: ; preds = %19, %15
br label %24
24: ; preds = %23
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
store i32 %26, i32* %6
br label %8
27: ; preds = %8
%28 = load i32, i32* %7
%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> [ zeroinitializer, %2 ], [ %23, %3 ]
%6 = phi <4 x i32> [ zeroinitializer, %2 ], [ %24, %3 ]
%7 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %2 ], [ %26, %3 ]
%8 = phi <4 x i16> [ <i16 0, i16 1, i16 2, i16 3>, %2 ], [ %27, %3 ]
%9 = add <4 x i32> %7, <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 3, i16 3, i16 3, i16 3>
%12 = urem <4 x i16> %10, <i16 3, i16 3, i16 3, i16 3>
%13 = icmp eq <4 x i16> %11, zeroinitializer
%14 = icmp eq <4 x i16> %12, zeroinitializer
%15 = urem <4 x i16> %8, <i16 5, i16 5, i16 5, i16 5>
%16 = urem <4 x i16> %10, <i16 5, i16 5, i16 5, i16 5>
%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> %7, <4 x i32> zeroinitializer
%22 = select <4 x i1> %20, <4 x i32> %9, <4 x i32> zeroinitializer
%23 = add <4 x i32> %21, %5
%24 = add <4 x i32> %22, %6
%25 = add nuw i32 %4, 8
%26 = add <4 x i32> %7, <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
}