; LLVM IR from stan-dev/math :: lib/sundials_6.1.1/src/kinsol (kinsol_ls)

; 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.KINMemRec = type { ptr, double, ptr, ptr, double, double, i32, i32, i64, i64, i64, i64, i32, i32, i32, i32, i32, i32, i32, i32, double, double, double, double, double, double, double, double, double, i32, double, i64, i64, i64, i64, i64, i64, i64, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, double, ptr, ptr, ptr, ptr, ptr, double, ptr, ptr, ptr, ptr, i64, i64, i32, ptr, ptr, i32, ptr, ptr, i64, i64, i64, i64, ptr, ptr, ptr, ptr, i32, ptr, double, double, double, double, double, i32, double, double, double, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.KINLsMemRec = type { i32, i32, i32, ptr, ptr, ptr, ptr, double, i64, i64, i64, i64, i64, i64, i64, i32, i32, ptr, ptr, ptr, ptr, i32, ptr, ptr, ptr }

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

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

declare void @N_VScale(double noundef, ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @kinLsBandDQJac(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) #2 {
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca i64, align 8
  %21 = alloca i64, align 8
  %22 = alloca i64, align 8
  %23 = alloca i64, align 8
  %24 = alloca i64, align 8
  %25 = alloca i64, align 8
  %26 = alloca i64, align 8
  %27 = alloca i64, align 8
  %28 = alloca ptr, align 8
  %29 = alloca ptr, align 8
  %30 = alloca ptr, align 8
  %31 = alloca ptr, align 8
  %32 = alloca ptr, align 8
  %33 = alloca ptr, align 8
  %34 = alloca ptr, align 8
  %35 = alloca i32, align 4
  %36 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store ptr %2, ptr %10, align 8, !tbaa !5
  store ptr %3, ptr %11, align 8, !tbaa !5
  store ptr %4, ptr %12, align 8, !tbaa !5
  store ptr %5, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %31) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %32) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %33) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %34) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %35) #4
  store i32 0, ptr %35, align 4, !tbaa !9
  %37 = load ptr, ptr %11, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.KINMemRec, ptr %37, i32 0, i32 79
  %39 = load ptr, ptr %38, align 8, !tbaa !11
  store ptr %39, ptr %34, align 8, !tbaa !5
  %40 = load ptr, ptr %10, align 8, !tbaa !5
  %41 = call i64 @SUNBandMatrix_Columns(ptr noundef %40)
  store i64 %41, ptr %25, align 8, !tbaa !15
  %42 = load ptr, ptr %10, align 8, !tbaa !5
  %43 = call i64 @SUNBandMatrix_UpperBandwidth(ptr noundef %42)
  store i64 %43, ptr %26, align 8, !tbaa !15
  %44 = load ptr, ptr %10, align 8, !tbaa !5
  %45 = call i64 @SUNBandMatrix_LowerBandwidth(ptr noundef %44)
  store i64 %45, ptr %27, align 8, !tbaa !15
  %46 = load ptr, ptr %12, align 8, !tbaa !5
  store ptr %46, ptr %16, align 8, !tbaa !5
  %47 = load ptr, ptr %13, align 8, !tbaa !5
  store ptr %47, ptr %17, align 8, !tbaa !5
  %48 = load ptr, ptr %9, align 8, !tbaa !5
  %49 = call ptr @N_VGetArrayPointer(ptr noundef %48)
  store ptr %49, ptr %29, align 8, !tbaa !5
  %50 = load ptr, ptr %16, align 8, !tbaa !5
  %51 = call ptr @N_VGetArrayPointer(ptr noundef %50)
  store ptr %51, ptr %30, align 8, !tbaa !5
  %52 = load ptr, ptr %8, align 8, !tbaa !5
  %53 = call ptr @N_VGetArrayPointer(ptr noundef %52)
  store ptr %53, ptr %31, align 8, !tbaa !5
  %54 = load ptr, ptr %11, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.KINMemRec, ptr %54, i32 0, i32 42
  %56 = load ptr, ptr %55, align 8, !tbaa !16
  %57 = call ptr @N_VGetArrayPointer(ptr noundef %56)
  store ptr %57, ptr %33, align 8, !tbaa !5
  %58 = load ptr, ptr %17, align 8, !tbaa !5
  %59 = call ptr @N_VGetArrayPointer(ptr noundef %58)
  store ptr %59, ptr %32, align 8, !tbaa !5
  %60 = load ptr, ptr %8, align 8, !tbaa !5
  %61 = load ptr, ptr %17, align 8, !tbaa !5
  call void @N_VScale(double noundef 1.000000e+00, ptr noundef %60, ptr noundef %61)
  %62 = load i64, ptr %27, align 8, !tbaa !15
  %63 = load i64, ptr %26, align 8, !tbaa !15
  %64 = add nsw i64 %62, %63
  %65 = add nsw i64 %64, 1
  store i64 %65, ptr %21, align 8, !tbaa !15
  %66 = load i64, ptr %21, align 8, !tbaa !15
  %67 = load i64, ptr %25, align 8, !tbaa !15
  %68 = icmp slt i64 %66, %67
  br i1 %68, label %69, label %71

69:                                               ; preds = %6
  %70 = load i64, ptr %21, align 8, !tbaa !15
  br label %73

71:                                               ; preds = %6
  %72 = load i64, ptr %25, align 8, !tbaa !15
  br label %73

73:                                               ; preds = %71, %69
  %74 = phi i64 [ %70, %69 ], [ %72, %71 ]
  store i64 %74, ptr %22, align 8, !tbaa !15
  store i64 1, ptr %18, align 8, !tbaa !15
  br label %75

75:                                               ; preds = %250, %73
  %76 = load i64, ptr %18, align 8, !tbaa !15
  %77 = load i64, ptr %22, align 8, !tbaa !15
  %78 = icmp sle i64 %76, %77
  br i1 %78, label %79, label %253

79:                                               ; preds = %75
  %80 = load i64, ptr %18, align 8, !tbaa !15
  %81 = sub nsw i64 %80, 1
  store i64 %81, ptr %20, align 8, !tbaa !15
  br label %82

82:                                               ; preds = %124, %79
  %83 = load i64, ptr %20, align 8, !tbaa !15
  %84 = load i64, ptr %25, align 8, !tbaa !15
  %85 = icmp slt i64 %83, %84
  br i1 %85, label %86, label %128

86:                                               ; preds = %82
  %87 = load ptr, ptr %11, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.KINMemRec, ptr %87, i32 0, i32 22
  %89 = load double, ptr %88, align 8, !tbaa !17
  %90 = load ptr, ptr %31, align 8, !tbaa !5
  %91 = load i64, ptr %20, align 8, !tbaa !15
  %92 = getelementptr inbounds double, ptr %90, i64 %91
  %93 = load double, ptr %92, align 8, !tbaa !18
  %94 = call double @llvm.fabs.f64(double %93)
  %95 = load ptr, ptr %33, align 8, !tbaa !5
  %96 = load i64, ptr %20, align 8, !tbaa !15
  %97 = getelementptr inbounds double, ptr %95, i64 %96
  %98 = load double, ptr %97, align 8, !tbaa !18
  %99 = call double @llvm.fabs.f64(double %98)
  %100 = fdiv double 1.000000e+00, %99
  %101 = fcmp ogt double %94, %100
  br i1 %101, label %102, label %108

102:                                              ; preds = %86
  %103 = load ptr, ptr %31, align 8, !tbaa !5
  %104 = load i64, ptr %20, align 8, !tbaa !15
  %105 = getelementptr inbounds double, ptr %103, i64 %104
  %106 = load double, ptr %105, align 8, !tbaa !18
  %107 = call double @llvm.fabs.f64(double %106)
  br label %115

108:                                              ; preds = %86
  %109 = load ptr, ptr %33, align 8, !tbaa !5
  %110 = load i64, ptr %20, align 8, !tbaa !15
  %111 = getelementptr inbounds double, ptr %109, i64 %110
  %112 = load double, ptr %111, align 8, !tbaa !18
  %113 = call double @llvm.fabs.f64(double %112)
  %114 = fdiv double 1.000000e+00, %113
  br label %115

115:                                              ; preds = %108, %102
  %116 = phi double [ %107, %102 ], [ %114, %108 ]
  %117 = fmul double %89, %116
  store double %117, ptr %14, align 8, !tbaa !18
  %118 = load double, ptr %14, align 8, !tbaa !18
  %119 = load ptr, ptr %32, align 8, !tbaa !5
  %120 = load i64, ptr %20, align 8, !tbaa !15
  %121 = getelementptr inbounds double, ptr %119, i64 %120
  %122 = load double, ptr %121, align 8, !tbaa !18
  %123 = fadd double %122, %118
  store double %123, ptr %121, align 8, !tbaa !18
  br label %124

124:                                              ; preds = %115
  %125 = load i64, ptr %21, align 8, !tbaa !15
  %126 = load i64, ptr %20, align 8, !tbaa !15
  %127 = add nsw i64 %126, %125
  store i64 %127, ptr %20, align 8, !tbaa !15
  br label %82, !llvm.loop !19

