#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 */
double ddot_(int *, double *, int *, double *, int *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, double);
int main(int argc, char **argv) {
  double *a = (double *)malloc(3 * sizeof(double));
  a[0] = 1.0;
  a[1] = 2.0;
  a[2] = 3.0;
  double b[3] = {4.0, 5.0, 6.0};
  int N = 3, one = 1;
  double dot_product = ddot_(&N, a, &one, b, &one);
  printf(" The dot product is: %f \n", dot_product);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x18,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsd  0xeb0(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
movsd  0xe98(%rip),%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x18(%rbp),%rax
movsd  0xe7f(%rip),%xmm0
movsd  %xmm0,0x10(%rax)
mov    0xe93(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xe90(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xe8d(%rip),%rax
mov    %rax,-0x20(%rbp)
movl   $0x3,-0x34(%rbp)
movl   $0x1,-0x38(%rbp)
mov    -0x18(%rbp),%rsi
lea    -0x30(%rbp),%rcx
lea    -0x34(%rbp),%rdi
lea    -0x38(%rbp),%r8
mov    %r8,%rdx
call   1030 <ddot_@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
lea    0xe5a(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
mov    $0x18,%edi
call   1050 <malloc@plt>
movaps 0xebb(%rip),%xmm0
movups %xmm0,(%rax)
movabs $0x4008000000000000,%rcx
mov    %rcx,0x10(%rax)
mov    0xec3(%rip),%rcx
mov    %rcx,0x20(%rsp)
movaps 0xea7(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movl   $0x3,0xc(%rsp)
movl   $0x1,0x8(%rsp)
lea    0xc(%rsp),%rdi
lea    0x10(%rsp),%rcx
lea    0x8(%rsp),%rdx
mov    %rax,%rsi
mov    %rdx,%r8
call   1030 <ddot_@plt>
lea    0xe89(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.b = [3 x double] [double 4.000000e+00, double 5.000000e+00, double 6.000000e+00]
@.str = [26 x i8] c" The dot product is: %f \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double*
%7 = alloca [3 x double]
%8 = alloca i32
%9 = alloca i32
%10 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = call i64 @malloc(i32 24)
%12 = inttoptr i64 %11 to double*
store double* %12, double** %6
%13 = load double*, double** %6
%14 = getelementptr inbounds double, double* %13, i64 0
store double 1.000000e+00, double* %14
%15 = load double*, double** %6
%16 = getelementptr inbounds double, double* %15, i64 1
store double 2.000000e+00, double* %16
%17 = load double*, double** %6
%18 = getelementptr inbounds double, double* %17, i64 2
store double 3.000000e+00, double* %18
%19 = bitcast [3 x double]* %7 to i8*
store i32 3, i32* %8
store i32 1, i32* %9
%20 = load double*, double** %6
%21 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%22 = call double @ddot_(i32* %8, double* %20, i32* %9, double* %21, i32* %9)
store double %22, double* %10
%23 = load double, double* %10
%24 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), double %23)
ret i32 0
}

LLVM IR (-O2):
@__const.main.b = [3 x double] [double 4.000000e+00, double 5.000000e+00, double 6.000000e+00]
@.str = [26 x i8] c" The dot product is: %f \0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [3 x double]
%4 = alloca i32
%5 = alloca i32
%6 = tail call i64 @malloc(i32 24)
%7 = inttoptr i64 %6 to double*
%8 = inttoptr i64 %6 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 2.000000e+00>, <2 x double>* %8
%9 = getelementptr inbounds double, double* %7, i64 2
store double 3.000000e+00, double* %9
%10 = bitcast [3 x double]* %3 to i8*
%11 = bitcast i32* %4 to i8*
store i32 3, i32* %4
%12 = bitcast i32* %5 to i8*
store i32 1, i32* %5
%13 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 0
%14 = call double @ddot_(i32* %4, double* %7, i32* %5, double* %13, i32* %5)
%15 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), double %14)
ret i32 0
}