; 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 @SUNLinSolInitialize_SPGMR(ptr noundef %0) #1 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %7 = load ptr, ptr %3, align 8, !tbaa !5
  %8 = icmp eq ptr %7, null
  br i1 %8, label %9, label %10

9:                                                ; preds = %1
  store i32 -801, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %257

10:                                               ; preds = %1
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %11, i32 0, i32 0
  %13 = load ptr, ptr %12, align 8, !tbaa !9
  store ptr %13, ptr %5, align 8, !tbaa !5
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %14, i32 0, i32 3
  %16 = load i32, ptr %15, align 4, !tbaa !11
  %17 = icmp slt i32 %16, 0
  br i1 %17, label %18, label %21

18:                                               ; preds = %10
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %19, i32 0, i32 3
  store i32 0, ptr %20, align 4, !tbaa !11
  br label %21

21:                                               ; preds = %18, %10
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %22, i32 0, i32 8
  %24 = load ptr, ptr %23, align 8, !tbaa !15
  %25 = icmp eq ptr %24, null
  br i1 %25, label %26, label %36

26:                                               ; preds = %21
  %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 7
  store i32 -804, ptr %30, align 8, !tbaa !16
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %31, i32 0, i32 0
  %33 = load ptr, ptr %32, align 8, !tbaa !9
  %34 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %33, i32 0, i32 7
  %35 = load i32, ptr %34, align 8, !tbaa !16
  store i32 %35, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %257

36:                                               ; preds = %21
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %37, i32 0, i32 1
  %39 = load i32, ptr %38, align 4, !tbaa !17
  %40 = icmp ne i32 %39, 1
  br i1 %40, label %41, label %54

41:                                               ; preds = %36
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %42, i32 0, i32 1
  %44 = load i32, ptr %43, align 4, !tbaa !17
  %45 = icmp ne i32 %44, 2
  br i1 %45, label %46, label %54

46:                                               ; preds = %41
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %47, i32 0, i32 1
  %49 = load i32, ptr %48, align 4, !tbaa !17
  %50 = icmp ne i32 %49, 3
  br i1 %50, label %51, label %54

51:                                               ; preds = %46
  %52 = load ptr, ptr %5, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %52, i32 0, i32 1
  store i32 0, ptr %53, align 4, !tbaa !17
  br label %54

54:                                               ; preds = %51, %46, %41, %36
  %55 = load ptr, ptr %5, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %55, i32 0, i32 1
  %57 = load i32, ptr %56, align 4, !tbaa !17
  %58 = icmp ne i32 %57, 0
  br i1 %58, label %59, label %74

59:                                               ; preds = %54
  %60 = load ptr, ptr %5, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %60, i32 0, i32 11
  %62 = load ptr, ptr %61, align 8, !tbaa !18
  %63 = icmp eq ptr %62, null
  br i1 %63, label %64, label %74

64:                                               ; preds = %59
  %65 = load ptr, ptr %3, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %65, i32 0, i32 0
  %67 = load ptr, ptr %66, align 8, !tbaa !9
  %68 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %67, i32 0, i32 7
  store i32 -807, ptr %68, align 8, !tbaa !16
  %69 = load ptr, ptr %3, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %69, i32 0, i32 0
  %71 = load ptr, ptr %70, align 8, !tbaa !9
  %72 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %71, i32 0, i32 7
  %73 = load i32, ptr %72, align 8, !tbaa !16
  store i32 %73, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %257

74:                                               ; preds = %59, %54
  %75 = load ptr, ptr %5, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %75, i32 0, i32 15
  %77 = load ptr, ptr %76, align 8, !tbaa !19
  %78 = icmp eq ptr %77, null
  br i1 %78, label %79, label %98