128:                                              ; preds = %82
  %129 = load ptr, ptr %11, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.KINMemRec, ptr %129, i32 0, i32 2
  %131 = load ptr, ptr %130, align 8, !tbaa !21
  %132 = load ptr, ptr %17, align 8, !tbaa !5
  %133 = load ptr, ptr %16, align 8, !tbaa !5
  %134 = load ptr, ptr %11, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.KINMemRec, ptr %134, i32 0, i32 3
  %136 = load ptr, ptr %135, align 8, !tbaa !22
  %137 = call i32 %131(ptr noundef %132, ptr noundef %133, ptr noundef %136)
  store i32 %137, ptr %35, align 4, !tbaa !9
  %138 = load i32, ptr %35, align 4, !tbaa !9
  %139 = icmp ne i32 %138, 0
  br i1 %139, label %140, label %142

140:                                              ; preds = %128
  %141 = load i32, ptr %35, align 4, !tbaa !9
  store i32 %141, ptr %7, align 4
  store i32 1, ptr %36, align 4
  br label %259

142:                                              ; preds = %128
  %143 = load i64, ptr %18, align 8, !tbaa !15
  %144 = sub nsw i64 %143, 1
  store i64 %144, ptr %20, align 8, !tbaa !15
  br label %145

145:                                              ; preds = %245, %142
  %146 = load i64, ptr %20, align 8, !tbaa !15
  %147 = load i64, ptr %25, align 8, !tbaa !15
  %148 = icmp slt i64 %146, %147
  br i1 %148, label %149, label %249

149:                                              ; preds = %145
  %150 = load ptr, ptr %31, align 8, !tbaa !5
  %151 = load i64, ptr %20, align 8, !tbaa !15
  %152 = getelementptr inbounds double, ptr %150, i64 %151
  %153 = load double, ptr %152, align 8, !tbaa !18
  %154 = load ptr, ptr %32, align 8, !tbaa !5
  %155 = load i64, ptr %20, align 8, !tbaa !15
  %156 = getelementptr inbounds double, ptr %154, i64 %155
  store double %153, ptr %156, align 8, !tbaa !18
  %157 = load ptr, ptr %10, align 8, !tbaa !5
  %158 = load i64, ptr %20, align 8, !tbaa !15
  %159 = call ptr @SUNBandMatrix_Column(ptr noundef %157, i64 noundef %158)
  store ptr %159, ptr %28, align 8, !tbaa !5
  %160 = load ptr, ptr %11, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.KINMemRec, ptr %160, i32 0, i32 22
  %162 = load double, ptr %161, align 8, !tbaa !17
  %163 = load ptr, ptr %31, align 8, !tbaa !5
  %164 = load i64, ptr %20, align 8, !tbaa !15
  %165 = getelementptr inbounds double, ptr %163, i64 %164
  %166 = load double, ptr %165, align 8, !tbaa !18
  %167 = call double @llvm.fabs.f64(double %166)
  %168 = load ptr, ptr %33, align 8, !tbaa !5
  %169 = load i64, ptr %20, align 8, !tbaa !15
  %170 = getelementptr inbounds double, ptr %168, i64 %169
  %171 = load double, ptr %170, align 8, !tbaa !18
  %172 = call double @llvm.fabs.f64(double %171)
  %173 = fdiv double 1.000000e+00, %172
  %174 = fcmp ogt double %167, %173
  br i1 %174, label %175, label %181

175:                                              ; preds = %149
  %176 = load ptr, ptr %31, align 8, !tbaa !5
  %177 = load i64, ptr %20, align 8, !tbaa !15
  %178 = getelementptr inbounds double, ptr %176, i64 %177
  %179 = load double, ptr %178, align 8, !tbaa !18
  %180 = call double @llvm.fabs.f64(double %179)
  br label %188

181:                                              ; preds = %149
  %182 = load ptr, ptr %33, align 8, !tbaa !5
  %183 = load i64, ptr %20, align 8, !tbaa !15
  %184 = getelementptr inbounds double, ptr %182, i64 %183
  %185 = load double, ptr %184, align 8, !tbaa !18
  %186 = call double @llvm.fabs.f64(double %185)
  %187 = fdiv double 1.000000e+00, %186
  br label %188

188:                                              ; preds = %181, %175
  %189 = phi double [ %180, %175 ], [ %187, %181 ]
  %190 = fmul double %162, %189
  store double %190, ptr %14, align 8, !tbaa !18
  %191 = load double, ptr %14, align 8, !tbaa !18
  %192 = fdiv double 1.000000e+00, %191
  store double %192, ptr %15, align 8, !tbaa !18
  %193 = load i64, ptr %20, align 8, !tbaa !15
  %194 = load i64, ptr %26, align 8, !tbaa !15
  %195 = sub nsw i64 %193, %194
  %196 = icmp sgt i64 0, %195
  br i1 %196, label %197, label %198

197:                                              ; preds = %188
  br label %202

198:                                              ; preds = %188
  %199 = load i64, ptr %20, align 8, !tbaa !15
  %200 = load i64, ptr %26, align 8, !tbaa !15
  %201 = sub nsw i64 %199, %200
  br label %202

202:                                              ; preds = %198, %197
  %203 = phi i64 [ 0, %197 ], [ %201, %198 ]
  store i64 %203, ptr %23, align 8, !tbaa !15
  %204 = load i64, ptr %20, align 8, !tbaa !15
  %205 = load i64, ptr %27, align 8, !tbaa !15
  %206 = add nsw i64 %204, %205
  %207 = load i64, ptr %25, align 8, !tbaa !15
  %208 = sub nsw i64 %207, 1
  %209 = icmp slt i64 %206, %208
  br i1 %209, label %210, label %214

210:                                              ; preds = %202
  %211 = load i64, ptr %20, align 8, !tbaa !15
  %212 = load i64, ptr %27, align 8, !tbaa !15
  %213 = add nsw i64 %211, %212
  br label %217

214:                                              ; preds = %202
  %215 = load i64, ptr %25, align 8, !tbaa !15
  %216 = sub nsw i64 %215, 1
  br label %217

217:                                              ; preds = %214, %210
  %218 = phi i64 [ %213, %210 ], [ %216, %214 ]
  store i64 %218, ptr %24, align 8, !tbaa !15
  %219 = load i64, ptr %23, align 8, !tbaa !15
  store i64 %219, ptr %19, align 8, !tbaa !15
  br label %220

220:                                              ; preds = %241, %217
  %221 = load i64, ptr %19, align 8, !tbaa !15
  %222 = load i64, ptr %24, align 8, !tbaa !15
  %223 = icmp sle i64 %221, %222
  br i1 %223, label %224, label %244

224:                                              ; preds = %220
  %225 = load double, ptr %15, align 8, !tbaa !18
  %226 = load ptr, ptr %30, align 8, !tbaa !5
  %227 = load i64, ptr %19, align 8, !tbaa !15
  %228 = getelementptr inbounds double, ptr %226, i64 %227
  %229 = load double, ptr %228, align 8, !tbaa !18
  %230 = load ptr, ptr %29, align 8, !tbaa !5
  %231 = load i64, ptr %19, align 8, !tbaa !15
  %232 = getelementptr inbounds double, ptr %230, i64 %231
  %233 = load double, ptr %232, align 8, !tbaa !18
  %234 = fsub double %229, %233
  %235 = fmul double %225, %234
  %236 = load ptr, ptr %28, align 8, !tbaa !5
  %237 = load i64, ptr %19, align 8, !tbaa !15
  %238 = load i64, ptr %20, align 8, !tbaa !15
  %239 = sub nsw i64 %237, %238
  %240 = getelementptr inbounds double, ptr %236, i64 %239
  store double %235, ptr %240, align 8, !tbaa !18
  br label %241

241:                                              ; preds = %224
  %242 = load i64, ptr %19, align 8, !tbaa !15
  %243 = add nsw i64 %242, 1
  store i64 %243, ptr %19, align 8, !tbaa !15
  br label %220, !llvm.loop !23

244:                                              ; preds = %220
  br label %245

245:                                              ; preds = %244
  %246 = load i64, ptr %21, align 8, !tbaa !15
  %247 = load i64, ptr %20, align 8, !tbaa !15
  %248 = add nsw i64 %247, %246
  store i64 %248, ptr %20, align 8, !tbaa !15
  br label %145, !llvm.loop !24

249:                                              ; preds = %145
  br label %250

250:                                              ; preds = %249
  %251 = load i64, ptr %18, align 8, !tbaa !15
  %252 = add nsw i64 %251, 1
  store i64 %252, ptr %18, align 8, !tbaa !15
  br label %75, !llvm.loop !25

253:                                              ; preds = %75
  %254 = load i64, ptr %22, align 8, !tbaa !15
  %255 = load ptr, ptr %34, align 8, !tbaa !5
  %256 = getelementptr inbounds %struct.KINLsMemRec, ptr %255, i32 0, i32 9
  %257 = load i64, ptr %256, align 8, !tbaa !26
  %258 = add nsw i64 %257, %254
  store i64 %258, ptr %256, align 8, !tbaa !26
  store i32 0, ptr %7, align 4
  store i32 1, ptr %36, align 4
  br label %259

259:                                              ; preds = %253, %140
  call void @llvm.lifetime.end.p0(i64 4, ptr %35) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %34) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %33) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %32) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %31) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  %260 = load i32, ptr %7, align 4
  ret i32 %260
}

declare ptr @N_VGetArrayPointer(ptr noundef) #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #3

declare i64 @SUNBandMatrix_Columns(ptr noundef) #1

declare i64 @SUNBandMatrix_UpperBandwidth(ptr noundef) #1

declare i64 @SUNBandMatrix_LowerBandwidth(ptr noundef) #1

declare ptr @SUNBandMatrix_Column(ptr noundef, i64 noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 584}
!12 = !{!"KINMemRec", !6, i64 0, !13, i64 8, !6, i64 16, !6, i64 24, !13, i64 32, !13, i64 40, !10, i64 48, !10, i64 52, !14, i64 56, !14, i64 64, !14, i64 72, !14, i64 80, !10, i64 88, !10, i64 92, !10, i64 96, !10, i64 100, !10, i64 104, !10, i64 108, !10, i64 112, !10, i64 116, !13, i64 120, !13, i64 128, !13, i64 136, !13, i64 144, !13, i64 152, !13, i64 160, !13, i64 168, !13, i64 176, !13, i64 184, !10, i64 192, !13, i64 200, !14, i64 208, !14, i64 216, !14, i64 224, !14, i64 232, !14, i64 240, !14, i64 248, !14, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !6, i64 296, !6, i64 304, !6, i64 312, !6, i64 320, !6, i64 328, !6, i64 336, !6, i64 344, !10, i64 352, !10, i64 356, !13, i64 360, !6, i64 368, !6, i64 376, !6, i64 384, !6, i64 392, !6, i64 400, !13, i64 408, !6, i64 416, !6, i64 424, !6, i64 432, !6, i64 440, !14, i64 448, !14, i64 456, !10, i64 464, !6, i64 472, !6, i64 480, !10, i64 488, !6, i64 496, !6, i64 504, !14, i64 512, !14, i64 520, !14, i64 528, !14, i64 536, !6, i64 544, !6, i64 552, !6, i64 560, !6, i64 568, !10, i64 576, !6, i64 584, !13, i64 592, !13, i64 600, !13, i64 608, !13, i64 616, !13, i64 624, !10, i64 632, !13, i64 640, !13, i64 648, !13, i64 656, !10, i64 664, !6, i64 672, !6, i64 680, !6, i64 688, !6, i64 696, !6, i64 704, !6, i64 712, !6, i64 720}
!13 = !{!"double", !7, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!14, !14, i64 0}
!16 = !{!12, !6, i64 296}
!17 = !{!12, !13, i64 136}
!18 = !{!13, !13, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!12, !6, i64 16}
!22 = !{!12, !6, i64 24}
!23 = distinct !{!23, !20}
!24 = distinct !{!24, !20}
!25 = distinct !{!25, !20}
!26 = !{!27, !14, i64 64}
!27 = !{!"KINLsMemRec", !10, i64 0, !10, i64 4, !10, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !13, i64 48, !14, i64 56, !14, i64 64, !14, i64 72, !14, i64 80, !14, i64 88, !14, i64 96, !14, i64 104, !10, i64 112, !10, i64 116, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !10, i64 152, !6, i64 160, !6, i64 168, !6, i64 176}


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

declare void @N_VScale(double noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local i32 @kinLsBandDQJac(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr nocapture noundef readonly %3, ptr noundef %4, ptr noundef %5) local_unnamed_addr #1 {
  %7 = getelementptr inbounds i8, ptr %3, i64 584
  %8 = load ptr, ptr %7, align 8, !tbaa !5
  %9 = tail call i64 @SUNBandMatrix_Columns(ptr noundef %2) #4
  %10 = tail call i64 @SUNBandMatrix_UpperBandwidth(ptr noundef %2) #4
  %11 = tail call i64 @SUNBandMatrix_LowerBandwidth(ptr noundef %2) #4
  %12 = tail call ptr @N_VGetArrayPointer(ptr noundef %1) #4
  %13 = tail call ptr @N_VGetArrayPointer(ptr noundef %4) #4
  %14 = tail call ptr @N_VGetArrayPointer(ptr noundef %0) #4
  %15 = getelementptr inbounds i8, ptr %3, i64 296
  %16 = load ptr, ptr %15, align 8, !tbaa !13
  %17 = tail call ptr @N_VGetArrayPointer(ptr noundef %16) #4
  %18 = tail call ptr @N_VGetArrayPointer(ptr noundef %5) #4
  tail call void @N_VScale(double noundef 1.000000e+00, ptr noundef %0, ptr noundef %5) #4
  %19 = add i64 %10, 1
  %20 = add i64 %19, %11
  %21 = tail call i64 @llvm.smin.i64(i64 %20, i64 %9)
  %.not114 = icmp slt i64 %21, 1
  br i1 %.not114, label %._crit_edge118, label %.lr.ph117

.lr.ph117:                                        ; preds = %6
  %22 = ptrtoint ptr %13 to i64
  %23 = ptrtoint ptr %12 to i64
  %24 = getelementptr inbounds i8, ptr %3, i64 136
  %25 = getelementptr inbounds i8, ptr %3, i64 16
  %26 = getelementptr inbounds i8, ptr %3, i64 24
  %27 = add nsw i64 %9, -1
  %28 = xor i64 %10, -1
  %29 = sub i64 %28, %11
  %30 = shl i64 %29, 3
  br label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %._crit_edge113, %.lr.ph117
  %indvar = phi i64 [ %indvar.next, %._crit_edge113 ], [ 0, %.lr.ph117 ]
  %.090115 = phi i64 [ %107, %._crit_edge113 ], [ 1, %.lr.ph117 ]
  %31 = add i64 %11, %indvar
  %32 = sub i64 %indvar, %10
  %33 = mul i64 %indvar, -8
  %34 = sub i64 %33, %22
  %35 = sub i64 %33, %23
  %36 = add nsw i64 %.090115, -1
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %.092105 = phi i64 [ %50, %.lr.ph ], [ %36, %.lr.ph.preheader ]
  %37 = load double, ptr %24, align 8, !tbaa !14
  %38 = getelementptr inbounds double, ptr %14, i64 %.092105
  %39 = load double, ptr %38, align 8, !tbaa !15
  %40 = tail call double @llvm.fabs.f64(double %39)
  %41 = getelementptr inbounds double, ptr %17, i64 %.092105
  %42 = load double, ptr %41, align 8, !tbaa !15
  %43 = tail call double @llvm.fabs.f64(double %42)
  %44 = fdiv double 1.000000e+00, %43
  %45 = fcmp ogt double %40, %44
  %. = select i1 %45, double %40, double %44
  %46 = fmul double %37, %.
  %47 = getelementptr inbounds double, ptr %18, i64 %.092105
  %48 = load double, ptr %47, align 8, !tbaa !15
  %49 = fadd double %48, %46
  store double %49, ptr %47, align 8, !tbaa !15
  %50 = add nsw i64 %.092105, %20
  %51 = icmp slt i64 %50, %9
  br i1 %51, label %.lr.ph, label %._crit_edge, !llvm.loop !16

._crit_edge:                                      ; preds = %.lr.ph
  %52 = load ptr, ptr %25, align 8, !tbaa !18
  %53 = load ptr, ptr %26, align 8, !tbaa !19
  %54 = tail call i32 %52(ptr noundef %5, ptr noundef %4, ptr noundef %53) #4
  %.not102 = icmp eq i32 %54, 0
  br i1 %.not102, label %.lr.ph112, label %.loopexit

.lr.ph112:                                        ; preds = %._crit_edge, %._crit_edge110
  %indvar124 = phi i64 [ %indvar.next125, %._crit_edge110 ], [ 0, %._crit_edge ]
  %.1111 = phi i64 [ %105, %._crit_edge110 ], [ %36, %._crit_edge ]
  %55 = mul i64 %20, %indvar124
  %56 = add i64 %31, %55
  %smin = tail call i64 @llvm.smin.i64(i64 %56, i64 %27)
  %57 = add i64 %smin, 1
  %58 = add i64 %32, %55
  %smax = tail call i64 @llvm.smax.i64(i64 %58, i64 0)
  %59 = sub i64 %57, %smax
  %60 = mul i64 %30, %indvar124
  %61 = add i64 %34, %60
  %62 = add i64 %35, %60
  %63 = getelementptr inbounds double, ptr %14, i64 %.1111
  %64 = load double, ptr %63, align 8, !tbaa !15
  %65 = getelementptr inbounds double, ptr %18, i64 %.1111
  store double %64, ptr %65, align 8, !tbaa !15
  %66 = tail call ptr @SUNBandMatrix_Column(ptr noundef %2, i64 noundef %.1111) #4
  %67 = ptrtoint ptr %66 to i64
  %68 = load double, ptr %24, align 8, !tbaa !14
  %69 = load double, ptr %63, align 8, !tbaa !15
  %70 = tail call double @llvm.fabs.f64(double %69)
  %71 = getelementptr inbounds double, ptr %17, i64 %.1111
  %72 = load double, ptr %71, align 8, !tbaa !15
  %73 = tail call double @llvm.fabs.f64(double %72)
  %74 = fdiv double 1.000000e+00, %73
  %75 = fcmp ogt double %70, %74
  %.104 = select i1 %75, double %70, double %74
  %76 = fmul double %68, %.104
  %77 = fdiv double 1.000000e+00, %76
  %78 = sub nsw i64 %.1111, %10
  %79 = tail call i64 @llvm.smax.i64(i64 %78, i64 0)
  %80 = add nsw i64 %.1111, %11
  %81 = tail call i64 @llvm.smin.i64(i64 %80, i64 %27)
  %.not103106 = icmp sgt i64 %79, %81
  br i1 %.not103106, label %._crit_edge110, label %.lr.ph109.preheader

.lr.ph109.preheader:                              ; preds = %.lr.ph112
  %min.iters.check = icmp ult i64 %59, 4
  br i1 %min.iters.check, label %.lr.ph109.preheader130, label %vector.memcheck

vector.memcheck:                                  ; preds = %.lr.ph109.preheader
  %82 = add i64 %61, %67
  %diff.check = icmp ult i64 %82, 32
  %83 = add i64 %62, %67
  %diff.check126 = icmp ult i64 %83, 32
  %conflict.rdx = or i1 %diff.check, %diff.check126
  br i1 %conflict.rdx, label %.lr.ph109.preheader130, label %vector.ph

vector.ph:                                        ; preds = %vector.memcheck
  %n.vec = and i64 %59, -4
  %ind.end = add i64 %79, %n.vec
  %broadcast.splatinsert = insertelement <2 x double> poison, double %77, i64 0
  %broadcast.splat = shufflevector <2 x double> %broadcast.splatinsert, <2 x double> poison, <2 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %offset.idx = add i64 %79, %index
  %84 = getelementptr inbounds double, ptr %13, i64 %offset.idx
  %85 = getelementptr inbounds i8, ptr %84, i64 16
  %wide.load = load <2 x double>, ptr %84, align 8, !tbaa !15
  %wide.load127 = load <2 x double>, ptr %85, align 8, !tbaa !15
  %86 = getelementptr inbounds double, ptr %12, i64 %offset.idx
  %87 = getelementptr inbounds i8, ptr %86, i64 16
  %wide.load128 = load <2 x double>, ptr %86, align 8, !tbaa !15
  %wide.load129 = load <2 x double>, ptr %87, align 8, !tbaa !15
  %88 = fsub <2 x double> %wide.load, %wide.load128
  %89 = fsub <2 x double> %wide.load127, %wide.load129
  %90 = fmul <2 x double> %broadcast.splat, %88
  %91 = fmul <2 x double> %broadcast.splat, %89
  %92 = sub nsw i64 %offset.idx, %.1111
  %93 = getelementptr inbounds double, ptr %66, i64 %92
  %94 = getelementptr inbounds i8, ptr %93, i64 16
  store <2 x double> %90, ptr %93, align 8, !tbaa !15
  store <2 x double> %91, ptr %94, align 8, !tbaa !15
  %index.next = add nuw i64 %index, 4
  %95 = icmp eq i64 %index.next, %n.vec
  br i1 %95, label %middle.block, label %vector.body, !llvm.loop !20

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %59, %n.vec
  br i1 %cmp.n, label %._crit_edge110, label %.lr.ph109.preheader130

.lr.ph109.preheader130:                           ; preds = %middle.block, %vector.memcheck, %.lr.ph109.preheader
  %.091107.ph = phi i64 [ %79, %vector.memcheck ], [ %79, %.lr.ph109.preheader ], [ %ind.end, %middle.block ]
  br label %.lr.ph109

.lr.ph109:                                        ; preds = %.lr.ph109.preheader130, %.lr.ph109
  %.091107 = phi i64 [ %104, %.lr.ph109 ], [ %.091107.ph, %.lr.ph109.preheader130 ]
  %96 = getelementptr inbounds double, ptr %13, i64 %.091107
  %97 = load double, ptr %96, align 8, !tbaa !15
  %98 = getelementptr inbounds double, ptr %12, i64 %.091107
  %99 = load double, ptr %98, align 8, !tbaa !15
  %100 = fsub double %97, %99
  %101 = fmul double %77, %100
  %102 = sub nsw i64 %.091107, %.1111
  %103 = getelementptr inbounds double, ptr %66, i64 %102
  store double %101, ptr %103, align 8, !tbaa !15
  %104 = add nuw nsw i64 %.091107, 1
  %.not103.not = icmp slt i64 %.091107, %81
  br i1 %.not103.not, label %.lr.ph109, label %._crit_edge110, !llvm.loop !23

._crit_edge110:                                   ; preds = %.lr.ph109, %middle.block, %.lr.ph112
  %105 = add nsw i64 %.1111, %20
  %106 = icmp slt i64 %105, %9
  %indvar.next125 = add i64 %indvar124, 1
  br i1 %106, label %.lr.ph112, label %._crit_edge113, !llvm.loop !24

._crit_edge113:                                   ; preds = %._crit_edge110
  %107 = add nuw i64 %.090115, 1
  %exitcond.not = icmp eq i64 %.090115, %21
  %indvar.next = add i64 %indvar, 1
  br i1 %exitcond.not, label %._crit_edge118, label %.lr.ph.preheader, !llvm.loop !25

._crit_edge118:                                   ; preds = %._crit_edge113, %6
  %108 = getelementptr inbounds i8, ptr %8, i64 64
  %109 = load i64, ptr %108, align 8, !tbaa !26
  %110 = add nsw i64 %109, %21
  store i64 %110, ptr %108, align 8, !tbaa !26
  br label %.loopexit

.loopexit:                                        ; preds = %._crit_edge, %._crit_edge118
  %.0 = phi i32 [ 0, %._crit_edge118 ], [ %54, %._crit_edge ]
  ret i32 %.0
}

