; LLVM IR from ox-vgg/vise :: src/search_engine/relja_retrival/external/KMCode_relja/matrix (operator)

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

%class.Matrix = type { ptr, ptr, i32, i32 }

@.str.2 = external hidden unnamed_addr constant [64 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6Matrix6nbRowsEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6Matrix6nbColsEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

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

declare void @_ZNK6Matrix5errorEPc(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef) #2

declare void @_ZN6MatrixC1Eii(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef) unnamed_addr #2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN6MatrixclEii(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef) unnamed_addr #1 align 2

; Function Attrs: nounwind
declare void @_ZN6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK6MatrixmlERKS_(ptr dead_on_unwind noalias writable sret(%class.Matrix) align 8 %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %2) #4 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca double, align 8
  %11 = alloca i1, align 1
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  store ptr %0, ptr %4, align 8
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %14 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %15 = call noundef i32 @_ZNK6Matrix6nbColsEv(ptr noundef nonnull align 8 dereferenceable(24) %14)
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  %17 = call noundef i32 @_ZNK6Matrix6nbRowsEv(ptr noundef nonnull align 8 dereferenceable(24) %16)
  %18 = icmp ne i32 %15, %17
  br i1 %18, label %19, label %20

19:                                               ; preds = %3
  call void @_ZNK6Matrix5errorEPc(ptr noundef nonnull align 8 dereferenceable(24) %14, ptr noundef @.str.2)
  br label %20

20:                                               ; preds = %19, %3
  store i1 false, ptr %11, align 1
  %21 = call noundef i32 @_ZNK6Matrix6nbRowsEv(ptr noundef nonnull align 8 dereferenceable(24) %14)
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = call noundef i32 @_ZNK6Matrix6nbColsEv(ptr noundef nonnull align 8 dereferenceable(24) %22)
  call void @_ZN6MatrixC1Eii(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %21, i32 noundef %23)
  store i32 1, ptr %7, align 4, !tbaa !9
  br label %24

24:                                               ; preds = %77, %20
  %25 = load i32, ptr %7, align 4, !tbaa !9
  %26 = invoke noundef i32 @_ZNK6Matrix6nbRowsEv(ptr noundef nonnull align 8 dereferenceable(24) %14)
          to label %27 unwind label %63

27:                                               ; preds = %24
  %28 = icmp sle i32 %25, %26
  br i1 %28, label %29, label %80

29:                                               ; preds = %27
  store i32 1, ptr %8, align 4, !tbaa !9
  br label %30

30:                                               ; preds = %73, %29
  %31 = load i32, ptr %8, align 4, !tbaa !9
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = invoke noundef i32 @_ZNK6Matrix6nbColsEv(ptr noundef nonnull align 8 dereferenceable(24) %32)
          to label %34 unwind label %63

34:                                               ; preds = %30
  %35 = icmp sle i32 %31, %33
  br i1 %35, label %36, label %76

36:                                               ; preds = %34
  store double 0.000000e+00, ptr %10, align 8, !tbaa !11
  store i32 1, ptr %9, align 4, !tbaa !9
  br label %37

37:                                               ; preds = %60, %36
  %38 = load i32, ptr %9, align 4, !tbaa !9
  %39 = invoke noundef i32 @_ZNK6Matrix6nbColsEv(ptr noundef nonnull align 8 dereferenceable(24) %14)
          to label %40 unwind label %63

40:                                               ; preds = %37
  %41 = icmp sle i32 %38, %39
  br i1 %41, label %42, label %67

42:                                               ; preds = %40
  %43 = load i32, ptr %7, align 4, !tbaa !9
  %44 = load i32, ptr %9, align 4, !tbaa !9
  %45 = load ptr, ptr %14, align 8, !tbaa !13
  %46 = getelementptr inbounds ptr, ptr %45, i64 5
  %47 = load ptr, ptr %46, align 8
  %48 = invoke noundef double %47(ptr noundef nonnull align 8 dereferenceable(24) %14, i32 noundef %43, i32 noundef %44)
          to label %49 unwind label %63

49:                                               ; preds = %42
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = load i32, ptr %9, align 4, !tbaa !9
  %52 = load i32, ptr %8, align 4, !tbaa !9
  %53 = load ptr, ptr %50, align 8, !tbaa !13
  %54 = getelementptr inbounds ptr, ptr %53, i64 5
  %55 = load ptr, ptr %54, align 8
  %56 = invoke noundef double %55(ptr noundef nonnull align 8 dereferenceable(24) %50, i32 noundef %51, i32 noundef %52)
          to label %57 unwind label %63

57:                                               ; preds = %49
  %58 = load double, ptr %10, align 8, !tbaa !11
  %59 = call double @llvm.fmuladd.f64(double %48, double %56, double %58)
  store double %59, ptr %10, align 8, !tbaa !11
  br label %60

60:                                               ; preds = %57
  %61 = load i32, ptr %9, align 4, !tbaa !9
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %9, align 4, !tbaa !9
  br label %37, !llvm.loop !15

63:                                               ; preds = %67, %49, %42, %37, %30, %24
  %64 = landingpad { ptr, i32 }
          cleanup
  %65 = extractvalue { ptr, i32 } %64, 0
  store ptr %65, ptr %12, align 8
  %66 = extractvalue { ptr, i32 } %64, 1
  store i32 %66, ptr %13, align 4
  call void @_ZN6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %84

67:                                               ; preds = %40
  %68 = load double, ptr %10, align 8, !tbaa !11
  %69 = load i32, ptr %7, align 4, !tbaa !9
  %70 = load i32, ptr %8, align 4, !tbaa !9
  %71 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN6MatrixclEii(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %69, i32 noundef %70)
          to label %72 unwind label %63

72:                                               ; preds = %67
  store double %68, ptr %71, align 8, !tbaa !11
  br label %73

73:                                               ; preds = %72
  %74 = load i32, ptr %8, align 4, !tbaa !9
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %8, align 4, !tbaa !9
  br label %30, !llvm.loop !17

76:                                               ; preds = %34
  br label %77

77:                                               ; preds = %76
  %78 = load i32, ptr %7, align 4, !tbaa !9
  %79 = add nsw i32 %78, 1
  store i32 %79, ptr %7, align 4, !tbaa !9
  br label %24, !llvm.loop !18

80:                                               ; preds = %27
  store i1 true, ptr %11, align 1
  %81 = load i1, ptr %11, align 1
  br i1 %81, label %83, label %82

82:                                               ; preds = %80
  call void @_ZN6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #6
  br label %83

83:                                               ; preds = %82, %80
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  ret void

84:                                               ; preds = %63
  %85 = load ptr, ptr %12, align 8
  %86 = load i32, ptr %13, align 4
  %87 = insertvalue { ptr, i32 } poison, ptr %85, 0
  %88 = insertvalue { ptr, i32 } %87, i32 %86, 1
  resume { ptr, i32 } %88
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #5

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint mustprogress 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 #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 "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 = { 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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { 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, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"vtable pointer", !8, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}


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

%class.Matrix = type { ptr, ptr, i32, i32 }

@.str.2 = external hidden unnamed_addr constant [64 x i8], align 1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6Matrix6nbRowsEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6Matrix6nbColsEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

declare void @_ZNK6Matrix5errorEPc(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef) local_unnamed_addr #1

declare void @_ZN6MatrixC1Eii(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef) unnamed_addr #1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN6MatrixclEii(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef) unnamed_addr #0 align 2

; Function Attrs: nounwind
declare void @_ZN6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK6MatrixmlERKS_(ptr dead_on_unwind noalias writable sret(%class.Matrix) align 8 %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %2) local_unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %4 = tail call noundef i32 @_ZNK6Matrix6nbColsEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  %5 = tail call noundef i32 @_ZNK6Matrix6nbRowsEv(ptr noundef nonnull align 8 dereferenceable(24) %2)
  %.not = icmp eq i32 %4, %5
  br i1 %.not, label %7, label %6

6:                                                ; preds = %3
  tail call void @_ZNK6Matrix5errorEPc(ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull @.str.2)
  br label %7

7:                                                ; preds = %6, %3
  %8 = tail call noundef i32 @_ZNK6Matrix6nbRowsEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  %9 = tail call noundef i32 @_ZNK6Matrix6nbColsEv(ptr noundef nonnull align 8 dereferenceable(24) %2)
  tail call void @_ZN6MatrixC1Eii(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %8, i32 noundef %9)
  %10 = tail call noundef i32 @_ZNK6Matrix6nbRowsEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  %.not2435 = icmp slt i32 %10, 1
  br i1 %.not2435, label %._crit_edge37, label %.preheader27

.preheader27:                                     ; preds = %7, %._crit_edge34
  %.036 = phi i32 [ %31, %._crit_edge34 ], [ 1, %7 ]
  %11 = tail call noundef i32 @_ZNK6Matrix6nbColsEv(ptr noundef nonnull align 8 dereferenceable(24) %2)
  %.not2532 = icmp slt i32 %11, 1
  br i1 %.not2532, label %._crit_edge34, label %.preheader

.preheader:                                       ; preds = %.preheader27, %._crit_edge
  %.02133 = phi i32 [ %29, %._crit_edge ], [ 1, %.preheader27 ]
  %12 = tail call noundef i32 @_ZNK6Matrix6nbColsEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  %.not2629 = icmp slt i32 %12, 1
  br i1 %.not2629, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader, %22
  %.02231 = phi double [ %23, %22 ], [ 0.000000e+00, %.preheader ]
  %.02330 = phi i32 [ %24, %22 ], [ 1, %.preheader ]
  %13 = load ptr, ptr %1, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %13, i64 40
  %15 = load ptr, ptr %14, align 8
  %16 = invoke noundef double %15(ptr noundef nonnull align 8 dereferenceable(24) %1, i32 noundef %.036, i32 noundef %.02330)
          to label %17 unwind label %26

17:                                               ; preds = %.lr.ph
  %18 = load ptr, ptr %2, align 8, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %18, i64 40
  %20 = load ptr, ptr %19, align 8
  %21 = invoke noundef double %20(ptr noundef nonnull align 8 dereferenceable(24) %2, i32 noundef %.02330, i32 noundef %.02133)
          to label %22 unwind label %26

22:                                               ; preds = %17
  %23 = tail call double @llvm.fmuladd.f64(double %16, double %21, double %.02231)
  %24 = add nuw nsw i32 %.02330, 1
  %25 = tail call noundef i32 @_ZNK6Matrix6nbColsEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  %.not26.not = icmp slt i32 %.02330, %25
  br i1 %.not26.not, label %.lr.ph, label %._crit_edge, !llvm.loop !8

26:                                               ; preds = %17, %.lr.ph
  %27 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZN6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  resume { ptr, i32 } %27

._crit_edge:                                      ; preds = %22, %.preheader
  %.022.lcssa = phi double [ 0.000000e+00, %.preheader ], [ %23, %22 ]
  %28 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN6MatrixclEii(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %.036, i32 noundef %.02133)
  store double %.022.lcssa, ptr %28, align 8, !tbaa !10
  %29 = add nuw nsw i32 %.02133, 1
  %30 = tail call noundef i32 @_ZNK6Matrix6nbColsEv(ptr noundef nonnull align 8 dereferenceable(24) %2)
  %.not25.not = icmp slt i32 %.02133, %30
  br i1 %.not25.not, label %.preheader, label %._crit_edge34, !llvm.loop !13

._crit_edge34:                                    ; preds = %._crit_edge, %.preheader27
  %31 = add nuw nsw i32 %.036, 1
  %32 = tail call noundef i32 @_ZNK6Matrix6nbRowsEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  %.not24.not = icmp slt i32 %.036, %32
  br i1 %.not24.not, label %.preheader27, label %._crit_edge37, !llvm.loop !14

._crit_edge37:                                    ; preds = %._crit_edge34, %7
  ret void
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #4

attributes #0 = { inlinehint mustprogress 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 "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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !6, i64 0}
!6 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!11, !11, i64 0}
!11 = !{!"double", !12, i64 0}
!12 = !{!"omnipotent char", !7, i64 0}
!13 = distinct !{!13, !9}
!14 = distinct !{!14, !9}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass