#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 multiplesof3 = 0, multiplesof5 = 0, multiplesof15 = 0;
  int i;
  for (i = 0; i < 1000; i++) {
    if (i % 3 == 0) {
      multiplesof3 += i;
    }
    if (i % 5 == 0) {
      multiplesof5 += i;
    }
    if (i % 15 == 0) {
      multiplesof15 += i;
    }
  }
  printf("Number of multiples of 3 and 5 but not of 15: %d\n",
         multiplesof3 + multiplesof5 - multiplesof15);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x3e8,-0x14(%rbp)
jge    11b2 <main+0xa2>
mov    -0x14(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1165 <main+0x55>
mov    -0x14(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1182 <main+0x72>
mov    -0x14(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
mov    $0xf,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    119f <main+0x8f>
mov    -0x14(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    11a4 <main+0x94>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113b <main+0x2b>
mov    -0x8(%rbp),%esi
add    -0xc(%rbp),%esi
sub    -0x10(%rbp),%esi
lea    0xe3e(%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),%xmm9
pxor   %xmm3,%xmm3
movdqa 0xeea(%rip),%xmm4
mov    $0x3e8,%eax
movdqa 0xf0c(%rip),%xmm12
movdqa 0xf33(%rip),%xmm15
movdqa 0xf5a(%rip),%xmm10
pxor   %xmm1,%xmm1
pxor   %xmm0,%xmm0
pxor   %xmm6,%xmm6
pxor   %xmm5,%xmm5
pxor   %xmm13,%xmm13
pxor   %xmm11,%xmm11
movdqa %xmm4,%xmm14
paddd  0xeb2(%rip),%xmm14
movdqa %xmm9,%xmm8
pmullw 0xeb4(%rip),%xmm8
movdqa %xmm8,%xmm2
psubusw %xmm12,%xmm2
pcmpeqw %xmm3,%xmm2
punpcklwd %xmm2,%xmm2
psrad  $0x10,%xmm2
paddw  0xeb4(%rip),%xmm8
psubusw %xmm12,%xmm8
pcmpeqw %xmm3,%xmm8
punpcklwd %xmm8,%xmm7
psrad  $0x10,%xmm7
pand   %xmm4,%xmm2
paddd  %xmm2,%xmm13
pand   %xmm14,%xmm7
paddd  %xmm7,%xmm11
movdqa %xmm9,%xmm2
pmullw 0xe90(%rip),%xmm2
movdqa %xmm2,%xmm7
psubusw %xmm15,%xmm7
pcmpeqw %xmm3,%xmm7
punpcklwd %xmm7,%xmm7
psrad  $0x10,%xmm7
paddw  0xe92(%rip),%xmm2
psubusw %xmm15,%xmm2
pcmpeqw %xmm3,%xmm2
punpcklwd %xmm2,%xmm2
psrad  $0x10,%xmm2
pand   %xmm4,%xmm7
paddd  %xmm7,%xmm6
pand   %xmm14,%xmm2
paddd  %xmm2,%xmm5
movdqa %xmm9,%xmm2
pmullw 0xe72(%rip),%xmm2
movdqa %xmm2,%xmm7
psubusw %xmm10,%xmm7
pcmpeqw %xmm3,%xmm7
punpcklwd %xmm7,%xmm7
psrad  $0x10,%xmm7
pand   %xmm4,%xmm7
paddd  %xmm7,%xmm1
paddw  0xe6c(%rip),%xmm2
psubusw %xmm10,%xmm2
pcmpeqw %xmm3,%xmm2
punpcklwd %xmm2,%xmm2
psrad  $0x10,%xmm2
pand   %xmm14,%xmm2
paddd  %xmm2,%xmm0
paddd  0xe59(%rip),%xmm4
paddw  0xe60(%rip),%xmm9
add    $0xfffffff8,%eax
jne    1160 <main+0x50>
paddd  %xmm13,%xmm11
pshufd $0xee,%xmm11,%xmm2
paddd  %xmm11,%xmm2
pshufd $0x55,%xmm2,%xmm3
paddd  %xmm2,%xmm3
movd   %xmm3,%eax
paddd  %xmm6,%xmm5
pshufd $0xee,%xmm5,%xmm2
paddd  %xmm5,%xmm2
pshufd $0x55,%xmm2,%xmm3
paddd  %xmm2,%xmm3
movd   %xmm3,%esi
add    %eax,%esi
paddd  %xmm1,%xmm0
pshufd $0xee,%xmm0,%xmm1
paddd  %xmm0,%xmm1
pshufd $0x55,%xmm1,%xmm0
paddd  %xmm1,%xmm0
movd   %xmm0,%eax
sub    %eax,%esi
lea    0xe0b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [50 x i8] c"Number of multiples of 3 and 5 but not of 15: %d\0A\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* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %34, %0
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 1000
br i1 %8, label %9, label %37
9: ; preds = %6
%10 = load i32, i32* %5
%11 = srem i32 %10, 3
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %9
%14 = load i32, i32* %5
%15 = load i32, i32* %2
%16 = add nsw i32 %15, %14
store i32 %16, i32* %2
br label %17
17: ; preds = %13, %9
%18 = load i32, i32* %5
%19 = srem i32 %18, 5
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %25
21: ; preds = %17
%22 = load i32, i32* %5
%23 = load i32, i32* %3
%24 = add nsw i32 %23, %22
store i32 %24, i32* %3
br label %25
25: ; preds = %21, %17
%26 = load i32, i32* %5
%27 = srem i32 %26, 15
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %33
29: ; preds = %25
%30 = load i32, i32* %5
%31 = load i32, i32* %4
%32 = add nsw i32 %31, %30
store i32 %32, i32* %4
br label %33
33: ; preds = %29, %25
br label %34
34: ; preds = %33
%35 = load i32, i32* %5
%36 = add nsw i32 %35, 1
store i32 %36, i32* %5
br label %6
37: ; preds = %6
%38 = load i32, i32* %2
%39 = load i32, i32* %3
%40 = add nsw i32 %38, %39
%41 = load i32, i32* %4
%42 = sub nsw i32 %40, %41
%43 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 %42)
ret i32 0
}

LLVM IR (-O2):
@.str = [50 x i8] c"Number of multiples of 3 and 5 but not of 15: %d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = phi i32 [ 0, %0 ], [ %37, %1 ]
%3 = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %0 ], [ %38, %1 ]
%4 = phi <4 x i32> [ zeroinitializer, %0 ], [ %35, %1 ]
%5 = phi <4 x i32> [ zeroinitializer, %0 ], [ %36, %1 ]
%6 = phi <4 x i32> [ zeroinitializer, %0 ], [ %27, %1 ]
%7 = phi <4 x i32> [ zeroinitializer, %0 ], [ %28, %1 ]
%8 = phi <4 x i32> [ zeroinitializer, %0 ], [ %19, %1 ]
%9 = phi <4 x i32> [ zeroinitializer, %0 ], [ %20, %1 ]
%10 = phi <4 x i16> [ <i16 0, i16 1, i16 2, i16 3>, %0 ], [ %39, %1 ]
%11 = add <4 x i32> %3, <i32 4, i32 4, i32 4, i32 4>
%12 = add <4 x i16> %10, <i16 4, i16 4, i16 4, i16 4>
%13 = urem <4 x i16> %10, <i16 3, i16 3, i16 3, i16 3>
%14 = urem <4 x i16> %12, <i16 3, i16 3, i16 3, i16 3>
%15 = icmp eq <4 x i16> %13, zeroinitializer
%16 = icmp eq <4 x i16> %14, zeroinitializer
%17 = select <4 x i1> %15, <4 x i32> %3, <4 x i32> zeroinitializer
%18 = select <4 x i1> %16, <4 x i32> %11, <4 x i32> zeroinitializer
%19 = add <4 x i32> %17, %8
%20 = add <4 x i32> %18, %9
%21 = urem <4 x i16> %10, <i16 5, i16 5, i16 5, i16 5>
%22 = urem <4 x i16> %12, <i16 5, i16 5, i16 5, i16 5>
%23 = icmp eq <4 x i16> %21, zeroinitializer
%24 = icmp eq <4 x i16> %22, zeroinitializer
%25 = select <4 x i1> %23, <4 x i32> %3, <4 x i32> zeroinitializer
%26 = select <4 x i1> %24, <4 x i32> %11, <4 x i32> zeroinitializer
%27 = add <4 x i32> %25, %6
%28 = add <4 x i32> %26, %7
%29 = urem <4 x i16> %10, <i16 15, i16 15, i16 15, i16 15>
%30 = urem <4 x i16> %12, <i16 15, i16 15, i16 15, i16 15>
%31 = icmp eq <4 x i16> %29, zeroinitializer
%32 = icmp eq <4 x i16> %30, zeroinitializer
%33 = select <4 x i1> %31, <4 x i32> %3, <4 x i32> zeroinitializer
%34 = select <4 x i1> %32, <4 x i32> %11, <4 x i32> zeroinitializer
%35 = add <4 x i32> %33, %4
%36 = add <4 x i32> %34, %5
%37 = add nuw i32 %2, 8
%38 = add <4 x i32> %3, <i32 8, i32 8, i32 8, i32 8>
%39 = add <4 x i16> %10, <i16 8, i16 8, i16 8, i16 8>
%40 = icmp eq i32 %37, 1000
br i1 %40, label %41, label %1
41: ; preds = %1
%42 = add <4 x i32> %20, %19
%43 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %42)
%44 = add <4 x i32> %28, %27
%45 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %44)
%46 = add <4 x i32> %36, %35
%47 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %46)
%48 = add nuw nsw i32 %45, %43
%49 = sub nsw i32 %48, %47
%50 = tail call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 %49)
ret i32 0
}