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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x28bb1,-0x8(%rbp)
movl   $0x5,-0xc(%rbp)
cmpl   $0x3e8,-0xc(%rbp)
jge    116a <main+0x5a>
mov    -0xc(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1157 <main+0x47>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    115c <main+0x4c>
mov    -0xc(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0xc(%rbp)
jmp    112d <main+0x1d>
mov    -0x8(%rbp),%esi
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movdqa 0xee7(%rip),%xmm2
pxor   %xmm13,%xmm13
movdqa 0xeea(%rip),%xmm0
movdqa 0xef2(%rip),%xmm3
mov    $0xc0,%eax
movdqa 0xef4(%rip),%xmm8
movdqa 0xefb(%rip),%xmm9
movdqa 0xf03(%rip),%xmm6
movdqa 0xf0a(%rip),%xmm10
movdqa 0xf11(%rip),%xmm11
movdqa 0xf18(%rip),%xmm12
pxor   %xmm4,%xmm4
nopl   0x0(%rax)
movdqa %xmm3,%xmm5
paddd  %xmm8,%xmm5
movdqa %xmm2,%xmm7
pmullw %xmm9,%xmm7
movdqa %xmm7,%xmm1
psubusw %xmm6,%xmm1
pcmpeqw %xmm13,%xmm1
punpcklwd %xmm1,%xmm1
psrad  $0x10,%xmm1
paddw  %xmm10,%xmm7
psubusw %xmm6,%xmm7
pcmpeqw %xmm13,%xmm7
punpcklwd %xmm7,%xmm7
psrad  $0x10,%xmm7
pandn  %xmm5,%xmm7
paddd  %xmm7,%xmm4
pandn  %xmm3,%xmm1
paddd  %xmm1,%xmm0
paddd  %xmm11,%xmm3
paddw  %xmm12,%xmm2
add    $0xfffffff8,%eax
jne    1170 <main+0x60>
paddd  %xmm0,%xmm4
pshufd $0xee,%xmm4,%xmm0
paddd  %xmm4,%xmm0
pshufd $0x55,%xmm0,%xmm1
paddd  %xmm0,%xmm1
movd   %xmm1,%esi
add    $0x131f,%esi
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

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