79:                                               ; preds = %74
  %80 = load ptr, ptr %5, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %80, i32 0, i32 0
  %82 = load i32, ptr %81, align 8, !tbaa !20
  %83 = add nsw i32 %82, 1
  %84 = load ptr, ptr %5, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %84, i32 0, i32 20
  %86 = load ptr, ptr %85, align 8, !tbaa !21
  %87 = call ptr @N_VCloneVectorArray(i32 noundef %83, ptr noundef %86)
  %88 = load ptr, ptr %5, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %88, i32 0, i32 15
  store ptr %87, ptr %89, align 8, !tbaa !19
  %90 = load ptr, ptr %5, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %90, i32 0, i32 15
  %92 = load ptr, ptr %91, align 8, !tbaa !19
  %93 = icmp eq ptr %92, null
  br i1 %93, label %94, label %97

94:                                               ; preds = %79
  %95 = load ptr, ptr %5, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %95, i32 0, i32 7
  store i32 -803, ptr %96, align 8, !tbaa !16
  store i32 -803, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %257

97:                                               ; preds = %79
  br label %98

98:                                               ; preds = %97, %74
  %99 = load ptr, ptr %5, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %99, i32 0, i32 16
  %101 = load ptr, ptr %100, align 8, !tbaa !22
  %102 = icmp eq ptr %101, null
  br i1 %102, label %103, label %162

103:                                              ; preds = %98
  %104 = load ptr, ptr %5, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %104, i32 0, i32 0
  %106 = load i32, ptr %105, align 8, !tbaa !20
  %107 = add nsw i32 %106, 1
  %108 = sext i32 %107 to i64
  %109 = mul i64 %108, 8
  %110 = call noalias ptr @malloc(i64 noundef %109) #5
  %111 = load ptr, ptr %5, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %111, i32 0, i32 16
  store ptr %110, ptr %112, align 8, !tbaa !22
  %113 = load ptr, ptr %5, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %113, i32 0, i32 16
  %115 = load ptr, ptr %114, align 8, !tbaa !22
  %116 = icmp eq ptr %115, null
  br i1 %116, label %117, label %120

117:                                              ; preds = %103
  %118 = load ptr, ptr %5, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %118, i32 0, i32 7
  store i32 -803, ptr %119, align 8, !tbaa !16
  store i32 -803, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %257

120:                                              ; preds = %103
  store i32 0, ptr %4, align 4, !tbaa !23
  br label %121

121:                                              ; preds = %158, %120
  %122 = load i32, ptr %4, align 4, !tbaa !23
  %123 = load ptr, ptr %5, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %123, i32 0, i32 0
  %125 = load i32, ptr %124, align 8, !tbaa !20
  %126 = icmp sle i32 %122, %125
  br i1 %126, label %127, label %161

127:                                              ; preds = %121
  %128 = load ptr, ptr %5, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %128, i32 0, i32 16
  %130 = load ptr, ptr %129, align 8, !tbaa !22
  %131 = load i32, ptr %4, align 4, !tbaa !23
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds ptr, ptr %130, i64 %132
  store ptr null, ptr %133, align 8, !tbaa !5
  %134 = load ptr, ptr %5, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %134, i32 0, i32 0
  %136 = load i32, ptr %135, align 8, !tbaa !20
  %137 = sext i32 %136 to i64
  %138 = mul i64 %137, 8
  %139 = call noalias ptr @malloc(i64 noundef %138) #5
  %140 = load ptr, ptr %5, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %140, i32 0, i32 16
  %142 = load ptr, ptr %141, align 8, !tbaa !22
  %143 = load i32, ptr %4, align 4, !tbaa !23
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds ptr, ptr %142, i64 %144
  store ptr %139, ptr %145, align 8, !tbaa !5
  %146 = load ptr, ptr %5, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %146, i32 0, i32 16
  %148 = load ptr, ptr %147, align 8, !tbaa !22
  %149 = load i32, ptr %4, align 4, !tbaa !23
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds ptr, ptr %148, i64 %150
  %152 = load ptr, ptr %151, align 8, !tbaa !5
  %153 = icmp eq ptr %152, null
  br i1 %153, label %154, label %157

154:                                              ; preds = %127
  %155 = load ptr, ptr %5, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %155, i32 0, i32 7
  store i32 -803, ptr %156, align 8, !tbaa !16
  store i32 -803, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %257

157:                                              ; preds = %127
  br label %158

