; LLVM IR from simbody/simbody :: SimTKmath/Integrators/src/CPodes/sundials/src/cpodes (cpodes_proj)

; 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.CPodeMemRec = type { double, i32, ptr, ptr, ptr, i32, i32, i32, double, double, ptr, ptr, ptr, [13 x ptr], ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, double, double, double, double, double, double, double, double, [14 x double], [6 x double], [13 x double], [13 x double], double, double, double, double, double, double, double, i32, i32, i32, i32, i64, i64, i32, i32, ptr, ptr, ptr, ptr, double, ptr, ptr, ptr, i64, i64, double, i32, i32, i32, ptr, ptr, ptr, ptr, i32, i64, i64, i64, i64, i32, i32, ptr, ptr, i32, i32, double, double, ptr, [13 x ptr], ptr, ptr, ptr, ptr, double, i64, i64, i32, i32, i32, i64, i64, i32, i32, double, i32, i64, i32, i32, i32, i32, double, double, double, i64, i64, i64, i64, i64, i64, i32, double, double, double, i64, i64, i64, i64, i64, i64, ptr, ptr, ptr, ptr, ptr, i32, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i64, double, double, double, i32, double, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, i32, [6 x [4 x double]], i32, i64, i32, ptr, i32, ptr, ptr, ptr, ptr, double, double, double, ptr, ptr, ptr, double, i32, i32, i64, double, double, i32, i32, ptr, ptr }

; Function Attrs: nounwind uwtable
define dso_local i32 @cpDoProjection(ptr noundef %0, double noundef %1, ptr noundef %2) #0 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca double, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca double, align 8
  %11 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store double %1, ptr %6, align 8, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.CPodeMemRec, ptr %12, i32 0, i32 45
  %14 = load i32, ptr %13, align 4, !tbaa !11
  switch i32 %14, label %143 [
    i32 2, label %15
    i32 1, label %83
  ]

15:                                               ; preds = %3
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.CPodeMemRec, ptr %16, i32 0, i32 52
  %18 = load ptr, ptr %17, align 8, !tbaa !15
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.CPodeMemRec, ptr %19, i32 0, i32 31
  %21 = load double, ptr %20, align 8, !tbaa !16
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.CPodeMemRec, ptr %22, i32 0, i32 15
  %24 = load ptr, ptr %23, align 8, !tbaa !17
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.CPodeMemRec, ptr %25, i32 0, i32 67
  %27 = load ptr, ptr %26, align 8, !tbaa !18
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.CPodeMemRec, ptr %28, i32 0, i32 53
  %30 = load ptr, ptr %29, align 8, !tbaa !19
  %31 = call i32 %18(double noundef %21, ptr noundef %24, ptr noundef %27, ptr noundef %30)
  store i32 %31, ptr %9, align 4, !tbaa !20
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.CPodeMemRec, ptr %32, i32 0, i32 73
  %34 = load i64, ptr %33, align 8, !tbaa !21
  %35 = add nsw i64 %34, 1
  store i64 %35, ptr %33, align 8, !tbaa !21
  %36 = load i32, ptr %9, align 4, !tbaa !20
  %37 = icmp slt i32 %36, 0
  br i1 %37, label %38, label %39

38:                                               ; preds = %15
  store i32 -53, ptr %8, align 4, !tbaa !20
  br label %143

39:                                               ; preds = %15
  %40 = load i32, ptr %9, align 4, !tbaa !20
  %41 = icmp sgt i32 %40, 0
  br i1 %41, label %42, label %43

42:                                               ; preds = %39
  store i32 112, ptr %8, align 4, !tbaa !20
  br label %143

43:                                               ; preds = %39
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.CPodeMemRec, ptr %44, i32 0, i32 65
  %46 = load i32, ptr %45, align 8, !tbaa !22
  %47 = icmp ne i32 %46, 0
  br i1 %47, label %48, label %67

48:                                               ; preds = %43
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.CPodeMemRec, ptr %49, i32 0, i32 67
  %51 = load ptr, ptr %50, align 8, !tbaa !18
  %52 = load ptr, ptr %5, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.CPodeMemRec, ptr %52, i32 0, i32 66
  %54 = load ptr, ptr %53, align 8, !tbaa !23
  %55 = call double @N_VWL2Norm(ptr noundef %51, ptr noundef %54)
  store double %55, ptr %10, align 8, !tbaa !9
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.CPodeMemRec, ptr %56, i32 0, i32 56
  %58 = load double, ptr %57, align 8, !tbaa !24
  %59 = load double, ptr %10, align 8, !tbaa !9
  %60 = fdiv double %59, %58
  store double %60, ptr %10, align 8, !tbaa !9
  %61 = load double, ptr %10, align 8, !tbaa !9
  %62 = fcmp ole double %61, 1.000000e+00
  br i1 %62, label %63, label %66

63:                                               ; preds = %48
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.CPodeMemRec, ptr %64, i32 0, i32 47
  store i32 0, ptr %65, align 4, !tbaa !25
  store i32 0, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %233

66:                                               ; preds = %48
  br label %67

67:                                               ; preds = %66, %43
  %68 = load ptr, ptr %5, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.CPodeMemRec, ptr %68, i32 0, i32 71
  %70 = load i64, ptr %69, align 8, !tbaa !26
  %71 = add nsw i64 %70, 1
  store i64 %71, ptr %69, align 8, !tbaa !26
  %72 = load ptr, ptr %5, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.CPodeMemRec, ptr %72, i32 0, i32 51
  %74 = load i32, ptr %73, align 4, !tbaa !27
  %75 = icmp eq i32 %74, 2
  br i1 %75, label %76, label %79

76:                                               ; preds = %67
  %77 = load ptr, ptr %5, align 8, !tbaa !5
  %78 = call i32 @cpProjNonlinear(ptr noundef %77)
  store i32 %78, ptr %8, align 4, !tbaa !20
  br label %82

79:                                               ; preds = %67
  %80 = load ptr, ptr %5, align 8, !tbaa !5
  %81 = call i32 @cpProjLinear(ptr noundef %80)
  store i32 %81, ptr %8, align 4, !tbaa !20
  br label %82

82:                                               ; preds = %79, %76
  br label %143

83:                                               ; preds = %3
  %84 = load ptr, ptr %5, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.CPodeMemRec, ptr %84, i32 0, i32 19
  %86 = load ptr, ptr %85, align 8, !tbaa !28
  %87 = load ptr, ptr %5, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.CPodeMemRec, ptr %87, i32 0, i32 58
  store ptr %86, ptr %88, align 8, !tbaa !29
  %89 = load ptr, ptr %5, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.CPodeMemRec, ptr %89, i32 0, i32 18
  %91 = load ptr, ptr %90, align 8, !tbaa !30
  %92 = load ptr, ptr %5, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.CPodeMemRec, ptr %92, i32 0, i32 57
  store ptr %91, ptr %93, align 8, !tbaa !31
  %94 = load ptr, ptr %5, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.CPodeMemRec, ptr %94, i32 0, i32 17
  %96 = load ptr, ptr %95, align 8, !tbaa !32
  %97 = load ptr, ptr %5, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.CPodeMemRec, ptr %97, i32 0, i32 58
  %99 = load ptr, ptr %98, align 8, !tbaa !29
  call void @N_VScale(double noundef 1.000000e+00, ptr noundef %96, ptr noundef %99)
  %100 = load ptr, ptr %5, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.CPodeMemRec, ptr %100, i32 0, i32 54
  %102 = load ptr, ptr %101, align 8, !tbaa !33
  %103 = load ptr, ptr %5, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.CPodeMemRec, ptr %103, i32 0, i32 31
  %105 = load double, ptr %104, align 8, !tbaa !16
  %106 = load ptr, ptr %5, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.CPodeMemRec, ptr %106, i32 0, i32 15
  %108 = load ptr, ptr %107, align 8, !tbaa !17
  %109 = load ptr, ptr %5, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.CPodeMemRec, ptr %109, i32 0, i32 57
  %111 = load ptr, ptr %110, align 8, !tbaa !31
  %112 = load ptr, ptr %5, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.CPodeMemRec, ptr %112, i32 0, i32 56
  %114 = load double, ptr %113, align 8, !tbaa !24
  %115 = load ptr, ptr %5, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.CPodeMemRec, ptr %115, i32 0, i32 58
  %117 = load ptr, ptr %116, align 8, !tbaa !29
  %118 = load ptr, ptr %5, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.CPodeMemRec, ptr %118, i32 0, i32 55
  %120 = load ptr, ptr %119, align 8, !tbaa !34
  %121 = call i32 %102(double noundef %105, ptr noundef %108, ptr noundef %111, double noundef %114, ptr noundef %117, ptr noundef %120)
  store i32 %121, ptr %9, align 4, !tbaa !20
  %122 = load ptr, ptr %5, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.CPodeMemRec, ptr %122, i32 0, i32 71
  %124 = load i64, ptr %123, align 8, !tbaa !26
  %125 = add nsw i64 %124, 1
  store i64 %125, ptr %123, align 8, !tbaa !26
  %126 = load i32, ptr %9, align 4, !tbaa !20
  %127 = icmp slt i32 %126, 0
  br i1 %127, label %128, label %129

128:                                              ; preds = %83
  store i32 -54, ptr %8, align 4, !tbaa !20
  br label %143

129:                                              ; preds = %83
  %130 = load i32, ptr %9, align 4, !tbaa !20
  %131 = icmp sgt i32 %130, 0
  br i1 %131, label %132, label %133

132:                                              ; preds = %129
  store i32 113, ptr %8, align 4, !tbaa !20
  br label %143

