#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 */
scalar_t__ is_Multiple_of(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ system(char *);
int main(void) {
  int number, i = 0;
  long int sum = 0;
  printf("Adding all Natural numbers below one thousand that are multiples of "
         "3 and 5.\n");
  printf("\nAdding the numbers...");
  printf("\n");
  system("sleep 3");
  for (i = 1; i <= 1000; i++)
    sum += is_Multiple_of(i);
  printf("\nThe sum of all the natural numbers is: %ld.\n", sum);
  printf("This is cool huh......\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeeb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf40(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xee6(%rip),%rdi
call   1030 <system@plt>
movl   $0x1,-0xc(%rbp)
cmpl   $0x3e8,-0xc(%rbp)
jg     11b6 <main+0x86>
mov    -0xc(%rbp),%edi
call   1050 <is_Multiple_of@plt>
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    118b <main+0x5b>
mov    -0x18(%rbp),%rsi
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xef3(%rip),%rdi
call   1040 <puts@plt>
lea    0xe9a(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe97(%rip),%rdi
call   1050 <system@plt>
mov    $0x1,%ebp
nopw   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1070 <is_Multiple_of@plt>
add    %rax,%rbx
add    $0x1,%ebp
cmp    $0x3e9,%ebp
jne    1190 <main+0x40>
lea    0xe73(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xedd(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [78 x i8] c"Adding all Natural numbers below one thousand that are multiples of 3 and 5.\0A\00"
@.str.1 = [23 x i8] c"\0AAdding the numbers...\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [8 x i8] c"sleep 3\00"
@.str.4 = [46 x i8] c"\0AThe sum of all the natural numbers is: %ld.\0A\00"
@.str.5 = [24 x i8] c"This is cool huh......\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i64
store i32 0, i32* %1
store i32 0, i32* %3
store i64 0, i64* %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @system(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %3
br label %9
9: ; preds = %17, %0
%10 = load i32, i32* %3
%11 = icmp sle i32 %10, 1000
br i1 %11, label %12, label %20
12: ; preds = %9
%13 = load i32, i32* %3
%14 = call i64 @is_Multiple_of(i32 %13)
%15 = load i64, i64* %4
%16 = add nsw i64 %15, %14
store i64 %16, i64* %4
br label %17
17: ; preds = %12
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %9
20: ; preds = %9
%21 = load i64, i64* %4
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0), i64 %21)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [23 x i8] c"\0AAdding the numbers...\00"
@.str.3 = [8 x i8] c"sleep 3\00"
@.str.4 = [46 x i8] c"\0AThe sum of all the natural numbers is: %ld.\0A\00"
@str = [77 x i8] c"Adding all Natural numbers below one thousand that are multiples of 3 and 5.\00"
@str.6 = [23 x i8] c"This is cool huh......\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([77 x i8], [77 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @putchar(i32 10)
%4 = tail call i32 @system(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
br label %5
5: ; preds = %0, %5
%6 = phi i64 [ 0, %0 ], [ %9, %5 ]
%7 = phi i32 [ 1, %0 ], [ %10, %5 ]
%8 = tail call i64 @is_Multiple_of(i32 %7)
%9 = add nsw i64 %8, %6
%10 = add nuw nsw i32 %7, 1
%11 = icmp eq i32 %10, 1001
br i1 %11, label %12, label %5
12: ; preds = %5
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.4, i64 0, i64 0), i64 %9)
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.6, i64 0, i64 0))
ret i32 0
}