declare ptr @N_VGetArrayPointer(ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #2

declare i64 @SUNBandMatrix_Columns(ptr noundef) local_unnamed_addr #0

declare i64 @SUNBandMatrix_UpperBandwidth(ptr noundef) local_unnamed_addr #0

declare i64 @SUNBandMatrix_LowerBandwidth(ptr noundef) local_unnamed_addr #0

declare ptr @SUNBandMatrix_Column(ptr noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #3

attributes #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 = { 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !7, i64 584}
!6 = !{!"KINMemRec", !7, i64 0, !10, i64 8, !7, i64 16, !7, i64 24, !10, i64 32, !10, i64 40, !11, i64 48, !11, i64 52, !12, i64 56, !12, i64 64, !12, i64 72, !12, i64 80, !11, i64 88, !11, i64 92, !11, i64 96, !11, i64 100, !11, i64 104, !11, i64 108, !11, i64 112, !11, i64 116, !10, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !10, i64 168, !10, i64 176, !10, i64 184, !11, i64 192, !10, i64 200, !12, i64 208, !12, i64 216, !12, i64 224, !12, i64 232, !12, i64 240, !12, i64 248, !12, i64 256, !7, i64 264, !7, i64 272, !7, i64 280, !7, i64 288, !7, i64 296, !7, i64 304, !7, i64 312, !7, i64 320, !7, i64 328, !7, i64 336, !7, i64 344, !11, i64 352, !11, i64 356, !10, i64 360, !7, i64 368, !7, i64 376, !7, i64 384, !7, i64 392, !7, i64 400, !10, i64 408, !7, i64 416, !7, i64 424, !7, i64 432, !7, i64 440, !12, i64 448, !12, i64 456, !11, i64 464, !7, i64 472, !7, i64 480, !11, i64 488, !7, i64 496, !7, i64 504, !12, i64 512, !12, i64 520, !12, i64 528, !12, i64 536, !7, i64 544, !7, i64 552, !7, i64 560, !7, i64 568, !11, i64 576, !7, i64 584, !10, i64 592, !10, i64 600, !10, i64 608, !10, i64 616, !10, i64 624, !11, i64 632, !10, i64 640, !10, i64 648, !10, i64 656, !11, i64 664, !7, i64 672, !7, i64 680, !7, i64 688, !7, i64 696, !7, i64 704, !7, i64 712, !7, i64 720}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"double", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!"long", !8, i64 0}
!13 = !{!6, !7, i64 296}
!14 = !{!6, !10, i64 136}
!15 = !{!10, !10, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!6, !7, i64 16}
!19 = !{!6, !7, i64 24}
!20 = distinct !{!20, !17, !21, !22}
!21 = !{!"llvm.loop.isvectorized", i32 1}
!22 = !{!"llvm.loop.unroll.runtime.disable"}
!23 = distinct !{!23, !17, !21}
!24 = distinct !{!24, !17}
!25 = distinct !{!25, !17}
!26 = !{!27, !12, i64 64}
!27 = !{!"KINLsMemRec", !11, i64 0, !11, i64 4, !11, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !10, i64 48, !12, i64 56, !12, i64 64, !12, i64 72, !12, i64 80, !12, i64 88, !12, i64 96, !12, i64 104, !11, i64 112, !11, i64 116, !7, i64 120, !7, i64 128, !7, i64 136, !7, i64 144, !11, i64 152, !7, i64 160, !7, i64 168, !7, i64 176}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass