; LLVM IR from stan-dev/math :: lib/sundials_6.1.1/src/sunlinsol/spfgmr (sunlinsol_spfgmr)

; 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"

%struct._generic_SUNLinearSolver = type { ptr, ptr, ptr }
%struct._SUNLinearSolverContent_SPFGMR = type { i32, i32, i32, i32, i32, i32, double, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, ptr }

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

; Function Attrs: nounwind uwtable
define dso_local i32 @SUNLinSolFree_SPFGMR(ptr noundef %0) #1 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  %6 = load ptr, ptr %3, align 8, !tbaa !5
  %7 = icmp eq ptr %6, null
  br i1 %7, label %8, label %9

8:                                                ; preds = %1
  store i32 0, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %240

9:                                                ; preds = %1
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %10, i32 0, i32 0
  %12 = load ptr, ptr %11, align 8, !tbaa !9
  %13 = icmp ne ptr %12, null
  br i1 %13, label %14, label %227

14:                                               ; preds = %9
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %15, i32 0, i32 0
  %17 = load ptr, ptr %16, align 8, !tbaa !9
  %18 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %17, i32 0, i32 19
  %19 = load ptr, ptr %18, align 8, !tbaa !11
  %20 = icmp ne ptr %19, null
  br i1 %20, label %21, label %31

21:                                               ; preds = %14
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %22, i32 0, i32 0
  %24 = load ptr, ptr %23, align 8, !tbaa !9
  %25 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %24, i32 0, i32 19
  %26 = load ptr, ptr %25, align 8, !tbaa !11
  call void @N_VDestroy(ptr noundef %26)
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %27, i32 0, i32 0
  %29 = load ptr, ptr %28, align 8, !tbaa !9
  %30 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %29, i32 0, i32 19
  store ptr null, ptr %30, align 8, !tbaa !11
  br label %31

31:                                               ; preds = %21, %14
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %32, i32 0, i32 0
  %34 = load ptr, ptr %33, align 8, !tbaa !9
  %35 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %34, i32 0, i32 21
  %36 = load ptr, ptr %35, align 8, !tbaa !15
  %37 = icmp ne ptr %36, null
  br i1 %37, label %38, label %48

38:                                               ; preds = %31
  %39 = load ptr, ptr %3, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %39, i32 0, i32 0
  %41 = load ptr, ptr %40, align 8, !tbaa !9
  %42 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %41, i32 0, i32 21
  %43 = load ptr, ptr %42, align 8, !tbaa !15
  call void @N_VDestroy(ptr noundef %43)
  %44 = load ptr, ptr %3, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %44, i32 0, i32 0
  %46 = load ptr, ptr %45, align 8, !tbaa !9
  %47 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %46, i32 0, i32 21
  store ptr null, ptr %47, align 8, !tbaa !15
  br label %48

48:                                               ; preds = %38, %31
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %49, i32 0, i32 0
  %51 = load ptr, ptr %50, align 8, !tbaa !9
  %52 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %51, i32 0, i32 15
  %53 = load ptr, ptr %52, align 8, !tbaa !16
  %54 = icmp ne ptr %53, null
  br i1 %54, label %55, label %71

55:                                               ; preds = %48
  %56 = load ptr, ptr %3, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %56, i32 0, i32 0
  %58 = load ptr, ptr %57, align 8, !tbaa !9
  %59 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %58, i32 0, i32 15
  %60 = load ptr, ptr %59, align 8, !tbaa !16
  %61 = load ptr, ptr %3, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %61, i32 0, i32 0
  %63 = load ptr, ptr %62, align 8, !tbaa !9
  %64 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %63, i32 0, i32 0
  %65 = load i32, ptr %64, align 8, !tbaa !17
  %66 = add nsw i32 %65, 1
  call void @N_VDestroyVectorArray(ptr noundef %60, i32 noundef %66)
  %67 = load ptr, ptr %3, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %67, i32 0, i32 0
  %69 = load ptr, ptr %68, align 8, !tbaa !9
  %70 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %69, i32 0, i32 15
  store ptr null, ptr %70, align 8, !tbaa !16
  br label %71

71:                                               ; preds = %55, %48
  %72 = load ptr, ptr %3, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %72, i32 0, i32 0
  %74 = load ptr, ptr %73, align 8, !tbaa !9
  %75 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %74, i32 0, i32 16
  %76 = load ptr, ptr %75, align 8, !tbaa !18
  %77 = icmp ne ptr %76, null
  br i1 %77, label %78, label %94

78:                                               ; preds = %71
  %79 = load ptr, ptr %3, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %79, i32 0, i32 0
  %81 = load ptr, ptr %80, align 8, !tbaa !9
  %82 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %81, i32 0, i32 16
  %83 = load ptr, ptr %82, align 8, !tbaa !18
  %84 = load ptr, ptr %3, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %84, i32 0, i32 0
  %86 = load ptr, ptr %85, align 8, !tbaa !9
  %87 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %86, i32 0, i32 0
  %88 = load i32, ptr %87, align 8, !tbaa !17
  %89 = add nsw i32 %88, 1
  call void @N_VDestroyVectorArray(ptr noundef %83, i32 noundef %89)
  %90 = load ptr, ptr %3, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %90, i32 0, i32 0
  %92 = load ptr, ptr %91, align 8, !tbaa !9
  %93 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %92, i32 0, i32 16
  store ptr null, ptr %93, align 8, !tbaa !18
  br label %94

94:                                               ; preds = %78, %71
  %95 = load ptr, ptr %3, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %95, i32 0, i32 0
  %97 = load ptr, ptr %96, align 8, !tbaa !9
  %98 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %97, i32 0, i32 17
  %99 = load ptr, ptr %98, align 8, !tbaa !19
  %100 = icmp ne ptr %99, null
  br i1 %100, label %101, label %153

101:                                              ; preds = %94
  store i32 0, ptr %4, align 4, !tbaa !20
  br label %102

102:                                              ; preds = %140, %101
  %103 = load i32, ptr %4, align 4, !tbaa !20
  %104 = load ptr, ptr %3, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %104, i32 0, i32 0
  %106 = load ptr, ptr %105, align 8, !tbaa !9
  %107 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %106, i32 0, i32 0
  %108 = load i32, ptr %107, align 8, !tbaa !17
  %109 = icmp sle i32 %103, %108
  br i1 %109, label %110, label %143

110:                                              ; preds = %102
  %111 = load ptr, ptr %3, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %111, i32 0, i32 0
  %113 = load ptr, ptr %112, align 8, !tbaa !9
  %114 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %113, i32 0, i32 17
  %115 = load ptr, ptr %114, align 8, !tbaa !19
  %116 = load i32, ptr %4, align 4, !tbaa !20
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds ptr, ptr %115, i64 %117
  %119 = load ptr, ptr %118, align 8, !tbaa !5
  %120 = icmp ne ptr %119, null
  br i1 %120, label %121, label %139

121:                                              ; preds = %110
  %122 = load ptr, ptr %3, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %122, i32 0, i32 0
  %124 = load ptr, ptr %123, align 8, !tbaa !9
  %125 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %124, i32 0, i32 17
  %126 = load ptr, ptr %125, align 8, !tbaa !19
  %127 = load i32, ptr %4, align 4, !tbaa !20
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds ptr, ptr %126, i64 %128
  %130 = load ptr, ptr %129, align 8, !tbaa !5
  call void @free(ptr noundef %130) #4
  %131 = load ptr, ptr %3, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %131, i32 0, i32 0
  %133 = load ptr, ptr %132, align 8, !tbaa !9
  %134 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %133, i32 0, i32 17
  %135 = load ptr, ptr %134, align 8, !tbaa !19
  %136 = load i32, ptr %4, align 4, !tbaa !20
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds ptr, ptr %135, i64 %137
  store ptr null, ptr %138, align 8, !tbaa !5
  br label %139

139:                                              ; preds = %121, %110
  br label %140

140:                                              ; preds = %139
  %141 = load i32, ptr %4, align 4, !tbaa !20
  %142 = add nsw i32 %141, 1
  store i32 %142, ptr %4, align 4, !tbaa !20
  br label %102, !llvm.loop !21

143:                                              ; preds = %102
  %144 = load ptr, ptr %3, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %144, i32 0, i32 0
  %146 = load ptr, ptr %145, align 8, !tbaa !9
  %147 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %146, i32 0, i32 17
  %148 = load ptr, ptr %147, align 8, !tbaa !19
  call void @free(ptr noundef %148) #4
  %149 = load ptr, ptr %3, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %149, i32 0, i32 0
  %151 = load ptr, ptr %150, align 8, !tbaa !9
  %152 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %151, i32 0, i32 17
  store ptr null, ptr %152, align 8, !tbaa !19
  br label %153

