#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 /*<<< orphan*/ system(char *);
int main(void) {
  int mySum = 0;
  for (int i = 0; i < 1000; i++) {
    if (i % 5 == 0 || i % 3 == 0) {
      mySum += i;
      printf("%d\n", i);
    }
  }
  printf("The sum is %d\n", mySum);
  system("PAUSE");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x3e8,-0xc(%rbp)
jge    119d <main+0x7d>
mov    -0xc(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1172 <main+0x52>
mov    -0xc(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    118a <main+0x6a>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe86(%rip),%rdi
call   1040 <printf@plt>
jmp    118f <main+0x6f>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113d <main+0x1d>
mov    -0x8(%rbp),%esi
lea    0xe59(%rip),%rdi
call   1040 <printf@plt>
lea    0xe5c(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %ebp,%ebp
lea    0xede(%rip),%r14
xor    %ebx,%ebx
jmp    1157 <main+0x37>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    %ebp,%ebx
mov    %r14,%rdi
mov    %ebp,%esi
call   1040 <printf@plt>
add    $0x1,%ebp
cmp    $0x3e8,%ebp
je     1184 <main+0x64>
movzwl %bp,%eax
imul   $0xcccd,%eax,%ecx
shr    $0x12,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
add    %ax,%cx
je     1140 <main+0x20>
imul   $0xaaab,%eax,%eax
shr    $0x11,%eax
lea    (%rax,%rax,2),%eax
mov    %ebp,%ecx
sub    %eax,%ecx
test   %cx,%cx
jne    114c <main+0x2c>
jmp    1140 <main+0x20>
lea    0xe75(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
lea    0xe76(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [15 x i8] c"The sum is %d\0A\00"
@.str.2 = [6 x i8] c"PAUSE\00"
define i32 @main() {
br label %4
1: ; preds = %16
%2 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%3 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
4: ; preds = %0, %16
%5 = phi i32 [ 0, %0 ], [ %18, %16 ]
%6 = phi i32 [ 0, %0 ], [ %17, %16 ]
%7 = trunc i32 %5 to i16
%8 = urem i16 %7, 5
%9 = icmp eq i16 %8, 0
%10 = urem i16 %7, 3
%11 = icmp eq i16 %10, 0
%12 = or i1 %9, %11
br i1 %12, label %13, label %16
13: ; preds = %4
%14 = add nsw i32 %5, %6
%15 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
br label %16
16: ; preds = %4, %13
%17 = phi i32 [ %14, %13 ], [ %6, %4 ]
%18 = add nuw nsw i32 %5, 1
%19 = icmp eq i32 %18, 1000
br i1 %19, label %1, label %4
}