#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__ malloc(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i;
  int noOfMultiples_3 = 1000 / 3;
  int noOfMultiples_5 = 1000 / 5;
  int *array_3 = (int *)(malloc(sizeof(int) * noOfMultiples_3));
  int *array_5 = (int *)(malloc(sizeof(int) * noOfMultiples_5));
  int sum = 0;
  for (i = 3; i < 10;) {
    array_3[i / 3 - 1] = i;
    sum += i;
    i = i + 3;
  }
  for (i = 5; i < 10;) {
    sum += i;
    i = i + 5;
  }
  printf("%d", sum);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x14d,-0xc(%rbp)
movl   $0xc8,-0x10(%rbp)
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x3,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    11bd <main+0x9d>
mov    -0x8(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    -0x34(%rbp),%edx
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x8(%rbp)
jmp    1171 <main+0x51>
movl   $0x5,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    11e5 <main+0xc5>
mov    -0x8(%rbp),%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0x8(%rbp)
jmp    11c4 <main+0xa4>
mov    -0x24(%rbp),%esi
lea    0xe11(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x534,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    $0x320,%edi
call   1040 <malloc@plt>
movabs $0x600000003,%rax
mov    %rax,(%rbx)
movl   $0x9,0x8(%rbx)
lea    0xead(%rip),%rdi
mov    $0x17,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
store i32 0, i32* %1
store i32 333, i32* %3
store i32 200, i32* %4
%8 = load i32, i32* %3
%9 = sext i32 %8 to i64
%10 = mul i64 4, %9
%11 = trunc i64 %10 to i32
%12 = call i64 @malloc(i32 %11)
%13 = inttoptr i64 %12 to i32*
store i32* %13, i32** %5
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = mul i64 4, %15
%17 = trunc i64 %16 to i32
%18 = call i64 @malloc(i32 %17)
%19 = inttoptr i64 %18 to i32*
store i32* %19, i32** %6
store i32 0, i32* %7
store i32 3, i32* %2
br label %20
20: ; preds = %23, %0
%21 = load i32, i32* %2
%22 = icmp slt i32 %21, 10
br i1 %22, label %23, label %36
23: ; preds = %20
%24 = load i32, i32* %2
%25 = load i32*, i32** %5
%26 = load i32, i32* %2
%27 = sdiv i32 %26, 3
%28 = sub nsw i32 %27, 1
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %25, i64 %29
store i32 %24, i32* %30
%31 = load i32, i32* %2
%32 = load i32, i32* %7
%33 = add nsw i32 %32, %31
store i32 %33, i32* %7
%34 = load i32, i32* %2
%35 = add nsw i32 %34, 3
store i32 %35, i32* %2
br label %20
36: ; preds = %20
store i32 5, i32* %2
br label %37
37: ; preds = %40, %36
%38 = load i32, i32* %2
%39 = icmp slt i32 %38, 10
br i1 %39, label %40, label %46
40: ; preds = %37
%41 = load i32, i32* %2
%42 = load i32, i32* %7
%43 = add nsw i32 %42, %41
store i32 %43, i32* %7
%44 = load i32, i32* %2
%45 = add nsw i32 %44, 5
store i32 %45, i32* %2
br label %37
46: ; preds = %37
%47 = load i32, i32* %7
%48 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %47)
%49 = load i32, i32* %1
ret i32 %49
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = tail call i64 @malloc(i32 1332)
%2 = inttoptr i64 %1 to i32*
%3 = tail call i64 @malloc(i32 800)
store i32 3, i32* %2
%4 = getelementptr inbounds i32, i32* %2, i64 1
store i32 6, i32* %4
%5 = getelementptr inbounds i32, i32* %2, i64 2
store i32 9, i32* %5
%6 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 23)
ret i32 0
}