#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*/ free_ivector(int *, int, int);
int /*<<< orphan*/ free_matrix(float **, int, int, int, int);
int *ivector(int, int);
float **matrix(int, int, int, int);
float stub1(float, float);
float stub2(float);
void fred2(int n, float a, float b, float t[], float f[], float w[],
           float (*g)(float), float (*ak)(float, float)) {
  void gauleg(float x1, float x2, float x[], float w[], int n);
  void lubksb(float **a, int n, int *indx, float b[]);
  void ludcmp(float **a, int n, int *indx, float *d);
  int i, j, *indx;
  float d, **omk;
  indx = ivector(1, n);
  omk = matrix(1, n, 1, n);
  gauleg(a, b, t, w, n);
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++)
      omk[i][j] = (float)(i == j) - (*ak)(t[i], t[j]) * w[j];
    f[i] = (*g)(t[i]);
  }
  ludcmp(omk, n, indx, &d);
  lubksb(omk, n, indx, f);
  free_matrix(omk, 1, n, 1, n);
  free_ivector(indx, 1, n);
}


x86 assembly (clang, -O0):
<fred2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
mov    -0x4(%rbp),%esi
mov    $0x1,%edi
call   1090 <ivector@plt>
mov    %rax,-0x48(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x4(%rbp),%ecx
mov    $0x1,%edx
mov    %edx,%edi
call   1070 <matrix@plt>
mov    %rax,-0x58(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x4(%rbp),%edx
call   1040 <gauleg@plt>
movl   $0x1,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     12af <fred2+0x13f>
movl   $0x1,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1281 <fred2+0x111>
mov    -0x3c(%rbp),%eax
cmp    -0x40(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x5c(%rbp)
mov    -0x38(%rbp),%rax
mov    -0x18(%rbp),%rcx
movslq -0x3c(%rbp),%rdx
movss  (%rcx,%rdx,4),%xmm0
mov    -0x18(%rbp),%rcx
movslq -0x40(%rbp),%rdx
movss  (%rcx,%rdx,4),%xmm1
call   *%rax
movss  -0x5c(%rbp),%xmm1
mov    -0x28(%rbp),%rax
movslq -0x40(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm2
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x58(%rbp),%rax
movslq -0x3c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x40(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    11f4 <fred2+0x84>
mov    -0x30(%rbp),%rax
mov    -0x18(%rbp),%rcx
movslq -0x3c(%rbp),%rdx
movss  (%rcx,%rdx,4),%xmm0
call   *%rax
mov    -0x20(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11e1 <fred2+0x71>
mov    -0x58(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    -0x48(%rbp),%rdx
lea    -0x4c(%rbp),%rcx
call   1030 <ludcmp@plt>
mov    -0x58(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    -0x48(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1060 <lubksb@plt>
mov    -0x58(%rbp),%rdi
mov    -0x4(%rbp),%edx
mov    -0x4(%rbp),%r8d
mov    $0x1,%ecx
mov    %ecx,%esi
call   1050 <free_matrix@plt>
mov    -0x48(%rbp),%rdi
mov    -0x4(%rbp),%edx
mov    $0x1,%esi
call   1080 <free_ivector@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fred2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %r9,0x38(%rsp)
mov    %r8,0x30(%rsp)
mov    %rcx,%rbp
mov    %rdx,0x18(%rsp)
mov    %rsi,%r14
movss  %xmm1,0x8(%rsp)
movss  %xmm0,0x10(%rsp)
mov    %edi,%ebx
mov    $0x1,%edi
mov    %ebx,%esi
call   1090 <ivector@plt>
mov    %rax,0x28(%rsp)
mov    $0x1,%edi
mov    %ebx,%esi
mov    $0x1,%edx
mov    %ebx,%ecx
call   1070 <matrix@plt>
mov    %rax,0x20(%rsp)
movss  0x10(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
mov    %r14,%rdi
mov    %rbp,%r15
mov    %rbp,%rsi
mov    %ebx,%edx
call   1040 <gauleg@plt>
mov    %ebx,0xc(%rsp)
test   %ebx,%ebx
jle    1292 <fred2+0x122>
mov    0xc(%rsp),%r12d
lea    0x1(%r12),%rax
mov    %rax,0x10(%rsp)
mov    $0x1,%r13d
xor    %ebp,%ebp
jmp    1234 <fred2+0xc4>
nopl   0x0(%rax,%rax,1)
movss  (%r14,%r13,4),%xmm0
call   *0x30(%rsp)
mov    0x18(%rsp),%rax
movss  %xmm0,(%rax,%r13,4)
add    $0x1,%r13
add    $0x1,%rbp
cmp    0x10(%rsp),%r13
je     1292 <fred2+0x122>
xor    %ebx,%ebx
jmp    1280 <fred2+0x110>
nopl   0x0(%rax,%rax,1)
movss  %xmm0,0x8(%rsp)
movss  (%r14,%r13,4),%xmm0
movss  0x4(%r14,%rbx,4),%xmm1
call   *0x38(%rsp)
mulss  0x4(%r15,%rbx,4),%xmm0
movss  0x8(%rsp),%xmm1
subss  %xmm0,%xmm1
mov    0x20(%rsp),%rax
mov    (%rax,%r13,8),%rax
movss  %xmm1,0x4(%rax,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r12
je     1210 <fred2+0xa0>
movss  0xd78(%rip),%xmm0
cmp    %rbx,%rbp
je     1240 <fred2+0xd0>
xorps  %xmm0,%xmm0
jmp    1240 <fred2+0xd0>
lea    0x44(%rsp),%rcx
mov    0x20(%rsp),%rbp
mov    %rbp,%rdi
mov    0xc(%rsp),%ebx
mov    %ebx,%esi
mov    0x28(%rsp),%r14
mov    %r14,%rdx
call   1030 <ludcmp@plt>
mov    %rbp,%rdi
mov    %ebx,%esi
mov    %r14,%rdx
mov    0x18(%rsp),%rcx
call   1060 <lubksb@plt>
mov    %rbp,%rdi
mov    $0x1,%esi
mov    %ebx,%edx
mov    $0x1,%ecx
mov    %ebx,%r8d
call   1050 <free_matrix@plt>
mov    %r14,%rdi
mov    $0x1,%esi
mov    %ebx,%edx
call   1080 <free_ivector@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @fred2(i32 %0, float %1, float %2, float* %3, float* %4, float* %5, float (float)* nocapture %6, float (float, float)* nocapture %7) {
%9 = alloca float
%10 = bitcast float* %9 to i8*
%11 = tail call i32* @ivector(i32 1, i32 %0)
%12 = tail call float** @matrix(i32 1, i32 %0, i32 1, i32 %0)
tail call void @gauleg(float %1, float %2, float* %3, float* %5, i32 %0)
%13 = icmp slt i32 %0, 1
br i1 %13, label %44, label %14
14: ; preds = %8
%15 = add nuw i32 %0, 1
%16 = zext i32 %15 to i64
br label %17
17: ; preds = %37, %14
%18 = phi i64 [ 1, %14 ], [ %42, %37 ]
%19 = getelementptr inbounds float, float* %3, i64 %18
%20 = getelementptr inbounds float*, float** %12, i64 %18
br label %21
21: ; preds = %17, %21
%22 = phi i64 [ 1, %17 ], [ %35, %21 ]
%23 = icmp eq i64 %18, %22
%24 = uitofp i1 %23 to float
%25 = load float, float* %19
%26 = getelementptr inbounds float, float* %3, i64 %22
%27 = load float, float* %26
%28 = tail call float %7(float %25, float %27)
%29 = getelementptr inbounds float, float* %5, i64 %22
%30 = load float, float* %29
%31 = fneg float %28
%32 = tail call float @llvm.fmuladd.f32(float %31, float %30, float %24)
%33 = load float*, float** %20
%34 = getelementptr inbounds float, float* %33, i64 %22
store float %32, float* %34
%35 = add nuw nsw i64 %22, 1
%36 = icmp eq i64 %35, %16
br i1 %36, label %37, label %21
37: ; preds = %21
%38 = getelementptr inbounds float, float* %3, i64 %18
%39 = load float, float* %38
%40 = tail call float %6(float %39)
%41 = getelementptr inbounds float, float* %4, i64 %18
store float %40, float* %41
%42 = add nuw nsw i64 %18, 1
%43 = icmp eq i64 %42, %16
br i1 %43, label %44, label %17
44: ; preds = %37, %8
%45 = call i32 @free_matrix(float** %12, i32 1, i32 %0, i32 1, i32 %0)
%46 = call i32 @free_ivector(i32* %11, i32 1, i32 %0)
ret void
}