#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 fabs(double);
void Product_and_Sum_of_Shifts(double *H, int n, int max_row, double *shift,
                               double *trace, double *det, int iteration) {
  double *pH = H + max_row * n;
  double *p_aux;
  int i;
  int min_col = max_row - 1;
  if ((iteration % 10) == 0) {
    *shift += pH[max_row];
    for (i = 0, p_aux = H; i <= max_row; p_aux += n, i++)
      p_aux[i] -= pH[max_row];
    p_aux = pH - n;
    *trace = fabs(pH[min_col]) + fabs(p_aux[min_col - 1]);
    *det = *trace * *trace;
    *trace *= 1.5;
  } else {
    p_aux = pH - n;
    *trace = p_aux[min_col] + pH[max_row];
    *det = p_aux[min_col] * pH[max_row] - p_aux[max_row] * pH[min_col];
  }
}


x86 assembly (clang, -O0):
<Product_and_Sum_of_Shifts>:
push   %rbp
mov    %rsp,%rbp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
imul   -0xc(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x40(%rbp)
mov    0x10(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1257 <Product_and_Sum_of_Shifts+0x157>
mov    -0x30(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
movl   $0x0,-0x3c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     11cd <Product_and_Sum_of_Shifts+0xcd>
mov    -0x30(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x38(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0xc(%rbp),%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    117b <Product_and_Sum_of_Shifts+0x7b>
mov    -0x30(%rbp),%rax
movslq -0xc(%rbp),%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movaps 0xe17(%rip),%xmm1
pand   %xmm1,%xmm0
mov    -0x38(%rbp),%rax
mov    -0x40(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
movaps 0xdfa(%rip),%xmm2
pand   %xmm2,%xmm1
addsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x20(%rbp),%rax
mulsd  (%rax),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
movsd  0xdb6(%rip),%xmm0
mulsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
jmp    12ec <Product_and_Sum_of_Shifts+0x1ec>
mov    -0x30(%rbp),%rax
movslq -0xc(%rbp),%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x10(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x38(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x38(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x30(%rbp),%rax
movslq -0x40(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<Product_and_Sum_of_Shifts>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %edx,%eax
imul   %esi,%eax
cltq
lea    (%rdi,%rax,8),%r13
lea    -0x1(%rdx),%ebp
imul   $0xcccccccd,0x38(%rsp),%eax
cc
add    $0x19999998,%eax
ror    %eax
cmp    $0x19999998,%eax
jbe    1178 <Product_and_Sum_of_Shifts+0x78>
movslq %esi,%rax
shl    $0x3,%rax
mov    %r13,%rcx
sub    %rax,%rcx
movslq %ebp,%rax
movsd  (%rcx,%rax,8),%xmm0
movslq %edx,%rdx
addsd  0x0(%r13,%rdx,8),%xmm0
movsd  %xmm0,(%r8)
movsd  (%rcx,%rax,8),%xmm0
movsd  0x0(%r13,%rax,8),%xmm1
mulsd  (%rcx,%rdx,8),%xmm1
mulsd  0x0(%r13,%rdx,8),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%r9)
jmp    12e4 <Product_and_Sum_of_Shifts+0x1e4>
movslq %edx,%r11
movsd  0x0(%r13,%r11,8),%xmm0
addsd  (%rcx),%xmm0
movsd  %xmm0,(%rcx)
movslq %esi,%r14
test   %edx,%edx
js     1298 <Product_and_Sum_of_Shifts+0x198>
mov    %edx,%r15d
add    $0x1,%r15
mov    %r15d,%esi
and    $0x3,%esi
cmp    $0x3,%edx
jae    11b7 <Product_and_Sum_of_Shifts+0xb7>
xor    %ecx,%ecx
test   %rsi,%rsi
jne    1271 <Product_and_Sum_of_Shifts+0x171>
jmp    1298 <Product_and_Sum_of_Shifts+0x198>
mov    %ebp,-0xc(%rsp)
mov    %r9,-0x8(%rsp)
and    $0xfffffffc,%r15d
mov    %r14,%rdx
shl    $0x4,%rdx
add    $0x10,%rdx
mov    %r14,%r12
shl    $0x5,%r12
lea    0x20(%r12),%rbx
lea    0x8(,%r14,8),%rax
lea    (%r14,%r14,2),%rcx
lea    0x18(,%rcx,8),%r10
xor    %ebp,%ebp
xor    %r9d,%r9d
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
movsd  (%rdi,%r9,1),%xmm0
subsd  0x0(%r13,%r11,8),%xmm0
movsd  %xmm0,(%rdi,%r9,1)
movsd  (%rdi,%rax,1),%xmm0
subsd  0x0(%r13,%r11,8),%xmm0
movsd  %xmm0,(%rdi,%rax,1)
movsd  (%rdi,%rdx,1),%xmm0
subsd  0x0(%r13,%r11,8),%xmm0
movsd  %xmm0,(%rdi,%rdx,1)
movsd  (%rdi,%r10,1),%xmm0
subsd  0x0(%r13,%r11,8),%xmm0
movsd  %xmm0,(%rdi,%r10,1)
add    $0x4,%rcx
add    %rbx,%rdx
add    %rbx,%rax
add    %rbx,%r10
add    %rbx,%r9
add    %r12,%rbp
cmp    %rcx,%r15
jne    1200 <Product_and_Sum_of_Shifts+0x100>
add    %rbp,%rdi
mov    -0x8(%rsp),%r9
mov    -0xc(%rsp),%ebp
test   %rsi,%rsi
je     1298 <Product_and_Sum_of_Shifts+0x198>
lea    (%rdi,%rcx,8),%rax
lea    0x8(,%r14,8),%rcx
nopl   (%rax)
movsd  (%rax),%xmm0
subsd  0x0(%r13,%r11,8),%xmm0
movsd  %xmm0,(%rax)
add    %rcx,%rax
add    $0xffffffffffffffff,%rsi
jne    1280 <Product_and_Sum_of_Shifts+0x180>
shl    $0x3,%r14
movslq %ebp,%rax
movsd  0x0(%r13,%rax,8),%xmm0
sub    %r14,%r13
movapd 0xd4f(%rip),%xmm1
andpd  %xmm1,%xmm0
movsd  -0x10(%r13,%r11,8),%xmm2
andpd  %xmm1,%xmm2
addsd  %xmm0,%xmm2
movsd  %xmm2,(%r8)
mulsd  %xmm2,%xmm2
movsd  %xmm2,(%r9)
movsd  (%r8),%xmm0
mulsd  0xd31(%rip),%xmm0
movsd  %xmm0,(%r8)
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @Product_and_Sum_of_Shifts(double* %0, i32 %1, i32 %2, double* %3, double* %4, double* %5, i32 %6) {
%8 = alloca double*
%9 = alloca i32
%10 = alloca i32
%11 = alloca double*
%12 = alloca double*
%13 = alloca double*
%14 = alloca i32
%15 = alloca double*
%16 = alloca double*
%17 = alloca i32
%18 = alloca i32
store double* %0, double** %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store double* %3, double** %11
store double* %4, double** %12
store double* %5, double** %13
store i32 %6, i32* %14
%19 = load double*, double** %8
%20 = load i32, i32* %10
%21 = load i32, i32* %9
%22 = mul nsw i32 %20, %21
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds double, double* %19, i64 %23
store double* %24, double** %15
%25 = load i32, i32* %10
%26 = sub nsw i32 %25, 1
store i32 %26, i32* %18
%27 = load i32, i32* %14
%28 = srem i32 %27, 10
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %93
30: ; preds = %7
%31 = load double*, double** %15
%32 = load i32, i32* %10
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds double, double* %31, i64 %33
%35 = load double, double* %34
%36 = load double*, double** %11
%37 = load double, double* %36
%38 = fadd double %37, %35
store double %38, double* %36
store i32 0, i32* %17
%39 = load double*, double** %8
store double* %39, double** %16
br label %40
40: ; preds = %56, %30
%41 = load i32, i32* %17
%42 = load i32, i32* %10
%43 = icmp sle i32 %41, %42
br i1 %43, label %44, label %63
44: ; preds = %40
%45 = load double*, double** %15
%46 = load i32, i32* %10
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds double, double* %45, i64 %47
%49 = load double, double* %48
%50 = load double*, double** %16
%51 = load i32, i32* %17
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds double, double* %50, i64 %52
%54 = load double, double* %53
%55 = fsub double %54, %49
store double %55, double* %53
br label %56
56: ; preds = %44
%57 = load i32, i32* %9
%58 = load double*, double** %16
%59 = sext i32 %57 to i64
%60 = getelementptr inbounds double, double* %58, i64 %59
store double* %60, double** %16
%61 = load i32, i32* %17
%62 = add nsw i32 %61, 1
store i32 %62, i32* %17
br label %40
63: ; preds = %40
%64 = load double*, double** %15
%65 = load i32, i32* %9
%66 = sext i32 %65 to i64
%67 = sub i64 0, %66
%68 = getelementptr inbounds double, double* %64, i64 %67
store double* %68, double** %16
%69 = load double*, double** %15
%70 = load i32, i32* %18
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds double, double* %69, i64 %71
%73 = load double, double* %72
%74 = call double @llvm.fabs.f64(double %73)
%75 = load double*, double** %16
%76 = load i32, i32* %18
%77 = sub nsw i32 %76, 1
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds double, double* %75, i64 %78
%80 = load double, double* %79
%81 = call double @llvm.fabs.f64(double %80)
%82 = fadd double %74, %81
%83 = load double*, double** %12
store double %82, double* %83
%84 = load double*, double** %12
%85 = load double, double* %84
%86 = load double*, double** %12
%87 = load double, double* %86
%88 = fmul double %85, %87
%89 = load double*, double** %13
store double %88, double* %89
%90 = load double*, double** %12
%91 = load double, double* %90
%92 = fmul double %91, 1.500000e+00
store double %92, double* %90
br label %135
93: ; preds = %7
%94 = load double*, double** %15
%95 = load i32, i32* %9
%96 = sext i32 %95 to i64
%97 = sub i64 0, %96
%98 = getelementptr inbounds double, double* %94, i64 %97
store double* %98, double** %16
%99 = load double*, double** %16
%100 = load i32, i32* %18
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds double, double* %99, i64 %101
%103 = load double, double* %102
%104 = load double*, double** %15
%105 = load i32, i32* %10
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds double, double* %104, i64 %106
%108 = load double, double* %107
%109 = fadd double %103, %108
%110 = load double*, double** %12
store double %109, double* %110
%111 = load double*, double** %16
%112 = load i32, i32* %18
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds double, double* %111, i64 %113
%115 = load double, double* %114
%116 = load double*, double** %15
%117 = load i32, i32* %10
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds double, double* %116, i64 %118
%120 = load double, double* %119
%121 = load double*, double** %16
%122 = load i32, i32* %10
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds double, double* %121, i64 %123
%125 = load double, double* %124
%126 = load double*, double** %15
%127 = load i32, i32* %18
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds double, double* %126, i64 %128
%130 = load double, double* %129
%131 = fmul double %125, %130
%132 = fneg double %131
%133 = call double @llvm.fmuladd.f64(double %115, double %120, double %132)
%134 = load double*, double** %13
store double %133, double* %134
br label %135
135: ; preds = %93, %63
ret void
}

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