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

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

@stdout = external global ptr, align 8

; Function Attrs: nounwind uwtable
define dso_local ptr @SUNLinSol_PCG(ptr noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %3) #0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  store i32 %2, ptr %8, align 4, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %13 = load i32, ptr %7, align 4, !tbaa !9
  %14 = icmp ne i32 %13, 0
  br i1 %14, label %15, label %25

15:                                               ; preds = %4
  %16 = load i32, ptr %7, align 4, !tbaa !9
  %17 = icmp ne i32 %16, 1
  br i1 %17, label %18, label %25

18:                                               ; preds = %15
  %19 = load i32, ptr %7, align 4, !tbaa !9
  %20 = icmp ne i32 %19, 2
  br i1 %20, label %21, label %25

21:                                               ; preds = %18
  %22 = load i32, ptr %7, align 4, !tbaa !9
  %23 = icmp ne i32 %22, 3
  br i1 %23, label %24, label %25

24:                                               ; preds = %21
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %25

25:                                               ; preds = %24, %21, %18, %15, %4
  %26 = load i32, ptr %8, align 4, !tbaa !9
  %27 = icmp sle i32 %26, 0
  br i1 %27, label %28, label %29

28:                                               ; preds = %25
  store i32 5, ptr %8, align 4, !tbaa !9
  br label %29

29:                                               ; preds = %28, %25
  store ptr null, ptr %10, align 8, !tbaa !5
  %30 = load ptr, ptr %9, align 8, !tbaa !5
  %31 = call ptr @SUNLinSolNewEmpty(ptr noundef %30)
  store ptr %31, ptr %10, align 8, !tbaa !5
  %32 = load ptr, ptr %10, align 8, !tbaa !5
  %33 = icmp eq ptr %32, null
  br i1 %33, label %34, label %35

34:                                               ; preds = %29
  store ptr null, ptr %5, align 8
  store i32 1, ptr %12, align 4
  br label %194