133:                                              ; preds = %129
  %134 = load ptr, ptr %5, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.CPodeMemRec, ptr %134, i32 0, i32 58
  %136 = load ptr, ptr %135, align 8, !tbaa !29
  %137 = load ptr, ptr %5, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.CPodeMemRec, ptr %137, i32 0, i32 14
  %139 = load ptr, ptr %138, align 8, !tbaa !35
  %140 = call double @N_VWrmsNorm(ptr noundef %136, ptr noundef %139)
  %141 = load ptr, ptr %5, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.CPodeMemRec, ptr %141, i32 0, i32 42
  store double %140, ptr %142, align 8, !tbaa !36
  store i32 0, ptr %8, align 4, !tbaa !20
  br label %143

143:                                              ; preds = %133, %132, %128, %82, %42, %38, %3
  %144 = load ptr, ptr %5, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.CPodeMemRec, ptr %144, i32 0, i32 70
  store i32 0, ptr %145, align 8, !tbaa !37
  %146 = load i32, ptr %8, align 4, !tbaa !20
  %147 = icmp eq i32 %146, 0
  br i1 %147, label %148, label %151

148:                                              ; preds = %143
  %149 = load ptr, ptr %5, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.CPodeMemRec, ptr %149, i32 0, i32 47
  store i32 1, ptr %150, align 4, !tbaa !25
  store i32 0, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %233

151:                                              ; preds = %143
  %152 = load ptr, ptr %5, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.CPodeMemRec, ptr %152, i32 0, i32 72
  %154 = load i64, ptr %153, align 8, !tbaa !38
  %155 = add nsw i64 %154, 1
  store i64 %155, ptr %153, align 8, !tbaa !38
  %156 = load ptr, ptr %5, align 8, !tbaa !5
  %157 = load double, ptr %6, align 8, !tbaa !9
  call void @cpRestore(ptr noundef %156, double noundef %157)
  %158 = load i32, ptr %8, align 4, !tbaa !20
  %159 = icmp eq i32 %158, -51
  br i1 %159, label %160, label %161

160:                                              ; preds = %151
  store i32 -51, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %233

161:                                              ; preds = %151
  %162 = load i32, ptr %8, align 4, !tbaa !20
  %163 = icmp eq i32 %162, -52
  br i1 %163, label %164, label %165

164:                                              ; preds = %161
  store i32 -52, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %233

165:                                              ; preds = %161
  %166 = load i32, ptr %8, align 4, !tbaa !20
  %167 = icmp eq i32 %166, -53
  br i1 %167, label %168, label %169

168:                                              ; preds = %165
  store i32 -53, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %233

169:                                              ; preds = %165
  %170 = load i32, ptr %8, align 4, !tbaa !20
  %171 = icmp eq i32 %170, -54
  br i1 %171, label %172, label %173

172:                                              ; preds = %169
  store i32 -54, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %233

173:                                              ; preds = %169
  %174 = load ptr, ptr %7, align 8, !tbaa !5
  %175 = load i32, ptr %174, align 4, !tbaa !20
  %176 = add nsw i32 %175, 1
  store i32 %176, ptr %174, align 4, !tbaa !20
  %177 = load ptr, ptr %5, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.CPodeMemRec, ptr %177, i32 0, i32 108
  store double 1.000000e+00, ptr %178, align 8, !tbaa !39
  %179 = load ptr, ptr %5, align 8, !tbaa !5
  %180 = getelementptr inbounds %struct.CPodeMemRec, ptr %179, i32 0, i32 26
  %181 = load double, ptr %180, align 8, !tbaa !40
  %182 = call double @RAbs(double noundef %181)
  %183 = load ptr, ptr %5, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct.CPodeMemRec, ptr %183, i32 0, i32 106
  %185 = load double, ptr %184, align 8, !tbaa !41
  %186 = fmul double %185, 0x3FF000010C6F7A0B
  %187 = fcmp ole double %182, %186
  br i1 %187, label %195, label %188

188:                                              ; preds = %173
  %189 = load ptr, ptr %7, align 8, !tbaa !5
  %190 = load i32, ptr %189, align 4, !tbaa !20
  %191 = load ptr, ptr %5, align 8, !tbaa !5
  %192 = getelementptr inbounds %struct.CPodeMemRec, ptr %191, i32 0, i32 75
  %193 = load i32, ptr %192, align 8, !tbaa !42
  %194 = icmp eq i32 %190, %193
  br i1 %194, label %195, label %208

195:                                              ; preds = %188, %173
  %196 = load i32, ptr %8, align 4, !tbaa !20
  %197 = icmp eq i32 %196, 110
  br i1 %197, label %198, label %199

198:                                              ; preds = %195
  store i32 -55, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %233

199:                                              ; preds = %195
  %200 = load i32, ptr %8, align 4, !tbaa !20
  %201 = icmp eq i32 %200, 112
  br i1 %201, label %202, label %203

202:                                              ; preds = %199
  store i32 -56, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %233

203:                                              ; preds = %199
  %204 = load i32, ptr %8, align 4, !tbaa !20
  %205 = icmp eq i32 %204, 113
  br i1 %205, label %206, label %207

206:                                              ; preds = %203
  store i32 -57, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %233

207:                                              ; preds = %203
  br label %208

208:                                              ; preds = %207, %188
  %209 = load ptr, ptr %5, align 8, !tbaa !5
  %210 = getelementptr inbounds %struct.CPodeMemRec, ptr %209, i32 0, i32 106
  %211 = load double, ptr %210, align 8, !tbaa !41
  %212 = load ptr, ptr %5, align 8, !tbaa !5
  %213 = getelementptr inbounds %struct.CPodeMemRec, ptr %212, i32 0, i32 26
  %214 = load double, ptr %213, align 8, !tbaa !40
  %215 = call double @RAbs(double noundef %214)
  %216 = fdiv double %211, %215
  %217 = fcmp ogt double 2.500000e-01, %216
  br i1 %217, label %218, label %219

218:                                              ; preds = %208
  br label %228

219:                                              ; preds = %208
  %220 = load ptr, ptr %5, align 8, !tbaa !5
  %221 = getelementptr inbounds %struct.CPodeMemRec, ptr %220, i32 0, i32 106
  %222 = load double, ptr %221, align 8, !tbaa !41
  %223 = load ptr, ptr %5, align 8, !tbaa !5
  %224 = getelementptr inbounds %struct.CPodeMemRec, ptr %223, i32 0, i32 26
  %225 = load double, ptr %224, align 8, !tbaa !40
  %226 = call double @RAbs(double noundef %225)
  %227 = fdiv double %222, %226
  br label %228

228:                                              ; preds = %219, %218
  %229 = phi double [ 2.500000e-01, %218 ], [ %227, %219 ]
  %230 = load ptr, ptr %5, align 8, !tbaa !5
  %231 = getelementptr inbounds %struct.CPodeMemRec, ptr %230, i32 0, i32 29
  store double %229, ptr %231, align 8, !tbaa !43
  %232 = load ptr, ptr %5, align 8, !tbaa !5
  call void @cpRescale(ptr noundef %232)
  store i32 3, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %233

233:                                              ; preds = %228, %206, %202, %198, %172, %168, %164, %160, %148, %63
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  %234 = load i32, ptr %4, align 4
  ret i32 %234
}

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

declare double @N_VWL2Norm(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden i32 @cpProjNonlinear(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden i32 @cpProjLinear(ptr noundef) #0

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

declare double @N_VWrmsNorm(ptr noundef, ptr noundef) #2

declare void @cpRestore(ptr noundef, double noundef) #2

declare double @RAbs(double noundef) #2

declare void @cpRescale(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 }

!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 = !{!"double", !7, i64 0}
!11 = !{!12, !13, i64 764}
!12 = !{!"CPodeMemRec", !10, i64 0, !13, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !13, i64 40, !13, i64 44, !13, i64 48, !10, i64 56, !10, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !7, i64 96, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !13, i64 248, !13, i64 252, !13, i64 256, !13, i64 260, !13, i64 264, !10, i64 272, !10, i64 280, !10, i64 288, !10, i64 296, !10, i64 304, !10, i64 312, !10, i64 320, !10, i64 328, !7, i64 336, !7, i64 448, !7, i64 496, !7, i64 600, !10, i64 704, !10, i64 712, !10, i64 720, !10, i64 728, !10, i64 736, !10, i64 744, !10, i64 752, !13, i64 760, !13, i64 764, !13, i64 768, !13, i64 772, !14, i64 776, !14, i64 784, !13, i64 792, !13, i64 796, !6, i64 800, !6, i64 808, !6, i64 816, !6, i64 824, !10, i64 832, !6, i64 840, !6, i64 848, !6, i64 856, !14, i64 864, !14, i64 872, !10, i64 880, !13, i64 888, !13, i64 892, !13, i64 896, !6, i64 904, !6, i64 912, !6, i64 920, !6, i64 928, !13, i64 936, !14, i64 944, !14, i64 952, !14, i64 960, !14, i64 968, !13, i64 976, !13, i64 980, !6, i64 984, !6, i64 992, !13, i64 1000, !13, i64 1004, !10, i64 1008, !10, i64 1016, !6, i64 1024, !7, i64 1032, !6, i64 1136, !6, i64 1144, !6, i64 1152, !6, i64 1160, !10, i64 1168, !14, i64 1176, !14, i64 1184, !13, i64 1192, !13, i64 1196, !13, i64 1200, !14, i64 1208, !14, i64 1216, !13, i64 1224, !13, i64 1228, !10, i64 1232, !13, i64 1240, !14, i64 1248, !13, i64 1256, !13, i64 1260, !13, i64 1264, !13, i64 1268, !10, i64 1272, !10, i64 1280, !10, i64 1288, !14, i64 1296, !14, i64 1304, !14, i64 1312, !14, i64 1320, !14, i64 1328, !14, i64 1336, !13, i64 1344, !10, i64 1352, !10, i64 1360, !10, i64 1368, !14, i64 1376, !14, i64 1384, !14, i64 1392, !14, i64 1400, !14, i64 1408, !14, i64 1416, !6, i64 1424, !6, i64 1432, !6, i64 1440, !6, i64 1448, !6, i64 1456, !13, i64 1464, !6, i64 1472, !6, i64 1480, !6, i64 1488, !6, i64 1496, !6, i64 1504, !6, i64 1512, !13, i64 1520, !13, i64 1524, !14, i64 1528, !10, i64 1536, !10, i64 1544, !10, i64 1552, !13, i64 1560, !10, i64 1568, !13, i64 1576, !13, i64 1580, !13, i64 1584, !13, i64 1588, !13, i64 1592, !13, i64 1596, !6, i64 1600, !6, i64 1608, !6, i64 1616, !13, i64 1624, !7, i64 1632, !13, i64 1824, !14, i64 1832, !13, i64 1840, !6, i64 1848, !13, i64 1856, !6, i64 1864, !6, i64 1872, !6, i64 1880, !6, i64 1888, !10, i64 1896, !10, i64 1904, !10, i64 1912, !6, i64 1920, !6, i64 1928, !6, i64 1936, !10, i64 1944, !13, i64 1952, !13, i64 1956, !14, i64 1960, !10, i64 1968, !10, i64 1976, !13, i64 1984, !13, i64 1988, !6, i64 1992, !6, i64 2000}
!13 = !{!"int", !7, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!12, !6, i64 800}
!16 = !{!12, !10, i64 320}
!17 = !{!12, !6, i64 208}
!18 = !{!12, !6, i64 912}
!19 = !{!12, !6, i64 808}
!20 = !{!13, !13, i64 0}
!21 = !{!12, !14, i64 960}
!22 = !{!12, !13, i64 896}
!23 = !{!12, !6, i64 904}
!24 = !{!12, !10, i64 832}
!25 = !{!12, !13, i64 772}
!26 = !{!12, !14, i64 944}
!27 = !{!12, !13, i64 796}
!28 = !{!12, !6, i64 240}
!29 = !{!12, !6, i64 848}
!30 = !{!12, !6, i64 232}
!31 = !{!12, !6, i64 840}
!32 = !{!12, !6, i64 224}
!33 = !{!12, !6, i64 816}
!34 = !{!12, !6, i64 824}
!35 = !{!12, !6, i64 200}
!36 = !{!12, !10, i64 744}
!37 = !{!12, !13, i64 936}
!38 = !{!12, !14, i64 952}
!39 = !{!12, !10, i64 1288}
!40 = !{!12, !10, i64 280}
!41 = !{!12, !10, i64 1272}
!42 = !{!12, !13, i64 976}
!43 = !{!12, !10, i64 304}


; 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 range(i32 -57, 4) i32 @cpDoProjection(ptr noundef %0, double noundef %1, ptr nocapture noundef %2) local_unnamed_addr #0 {
  %4 = getelementptr inbounds i8, ptr %0, i64 764
  %5 = load i32, ptr %4, align 4, !tbaa !5
  switch i32 %5, label %.sink.split [
    i32 2, label %6
    i32 1, label %48
  ]

6:                                                ; preds = %3
  %7 = getelementptr inbounds i8, ptr %0, i64 800
  %8 = load ptr, ptr %7, align 8, !tbaa !13
  %9 = getelementptr inbounds i8, ptr %0, i64 320
  %10 = load double, ptr %9, align 8, !tbaa !14
  %11 = getelementptr inbounds i8, ptr %0, i64 208
  %12 = load ptr, ptr %11, align 8, !tbaa !15
  %13 = getelementptr inbounds i8, ptr %0, i64 912
  %14 = load ptr, ptr %13, align 8, !tbaa !16
  %15 = getelementptr inbounds i8, ptr %0, i64 808
  %16 = load ptr, ptr %15, align 8, !tbaa !17
  %17 = tail call i32 %8(double noundef %10, ptr noundef %12, ptr noundef %14, ptr noundef %16) #2
  %18 = getelementptr inbounds i8, ptr %0, i64 960
  %19 = load i64, ptr %18, align 8, !tbaa !18
  %20 = add nsw i64 %19, 1
  store i64 %20, ptr %18, align 8, !tbaa !18
  %21 = icmp slt i32 %17, 0
  br i1 %21, label %.thread, label %22

22:                                               ; preds = %6
  %.not67 = icmp eq i32 %17, 0
  br i1 %.not67, label %23, label %.thread

23:                                               ; preds = %22
  %24 = getelementptr inbounds i8, ptr %0, i64 896
  %25 = load i32, ptr %24, align 8, !tbaa !19
  %.not68 = icmp eq i32 %25, 0
  br i1 %.not68, label %37, label %26

26:                                               ; preds = %23
  %27 = load ptr, ptr %13, align 8, !tbaa !16
  %28 = getelementptr inbounds i8, ptr %0, i64 904
  %29 = load ptr, ptr %28, align 8, !tbaa !20
  %30 = tail call double @N_VWL2Norm(ptr noundef %27, ptr noundef %29) #2
  %31 = getelementptr inbounds i8, ptr %0, i64 832
  %32 = load double, ptr %31, align 8, !tbaa !21
  %33 = fdiv double %30, %32
  %34 = fcmp ugt double %33, 1.000000e+00
  br i1 %34, label %37, label %35

35:                                               ; preds = %26
  %36 = getelementptr inbounds i8, ptr %0, i64 772
  store i32 0, ptr %36, align 4, !tbaa !22
  br label %switch.lookup

37:                                               ; preds = %26, %23
  %38 = getelementptr inbounds i8, ptr %0, i64 944
  %39 = load i64, ptr %38, align 8, !tbaa !23
  %40 = add nsw i64 %39, 1
  store i64 %40, ptr %38, align 8, !tbaa !23
  %41 = getelementptr inbounds i8, ptr %0, i64 796
  %42 = load i32, ptr %41, align 4, !tbaa !24
  %43 = icmp eq i32 %42, 2
  br i1 %43, label %44, label %46

44:                                               ; preds = %37
  %45 = tail call i32 @cpProjNonlinear(ptr noundef nonnull %0)
  br label %81

46:                                               ; preds = %37
  %47 = tail call i32 @cpProjLinear(ptr noundef nonnull %0)
  br label %81

48:                                               ; preds = %3
  %49 = getelementptr inbounds i8, ptr %0, i64 240
  %50 = load ptr, ptr %49, align 8, !tbaa !25
  %51 = getelementptr inbounds i8, ptr %0, i64 848
  store ptr %50, ptr %51, align 8, !tbaa !26
  %52 = getelementptr inbounds i8, ptr %0, i64 232
  %53 = load ptr, ptr %52, align 8, !tbaa !27
  %54 = getelementptr inbounds i8, ptr %0, i64 840
  store ptr %53, ptr %54, align 8, !tbaa !28
  %55 = getelementptr inbounds i8, ptr %0, i64 224
  %56 = load ptr, ptr %55, align 8, !tbaa !29
  tail call void @N_VScale(double noundef 1.000000e+00, ptr noundef %56, ptr noundef %50) #2
  %57 = getelementptr inbounds i8, ptr %0, i64 816
  %58 = load ptr, ptr %57, align 8, !tbaa !30
  %59 = getelementptr inbounds i8, ptr %0, i64 320
  %60 = load double, ptr %59, align 8, !tbaa !14
  %61 = getelementptr inbounds i8, ptr %0, i64 208
  %62 = load ptr, ptr %61, align 8, !tbaa !15
  %63 = load ptr, ptr %54, align 8, !tbaa !28
  %64 = getelementptr inbounds i8, ptr %0, i64 832
  %65 = load double, ptr %64, align 8, !tbaa !21
  %66 = load ptr, ptr %51, align 8, !tbaa !26
  %67 = getelementptr inbounds i8, ptr %0, i64 824
  %68 = load ptr, ptr %67, align 8, !tbaa !31
  %69 = tail call i32 %58(double noundef %60, ptr noundef %62, ptr noundef %63, double noundef %65, ptr noundef %66, ptr noundef %68) #2
  %70 = getelementptr inbounds i8, ptr %0, i64 944
  %71 = load i64, ptr %70, align 8, !tbaa !23
  %72 = add nsw i64 %71, 1
  store i64 %72, ptr %70, align 8, !tbaa !23
  %73 = icmp slt i32 %69, 0
  br i1 %73, label %.thread, label %74

74:                                               ; preds = %48
  %.not = icmp eq i32 %69, 0
  br i1 %.not, label %.thread71, label %.thread

.thread71:                                        ; preds = %74
  %75 = load ptr, ptr %51, align 8, !tbaa !26
  %76 = getelementptr inbounds i8, ptr %0, i64 200
  %77 = load ptr, ptr %76, align 8, !tbaa !32
  %78 = tail call double @N_VWrmsNorm(ptr noundef %75, ptr noundef %77) #2
  %79 = getelementptr inbounds i8, ptr %0, i64 744
  store double %78, ptr %79, align 8, !tbaa !33
  br label %.sink.split

.thread:                                          ; preds = %6, %22, %48, %74
  %.064.ph = phi i32 [ 113, %74 ], [ -54, %48 ], [ 112, %22 ], [ -53, %6 ]
  %80 = getelementptr inbounds i8, ptr %0, i64 936
  store i32 0, ptr %80, align 8, !tbaa !34
  br label %87

81:                                               ; preds = %44, %46
  %.064 = phi i32 [ %45, %44 ], [ %47, %46 ]
  %82 = getelementptr inbounds i8, ptr %0, i64 936
  store i32 0, ptr %82, align 8, !tbaa !34
  %83 = icmp eq i32 %.064, 0
  br i1 %83, label %85, label %87

.sink.split:                                      ; preds = %3, %.thread71
  %84 = getelementptr inbounds i8, ptr %0, i64 936
  store i32 0, ptr %84, align 8, !tbaa !34
  br label %85

85:                                               ; preds = %.sink.split, %81
  %86 = getelementptr inbounds i8, ptr %0, i64 772
  store i32 1, ptr %86, align 4, !tbaa !22
  br label %switch.lookup

87:                                               ; preds = %.thread, %81
  %.06470 = phi i32 [ %.064.ph, %.thread ], [ %.064, %81 ]
  %88 = getelementptr inbounds i8, ptr %0, i64 952
  %89 = load i64, ptr %88, align 8, !tbaa !35
  %90 = add nsw i64 %89, 1
  store i64 %90, ptr %88, align 8, !tbaa !35
  tail call void @cpRestore(ptr noundef nonnull %0, double noundef %1) #2
  %switch.tableidx = add i32 %.06470, 54
  %91 = icmp ult i32 %switch.tableidx, 4
  br i1 %91, label %switch.lookup, label %92

92:                                               ; preds = %87
  %93 = load i32, ptr %2, align 4, !tbaa !36
  %94 = add nsw i32 %93, 1
  store i32 %94, ptr %2, align 4, !tbaa !36
  %95 = getelementptr inbounds i8, ptr %0, i64 1288
  store double 1.000000e+00, ptr %95, align 8, !tbaa !37
  %96 = getelementptr inbounds i8, ptr %0, i64 280
  %97 = load double, ptr %96, align 8, !tbaa !38
  %98 = tail call double @RAbs(double noundef %97) #2
  %99 = getelementptr inbounds i8, ptr %0, i64 1272
  %100 = load double, ptr %99, align 8, !tbaa !39
  %101 = fmul double %100, 0x3FF000010C6F7A0B
  %102 = fcmp ugt double %98, %101
  br i1 %102, label %103, label %108

103:                                              ; preds = %92
  %104 = load i32, ptr %2, align 4, !tbaa !36
  %105 = getelementptr inbounds i8, ptr %0, i64 976
  %106 = load i32, ptr %105, align 8, !tbaa !40
  %107 = icmp eq i32 %104, %106
  br i1 %107, label %108, label %111

108:                                              ; preds = %103, %92
  switch i32 %.06470, label %111 [
    i32 110, label %switch.lookup
    i32 112, label %109
    i32 113, label %110
  ]

109:                                              ; preds = %108
  br label %switch.lookup

110:                                              ; preds = %108
  br label %switch.lookup

111:                                              ; preds = %108, %103
  %112 = load double, ptr %96, align 8, !tbaa !38
  %113 = tail call double @RAbs(double noundef %112) #2
  %114 = fdiv double %100, %113
  %115 = fcmp olt double %114, 2.500000e-01
  br i1 %115, label %121, label %116

116:                                              ; preds = %111
  %117 = load double, ptr %99, align 8, !tbaa !39
  %118 = load double, ptr %96, align 8, !tbaa !38
  %119 = tail call double @RAbs(double noundef %118) #2
  %120 = fdiv double %117, %119
  br label %121

121:                                              ; preds = %111, %116
  %122 = phi double [ %120, %116 ], [ 2.500000e-01, %111 ]
  %123 = getelementptr inbounds i8, ptr %0, i64 304
  store double %122, ptr %123, align 8, !tbaa !41
  tail call void @cpRescale(ptr noundef nonnull %0) #2
  br label %switch.lookup

switch.lookup:                                    ; preds = %87, %108, %121, %110, %109, %85, %35
  %.0 = phi i32 [ 0, %85 ], [ -56, %109 ], [ -57, %110 ], [ 3, %121 ], [ 0, %35 ], [ -55, %108 ], [ %.06470, %87 ]
  ret i32 %.0
}

declare double @N_VWL2Norm(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden i32 @cpProjNonlinear(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @cpProjLinear(ptr noundef) local_unnamed_addr #0

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

declare double @N_VWrmsNorm(ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @cpRestore(ptr noundef, double noundef) local_unnamed_addr #1

declare double @RAbs(double noundef) local_unnamed_addr #1

declare void @cpRescale(ptr noundef) local_unnamed_addr #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 = { "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 }

!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, !10, i64 764}
!6 = !{!"CPodeMemRec", !7, i64 0, !10, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !10, i64 40, !10, i64 44, !10, i64 48, !7, i64 56, !7, i64 64, !11, i64 72, !11, i64 80, !11, i64 88, !8, i64 96, !11, i64 200, !11, i64 208, !11, i64 216, !11, i64 224, !11, i64 232, !11, i64 240, !10, i64 248, !10, i64 252, !10, i64 256, !10, i64 260, !10, 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, !8, i64 336, !8, i64 448, !8, i64 496, !8, i64 600, !7, i64 704, !7, i64 712, !7, i64 720, !7, i64 728, !7, i64 736, !7, i64 744, !7, i64 752, !10, i64 760, !10, i64 764, !10, i64 768, !10, i64 772, !12, i64 776, !12, i64 784, !10, i64 792, !10, i64 796, !11, i64 800, !11, i64 808, !11, i64 816, !11, i64 824, !7, i64 832, !11, i64 840, !11, i64 848, !11, i64 856, !12, i64 864, !12, i64 872, !7, i64 880, !10, i64 888, !10, i64 892, !10, i64 896, !11, i64 904, !11, i64 912, !11, i64 920, !11, i64 928, !10, i64 936, !12, i64 944, !12, i64 952, !12, i64 960, !12, i64 968, !10, i64 976, !10, i64 980, !11, i64 984, !11, i64 992, !10, i64 1000, !10, i64 1004, !7, i64 1008, !7, i64 1016, !11, i64 1024, !8, i64 1032, !11, i64 1136, !11, i64 1144, !11, i64 1152, !11, i64 1160, !7, i64 1168, !12, i64 1176, !12, i64 1184, !10, i64 1192, !10, i64 1196, !10, i64 1200, !12, i64 1208, !12, i64 1216, !10, i64 1224, !10, i64 1228, !7, i64 1232, !10, i64 1240, !12, i64 1248, !10, i64 1256, !10, i64 1260, !10, i64 1264, !10, i64 1268, !7, i64 1272, !7, i64 1280, !7, i64 1288, !12, i64 1296, !12, i64 1304, !12, i64 1312, !12, i64 1320, !12, i64 1328, !12, i64 1336, !10, i64 1344, !7, i64 1352, !7, i64 1360, !7, i64 1368, !12, i64 1376, !12, i64 1384, !12, i64 1392, !12, i64 1400, !12, i64 1408, !12, i64 1416, !11, i64 1424, !11, i64 1432, !11, i64 1440, !11, i64 1448, !11, i64 1456, !10, i64 1464, !11, i64 1472, !11, i64 1480, !11, i64 1488, !11, i64 1496, !11, i64 1504, !11, i64 1512, !10, i64 1520, !10, i64 1524, !12, i64 1528, !7, i64 1536, !7, i64 1544, !7, i64 1552, !10, i64 1560, !7, i64 1568, !10, i64 1576, !10, i64 1580, !10, i64 1584, !10, i64 1588, !10, i64 1592, !10, i64 1596, !11, i64 1600, !11, i64 1608, !11, i64 1616, !10, i64 1624, !8, i64 1632, !10, i64 1824, !12, i64 1832, !10, i64 1840, !11, i64 1848, !10, i64 1856, !11, i64 1864, !11, i64 1872, !11, i64 1880, !11, i64 1888, !7, i64 1896, !7, i64 1904, !7, i64 1912, !11, i64 1920, !11, i64 1928, !11, i64 1936, !7, i64 1944, !10, i64 1952, !10, i64 1956, !12, i64 1960, !7, i64 1968, !7, i64 1976, !10, i64 1984, !10, i64 1988, !11, i64 1992, !11, i64 2000}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!"long", !8, i64 0}
!13 = !{!6, !11, i64 800}
!14 = !{!6, !7, i64 320}
!15 = !{!6, !11, i64 208}
!16 = !{!6, !11, i64 912}
!17 = !{!6, !11, i64 808}
!18 = !{!6, !12, i64 960}
!19 = !{!6, !10, i64 896}
!20 = !{!6, !11, i64 904}
!21 = !{!6, !7, i64 832}
!22 = !{!6, !10, i64 772}
!23 = !{!6, !12, i64 944}
!24 = !{!6, !10, i64 796}
!25 = !{!6, !11, i64 240}
!26 = !{!6, !11, i64 848}
!27 = !{!6, !11, i64 232}
!28 = !{!6, !11, i64 840}
!29 = !{!6, !11, i64 224}
!30 = !{!6, !11, i64 816}
!31 = !{!6, !11, i64 824}
!32 = !{!6, !11, i64 200}
!33 = !{!6, !7, i64 744}
!34 = !{!6, !10, i64 936}
!35 = !{!6, !12, i64 952}
!36 = !{!10, !10, i64 0}
!37 = !{!6, !7, i64 1288}
!38 = !{!6, !7, i64 280}
!39 = !{!6, !7, i64 1272}
!40 = !{!6, !10, i64 976}
!41 = !{!6, !7, i64 304}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass