#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*/ elemprod(double *, double *, double *, int);
int /*<<< orphan*/ printf(char *, double);
int main(int argc, char *argv[]) {
  double v1[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
  double v2[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
  double v3[10];
  elemprod(v3, v1, v2, 10);
  int j;
  for (j = 0; j < 10; j++)
    printf("%f\n", v3[j]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x60(%rbp),%rdi
lea    0xeac(%rip),%rsi
mov    $0x50,%edx
call   1050 <memcpy@plt>
lea    -0xb0(%rbp),%rdi
lea    0xee4(%rip),%rsi
mov    $0x50,%edx
call   1050 <memcpy@plt>
lea    -0x100(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0xb0(%rbp),%rdx
mov    $0xa,%ecx
call   1030 <elemprod@plt>
movl   $0x0,-0x104(%rbp)
cmpl   $0xa,-0x104(%rbp)
jge    11d9 <main+0xa9>
movslq -0x104(%rbp),%rax
movsd  -0x100(%rbp,%rax,8),%xmm0
ff ff
lea    0xee0(%rip),%rdi
call   1040 <printf@plt>
mov    -0x104(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x104(%rbp)
jmp    119c <main+0x6c>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0xf0,%rsp
movaps 0xf11(%rip),%xmm0
movaps %xmm0,0xe0(%rsp)
movaps 0xef2(%rip),%xmm1
movaps %xmm1,0xd0(%rsp)
movaps 0xed3(%rip),%xmm2
movaps %xmm2,0xc0(%rsp)
movaps 0xeb4(%rip),%xmm3
movaps %xmm3,0xb0(%rsp)
movaps 0xe95(%rip),%xmm4
movaps %xmm4,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm1,0x80(%rsp)
movaps %xmm2,0x70(%rsp)
movaps %xmm3,0x60(%rsp)
movaps %xmm4,0x50(%rsp)
mov    %rsp,%rdi
lea    0xa0(%rsp),%rsi
lea    0x50(%rsp),%rdx
mov    $0xa,%ecx
call   1030 <elemprod@plt>
movsd  (%rsp),%xmm0
lea    0xe98(%rip),%rbx
mov    %rbx,%rdi
call   1040 <printf@plt>
movsd  0x8(%rsp),%xmm0
mov    %rbx,%rdi
call   1040 <printf@plt>
movsd  0x10(%rsp),%xmm0
mov    %rbx,%rdi
call   1040 <printf@plt>
movsd  0x18(%rsp),%xmm0
mov    %rbx,%rdi
call   1040 <printf@plt>
movsd  0x20(%rsp),%xmm0
mov    %rbx,%rdi
call   1040 <printf@plt>
movsd  0x28(%rsp),%xmm0
mov    %rbx,%rdi
call   1040 <printf@plt>
movsd  0x30(%rsp),%xmm0
mov    %rbx,%rdi
call   1040 <printf@plt>
movsd  0x38(%rsp),%xmm0
mov    %rbx,%rdi
call   1040 <printf@plt>
movsd  0x40(%rsp),%xmm0
mov    %rbx,%rdi
call   1040 <printf@plt>
movsd  0x48(%rsp),%xmm0
mov    %rbx,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.v1 = [10 x double] [double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00, double 5.000000e+00, double 6.000000e+00, double 7.000000e+00, double 8.000000e+00, double 9.000000e+00, double 1.000000e+01]
@__const.main.v2 = [10 x double] [double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00, double 5.000000e+00, double 6.000000e+00, double 7.000000e+00, double 8.000000e+00, double 9.000000e+00, double 1.000000e+01]
@.str = [4 x i8] c"%f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [10 x double]
%7 = alloca [10 x double]
%8 = alloca [10 x double]
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = bitcast [10 x double]* %6 to i8*
%11 = bitcast [10 x double]* %7 to i8*
%12 = getelementptr inbounds [10 x double], [10 x double]* %8, i64 0, i64 0
%13 = getelementptr inbounds [10 x double], [10 x double]* %6, i64 0, i64 0
%14 = getelementptr inbounds [10 x double], [10 x double]* %7, i64 0, i64 0
%15 = call i32 @elemprod(double* %12, double* %13, double* %14, i32 10)
store i32 0, i32* %9
br label %16
16: ; preds = %25, %2
%17 = load i32, i32* %9
%18 = icmp slt i32 %17, 10
br i1 %18, label %19, label %28
19: ; preds = %16
%20 = load i32, i32* %9
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [10 x double], [10 x double]* %8, i64 0, i64 %21
%23 = load double, double* %22
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %23)
br label %25
25: ; preds = %19
%26 = load i32, i32* %9
%27 = add nsw i32 %26, 1
store i32 %27, i32* %9
br label %16
28: ; preds = %16
ret i32 0
}

LLVM IR (-O2):
@__const.main.v2 = [10 x double] [double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00, double 5.000000e+00, double 6.000000e+00, double 7.000000e+00, double 8.000000e+00, double 9.000000e+00, double 1.000000e+01]
@.str = [4 x i8] c"%f\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [10 x double]
%4 = alloca [10 x double]
%5 = alloca [10 x double]
%6 = bitcast [10 x double]* %3 to i8*
%7 = bitcast [10 x double]* %4 to i8*
%8 = bitcast [10 x double]* %5 to i8*
%9 = getelementptr inbounds [10 x double], [10 x double]* %5, i64 0, i64 0
%10 = getelementptr inbounds [10 x double], [10 x double]* %3, i64 0, i64 0
%11 = getelementptr inbounds [10 x double], [10 x double]* %4, i64 0, i64 0
%12 = call i32 @elemprod(double* %9, double* %10, double* %11, i32 10)
%13 = load double, double* %9
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %13)
%15 = getelementptr inbounds [10 x double], [10 x double]* %5, i64 0, i64 1
%16 = load double, double* %15
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %16)
%18 = getelementptr inbounds [10 x double], [10 x double]* %5, i64 0, i64 2
%19 = load double, double* %18
%20 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %19)
%21 = getelementptr inbounds [10 x double], [10 x double]* %5, i64 0, i64 3
%22 = load double, double* %21
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %22)
%24 = getelementptr inbounds [10 x double], [10 x double]* %5, i64 0, i64 4
%25 = load double, double* %24
%26 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %25)
%27 = getelementptr inbounds [10 x double], [10 x double]* %5, i64 0, i64 5
%28 = load double, double* %27
%29 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %28)
%30 = getelementptr inbounds [10 x double], [10 x double]* %5, i64 0, i64 6
%31 = load double, double* %30
%32 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %31)
%33 = getelementptr inbounds [10 x double], [10 x double]* %5, i64 0, i64 7
%34 = load double, double* %33
%35 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %34)
%36 = getelementptr inbounds [10 x double], [10 x double]* %5, i64 0, i64 8
%37 = load double, double* %36
%38 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %37)
%39 = getelementptr inbounds [10 x double], [10 x double]* %5, i64 0, i64 9
%40 = load double, double* %39
%41 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %40)
ret i32 0
}