#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 threes, fives, fifteens;
  int sum = 0;
  for (threes = 3; threes < 1000; threes = threes + 3) {
    sum = sum + threes;
  }
  for (fives = 5; fives < 1000; fives = fives + 5) {
    sum = sum + fives;
  }
  for (fifteens = 15; fifteens < 1000; fifteens = fifteens + 15) {
    sum = sum - fifteens;
  }
  printf("%i", sum);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x3,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jge    1151 <main+0x41>
mov    -0x14(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x8(%rbp)
jmp    112d <main+0x1d>
movl   $0x5,-0xc(%rbp)
cmpl   $0x3e8,-0xc(%rbp)
jge    117c <main+0x6c>
mov    -0x14(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0xc(%rbp)
jmp    1158 <main+0x48>
movl   $0xf,-0x10(%rbp)
cmpl   $0x3e8,-0x10(%rbp)
jge    11a7 <main+0x97>
mov    -0x14(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    $0xf,%eax
mov    %eax,-0x10(%rbp)
jmp    1183 <main+0x73>
mov    -0x14(%rbp),%esi
lea    0xe4f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%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 = [3 x i8] c"%i\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
store i32 3, i32* %2
br label %6
6: ; preds = %13, %0
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 1000
br i1 %8, label %9, label %16
9: ; preds = %6
%10 = load i32, i32* %5
%11 = load i32, i32* %2
%12 = add nsw i32 %10, %11
store i32 %12, i32* %5
br label %13
13: ; preds = %9
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 3
store i32 %15, i32* %2
br label %6
16: ; preds = %6
store i32 5, i32* %3
br label %17
17: ; preds = %24, %16
%18 = load i32, i32* %3
%19 = icmp slt i32 %18, 1000
br i1 %19, label %20, label %27
20: ; preds = %17
%21 = load i32, i32* %5
%22 = load i32, i32* %3
%23 = add nsw i32 %21, %22
store i32 %23, i32* %5
br label %24
24: ; preds = %20
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 5
store i32 %26, i32* %3
br label %17
27: ; preds = %17
store i32 15, i32* %4
br label %28
28: ; preds = %35, %27
%29 = load i32, i32* %4
%30 = icmp slt i32 %29, 1000
br i1 %30, label %31, label %38
31: ; preds = %28
%32 = load i32, i32* %5
%33 = load i32, i32* %4
%34 = sub nsw i32 %32, %33
store i32 %34, i32* %5
br label %35
35: ; preds = %31
%36 = load i32, i32* %4
%37 = add nsw i32 %36, 15
store i32 %37, i32* %4
br label %28
38: ; preds = %28
%39 = load i32, i32* %5
%40 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %39)
%41 = load i32, i32* %1
ret i32 %41
}

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