#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 */
typedef int uint32_t;

/* Variables and functions */
double dot_vector(double *, double *, int);
int /*<<< orphan*/ produce_matrix_vector_product(double *, double *, double *,
                                                 int, int);
double rayliegh_quatient(double a[], double x[], uint32_t cubic_matrix_size) {
  double value = 0;
  double y[cubic_matrix_size];
  produce_matrix_vector_product(a, x, y, cubic_matrix_size, cubic_matrix_size);
  value =
      dot_vector(y, x, cubic_matrix_size) / dot_vector(x, x, cubic_matrix_size);
  return value;
}


x86 assembly (clang, -O0):
<rayliegh_quatient>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
lea    0xf(,%rax,8),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdx
sub    %rcx,%rdx
mov    %rdx,-0x40(%rbp)
mov    %rdx,%rsp
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%ecx
mov    -0x14(%rbp),%r8d
call   1040 <produce_matrix_vector_product@plt>
mov    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <dot_vector@plt>
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <dot_vector@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rayliegh_quatient>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %rsi,%r14
mov    %edx,%eax
mov    %rsp,%rbx
lea    0xf(,%rax,8),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %rbx,%rdx
mov    %r15d,%ecx
mov    %r15d,%r8d
call   1040 <produce_matrix_vector_product@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   1030 <dot_vector@plt>
movsd  %xmm0,-0x20(%rbp)
mov    %r14,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   1030 <dot_vector@plt>
movsd  -0x20(%rbp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @rayliegh_quatient(double* %0, double* %1, i32 %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca i32
%7 = alloca double
%8 = alloca i8*
%9 = alloca i64
store double* %0, double** %4
store double* %1, double** %5
store i32 %2, i32* %6
store double 0.000000e+00, double* %7
%10 = load i32, i32* %6
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %8
%13 = alloca double, i64 %11
store i64 %11, i64* %9
%14 = load double*, double** %4
%15 = load double*, double** %5
%16 = load i32, i32* %6
%17 = load i32, i32* %6
%18 = call i32 @produce_matrix_vector_product(double* %14, double* %15, double* %13, i32 %16, i32 %17)
%19 = load double*, double** %5
%20 = load i32, i32* %6
%21 = call double @dot_vector(double* %13, double* %19, i32 %20)
%22 = load double*, double** %5
%23 = load double*, double** %5
%24 = load i32, i32* %6
%25 = call double @dot_vector(double* %22, double* %23, i32 %24)
%26 = fdiv double %21, %25
store double %26, double* %7
%27 = load double, double* %7
%28 = load i8*, i8** %8
ret double %27
}

LLVM IR (-O2):
define double @rayliegh_quatient(double* %0, double* %1, i32 %2) {
%4 = zext i32 %2 to i64
%5 = alloca double, i64 %4
%6 = call i32 @produce_matrix_vector_product(double* %0, double* %1, double* %5, i32 %2, i32 %2)
%7 = call double @dot_vector(double* %5, double* %1, i32 %2)
%8 = call double @dot_vector(double* %1, double* %1, i32 %2)
%9 = fdiv double %7, %8
ret double %9
}