; LLVM IR from HRI-EU/Rcs :: src/RcsCore/ViaPointSequence.ll (ZN3Rcs16ViaPointSequence18getConstraintIndexEPK6_MatNdjj)

; 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._MatNd = type { ptr, i32, i32, i32, i8 }

@stderr = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [77 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@RCS_GLOBAL_RLOG_CB = external global ptr, align 8
@RcsLogLevel = external global i32, align 4
@.str.42 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.82 = external hidden unnamed_addr constant [33 x i8], align 1
@__func__._ZN3Rcs16ViaPointSequence18getConstraintIndexEPK6_MatNdjj = external hidden unnamed_addr constant [19 x i8], align 1
@.str.83 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.84 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.85 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.86 = external hidden unnamed_addr constant [66 x i8], align 1

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

; Function Attrs: nounwind
declare i64 @lround(double noundef) #1

declare zeroext i1 @Math_isBitSet(i32 noundef, i32 noundef) #2

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #1

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN3Rcs16ViaPointSequence18getConstraintIndexEPK6_MatNdjj(ptr noundef %0, i32 noundef %1, i32 noundef %2) #3 align 2 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store i32 %2, ptr %7, align 4, !tbaa !9
  %12 = load i32, ptr %6, align 4, !tbaa !9
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct._MatNd, ptr %13, i32 0, i32 1
  %15 = load i32, ptr %14, align 8, !tbaa !11
  %16 = icmp ugt i32 %12, %15
  br i1 %16, label %17, label %43

17:                                               ; preds = %3
  br label %18

18:                                               ; preds = %17
  %19 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %20 = icmp ne ptr %19, null
  br i1 %20, label %21, label %27

21:                                               ; preds = %18
  %22 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %23 = load i32, ptr %6, align 4, !tbaa !9
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct._MatNd, ptr %24, i32 0, i32 1
  %26 = load i32, ptr %25, align 8, !tbaa !11
  call void (i32, ptr, ptr, i32, ptr, ...) %22(i32 noundef 1, ptr noundef @.str.2, ptr noundef @__func__._ZN3Rcs16ViaPointSequence18getConstraintIndexEPK6_MatNdjj, i32 noundef 1969, ptr noundef @.str.83, i32 noundef %23, i32 noundef %26)
  br label %27

27:                                               ; preds = %21, %18
  %28 = load i32, ptr @RcsLogLevel, align 4, !tbaa !9
  %29 = icmp sle i32 1, %28
  br i1 %29, label %30, label %41

30:                                               ; preds = %27
  %31 = load ptr, ptr @stderr, align 8, !tbaa !5
  %32 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %31, ptr noundef @.str.42, ptr noundef @.str.2, ptr noundef @__func__._ZN3Rcs16ViaPointSequence18getConstraintIndexEPK6_MatNdjj, i32 noundef 1969) #4
  %33 = load ptr, ptr @stderr, align 8, !tbaa !5
  %34 = load i32, ptr %6, align 4, !tbaa !9
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct._MatNd, ptr %35, i32 0, i32 1
  %37 = load i32, ptr %36, align 8, !tbaa !11
  %38 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %33, ptr noundef @.str.83, i32 noundef %34, i32 noundef %37) #4
  %39 = load ptr, ptr @stderr, align 8, !tbaa !5
  %40 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %39, ptr noundef @.str.4) #4
  br label %41

41:                                               ; preds = %30, %27
  br label %42

42:                                               ; preds = %41
  store i32 -1, ptr %4, align 4
  br label %218

43:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %44

44:                                               ; preds = %82, %43
  %45 = load i32, ptr %10, align 4, !tbaa !9
  %46 = load i32, ptr %6, align 4, !tbaa !9
  %47 = icmp ult i32 %45, %46
  br i1 %47, label %49, label %48

48:                                               ; preds = %44
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %85

49:                                               ; preds = %44
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct._MatNd, ptr %50, i32 0, i32 0
  %52 = load ptr, ptr %51, align 8, !tbaa !14
  %53 = load i32, ptr %10, align 4, !tbaa !9
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct._MatNd, ptr %54, i32 0, i32 2
  %56 = load i32, ptr %55, align 4, !tbaa !15
  %57 = mul i32 %53, %56
  %58 = add i32 %57, 4
  %59 = zext i32 %58 to i64
  %60 = getelementptr inbounds double, ptr %52, i64 %59
  %61 = load double, ptr %60, align 8, !tbaa !16
  %62 = call i64 @lround(double noundef %61) #4
  %63 = trunc i64 %62 to i32
  store i32 %63, ptr %8, align 4, !tbaa !9
  %64 = load i32, ptr %8, align 4, !tbaa !9
  %65 = call zeroext i1 @Math_isBitSet(i32 noundef %64, i32 noundef 0)
  br i1 %65, label %66, label %69

66:                                               ; preds = %49
  %67 = load i32, ptr %9, align 4, !tbaa !9
  %68 = add i32 %67, 1
  store i32 %68, ptr %9, align 4, !tbaa !9
  br label %69

69:                                               ; preds = %66, %49
  %70 = load i32, ptr %8, align 4, !tbaa !9
  %71 = call zeroext i1 @Math_isBitSet(i32 noundef %70, i32 noundef 1)
  br i1 %71, label %72, label %75

72:                                               ; preds = %69
  %73 = load i32, ptr %9, align 4, !tbaa !9
  %74 = add i32 %73, 1
  store i32 %74, ptr %9, align 4, !tbaa !9
  br label %75

75:                                               ; preds = %72, %69
  %76 = load i32, ptr %8, align 4, !tbaa !9
  %77 = call zeroext i1 @Math_isBitSet(i32 noundef %76, i32 noundef 2)
  br i1 %77, label %78, label %81

78:                                               ; preds = %75
  %79 = load i32, ptr %9, align 4, !tbaa !9
  %80 = add i32 %79, 1
  store i32 %80, ptr %9, align 4, !tbaa !9
  br label %81

81:                                               ; preds = %78, %75
  br label %82

82:                                               ; preds = %81
  %83 = load i32, ptr %10, align 4, !tbaa !9
  %84 = add i32 %83, 1
  store i32 %84, ptr %10, align 4, !tbaa !9
  br label %44, !llvm.loop !18

85:                                               ; preds = %48
  %86 = load ptr, ptr %5, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct._MatNd, ptr %86, i32 0, i32 0
  %88 = load ptr, ptr %87, align 8, !tbaa !14
  %89 = load i32, ptr %6, align 4, !tbaa !9
  %90 = load ptr, ptr %5, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct._MatNd, ptr %90, i32 0, i32 2
  %92 = load i32, ptr %91, align 4, !tbaa !15
  %93 = mul i32 %89, %92
  %94 = add i32 %93, 4
  %95 = zext i32 %94 to i64
  %96 = getelementptr inbounds double, ptr %88, i64 %95
  %97 = load double, ptr %96, align 8, !tbaa !16
  %98 = call i64 @lround(double noundef %97) #4
  %99 = trunc i64 %98 to i32
  store i32 %99, ptr %8, align 4, !tbaa !9
  %100 = load i32, ptr %7, align 4, !tbaa !9
  switch i32 %100, label %194 [
    i32 0, label %101
    i32 1, label %126
    i32 2, label %157
  ]

101:                                              ; preds = %85
  %102 = load i32, ptr %8, align 4, !tbaa !9
  %103 = call zeroext i1 @Math_isBitSet(i32 noundef %102, i32 noundef 0)
  br i1 %103, label %125, label %104

104:                                              ; preds = %101
  br label %105

105:                                              ; preds = %104
  %106 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %107 = icmp ne ptr %106, null
  br i1 %107, label %108, label %111

108:                                              ; preds = %105
  %109 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %110 = load i32, ptr %6, align 4, !tbaa !9
  call void (i32, ptr, ptr, i32, ptr, ...) %109(i32 noundef 1, ptr noundef @.str.2, ptr noundef @__func__._ZN3Rcs16ViaPointSequence18getConstraintIndexEPK6_MatNdjj, i32 noundef 2005, ptr noundef @.str.82, i32 noundef %110)
  br label %111

111:                                              ; preds = %108, %105
  %112 = load i32, ptr @RcsLogLevel, align 4, !tbaa !9
  %113 = icmp sle i32 1, %112
  br i1 %113, label %114, label %122

