; 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 @SUNLinSolInitialize_SPFGMR(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 %281

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_SPFGMR, 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_SPFGMR, 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_SPFGMR, 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_SPFGMR, 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_SPFGMR, 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 %281

36:                                               ; preds = %21
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, 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_SPFGMR, 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_SPFGMR, 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_SPFGMR, 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_SPFGMR, 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_SPFGMR, 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_SPFGMR, 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_SPFGMR, 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 %281

74:                                               ; preds = %59, %54
  %75 = load ptr, ptr %5, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, 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_SPFGMR, 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_SPFGMR, ptr %84, i32 0, i32 21
  %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_SPFGMR, 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_SPFGMR, 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_SPFGMR, 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 %281

97:                                               ; preds = %79
  br label %98

98:                                               ; preds = %97, %74
  %99 = load ptr, ptr %5, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, 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 %122

103:                                              ; preds = %98
  %104 = load ptr, ptr %5, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %104, i32 0, i32 0
  %106 = load i32, ptr %105, align 8, !tbaa !20
  %107 = add nsw i32 %106, 1
  %108 = load ptr, ptr %5, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %108, i32 0, i32 21
  %110 = load ptr, ptr %109, align 8, !tbaa !21
  %111 = call ptr @N_VCloneVectorArray(i32 noundef %107, ptr noundef %110)
  %112 = load ptr, ptr %5, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %112, i32 0, i32 16
  store ptr %111, ptr %113, align 8, !tbaa !22
  %114 = load ptr, ptr %5, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %114, i32 0, i32 16
  %116 = load ptr, ptr %115, align 8, !tbaa !22
  %117 = icmp eq ptr %116, null
  br i1 %117, label %118, label %121

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

121:                                              ; preds = %103
  br label %122

122:                                              ; preds = %121, %98
  %123 = load ptr, ptr %5, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %123, i32 0, i32 17
  %125 = load ptr, ptr %124, align 8, !tbaa !23
  %126 = icmp eq ptr %125, null
  br i1 %126, label %127, label %186

127:                                              ; preds = %122
  %128 = load ptr, ptr %5, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %128, i32 0, i32 0
  %130 = load i32, ptr %129, align 8, !tbaa !20
  %131 = add nsw i32 %130, 1
  %132 = sext i32 %131 to i64
  %133 = mul i64 %132, 8
  %134 = call noalias ptr @malloc(i64 noundef %133) #5
  %135 = load ptr, ptr %5, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %135, i32 0, i32 17
  store ptr %134, ptr %136, align 8, !tbaa !23
  %137 = load ptr, ptr %5, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %137, i32 0, i32 17
  %139 = load ptr, ptr %138, align 8, !tbaa !23
  %140 = icmp eq ptr %139, null
  br i1 %140, label %141, label %144

141:                                              ; preds = %127
  %142 = load ptr, ptr %5, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %142, i32 0, i32 7
  store i32 -803, ptr %143, align 8, !tbaa !16
  store i32 -803, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %281

144:                                              ; preds = %127
  store i32 0, ptr %4, align 4, !tbaa !24
  br label %145

145:                                              ; preds = %182, %144
  %146 = load i32, ptr %4, align 4, !tbaa !24
  %147 = load ptr, ptr %5, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %147, i32 0, i32 0
  %149 = load i32, ptr %148, align 8, !tbaa !20
  %150 = icmp sle i32 %146, %149
  br i1 %150, label %151, label %185

151:                                              ; preds = %145
  %152 = load ptr, ptr %5, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %152, i32 0, i32 17
  %154 = load ptr, ptr %153, align 8, !tbaa !23
  %155 = load i32, ptr %4, align 4, !tbaa !24
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds ptr, ptr %154, i64 %156
  store ptr null, ptr %157, align 8, !tbaa !5
  %158 = load ptr, ptr %5, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %158, i32 0, i32 0
  %160 = load i32, ptr %159, align 8, !tbaa !20
  %161 = sext i32 %160 to i64
  %162 = mul i64 %161, 8
  %163 = call noalias ptr @malloc(i64 noundef %162) #5
  %164 = load ptr, ptr %5, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %164, i32 0, i32 17
  %166 = load ptr, ptr %165, align 8, !tbaa !23
  %167 = load i32, ptr %4, align 4, !tbaa !24
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds ptr, ptr %166, i64 %168
  store ptr %163, ptr %169, align 8, !tbaa !5
  %170 = load ptr, ptr %5, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %170, i32 0, i32 17
  %172 = load ptr, ptr %171, align 8, !tbaa !23
  %173 = load i32, ptr %4, align 4, !tbaa !24
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds ptr, ptr %172, i64 %174
  %176 = load ptr, ptr %175, align 8, !tbaa !5
  %177 = icmp eq ptr %176, null
  br i1 %177, label %178, label %181

178:                                              ; preds = %151
  %179 = load ptr, ptr %5, align 8, !tbaa !5
  %180 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %179, i32 0, i32 7
  store i32 -803, ptr %180, align 8, !tbaa !16
  store i32 -803, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %281

181:                                              ; preds = %151
  br label %182

182:                                              ; preds = %181
  %183 = load i32, ptr %4, align 4, !tbaa !24
  %184 = add nsw i32 %183, 1
  store i32 %184, ptr %4, align 4, !tbaa !24
  br label %145, !llvm.loop !25

185:                                              ; preds = %145
  br label %186

186:                                              ; preds = %185, %122
  %187 = load ptr, ptr %5, align 8, !tbaa !5
  %188 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %187, i32 0, i32 18
  %189 = load ptr, ptr %188, align 8, !tbaa !27
  %190 = icmp eq ptr %189, null
  br i1 %190, label %191, label %209

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

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

208:                                              ; preds = %191
  br label %209

209:                                              ; preds = %208, %186
  %210 = load ptr, ptr %5, align 8, !tbaa !5
  %211 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %210, i32 0, i32 20
  %212 = load ptr, ptr %211, align 8, !tbaa !28
  %213 = icmp eq ptr %212, null
  br i1 %213, label %214, label %232

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

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

231:                                              ; preds = %214
  br label %232

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

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

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

254:                                              ; preds = %237
  br label %255

255:                                              ; preds = %254, %232
  %256 = load ptr, ptr %5, align 8, !tbaa !5
  %257 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %256, i32 0, i32 23
  %258 = load ptr, ptr %257, align 8, !tbaa !30
  %259 = icmp eq ptr %258, null
  br i1 %259, label %260, label %278

260:                                              ; preds = %255
  %261 = load ptr, ptr %5, align 8, !tbaa !5
  %262 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %261, i32 0, i32 0
  %263 = load i32, ptr %262, align 8, !tbaa !20
  %264 = add nsw i32 %263, 1
  %265 = sext i32 %264 to i64
  %266 = mul i64 %265, 8
  %267 = call noalias ptr @malloc(i64 noundef %266) #5
  %268 = load ptr, ptr %5, align 8, !tbaa !5
  %269 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %268, i32 0, i32 23
  store ptr %267, ptr %269, align 8, !tbaa !30
  %270 = load ptr, ptr %5, align 8, !tbaa !5
  %271 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %270, i32 0, i32 23
  %272 = load ptr, ptr %271, align 8, !tbaa !30
  %273 = icmp eq ptr %272, null
  br i1 %273, label %274, label %277

274:                                              ; preds = %260
  %275 = load ptr, ptr %5, align 8, !tbaa !5
  %276 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %275, i32 0, i32 7
  store i32 -803, ptr %276, align 8, !tbaa !16
  store i32 -803, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %281

277:                                              ; preds = %260
  br label %278

278:                                              ; preds = %277, %255
  %279 = load ptr, ptr %5, align 8, !tbaa !5
  %280 = getelementptr inbounds %struct._SUNLinearSolverContent_SPFGMR, ptr %279, i32 0, i32 7
  store i32 0, ptr %280, align 8, !tbaa !16
  store i32 0, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %281

281:                                              ; preds = %278, %274, %251, %228, %205, %178, %141, %118, %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
  %282 = load i32, ptr %2, align 4
  ret i32 %282
}

