#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 = 0;
  for (int number = 1; number < 1000; number++) {
    if ((number % 3 == 0) || (number % 5 == 0) && !(number % 15 == 0)) {
      sum += number;
    }
  }
  printf("%i\n", sum);
}


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    1199 <main+0x89>
mov    -0x18(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     117d <main+0x6d>
mov    -0x18(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1186 <main+0x76>
mov    -0x18(%rbp),%eax
mov    $0xf,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1186 <main+0x76>
mov    -0x18(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    118b <main+0x7b>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1134 <main+0x24>
mov    -0x14(%rbp),%esi
lea    0xe5d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movdqa 0xee6(%rip),%xmm12
pxor   %xmm13,%xmm13
movdqa 0xee9(%rip),%xmm2
mov    $0x3e0,%eax
movdqa 0xf0c(%rip),%xmm5
movdqa 0xf13(%rip),%xmm14
movdqa 0xf3a(%rip),%xmm15
movdqa 0xf62(%rip),%xmm7
movdqa 0xf89(%rip),%xmm8
pxor   %xmm9,%xmm9
pxor   %xmm3,%xmm3
movdqa %xmm12,%xmm0
pmullw 0xec3(%rip),%xmm0
movdqa %xmm12,%xmm11
pmullw 0xef5(%rip),%xmm11
movdqa %xmm11,%xmm10
pxor   %xmm5,%xmm10
pcmpgtw %xmm15,%xmm10
punpcklwd %xmm10,%xmm1
movdqa %xmm12,%xmm4
pmullw 0xf04(%rip),%xmm4
movdqa %xmm4,%xmm6
psubusw %xmm7,%xmm6
pcmpeqw %xmm13,%xmm6
punpcklwd %xmm6,%xmm6
por    %xmm1,%xmm6
movdqa %xmm0,%xmm1
pxor   %xmm5,%xmm1
pcmpgtw %xmm14,%xmm1
punpcklwd %xmm1,%xmm1
pand   %xmm1,%xmm6
paddw  0xec1(%rip),%xmm11
pxor   %xmm5,%xmm11
pcmpgtw %xmm15,%xmm11
punpcklwd %xmm11,%xmm1
paddw  0xeda(%rip),%xmm4
psubusw %xmm7,%xmm4
pcmpeqw %xmm13,%xmm4
punpcklwd %xmm4,%xmm4
por    %xmm1,%xmm4
paddw  0xe61(%rip),%xmm0
pxor   %xmm5,%xmm0
pcmpgtw %xmm14,%xmm0
punpcklwd %xmm0,%xmm0
pand   %xmm0,%xmm4
movdqa %xmm2,%xmm0
paddd  0xe04(%rip),%xmm0
psrad  $0x10,%xmm4
pandn  %xmm0,%xmm4
paddd  %xmm4,%xmm3
psrad  $0x10,%xmm6
pandn  %xmm2,%xmm6
paddd  %xmm6,%xmm9
paddd  0xe91(%rip),%xmm2
paddw  %xmm8,%xmm12
add    $0xfffffff8,%eax
jne    1160 <main+0x50>
paddd  %xmm9,%xmm3
pshufd $0xee,%xmm3,%xmm0
paddd  %xmm3,%xmm0
pshufd $0x55,%xmm0,%xmm1
paddd  %xmm0,%xmm1
movd   %xmm1,%esi
add    $0xf8f,%esi
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%i\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i32 [ 0, %2 ], [ %31, %3 ]
%5 = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %2 ], [ %32, %3 ]
%6 = phi <4 x i32> [ zeroinitializer, %2 ], [ %28, %3 ]
%7 = phi <4 x i32> [ zeroinitializer, %2 ], [ %30, %3 ]
%8 = phi <4 x i16> [ <i16 1, i16 2, i16 3, i16 4>, %2 ], [ %33, %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 3, i16 3, i16 3, i16 3>
%12 = urem <4 x i16> %10, <i16 3, i16 3, i16 3, i16 3>
%13 = icmp ne <4 x i16> %11, zeroinitializer
%14 = icmp ne <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 ne <4 x i16> %15, zeroinitializer
%18 = icmp ne <4 x i16> %16, zeroinitializer
%19 = urem <4 x i16> %8, <i16 15, i16 15, i16 15, i16 15>
%20 = urem <4 x i16> %10, <i16 15, i16 15, i16 15, i16 15>
%21 = icmp eq <4 x i16> %19, zeroinitializer
%22 = icmp eq <4 x i16> %20, zeroinitializer
%23 = or <4 x i1> %17, %21
%24 = or <4 x i1> %18, %22
%25 = select <4 x i1> %13, <4 x i1> %23, <4 x i1> zeroinitializer
%26 = select <4 x i1> %14, <4 x i1> %24, <4 x i1> zeroinitializer
%27 = select <4 x i1> %25, <4 x i32> zeroinitializer, <4 x i32> %5
%28 = add <4 x i32> %6, %27
%29 = select <4 x i1> %26, <4 x i32> zeroinitializer, <4 x i32> %9
%30 = add <4 x i32> %7, %29
%31 = add nuw i32 %4, 8
%32 = add <4 x i32> %5, <i32 8, i32 8, i32 8, i32 8>
%33 = add <4 x i16> %8, <i16 8, i16 8, i16 8, i16 8>
%34 = icmp eq i32 %31, 992
br i1 %34, label %35, label %3
35: ; preds = %3
%36 = add <4 x i32> %30, %28
%37 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %36)
%38 = add nsw i32 %37, 993
%39 = add nsw i32 %38, 995
%40 = add nsw i32 %39, 996
%41 = add nsw i32 %40, 999
%42 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %41)
ret i32 0
}