; LLVM IR from HRI-EU/Rcs :: src/RcsCore (Rcs_kinematics)

; 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._RcsGraph = type { ptr, [10 x %struct._RcsBody], i32, i32, ptr, ptr, ptr, ptr, ptr }
%struct._RcsBody = type { double, i8, i32, [3 x double], [3 x double], double, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct._RcsJoint = type { ptr, double, double, double, double, double, double, double, i8, i32, i32, i32, i32, ptr, %struct.HTr, double, double, double, double, i32, ptr, ptr, ptr, ptr, ptr }
%struct.HTr = type { [3 x double], [3 x [3 x double]] }
%struct._MatNd = type { ptr, i32, i32, i32, i8 }

@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [43 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [73 x i8], align 1
@__func__.RcsGraph_jointLimitBorderHessian = external hidden unnamed_addr constant [33 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [35 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

declare void @MatNd_reshapeAndSetZero(ptr noundef, i32 noundef, i32 noundef) #1

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

declare void @print_trace() #1

; Function Attrs: noreturn nounwind
declare void @abort() #3

declare ptr @RcsBody_depthFirstTraversalGetNext(ptr noundef) #1

declare double @MatNd_get(ptr noundef, i32 noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @RcsGraph_jointLimitBorderHessian(ptr noundef %0, ptr noundef %1, double noundef %2, i32 noundef %3) #4 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca double, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  %16 = alloca double, align 8
  %17 = alloca double, align 8
  %18 = alloca double, align 8
  %19 = alloca double, align 8
  %20 = alloca double, align 8
  %21 = alloca double, align 8
  %22 = alloca double, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store double %2, ptr %7, align 8, !tbaa !9
  store i32 %3, ptr %8, align 4, !tbaa !11
  br label %23

23:                                               ; preds = %4
  %24 = load double, ptr %7, align 8, !tbaa !9
  %25 = fcmp oge double %24, 0.000000e+00
  %26 = zext i1 %25 to i32
  %27 = load double, ptr %7, align 8, !tbaa !9
  %28 = fcmp olt double %27, 1.000000e+00
  %29 = zext i1 %28 to i32
  %30 = and i32 %26, %29
  %31 = icmp ne i32 %30, 0
  br i1 %31, label %35, label %32

32:                                               ; preds = %23
  %33 = load ptr, ptr @stderr, align 8, !tbaa !5
  %34 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %33, ptr noundef @.str, ptr noundef @.str.1, ptr noundef @__func__.RcsGraph_jointLimitBorderHessian, i32 noundef 1418, ptr noundef @.str.11) #5
  call void @print_trace()
  call void @abort() #6
  unreachable

35:                                               ; preds = %23
  br label %36

36:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %37 = load i32, ptr %8, align 4, !tbaa !11
  %38 = icmp eq i32 %37, 0
  br i1 %38, label %39, label %43

39:                                               ; preds = %36
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct._RcsGraph, ptr %40, i32 0, i32 2
  %42 = load i32, ptr %41, align 8, !tbaa !13
  br label %47

43:                                               ; preds = %36
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct._RcsGraph, ptr %44, i32 0, i32 3
  %46 = load i32, ptr %45, align 4, !tbaa !15
  br label %47

47:                                               ; preds = %43, %39
  %48 = phi i32 [ %42, %39 ], [ %46, %43 ]
  store i32 %48, ptr %9, align 4, !tbaa !11
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = load i32, ptr %9, align 4, !tbaa !11
  %51 = load i32, ptr %9, align 4, !tbaa !11
  call void @MatNd_reshapeAndSetZero(ptr noundef %49, i32 noundef %50, i32 noundef %51)
  %52 = load double, ptr %7, align 8, !tbaa !9
  %53 = fcmp oeq double %52, 1.000000e+00
  br i1 %53, label %54, label %55

54:                                               ; preds = %47
  store i32 1, ptr %10, align 4
  br label %217

55:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct._RcsGraph, ptr %56, i32 0, i32 0
  %58 = load ptr, ptr %57, align 8, !tbaa !16
  store ptr %58, ptr %11, align 8, !tbaa !5
  br label %59

59:                                               ; preds = %213, %55
  %60 = load ptr, ptr %11, align 8, !tbaa !5
  %61 = icmp ne ptr %60, null
  br i1 %61, label %63, label %62

62:                                               ; preds = %59
  store i32 4, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  br label %216

63:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %64 = load ptr, ptr %11, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct._RcsBody, ptr %64, i32 0, i32 18
  %66 = load ptr, ptr %65, align 8, !tbaa !17
  store ptr %66, ptr %12, align 8, !tbaa !5
  br label %67

67:                                               ; preds = %208, %63
  %68 = load ptr, ptr %12, align 8, !tbaa !5
  %69 = icmp ne ptr %68, null
  br i1 %69, label %71, label %70

70:                                               ; preds = %67
  store i32 7, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  br label %212

71:                                               ; preds = %67
  %72 = load ptr, ptr %12, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct._RcsJoint, ptr %72, i32 0, i32 8
  %74 = load i8, ptr %73, align 8, !tbaa !20, !range !23, !noundef !24
  %75 = trunc i8 %74 to i1
  %76 = zext i1 %75 to i32
  %77 = icmp eq i32 %76, 1
  br i1 %77, label %78, label %82

78:                                               ; preds = %71
  %79 = load i32, ptr %8, align 4, !tbaa !11
  %80 = icmp eq i32 %79, 1
  br i1 %80, label %81, label %82

81:                                               ; preds = %78
  br label %208

82:                                               ; preds = %78, %71
  %83 = load ptr, ptr %12, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct._RcsJoint, ptr %83, i32 0, i32 24
  %85 = load ptr, ptr %84, align 8, !tbaa !25
  %86 = icmp ne ptr %85, null
  br i1 %86, label %87, label %88

87:                                               ; preds = %82
  br label %208

88:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %89 = load i32, ptr %8, align 4, !tbaa !11
  %90 = icmp eq i32 %89, 1
  br i1 %90, label %91, label %95

91:                                               ; preds = %88
  %92 = load ptr, ptr %12, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct._RcsJoint, ptr %92, i32 0, i32 12
  %94 = load i32, ptr %93, align 8, !tbaa !26
  br label %99

95:                                               ; preds = %88
  %96 = load ptr, ptr %12, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct._RcsJoint, ptr %96, i32 0, i32 11
  %98 = load i32, ptr %97, align 4, !tbaa !27
  br label %99

99:                                               ; preds = %95, %91
  %100 = phi i32 [ %94, %91 ], [ %98, %95 ]
  store i32 %100, ptr %13, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %101 = load ptr, ptr %5, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct._RcsGraph, ptr %101, i32 0, i32 4
  %103 = load ptr, ptr %102, align 8, !tbaa !28
  %104 = load ptr, ptr %12, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct._RcsJoint, ptr %104, i32 0, i32 11
  %106 = load i32, ptr %105, align 4, !tbaa !27
  %107 = call double @MatNd_get(ptr noundef %103, i32 noundef %106, i32 noundef 0)
  store double %107, ptr %14, align 8, !tbaa !9
  %108 = load double, ptr %14, align 8, !tbaa !9
  %109 = load ptr, ptr %12, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct._RcsJoint, ptr %109, i32 0, i32 1
  %111 = load double, ptr %110, align 8, !tbaa !29
  %112 = fcmp ogt double %108, %111
  br i1 %112, label %113, label %160

113:                                              ; preds = %99
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %114 = load ptr, ptr %12, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct._RcsJoint, ptr %114, i32 0, i32 4
  %116 = load double, ptr %115, align 8, !tbaa !30
  %117 = load ptr, ptr %12, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct._RcsJoint, ptr %117, i32 0, i32 1
  %119 = load double, ptr %118, align 8, !tbaa !29
  %120 = fsub double %116, %119
  store double %120, ptr %15, align 8, !tbaa !9
  %121 = load double, ptr %15, align 8, !tbaa !9
  %122 = fcmp ogt double %121, 0.000000e+00
  br i1 %122, label %123, label %159

123:                                              ; preds = %113
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %124 = load double, ptr %7, align 8, !tbaa !9
  %125 = load double, ptr %15, align 8, !tbaa !9
  %126 = fmul double %124, %125
  store double %126, ptr %16, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %127 = load double, ptr %15, align 8, !tbaa !9
  %128 = load double, ptr %16, align 8, !tbaa !9
  %129 = fsub double %127, %128
  store double %129, ptr %17, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  %130 = load ptr, ptr %12, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct._RcsJoint, ptr %130, i32 0, i32 1
  %132 = load double, ptr %131, align 8, !tbaa !29
  %133 = load double, ptr %16, align 8, !tbaa !9
  %134 = fadd double %132, %133
  store double %134, ptr %18, align 8, !tbaa !9
  %135 = load double, ptr %14, align 8, !tbaa !9
  %136 = load double, ptr %18, align 8, !tbaa !9
  %137 = fcmp ogt double %135, %136
  br i1 %137, label %138, label %158

138:                                              ; preds = %123
  %139 = load ptr, ptr %12, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct._RcsJoint, ptr %139, i32 0, i32 5
  %141 = load double, ptr %140, align 8, !tbaa !31
  %142 = load double, ptr %17, align 8, !tbaa !9
  %143 = load double, ptr %17, align 8, !tbaa !9
  %144 = fmul double %142, %143
  %145 = fdiv double %141, %144
  %146 = load ptr, ptr %6, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct._MatNd, ptr %146, i32 0, i32 0
  %148 = load ptr, ptr %147, align 8, !tbaa !32
  %149 = load i32, ptr %13, align 4, !tbaa !11
  %150 = load ptr, ptr %6, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct._MatNd, ptr %150, i32 0, i32 2
  %152 = load i32, ptr %151, align 4, !tbaa !34
  %153 = mul i32 %149, %152
  %154 = load i32, ptr %13, align 4, !tbaa !11
  %155 = add i32 %153, %154
  %156 = zext i32 %155 to i64
  %157 = getelementptr inbounds double, ptr %148, i64 %156
  store double %145, ptr %157, align 8, !tbaa !9
  br label %158

158:                                              ; preds = %138, %123
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  br label %159

159:                                              ; preds = %158, %113
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  br label %207

160:                                              ; preds = %99
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  %161 = load ptr, ptr %12, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct._RcsJoint, ptr %161, i32 0, i32 1
  %163 = load double, ptr %162, align 8, !tbaa !29
  %164 = load ptr, ptr %12, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct._RcsJoint, ptr %164, i32 0, i32 3
  %166 = load double, ptr %165, align 8, !tbaa !35
  %167 = fsub double %163, %166
  store double %167, ptr %19, align 8, !tbaa !9
  %168 = load double, ptr %19, align 8, !tbaa !9
  %169 = fcmp ogt double %168, 0.000000e+00
  br i1 %169, label %170, label %206

170:                                              ; preds = %160
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #5
  %171 = load double, ptr %7, align 8, !tbaa !9
  %172 = load double, ptr %19, align 8, !tbaa !9
  %173 = fmul double %171, %172
  store double %173, ptr %20, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #5
  %174 = load double, ptr %19, align 8, !tbaa !9
  %175 = load double, ptr %20, align 8, !tbaa !9
  %176 = fsub double %174, %175
  store double %176, ptr %21, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #5
  %177 = load ptr, ptr %12, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct._RcsJoint, ptr %177, i32 0, i32 1
  %179 = load double, ptr %178, align 8, !tbaa !29
  %180 = load double, ptr %20, align 8, !tbaa !9
  %181 = fsub double %179, %180
  store double %181, ptr %22, align 8, !tbaa !9
  %182 = load double, ptr %14, align 8, !tbaa !9
  %183 = load double, ptr %22, align 8, !tbaa !9
  %184 = fcmp olt double %182, %183
  br i1 %184, label %185, label %205

185:                                              ; preds = %170
  %186 = load ptr, ptr %12, align 8, !tbaa !5
  %187 = getelementptr inbounds %struct._RcsJoint, ptr %186, i32 0, i32 5
  %188 = load double, ptr %187, align 8, !tbaa !31
  %189 = load double, ptr %21, align 8, !tbaa !9
  %190 = load double, ptr %21, align 8, !tbaa !9
  %191 = fmul double %189, %190
  %192 = fdiv double %188, %191
  %193 = load ptr, ptr %6, align 8, !tbaa !5
  %194 = getelementptr inbounds %struct._MatNd, ptr %193, i32 0, i32 0
  %195 = load ptr, ptr %194, align 8, !tbaa !32
  %196 = load i32, ptr %13, align 4, !tbaa !11
  %197 = load ptr, ptr %6, align 8, !tbaa !5
  %198 = getelementptr inbounds %struct._MatNd, ptr %197, i32 0, i32 2
  %199 = load i32, ptr %198, align 4, !tbaa !34
  %200 = mul i32 %196, %199
  %201 = load i32, ptr %13, align 4, !tbaa !11
  %202 = add i32 %200, %201
  %203 = zext i32 %202 to i64
  %204 = getelementptr inbounds double, ptr %195, i64 %203
  store double %192, ptr %204, align 8, !tbaa !9
  br label %205

205:                                              ; preds = %185, %170
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  br label %206

206:                                              ; preds = %205, %160
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  br label %207

207:                                              ; preds = %206, %159
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %208

208:                                              ; preds = %207, %87, %81
  %209 = load ptr, ptr %12, align 8, !tbaa !5
  %210 = getelementptr inbounds %struct._RcsJoint, ptr %209, i32 0, i32 23
  %211 = load ptr, ptr %210, align 8, !tbaa !36
  store ptr %211, ptr %12, align 8, !tbaa !5
  br label %67, !llvm.loop !37

212:                                              ; preds = %70
  br label %213

213:                                              ; preds = %212
  %214 = load ptr, ptr %11, align 8, !tbaa !5
  %215 = call ptr @RcsBody_depthFirstTraversalGetNext(ptr noundef %214)
  store ptr %215, ptr %11, align 8, !tbaa !5
  br label %59, !llvm.loop !39

216:                                              ; preds = %62
  store i32 0, ptr %10, align 4
  br label %217

217:                                              ; preds = %216, %54
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  %218 = load i32, ptr %10, align 4
  switch i32 %218, label %220 [
    i32 0, label %219
    i32 1, label %219
  ]

219:                                              ; preds = %217, %217
  ret void

220:                                              ; preds = %217
  unreachable
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind "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 = { noreturn 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 #4 = { 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 #5 = { nounwind }
attributes #6 = { noreturn 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, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !12, i64 1848}
!14 = !{!"_RcsGraph", !6, i64 0, !7, i64 8, !12, i64 1848, !12, i64 1852, !6, i64 1856, !6, i64 1864, !6, i64 1872, !6, i64 1880, !6, i64 1888}
!15 = !{!14, !12, i64 1852}
!16 = !{!14, !6, i64 0}
!17 = !{!18, !6, i64 168}
!18 = !{!"_RcsBody", !10, i64 0, !19, i64 8, !12, i64 12, !7, i64 16, !7, i64 40, !10, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176}
!19 = !{!"_Bool", !7, i64 0}
!20 = !{!21, !19, i64 64}
!21 = !{!"_RcsJoint", !6, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !19, i64 64, !12, i64 68, !12, i64 72, !12, i64 76, !12, i64 80, !6, i64 88, !22, i64 96, !10, i64 192, !10, i64 200, !10, i64 208, !10, i64 216, !12, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264}
!22 = !{!"", !7, i64 0, !7, i64 24}
!23 = !{i8 0, i8 2}
!24 = !{}
!25 = !{!21, !6, i64 264}
!26 = !{!21, !12, i64 80}
!27 = !{!21, !12, i64 76}
!28 = !{!14, !6, i64 1856}
!29 = !{!21, !10, i64 8}
!30 = !{!21, !10, i64 32}
!31 = !{!21, !10, i64 40}
!32 = !{!33, !6, i64 0}
!33 = !{!"_MatNd", !6, i64 0, !12, i64 8, !12, i64 12, !12, i64 16, !19, i64 20}
!34 = !{!33, !12, i64 12}
!35 = !{!21, !10, i64 24}
!36 = !{!21, !6, i64 256}
!37 = distinct !{!37, !38}
!38 = !{!"llvm.loop.mustprogress"}
!39 = distinct !{!39, !38}


; 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 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [73 x i8], align 1
@__func__.RcsGraph_jointLimitBorderHessian = external hidden unnamed_addr constant [33 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [35 x i8], align 1

declare void @MatNd_reshapeAndSetZero(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

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

declare void @print_trace() local_unnamed_addr #0

; Function Attrs: noreturn nounwind
declare void @abort() local_unnamed_addr #2

declare ptr @RcsBody_depthFirstTraversalGetNext(ptr noundef) local_unnamed_addr #0

declare double @MatNd_get(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @RcsGraph_jointLimitBorderHessian(ptr nocapture noundef readonly %0, ptr noundef %1, double noundef %2, i32 noundef %3) local_unnamed_addr #3 {
  %5 = fcmp oge double %2, 0.000000e+00
  %6 = fcmp olt double %2, 1.000000e+00
  %7 = and i1 %5, %6
  br i1 %7, label %11, label %8

8:                                                ; preds = %4
  %9 = load ptr, ptr @stderr, align 8, !tbaa !5
  %10 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %9, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.RcsGraph_jointLimitBorderHessian, i32 noundef 1418, ptr noundef nonnull @.str.11) #4
  tail call void @print_trace() #5
  tail call void @abort() #6
  unreachable

11:                                               ; preds = %4
  %12 = icmp eq i32 %3, 0
  %.in.v = select i1 %12, i64 1848, i64 1852
  %.in = getelementptr inbounds i8, ptr %0, i64 %.in.v
  %13 = load i32, ptr %.in, align 4, !tbaa !9
  tail call void @MatNd_reshapeAndSetZero(ptr noundef %1, i32 noundef %13, i32 noundef %13) #5
  %14 = fcmp oeq double %2, 1.000000e+00
  br i1 %14, label %.loopexit, label %15

15:                                               ; preds = %11
  %16 = load ptr, ptr %0, align 8, !tbaa !11
  %.not74 = icmp eq ptr %16, null
  br i1 %.not74, label %.loopexit, label %.lr.ph77

.lr.ph77:                                         ; preds = %15
  %17 = icmp eq i32 %3, 1
  %18 = getelementptr inbounds i8, ptr %0, i64 1856
  %19 = getelementptr inbounds i8, ptr %1, i64 12
  br label %20

20:                                               ; preds = %.lr.ph77, %._crit_edge
  %.075 = phi ptr [ %16, %.lr.ph77 ], [ %22, %._crit_edge ]
  %21 = getelementptr inbounds i8, ptr %.075, i64 168
  %.06171 = load ptr, ptr %21, align 8, !tbaa !5
  %.not6872 = icmp eq ptr %.06171, null
  br i1 %.not6872, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %75, %20
  %22 = tail call ptr @RcsBody_depthFirstTraversalGetNext(ptr noundef nonnull %.075) #5
  %.not = icmp eq ptr %22, null
  br i1 %.not, label %.loopexit, label %20, !llvm.loop !13

.lr.ph:                                           ; preds = %20, %75
  %.06173 = phi ptr [ %.061, %75 ], [ %.06171, %20 ]
  %23 = getelementptr inbounds i8, ptr %.06173, i64 64
  %24 = load i8, ptr %23, align 8, !tbaa !15, !range !20, !noundef !21
  %25 = trunc nuw i8 %24 to i1
  %or.cond = and i1 %17, %25
  br i1 %or.cond, label %75, label %26

26:                                               ; preds = %.lr.ph
  %27 = getelementptr inbounds i8, ptr %.06173, i64 264
  %28 = load ptr, ptr %27, align 8, !tbaa !22
  %.not69 = icmp eq ptr %28, null
  br i1 %.not69, label %29, label %75

29:                                               ; preds = %26
  %30 = getelementptr inbounds i8, ptr %.06173, i64 80
  %31 = getelementptr inbounds i8, ptr %.06173, i64 76
  %.in70 = select i1 %17, ptr %30, ptr %31
  %32 = load i32, ptr %.in70, align 4, !tbaa !9
  %33 = load ptr, ptr %18, align 8, !tbaa !23
  %34 = load i32, ptr %31, align 4, !tbaa !24
  %35 = tail call double @MatNd_get(ptr noundef %33, i32 noundef %34, i32 noundef 0) #5
  %36 = getelementptr inbounds i8, ptr %.06173, i64 8
  %37 = load double, ptr %36, align 8, !tbaa !25
  %38 = fcmp ogt double %35, %37
  br i1 %38, label %39, label %54

39:                                               ; preds = %29
  %40 = getelementptr inbounds i8, ptr %.06173, i64 32
  %41 = load double, ptr %40, align 8, !tbaa !26
  %42 = fsub double %41, %37
  %43 = fcmp ogt double %42, 0.000000e+00
  br i1 %43, label %44, label %75

44:                                               ; preds = %39
  %45 = fmul double %42, %2
  %46 = fadd double %37, %45
  %47 = fcmp ogt double %35, %46
  br i1 %47, label %48, label %75

48:                                               ; preds = %44
  %49 = fsub double %42, %45
  %50 = getelementptr inbounds i8, ptr %.06173, i64 40
  %51 = load double, ptr %50, align 8, !tbaa !27
  %52 = fmul double %49, %49
  %53 = fdiv double %51, %52
  br label %.sink.split

54:                                               ; preds = %29
  %55 = getelementptr inbounds i8, ptr %.06173, i64 24
  %56 = load double, ptr %55, align 8, !tbaa !28
  %57 = fsub double %37, %56
  %58 = fcmp ogt double %57, 0.000000e+00
  br i1 %58, label %59, label %75

59:                                               ; preds = %54
  %60 = fmul double %57, %2
  %61 = fsub double %37, %60
  %62 = fcmp olt double %35, %61
  br i1 %62, label %63, label %75

63:                                               ; preds = %59
  %64 = fsub double %57, %60
  %65 = getelementptr inbounds i8, ptr %.06173, i64 40
  %66 = load double, ptr %65, align 8, !tbaa !27
  %67 = fmul double %64, %64
  %68 = fdiv double %66, %67
  br label %.sink.split

.sink.split:                                      ; preds = %63, %48
  %.sink = phi double [ %53, %48 ], [ %68, %63 ]
  %69 = load ptr, ptr %1, align 8, !tbaa !29
  %70 = load i32, ptr %19, align 4, !tbaa !31
  %71 = add i32 %70, 1
  %72 = mul i32 %71, %32
  %73 = zext i32 %72 to i64
  %74 = getelementptr inbounds double, ptr %69, i64 %73
  store double %.sink, ptr %74, align 8, !tbaa !32
  br label %75

75:                                               ; preds = %.sink.split, %44, %39, %59, %54, %26, %.lr.ph
  %76 = getelementptr inbounds i8, ptr %.06173, i64 256
  %.061 = load ptr, ptr %76, align 8, !tbaa !5
  %.not68 = icmp eq ptr %.061, null
  br i1 %.not68, label %._crit_edge, label %.lr.ph, !llvm.loop !33

.loopexit:                                        ; preds = %._crit_edge, %15, %11
  ret void
}

attributes #0 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 #2 = { noreturn 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 = { 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 #4 = { cold nounwind }
attributes #5 = { nounwind }
attributes #6 = { noreturn nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"_RcsGraph", !6, i64 0, !7, i64 8, !10, i64 1848, !10, i64 1852, !6, i64 1856, !6, i64 1864, !6, i64 1872, !6, i64 1880, !6, i64 1888}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !18, i64 64}
!16 = !{!"_RcsJoint", !6, i64 0, !17, i64 8, !17, i64 16, !17, i64 24, !17, i64 32, !17, i64 40, !17, i64 48, !17, i64 56, !18, i64 64, !10, i64 68, !10, i64 72, !10, i64 76, !10, i64 80, !6, i64 88, !19, i64 96, !17, i64 192, !17, i64 200, !17, i64 208, !17, i64 216, !10, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264}
!17 = !{!"double", !7, i64 0}
!18 = !{!"_Bool", !7, i64 0}
!19 = !{!"", !7, i64 0, !7, i64 24}
!20 = !{i8 0, i8 2}
!21 = !{}
!22 = !{!16, !6, i64 264}
!23 = !{!12, !6, i64 1856}
!24 = !{!16, !10, i64 76}
!25 = !{!16, !17, i64 8}
!26 = !{!16, !17, i64 32}
!27 = !{!16, !17, i64 40}
!28 = !{!16, !17, i64 24}
!29 = !{!30, !6, i64 0}
!30 = !{!"_MatNd", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !18, i64 20}
!31 = !{!30, !10, i64 12}
!32 = !{!17, !17, i64 0}
!33 = distinct !{!33, !14}


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