158:                                              ; preds = %157
  %159 = load i32, ptr %4, align 4, !tbaa !23
  %160 = add nsw i32 %159, 1
  store i32 %160, ptr %4, align 4, !tbaa !23
  br label %121, !llvm.loop !24

161:                                              ; preds = %121
  br label %162

162:                                              ; preds = %161, %98
  %163 = load ptr, ptr %5, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %163, i32 0, i32 17
  %165 = load ptr, ptr %164, align 8, !tbaa !26
  %166 = icmp eq ptr %165, null
  br i1 %166, label %167, label %185

167:                                              ; preds = %162
  %168 = load ptr, ptr %5, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %168, i32 0, i32 0
  %170 = load i32, ptr %169, align 8, !tbaa !20
  %171 = mul nsw i32 2, %170
  %172 = sext i32 %171 to i64
  %173 = mul i64 %172, 8
  %174 = call noalias ptr @malloc(i64 noundef %173) #5
  %175 = load ptr, ptr %5, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %175, i32 0, i32 17
  store ptr %174, ptr %176, align 8, !tbaa !26
  %177 = load ptr, ptr %5, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %177, i32 0, i32 17
  %179 = load ptr, ptr %178, align 8, !tbaa !26
  %180 = icmp eq ptr %179, null
  br i1 %180, label %181, label %184

181:                                              ; preds = %167
  %182 = load ptr, ptr %5, align 8, !tbaa !5
  %183 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %182, i32 0, i32 7
  store i32 -803, ptr %183, align 8, !tbaa !16
  store i32 -803, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %257

184:                                              ; preds = %167
  br label %185

185:                                              ; preds = %184, %162
  %186 = load ptr, ptr %5, align 8, !tbaa !5
  %187 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %186, i32 0, i32 19
  %188 = load ptr, ptr %187, align 8, !tbaa !27
  %189 = icmp eq ptr %188, null
  br i1 %189, label %190, label %208

190:                                              ; preds = %185
  %191 = load ptr, ptr %5, align 8, !tbaa !5
  %192 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %191, i32 0, i32 0
  %193 = load i32, ptr %192, align 8, !tbaa !20
  %194 = add nsw i32 %193, 1
  %195 = sext i32 %194 to i64
  %196 = mul i64 %195, 8
  %197 = call noalias ptr @malloc(i64 noundef %196) #5
  %198 = load ptr, ptr %5, align 8, !tbaa !5
  %199 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %198, i32 0, i32 19
  store ptr %197, ptr %199, align 8, !tbaa !27
  %200 = load ptr, ptr %5, align 8, !tbaa !5
  %201 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %200, i32 0, i32 19
  %202 = load ptr, ptr %201, align 8, !tbaa !27
  %203 = icmp eq ptr %202, null
  br i1 %203, label %204, label %207

204:                                              ; preds = %190
  %205 = load ptr, ptr %5, align 8, !tbaa !5
  %206 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %205, i32 0, i32 7
  store i32 -803, ptr %206, align 8, !tbaa !16
  store i32 -803, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %257

207:                                              ; preds = %190
  br label %208

208:                                              ; preds = %207, %185
  %209 = load ptr, ptr %5, align 8, !tbaa !5
  %210 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %209, i32 0, i32 21
  %211 = load ptr, ptr %210, align 8, !tbaa !28
  %212 = icmp eq ptr %211, null
  br i1 %212, label %213, label %231

213:                                              ; preds = %208
  %214 = load ptr, ptr %5, align 8, !tbaa !5
  %215 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %214, i32 0, i32 0
  %216 = load i32, ptr %215, align 8, !tbaa !20
  %217 = add nsw i32 %216, 1
  %218 = sext i32 %217 to i64
  %219 = mul i64 %218, 8
  %220 = call noalias ptr @malloc(i64 noundef %219) #5
  %221 = load ptr, ptr %5, align 8, !tbaa !5
  %222 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %221, i32 0, i32 21
  store ptr %220, ptr %222, align 8, !tbaa !28
  %223 = load ptr, ptr %5, align 8, !tbaa !5
  %224 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %223, i32 0, i32 21
  %225 = load ptr, ptr %224, align 8, !tbaa !28
  %226 = icmp eq ptr %225, null
  br i1 %226, label %227, label %230

227:                                              ; preds = %213
  %228 = load ptr, ptr %5, align 8, !tbaa !5
  %229 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %228, i32 0, i32 7
  store i32 -803, ptr %229, align 8, !tbaa !16
  store i32 -803, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %257

230:                                              ; preds = %213
  br label %231

231:                                              ; preds = %230, %208
  %232 = load ptr, ptr %5, align 8, !tbaa !5
  %233 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %232, i32 0, i32 22
  %234 = load ptr, ptr %233, align 8, !tbaa !29
  %235 = icmp eq ptr %234, null
  br i1 %235, label %236, label %254

236:                                              ; preds = %231
  %237 = load ptr, ptr %5, align 8, !tbaa !5
  %238 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %237, i32 0, i32 0
  %239 = load i32, ptr %238, align 8, !tbaa !20
  %240 = add nsw i32 %239, 1
  %241 = sext i32 %240 to i64
  %242 = mul i64 %241, 8
  %243 = call noalias ptr @malloc(i64 noundef %242) #5
  %244 = load ptr, ptr %5, align 8, !tbaa !5
  %245 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %244, i32 0, i32 22
  store ptr %243, ptr %245, align 8, !tbaa !29
  %246 = load ptr, ptr %5, align 8, !tbaa !5
  %247 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %246, i32 0, i32 22
  %248 = load ptr, ptr %247, align 8, !tbaa !29
  %249 = icmp eq ptr %248, null
  br i1 %249, label %250, label %253

250:                                              ; preds = %236
  %251 = load ptr, ptr %5, align 8, !tbaa !5
  %252 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %251, i32 0, i32 7
  store i32 -803, ptr %252, align 8, !tbaa !16
  store i32 -803, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %257

253:                                              ; preds = %236
  br label %254

254:                                              ; preds = %253, %231
  %255 = load ptr, ptr %5, align 8, !tbaa !5
  %256 = getelementptr inbounds %struct._SUNLinearSolverContent_SPGMR, ptr %255, i32 0, i32 7
  store i32 0, ptr %256, align 8, !tbaa !16
  store i32 0, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %257

257:                                              ; preds = %254, %250, %227, %204, %181, %154, %117, %94, %64, %26, %9
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  %258 = load i32, ptr %2, align 4
  ret i32 %258
}

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #2

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

declare ptr @N_VCloneVectorArray(i32 noundef, 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 = { nounwind allocsize(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 = { "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 }
attributes #5 = { nounwind allocsize(0) }

!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, !13, i64 12}
!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 40}
!16 = !{!12, !13, i64 32}
!17 = !{!12, !13, i64 4}
!18 = !{!12, !6, i64 64}
!19 = !{!12, !6, i64 96}
!20 = !{!12, !13, i64 0}
!21 = !{!12, !6, i64 136}
!22 = !{!12, !6, i64 104}
!23 = !{!13, !13, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{!12, !6, i64 112}
!27 = !{!12, !6, i64 128}
!28 = !{!12, !6, i64 144}
!29 = !{!12, !6, i64 152}


; 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 @SUNLinSolInitialize_SPGMR(ptr noundef readonly %0) local_unnamed_addr #0 {
  %2 = icmp eq ptr %0, null
  br i1 %2, label %100, label %3

3:                                                ; preds = %1
  %4 = load ptr, ptr %0, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %4, i64 12
  %6 = load i32, ptr %5, align 4, !tbaa !10
  %7 = icmp slt i32 %6, 0
  br i1 %7, label %8, label %9

8:                                                ; preds = %3
  store i32 0, ptr %5, align 4, !tbaa !10
  br label %9

9:                                                ; preds = %8, %3
  %10 = getelementptr inbounds i8, ptr %4, i64 40
  %11 = load ptr, ptr %10, align 8, !tbaa !14
  %12 = icmp eq ptr %11, null
  br i1 %12, label %.sink.split, label %13

13:                                               ; preds = %9
  %14 = getelementptr inbounds i8, ptr %4, i64 4
  %15 = load i32, ptr %14, align 4, !tbaa !15
  %.off = add i32 %15, -1
  %switch = icmp ult i32 %.off, 3
  br i1 %switch, label %16, label %.thread

.thread:                                          ; preds = %13
  store i32 0, ptr %14, align 4, !tbaa !15
  br label %20

16:                                               ; preds = %13
  %17 = getelementptr inbounds i8, ptr %4, i64 64
  %18 = load ptr, ptr %17, align 8, !tbaa !16
  %19 = icmp eq ptr %18, null
  br i1 %19, label %.sink.split, label %20

20:                                               ; preds = %.thread, %16
  %21 = getelementptr inbounds i8, ptr %4, i64 96
  %22 = load ptr, ptr %21, align 8, !tbaa !17
  %23 = icmp eq ptr %22, null
  br i1 %23, label %24, label %31

24:                                               ; preds = %20
  %25 = load i32, ptr %4, align 8, !tbaa !18
  %26 = add nsw i32 %25, 1
  %27 = getelementptr inbounds i8, ptr %4, i64 136
  %28 = load ptr, ptr %27, align 8, !tbaa !19
  %29 = tail call ptr @N_VCloneVectorArray(i32 noundef %26, ptr noundef %28) #3
  store ptr %29, ptr %21, align 8, !tbaa !17
  %30 = icmp eq ptr %29, null
  br i1 %30, label %.sink.split, label %31

31:                                               ; preds = %24, %20
  %32 = getelementptr inbounds i8, ptr %4, i64 104
  %33 = load ptr, ptr %32, align 8, !tbaa !20
  %34 = icmp eq ptr %33, null
  br i1 %34, label %35, label %.loopexit

35:                                               ; preds = %31
  %36 = load i32, ptr %4, align 8, !tbaa !18
  %37 = add i32 %36, 1
  %38 = sext i32 %37 to i64
  %39 = shl nsw i64 %38, 3
  %40 = tail call noalias ptr @malloc(i64 noundef %39) #4
  store ptr %40, ptr %32, align 8, !tbaa !20
  %41 = icmp eq ptr %40, null
  br i1 %41, label %.sink.split, label %.preheader

.preheader:                                       ; preds = %35
  %.not6466 = icmp slt i32 %36, 0
  br i1 %.not6466, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader
  %42 = zext nneg i32 %36 to i64
  %43 = shl nuw nsw i64 %42, 3
  %wide.trip.count = zext i32 %37 to i64
  br label %45

44:                                               ; preds = %45
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.loopexit, label %45, !llvm.loop !21

45:                                               ; preds = %.lr.ph, %44
  %46 = phi ptr [ %40, %.lr.ph ], [ %51, %44 ]
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %44 ]
  %47 = getelementptr inbounds ptr, ptr %46, i64 %indvars.iv
  store ptr null, ptr %47, align 8, !tbaa !23
  %48 = tail call noalias ptr @malloc(i64 noundef %43) #4
  %49 = load ptr, ptr %32, align 8, !tbaa !20
  %50 = getelementptr inbounds ptr, ptr %49, i64 %indvars.iv
  store ptr %48, ptr %50, align 8, !tbaa !23
  %51 = load ptr, ptr %32, align 8, !tbaa !20
  %52 = getelementptr inbounds ptr, ptr %51, i64 %indvars.iv
  %53 = load ptr, ptr %52, align 8, !tbaa !23
  %54 = icmp eq ptr %53, null
  br i1 %54, label %.sink.split, label %44

.loopexit:                                        ; preds = %44, %.preheader, %31
  %55 = getelementptr inbounds i8, ptr %4, i64 112
  %56 = load ptr, ptr %55, align 8, !tbaa !24
  %57 = icmp eq ptr %56, null
  br i1 %57, label %58, label %65

58:                                               ; preds = %.loopexit
  %59 = load i32, ptr %4, align 8, !tbaa !18
  %60 = shl nsw i32 %59, 1
  %61 = sext i32 %60 to i64
  %62 = shl nsw i64 %61, 3
  %63 = tail call noalias ptr @malloc(i64 noundef %62) #4
  store ptr %63, ptr %55, align 8, !tbaa !24
  %64 = icmp eq ptr %63, null
  br i1 %64, label %.sink.split, label %65

65:                                               ; preds = %58, %.loopexit
  %66 = getelementptr inbounds i8, ptr %4, i64 128
  %67 = load ptr, ptr %66, align 8, !tbaa !25
  %68 = icmp eq ptr %67, null
  br i1 %68, label %69, label %76

69:                                               ; preds = %65
  %70 = load i32, ptr %4, align 8, !tbaa !18
  %71 = add nsw i32 %70, 1
  %72 = sext i32 %71 to i64
  %73 = shl nsw i64 %72, 3
  %74 = tail call noalias ptr @malloc(i64 noundef %73) #4
  store ptr %74, ptr %66, align 8, !tbaa !25
  %75 = icmp eq ptr %74, null
  br i1 %75, label %.sink.split, label %76

76:                                               ; preds = %69, %65
  %77 = getelementptr inbounds i8, ptr %4, i64 144
  %78 = load ptr, ptr %77, align 8, !tbaa !26
  %79 = icmp eq ptr %78, null
  br i1 %79, label %80, label %87

80:                                               ; preds = %76
  %81 = load i32, ptr %4, align 8, !tbaa !18
  %82 = add nsw i32 %81, 1
  %83 = sext i32 %82 to i64
  %84 = shl nsw i64 %83, 3
  %85 = tail call noalias ptr @malloc(i64 noundef %84) #4
  store ptr %85, ptr %77, align 8, !tbaa !26
  %86 = icmp eq ptr %85, null
  br i1 %86, label %.sink.split, label %87

87:                                               ; preds = %80, %76
  %88 = getelementptr inbounds i8, ptr %4, i64 152
  %89 = load ptr, ptr %88, align 8, !tbaa !27
  %90 = icmp eq ptr %89, null
  br i1 %90, label %91, label %98

91:                                               ; preds = %87
  %92 = load i32, ptr %4, align 8, !tbaa !18
  %93 = add nsw i32 %92, 1
  %94 = sext i32 %93 to i64
  %95 = shl nsw i64 %94, 3
  %96 = tail call noalias ptr @malloc(i64 noundef %95) #4
  store ptr %96, ptr %88, align 8, !tbaa !27
  %97 = icmp eq ptr %96, null
  br i1 %97, label %.sink.split, label %98

98:                                               ; preds = %91, %87
  br label %.sink.split

.sink.split:                                      ; preds = %45, %91, %80, %69, %58, %35, %24, %16, %9, %98
  %.sink = phi i32 [ 0, %98 ], [ -804, %9 ], [ -807, %16 ], [ -803, %24 ], [ -803, %35 ], [ -803, %58 ], [ -803, %69 ], [ -803, %80 ], [ -803, %91 ], [ -803, %45 ]
  %99 = getelementptr inbounds i8, ptr %4, i64 32
  store i32 %.sink, ptr %99, align 8, !tbaa !28
  br label %100

100:                                              ; preds = %.sink.split, %1
  %.0 = phi i32 [ -801, %1 ], [ %.sink, %.sink.split ]
  ret i32 %.0
}

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #1

declare ptr @N_VCloneVectorArray(i32 noundef, ptr 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 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(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 #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 }
attributes #4 = { nounwind allocsize(0) }

!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, !12, i64 12}
!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 40}
!15 = !{!11, !12, i64 4}
!16 = !{!11, !7, i64 64}
!17 = !{!11, !7, i64 96}
!18 = !{!11, !12, i64 0}
!19 = !{!11, !7, i64 136}
!20 = !{!11, !7, i64 104}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!7, !7, i64 0}
!24 = !{!11, !7, i64 112}
!25 = !{!11, !7, i64 128}
!26 = !{!11, !7, i64 144}
!27 = !{!11, !7, i64 152}
!28 = !{!11, !12, i64 32}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass