#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 getinput();
int /*<<< orphan*/ printf(char *);
int main() {
  int A[100];
  int B[100];
  int size, i, j;
  int result;
  printf("Please give the size of the vectors to be multiplied: ");
  size = getinput();
  A[0] = 0;
  for (i = 1; i < size; i++)
    A[i] = A[i - 1] + i * i;
  B[0] = 0;
  for (i = 1; i < size; i++)
    B[i] = i + B[i - 1];
  result = 0;
  for (i = 0; i < size; i++)
    result += A[i] * B[i];
  printf("0\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x340,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getinput@plt>
mov    %eax,-0x334(%rbp)
movl   $0x0,-0x1a0(%rbp)
movl   $0x1,-0x338(%rbp)
mov    -0x338(%rbp),%eax
cmp    -0x334(%rbp),%eax
jge    11b4 <main+0x94>
mov    -0x338(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x1a0(%rbp,%rax,4),%ecx
mov    -0x338(%rbp),%eax
imul   -0x338(%rbp),%eax
add    %eax,%ecx
movslq -0x338(%rbp),%rax
mov    %ecx,-0x1a0(%rbp,%rax,4)
mov    -0x338(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x338(%rbp)
jmp    115f <main+0x3f>
movl   $0x0,-0x330(%rbp)
movl   $0x1,-0x338(%rbp)
mov    -0x338(%rbp),%eax
cmp    -0x334(%rbp),%eax
jge    1214 <main+0xf4>
mov    -0x338(%rbp),%ecx
mov    -0x338(%rbp),%eax
sub    $0x1,%eax
cltq
add    -0x330(%rbp,%rax,4),%ecx
movslq -0x338(%rbp),%rax
mov    %ecx,-0x330(%rbp,%rax,4)
mov    -0x338(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x338(%rbp)
jmp    11c8 <main+0xa8>
movl   $0x0,-0x340(%rbp)
movl   $0x0,-0x338(%rbp)
mov    -0x338(%rbp),%eax
cmp    -0x334(%rbp),%eax
jge    1277 <main+0x157>
movslq -0x338(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%eax
movslq -0x338(%rbp),%rcx
imul   -0x330(%rbp,%rcx,4),%eax
ff
add    -0x340(%rbp),%eax
mov    %eax,-0x340(%rbp)
mov    -0x338(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x338(%rbp)
jmp    1228 <main+0x108>
lea    0xdb9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x340,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getinput@plt>
lea    0xeec(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [55 x i8] c"Please give the size of the vectors to be multiplied: \00"
@.str.1 = [3 x i8] c"0\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i32]
%3 = alloca [100 x i32]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (...) @getinput()
store i32 %9, i32* %4
%10 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
store i32 0, i32* %10
store i32 1, i32* %5
br label %11
11: ; preds = %28, %0
%12 = load i32, i32* %5
%13 = load i32, i32* %4
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %31
15: ; preds = %11
%16 = load i32, i32* %5
%17 = sub nsw i32 %16, 1
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %18
%20 = load i32, i32* %19
%21 = load i32, i32* %5
%22 = load i32, i32* %5
%23 = mul nsw i32 %21, %22
%24 = add nsw i32 %20, %23
%25 = load i32, i32* %5
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %26
store i32 %24, i32* %27
br label %28
28: ; preds = %15
%29 = load i32, i32* %5
%30 = add nsw i32 %29, 1
store i32 %30, i32* %5
br label %11
31: ; preds = %11
%32 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 0
store i32 0, i32* %32
store i32 1, i32* %5
br label %33
33: ; preds = %48, %31
%34 = load i32, i32* %5
%35 = load i32, i32* %4
%36 = icmp slt i32 %34, %35
br i1 %36, label %37, label %51
37: ; preds = %33
%38 = load i32, i32* %5
%39 = load i32, i32* %5
%40 = sub nsw i32 %39, 1
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %41
%43 = load i32, i32* %42
%44 = add nsw i32 %38, %43
%45 = load i32, i32* %5
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %46
store i32 %44, i32* %47
br label %48
48: ; preds = %37
%49 = load i32, i32* %5
%50 = add nsw i32 %49, 1
store i32 %50, i32* %5
br label %33
51: ; preds = %33
store i32 0, i32* %7
store i32 0, i32* %5
br label %52
52: ; preds = %68, %51
%53 = load i32, i32* %5
%54 = load i32, i32* %4
%55 = icmp slt i32 %53, %54
br i1 %55, label %56, label %71
56: ; preds = %52
%57 = load i32, i32* %5
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %58
%60 = load i32, i32* %59
%61 = load i32, i32* %5
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %62
%64 = load i32, i32* %63
%65 = mul nsw i32 %60, %64
%66 = load i32, i32* %7
%67 = add nsw i32 %66, %65
store i32 %67, i32* %7
br label %68
68: ; preds = %56
%69 = load i32, i32* %5
%70 = add nsw i32 %69, 1
store i32 %70, i32* %5
br label %52
71: ; preds = %52
%72 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%73 = load i32, i32* %1
ret i32 %73
}

LLVM IR (-O2):
@.str = [55 x i8] c"Please give the size of the vectors to be multiplied: \00"
@str = [2 x i8] c"0\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @getinput()
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret i32 0
}