#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(void) {
  int i;
  int sum = 0;
  for (i = 3; i < 1000; i += 3)
    sum += i;
  for (i = 5; i < 1000; i += 5)
    sum += i;
  for (i = 15; i < 1000; i += 15)
    sum -= 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,-0xc(%rbp)
movl   $0x3,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jge    1151 <main+0x41>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x8(%rbp)
jmp    112d <main+0x1d>
movl   $0x5,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jge    117c <main+0x6c>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0x8(%rbp)
jmp    1158 <main+0x48>
movl   $0xf,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jge    11a9 <main+0x99>
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0xf,%eax
mov    %eax,-0x8(%rbp)
jmp    1183 <main+0x73>
mov    -0xc(%rbp),%esi
lea    0xe4d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x38ed0,%esi
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* %3
store i32 3, i32* %2
br label %4
4: ; preds = %11, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 1000
br i1 %6, label %7, label %14
7: ; preds = %4
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = add nsw i32 %9, %8
store i32 %10, i32* %3
br label %11
11: ; preds = %7
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 3
store i32 %13, i32* %2
br label %4
14: ; preds = %4
store i32 5, i32* %2
br label %15
15: ; preds = %22, %14
%16 = load i32, i32* %2
%17 = icmp slt i32 %16, 1000
br i1 %17, label %18, label %25
18: ; preds = %15
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = add nsw i32 %20, %19
store i32 %21, i32* %3
br label %22
22: ; preds = %18
%23 = load i32, i32* %2
%24 = add nsw i32 %23, 5
store i32 %24, i32* %2
br label %15
25: ; preds = %15
store i32 15, i32* %2
br label %26
26: ; preds = %33, %25
%27 = load i32, i32* %2
%28 = icmp slt i32 %27, 1000
br i1 %28, label %29, label %36
29: ; preds = %26
%30 = load i32, i32* %2
%31 = load i32, i32* %3
%32 = sub nsw i32 %31, %30
store i32 %32, i32* %3
br label %33
33: ; preds = %29
%34 = load i32, i32* %2
%35 = add nsw i32 %34, 15
store i32 %35, i32* %2
br label %26
36: ; preds = %26
%37 = load i32, i32* %3
%38 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %37)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 233168)
ret i32 0
}