#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*/ givensRotation_double(double *, double, double);
void matrixToHessenbergForm_Givens_double(double *A) {
  double givensValues[2] = {0.0, 0.0};
  int i;
  double tau_one = 0.0;
  double tau_two = 0.0;
  givensRotation_double(givensValues, A[3], A[6]);
  for (i = 0; i < 3; i++) {
    tau_one = A[3 + i];
    tau_two = A[6 + i];
    A[3 + i] = tau_one * givensValues[0] - tau_two * givensValues[1];
    A[6 + i] = tau_one * givensValues[1] + tau_two * givensValues[0];
  }
  for (i = 0; i < 9; i += 3) {
    tau_one = A[i + 1];
    tau_two = A[i + 2];
    A[i + 1] = tau_one * givensValues[0] - tau_two * givensValues[1];
    A[i + 2] = tau_one * givensValues[1] + tau_two * givensValues[0];
  }
}


x86 assembly (clang, -O0):
<matrixToHessenbergForm_Givens_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x30(%rax),%xmm1
call   1030 <givensRotation_double@plt>
movl   $0x0,-0x24(%rbp)
cmpl   $0x3,-0x24(%rbp)
jge    1227 <matrixToHessenbergForm_Givens_double+0x107>
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x6,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x30(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x6,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    116e <matrixToHessenbergForm_Givens_double+0x4e>
movl   $0x0,-0x24(%rbp)
cmpl   $0x9,-0x24(%rbp)
jge    12e7 <matrixToHessenbergForm_Givens_double+0x1c7>
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x30(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x24(%rbp)
jmp    122e <matrixToHessenbergForm_Givens_double+0x10e>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matrixToHessenbergForm_Givens_double>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movsd  0x18(%rdi),%xmm0
movsd  0x30(%rdi),%xmm1
mov    %rsp,%rdi
call   1030 <givensRotation_double@plt>
movapd (%rsp),%xmm3
movapd %xmm3,%xmm9
unpckhpd %xmm3,%xmm9
movsd  0x20(%rbx),%xmm0
movsd  0x38(%rbx),%xmm1
movapd %xmm9,%xmm4
mulsd  %xmm1,%xmm4
movapd %xmm0,%xmm2
mulsd  %xmm3,%xmm2
subsd  %xmm4,%xmm2
mulsd  %xmm3,%xmm1
mulsd  %xmm9,%xmm0
addsd  %xmm1,%xmm0
movsd  0x28(%rbx),%xmm10
movsd  0x40(%rbx),%xmm1
movapd %xmm9,%xmm4
mulsd  %xmm1,%xmm4
movapd %xmm10,%xmm5
mulsd  %xmm3,%xmm5
subsd  %xmm4,%xmm5
mulsd  %xmm3,%xmm1
mulsd  %xmm9,%xmm10
addsd  %xmm1,%xmm10
movsd  0x8(%rbx),%xmm7
movsd  0x10(%rbx),%xmm4
movsd  0x18(%rbx),%xmm8
movapd 0xe4d(%rip),%xmm6
movapd %xmm4,%xmm1
xorpd  %xmm6,%xmm1
unpcklpd %xmm4,%xmm1
unpcklpd %xmm7,%xmm7
mulpd  %xmm3,%xmm7
movapd %xmm3,%xmm11
unpcklpd %xmm0,%xmm0
mulpd  %xmm3,%xmm0
shufpd $0x1,%xmm3,%xmm3
mulpd  %xmm3,%xmm1
addpd  %xmm1,%xmm7
movupd %xmm7,0x8(%rbx)
movsd  0x30(%rbx),%xmm1
movapd %xmm1,%xmm7
unpcklpd %xmm5,%xmm7
mulpd  %xmm9,%xmm7
movapd %xmm8,%xmm4
unpcklpd %xmm2,%xmm4
unpcklpd %xmm11,%xmm11
mulpd  %xmm11,%xmm4
subpd  %xmm7,%xmm4
movupd %xmm4,0x18(%rbx)
unpcklpd %xmm1,%xmm5
mulpd  %xmm11,%xmm5
unpcklpd %xmm8,%xmm2
mulpd  %xmm9,%xmm2
addpd  %xmm5,%xmm2
movupd %xmm2,0x28(%rbx)
xorpd  %xmm10,%xmm6
unpcklpd %xmm10,%xmm6
mulpd  %xmm3,%xmm6
addpd  %xmm6,%xmm0
movupd %xmm0,0x38(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @matrixToHessenbergForm_Givens_double(double* %0) {
%2 = alloca double*
%3 = alloca [2 x double]
%4 = alloca i32
%5 = alloca double
%6 = alloca double
store double* %0, double** %2
%7 = bitcast [2 x double]* %3 to i8*
store double 0.000000e+00, double* %5
store double 0.000000e+00, double* %6
%8 = getelementptr inbounds [2 x double], [2 x double]* %3, i64 0, i64 0
%9 = load double*, double** %2
%10 = getelementptr inbounds double, double* %9, i64 3
%11 = load double, double* %10
%12 = load double*, double** %2
%13 = getelementptr inbounds double, double* %12, i64 6
%14 = load double, double* %13
%15 = call i32 @givensRotation_double(double* %8, double %11, double %14)
store i32 0, i32* %4
br label %16
16: ; preds = %59, %1
%17 = load i32, i32* %4
%18 = icmp slt i32 %17, 3
br i1 %18, label %19, label %62
19: ; preds = %16
%20 = load double*, double** %2
%21 = load i32, i32* %4
%22 = add nsw i32 3, %21
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds double, double* %20, i64 %23
%25 = load double, double* %24
store double %25, double* %5
%26 = load double*, double** %2
%27 = load i32, i32* %4
%28 = add nsw i32 6, %27
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds double, double* %26, i64 %29
%31 = load double, double* %30
store double %31, double* %6
%32 = load double, double* %5
%33 = getelementptr inbounds [2 x double], [2 x double]* %3, i64 0, i64 0
%34 = load double, double* %33
%35 = load double, double* %6
%36 = getelementptr inbounds [2 x double], [2 x double]* %3, i64 0, i64 1
%37 = load double, double* %36
%38 = fmul double %35, %37
%39 = fneg double %38
%40 = call double @llvm.fmuladd.f64(double %32, double %34, double %39)
%41 = load double*, double** %2
%42 = load i32, i32* %4
%43 = add nsw i32 3, %42
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds double, double* %41, i64 %44
store double %40, double* %45
%46 = load double, double* %5
%47 = getelementptr inbounds [2 x double], [2 x double]* %3, i64 0, i64 1
%48 = load double, double* %47
%49 = load double, double* %6
%50 = getelementptr inbounds [2 x double], [2 x double]* %3, i64 0, i64 0
%51 = load double, double* %50
%52 = fmul double %49, %51
%53 = call double @llvm.fmuladd.f64(double %46, double %48, double %52)
%54 = load double*, double** %2
%55 = load i32, i32* %4
%56 = add nsw i32 6, %55
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds double, double* %54, i64 %57
store double %53, double* %58
br label %59
59: ; preds = %19
%60 = load i32, i32* %4
%61 = add nsw i32 %60, 1
store i32 %61, i32* %4
br label %16
62: ; preds = %16
store i32 0, i32* %4
br label %63
63: ; preds = %106, %62
%64 = load i32, i32* %4
%65 = icmp slt i32 %64, 9
br i1 %65, label %66, label %109
66: ; preds = %63
%67 = load double*, double** %2
%68 = load i32, i32* %4
%69 = add nsw i32 %68, 1
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds double, double* %67, i64 %70
%72 = load double, double* %71
store double %72, double* %5
%73 = load double*, double** %2
%74 = load i32, i32* %4
%75 = add nsw i32 %74, 2
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds double, double* %73, i64 %76
%78 = load double, double* %77
store double %78, double* %6
%79 = load double, double* %5
%80 = getelementptr inbounds [2 x double], [2 x double]* %3, i64 0, i64 0
%81 = load double, double* %80
%82 = load double, double* %6
%83 = getelementptr inbounds [2 x double], [2 x double]* %3, i64 0, i64 1
%84 = load double, double* %83
%85 = fmul double %82, %84
%86 = fneg double %85
%87 = call double @llvm.fmuladd.f64(double %79, double %81, double %86)
%88 = load double*, double** %2
%89 = load i32, i32* %4
%90 = add nsw i32 %89, 1
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds double, double* %88, i64 %91
store double %87, double* %92
%93 = load double, double* %5
%94 = getelementptr inbounds [2 x double], [2 x double]* %3, i64 0, i64 1
%95 = load double, double* %94
%96 = load double, double* %6
%97 = getelementptr inbounds [2 x double], [2 x double]* %3, i64 0, i64 0
%98 = load double, double* %97
%99 = fmul double %96, %98
%100 = call double @llvm.fmuladd.f64(double %93, double %95, double %99)
%101 = load double*, double** %2
%102 = load i32, i32* %4
%103 = add nsw i32 %102, 2
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds double, double* %101, i64 %104
store double %100, double* %105
br label %106
106: ; preds = %66
%107 = load i32, i32* %4
%108 = add nsw i32 %107, 3
store i32 %108, i32* %4
br label %63
109: ; preds = %63
ret void
}

LLVM IR (-O2):
define void @matrixToHessenbergForm_Givens_double(double* nocapture %0) {
%2 = alloca <2 x double>
%3 = bitcast <2 x double>* %2 to i8*
%4 = getelementptr inbounds <2 x double>, <2 x double>* %2, i64 0, i64 0
%5 = getelementptr inbounds double, double* %0, i64 3
%6 = load double, double* %5
%7 = getelementptr inbounds double, double* %0, i64 6
%8 = load double, double* %7
%9 = call i32 @givensRotation_double(double* %4, double %6, double %8)
%10 = load <2 x double>, <2 x double>* %2
%11 = load double, double* %5
%12 = load double, double* %7
%13 = extractelement <2 x double> %10, i64 1
%14 = extractelement <2 x double> %10, i64 0
%15 = getelementptr inbounds double, double* %0, i64 4
%16 = load double, double* %15
%17 = getelementptr inbounds double, double* %0, i64 7
%18 = load double, double* %17
%19 = fneg double %18
%20 = fmul double %13, %19
%21 = call double @llvm.fmuladd.f64(double %16, double %14, double %20)
%22 = fmul double %18, %14
%23 = call double @llvm.fmuladd.f64(double %16, double %13, double %22)
%24 = getelementptr inbounds double, double* %0, i64 5
%25 = load double, double* %24
%26 = getelementptr inbounds double, double* %0, i64 8
%27 = load double, double* %26
%28 = fneg double %27
%29 = fmul double %13, %28
%30 = call double @llvm.fmuladd.f64(double %25, double %14, double %29)
%31 = fmul double %27, %14
%32 = call double @llvm.fmuladd.f64(double %25, double %13, double %31)
%33 = getelementptr inbounds double, double* %0, i64 1
%34 = load double, double* %33
%35 = getelementptr inbounds double, double* %0, i64 2
%36 = load double, double* %35
%37 = fneg double %36
%38 = insertelement <2 x double> poison, double %36, i64 0
%39 = insertelement <2 x double> %38, double %37, i64 1
%40 = fmul <2 x double> %10, %39
%41 = shufflevector <2 x double> %40, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%42 = insertelement <2 x double> poison, double %34, i64 0
%43 = shufflevector <2 x double> %42, <2 x double> poison, <2 x i32> zeroinitializer
%44 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %43, <2 x double> %10, <2 x double> %41)
%45 = bitcast double* %33 to <2 x double>*
store <2 x double> %44, <2 x double>* %45
%46 = insertelement <2 x double> poison, double %12, i64 0
%47 = insertelement <2 x double> %46, double %30, i64 1
%48 = fneg <2 x double> %47
%49 = shufflevector <2 x double> %10, <2 x double> undef, <2 x i32> <i32 1, i32 1>
%50 = fmul <2 x double> %49, %48
%51 = insertelement <2 x double> poison, double %11, i64 0
%52 = insertelement <2 x double> %51, double %21, i64 1
%53 = shufflevector <2 x double> %10, <2 x double> undef, <2 x i32> zeroinitializer
%54 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %52, <2 x double> %53, <2 x double> %50)
%55 = bitcast double* %5 to <2 x double>*
store <2 x double> %54, <2 x double>* %55
%56 = insertelement <2 x double> poison, double %30, i64 0
%57 = insertelement <2 x double> %56, double %12, i64 1
%58 = fmul <2 x double> %57, %53
%59 = insertelement <2 x double> poison, double %21, i64 0
%60 = insertelement <2 x double> %59, double %11, i64 1
%61 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %60, <2 x double> %49, <2 x double> %58)
%62 = bitcast double* %24 to <2 x double>*
store <2 x double> %61, <2 x double>* %62
%63 = fneg double %32
%64 = insertelement <2 x double> poison, double %32, i64 0
%65 = insertelement <2 x double> %64, double %63, i64 1
%66 = fmul <2 x double> %10, %65
%67 = shufflevector <2 x double> %66, <2 x double> poison, <2 x i32> <i32 1, i32 0>
%68 = insertelement <2 x double> poison, double %23, i64 0
%69 = shufflevector <2 x double> %68, <2 x double> poison, <2 x i32> zeroinitializer
%70 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %69, <2 x double> %10, <2 x double> %67)
%71 = bitcast double* %17 to <2 x double>*
store <2 x double> %70, <2 x double>* %71
ret void
}