#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 class(int, double, double, double *, double *);
int /*<<< orphan*/ imtql2(int, double *, double *, double *);
void gaussj(int n, double alpha, double beta, double *b, double *t, double *w) {
  double mu0 = class(n, alpha, beta, b, t);
  int i;
  w[0] = 1.0;
  imtql2(n, t, b, w);
  for (i = 0; i < n; ++i)
    w[i] = mu0 * w[i] * w[i];
}


x86 assembly (clang, -O0):
<gaussj>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
mov    -0x4(%rbp),%edi
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1040 <class@plt>
movsd  %xmm0,-0x38(%rbp)
mov    -0x30(%rbp),%rax
movsd  0xe94(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x4(%rbp),%edi
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x30(%rbp),%rcx
call   1030 <imtql2@plt>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11d1 <gaussj+0xb1>
movsd  -0x38(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    118b <gaussj+0x6b>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gaussj>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rcx,%rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %edi,%ebp
call   1040 <class@plt>
movapd %xmm0,(%rsp)
movabs $0x3ff0000000000000,%rax
mov    %rax,(%rbx)
mov    %ebp,%edi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %rbx,%rcx
call   1030 <imtql2@plt>
movapd (%rsp),%xmm7
test   %ebp,%ebp
jle    126f <gaussj+0x14f>
mov    %ebp,%eax
cmp    $0x4,%ebp
jae    1177 <gaussj+0x57>
xor    %ecx,%ecx
jmp    1250 <gaussj+0x130>
mov    %eax,%ecx
and    $0xfffffffc,%ecx
movapd %xmm7,%xmm0
unpcklpd %xmm7,%xmm0
lea    -0x4(%rcx),%rdx
mov    %rdx,%rsi
shr    $0x2,%rsi
add    $0x1,%rsi
test   %rdx,%rdx
je     127a <gaussj+0x15a>
mov    %rsi,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nop
movupd (%rbx,%rdx,8),%xmm1
movupd 0x10(%rbx,%rdx,8),%xmm2
movupd 0x20(%rbx,%rdx,8),%xmm3
movupd 0x30(%rbx,%rdx,8),%xmm4
movapd %xmm0,%xmm5
mulpd  %xmm1,%xmm5
movapd %xmm0,%xmm6
mulpd  %xmm2,%xmm6
mulpd  %xmm1,%xmm5
mulpd  %xmm2,%xmm6
movupd %xmm5,(%rbx,%rdx,8)
movupd %xmm6,0x10(%rbx,%rdx,8)
movapd %xmm0,%xmm1
mulpd  %xmm3,%xmm1
movapd %xmm0,%xmm2
mulpd  %xmm4,%xmm2
mulpd  %xmm3,%xmm1
mulpd  %xmm4,%xmm2
movupd %xmm1,0x20(%rbx,%rdx,8)
movupd %xmm2,0x30(%rbx,%rdx,8)
add    $0x8,%rdx
add    $0xfffffffffffffffe,%rdi
jne    11b0 <gaussj+0x90>
test   $0x1,%sil
je     1248 <gaussj+0x128>
movupd (%rbx,%rdx,8),%xmm1
movupd 0x10(%rbx,%rdx,8),%xmm2
movapd %xmm0,%xmm3
mulpd  %xmm1,%xmm3
mulpd  %xmm2,%xmm0
mulpd  %xmm1,%xmm3
mulpd  %xmm2,%xmm0
movupd %xmm3,(%rbx,%rdx,8)
movupd %xmm0,0x10(%rbx,%rdx,8)
cmp    %rax,%rcx
je     126f <gaussj+0x14f>
nopl   (%rax)
movsd  (%rbx,%rcx,8),%xmm0
movapd %xmm7,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rbx,%rcx,8)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1250 <gaussj+0x130>
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %edx,%edx
test   $0x1,%sil
jne    121e <gaussj+0xfe>
jmp    1248 <gaussj+0x128>

LLVM IR (-O0):
define void @gaussj(i32 %0, double %1, double %2, double* %3, double* %4, double* %5) {
%7 = alloca i32
%8 = alloca double
%9 = alloca double
%10 = alloca double*
%11 = alloca double*
%12 = alloca double*
%13 = alloca double
%14 = alloca i32
store i32 %0, i32* %7
store double %1, double* %8
store double %2, double* %9
store double* %3, double** %10
store double* %4, double** %11
store double* %5, double** %12
%15 = load i32, i32* %7
%16 = load double, double* %8
%17 = load double, double* %9
%18 = load double*, double** %10
%19 = load double*, double** %11
%20 = call double @class(i32 %15, double %16, double %17, double* %18, double* %19)
store double %20, double* %13
%21 = load double*, double** %12
%22 = getelementptr inbounds double, double* %21, i64 0
store double 1.000000e+00, double* %22
%23 = load i32, i32* %7
%24 = load double*, double** %11
%25 = load double*, double** %10
%26 = load double*, double** %12
%27 = call i32 @imtql2(i32 %23, double* %24, double* %25, double* %26)
store i32 0, i32* %14
br label %28
28: ; preds = %50, %6
%29 = load i32, i32* %14
%30 = load i32, i32* %7
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %53
32: ; preds = %28
%33 = load double, double* %13
%34 = load double*, double** %12
%35 = load i32, i32* %14
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds double, double* %34, i64 %36
%38 = load double, double* %37
%39 = fmul double %33, %38
%40 = load double*, double** %12
%41 = load i32, i32* %14
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds double, double* %40, i64 %42
%44 = load double, double* %43
%45 = fmul double %39, %44
%46 = load double*, double** %12
%47 = load i32, i32* %14
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds double, double* %46, i64 %48
store double %45, double* %49
br label %50
50: ; preds = %32
%51 = load i32, i32* %14
%52 = add nsw i32 %51, 1
store i32 %52, i32* %14
br label %28
53: ; preds = %28
ret void
}

LLVM IR (-O2):
define void @gaussj(i32 %0, double %1, double %2, double* %3, double* %4, double* %5) {
%7 = tail call double @class(i32 %0, double %1, double %2, double* %3, double* %4)
store double 1.000000e+00, double* %5
%8 = tail call i32 @imtql2(i32 %0, double* %4, double* %3, double* %5)
%9 = icmp sgt i32 %0, 0
br i1 %9, label %10, label %85
10: ; preds = %6
%11 = zext i32 %0 to i64
%12 = icmp ult i32 %0, 4
br i1 %12, label %75, label %13
13: ; preds = %10
%14 = and i64 %11, 4294967292
%15 = insertelement <2 x double> poison, double %7, i64 0
%16 = shufflevector <2 x double> %15, <2 x double> poison, <2 x i32> zeroinitializer
%17 = insertelement <2 x double> poison, double %7, i64 0
%18 = shufflevector <2 x double> %17, <2 x double> poison, <2 x i32> zeroinitializer
%19 = add nsw i64 %14, -4
%20 = lshr exact i64 %19, 2
%21 = add nuw nsw i64 %20, 1
%22 = and i64 %21, 1
%23 = icmp eq i64 %19, 0
br i1 %23, label %57, label %24
24: ; preds = %13
%25 = and i64 %21, 9223372036854775806
br label %26
26: ; preds = %26, %24
%27 = phi i64 [ 0, %24 ], [ %54, %26 ]
%28 = phi i64 [ 0, %24 ], [ %55, %26 ]
%29 = getelementptr inbounds double, double* %5, i64 %27
%30 = bitcast double* %29 to <2 x double>*
%31 = load <2 x double>, <2 x double>* %30
%32 = getelementptr inbounds double, double* %29, i64 2
%33 = bitcast double* %32 to <2 x double>*
%34 = load <2 x double>, <2 x double>* %33
%35 = fmul <2 x double> %16, %31
%36 = fmul <2 x double> %18, %34
%37 = fmul <2 x double> %31, %35
%38 = fmul <2 x double> %34, %36
%39 = bitcast double* %29 to <2 x double>*
store <2 x double> %37, <2 x double>* %39
%40 = bitcast double* %32 to <2 x double>*
store <2 x double> %38, <2 x double>* %40
%41 = or i64 %27, 4
%42 = getelementptr inbounds double, double* %5, i64 %41
%43 = bitcast double* %42 to <2 x double>*
%44 = load <2 x double>, <2 x double>* %43
%45 = getelementptr inbounds double, double* %42, i64 2
%46 = bitcast double* %45 to <2 x double>*
%47 = load <2 x double>, <2 x double>* %46
%48 = fmul <2 x double> %16, %44
%49 = fmul <2 x double> %18, %47
%50 = fmul <2 x double> %44, %48
%51 = fmul <2 x double> %47, %49
%52 = bitcast double* %42 to <2 x double>*
store <2 x double> %50, <2 x double>* %52
%53 = bitcast double* %45 to <2 x double>*
store <2 x double> %51, <2 x double>* %53
%54 = add nuw i64 %27, 8
%55 = add i64 %28, 2
%56 = icmp eq i64 %55, %25
br i1 %56, label %57, label %26
57: ; preds = %26, %13
%58 = phi i64 [ 0, %13 ], [ %54, %26 ]
%59 = icmp eq i64 %22, 0
br i1 %59, label %73, label %60
60: ; preds = %57
%61 = getelementptr inbounds double, double* %5, i64 %58
%62 = bitcast double* %61 to <2 x double>*
%63 = load <2 x double>, <2 x double>* %62
%64 = getelementptr inbounds double, double* %61, i64 2
%65 = bitcast double* %64 to <2 x double>*
%66 = load <2 x double>, <2 x double>* %65
%67 = fmul <2 x double> %16, %63
%68 = fmul <2 x double> %18, %66
%69 = fmul <2 x double> %63, %67
%70 = fmul <2 x double> %66, %68
%71 = bitcast double* %61 to <2 x double>*
store <2 x double> %69, <2 x double>* %71
%72 = bitcast double* %64 to <2 x double>*
store <2 x double> %70, <2 x double>* %72
br label %73
73: ; preds = %57, %60
%74 = icmp eq i64 %14, %11
br i1 %74, label %85, label %75
75: ; preds = %10, %73
%76 = phi i64 [ 0, %10 ], [ %14, %73 ]
br label %77
77: ; preds = %75, %77
%78 = phi i64 [ %83, %77 ], [ %76, %75 ]
%79 = getelementptr inbounds double, double* %5, i64 %78
%80 = load double, double* %79
%81 = fmul double %7, %80
%82 = fmul double %80, %81
store double %82, double* %79
%83 = add nuw nsw i64 %78, 1
%84 = icmp eq i64 %83, %11
br i1 %84, label %85, label %77
85: ; preds = %77, %73, %6
ret void
}