#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 *, unsigned long);
int main(void) {
  unsigned long sum = 0;
  unsigned int i = 0;
  while (++i < 1000)
    if (!(i % 3) || !(i % 5))
      sum += i;
  printf("%lu\n", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmp    $0x3e8,%eax
jae    117c <main+0x6c>
mov    -0x14(%rbp),%eax
mov    $0x3,%ecx
xor    %edx,%edx
div    %ecx
cmp    $0x0,%edx
je     116c <main+0x5c>
mov    -0x14(%rbp),%eax
mov    $0x5,%ecx
xor    %edx,%edx
div    %ecx
cmp    $0x0,%edx
jne    1177 <main+0x67>
mov    -0x14(%rbp),%eax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    112e <main+0x1e>
mov    -0x10(%rbp),%rsi
lea    0xe79(%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    $0x3e4,%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
punpcklwd %xmm9,%xmm5
paddw  %xmm12,%xmm4
psubusw %xmm3,%xmm4
pcmpeqw %xmm1,%xmm4
por    %xmm0,%xmm4
punpcklwd %xmm4,%xmm0
pxor   %xmm4,%xmm4
pcmpgtd %xmm5,%xmm4
psrad  $0x10,%xmm5
punpckldq %xmm4,%xmm5
pxor   %xmm4,%xmm4
pcmpgtd %xmm0,%xmm4
psrad  $0x10,%xmm0
punpckldq %xmm4,%xmm0
movdqa %xmm2,%xmm4
paddq  0xe12(%rip),%xmm4
pand   %xmm4,%xmm0
paddq  %xmm0,%xmm6
pand   %xmm2,%xmm5
paddq  %xmm5,%xmm7
paddq  %xmm13,%xmm2
paddw  %xmm14,%xmm8
add    $0xfffffffffffffffc,%rax
jne    1180 <main+0x70>
paddq  %xmm7,%xmm6
pshufd $0xee,%xmm6,%xmm0
paddq  %xmm6,%xmm0
movq   %xmm0,%rsi
add    $0x3e7,%rsi
lea    0xe5e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%lu\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i32
store i32 0, i32* %1
store i64 0, i64* %2
store i32 0, i32* %3
br label %4
4: ; preds = %21, %0
%5 = load i32, i32* %3
%6 = add i32 %5, 1
store i32 %6, i32* %3
%7 = icmp ult i32 %6, 1000
br i1 %7, label %8, label %22
8: ; preds = %4
%9 = load i32, i32* %3
%10 = urem i32 %9, 3
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %8
%13 = load i32, i32* %3
%14 = urem i32 %13, 5
%15 = icmp ne i32 %14, 0
br i1 %15, label %21, label %16
16: ; preds = %12, %8
%17 = load i32, i32* %3
%18 = zext i32 %17 to i64
%19 = load i64, i64* %2
%20 = add i64 %19, %18
store i64 %20, i64* %2
br label %21
21: ; preds = %16, %12
br label %4
22: ; preds = %4
%23 = load i64, i64* %2
%24 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %23)
ret i32 0
}

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