#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*/ EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ check_intInput(int *);
int dot_product_of_vectors(int *, int *, int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fill_array(int *, int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int dimension;
  printf("Enter dimension: ");
  check_intInput(&dimension);
  if (dimension <= 0) {
    printf("dimension > 0 !");
    exit(EXIT_FAILURE);
  }
  printf("Enter vector members :\n");
  int firstVector[dimension], secondVector[dimension];
  fill_array(firstVector, dimension);
  fill_array(secondVector, dimension);
  int result = dot_product_of_vectors(firstVector, secondVector, dimension);
  printf("result %d", result);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x8(%rbp),%rdi
call   1030 <check_intInput@plt>
cmpl   $0x0,-0x8(%rbp)
jg     119c <main+0x4c>
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2e4b(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
lea    0xe7f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
lea    0xf(,%rax,4),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x38(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%esi
call   1050 <fill_array@plt>
mov    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1050 <fill_array@plt>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x8(%rbp),%edx
call   1060 <dot_product_of_vectors@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xe18(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2da8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xe8f(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    -0x1c(%rbp),%rdi
call   1030 <check_intInput@plt>
cmpl   $0x0,-0x1c(%rbp)
jle    1212 <main+0xb2>
lea    0xe9a(%rip),%rdi
call   1040 <puts@plt>
mov    %rsp,%r15
mov    -0x1c(%rbp),%eax
mov    %rsp,%r14
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
mov    -0x1c(%rbp),%esi
mov    %rsp,%rbx
lea    0xf(,%rsi,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %r14,%rdi
call   1060 <fill_array@plt>
mov    -0x1c(%rbp),%esi
mov    %rbx,%rdi
call   1060 <fill_array@plt>
mov    -0x1c(%rbp),%edx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <dot_product_of_vectors@plt>
lea    0xe30(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2dd6(%rip),%rax
mov    (%rax),%eax
mov    %r15,%rsp
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xdf9(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2db9(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"Enter dimension: \00"
@.str.1 = [16 x i8] c"dimension > 0 !\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [24 x i8] c"Enter vector members :\0A\00"
@.str.3 = [10 x i8] c"result %d\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @check_intInput(i32* %2)
%9 = load i32, i32* %2
%10 = icmp sle i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %0
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%13 = load i32, i32* @EXIT_FAILURE
%14 = call i32 @exit(i32 %13)
unreachable
15: ; preds = %0
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%17 = load i32, i32* %2
%18 = zext i32 %17 to i64
%19 = call i8* @llvm.stacksave()
store i8* %19, i8** %3
%20 = alloca i32, i64 %18
store i64 %18, i64* %4
%21 = load i32, i32* %2
%22 = zext i32 %21 to i64
%23 = alloca i32, i64 %22
store i64 %22, i64* %5
%24 = load i32, i32* %2
%25 = call i32 @fill_array(i32* %20, i32 %24)
%26 = load i32, i32* %2
%27 = call i32 @fill_array(i32* %23, i32 %26)
%28 = load i32, i32* %2
%29 = call i32 @dot_product_of_vectors(i32* %20, i32* %23, i32 %28)
store i32 %29, i32* %6
%30 = load i32, i32* %6
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %30)
%32 = load i32, i32* @EXIT_SUCCESS
store i32 %32, i32* %1
%33 = load i8*, i8** %3
%34 = load i32, i32* %1
ret i32 %34
}

LLVM IR (-O2):
@.str = [18 x i8] c"Enter dimension: \00"
@.str.1 = [16 x i8] c"dimension > 0 !\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [10 x i8] c"result %d\00"
@EXIT_SUCCESS = global i32 0
@str = [23 x i8] c"Enter vector members :\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @check_intInput(i32* %1)
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 1
br i1 %6, label %7, label %11
7: ; preds = %0
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%9 = load i32, i32* @EXIT_FAILURE
%10 = call i32 @exit(i32 %9)
unreachable
11: ; preds = %0
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%13 = load i32, i32* %1
%14 = zext i32 %13 to i64
%15 = call i8* @llvm.stacksave()
%16 = alloca i32, i64 %14
%17 = load i32, i32* %1
%18 = zext i32 %17 to i64
%19 = alloca i32, i64 %18
%20 = call i32 @fill_array(i32* %16, i32 %17)
%21 = load i32, i32* %1
%22 = call i32 @fill_array(i32* %19, i32 %21)
%23 = load i32, i32* %1
%24 = call i32 @dot_product_of_vectors(i32* %16, i32* %19, i32 %23)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %24)
%26 = load i32, i32* @EXIT_SUCCESS
ret i32 %26
}