; LLVM IR from radualexandrub/Optimization-Algorithms-Find-local-minimum :: 2D_Derivative_NonQuadratic_CostFunctions (Quasi_Newton)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@.str = external hidden unnamed_addr constant [20 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [28 x i8], align 1
@logfile2 = external dso_local global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: nounwind uwtable
declare dso_local void @Vec_scale(i32 noundef, double noundef, ptr noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local void @Vec_add_coefVec(i32 noundef, ptr noundef, double noundef, ptr noundef, ptr noundef) #3

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: nounwind uwtable
declare dso_local double @Vec_norm(i32 noundef, ptr noundef) #3

declare i32 @printf(ptr noundef, ...) #4

; Function Attrs: nounwind uwtable
declare dso_local void @Mat_mult_Vec(i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) #3

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #1

; Function Attrs: nounwind uwtable
define dso_local void @Quasi_Newton(i32 noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, double noundef %4, ptr noundef %5) #3 {
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca double, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca double, align 8
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i64, align 8
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca ptr, align 8
  %27 = alloca i64, align 8
  %28 = alloca i64, align 8
  %29 = alloca i64, align 8
  %30 = alloca i64, align 8
  %31 = alloca i64, align 8
  %32 = alloca i64, align 8
  %33 = alloca i64, align 8
  %34 = alloca i64, align 8
  %35 = alloca i64, align 8
  %36 = alloca i64, align 8
  %37 = alloca double, align 8
  %38 = alloca i64, align 8
  %39 = alloca i64, align 8
  store i32 %0, ptr %7, align 4, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !9
  store ptr %2, ptr %9, align 8, !tbaa !9
  store ptr %3, ptr %10, align 8, !tbaa !9
  store double %4, ptr %11, align 8, !tbaa !11
  store ptr %5, ptr %12, align 8, !tbaa !9
  %40 = load i32, ptr %7, align 4, !tbaa !5
  %41 = zext i32 %40 to i64
  %42 = load ptr, ptr @logfile2, align 8, !tbaa !9
  %43 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %42, ptr noundef @.str) #5
  %44 = load i32, ptr %7, align 4, !tbaa !5
  %45 = zext i32 %44 to i64
  %46 = call ptr @llvm.stacksave.p0()
  store ptr %46, ptr %13, align 8
  %47 = alloca double, i64 %45, align 16
  store i64 %45, ptr %14, align 8
  %48 = load i32, ptr %7, align 4, !tbaa !5
  %49 = zext i32 %48 to i64
  %50 = alloca double, i64 %49, align 16
  store i64 %49, ptr %15, align 8
  %51 = load i32, ptr %7, align 4, !tbaa !5
  %52 = zext i32 %51 to i64
  %53 = alloca double, i64 %52, align 16
  store i64 %52, ptr %16, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %54 = load i32, ptr %7, align 4, !tbaa !5
  %55 = zext i32 %54 to i64
  %56 = load i32, ptr %7, align 4, !tbaa !5
  %57 = zext i32 %56 to i64
  %58 = mul nuw i64 %55, %57
  %59 = alloca double, i64 %58, align 16
  store i64 %55, ptr %18, align 8
  store i64 %57, ptr %19, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #5
  store i32 0, ptr %20, align 4, !tbaa !5
  br label %60

60:                                               ; preds = %96, %6
  %61 = load i32, ptr %20, align 4, !tbaa !5
  %62 = load i32, ptr %7, align 4, !tbaa !5
  %63 = icmp slt i32 %61, %62
  br i1 %63, label %65, label %64

64:                                               ; preds = %60
  store i32 2, ptr %21, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  br label %99

65:                                               ; preds = %60
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #5
  store i32 0, ptr %22, align 4, !tbaa !5
  br label %66

66:                                               ; preds = %92, %65
  %67 = load i32, ptr %22, align 4, !tbaa !5
  %68 = load i32, ptr %7, align 4, !tbaa !5
  %69 = icmp slt i32 %67, %68
  br i1 %69, label %71, label %70

70:                                               ; preds = %66
  store i32 5, ptr %21, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #5
  br label %95

71:                                               ; preds = %66
  %72 = load i32, ptr %20, align 4, !tbaa !5
  %73 = load i32, ptr %22, align 4, !tbaa !5
  %74 = icmp eq i32 %72, %73
  br i1 %74, label %75, label %83

75:                                               ; preds = %71
  %76 = load i32, ptr %20, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = mul nsw i64 %77, %57
  %79 = getelementptr inbounds double, ptr %59, i64 %78
  %80 = load i32, ptr %22, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds double, ptr %79, i64 %81
  store double 1.000000e+00, ptr %82, align 8, !tbaa !11
  br label %91

83:                                               ; preds = %71
  %84 = load i32, ptr %20, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = mul nsw i64 %85, %57
  %87 = getelementptr inbounds double, ptr %59, i64 %86
  %88 = load i32, ptr %22, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds double, ptr %87, i64 %89
  store double 0.000000e+00, ptr %90, align 8, !tbaa !11
  br label %91

91:                                               ; preds = %83, %75
  br label %92

92:                                               ; preds = %91
  %93 = load i32, ptr %22, align 4, !tbaa !5
  %94 = add nsw i32 %93, 1
  store i32 %94, ptr %22, align 4, !tbaa !5
  br label %66, !llvm.loop !13

95:                                               ; preds = %70
  br label %96

96:                                               ; preds = %95
  %97 = load i32, ptr %20, align 4, !tbaa !5
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr %20, align 4, !tbaa !5
  br label %60, !llvm.loop !15

99:                                               ; preds = %64
  %100 = load i32, ptr %7, align 4, !tbaa !5
  %101 = zext i32 %100 to i64
  %102 = alloca double, i64 %101, align 16
  store i64 %101, ptr %23, align 8
  %103 = load ptr, ptr %9, align 8, !tbaa !9
  %104 = load ptr, ptr %12, align 8, !tbaa !9
  %105 = getelementptr inbounds double, ptr %104, i64 0
  %106 = load double, ptr %105, align 8, !tbaa !11
  %107 = load ptr, ptr %12, align 8, !tbaa !9
  %108 = getelementptr inbounds double, ptr %107, i64 1
  %109 = load double, ptr %108, align 8, !tbaa !11
  %110 = call double %103(double noundef %106, double noundef %109)
  %111 = getelementptr inbounds double, ptr %102, i64 0
  store double %110, ptr %111, align 16, !tbaa !11
  %112 = load ptr, ptr %10, align 8, !tbaa !9
  %113 = load ptr, ptr %12, align 8, !tbaa !9
  %114 = getelementptr inbounds double, ptr %113, i64 0
  %115 = load double, ptr %114, align 8, !tbaa !11
  %116 = load ptr, ptr %12, align 8, !tbaa !9
  %117 = getelementptr inbounds double, ptr %116, i64 1
  %118 = load double, ptr %117, align 8, !tbaa !11
  %119 = call double %112(double noundef %115, double noundef %118)
  %120 = getelementptr inbounds double, ptr %102, i64 1
  store double %119, ptr %120, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #5
  store i32 10000, ptr %24, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #5
  store i32 0, ptr %25, align 4, !tbaa !5
  br label %121

121:                                              ; preds = %282, %99
  %122 = load i32, ptr %25, align 4, !tbaa !5
  %123 = load i32, ptr %24, align 4, !tbaa !5
  %124 = icmp slt i32 %122, %123
  br i1 %124, label %126, label %125

125:                                              ; preds = %121
  store i32 8, ptr %21, align 4
  br label %285

126:                                              ; preds = %121
  %127 = load i32, ptr %25, align 4, !tbaa !5
  %128 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %127)
  %129 = load i32, ptr %7, align 4, !tbaa !5
  %130 = call double @Vec_norm(i32 noundef %129, ptr noundef %102)
  %131 = load double, ptr %11, align 8, !tbaa !11
  %132 = fcmp olt double %130, %131
  br i1 %132, label %133, label %136

133:                                              ; preds = %126
  %134 = load i32, ptr %25, align 4, !tbaa !5
  %135 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %134)
  store i32 8, ptr %21, align 4
  br label %285

136:                                              ; preds = %126
  %137 = load i32, ptr %7, align 4, !tbaa !5
  %138 = load i32, ptr %7, align 4, !tbaa !5
  call void @Mat_mult_Vec(i32 noundef %137, i32 noundef %138, ptr noundef %59, ptr noundef %102, ptr noundef %47)
  %139 = load i32, ptr %7, align 4, !tbaa !5
  call void @Vec_scale(i32 noundef %139, double noundef -1.000000e+00, ptr noundef %47, ptr noundef %47)
  %140 = load i32, ptr %7, align 4, !tbaa !5
  %141 = zext i32 %140 to i64
  %142 = call ptr @llvm.stacksave.p0()
  store ptr %142, ptr %26, align 8
  %143 = alloca double, i64 %141, align 16
  store i64 %141, ptr %27, align 8
  %144 = load i32, ptr %7, align 4, !tbaa !5
  %145 = zext i32 %144 to i64
  %146 = alloca double, i64 %145, align 16
  store i64 %145, ptr %28, align 8
  %147 = load i32, ptr %7, align 4, !tbaa !5
  call void @Vec_scale(i32 noundef %147, double noundef -1.000000e+00, ptr noundef %102, ptr noundef %146)
  %148 = load i32, ptr %7, align 4, !tbaa !5
  %149 = load ptr, ptr %8, align 8, !tbaa !9
  %150 = load ptr, ptr %12, align 8, !tbaa !9
  %151 = load double, ptr %11, align 8, !tbaa !11
  %152 = call double @goldsearch(i32 noundef %148, ptr noundef %149, ptr noundef %146, ptr noundef %150, double noundef %151, ptr noundef %143)
  store double %152, ptr %17, align 8, !tbaa !11
  %153 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  %154 = load double, ptr %17, align 8, !tbaa !11
  call void @print(double noundef %154)
  %155 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  %156 = load i32, ptr %7, align 4, !tbaa !5
  call void @printVec(i32 noundef %156, ptr noundef %47)
  %157 = load i32, ptr %7, align 4, !tbaa !5
  %158 = zext i32 %157 to i64
  %159 = alloca double, i64 %158, align 16
  store i64 %158, ptr %29, align 8
  %160 = load ptr, ptr %12, align 8, !tbaa !9
  %161 = getelementptr inbounds double, ptr %160, i64 0
  %162 = load double, ptr %161, align 8, !tbaa !11
  %163 = getelementptr inbounds double, ptr %159, i64 0
  store double %162, ptr %163, align 16, !tbaa !11
  %164 = load ptr, ptr %12, align 8, !tbaa !9
  %165 = getelementptr inbounds double, ptr %164, i64 1
  %166 = load double, ptr %165, align 8, !tbaa !11
  %167 = getelementptr inbounds double, ptr %159, i64 1
  store double %166, ptr %167, align 8, !tbaa !11
  %168 = load i32, ptr %7, align 4, !tbaa !5
  %169 = load ptr, ptr %12, align 8, !tbaa !9
  %170 = load double, ptr %17, align 8, !tbaa !11
  %171 = load ptr, ptr %12, align 8, !tbaa !9
  call void @Vec_add_coefVec(i32 noundef %168, ptr noundef %169, double noundef %170, ptr noundef %47, ptr noundef %171)
  %172 = load i32, ptr %7, align 4, !tbaa !5
  %173 = zext i32 %172 to i64
  %174 = alloca double, i64 %173, align 16
  store i64 %173, ptr %30, align 8
  %175 = getelementptr inbounds double, ptr %102, i64 0
  %176 = load double, ptr %175, align 16, !tbaa !11
  %177 = getelementptr inbounds double, ptr %174, i64 0
  store double %176, ptr %177, align 16, !tbaa !11
  %178 = getelementptr inbounds double, ptr %102, i64 1
  %179 = load double, ptr %178, align 8, !tbaa !11
  %180 = getelementptr inbounds double, ptr %174, i64 1
  store double %179, ptr %180, align 8, !tbaa !11
  %181 = load ptr, ptr %9, align 8, !tbaa !9
  %182 = load ptr, ptr %12, align 8, !tbaa !9
  %183 = getelementptr inbounds double, ptr %182, i64 0
  %184 = load double, ptr %183, align 8, !tbaa !11
  %185 = load ptr, ptr %12, align 8, !tbaa !9
  %186 = getelementptr inbounds double, ptr %185, i64 1
  %187 = load double, ptr %186, align 8, !tbaa !11
  %188 = call double %181(double noundef %184, double noundef %187)
  %189 = getelementptr inbounds double, ptr %102, i64 0
  store double %188, ptr %189, align 16, !tbaa !11
  %190 = load ptr, ptr %10, align 8, !tbaa !9
  %191 = load ptr, ptr %12, align 8, !tbaa !9
  %192 = getelementptr inbounds double, ptr %191, i64 0
  %193 = load double, ptr %192, align 8, !tbaa !11
  %194 = load ptr, ptr %12, align 8, !tbaa !9
  %195 = getelementptr inbounds double, ptr %194, i64 1
  %196 = load double, ptr %195, align 8, !tbaa !11
  %197 = call double %190(double noundef %193, double noundef %196)
  %198 = getelementptr inbounds double, ptr %102, i64 1
  store double %197, ptr %198, align 8, !tbaa !11
  %199 = load i32, ptr %7, align 4, !tbaa !5
  call void @Vec_add_coefVec(i32 noundef %199, ptr noundef %102, double noundef -1.000000e+00, ptr noundef %174, ptr noundef %50)
  %200 = load i32, ptr %7, align 4, !tbaa !5
  %201 = load ptr, ptr %12, align 8, !tbaa !9
  call void @Vec_add_coefVec(i32 noundef %200, ptr noundef %201, double noundef -1.000000e+00, ptr noundef %159, ptr noundef %53)
  %202 = load i32, ptr %7, align 4, !tbaa !5
  %203 = zext i32 %202 to i64
  %204 = load i32, ptr %7, align 4, !tbaa !5
  %205 = zext i32 %204 to i64
  %206 = mul nuw i64 %203, %205
  %207 = alloca double, i64 %206, align 16
  store i64 %203, ptr %31, align 8
  store i64 %205, ptr %32, align 8
  %208 = load i32, ptr %7, align 4, !tbaa !5
  call void @Vec_mult_Vec(i32 noundef %208, ptr noundef %53, ptr noundef %53, ptr noundef %207)
  %209 = load i32, ptr %7, align 4, !tbaa !5
  %210 = load i32, ptr %7, align 4, !tbaa !5
  %211 = load i32, ptr %7, align 4, !tbaa !5
  %212 = call double @Vec_sprod(i32 noundef %211, ptr noundef %53, ptr noundef %50)
  %213 = fdiv double 1.000000e+00, %212
  call void @Mat_scale(i32 noundef %209, i32 noundef %210, ptr noundef %207, double noundef %213, ptr noundef %207)
  %214 = load i32, ptr %7, align 4, !tbaa !5
  %215 = zext i32 %214 to i64
  %216 = alloca double, i64 %215, align 16
  store i64 %215, ptr %33, align 8
  %217 = load i32, ptr %7, align 4, !tbaa !5
  %218 = zext i32 %217 to i64
  %219 = alloca double, i64 %218, align 16
  store i64 %218, ptr %34, align 8
  %220 = load i32, ptr %7, align 4, !tbaa !5
  %221 = zext i32 %220 to i64
  %222 = load i32, ptr %7, align 4, !tbaa !5
  %223 = zext i32 %222 to i64
  %224 = mul nuw i64 %221, %223
  %225 = alloca double, i64 %224, align 16
  store i64 %221, ptr %35, align 8
  store i64 %223, ptr %36, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %37) #5
  %226 = load i32, ptr %7, align 4, !tbaa !5
  %227 = load i32, ptr %7, align 4, !tbaa !5
  call void @Mat_mult_Vec(i32 noundef %226, i32 noundef %227, ptr noundef %59, ptr noundef %50, ptr noundef %216)
  %228 = load i32, ptr %7, align 4, !tbaa !5
  %229 = load i32, ptr %7, align 4, !tbaa !5
  call void @Mat_mult_Vec(i32 noundef %228, i32 noundef %229, ptr noundef %59, ptr noundef %50, ptr noundef %219)
  %230 = load i32, ptr %7, align 4, !tbaa !5
  call void @Vec_mult_Vec(i32 noundef %230, ptr noundef %216, ptr noundef %219, ptr noundef %225)
  %231 = load i32, ptr %7, align 4, !tbaa !5
  %232 = load i32, ptr %7, align 4, !tbaa !5
  %233 = call double @Vec_Mat_Vec(i32 noundef %231, i32 noundef %232, ptr noundef %50, ptr noundef %59, ptr noundef %50)
  store double %233, ptr %37, align 8, !tbaa !11
  %234 = load i32, ptr %7, align 4, !tbaa !5
  %235 = load i32, ptr %7, align 4, !tbaa !5
  %236 = load double, ptr %37, align 8, !tbaa !11
  %237 = fdiv double 1.000000e+00, %236
  call void @Mat_scale(i32 noundef %234, i32 noundef %235, ptr noundef %225, double noundef %237, ptr noundef %225)
  %238 = load i32, ptr %7, align 4, !tbaa !5
  %239 = zext i32 %238 to i64
  %240 = load i32, ptr %7, align 4, !tbaa !5
  %241 = zext i32 %240 to i64
  %242 = mul nuw i64 %239, %241
  %243 = alloca double, i64 %242, align 16
  store i64 %239, ptr %38, align 8
  store i64 %241, ptr %39, align 8
  %244 = load i32, ptr %7, align 4, !tbaa !5
  %245 = load i32, ptr %7, align 4, !tbaa !5
  call void @Mat_add_Mat(i32 noundef %244, i32 noundef %245, ptr noundef %59, ptr noundef %207, ptr noundef %243)
  %246 = load i32, ptr %7, align 4, !tbaa !5
  %247 = load i32, ptr %7, align 4, !tbaa !5
  call void @Mat_scale(i32 noundef %246, i32 noundef %247, ptr noundef %225, double noundef -1.000000e+00, ptr noundef %225)
  %248 = load i32, ptr %7, align 4, !tbaa !5
  %249 = load i32, ptr %7, align 4, !tbaa !5
  call void @Mat_add_Mat(i32 noundef %248, i32 noundef %249, ptr noundef %243, ptr noundef %225, ptr noundef %59)
  %250 = load ptr, ptr @logfile2, align 8, !tbaa !9
  %251 = load ptr, ptr %12, align 8, !tbaa !9
  %252 = getelementptr inbounds double, ptr %251, i64 0
  %253 = load double, ptr %252, align 8, !tbaa !11
  %254 = load ptr, ptr %12, align 8, !tbaa !9
  %255 = getelementptr inbounds double, ptr %254, i64 1
  %256 = load double, ptr %255, align 8, !tbaa !11
  %257 = load ptr, ptr %8, align 8, !tbaa !9
  %258 = load ptr, ptr %12, align 8, !tbaa !9
  %259 = getelementptr inbounds double, ptr %258, i64 0
  %260 = load double, ptr %259, align 8, !tbaa !11
  %261 = load ptr, ptr %12, align 8, !tbaa !9
  %262 = getelementptr inbounds double, ptr %261, i64 1
  %263 = load double, ptr %262, align 8, !tbaa !11
  %264 = call double %257(double noundef %260, double noundef %263)
  %265 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %250, ptr noundef @.str.2, double noundef %253, double noundef %256, double noundef %264) #5
  %266 = load ptr, ptr %12, align 8, !tbaa !9
  %267 = getelementptr inbounds double, ptr %266, i64 0
  %268 = load double, ptr %267, align 8, !tbaa !11
  %269 = load ptr, ptr %12, align 8, !tbaa !9
  %270 = getelementptr inbounds double, ptr %269, i64 1
  %271 = load double, ptr %270, align 8, !tbaa !11
  %272 = load ptr, ptr %8, align 8, !tbaa !9
  %273 = load ptr, ptr %12, align 8, !tbaa !9
  %274 = getelementptr inbounds double, ptr %273, i64 0
  %275 = load double, ptr %274, align 8, !tbaa !11
  %276 = load ptr, ptr %12, align 8, !tbaa !9
  %277 = getelementptr inbounds double, ptr %276, i64 1
  %278 = load double, ptr %277, align 8, !tbaa !11
  %279 = call double %272(double noundef %275, double noundef %278)
  %280 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, double noundef %268, double noundef %271, double noundef %279)
  call void @llvm.lifetime.end.p0(i64 8, ptr %37) #5
  %281 = load ptr, ptr %26, align 8
  call void @llvm.stackrestore.p0(ptr %281)
  br label %282

282:                                              ; preds = %136
  %283 = load i32, ptr %25, align 4, !tbaa !5
  %284 = add nsw i32 %283, 1
  store i32 %284, ptr %25, align 4, !tbaa !5
  br label %121, !llvm.loop !16

285:                                              ; preds = %133, %125
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #5
  br label %286

286:                                              ; preds = %285
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  %287 = load ptr, ptr %13, align 8
  call void @llvm.stackrestore.p0(ptr %287)
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local double @goldsearch(i32 noundef, ptr noundef, ptr noundef, ptr noundef, double noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local void @print(double noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local void @printVec(i32 noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local void @Vec_mult_Vec(i32 noundef, ptr noundef, ptr noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local void @Mat_scale(i32 noundef, i32 noundef, ptr noundef, double noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local double @Vec_sprod(i32 noundef, ptr noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local double @Vec_Mat_Vec(i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local void @Mat_add_Mat(i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) #3

attributes #0 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@.str = external hidden unnamed_addr constant [20 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [28 x i8], align 1
@logfile2 = external dso_local local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #1

; Function Attrs: nounwind uwtable
declare dso_local void @Vec_scale(i32 noundef, double noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local void @Vec_add_coefVec(i32 noundef, ptr noundef, double noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local double @Vec_norm(i32 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @Mat_mult_Vec(i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #1

; Function Attrs: nounwind uwtable
define dso_local void @Quasi_Newton(i32 noundef %0, ptr noundef %1, ptr nocapture noundef readonly %2, ptr nocapture noundef readonly %3, double noundef %4, ptr noundef %5) local_unnamed_addr #2 {
  %7 = load ptr, ptr @logfile2, align 8, !tbaa !5
  %8 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %7, ptr noundef nonnull @.str) #3
  %9 = zext i32 %0 to i64
  %10 = alloca double, i64 %9, align 16
  %11 = alloca double, i64 %9, align 16
  %12 = alloca double, i64 %9, align 16
  %13 = mul nuw i64 %9, %9
  %14 = alloca double, i64 %13, align 16
  %15 = icmp sgt i32 %0, 0
  br i1 %15, label %.preheader.us.preheader, label %._crit_edge107

.preheader.us.preheader:                          ; preds = %6
  %xtraiter = and i64 %9, 1
  %16 = icmp eq i32 %0, 1
  %unroll_iter = and i64 %9, 2147483646
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.preheader.us

.preheader.us:                                    ; preds = %.preheader.us.preheader, %._crit_edge.us
  %indvars.iv111 = phi i64 [ %indvars.iv.next112, %._crit_edge.us ], [ 0, %.preheader.us.preheader ]
  %17 = mul nuw nsw i64 %indvars.iv111, %9
  %18 = getelementptr inbounds double, ptr %14, i64 %17
  %19 = getelementptr inbounds double, ptr %18, i64 %indvars.iv111
  br i1 %16, label %._crit_edge.us.unr-lcssa, label %.preheader.us.new

.preheader.us.new:                                ; preds = %.preheader.us, %29
  %indvars.iv = phi i64 [ %indvars.iv.next.1, %29 ], [ 0, %.preheader.us ]
  %niter = phi i64 [ %niter.next.1, %29 ], [ 0, %.preheader.us ]
  %20 = icmp eq i64 %indvars.iv111, %indvars.iv
  br i1 %20, label %23, label %21

21:                                               ; preds = %.preheader.us.new
  %22 = getelementptr inbounds double, ptr %18, i64 %indvars.iv
  store double 0.000000e+00, ptr %22, align 8, !tbaa !9
  br label %24

23:                                               ; preds = %.preheader.us.new
  store double 1.000000e+00, ptr %19, align 8, !tbaa !9
  br label %24

24:                                               ; preds = %23, %21
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %25 = icmp eq i64 %indvars.iv111, %indvars.iv.next
  br i1 %25, label %28, label %26

26:                                               ; preds = %24
  %27 = getelementptr inbounds double, ptr %18, i64 %indvars.iv.next
  store double 0.000000e+00, ptr %27, align 8, !tbaa !9
  br label %29

28:                                               ; preds = %24
  store double 1.000000e+00, ptr %19, align 8, !tbaa !9
  br label %29

29:                                               ; preds = %28, %26
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.us.unr-lcssa, label %.preheader.us.new, !llvm.loop !11

._crit_edge.us.unr-lcssa:                         ; preds = %29, %.preheader.us
  %indvars.iv.unr = phi i64 [ 0, %.preheader.us ], [ %indvars.iv.next.1, %29 ]
  br i1 %lcmp.mod.not, label %._crit_edge.us, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge.us.unr-lcssa
  %30 = icmp eq i64 %indvars.iv111, %indvars.iv.unr
  br i1 %30, label %33, label %31

31:                                               ; preds = %.epil.preheader
  %32 = getelementptr inbounds double, ptr %18, i64 %indvars.iv.unr
  store double 0.000000e+00, ptr %32, align 8, !tbaa !9
  br label %._crit_edge.us

33:                                               ; preds = %.epil.preheader
  store double 1.000000e+00, ptr %19, align 8, !tbaa !9
  br label %._crit_edge.us

._crit_edge.us:                                   ; preds = %31, %33, %._crit_edge.us.unr-lcssa
  %indvars.iv.next112 = add nuw nsw i64 %indvars.iv111, 1
  %exitcond115.not = icmp eq i64 %indvars.iv.next112, %9
  br i1 %exitcond115.not, label %._crit_edge107, label %.preheader.us, !llvm.loop !13

._crit_edge107:                                   ; preds = %._crit_edge.us, %6
  %34 = alloca double, i64 %9, align 16
  %35 = load double, ptr %5, align 8, !tbaa !9
  %36 = getelementptr inbounds i8, ptr %5, i64 8
  %37 = load double, ptr %36, align 8, !tbaa !9
  %38 = tail call double %2(double noundef %35, double noundef %37) #3
  store double %38, ptr %34, align 16, !tbaa !9
  %39 = load double, ptr %5, align 8, !tbaa !9
  %40 = load double, ptr %36, align 8, !tbaa !9
  %41 = tail call double %3(double noundef %39, double noundef %40) #3
  %42 = getelementptr inbounds i8, ptr %34, i64 8
  store double %41, ptr %42, align 8, !tbaa !9
  br label %43

43:                                               ; preds = %._crit_edge107, %49
  %.0101108 = phi i32 [ 0, %._crit_edge107 ], [ %84, %49 ]
  %44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %.0101108)
  %45 = call double @Vec_norm(i32 noundef %0, ptr noundef nonnull %34)
  %46 = fcmp olt double %45, %4
  br i1 %46, label %47, label %49

47:                                               ; preds = %43
  %48 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.0101108)
  br label %.loopexit

49:                                               ; preds = %43
  call void @Mat_mult_Vec(i32 noundef %0, i32 noundef %0, ptr noundef nonnull %14, ptr noundef nonnull %34, ptr noundef nonnull %10)
  call void @Vec_scale(i32 noundef %0, double noundef -1.000000e+00, ptr noundef nonnull %10, ptr noundef nonnull %10)
  %50 = call ptr @llvm.stacksave.p0()
  %51 = alloca double, i64 %9, align 16
  %52 = alloca double, i64 %9, align 16
  call void @Vec_scale(i32 noundef %0, double noundef -1.000000e+00, ptr noundef nonnull %34, ptr noundef nonnull %52)
  %53 = call double @goldsearch(i32 noundef %0, ptr noundef %1, ptr noundef nonnull %52, ptr noundef nonnull %5, double noundef %4, ptr noundef nonnull %51)
  %54 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5)
  call void @print(double noundef %53)
  %55 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  call void @printVec(i32 noundef %0, ptr noundef nonnull %10)
  %56 = alloca double, i64 %9, align 16
  %57 = load <2 x double>, ptr %5, align 8, !tbaa !9
  store <2 x double> %57, ptr %56, align 16, !tbaa !9
  call void @Vec_add_coefVec(i32 noundef %0, ptr noundef nonnull %5, double noundef %53, ptr noundef nonnull %10, ptr noundef nonnull %5)
  %58 = alloca double, i64 %9, align 16
  %59 = load <2 x double>, ptr %34, align 16, !tbaa !9
  store <2 x double> %59, ptr %58, align 16, !tbaa !9
  %60 = load double, ptr %5, align 8, !tbaa !9
  %61 = load double, ptr %36, align 8, !tbaa !9
  %62 = call double %2(double noundef %60, double noundef %61) #3
  store double %62, ptr %34, align 16, !tbaa !9
  %63 = load double, ptr %5, align 8, !tbaa !9
  %64 = load double, ptr %36, align 8, !tbaa !9
  %65 = call double %3(double noundef %63, double noundef %64) #3
  store double %65, ptr %42, align 8, !tbaa !9
  call void @Vec_add_coefVec(i32 noundef %0, ptr noundef nonnull %34, double noundef -1.000000e+00, ptr noundef nonnull %58, ptr noundef nonnull %11)
  call void @Vec_add_coefVec(i32 noundef %0, ptr noundef nonnull %5, double noundef -1.000000e+00, ptr noundef nonnull %56, ptr noundef nonnull %12)
  %66 = alloca double, i64 %13, align 16
  call void @Vec_mult_Vec(i32 noundef %0, ptr noundef nonnull %12, ptr noundef nonnull %12, ptr noundef nonnull %66)
  %67 = call double @Vec_sprod(i32 noundef %0, ptr noundef nonnull %12, ptr noundef nonnull %11)
  %68 = fdiv double 1.000000e+00, %67
  call void @Mat_scale(i32 noundef %0, i32 noundef %0, ptr noundef nonnull %66, double noundef %68, ptr noundef nonnull %66)
  %69 = alloca double, i64 %9, align 16
  %70 = alloca double, i64 %9, align 16
  %71 = alloca double, i64 %13, align 16
  call void @Mat_mult_Vec(i32 noundef %0, i32 noundef %0, ptr noundef nonnull %14, ptr noundef nonnull %11, ptr noundef nonnull %69)
  call void @Mat_mult_Vec(i32 noundef %0, i32 noundef %0, ptr noundef nonnull %14, ptr noundef nonnull %11, ptr noundef nonnull %70)
  call void @Vec_mult_Vec(i32 noundef %0, ptr noundef nonnull %69, ptr noundef nonnull %70, ptr noundef nonnull %71)
  %72 = call double @Vec_Mat_Vec(i32 noundef %0, i32 noundef %0, ptr noundef nonnull %11, ptr noundef nonnull %14, ptr noundef nonnull %11)
  %73 = fdiv double 1.000000e+00, %72
  call void @Mat_scale(i32 noundef %0, i32 noundef %0, ptr noundef nonnull %71, double noundef %73, ptr noundef nonnull %71)
  %74 = alloca double, i64 %13, align 16
  call void @Mat_add_Mat(i32 noundef %0, i32 noundef %0, ptr noundef nonnull %14, ptr noundef nonnull %66, ptr noundef nonnull %74)
  call void @Mat_scale(i32 noundef %0, i32 noundef %0, ptr noundef nonnull %71, double noundef -1.000000e+00, ptr noundef nonnull %71)
  call void @Mat_add_Mat(i32 noundef %0, i32 noundef %0, ptr noundef nonnull %74, ptr noundef nonnull %71, ptr noundef nonnull %14)
  %75 = load ptr, ptr @logfile2, align 8, !tbaa !5
  %76 = load double, ptr %5, align 8, !tbaa !9
  %77 = load double, ptr %36, align 8, !tbaa !9
  %78 = call double %1(double noundef %76, double noundef %77) #3
  %79 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %75, ptr noundef nonnull @.str.2, double noundef %76, double noundef %77, double noundef %78) #3
  %80 = load double, ptr %5, align 8, !tbaa !9
  %81 = load double, ptr %36, align 8, !tbaa !9
  %82 = call double %1(double noundef %80, double noundef %81) #3
  %83 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, double noundef %80, double noundef %81, double noundef %82)
  call void @llvm.stackrestore.p0(ptr %50)
  %84 = add nuw nsw i32 %.0101108, 1
  %exitcond116.not = icmp eq i32 %84, 10000
  br i1 %exitcond116.not, label %.loopexit, label %43, !llvm.loop !14

.loopexit:                                        ; preds = %49, %47
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local double @goldsearch(i32 noundef, ptr noundef, ptr noundef, ptr noundef, double noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local void @print(double noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local void @printVec(i32 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local void @Vec_mult_Vec(i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local void @Mat_scale(i32 noundef, i32 noundef, ptr noundef, double noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local double @Vec_sprod(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local double @Vec_Mat_Vec(i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local void @Mat_add_Mat(i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

attributes #0 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass