#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 floor(int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  int top = 999;
  int res = (floor(top / 3) * (3 + (floor(top / 3) * 3))) / 2 +
            (floor(top / 5) * (5 + (floor(top / 5) * 5))) / 2 -
            (floor(top / 15) * (15 + (floor(top / 15) * 15))) / 2;
  printf("%i\n", res);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x3e7,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <floor@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <floor@plt>
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
imul   $0x3,%ecx,%ecx
add    $0x3,%ecx
imul   %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x24(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <floor@plt>
mov    %eax,-0x28(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <floor@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
imul   $0x5,%ecx,%ecx
add    $0x5,%ecx
imul   %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
mov    $0xf,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <floor@plt>
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    $0xf,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <floor@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
imul   $0xf,%ecx,%ecx
add    $0xf,%ecx
imul   %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xdf2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0x14d,%edi
call   1040 <floor@plt>
mov    %eax,%ebx
mov    $0x14d,%edi
call   1040 <floor@plt>
lea    (%rax,%rax,2),%eax
add    $0x3,%eax
imul   %ebx,%eax
mov    %eax,%ebp
shr    $0x1f,%ebp
add    %eax,%ebp
sar    %ebp
mov    $0xc7,%edi
call   1040 <floor@plt>
mov    %eax,%ebx
mov    $0xc7,%edi
call   1040 <floor@plt>
lea    (%rax,%rax,4),%eax
add    $0x5,%eax
imul   %ebx,%eax
mov    %eax,%ebx
shr    $0x1f,%ebx
add    %eax,%ebx
sar    %ebx
add    %ebp,%ebx
mov    $0x42,%edi
call   1040 <floor@plt>
mov    %eax,%ebp
mov    $0x42,%edi
call   1040 <floor@plt>
lea    (%rax,%rax,4),%eax
lea    (%rax,%rax,2),%eax
add    $0xf,%eax
imul   %ebp,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
sub    %ecx,%ebx
lea    0xe57(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%i\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 999, i32* %5
%7 = load i32, i32* %5
%8 = sdiv i32 %7, 3
%9 = call i32 @floor(i32 %8)
%10 = load i32, i32* %5
%11 = sdiv i32 %10, 3
%12 = call i32 @floor(i32 %11)
%13 = mul nsw i32 %12, 3
%14 = add nsw i32 3, %13
%15 = mul nsw i32 %9, %14
%16 = sdiv i32 %15, 2
%17 = load i32, i32* %5
%18 = sdiv i32 %17, 5
%19 = call i32 @floor(i32 %18)
%20 = load i32, i32* %5
%21 = sdiv i32 %20, 5
%22 = call i32 @floor(i32 %21)
%23 = mul nsw i32 %22, 5
%24 = add nsw i32 5, %23
%25 = mul nsw i32 %19, %24
%26 = sdiv i32 %25, 2
%27 = add nsw i32 %16, %26
%28 = load i32, i32* %5
%29 = sdiv i32 %28, 15
%30 = call i32 @floor(i32 %29)
%31 = load i32, i32* %5
%32 = sdiv i32 %31, 15
%33 = call i32 @floor(i32 %32)
%34 = mul nsw i32 %33, 15
%35 = add nsw i32 15, %34
%36 = mul nsw i32 %30, %35
%37 = sdiv i32 %36, 2
%38 = sub nsw i32 %27, %37
store i32 %38, i32* %6
%39 = load i32, i32* %6
%40 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %39)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%i\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @floor(i32 333)
%4 = tail call i32 @floor(i32 333)
%5 = mul nsw i32 %4, 3
%6 = add nsw i32 %5, 3
%7 = mul nsw i32 %6, %3
%8 = sdiv i32 %7, 2
%9 = tail call i32 @floor(i32 199)
%10 = tail call i32 @floor(i32 199)
%11 = mul nsw i32 %10, 5
%12 = add nsw i32 %11, 5
%13 = mul nsw i32 %12, %9
%14 = sdiv i32 %13, 2
%15 = add nsw i32 %14, %8
%16 = tail call i32 @floor(i32 66)
%17 = tail call i32 @floor(i32 66)
%18 = mul nsw i32 %17, 15
%19 = add nsw i32 %18, 15
%20 = mul nsw i32 %19, %16
%21 = sdiv i32 %20, -2
%22 = add i32 %15, %21
%23 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %22)
ret i32 0
}