; 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 = external hidden unnamed_addr constant [58 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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK6MatrixplERKS_(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) #2 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 i1, align 1
  %10 = alloca ptr, align 8
  %11 = 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
  %12 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %13 = call noundef i32 @_ZNK6Matrix6nbRowsEv(ptr noundef nonnull align 8 dereferenceable(24) %12)
  %14 = load ptr, ptr %6, align 8, !tbaa !5
  %15 = call noundef i32 @_ZNK6Matrix6nbRowsEv(ptr noundef nonnull align 8 dereferenceable(24) %14)
  %16 = icmp ne i32 %13, %15
  br i1 %16, label %22, label %17

17:                                               ; preds = %3
  %18 = call noundef i32 @_ZNK6Matrix6nbColsEv(ptr noundef nonnull align 8 dereferenceable(24) %12)
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = call noundef i32 @_ZNK6Matrix6nbColsEv(ptr noundef nonnull align 8 dereferenceable(24) %19)
  %21 = icmp ne i32 %18, %20
  br i1 %21, label %22, label %23

22:                                               ; preds = %17, %3
  call void @_ZNK6Matrix5errorEPc(ptr noundef nonnull align 8 dereferenceable(24) %12, ptr noundef @.str)
  br label %23

23:                                               ; preds = %22, %17
  store i1 false, ptr %9, align 1
  %24 = call noundef i32 @_ZNK6Matrix6nbRowsEv(ptr noundef nonnull align 8 dereferenceable(24) %12)
  %25 = call noundef i32 @_ZNK6Matrix6nbColsEv(ptr noundef nonnull align 8 dereferenceable(24) %12)
  call void @_ZN6MatrixC1Eii(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %24, i32 noundef %25)
  store i32 1, ptr %7, align 4, !tbaa !9
  br label %26

26:                                               ; preds = %66, %23
  %27 = load i32, ptr %7, align 4, !tbaa !9
  %28 = invoke noundef i32 @_ZNK6Matrix6nbRowsEv(ptr noundef nonnull align 8 dereferenceable(24) %12)
          to label %29 unwind label %61

29:                                               ; preds = %26
  %30 = icmp sle i32 %27, %28
  br i1 %30, label %31, label %69

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

32:                                               ; preds = %58, %31
  %33 = load i32, ptr %8, align 4, !tbaa !9
  %34 = invoke noundef i32 @_ZNK6Matrix6nbColsEv(ptr noundef nonnull align 8 dereferenceable(24) %12)
          to label %35 unwind label %61

35:                                               ; preds = %32
  %36 = icmp sle i32 %33, %34
  br i1 %36, label %37, label %65

37:                                               ; preds = %35
  %38 = load i32, ptr %7, align 4, !tbaa !9
  %39 = load i32, ptr %8, align 4, !tbaa !9
  %40 = load ptr, ptr %12, align 8, !tbaa !11
  %41 = getelementptr inbounds ptr, ptr %40, i64 5
  %42 = load ptr, ptr %41, align 8
  %43 = invoke noundef double %42(ptr noundef nonnull align 8 dereferenceable(24) %12, i32 noundef %38, i32 noundef %39)
          to label %44 unwind label %61

44:                                               ; preds = %37
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = load i32, ptr %7, align 4, !tbaa !9
  %47 = load i32, ptr %8, align 4, !tbaa !9
  %48 = load ptr, ptr %45, align 8, !tbaa !11
  %49 = getelementptr inbounds ptr, ptr %48, i64 5
  %50 = load ptr, ptr %49, align 8
  %51 = invoke noundef double %50(ptr noundef nonnull align 8 dereferenceable(24) %45, i32 noundef %46, i32 noundef %47)
          to label %52 unwind label %61

52:                                               ; preds = %44
  %53 = fadd double %43, %51
  %54 = load i32, ptr %7, align 4, !tbaa !9
  %55 = load i32, ptr %8, align 4, !tbaa !9
  %56 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZN6MatrixclEii(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %54, i32 noundef %55)
          to label %57 unwind label %61

57:                                               ; preds = %52
  store double %53, ptr %56, align 8, !tbaa !13
  br label %58

58:                                               ; preds = %57
  %59 = load i32, ptr %8, align 4, !tbaa !9
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %8, align 4, !tbaa !9
  br label %32, !llvm.loop !15

61:                                               ; preds = %52, %44, %37, %32, %26
  %62 = landingpad { ptr, i32 }
          cleanup
  %63 = extractvalue { ptr, i32 } %62, 0
  store ptr %63, ptr %10, align 8
  %64 = extractvalue { ptr, i32 } %62, 1
  store i32 %64, ptr %11, align 4
  call void @_ZN6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %73

65:                                               ; preds = %35
  br label %66

66:                                               ; preds = %65
  %67 = load i32, ptr %7, align 4, !tbaa !9
  %68 = add nsw i32 %67, 1
  store i32 %68, ptr %7, align 4, !tbaa !9
  br label %26, !llvm.loop !17

69:                                               ; preds = %29
  store i1 true, ptr %9, align 1
  %70 = load i1, ptr %9, align 1
  br i1 %70, label %72, label %71

71:                                               ; preds = %69
  call void @_ZN6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #5
  br label %72

72:                                               ; preds = %71, %69
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  ret void

73:                                               ; preds = %61
  %74 = load ptr, ptr %10, align 8
  %75 = load i32, ptr %11, align 4
  %76 = insertvalue { ptr, i32 } poison, ptr %74, 0
  %77 = insertvalue { ptr, i32 } %76, i32 %75, 1
  resume { ptr, i32 } %77
}

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

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

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 #4

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 = { 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 #3 = { "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 "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 }

!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 = !{!"vtable pointer", !8, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !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 = external hidden unnamed_addr constant [58 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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK6MatrixplERKS_(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 #1 align 2 personality ptr @__gxx_personality_v0 {
  %4 = tail call noundef i32 @_ZNK6Matrix6nbRowsEv(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 %6, label %9

6:                                                ; preds = %3
  %7 = tail call noundef i32 @_ZNK6Matrix6nbColsEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  %8 = tail call noundef i32 @_ZNK6Matrix6nbColsEv(ptr noundef nonnull align 8 dereferenceable(24) %2)
  %.not17 = icmp eq i32 %7, %8
  br i1 %.not17, label %10, label %9

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

10:                                               ; preds = %9, %6
  %11 = tail call noundef i32 @_ZNK6Matrix6nbRowsEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  %12 = tail call noundef i32 @_ZNK6Matrix6nbColsEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  tail call void @_ZN6MatrixC1Eii(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %11, i32 noundef %12)
  %13 = tail call noundef i32 @_ZNK6Matrix6nbRowsEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  %.not1822 = icmp slt i32 %13, 1
  br i1 %.not1822, label %._crit_edge24, label %.preheader

.preheader:                                       ; preds = %10, %._crit_edge
  %.023 = phi i32 [ %31, %._crit_edge ], [ 1, %10 ]
  %14 = tail call noundef i32 @_ZNK6Matrix6nbColsEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  %.not1920 = icmp slt i32 %14, 1
  br i1 %.not1920, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader, %24
  %.01621 = phi i32 [ %27, %24 ], [ 1, %.preheader ]
  %15 = load ptr, ptr %1, align 8, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %15, i64 40
  %17 = load ptr, ptr %16, align 8
  %18 = invoke noundef double %17(ptr noundef nonnull align 8 dereferenceable(24) %1, i32 noundef %.023, i32 noundef %.01621)
          to label %19 unwind label %29

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

24:                                               ; preds = %19
  %25 = fadd double %18, %23
  %26 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN6MatrixclEii(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %.023, i32 noundef %.01621)
  store double %25, ptr %26, align 8, !tbaa !8
  %27 = add nuw nsw i32 %.01621, 1
  %28 = tail call noundef i32 @_ZNK6Matrix6nbColsEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  %.not19.not = icmp slt i32 %.01621, %28
  br i1 %.not19.not, label %.lr.ph, label %._crit_edge, !llvm.loop !11

29:                                               ; preds = %19, %.lr.ph
  %30 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZN6MatrixD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  resume { ptr, i32 } %30

._crit_edge:                                      ; preds = %24, %.preheader
  %31 = add nuw nsw i32 %.023, 1
  %32 = tail call noundef i32 @_ZNK6Matrix6nbRowsEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  %.not18.not = icmp slt i32 %.023, %32
  br i1 %.not18.not, label %.preheader, label %._crit_edge24, !llvm.loop !13

._crit_edge24:                                    ; preds = %._crit_edge, %10
  ret void
}

declare void @_ZNK6Matrix5errorEPc(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef) local_unnamed_addr #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 #0 align 2

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

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 = { 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 #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 = { 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 = !{!9, !9, i64 0}
!9 = !{!"double", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


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