35:                                               ; preds = %29
  %36 = load ptr, ptr %10, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %36, i32 0, i32 1
  %38 = load ptr, ptr %37, align 8, !tbaa !11
  %39 = getelementptr inbounds %struct._generic_SUNLinearSolver_Ops, ptr %38, i32 0, i32 0
  store ptr @SUNLinSolGetType_PCG, ptr %39, align 8, !tbaa !13
  %40 = load ptr, ptr %10, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %40, i32 0, i32 1
  %42 = load ptr, ptr %41, align 8, !tbaa !11
  %43 = getelementptr inbounds %struct._generic_SUNLinearSolver_Ops, ptr %42, i32 0, i32 1
  store ptr @SUNLinSolGetID_PCG, ptr %43, align 8, !tbaa !15
  %44 = load ptr, ptr %10, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %44, i32 0, i32 1
  %46 = load ptr, ptr %45, align 8, !tbaa !11
  %47 = getelementptr inbounds %struct._generic_SUNLinearSolver_Ops, ptr %46, i32 0, i32 2
  store ptr @SUNLinSolSetATimes_PCG, ptr %47, align 8, !tbaa !16
  %48 = load ptr, ptr %10, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %48, i32 0, i32 1
  %50 = load ptr, ptr %49, align 8, !tbaa !11
  %51 = getelementptr inbounds %struct._generic_SUNLinearSolver_Ops, ptr %50, i32 0, i32 3
  store ptr @SUNLinSolSetPreconditioner_PCG, ptr %51, align 8, !tbaa !17
  %52 = load ptr, ptr %10, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %52, i32 0, i32 1
  %54 = load ptr, ptr %53, align 8, !tbaa !11
  %55 = getelementptr inbounds %struct._generic_SUNLinearSolver_Ops, ptr %54, i32 0, i32 4
  store ptr @SUNLinSolSetScalingVectors_PCG, ptr %55, align 8, !tbaa !18
  %56 = load ptr, ptr %10, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %56, i32 0, i32 1
  %58 = load ptr, ptr %57, align 8, !tbaa !11
  %59 = getelementptr inbounds %struct._generic_SUNLinearSolver_Ops, ptr %58, i32 0, i32 5
  store ptr @SUNLinSolSetZeroGuess_PCG, ptr %59, align 8, !tbaa !19
  %60 = load ptr, ptr %10, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %60, i32 0, i32 1
  %62 = load ptr, ptr %61, align 8, !tbaa !11
  %63 = getelementptr inbounds %struct._generic_SUNLinearSolver_Ops, ptr %62, i32 0, i32 6
  store ptr @SUNLinSolInitialize_PCG, ptr %63, align 8, !tbaa !20
  %64 = load ptr, ptr %10, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %64, i32 0, i32 1
  %66 = load ptr, ptr %65, align 8, !tbaa !11
  %67 = getelementptr inbounds %struct._generic_SUNLinearSolver_Ops, ptr %66, i32 0, i32 7
  store ptr @SUNLinSolSetup_PCG, ptr %67, align 8, !tbaa !21
  %68 = load ptr, ptr %10, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %68, i32 0, i32 1
  %70 = load ptr, ptr %69, align 8, !tbaa !11
  %71 = getelementptr inbounds %struct._generic_SUNLinearSolver_Ops, ptr %70, i32 0, i32 8
  store ptr @SUNLinSolSolve_PCG, ptr %71, align 8, !tbaa !22
  %72 = load ptr, ptr %10, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %72, i32 0, i32 1
  %74 = load ptr, ptr %73, align 8, !tbaa !11
  %75 = getelementptr inbounds %struct._generic_SUNLinearSolver_Ops, ptr %74, i32 0, i32 9
  store ptr @SUNLinSolNumIters_PCG, ptr %75, align 8, !tbaa !23
  %76 = load ptr, ptr %10, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %76, i32 0, i32 1
  %78 = load ptr, ptr %77, align 8, !tbaa !11
  %79 = getelementptr inbounds %struct._generic_SUNLinearSolver_Ops, ptr %78, i32 0, i32 10
  store ptr @SUNLinSolResNorm_PCG, ptr %79, align 8, !tbaa !24
  %80 = load ptr, ptr %10, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %80, i32 0, i32 1
  %82 = load ptr, ptr %81, align 8, !tbaa !11
  %83 = getelementptr inbounds %struct._generic_SUNLinearSolver_Ops, ptr %82, i32 0, i32 13
  store ptr @SUNLinSolResid_PCG, ptr %83, align 8, !tbaa !25
  %84 = load ptr, ptr %10, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %84, i32 0, i32 1
  %86 = load ptr, ptr %85, align 8, !tbaa !11
  %87 = getelementptr inbounds %struct._generic_SUNLinearSolver_Ops, ptr %86, i32 0, i32 11
  store ptr @SUNLinSolLastFlag_PCG, ptr %87, align 8, !tbaa !26
  %88 = load ptr, ptr %10, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %88, i32 0, i32 1
  %90 = load ptr, ptr %89, align 8, !tbaa !11
  %91 = getelementptr inbounds %struct._generic_SUNLinearSolver_Ops, ptr %90, i32 0, i32 12
  store ptr @SUNLinSolSpace_PCG, ptr %91, align 8, !tbaa !27
  %92 = load ptr, ptr %10, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %92, i32 0, i32 1
  %94 = load ptr, ptr %93, align 8, !tbaa !11
  %95 = getelementptr inbounds %struct._generic_SUNLinearSolver_Ops, ptr %94, i32 0, i32 14
  store ptr @SUNLinSolFree_PCG, ptr %95, align 8, !tbaa !28
  store ptr null, ptr %11, align 8, !tbaa !5
  %96 = call noalias ptr @malloc(i64 noundef 128) #5
  store ptr %96, ptr %11, align 8, !tbaa !5
  %97 = load ptr, ptr %11, align 8, !tbaa !5
  %98 = icmp eq ptr %97, null
  br i1 %98, label %99, label %102

99:                                               ; preds = %35
  %100 = load ptr, ptr %10, align 8, !tbaa !5
  %101 = call i32 @SUNLinSolFree(ptr noundef %100)
  store ptr null, ptr %5, align 8
  store i32 1, ptr %12, align 4
  br label %194

102:                                              ; preds = %35
  %103 = load ptr, ptr %11, align 8, !tbaa !5
  %104 = load ptr, ptr %10, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct._generic_SUNLinearSolver, ptr %104, i32 0, i32 0
  store ptr %103, ptr %105, align 8, !tbaa !29
  %106 = load ptr, ptr %11, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct._SUNLinearSolverContent_PCG, ptr %106, i32 0, i32 5
  store i32 0, ptr %107, align 8, !tbaa !30
  %108 = load i32, ptr %8, align 4, !tbaa !9
  %109 = load ptr, ptr %11, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct._SUNLinearSolverContent_PCG, ptr %109, i32 0, i32 0
  store i32 %108, ptr %110, align 8, !tbaa !33
  %111 = load i32, ptr %7, align 4, !tbaa !9
  %112 = load ptr, ptr %11, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct._SUNLinearSolverContent_PCG, ptr %112, i32 0, i32 1
  store i32 %111, ptr %113, align 4, !tbaa !34
  %114 = load ptr, ptr %11, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct._SUNLinearSolverContent_PCG, ptr %114, i32 0, i32 2
  store i32 0, ptr %115, align 8, !tbaa !35
  %116 = load ptr, ptr %11, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct._SUNLinearSolverContent_PCG, ptr %116, i32 0, i32 3
  store i32 0, ptr %117, align 4, !tbaa !36
  %118 = load ptr, ptr %11, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct._SUNLinearSolverContent_PCG, ptr %118, i32 0, i32 4
  store double 0.000000e+00, ptr %119, align 8, !tbaa !37
  %120 = load ptr, ptr %11, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct._SUNLinearSolverContent_PCG, ptr %120, i32 0, i32 12
  store ptr null, ptr %121, align 8, !tbaa !38
  %122 = load ptr, ptr %11, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct._SUNLinearSolverContent_PCG, ptr %122, i32 0, i32 13
  store ptr null, ptr %123, align 8, !tbaa !39
  %124 = load ptr, ptr %11, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct._SUNLinearSolverContent_PCG, ptr %124, i32 0, i32 14
  store ptr null, ptr %125, align 8, !tbaa !40
  %126 = load ptr, ptr %11, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct._SUNLinearSolverContent_PCG, ptr %126, i32 0, i32 15
  store ptr null, ptr %127, align 8, !tbaa !41
  %128 = load ptr, ptr %11, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct._SUNLinearSolverContent_PCG, ptr %128, i32 0, i32 11
  store ptr null, ptr %129, align 8, !tbaa !42
  %130 = load ptr, ptr %11, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct._SUNLinearSolverContent_PCG, ptr %130, i32 0, i32 6
  store ptr null, ptr %131, align 8, !tbaa !43
  %132 = load ptr, ptr %11, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct._SUNLinearSolverContent_PCG, ptr %132, i32 0, i32 7
  store ptr null, ptr %133, align 8, !tbaa !44
  %134 = load ptr, ptr %11, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct._SUNLinearSolverContent_PCG, ptr %134, i32 0, i32 8
  store ptr null, ptr %135, align 8, !tbaa !45
  %136 = load ptr, ptr %11, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct._SUNLinearSolverContent_PCG, ptr %136, i32 0, i32 9
  store ptr null, ptr %137, align 8, !tbaa !46
  %138 = load ptr, ptr %11, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct._SUNLinearSolverContent_PCG, ptr %138, i32 0, i32 10
  store ptr null, ptr %139, align 8, !tbaa !47
  %140 = load ptr, ptr %11, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct._SUNLinearSolverContent_PCG, ptr %140, i32 0, i32 16
  store i32 0, ptr %141, align 8, !tbaa !48
  %142 = load ptr, ptr @stdout, align 8, !tbaa !5
  %143 = load ptr, ptr %11, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct._SUNLinearSolverContent_PCG, ptr %143, i32 0, i32 17
  store ptr %142, ptr %144, align 8, !tbaa !49
  %145 = load ptr, ptr %6, align 8, !tbaa !5
  %146 = call ptr @N_VClone(ptr noundef %145)
  %147 = load ptr, ptr %11, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct._SUNLinearSolverContent_PCG, ptr %147, i32 0, i32 12
  store ptr %146, ptr %148, align 8, !tbaa !38
  %149 = load ptr, ptr %11, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct._SUNLinearSolverContent_PCG, ptr %149, i32 0, i32 12
  %151 = load ptr, ptr %150, align 8, !tbaa !38
  %152 = icmp eq ptr %151, null
  br i1 %152, label %153, label %156

153:                                              ; preds = %102
  %154 = load ptr, ptr %10, align 8, !tbaa !5
  %155 = call i32 @SUNLinSolFree(ptr noundef %154)
  store ptr null, ptr %5, align 8
  store i32 1, ptr %12, align 4
  br label %194

156:                                              ; preds = %102
  %157 = load ptr, ptr %6, align 8, !tbaa !5
  %158 = call ptr @N_VClone(ptr noundef %157)
  %159 = load ptr, ptr %11, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct._SUNLinearSolverContent_PCG, ptr %159, i32 0, i32 13
  store ptr %158, ptr %160, align 8, !tbaa !39
  %161 = load ptr, ptr %11, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct._SUNLinearSolverContent_PCG, ptr %161, i32 0, i32 13
  %163 = load ptr, ptr %162, align 8, !tbaa !39
  %164 = icmp eq ptr %163, null
  br i1 %164, label %165, label %168

165:                                              ; preds = %156
  %166 = load ptr, ptr %10, align 8, !tbaa !5
  %167 = call i32 @SUNLinSolFree(ptr noundef %166)
  store ptr null, ptr %5, align 8
  store i32 1, ptr %12, align 4
  br label %194

168:                                              ; preds = %156
  %169 = load ptr, ptr %6, align 8, !tbaa !5
  %170 = call ptr @N_VClone(ptr noundef %169)
  %171 = load ptr, ptr %11, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct._SUNLinearSolverContent_PCG, ptr %171, i32 0, i32 14
  store ptr %170, ptr %172, align 8, !tbaa !40
  %173 = load ptr, ptr %11, align 8, !tbaa !5
  %174 = getelementptr inbounds %struct._SUNLinearSolverContent_PCG, ptr %173, i32 0, i32 14
  %175 = load ptr, ptr %174, align 8, !tbaa !40
  %176 = icmp eq ptr %175, null
  br i1 %176, label %177, label %180

177:                                              ; preds = %168
  %178 = load ptr, ptr %10, align 8, !tbaa !5
  %179 = call i32 @SUNLinSolFree(ptr noundef %178)
  store ptr null, ptr %5, align 8
  store i32 1, ptr %12, align 4
  br label %194

180:                                              ; preds = %168
  %181 = load ptr, ptr %6, align 8, !tbaa !5
  %182 = call ptr @N_VClone(ptr noundef %181)
  %183 = load ptr, ptr %11, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct._SUNLinearSolverContent_PCG, ptr %183, i32 0, i32 15
  store ptr %182, ptr %184, align 8, !tbaa !41
  %185 = load ptr, ptr %11, align 8, !tbaa !5
  %186 = getelementptr inbounds %struct._SUNLinearSolverContent_PCG, ptr %185, i32 0, i32 15
  %187 = load ptr, ptr %186, align 8, !tbaa !41
  %188 = icmp eq ptr %187, null
  br i1 %188, label %189, label %192

189:                                              ; preds = %180
  %190 = load ptr, ptr %10, align 8, !tbaa !5
  %191 = call i32 @SUNLinSolFree(ptr noundef %190)
  store ptr null, ptr %5, align 8
  store i32 1, ptr %12, align 4
  br label %194

192:                                              ; preds = %180
  %193 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %193, ptr %5, align 8
  store i32 1, ptr %12, align 4
  br label %194

194:                                              ; preds = %192, %189, %177, %165, %153, %99, %34
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  %195 = load ptr, ptr %5, align 8
  ret ptr %195
}

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

declare ptr @SUNLinSolNewEmpty(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNLinSolGetType_PCG(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNLinSolGetID_PCG(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNLinSolSetATimes_PCG(ptr noundef, ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNLinSolSetPreconditioner_PCG(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNLinSolSetScalingVectors_PCG(ptr noundef, ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNLinSolSetZeroGuess_PCG(ptr noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNLinSolInitialize_PCG(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNLinSolSetup_PCG(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNLinSolSolve_PCG(ptr noundef, ptr noundef, ptr noundef, ptr noundef, double noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNLinSolNumIters_PCG(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local double @SUNLinSolResNorm_PCG(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @SUNLinSolResid_PCG(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i64 @SUNLinSolLastFlag_PCG(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNLinSolSpace_PCG(ptr noundef, ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNLinSolFree_PCG(ptr noundef) #0

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

declare i32 @SUNLinSolFree(ptr noundef) #2

declare ptr @N_VClone(ptr noundef) #2

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 #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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 8}
!12 = !{!"_generic_SUNLinearSolver", !6, i64 0, !6, i64 8, !6, i64 16}
!13 = !{!14, !6, i64 0}
!14 = !{!"_generic_SUNLinearSolver_Ops", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, 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}
!15 = !{!14, !6, i64 8}
!16 = !{!14, !6, i64 16}
!17 = !{!14, !6, i64 24}
!18 = !{!14, !6, i64 32}
!19 = !{!14, !6, i64 40}
!20 = !{!14, !6, i64 48}
!21 = !{!14, !6, i64 56}
!22 = !{!14, !6, i64 64}
!23 = !{!14, !6, i64 72}
!24 = !{!14, !6, i64 80}
!25 = !{!14, !6, i64 104}
!26 = !{!14, !6, i64 88}
!27 = !{!14, !6, i64 96}
!28 = !{!14, !6, i64 112}
!29 = !{!12, !6, i64 0}
!30 = !{!31, !10, i64 24}
!31 = !{!"_SUNLinearSolverContent_PCG", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !32, i64 16, !10, i64 24, !6, 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, !10, i64 112, !6, i64 120}
!32 = !{!"double", !7, i64 0}
!33 = !{!31, !10, i64 0}
!34 = !{!31, !10, i64 4}
!35 = !{!31, !10, i64 8}
!36 = !{!31, !10, i64 12}
!37 = !{!31, !32, i64 16}
!38 = !{!31, !6, i64 80}
!39 = !{!31, !6, i64 88}
!40 = !{!31, !6, i64 96}
!41 = !{!31, !6, i64 104}
!42 = !{!31, !6, i64 72}
!43 = !{!31, !6, i64 32}
!44 = !{!31, !6, i64 40}
!45 = !{!31, !6, i64 48}
!46 = !{!31, !6, i64 56}
!47 = !{!31, !6, i64 64}
!48 = !{!31, !10, i64 112}
!49 = !{!31, !6, i64 120}


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

@stdout = external local_unnamed_addr global ptr, align 8

; Function Attrs: nounwind uwtable
define dso_local ptr @SUNLinSol_PCG(ptr noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %3) local_unnamed_addr #0 {
  %or.cond5 = icmp ugt i32 %1, 3
  %spec.store.select6 = select i1 %or.cond5, i32 0, i32 %1
  %5 = icmp slt i32 %2, 1
  %spec.store.select = select i1 %5, i32 5, i32 %2
  %6 = tail call ptr @SUNLinSolNewEmpty(ptr noundef %3) #4
  %7 = icmp eq ptr %6, null
  br i1 %7, label %50, label %8

8:                                                ; preds = %4
  %9 = getelementptr inbounds i8, ptr %6, i64 8
  %10 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr @SUNLinSolGetType_PCG, ptr %10, align 8, !tbaa !10
  %11 = getelementptr inbounds i8, ptr %10, i64 8
  store ptr @SUNLinSolGetID_PCG, ptr %11, align 8, !tbaa !12
  %12 = getelementptr inbounds i8, ptr %10, i64 16
  store ptr @SUNLinSolSetATimes_PCG, ptr %12, align 8, !tbaa !13
  %13 = getelementptr inbounds i8, ptr %10, i64 24
  store ptr @SUNLinSolSetPreconditioner_PCG, ptr %13, align 8, !tbaa !14
  %14 = getelementptr inbounds i8, ptr %10, i64 32
  store ptr @SUNLinSolSetScalingVectors_PCG, ptr %14, align 8, !tbaa !15
  %15 = getelementptr inbounds i8, ptr %10, i64 40
  store ptr @SUNLinSolSetZeroGuess_PCG, ptr %15, align 8, !tbaa !16
  %16 = getelementptr inbounds i8, ptr %10, i64 48
  store ptr @SUNLinSolInitialize_PCG, ptr %16, align 8, !tbaa !17
  %17 = getelementptr inbounds i8, ptr %10, i64 56
  store ptr @SUNLinSolSetup_PCG, ptr %17, align 8, !tbaa !18
  %18 = getelementptr inbounds i8, ptr %10, i64 64
  store ptr @SUNLinSolSolve_PCG, ptr %18, align 8, !tbaa !19
  %19 = getelementptr inbounds i8, ptr %10, i64 72
  store ptr @SUNLinSolNumIters_PCG, ptr %19, align 8, !tbaa !20
  %20 = getelementptr inbounds i8, ptr %10, i64 80
  store ptr @SUNLinSolResNorm_PCG, ptr %20, align 8, !tbaa !21
  %21 = getelementptr inbounds i8, ptr %10, i64 104
  store ptr @SUNLinSolResid_PCG, ptr %21, align 8, !tbaa !22
  %22 = getelementptr inbounds i8, ptr %10, i64 88
  store ptr @SUNLinSolLastFlag_PCG, ptr %22, align 8, !tbaa !23
  %23 = getelementptr inbounds i8, ptr %10, i64 96
  store ptr @SUNLinSolSpace_PCG, ptr %23, align 8, !tbaa !24
  %24 = getelementptr inbounds i8, ptr %10, i64 112
  store ptr @SUNLinSolFree_PCG, ptr %24, align 8, !tbaa !25
  %25 = tail call noalias dereferenceable_or_null(128) ptr @malloc(i64 noundef 128) #5
  %26 = icmp eq ptr %25, null
  br i1 %26, label %.sink.split, label %27

27:                                               ; preds = %8
  store ptr %25, ptr %6, align 8, !tbaa !26
  %28 = getelementptr inbounds i8, ptr %25, i64 24
  store i32 0, ptr %28, align 8, !tbaa !27
  store i32 %spec.store.select, ptr %25, align 8, !tbaa !31
  %29 = getelementptr inbounds i8, ptr %25, i64 4
  store i32 %spec.store.select6, ptr %29, align 4, !tbaa !32
  %30 = getelementptr inbounds i8, ptr %25, i64 8
  %31 = getelementptr inbounds i8, ptr %25, i64 80
  %32 = getelementptr inbounds i8, ptr %25, i64 96
  %33 = getelementptr inbounds i8, ptr %25, i64 104
  %34 = getelementptr inbounds i8, ptr %25, i64 32
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %30, i8 0, i64 16, i1 false)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(84) %34, i8 0, i64 84, i1 false)
  %35 = load ptr, ptr @stdout, align 8, !tbaa !33
  %36 = getelementptr inbounds i8, ptr %25, i64 120
  store ptr %35, ptr %36, align 8, !tbaa !34
  %37 = tail call ptr @N_VClone(ptr noundef %0) #4
  store ptr %37, ptr %31, align 8, !tbaa !35
  %38 = icmp eq ptr %37, null
  br i1 %38, label %.sink.split, label %39

39:                                               ; preds = %27
  %40 = getelementptr inbounds i8, ptr %25, i64 88
  %41 = tail call ptr @N_VClone(ptr noundef %0) #4
  store ptr %41, ptr %40, align 8, !tbaa !36
  %42 = icmp eq ptr %41, null
  br i1 %42, label %.sink.split, label %43

43:                                               ; preds = %39
  %44 = tail call ptr @N_VClone(ptr noundef %0) #4
  store ptr %44, ptr %32, align 8, !tbaa !37
  %45 = icmp eq ptr %44, null
  br i1 %45, label %.sink.split, label %46

46:                                               ; preds = %43
  %47 = tail call ptr @N_VClone(ptr noundef %0) #4
  store ptr %47, ptr %33, align 8, !tbaa !38
  %48 = icmp eq ptr %47, null
  br i1 %48, label %.sink.split, label %50

.sink.split:                                      ; preds = %46, %43, %39, %27, %8
  %49 = tail call i32 @SUNLinSolFree(ptr noundef nonnull %6) #4
  br label %50

50:                                               ; preds = %.sink.split, %46, %4
  %.0 = phi ptr [ null, %4 ], [ %6, %46 ], [ null, %.sink.split ]
  ret ptr %.0
}

declare ptr @SUNLinSolNewEmpty(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNLinSolGetType_PCG(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNLinSolGetID_PCG(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNLinSolSetATimes_PCG(ptr noundef, ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNLinSolSetPreconditioner_PCG(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNLinSolSetScalingVectors_PCG(ptr noundef, ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNLinSolSetZeroGuess_PCG(ptr noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNLinSolInitialize_PCG(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNLinSolSetup_PCG(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNLinSolSolve_PCG(ptr noundef, ptr noundef, ptr noundef, ptr noundef, double noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNLinSolNumIters_PCG(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local double @SUNLinSolResNorm_PCG(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @SUNLinSolResid_PCG(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i64 @SUNLinSolLastFlag_PCG(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNLinSolSpace_PCG(ptr noundef, ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @SUNLinSolFree_PCG(ptr noundef) #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 #2

declare i32 @SUNLinSolFree(ptr noundef) local_unnamed_addr #1

declare ptr @N_VClone(ptr noundef) local_unnamed_addr #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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, !7, i64 8}
!6 = !{!"_generic_SUNLinearSolver", !7, i64 0, !7, i64 8, !7, i64 16}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!11, !7, i64 0}
!11 = !{!"_generic_SUNLinearSolver_Ops", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, 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}
!12 = !{!11, !7, i64 8}
!13 = !{!11, !7, i64 16}
!14 = !{!11, !7, i64 24}
!15 = !{!11, !7, i64 32}
!16 = !{!11, !7, i64 40}
!17 = !{!11, !7, i64 48}
!18 = !{!11, !7, i64 56}
!19 = !{!11, !7, i64 64}
!20 = !{!11, !7, i64 72}
!21 = !{!11, !7, i64 80}
!22 = !{!11, !7, i64 104}
!23 = !{!11, !7, i64 88}
!24 = !{!11, !7, i64 96}
!25 = !{!11, !7, i64 112}
!26 = !{!6, !7, i64 0}
!27 = !{!28, !29, i64 24}
!28 = !{!"_SUNLinearSolverContent_PCG", !29, i64 0, !29, i64 4, !29, i64 8, !29, i64 12, !30, i64 16, !29, i64 24, !7, 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, !29, i64 112, !7, i64 120}
!29 = !{!"int", !8, i64 0}
!30 = !{!"double", !8, i64 0}
!31 = !{!28, !29, i64 0}
!32 = !{!28, !29, i64 4}
!33 = !{!7, !7, i64 0}
!34 = !{!28, !7, i64 120}
!35 = !{!28, !7, i64 80}
!36 = !{!28, !7, i64 88}
!37 = !{!28, !7, i64 96}
!38 = !{!28, !7, i64 104}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,SROAPass,SimplifyCFGPass,TailCallElimPass