; 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_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 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 144}
!22 = !{!12, !6, i64 104}
!23 = !{!12, !6, i64 112}
!24 = !{!13, !13, i64 0}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}
!27 = !{!12, !6, i64 120}
!28 = !{!12, !6, i64 136}
!29 = !{!12, !6, i64 152}
!30 = !{!12, !6, i64 160}


; 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_SPFGMR(ptr noundef readonly %0) local_unnamed_addr #0 {
  %2 = icmp eq ptr %0, null
  br i1 %2, label %111, 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 144
  %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 %42

35:                                               ; preds = %31
  %36 = load i32, ptr %4, align 8, !tbaa !18
  %37 = add nsw i32 %36, 1
  %38 = getelementptr inbounds i8, ptr %4, i64 144
  %39 = load ptr, ptr %38, align 8, !tbaa !19
  %40 = tail call ptr @N_VCloneVectorArray(i32 noundef %37, ptr noundef %39) #3
  store ptr %40, ptr %32, align 8, !tbaa !20
  %41 = icmp eq ptr %40, null
  br i1 %41, label %.sink.split, label %42

42:                                               ; preds = %35, %31
  %43 = getelementptr inbounds i8, ptr %4, i64 112
  %44 = load ptr, ptr %43, align 8, !tbaa !21
  %45 = icmp eq ptr %44, null
  br i1 %45, label %46, label %.loopexit

46:                                               ; preds = %42
  %47 = load i32, ptr %4, align 8, !tbaa !18
  %48 = add i32 %47, 1
  %49 = sext i32 %48 to i64
  %50 = shl nsw i64 %49, 3
  %51 = tail call noalias ptr @malloc(i64 noundef %50) #4
  store ptr %51, ptr %43, align 8, !tbaa !21
  %52 = icmp eq ptr %51, null
  br i1 %52, label %.sink.split, label %.preheader

.preheader:                                       ; preds = %46
  %.not7072 = icmp slt i32 %47, 0
  br i1 %.not7072, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader
  %53 = zext nneg i32 %47 to i64
  %54 = shl nuw nsw i64 %53, 3
  %wide.trip.count = zext i32 %48 to i64
  br label %56

55:                                               ; preds = %56
  %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 %56, !llvm.loop !22

56:                                               ; preds = %.lr.ph, %55
  %57 = phi ptr [ %51, %.lr.ph ], [ %62, %55 ]
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %55 ]
  %58 = getelementptr inbounds ptr, ptr %57, i64 %indvars.iv
  store ptr null, ptr %58, align 8, !tbaa !24
  %59 = tail call noalias ptr @malloc(i64 noundef %54) #4
  %60 = load ptr, ptr %43, align 8, !tbaa !21
  %61 = getelementptr inbounds ptr, ptr %60, i64 %indvars.iv
  store ptr %59, ptr %61, align 8, !tbaa !24
  %62 = load ptr, ptr %43, align 8, !tbaa !21
  %63 = getelementptr inbounds ptr, ptr %62, i64 %indvars.iv
  %64 = load ptr, ptr %63, align 8, !tbaa !24
  %65 = icmp eq ptr %64, null
  br i1 %65, label %.sink.split, label %55

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

69:                                               ; preds = %.loopexit
  %70 = load i32, ptr %4, align 8, !tbaa !18
  %71 = shl 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, %.loopexit
  %77 = getelementptr inbounds i8, ptr %4, i64 136
  %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
  %99 = getelementptr inbounds i8, ptr %4, i64 160
  %100 = load ptr, ptr %99, align 8, !tbaa !28
  %101 = icmp eq ptr %100, null
  br i1 %101, label %102, label %109

102:                                              ; preds = %98
  %103 = load i32, ptr %4, align 8, !tbaa !18
  %104 = add nsw i32 %103, 1
  %105 = sext i32 %104 to i64
  %106 = shl nsw i64 %105, 3
  %107 = tail call noalias ptr @malloc(i64 noundef %106) #4
  store ptr %107, ptr %99, align 8, !tbaa !28
  %108 = icmp eq ptr %107, null
  br i1 %108, label %.sink.split, label %109

109:                                              ; preds = %102, %98
  br label %.sink.split

.sink.split:                                      ; preds = %56, %102, %91, %80, %69, %46, %35, %24, %16, %9, %109
  %.sink = phi i32 [ 0, %109 ], [ -804, %9 ], [ -807, %16 ], [ -803, %24 ], [ -803, %35 ], [ -803, %46 ], [ -803, %69 ], [ -803, %80 ], [ -803, %91 ], [ -803, %102 ], [ -803, %56 ]
  %110 = getelementptr inbounds i8, ptr %4, i64 32
  store i32 %.sink, ptr %110, align 8, !tbaa !29
  br label %111

111:                                              ; 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_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 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 144}
!20 = !{!11, !7, i64 104}
!21 = !{!11, !7, i64 112}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!7, !7, i64 0}
!25 = !{!11, !7, i64 120}
!26 = !{!11, !7, i64 136}
!27 = !{!11, !7, i64 152}
!28 = !{!11, !7, i64 160}
!29 = !{!11, !12, i64 32}


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