153:                                              ; preds = %143, %94
  %154 = load ptr, ptr %3, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %154, i32 0, i32 0
  %156 = load ptr, ptr %155, align 8, !tbaa !9
  %157 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %156, i32 0, i32 18
  %158 = load ptr, ptr %157, align 8, !tbaa !23
  %159 = icmp ne ptr %158, null
  br i1 %159, label %160, label %170

160:                                              ; preds = %153
  %161 = load ptr, ptr %3, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %161, i32 0, i32 0
  %163 = load ptr, ptr %162, align 8, !tbaa !9
  %164 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %163, i32 0, i32 18
  %165 = load ptr, ptr %164, align 8, !tbaa !23
  call void @free(ptr noundef %165) #4
  %166 = load ptr, ptr %3, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %166, i32 0, i32 0
  %168 = load ptr, ptr %167, align 8, !tbaa !9
  %169 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %168, i32 0, i32 18
  store ptr null, ptr %169, align 8, !tbaa !23
  br label %170

170:                                              ; preds = %160, %153
  %171 = load ptr, ptr %3, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %171, i32 0, i32 0
  %173 = load ptr, ptr %172, align 8, !tbaa !9
  %174 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %173, i32 0, i32 20
  %175 = load ptr, ptr %174, align 8, !tbaa !24
  %176 = icmp ne ptr %175, null
  br i1 %176, label %177, label %187

177:                                              ; preds = %170
  %178 = load ptr, ptr %3, align 8, !tbaa !5
  %179 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %178, i32 0, i32 0
  %180 = load ptr, ptr %179, align 8, !tbaa !9
  %181 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %180, i32 0, i32 20
  %182 = load ptr, ptr %181, align 8, !tbaa !24
  call void @free(ptr noundef %182) #4
  %183 = load ptr, ptr %3, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %183, i32 0, i32 0
  %185 = load ptr, ptr %184, align 8, !tbaa !9
  %186 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %185, i32 0, i32 20
  store ptr null, ptr %186, align 8, !tbaa !24
  br label %187

187:                                              ; preds = %177, %170
  %188 = load ptr, ptr %3, align 8, !tbaa !5
  %189 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %188, i32 0, i32 0
  %190 = load ptr, ptr %189, align 8, !tbaa !9
  %191 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %190, i32 0, i32 22
  %192 = load ptr, ptr %191, align 8, !tbaa !25
  %193 = icmp ne ptr %192, null
  br i1 %193, label %194, label %204

194:                                              ; preds = %187
  %195 = load ptr, ptr %3, align 8, !tbaa !5
  %196 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %195, i32 0, i32 0
  %197 = load ptr, ptr %196, align 8, !tbaa !9
  %198 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %197, i32 0, i32 22
  %199 = load ptr, ptr %198, align 8, !tbaa !25
  call void @free(ptr noundef %199) #4
  %200 = load ptr, ptr %3, align 8, !tbaa !5
  %201 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %200, i32 0, i32 0
  %202 = load ptr, ptr %201, align 8, !tbaa !9
  %203 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %202, i32 0, i32 22
  store ptr null, ptr %203, align 8, !tbaa !25
  br label %204

204:                                              ; preds = %194, %187
  %205 = load ptr, ptr %3, align 8, !tbaa !5
  %206 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %205, i32 0, i32 0
  %207 = load ptr, ptr %206, align 8, !tbaa !9
  %208 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %207, i32 0, i32 23
  %209 = load ptr, ptr %208, align 8, !tbaa !26
  %210 = icmp ne ptr %209, null
  br i1 %210, label %211, label %221

211:                                              ; preds = %204
  %212 = load ptr, ptr %3, align 8, !tbaa !5
  %213 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %212, i32 0, i32 0
  %214 = load ptr, ptr %213, align 8, !tbaa !9
  %215 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %214, i32 0, i32 23
  %216 = load ptr, ptr %215, align 8, !tbaa !26
  call void @free(ptr noundef %216) #4
  %217 = load ptr, ptr %3, align 8, !tbaa !5
  %218 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %217, i32 0, i32 0
  %219 = load ptr, ptr %218, align 8, !tbaa !9
  %220 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %219, i32 0, i32 23
  store ptr null, ptr %220, align 8, !tbaa !26
  br label %221

221:                                              ; preds = %211, %204
  %222 = load ptr, ptr %3, align 8, !tbaa !5
  %223 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %222, i32 0, i32 0
  %224 = load ptr, ptr %223, align 8, !tbaa !9
  call void @free(ptr noundef %224) #4
  %225 = load ptr, ptr %3, align 8, !tbaa !5
  %226 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %225, i32 0, i32 0
  store ptr null, ptr %226, align 8, !tbaa !9
  br label %227

227:                                              ; preds = %221, %9
  %228 = load ptr, ptr %3, align 8, !tbaa !5
  %229 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %228, i32 0, i32 1
  %230 = load ptr, ptr %229, align 8, !tbaa !27
  %231 = icmp ne ptr %230, null
  br i1 %231, label %232, label %238

232:                                              ; preds = %227
  %233 = load ptr, ptr %3, align 8, !tbaa !5
  %234 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %233, i32 0, i32 1
  %235 = load ptr, ptr %234, align 8, !tbaa !27
  call void @free(ptr noundef %235) #4
  %236 = load ptr, ptr %3, align 8, !tbaa !5
  %237 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %236, i32 0, i32 1
  store ptr null, ptr %237, align 8, !tbaa !27
  br label %238

238:                                              ; preds = %232, %227
  %239 = load ptr, ptr %3, align 8, !tbaa !5
  call void @free(ptr noundef %239) #4
  store ptr null, ptr %3, align 8, !tbaa !5
  store i32 0, ptr %2, align 4
  store i32 1, ptr %5, align 4
  br label %240

240:                                              ; preds = %238, %8
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  %241 = load i32, ptr %2, align 4
  ret i32 %241
}

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

declare void @N_VDestroy(ptr noundef) #2

declare void @N_VDestroyVectorArray(ptr noundef, i32 noundef) #2

; Function Attrs: nounwind
declare void @free(ptr noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { "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 "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 = { 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, !6, i64 0}
!10 = !{!"_generic_SUNLinearSolver", !6, i64 0, !6, i64 8, !6, i64 16}
!11 = !{!12, !6, i64 128}
!12 = !{!"_SUNLinearSolverContent_SPFGMR", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !14, i64 24, !13, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !13, i64 168, !6, i64 176}
!13 = !{!"int", !7, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = !{!12, !6, i64 144}
!16 = !{!12, !6, i64 96}
!17 = !{!12, !13, i64 0}
!18 = !{!12, !6, i64 104}
!19 = !{!12, !6, i64 112}
!20 = !{!13, !13, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!12, !6, i64 120}
!24 = !{!12, !6, i64 136}
!25 = !{!12, !6, i64 152}
!26 = !{!12, !6, i64 160}
!27 = !{!10, !6, i64 8}


; 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"

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @SUNLinSolFree_SPFGMR(ptr noundef %0) local_unnamed_addr #0 {
  %2 = icmp eq ptr %0, null
  br i1 %2, label %94, label %3

3:                                                ; preds = %1
  %4 = load ptr, ptr %0, align 8, !tbaa !5
  %.not = icmp eq ptr %4, null
  br i1 %.not, label %89, label %5

5:                                                ; preds = %3
  %6 = getelementptr inbounds i8, ptr %4, i64 128
  %7 = load ptr, ptr %6, align 8, !tbaa !10
  %.not59 = icmp eq ptr %7, null
  br i1 %.not59, label %11, label %8

8:                                                ; preds = %5
  tail call void @N_VDestroy(ptr noundef nonnull %7) #3
  %9 = load ptr, ptr %0, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %9, i64 128
  store ptr null, ptr %10, align 8, !tbaa !10
  br label %11

11:                                               ; preds = %8, %5
  %12 = phi ptr [ %9, %8 ], [ %4, %5 ]
  %13 = getelementptr inbounds i8, ptr %12, i64 144
  %14 = load ptr, ptr %13, align 8, !tbaa !14
  %.not60 = icmp eq ptr %14, null
  br i1 %.not60, label %18, label %15

15:                                               ; preds = %11
  tail call void @N_VDestroy(ptr noundef nonnull %14) #3
  %16 = load ptr, ptr %0, align 8, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %16, i64 144
  store ptr null, ptr %17, align 8, !tbaa !14
  br label %18

18:                                               ; preds = %15, %11
  %19 = phi ptr [ %16, %15 ], [ %12, %11 ]
  %20 = getelementptr inbounds i8, ptr %19, i64 96
  %21 = load ptr, ptr %20, align 8, !tbaa !15
  %.not61 = icmp eq ptr %21, null
  br i1 %.not61, label %27, label %22

22:                                               ; preds = %18
  %23 = load i32, ptr %19, align 8, !tbaa !16
  %24 = add nsw i32 %23, 1
  tail call void @N_VDestroyVectorArray(ptr noundef nonnull %21, i32 noundef %24) #3
  %25 = load ptr, ptr %0, align 8, !tbaa !5
  %26 = getelementptr inbounds i8, ptr %25, i64 96
  store ptr null, ptr %26, align 8, !tbaa !15
  br label %27

27:                                               ; preds = %22, %18
  %28 = phi ptr [ %25, %22 ], [ %19, %18 ]
  %29 = getelementptr inbounds i8, ptr %28, i64 104
  %30 = load ptr, ptr %29, align 8, !tbaa !17
  %.not62 = icmp eq ptr %30, null
  br i1 %.not62, label %36, label %31

31:                                               ; preds = %27
  %32 = load i32, ptr %28, align 8, !tbaa !16
  %33 = add nsw i32 %32, 1
  tail call void @N_VDestroyVectorArray(ptr noundef nonnull %30, i32 noundef %33) #3
  %34 = load ptr, ptr %0, align 8, !tbaa !5
  %35 = getelementptr inbounds i8, ptr %34, i64 104
  store ptr null, ptr %35, align 8, !tbaa !17
  br label %36

36:                                               ; preds = %31, %27
  %37 = phi ptr [ %34, %31 ], [ %28, %27 ]
  %38 = getelementptr inbounds i8, ptr %37, i64 112
  %39 = load ptr, ptr %38, align 8, !tbaa !18
  %.not63 = icmp eq ptr %39, null
  br i1 %.not63, label %59, label %.preheader

.preheader:                                       ; preds = %36
  %40 = load i32, ptr %37, align 8, !tbaa !16
  %.not6471 = icmp slt i32 %40, 0
  br i1 %.not6471, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader, %52
  %41 = phi i32 [ %53, %52 ], [ %40, %.preheader ]
  %42 = phi ptr [ %54, %52 ], [ %37, %.preheader ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %52 ], [ 0, %.preheader ]
  %43 = getelementptr inbounds i8, ptr %42, i64 112
  %44 = load ptr, ptr %43, align 8, !tbaa !18
  %45 = getelementptr inbounds ptr, ptr %44, i64 %indvars.iv
  %46 = load ptr, ptr %45, align 8, !tbaa !19
  %.not70 = icmp eq ptr %46, null
  br i1 %.not70, label %52, label %47

47:                                               ; preds = %.lr.ph
  tail call void @free(ptr noundef nonnull %46) #3
  %48 = load ptr, ptr %0, align 8, !tbaa !5
  %49 = getelementptr inbounds i8, ptr %48, i64 112
  %50 = load ptr, ptr %49, align 8, !tbaa !18
  %51 = getelementptr inbounds ptr, ptr %50, i64 %indvars.iv
  store ptr null, ptr %51, align 8, !tbaa !19
  %.pre = load ptr, ptr %0, align 8, !tbaa !5
  %.pre75 = load i32, ptr %.pre, align 8, !tbaa !16
  br label %52

52:                                               ; preds = %.lr.ph, %47
  %53 = phi i32 [ %41, %.lr.ph ], [ %.pre75, %47 ]
  %54 = phi ptr [ %42, %.lr.ph ], [ %.pre, %47 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %55 = sext i32 %53 to i64
  %.not64.not = icmp slt i64 %indvars.iv, %55
  br i1 %.not64.not, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !20

._crit_edge.loopexit:                             ; preds = %52
  %.phi.trans.insert = getelementptr inbounds i8, ptr %54, i64 112
  %.pre76 = load ptr, ptr %.phi.trans.insert, align 8, !tbaa !18
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %56 = phi ptr [ %39, %.preheader ], [ %.pre76, %._crit_edge.loopexit ]
  tail call void @free(ptr noundef %56) #3
  %57 = load ptr, ptr %0, align 8, !tbaa !5
  %58 = getelementptr inbounds i8, ptr %57, i64 112
  store ptr null, ptr %58, align 8, !tbaa !18
  br label %59

59:                                               ; preds = %._crit_edge, %36
  %60 = phi ptr [ %57, %._crit_edge ], [ %37, %36 ]
  %61 = getelementptr inbounds i8, ptr %60, i64 120
  %62 = load ptr, ptr %61, align 8, !tbaa !22
  %.not65 = icmp eq ptr %62, null
  br i1 %.not65, label %66, label %63

63:                                               ; preds = %59
  tail call void @free(ptr noundef nonnull %62) #3
  %64 = load ptr, ptr %0, align 8, !tbaa !5
  %65 = getelementptr inbounds i8, ptr %64, i64 120
  store ptr null, ptr %65, align 8, !tbaa !22
  br label %66

66:                                               ; preds = %63, %59
  %67 = phi ptr [ %64, %63 ], [ %60, %59 ]
  %68 = getelementptr inbounds i8, ptr %67, i64 136
  %69 = load ptr, ptr %68, align 8, !tbaa !23
  %.not66 = icmp eq ptr %69, null
  br i1 %.not66, label %73, label %70

70:                                               ; preds = %66
  tail call void @free(ptr noundef nonnull %69) #3
  %71 = load ptr, ptr %0, align 8, !tbaa !5
  %72 = getelementptr inbounds i8, ptr %71, i64 136
  store ptr null, ptr %72, align 8, !tbaa !23
  br label %73

73:                                               ; preds = %70, %66
  %74 = phi ptr [ %71, %70 ], [ %67, %66 ]
  %75 = getelementptr inbounds i8, ptr %74, i64 152
  %76 = load ptr, ptr %75, align 8, !tbaa !24
  %.not67 = icmp eq ptr %76, null
  br i1 %.not67, label %80, label %77

77:                                               ; preds = %73
  tail call void @free(ptr noundef nonnull %76) #3
  %78 = load ptr, ptr %0, align 8, !tbaa !5
  %79 = getelementptr inbounds i8, ptr %78, i64 152
  store ptr null, ptr %79, align 8, !tbaa !24
  br label %80

80:                                               ; preds = %77, %73
  %81 = phi ptr [ %78, %77 ], [ %74, %73 ]
  %82 = getelementptr inbounds i8, ptr %81, i64 160
  %83 = load ptr, ptr %82, align 8, !tbaa !25
  %.not68 = icmp eq ptr %83, null
  br i1 %.not68, label %87, label %84

84:                                               ; preds = %80
  tail call void @free(ptr noundef nonnull %83) #3
  %85 = load ptr, ptr %0, align 8, !tbaa !5
  %86 = getelementptr inbounds i8, ptr %85, i64 160
  store ptr null, ptr %86, align 8, !tbaa !25
  br label %87

87:                                               ; preds = %84, %80
  %88 = phi ptr [ %85, %84 ], [ %81, %80 ]
  tail call void @free(ptr noundef nonnull %88) #3
  store ptr null, ptr %0, align 8, !tbaa !5
  br label %89

89:                                               ; preds = %87, %3
  %90 = getelementptr inbounds i8, ptr %0, i64 8
  %91 = load ptr, ptr %90, align 8, !tbaa !26
  %.not69 = icmp eq ptr %91, null
  br i1 %.not69, label %93, label %92

92:                                               ; preds = %89
  tail call void @free(ptr noundef nonnull %91) #3
  br label %93

93:                                               ; preds = %92, %89
  tail call void @free(ptr noundef nonnull %0) #3
  br label %94

94:                                               ; preds = %1, %93
  ret i32 0
}

declare void @N_VDestroy(ptr noundef) local_unnamed_addr #1

declare void @N_VDestroyVectorArray(ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #2

attributes #0 = { 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 #1 = { "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 #2 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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, !7, i64 0}
!6 = !{!"_generic_SUNLinearSolver", !7, i64 0, !7, i64 8, !7, i64 16}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!11, !7, i64 128}
!11 = !{!"_SUNLinearSolverContent_SPFGMR", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !13, i64 24, !12, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !7, i64 96, !7, i64 104, !7, i64 112, !7, i64 120, !7, i64 128, !7, i64 136, !7, i64 144, !7, i64 152, !7, i64 160, !12, i64 168, !7, i64 176}
!12 = !{!"int", !8, i64 0}
!13 = !{!"double", !8, i64 0}
!14 = !{!11, !7, i64 144}
!15 = !{!11, !7, i64 96}
!16 = !{!11, !12, i64 0}
!17 = !{!11, !7, i64 104}
!18 = !{!11, !7, i64 112}
!19 = !{!7, !7, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!11, !7, i64 120}
!23 = !{!11, !7, i64 136}
!24 = !{!11, !7, i64 152}
!25 = !{!11, !7, i64 160}
!26 = !{!6, !7, i64 8}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass