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

; 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 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [72 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@__func__.Math_finiteDifferenceDerivative = external hidden unnamed_addr constant [32 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [59 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

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

declare void @print_trace() #2

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #3

declare ptr @MatNd_create(i32 noundef, i32 noundef) #2

declare void @MatNd_destroy(ptr noundef) #2

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

17:                                               ; preds = %5
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct._MatNd, ptr %18, i32 0, i32 1
  %20 = load i32, ptr %19, align 8, !tbaa !11
  %21 = icmp ugt i32 %20, 0
  br i1 %21, label %35, label %22

22:                                               ; preds = %17
  %23 = load ptr, ptr @stderr, align 8, !tbaa !5
  %24 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %23, ptr noundef @.str, ptr noundef @.str.1, ptr noundef @__func__.Math_finiteDifferenceDerivative, i32 noundef 949, ptr noundef @.str.25) #5
  %25 = load ptr, ptr @stderr, align 8, !tbaa !5
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct._MatNd, ptr %26, i32 0, i32 1
  %28 = load i32, ptr %27, align 8, !tbaa !11
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct._MatNd, ptr %29, i32 0, i32 2
  %31 = load i32, ptr %30, align 4, !tbaa !15
  %32 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %25, ptr noundef @.str.26, i32 noundef %28, i32 noundef %31) #5
  %33 = load ptr, ptr @stderr, align 8, !tbaa !5
  %34 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %33, ptr noundef @.str.4) #5
  call void @print_trace()
  call void @exit(i32 noundef 1) #6
  unreachable

35:                                               ; preds = %17
  br label %36

36:                                               ; preds = %35
  br label %37

37:                                               ; preds = %36
  %38 = load ptr, ptr %9, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct._MatNd, ptr %38, i32 0, i32 2
  %40 = load i32, ptr %39, align 4, !tbaa !15
  %41 = icmp eq i32 %40, 1
  br i1 %41, label %55, label %42

42:                                               ; preds = %37
  %43 = load ptr, ptr @stderr, align 8, !tbaa !5
  %44 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %43, ptr noundef @.str, ptr noundef @.str.1, ptr noundef @__func__.Math_finiteDifferenceDerivative, i32 noundef 950, ptr noundef @.str.27) #5
  %45 = load ptr, ptr @stderr, align 8, !tbaa !5
  %46 = load ptr, ptr %9, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct._MatNd, ptr %46, i32 0, i32 1
  %48 = load i32, ptr %47, align 8, !tbaa !11
  %49 = load ptr, ptr %9, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct._MatNd, ptr %49, i32 0, i32 2
  %51 = load i32, ptr %50, align 4, !tbaa !15
  %52 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %45, ptr noundef @.str.28, i32 noundef %48, i32 noundef %51) #5
  %53 = load ptr, ptr @stderr, align 8, !tbaa !5
  %54 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %53, ptr noundef @.str.4) #5
  call void @print_trace()
  call void @exit(i32 noundef 1) #6
  unreachable

55:                                               ; preds = %37
  br label %56

56:                                               ; preds = %55
  br label %57

57:                                               ; preds = %56
  %58 = load ptr, ptr %9, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct._MatNd, ptr %58, i32 0, i32 1
  %60 = load i32, ptr %59, align 8, !tbaa !11
  %61 = load ptr, ptr %6, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct._MatNd, ptr %61, i32 0, i32 2
  %63 = load i32, ptr %62, align 4, !tbaa !15
  %64 = icmp eq i32 %60, %63
  br i1 %64, label %84, label %65

65:                                               ; preds = %57
  %66 = load ptr, ptr @stderr, align 8, !tbaa !5
  %67 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %66, ptr noundef @.str, ptr noundef @.str.1, ptr noundef @__func__.Math_finiteDifferenceDerivative, i32 noundef 952, ptr noundef @.str.29) #5
  %68 = load ptr, ptr @stderr, align 8, !tbaa !5
  %69 = load ptr, ptr %6, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct._MatNd, ptr %69, i32 0, i32 1
  %71 = load i32, ptr %70, align 8, !tbaa !11
  %72 = load ptr, ptr %6, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct._MatNd, ptr %72, i32 0, i32 2
  %74 = load i32, ptr %73, align 4, !tbaa !15
  %75 = load ptr, ptr %9, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct._MatNd, ptr %75, i32 0, i32 1
  %77 = load i32, ptr %76, align 8, !tbaa !11
  %78 = load ptr, ptr %9, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct._MatNd, ptr %78, i32 0, i32 2
  %80 = load i32, ptr %79, align 4, !tbaa !15
  %81 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %68, ptr noundef @.str.30, i32 noundef %71, i32 noundef %74, i32 noundef %77, i32 noundef %80) #5
  %82 = load ptr, ptr @stderr, align 8, !tbaa !5
  %83 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %82, ptr noundef @.str.4) #5
  call void @print_trace()
  call void @exit(i32 noundef 1) #6
  unreachable

84:                                               ; preds = %57
  br label %85

85:                                               ; preds = %84
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %86 = load ptr, ptr %9, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct._MatNd, ptr %86, i32 0, i32 1
  %88 = load i32, ptr %87, align 8, !tbaa !11
  %89 = zext i32 %88 to i64
  store i64 %89, ptr %11, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %90 = load ptr, ptr %6, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct._MatNd, ptr %90, i32 0, i32 1
  %92 = load i32, ptr %91, align 8, !tbaa !11
  %93 = zext i32 %92 to i64
  store i64 %93, ptr %12, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %94 = load i64, ptr %12, align 8, !tbaa !16
  %95 = trunc i64 %94 to i32
  %96 = call ptr @MatNd_create(i32 noundef %95, i32 noundef 1)
  store ptr %96, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %97 = load i64, ptr %11, align 8, !tbaa !16
  %98 = trunc i64 %97 to i32
  %99 = call ptr @MatNd_create(i32 noundef %98, i32 noundef 1)
  store ptr %99, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %100 = load i64, ptr %12, align 8, !tbaa !16
  %101 = trunc i64 %100 to i32
  %102 = call ptr @MatNd_create(i32 noundef %101, i32 noundef 1)
  store ptr %102, ptr %15, align 8, !tbaa !5
  %103 = load ptr, ptr %6, align 8, !tbaa !5
  %104 = load i64, ptr %12, align 8, !tbaa !16
  %105 = trunc i64 %104 to i32
  %106 = load i64, ptr %11, align 8, !tbaa !16
  %107 = trunc i64 %106 to i32
  call void @MatNd_reshapeAndSetZero(ptr noundef %103, i32 noundef %105, i32 noundef %107)
  %108 = load ptr, ptr %7, align 8, !tbaa !5
  %109 = load ptr, ptr %13, align 8, !tbaa !5
  %110 = load ptr, ptr %9, align 8, !tbaa !5
  %111 = load ptr, ptr %8, align 8, !tbaa !5
  call void %108(ptr noundef %109, ptr noundef %110, ptr noundef %111)
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  store i64 0, ptr %16, align 8, !tbaa !16
  br label %112

112:                                              ; preds = %137, %85
  %113 = load i64, ptr %16, align 8, !tbaa !16
  %114 = load i64, ptr %11, align 8, !tbaa !16
  %115 = icmp ult i64 %113, %114
  br i1 %115, label %117, label %116

116:                                              ; preds = %112
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  br label %140

117:                                              ; preds = %112
  %118 = load ptr, ptr %14, align 8, !tbaa !5
  %119 = load ptr, ptr %9, align 8, !tbaa !5
  call void @MatNd_copy(ptr noundef %118, ptr noundef %119)
  %120 = load ptr, ptr %14, align 8, !tbaa !5
  %121 = load i64, ptr %16, align 8, !tbaa !16
  %122 = trunc i64 %121 to i32
  %123 = load double, ptr %10, align 8, !tbaa !9
  call void @MatNd_addToEle(ptr noundef %120, i32 noundef %122, i32 noundef 0, double noundef %123)
  %124 = load ptr, ptr %7, align 8, !tbaa !5
  %125 = load ptr, ptr %15, align 8, !tbaa !5
  %126 = load ptr, ptr %14, align 8, !tbaa !5
  %127 = load ptr, ptr %8, align 8, !tbaa !5
  call void %124(ptr noundef %125, ptr noundef %126, ptr noundef %127)
  %128 = load ptr, ptr %15, align 8, !tbaa !5
  %129 = load ptr, ptr %13, align 8, !tbaa !5
  call void @MatNd_subSelf(ptr noundef %128, ptr noundef %129)
  %130 = load ptr, ptr %15, align 8, !tbaa !5
  %131 = load double, ptr %10, align 8, !tbaa !9
  %132 = fdiv double 1.000000e+00, %131
  call void @MatNd_constMulSelf(ptr noundef %130, double noundef %132)
  %133 = load ptr, ptr %6, align 8, !tbaa !5
  %134 = load i64, ptr %16, align 8, !tbaa !16
  %135 = trunc i64 %134 to i32
  %136 = load ptr, ptr %15, align 8, !tbaa !5
  call void @MatNd_copyColumn(ptr noundef %133, i32 noundef %135, ptr noundef %136, i32 noundef 0)
  br label %137

137:                                              ; preds = %117
  %138 = load i64, ptr %16, align 8, !tbaa !16
  %139 = add i64 %138, 1
  store i64 %139, ptr %16, align 8, !tbaa !16
  br label %112, !llvm.loop !18

140:                                              ; preds = %116
  %141 = load ptr, ptr %7, align 8, !tbaa !5
  %142 = load ptr, ptr %13, align 8, !tbaa !5
  %143 = load ptr, ptr %9, align 8, !tbaa !5
  %144 = load ptr, ptr %8, align 8, !tbaa !5
  call void %141(ptr noundef %142, ptr noundef %143, ptr noundef %144)
  %145 = load ptr, ptr %13, align 8, !tbaa !5
  call void @MatNd_destroy(ptr noundef %145)
  %146 = load ptr, ptr %15, align 8, !tbaa !5
  call void @MatNd_destroy(ptr noundef %146)
  %147 = load ptr, ptr %14, align 8, !tbaa !5
  call void @MatNd_destroy(ptr noundef %147)
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  ret void
}

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

declare void @MatNd_copy(ptr noundef, ptr noundef) #2

declare void @MatNd_addToEle(ptr noundef, i32 noundef, i32 noundef, double noundef) #2

declare void @MatNd_subSelf(ptr noundef, ptr noundef) #2

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

declare void @MatNd_copyColumn(ptr noundef, i32 noundef, ptr noundef, i32 noundef) #2

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 = { 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, !13, i64 8}
!12 = !{!"_MatNd", !6, i64 0, !13, i64 8, !13, i64 12, !13, i64 16, !14, i64 20}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_Bool", !7, i64 0}
!15 = !{!12, !13, i64 12}
!16 = !{!17, !17, i64 0}
!17 = !{!"long", !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 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [72 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@__func__.Math_finiteDifferenceDerivative = external hidden unnamed_addr constant [32 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [59 x i8], align 1

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

declare void @print_trace() local_unnamed_addr #1

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #2

declare ptr @MatNd_create(i32 noundef, i32 noundef) local_unnamed_addr #1

declare void @MatNd_destroy(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @Math_finiteDifferenceDerivative(ptr noundef %0, ptr nocapture noundef readonly %1, ptr noundef %2, ptr noundef %3, double noundef %4) local_unnamed_addr #3 {
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  %7 = load i32, ptr %6, align 8, !tbaa !5
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %8, label %18

8:                                                ; preds = %5
  %9 = load ptr, ptr @stderr, align 8, !tbaa !12
  %10 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %9, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.Math_finiteDifferenceDerivative, i32 noundef 949, ptr noundef nonnull @.str.25) #4
  %11 = load ptr, ptr @stderr, align 8, !tbaa !12
  %12 = load i32, ptr %6, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %0, i64 12
  %14 = load i32, ptr %13, align 4, !tbaa !13
  %15 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %11, ptr noundef nonnull @.str.26, i32 noundef %12, i32 noundef %14) #4
  %16 = load ptr, ptr @stderr, align 8, !tbaa !12
  %17 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %16, ptr noundef nonnull @.str.4) #4
  tail call void @print_trace() #5
  tail call void @exit(i32 noundef 1) #6
  unreachable

18:                                               ; preds = %5
  %19 = getelementptr inbounds i8, ptr %3, i64 12
  %20 = load i32, ptr %19, align 4, !tbaa !13
  %21 = icmp eq i32 %20, 1
  br i1 %21, label %32, label %22

22:                                               ; preds = %18
  %23 = load ptr, ptr @stderr, align 8, !tbaa !12
  %24 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %23, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.Math_finiteDifferenceDerivative, i32 noundef 950, ptr noundef nonnull @.str.27) #4
  %25 = load ptr, ptr @stderr, align 8, !tbaa !12
  %26 = getelementptr inbounds i8, ptr %3, i64 8
  %27 = load i32, ptr %26, align 8, !tbaa !5
  %28 = load i32, ptr %19, align 4, !tbaa !13
  %29 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %25, ptr noundef nonnull @.str.28, i32 noundef %27, i32 noundef %28) #4
  %30 = load ptr, ptr @stderr, align 8, !tbaa !12
  %31 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %30, ptr noundef nonnull @.str.4) #4
  tail call void @print_trace() #5
  tail call void @exit(i32 noundef 1) #6
  unreachable

32:                                               ; preds = %18
  %33 = getelementptr inbounds i8, ptr %3, i64 8
  %34 = load i32, ptr %33, align 8, !tbaa !5
  %35 = getelementptr inbounds i8, ptr %0, i64 12
  %36 = load i32, ptr %35, align 4, !tbaa !13
  %37 = icmp eq i32 %34, %36
  br i1 %37, label %49, label %38

38:                                               ; preds = %32
  %39 = load ptr, ptr @stderr, align 8, !tbaa !12
  %40 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %39, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.Math_finiteDifferenceDerivative, i32 noundef 952, ptr noundef nonnull @.str.29) #4
  %41 = load ptr, ptr @stderr, align 8, !tbaa !12
  %42 = load i32, ptr %6, align 8, !tbaa !5
  %43 = load i32, ptr %35, align 4, !tbaa !13
  %44 = load i32, ptr %33, align 8, !tbaa !5
  %45 = load i32, ptr %19, align 4, !tbaa !13
  %46 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %41, ptr noundef nonnull @.str.30, i32 noundef %42, i32 noundef %43, i32 noundef %44, i32 noundef %45) #4
  %47 = load ptr, ptr @stderr, align 8, !tbaa !12
  %48 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %47, ptr noundef nonnull @.str.4) #4
  tail call void @print_trace() #5
  tail call void @exit(i32 noundef 1) #6
  unreachable

49:                                               ; preds = %32
  %50 = zext i32 %34 to i64
  %51 = tail call ptr @MatNd_create(i32 noundef %7, i32 noundef 1) #5
  %52 = tail call ptr @MatNd_create(i32 noundef %34, i32 noundef 1) #5
  %53 = tail call ptr @MatNd_create(i32 noundef %7, i32 noundef 1) #5
  tail call void @MatNd_reshapeAndSetZero(ptr noundef nonnull %0, i32 noundef %7, i32 noundef %34) #5
  tail call void %1(ptr noundef %51, ptr noundef nonnull %3, ptr noundef %2) #5
  %.not52 = icmp eq i32 %34, 0
  br i1 %.not52, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %49
  %54 = fdiv double 1.000000e+00, %4
  br label %55

._crit_edge:                                      ; preds = %55, %49
  tail call void %1(ptr noundef %51, ptr noundef %3, ptr noundef %2) #5
  tail call void @MatNd_destroy(ptr noundef %51) #5
  tail call void @MatNd_destroy(ptr noundef %53) #5
  tail call void @MatNd_destroy(ptr noundef %52) #5
  ret void

55:                                               ; preds = %.lr.ph, %55
  %.051 = phi i64 [ 0, %.lr.ph ], [ %57, %55 ]
  tail call void @MatNd_copy(ptr noundef %52, ptr noundef %3) #5
  %56 = trunc nuw i64 %.051 to i32
  tail call void @MatNd_addToEle(ptr noundef %52, i32 noundef %56, i32 noundef 0, double noundef %4) #5
  tail call void %1(ptr noundef %53, ptr noundef %52, ptr noundef %2) #5
  tail call void @MatNd_subSelf(ptr noundef %53, ptr noundef %51) #5
  tail call void @MatNd_constMulSelf(ptr noundef %53, double noundef %54) #5
  tail call void @MatNd_copyColumn(ptr noundef %0, i32 noundef %56, ptr noundef %53, i32 noundef 0) #5
  %57 = add nuw nsw i64 %.051, 1
  %exitcond.not = icmp eq i64 %57, %50
  br i1 %exitcond.not, label %._crit_edge, label %55, !llvm.loop !14
}

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

declare void @MatNd_copy(ptr noundef, ptr noundef) local_unnamed_addr #1

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

declare void @MatNd_subSelf(ptr noundef, ptr noundef) local_unnamed_addr #1

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

declare void @MatNd_copyColumn(ptr noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

attributes #0 = { 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 #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 = { 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, !10, i64 8}
!6 = !{!"_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/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"_Bool", !8, i64 0}
!12 = !{!7, !7, i64 0}
!13 = !{!6, !10, i64 12}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


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