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

; 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_SPGMR = type { i32, i32, i32, i32, i32, i32, double, i32, 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_SPGMR(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 %217

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 %204

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_SPGMR, ptr %17, i32 0, i32 18
  %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_SPGMR, ptr %24, i32 0, i32 18
  %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_SPGMR, ptr %29, i32 0, i32 18
  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_SPGMR, ptr %34, i32 0, i32 20
  %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_SPGMR, ptr %41, i32 0, i32 20
  %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_SPGMR, ptr %46, i32 0, i32 20
  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_SPGMR, 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_SPGMR, 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_SPGMR, 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_SPGMR, 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_SPGMR, 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 %130

78:                                               ; preds = %71
  store i32 0, ptr %4, align 4, !tbaa !19
  br label %79

79:                                               ; preds = %117, %78
  %80 = load i32, ptr %4, align 4, !tbaa !19
  %81 = load ptr, ptr %3, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %81, i32 0, i32 0
  %83 = load ptr, ptr %82, align 8, !tbaa !9
  %84 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %83, i32 0, i32 0
  %85 = load i32, ptr %84, align 8, !tbaa !17
  %86 = icmp sle i32 %80, %85
  br i1 %86, label %87, label %120

87:                                               ; preds = %79
  %88 = load ptr, ptr %3, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %88, i32 0, i32 0
  %90 = load ptr, ptr %89, align 8, !tbaa !9
  %91 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %90, i32 0, i32 16
  %92 = load ptr, ptr %91, align 8, !tbaa !18
  %93 = load i32, ptr %4, align 4, !tbaa !19
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds ptr, ptr %92, i64 %94
  %96 = load ptr, ptr %95, align 8, !tbaa !5
  %97 = icmp ne ptr %96, null
  br i1 %97, label %98, label %116

98:                                               ; preds = %87
  %99 = load ptr, ptr %3, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %99, i32 0, i32 0
  %101 = load ptr, ptr %100, align 8, !tbaa !9
  %102 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %101, i32 0, i32 16
  %103 = load ptr, ptr %102, align 8, !tbaa !18
  %104 = load i32, ptr %4, align 4, !tbaa !19
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds ptr, ptr %103, i64 %105
  %107 = load ptr, ptr %106, align 8, !tbaa !5
  call void @free(ptr noundef %107) #4
  %108 = load ptr, ptr %3, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %108, i32 0, i32 0
  %110 = load ptr, ptr %109, align 8, !tbaa !9
  %111 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %110, i32 0, i32 16
  %112 = load ptr, ptr %111, align 8, !tbaa !18
  %113 = load i32, ptr %4, align 4, !tbaa !19
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds ptr, ptr %112, i64 %114
  store ptr null, ptr %115, align 8, !tbaa !5
  br label %116

116:                                              ; preds = %98, %87
  br label %117

117:                                              ; preds = %116
  %118 = load i32, ptr %4, align 4, !tbaa !19
  %119 = add nsw i32 %118, 1
  store i32 %119, ptr %4, align 4, !tbaa !19
  br label %79, !llvm.loop !20

120:                                              ; preds = %79
  %121 = load ptr, ptr %3, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %121, i32 0, i32 0
  %123 = load ptr, ptr %122, align 8, !tbaa !9
  %124 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %123, i32 0, i32 16
  %125 = load ptr, ptr %124, align 8, !tbaa !18
  call void @free(ptr noundef %125) #4
  %126 = load ptr, ptr %3, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %126, i32 0, i32 0
  %128 = load ptr, ptr %127, align 8, !tbaa !9
  %129 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %128, i32 0, i32 16
  store ptr null, ptr %129, align 8, !tbaa !18
  br label %130

130:                                              ; preds = %120, %71
  %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_SPGMR, ptr %133, i32 0, i32 17
  %135 = load ptr, ptr %134, align 8, !tbaa !22
  %136 = icmp ne ptr %135, null
  br i1 %136, label %137, label %147

137:                                              ; preds = %130
  %138 = load ptr, ptr %3, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %138, i32 0, i32 0
  %140 = load ptr, ptr %139, align 8, !tbaa !9
  %141 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %140, i32 0, i32 17
  %142 = load ptr, ptr %141, align 8, !tbaa !22
  call void @free(ptr noundef %142) #4
  %143 = load ptr, ptr %3, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %143, i32 0, i32 0
  %145 = load ptr, ptr %144, align 8, !tbaa !9
  %146 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %145, i32 0, i32 17
  store ptr null, ptr %146, align 8, !tbaa !22
  br label %147

147:                                              ; preds = %137, %130
  %148 = load ptr, ptr %3, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %148, i32 0, i32 0
  %150 = load ptr, ptr %149, align 8, !tbaa !9
  %151 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %150, i32 0, i32 19
  %152 = load ptr, ptr %151, align 8, !tbaa !23
  %153 = icmp ne ptr %152, null
  br i1 %153, label %154, label %164

154:                                              ; preds = %147
  %155 = load ptr, ptr %3, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %155, i32 0, i32 0
  %157 = load ptr, ptr %156, align 8, !tbaa !9
  %158 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %157, i32 0, i32 19
  %159 = load ptr, ptr %158, align 8, !tbaa !23
  call void @free(ptr noundef %159) #4
  %160 = load ptr, ptr %3, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %160, i32 0, i32 0
  %162 = load ptr, ptr %161, align 8, !tbaa !9
  %163 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %162, i32 0, i32 19
  store ptr null, ptr %163, align 8, !tbaa !23
  br label %164

164:                                              ; preds = %154, %147
  %165 = load ptr, ptr %3, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %165, i32 0, i32 0
  %167 = load ptr, ptr %166, align 8, !tbaa !9
  %168 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %167, i32 0, i32 21
  %169 = load ptr, ptr %168, align 8, !tbaa !24
  %170 = icmp ne ptr %169, null
  br i1 %170, label %171, label %181

171:                                              ; preds = %164
  %172 = load ptr, ptr %3, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %172, i32 0, i32 0
  %174 = load ptr, ptr %173, align 8, !tbaa !9
  %175 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %174, i32 0, i32 21
  %176 = load ptr, ptr %175, align 8, !tbaa !24
  call void @free(ptr noundef %176) #4
  %177 = load ptr, ptr %3, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %177, i32 0, i32 0
  %179 = load ptr, ptr %178, align 8, !tbaa !9
  %180 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %179, i32 0, i32 21
  store ptr null, ptr %180, align 8, !tbaa !24
  br label %181

181:                                              ; preds = %171, %164
  %182 = load ptr, ptr %3, align 8, !tbaa !5
  %183 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %182, i32 0, i32 0
  %184 = load ptr, ptr %183, align 8, !tbaa !9
  %185 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %184, i32 0, i32 22
  %186 = load ptr, ptr %185, align 8, !tbaa !25
  %187 = icmp ne ptr %186, null
  br i1 %187, label %188, label %198

188:                                              ; preds = %181
  %189 = load ptr, ptr %3, align 8, !tbaa !5
  %190 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %189, i32 0, i32 0
  %191 = load ptr, ptr %190, align 8, !tbaa !9
  %192 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %191, i32 0, i32 22
  %193 = load ptr, ptr %192, align 8, !tbaa !25
  call void @free(ptr noundef %193) #4
  %194 = load ptr, ptr %3, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %194, i32 0, i32 0
  %196 = load ptr, ptr %195, align 8, !tbaa !9
  %197 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %196, i32 0, i32 22
  store ptr null, ptr %197, align 8, !tbaa !25
  br label %198

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

204:                                              ; preds = %198, %9
  %205 = load ptr, ptr %3, align 8, !tbaa !5
  %206 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %205, i32 0, i32 1
  %207 = load ptr, ptr %206, align 8, !tbaa !26
  %208 = icmp ne ptr %207, null
  br i1 %208, label %209, label %215

209:                                              ; preds = %204
  %210 = load ptr, ptr %3, align 8, !tbaa !5
  %211 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %210, i32 0, i32 1
  %212 = load ptr, ptr %211, align 8, !tbaa !26
  call void @free(ptr noundef %212) #4
  %213 = load ptr, ptr %3, align 8, !tbaa !5
  %214 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %213, i32 0, i32 1
  store ptr null, ptr %214, align 8, !tbaa !26
  br label %215

215:                                              ; preds = %209, %204
  %216 = load ptr, ptr %3, align 8, !tbaa !5
  call void @free(ptr noundef %216) #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 %217

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

; 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 120}
!12 = !{!"_SUNLinearSolverContent_SPGMR", !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, !13, i64 160, !6, i64 168}
!13 = !{!"int", !7, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = !{!12, !6, i64 136}
!16 = !{!12, !6, i64 96}
!17 = !{!12, !13, i64 0}
!18 = !{!12, !6, i64 104}
!19 = !{!13, !13, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!12, !6, i64 112}
!23 = !{!12, !6, i64 128}
!24 = !{!12, !6, i64 144}
!25 = !{!12, !6, i64 152}
!26 = !{!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_SPGMR(ptr noundef %0) local_unnamed_addr #0 {
  %2 = icmp eq ptr %0, null
  br i1 %2, label %85, label %3

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

5:                                                ; preds = %3
  %6 = getelementptr inbounds i8, ptr %4, i64 120
  %7 = load ptr, ptr %6, align 8, !tbaa !10
  %.not54 = icmp eq ptr %7, null
  br i1 %.not54, 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 120
  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 136
  %14 = load ptr, ptr %13, align 8, !tbaa !14
  %.not55 = icmp eq ptr %14, null
  br i1 %.not55, 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 136
  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
  %.not56 = icmp eq ptr %21, null
  br i1 %.not56, 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
  %.not57 = icmp eq ptr %30, null
  br i1 %.not57, label %50, label %.preheader

.preheader:                                       ; preds = %27
  %31 = load i32, ptr %28, align 8, !tbaa !16
  %.not5865 = icmp slt i32 %31, 0
  br i1 %.not5865, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader, %43
  %32 = phi i32 [ %44, %43 ], [ %31, %.preheader ]
  %33 = phi ptr [ %45, %43 ], [ %28, %.preheader ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %43 ], [ 0, %.preheader ]
  %34 = getelementptr inbounds i8, ptr %33, i64 104
  %35 = load ptr, ptr %34, align 8, !tbaa !17
  %36 = getelementptr inbounds ptr, ptr %35, i64 %indvars.iv
  %37 = load ptr, ptr %36, align 8, !tbaa !18
  %.not64 = icmp eq ptr %37, null
  br i1 %.not64, label %43, label %38

38:                                               ; preds = %.lr.ph
  tail call void @free(ptr noundef nonnull %37) #3
  %39 = load ptr, ptr %0, align 8, !tbaa !5
  %40 = getelementptr inbounds i8, ptr %39, i64 104
  %41 = load ptr, ptr %40, align 8, !tbaa !17
  %42 = getelementptr inbounds ptr, ptr %41, i64 %indvars.iv
  store ptr null, ptr %42, align 8, !tbaa !18
  %.pre = load ptr, ptr %0, align 8, !tbaa !5
  %.pre69 = load i32, ptr %.pre, align 8, !tbaa !16
  br label %43

43:                                               ; preds = %.lr.ph, %38
  %44 = phi i32 [ %32, %.lr.ph ], [ %.pre69, %38 ]
  %45 = phi ptr [ %33, %.lr.ph ], [ %.pre, %38 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %46 = sext i32 %44 to i64
  %.not58.not = icmp slt i64 %indvars.iv, %46
  br i1 %.not58.not, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !19

._crit_edge.loopexit:                             ; preds = %43
  %.phi.trans.insert = getelementptr inbounds i8, ptr %45, i64 104
  %.pre70 = load ptr, ptr %.phi.trans.insert, align 8, !tbaa !17
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %47 = phi ptr [ %30, %.preheader ], [ %.pre70, %._crit_edge.loopexit ]
  tail call void @free(ptr noundef %47) #3
  %48 = load ptr, ptr %0, align 8, !tbaa !5
  %49 = getelementptr inbounds i8, ptr %48, i64 104
  store ptr null, ptr %49, align 8, !tbaa !17
  br label %50

50:                                               ; preds = %._crit_edge, %27
  %51 = phi ptr [ %48, %._crit_edge ], [ %28, %27 ]
  %52 = getelementptr inbounds i8, ptr %51, i64 112
  %53 = load ptr, ptr %52, align 8, !tbaa !21
  %.not59 = icmp eq ptr %53, null
  br i1 %.not59, label %57, label %54

54:                                               ; preds = %50
  tail call void @free(ptr noundef nonnull %53) #3
  %55 = load ptr, ptr %0, align 8, !tbaa !5
  %56 = getelementptr inbounds i8, ptr %55, i64 112
  store ptr null, ptr %56, align 8, !tbaa !21
  br label %57

57:                                               ; preds = %54, %50
  %58 = phi ptr [ %55, %54 ], [ %51, %50 ]
  %59 = getelementptr inbounds i8, ptr %58, i64 128
  %60 = load ptr, ptr %59, align 8, !tbaa !22
  %.not60 = icmp eq ptr %60, null
  br i1 %.not60, label %64, label %61

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

64:                                               ; preds = %61, %57
  %65 = phi ptr [ %62, %61 ], [ %58, %57 ]
  %66 = getelementptr inbounds i8, ptr %65, i64 144
  %67 = load ptr, ptr %66, align 8, !tbaa !23
  %.not61 = icmp eq ptr %67, null
  br i1 %.not61, label %71, label %68

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

71:                                               ; preds = %68, %64
  %72 = phi ptr [ %69, %68 ], [ %65, %64 ]
  %73 = getelementptr inbounds i8, ptr %72, i64 152
  %74 = load ptr, ptr %73, align 8, !tbaa !24
  %.not62 = icmp eq ptr %74, null
  br i1 %.not62, label %78, label %75

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

78:                                               ; preds = %75, %71
  %79 = phi ptr [ %76, %75 ], [ %72, %71 ]
  tail call void @free(ptr noundef nonnull %79) #3
  store ptr null, ptr %0, align 8, !tbaa !5
  br label %80

80:                                               ; preds = %78, %3
  %81 = getelementptr inbounds i8, ptr %0, i64 8
  %82 = load ptr, ptr %81, align 8, !tbaa !25
  %.not63 = icmp eq ptr %82, null
  br i1 %.not63, label %84, label %83

83:                                               ; preds = %80
  tail call void @free(ptr noundef nonnull %82) #3
  br label %84

84:                                               ; preds = %83, %80
  tail call void @free(ptr noundef nonnull %0) #3
  br label %85

85:                                               ; preds = %1, %84
  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 120}
!11 = !{!"_SUNLinearSolverContent_SPGMR", !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, !12, i64 160, !7, i64 168}
!12 = !{!"int", !8, i64 0}
!13 = !{!"double", !8, i64 0}
!14 = !{!11, !7, i64 136}
!15 = !{!11, !7, i64 96}
!16 = !{!11, !12, i64 0}
!17 = !{!11, !7, i64 104}
!18 = !{!7, !7, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!11, !7, i64 112}
!22 = !{!11, !7, i64 128}
!23 = !{!11, !7, i64 144}
!24 = !{!11, !7, i64 152}
!25 = !{!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