114:                                              ; preds = %111
  %115 = load ptr, ptr @stderr, align 8, !tbaa !5
  %116 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %115, ptr noundef @.str.42, ptr noundef @.str.2, ptr noundef @__func__._ZN3Rcs16ViaPointSequence18getConstraintIndexEPK6_MatNdjj, i32 noundef 2005) #4
  %117 = load ptr, ptr @stderr, align 8, !tbaa !5
  %118 = load i32, ptr %6, align 4, !tbaa !9
  %119 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %117, ptr noundef @.str.82, i32 noundef %118) #4
  %120 = load ptr, ptr @stderr, align 8, !tbaa !5
  %121 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %120, ptr noundef @.str.4) #4
  br label %122

122:                                              ; preds = %114, %111
  br label %123

123:                                              ; preds = %122
  br label %124

124:                                              ; preds = %123
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %217

125:                                              ; preds = %101
  br label %215

126:                                              ; preds = %85
  %127 = load i32, ptr %8, align 4, !tbaa !9
  %128 = call zeroext i1 @Math_isBitSet(i32 noundef %127, i32 noundef 1)
  br i1 %128, label %150, label %129

129:                                              ; preds = %126
  br label %130

130:                                              ; preds = %129
  %131 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %132 = icmp ne ptr %131, null
  br i1 %132, label %133, label %136

133:                                              ; preds = %130
  %134 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %135 = load i32, ptr %6, align 4, !tbaa !9
  call void (i32, ptr, ptr, i32, ptr, ...) %134(i32 noundef 1, ptr noundef @.str.2, ptr noundef @__func__._ZN3Rcs16ViaPointSequence18getConstraintIndexEPK6_MatNdjj, i32 noundef 2013, ptr noundef @.str.84, i32 noundef %135)
  br label %136

136:                                              ; preds = %133, %130
  %137 = load i32, ptr @RcsLogLevel, align 4, !tbaa !9
  %138 = icmp sle i32 1, %137
  br i1 %138, label %139, label %147

139:                                              ; preds = %136
  %140 = load ptr, ptr @stderr, align 8, !tbaa !5
  %141 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %140, ptr noundef @.str.42, ptr noundef @.str.2, ptr noundef @__func__._ZN3Rcs16ViaPointSequence18getConstraintIndexEPK6_MatNdjj, i32 noundef 2013) #4
  %142 = load ptr, ptr @stderr, align 8, !tbaa !5
  %143 = load i32, ptr %6, align 4, !tbaa !9
  %144 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %142, ptr noundef @.str.84, i32 noundef %143) #4
  %145 = load ptr, ptr @stderr, align 8, !tbaa !5
  %146 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %145, ptr noundef @.str.4) #4
  br label %147

147:                                              ; preds = %139, %136
  br label %148

148:                                              ; preds = %147
  br label %149

149:                                              ; preds = %148
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %217

150:                                              ; preds = %126
  %151 = load i32, ptr %8, align 4, !tbaa !9
  %152 = call zeroext i1 @Math_isBitSet(i32 noundef %151, i32 noundef 0)
  br i1 %152, label %153, label %156

153:                                              ; preds = %150
  %154 = load i32, ptr %9, align 4, !tbaa !9
  %155 = add i32 %154, 1
  store i32 %155, ptr %9, align 4, !tbaa !9
  br label %156

156:                                              ; preds = %153, %150
  br label %215

157:                                              ; preds = %85
  %158 = load i32, ptr %8, align 4, !tbaa !9
  %159 = call zeroext i1 @Math_isBitSet(i32 noundef %158, i32 noundef 2)
  br i1 %159, label %181, label %160

160:                                              ; preds = %157
  br label %161

161:                                              ; preds = %160
  %162 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %163 = icmp ne ptr %162, null
  br i1 %163, label %164, label %167

164:                                              ; preds = %161
  %165 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %166 = load i32, ptr %6, align 4, !tbaa !9
  call void (i32, ptr, ptr, i32, ptr, ...) %165(i32 noundef 1, ptr noundef @.str.2, ptr noundef @__func__._ZN3Rcs16ViaPointSequence18getConstraintIndexEPK6_MatNdjj, i32 noundef 2025, ptr noundef @.str.85, i32 noundef %166)
  br label %167

167:                                              ; preds = %164, %161
  %168 = load i32, ptr @RcsLogLevel, align 4, !tbaa !9
  %169 = icmp sle i32 1, %168
  br i1 %169, label %170, label %178

170:                                              ; preds = %167
  %171 = load ptr, ptr @stderr, align 8, !tbaa !5
  %172 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %171, ptr noundef @.str.42, ptr noundef @.str.2, ptr noundef @__func__._ZN3Rcs16ViaPointSequence18getConstraintIndexEPK6_MatNdjj, i32 noundef 2025) #4
  %173 = load ptr, ptr @stderr, align 8, !tbaa !5
  %174 = load i32, ptr %6, align 4, !tbaa !9
  %175 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %173, ptr noundef @.str.85, i32 noundef %174) #4
  %176 = load ptr, ptr @stderr, align 8, !tbaa !5
  %177 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %176, ptr noundef @.str.4) #4
  br label %178

178:                                              ; preds = %170, %167
  br label %179

179:                                              ; preds = %178
  br label %180

180:                                              ; preds = %179
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %217

181:                                              ; preds = %157
  %182 = load i32, ptr %8, align 4, !tbaa !9
  %183 = call zeroext i1 @Math_isBitSet(i32 noundef %182, i32 noundef 0)
  br i1 %183, label %184, label %187

184:                                              ; preds = %181
  %185 = load i32, ptr %9, align 4, !tbaa !9
  %186 = add i32 %185, 1
  store i32 %186, ptr %9, align 4, !tbaa !9
  br label %187

187:                                              ; preds = %184, %181
  %188 = load i32, ptr %8, align 4, !tbaa !9
  %189 = call zeroext i1 @Math_isBitSet(i32 noundef %188, i32 noundef 1)
  br i1 %189, label %190, label %193

190:                                              ; preds = %187
  %191 = load i32, ptr %9, align 4, !tbaa !9
  %192 = add i32 %191, 1
  store i32 %192, ptr %9, align 4, !tbaa !9
  br label %193

193:                                              ; preds = %190, %187
  br label %215

194:                                              ; preds = %85
  br label %195

195:                                              ; preds = %194
  %196 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %197 = icmp ne ptr %196, null
  br i1 %197, label %198, label %201

198:                                              ; preds = %195
  %199 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %200 = load i32, ptr %7, align 4, !tbaa !9
  call void (i32, ptr, ptr, i32, ptr, ...) %199(i32 noundef 1, ptr noundef @.str.2, ptr noundef @__func__._ZN3Rcs16ViaPointSequence18getConstraintIndexEPK6_MatNdjj, i32 noundef 2040, ptr noundef @.str.86, i32 noundef %200)
  br label %201

201:                                              ; preds = %198, %195
  %202 = load i32, ptr @RcsLogLevel, align 4, !tbaa !9
  %203 = icmp sle i32 1, %202
  br i1 %203, label %204, label %212

204:                                              ; preds = %201
  %205 = load ptr, ptr @stderr, align 8, !tbaa !5
  %206 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %205, ptr noundef @.str.42, ptr noundef @.str.2, ptr noundef @__func__._ZN3Rcs16ViaPointSequence18getConstraintIndexEPK6_MatNdjj, i32 noundef 2040) #4
  %207 = load ptr, ptr @stderr, align 8, !tbaa !5
  %208 = load i32, ptr %7, align 4, !tbaa !9
  %209 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %207, ptr noundef @.str.86, i32 noundef %208) #4
  %210 = load ptr, ptr @stderr, align 8, !tbaa !5
  %211 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %210, ptr noundef @.str.4) #4
  br label %212

212:                                              ; preds = %204, %201
  br label %213

213:                                              ; preds = %212
  br label %214

214:                                              ; preds = %213
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %217

215:                                              ; preds = %193, %156, %125
  %216 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %216, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %217

217:                                              ; preds = %215, %214, %180, %149, %124
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %218

218:                                              ; preds = %217, %42
  %219 = load i32, ptr %4, align 4
  ret i32 %219
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress 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 #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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 8}
!12 = !{!"_ZTS6_MatNd", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !13, i64 20}
!13 = !{!"bool", !7, i64 0}
!14 = !{!12, !6, i64 0}
!15 = !{!12, !10, i64 12}
!16 = !{!17, !17, i64 0}
!17 = !{!"double", !7, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}


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

@stderr = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [77 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@RCS_GLOBAL_RLOG_CB = external local_unnamed_addr global ptr, align 8
@RcsLogLevel = external local_unnamed_addr global i32, align 4
@.str.42 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.82 = external hidden unnamed_addr constant [33 x i8], align 1
@__func__._ZN3Rcs16ViaPointSequence18getConstraintIndexEPK6_MatNdjj = external hidden unnamed_addr constant [19 x i8], align 1
@.str.83 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.84 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.85 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.86 = external hidden unnamed_addr constant [66 x i8], align 1

; Function Attrs: nounwind
declare i64 @lround(double noundef) local_unnamed_addr #0

declare zeroext i1 @Math_isBitSet(i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN3Rcs16ViaPointSequence18getConstraintIndexEPK6_MatNdjj(ptr nocapture noundef readonly %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #3 align 2 {
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  %5 = load i32, ptr %4, align 8, !tbaa !5
  %6 = icmp ult i32 %5, %1
  br i1 %6, label %8, label %.preheader

.preheader:                                       ; preds = %3
  %.not60 = icmp eq i32 %1, 0
  br i1 %.not60, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader
  %7 = getelementptr inbounds i8, ptr %0, i64 12
  br label %32

8:                                                ; preds = %3
  %9 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !12
  %.not54 = icmp eq ptr %9, null
  br i1 %.not54, label %11, label %10

10:                                               ; preds = %8
  tail call void (i32, ptr, ptr, i32, ptr, ...) %9(i32 noundef 1, ptr noundef nonnull @.str.2, ptr noundef nonnull @__func__._ZN3Rcs16ViaPointSequence18getConstraintIndexEPK6_MatNdjj, i32 noundef 1969, ptr noundef nonnull @.str.83, i32 noundef %1, i32 noundef %5)
  br label %11

11:                                               ; preds = %10, %8
  %12 = load i32, ptr @RcsLogLevel, align 4, !tbaa !13
  %13 = icmp sgt i32 %12, 0
  br i1 %13, label %14, label %115

14:                                               ; preds = %11
  %15 = load ptr, ptr @stderr, align 8, !tbaa !12
  %16 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %15, ptr noundef nonnull @.str.42, ptr noundef nonnull @.str.2, ptr noundef nonnull @__func__._ZN3Rcs16ViaPointSequence18getConstraintIndexEPK6_MatNdjj, i32 noundef 1969) #4
  %17 = load ptr, ptr @stderr, align 8, !tbaa !12
  %18 = load i32, ptr %4, align 8, !tbaa !5
  %19 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %17, ptr noundef nonnull @.str.83, i32 noundef %1, i32 noundef %18) #4
  %20 = load ptr, ptr @stderr, align 8, !tbaa !12
  %21 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %20, ptr noundef nonnull @.str.4) #4
  br label %115

._crit_edge:                                      ; preds = %32, %.preheader
  %.040.lcssa = phi i32 [ 0, %.preheader ], [ %.3, %32 ]
  %22 = load ptr, ptr %0, align 8, !tbaa !14
  %23 = getelementptr inbounds i8, ptr %0, i64 12
  %24 = load i32, ptr %23, align 4, !tbaa !15
  %25 = mul i32 %24, %1
  %26 = add i32 %25, 4
  %27 = zext i32 %26 to i64
  %28 = getelementptr inbounds double, ptr %22, i64 %27
  %29 = load double, ptr %28, align 8, !tbaa !16
  %30 = tail call i64 @lround(double noundef %29) #5
  %31 = trunc i64 %30 to i32
  switch i32 %2, label %102 [
    i32 0, label %49
    i32 1, label %64
    i32 2, label %82
  ]

32:                                               ; preds = %.lr.ph, %32
  %.059 = phi i32 [ 0, %.lr.ph ], [ %48, %32 ]
  %.04058 = phi i32 [ 0, %.lr.ph ], [ %.3, %32 ]
  %33 = load ptr, ptr %0, align 8, !tbaa !14
  %34 = load i32, ptr %7, align 4, !tbaa !15
  %35 = mul i32 %34, %.059
  %36 = add i32 %35, 4
  %37 = zext i32 %36 to i64
  %38 = getelementptr inbounds double, ptr %33, i64 %37
  %39 = load double, ptr %38, align 8, !tbaa !16
  %40 = tail call i64 @lround(double noundef %39) #5
  %41 = trunc i64 %40 to i32
  %42 = tail call zeroext i1 @Math_isBitSet(i32 noundef %41, i32 noundef 0)
  %43 = zext i1 %42 to i32
  %spec.select = add i32 %.04058, %43
  %44 = tail call zeroext i1 @Math_isBitSet(i32 noundef %41, i32 noundef 1)
  %45 = zext i1 %44 to i32
  %.2 = add i32 %spec.select, %45
  %46 = tail call zeroext i1 @Math_isBitSet(i32 noundef %41, i32 noundef 2)
  %47 = zext i1 %46 to i32
  %.3 = add i32 %.2, %47
  %48 = add nuw i32 %.059, 1
  %exitcond.not = icmp eq i32 %48, %1
  br i1 %exitcond.not, label %._crit_edge, label %32, !llvm.loop !18

49:                                               ; preds = %._crit_edge
  %50 = tail call zeroext i1 @Math_isBitSet(i32 noundef %31, i32 noundef 0)
  br i1 %50, label %115, label %51

51:                                               ; preds = %49
  %52 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !12
  %.not52 = icmp eq ptr %52, null
  br i1 %.not52, label %54, label %53

53:                                               ; preds = %51
  tail call void (i32, ptr, ptr, i32, ptr, ...) %52(i32 noundef 1, ptr noundef nonnull @.str.2, ptr noundef nonnull @__func__._ZN3Rcs16ViaPointSequence18getConstraintIndexEPK6_MatNdjj, i32 noundef 2005, ptr noundef nonnull @.str.82, i32 noundef %1)
  br label %54

54:                                               ; preds = %53, %51
  %55 = load i32, ptr @RcsLogLevel, align 4, !tbaa !13
  %56 = icmp sgt i32 %55, 0
  br i1 %56, label %57, label %115

57:                                               ; preds = %54
  %58 = load ptr, ptr @stderr, align 8, !tbaa !12
  %59 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %58, ptr noundef nonnull @.str.42, ptr noundef nonnull @.str.2, ptr noundef nonnull @__func__._ZN3Rcs16ViaPointSequence18getConstraintIndexEPK6_MatNdjj, i32 noundef 2005) #4
  %60 = load ptr, ptr @stderr, align 8, !tbaa !12
  %61 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %60, ptr noundef nonnull @.str.82, i32 noundef %1) #4
  %62 = load ptr, ptr @stderr, align 8, !tbaa !12
  %63 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %62, ptr noundef nonnull @.str.4) #4
  br label %115

64:                                               ; preds = %._crit_edge
  %65 = tail call zeroext i1 @Math_isBitSet(i32 noundef %31, i32 noundef 1)
  br i1 %65, label %79, label %66

66:                                               ; preds = %64
  %67 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !12
  %.not51 = icmp eq ptr %67, null
  br i1 %.not51, label %69, label %68

68:                                               ; preds = %66
  tail call void (i32, ptr, ptr, i32, ptr, ...) %67(i32 noundef 1, ptr noundef nonnull @.str.2, ptr noundef nonnull @__func__._ZN3Rcs16ViaPointSequence18getConstraintIndexEPK6_MatNdjj, i32 noundef 2013, ptr noundef nonnull @.str.84, i32 noundef %1)
  br label %69

69:                                               ; preds = %68, %66
  %70 = load i32, ptr @RcsLogLevel, align 4, !tbaa !13
  %71 = icmp sgt i32 %70, 0
  br i1 %71, label %72, label %115

72:                                               ; preds = %69
  %73 = load ptr, ptr @stderr, align 8, !tbaa !12
  %74 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %73, ptr noundef nonnull @.str.42, ptr noundef nonnull @.str.2, ptr noundef nonnull @__func__._ZN3Rcs16ViaPointSequence18getConstraintIndexEPK6_MatNdjj, i32 noundef 2013) #4
  %75 = load ptr, ptr @stderr, align 8, !tbaa !12
  %76 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %75, ptr noundef nonnull @.str.84, i32 noundef %1) #4
  %77 = load ptr, ptr @stderr, align 8, !tbaa !12
  %78 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %77, ptr noundef nonnull @.str.4) #4
  br label %115

79:                                               ; preds = %64
  %80 = tail call zeroext i1 @Math_isBitSet(i32 noundef %31, i32 noundef 0)
  %81 = zext i1 %80 to i32
  %spec.select55 = add i32 %.040.lcssa, %81
  br label %115

82:                                               ; preds = %._crit_edge
  %83 = tail call zeroext i1 @Math_isBitSet(i32 noundef %31, i32 noundef 2)
  br i1 %83, label %97, label %84

84:                                               ; preds = %82
  %85 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !12
  %.not = icmp eq ptr %85, null
  br i1 %.not, label %87, label %86

86:                                               ; preds = %84
  tail call void (i32, ptr, ptr, i32, ptr, ...) %85(i32 noundef 1, ptr noundef nonnull @.str.2, ptr noundef nonnull @__func__._ZN3Rcs16ViaPointSequence18getConstraintIndexEPK6_MatNdjj, i32 noundef 2025, ptr noundef nonnull @.str.85, i32 noundef %1)
  br label %87

87:                                               ; preds = %86, %84
  %88 = load i32, ptr @RcsLogLevel, align 4, !tbaa !13
  %89 = icmp sgt i32 %88, 0
  br i1 %89, label %90, label %115

90:                                               ; preds = %87
  %91 = load ptr, ptr @stderr, align 8, !tbaa !12
  %92 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %91, ptr noundef nonnull @.str.42, ptr noundef nonnull @.str.2, ptr noundef nonnull @__func__._ZN3Rcs16ViaPointSequence18getConstraintIndexEPK6_MatNdjj, i32 noundef 2025) #4
  %93 = load ptr, ptr @stderr, align 8, !tbaa !12
  %94 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %93, ptr noundef nonnull @.str.85, i32 noundef %1) #4
  %95 = load ptr, ptr @stderr, align 8, !tbaa !12
  %96 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %95, ptr noundef nonnull @.str.4) #4
  br label %115

97:                                               ; preds = %82
  %98 = tail call zeroext i1 @Math_isBitSet(i32 noundef %31, i32 noundef 0)
  %99 = zext i1 %98 to i32
  %spec.select56 = add i32 %.040.lcssa, %99
  %100 = tail call zeroext i1 @Math_isBitSet(i32 noundef %31, i32 noundef 1)
  %101 = zext i1 %100 to i32
  %spec.select57 = add i32 %spec.select56, %101
  br label %115

102:                                              ; preds = %._crit_edge
  %103 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !12
  %.not53 = icmp eq ptr %103, null
  br i1 %.not53, label %105, label %104

104:                                              ; preds = %102
  tail call void (i32, ptr, ptr, i32, ptr, ...) %103(i32 noundef 1, ptr noundef nonnull @.str.2, ptr noundef nonnull @__func__._ZN3Rcs16ViaPointSequence18getConstraintIndexEPK6_MatNdjj, i32 noundef 2040, ptr noundef nonnull @.str.86, i32 noundef %2)
  br label %105

105:                                              ; preds = %104, %102
  %106 = load i32, ptr @RcsLogLevel, align 4, !tbaa !13
  %107 = icmp sgt i32 %106, 0
  br i1 %107, label %108, label %115

108:                                              ; preds = %105
  %109 = load ptr, ptr @stderr, align 8, !tbaa !12
  %110 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %109, ptr noundef nonnull @.str.42, ptr noundef nonnull @.str.2, ptr noundef nonnull @__func__._ZN3Rcs16ViaPointSequence18getConstraintIndexEPK6_MatNdjj, i32 noundef 2040) #4
  %111 = load ptr, ptr @stderr, align 8, !tbaa !12
  %112 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %111, ptr noundef nonnull @.str.86, i32 noundef %2) #4
  %113 = load ptr, ptr @stderr, align 8, !tbaa !12
  %114 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %113, ptr noundef nonnull @.str.4) #4
  br label %115

115:                                              ; preds = %97, %79, %57, %54, %72, %69, %90, %87, %108, %105, %49, %14, %11
  %.142 = phi i32 [ -1, %11 ], [ -1, %14 ], [ -1, %57 ], [ -1, %54 ], [ -1, %72 ], [ -1, %69 ], [ -1, %90 ], [ -1, %87 ], [ -1, %108 ], [ -1, %105 ], [ %.040.lcssa, %49 ], [ %spec.select55, %79 ], [ %spec.select57, %97 ]
  ret i32 %.142
}

attributes #0 = { nounwind "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 = { nofree nounwind "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 = { mustprogress 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 #4 = { cold nounwind }
attributes #5 = { 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 8}
!6 = !{!"_ZTS6_MatNd", !7, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !11, i64 20}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"bool", !8, i64 0}
!12 = !{!7, !7, i64 0}
!13 = !{!10, !10, i64 0}
!14 = !{!6, !7, i64 0}
!15 = !{!6, !10, i64 12}
!16 = !{!17, !17, i64 0}
!17 = !{!"double", !8, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}


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