; LLVM IR from ardiloot/NonlinearTMM :: NonlinearTMM/src/eigen-3.4.0/unsupported/test/cxx11_tensor_uint128.ll (Z8test_mulv)

; 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.Eigen::internal::TensorUInt128" = type { i64, i64 }

; 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: mustprogress uwtable
declare dso_local void @_Z12VERIFY_EQUALN5Eigen8internal13TensorUInt128ImmEEo(i64, i64, i64 noundef, i64 noundef) #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_ZN5Eigen8internal6randomImEENS0_13random_retvalINS0_36global_math_functions_filtering_baseIT_vE4typeEE4typeERKS4_SA_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local void @_ZN5Eigen8internal13TensorUInt128ImmEC2Emm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef, i64 noundef) unnamed_addr #3 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

; Function Attrs: mustprogress uwtable
define dso_local void @_Z8test_mulv() #1 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca %"struct.Eigen::internal::TensorUInt128", align 8
  %8 = alloca i128, align 16
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca %"struct.Eigen::internal::TensorUInt128", align 8
  %12 = alloca i128, align 16
  %13 = alloca %"struct.Eigen::internal::TensorUInt128", align 8
  %14 = alloca i128, align 16
  %15 = alloca %"struct.Eigen::internal::TensorUInt128", align 8
  %16 = alloca i128, align 16
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #5
  store i64 1, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  store i64 9999999999, ptr %3, align 8, !tbaa !5
  %17 = call noundef i64 @_ZN5Eigen8internal6randomImEENS0_13random_retvalINS0_36global_math_functions_filtering_baseIT_vE4typeEE4typeERKS4_SA_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  store i64 %17, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  store i64 0, ptr %4, align 8, !tbaa !5
  br label %18

18:                                               ; preds = %89, %0
  %19 = load i64, ptr %4, align 8, !tbaa !5
  %20 = icmp ult i64 %19, 100
  br i1 %20, label %22, label %21

21:                                               ; preds = %18
  store i32 2, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  br label %92

22:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  store i64 1, ptr %6, align 8, !tbaa !5
  br label %23

23:                                               ; preds = %84, %22
  %24 = load i64, ptr %6, align 8, !tbaa !5
  %25 = load i64, ptr %1, align 8, !tbaa !5
  %26 = mul i64 100, %25
  %27 = icmp ult i64 %24, %26
  br i1 %27, label %29, label %28

28:                                               ; preds = %23
  store i32 5, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  br label %88

29:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #5
  %30 = load i64, ptr %4, align 8, !tbaa !5
  %31 = load i64, ptr %6, align 8, !tbaa !5
  call void @_ZN5Eigen8internal13TensorUInt128ImmEC2Emm(ptr noundef nonnull align 8 dereferenceable(16) %7, i64 noundef %30, i64 noundef %31)
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #5
  %32 = load i64, ptr %4, align 8, !tbaa !5
  %33 = zext i64 %32 to i128
  %34 = shl i128 %33, 64
  %35 = load i64, ptr %6, align 8, !tbaa !5
  %36 = zext i64 %35 to i128
  %37 = add i128 %34, %36
  store i128 %37, ptr %8, align 16, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  store i64 0, ptr %9, align 8, !tbaa !5
  br label %38

38:                                               ; preds = %80, %29
  %39 = load i64, ptr %9, align 8, !tbaa !5
  %40 = icmp ult i64 %39, 100
  br i1 %40, label %42, label %41

41:                                               ; preds = %38
  store i32 8, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %83

42:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  store i64 1, ptr %10, align 8, !tbaa !5
  br label %43

43:                                               ; preds = %75, %42
  %44 = load i64, ptr %10, align 8, !tbaa !5
  %45 = load i64, ptr %1, align 8, !tbaa !5
  %46 = mul i64 100, %45
  %47 = icmp ult i64 %44, %46
  br i1 %47, label %49, label %48

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

49:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #5
  %50 = load i64, ptr %9, align 8, !tbaa !5
  %51 = load i64, ptr %10, align 8, !tbaa !5
  call void @_ZN5Eigen8internal13TensorUInt128ImmEC2Emm(ptr noundef nonnull align 8 dereferenceable(16) %11, i64 noundef %50, i64 noundef %51)
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #5
  %52 = load i64, ptr %9, align 8, !tbaa !5
  %53 = zext i64 %52 to i128
  %54 = shl i128 %53, 64
  %55 = load i64, ptr %10, align 8, !tbaa !5
  %56 = zext i64 %55 to i128
  %57 = add i128 %54, %56
  store i128 %57, ptr %12, align 16, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #5
  %58 = call { i64, i64 } @_ZN5Eigen8internalmlImmmmEENS0_13TensorUInt128ImmEERKNS2_IT_T0_EERKNS2_IT1_T2_EE(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 8 dereferenceable(16) %11)
  %59 = getelementptr inbounds { i64, i64 }, ptr %13, i32 0, i32 0
  %60 = extractvalue { i64, i64 } %58, 0
  store i64 %60, ptr %59, align 8
  %61 = getelementptr inbounds { i64, i64 }, ptr %13, i32 0, i32 1
  %62 = extractvalue { i64, i64 } %58, 1
  store i64 %62, ptr %61, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %14) #5
  %63 = load i128, ptr %8, align 16, !tbaa !9
  %64 = load i128, ptr %12, align 16, !tbaa !9
  %65 = mul i128 %63, %64
  store i128 %65, ptr %14, align 16, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %15, ptr align 8 %13, i64 16, i1 false), !tbaa.struct !11
  %66 = load i128, ptr %14, align 16, !tbaa !9
  %67 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 0
  %68 = load i64, ptr %67, align 8
  %69 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 1
  %70 = load i64, ptr %69, align 8
  store i128 %66, ptr %16, align 16, !tbaa !9
  %71 = getelementptr inbounds { i64, i64 }, ptr %16, i32 0, i32 0
  %72 = load i64, ptr %71, align 16
  %73 = getelementptr inbounds { i64, i64 }, ptr %16, i32 0, i32 1
  %74 = load i64, ptr %73, align 8
  call void @_Z12VERIFY_EQUALN5Eigen8internal13TensorUInt128ImmEEo(i64 %68, i64 %70, i64 noundef %72, i64 noundef %74)
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #5
  br label %75

75:                                               ; preds = %49
  %76 = load i64, ptr %1, align 8, !tbaa !5
  %77 = load i64, ptr %10, align 8, !tbaa !5
  %78 = add i64 %77, %76
  store i64 %78, ptr %10, align 8, !tbaa !5
  br label %43, !llvm.loop !12

79:                                               ; preds = %48
  br label %80

80:                                               ; preds = %79
  %81 = load i64, ptr %9, align 8, !tbaa !5
  %82 = add i64 %81, 1
  store i64 %82, ptr %9, align 8, !tbaa !5
  br label %38, !llvm.loop !14

83:                                               ; preds = %41
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #5
  br label %84

84:                                               ; preds = %83
  %85 = load i64, ptr %1, align 8, !tbaa !5
  %86 = load i64, ptr %6, align 8, !tbaa !5
  %87 = add i64 %86, %85
  store i64 %87, ptr %6, align 8, !tbaa !5
  br label %23, !llvm.loop !15

88:                                               ; preds = %28
  br label %89

89:                                               ; preds = %88
  %90 = load i64, ptr %4, align 8, !tbaa !5
  %91 = add i64 %90, 1
  store i64 %91, ptr %4, align 8, !tbaa !5
  br label %18, !llvm.loop !16

92:                                               ; preds = %21
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #5
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare hidden { i64, i64 } @_ZN5Eigen8internalmlImmmmEENS0_13TensorUInt128ImmEERKNS2_IT_T0_EERKNS2_IT1_T2_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { inlinehint 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 = { alwaysinline 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"__int128", !7, i64 0}
!11 = !{i64 0, i64 8, !5, i64 8, i64 8, !5}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}


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

%"struct.Eigen::internal::TensorUInt128" = type { i64, i64 }

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z12VERIFY_EQUALN5Eigen8internal13TensorUInt128ImmEEo(i64, i64, i64 noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_ZN5Eigen8internal6randomImEENS0_13random_retvalINS0_36global_math_functions_filtering_baseIT_vE4typeEE4typeERKS4_SA_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local void @_ZN5Eigen8internal13TensorUInt128ImmEC2Emm(ptr noundef nonnull align 8 dereferenceable(16), i64 noundef, i64 noundef) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z8test_mulv() local_unnamed_addr #1 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca %"struct.Eigen::internal::TensorUInt128", align 8
  %4 = alloca %"struct.Eigen::internal::TensorUInt128", align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #4
  store i64 1, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #4
  store i64 9999999999, ptr %2, align 8, !tbaa !5
  %5 = call noundef i64 @_ZN5Eigen8internal6randomImEENS0_13random_retvalINS0_36global_math_functions_filtering_baseIT_vE4typeEE4typeERKS4_SA_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #4
  %6 = mul i64 %5, 100
  %.not = icmp eq i64 %6, 0
  br i1 %.not, label %.split38.us, label %.preheader30.us

.preheader30.us:                                  ; preds = %0, %._crit_edge.split.us.us
  %.036.us = phi i64 [ %25, %._crit_edge.split.us.us ], [ 0, %0 ]
  %7 = zext nneg i64 %.036.us to i128
  %8 = shl nuw nsw i128 %7, 64
  br label %.split.us.us.us

.split.us.us.us:                                  ; preds = %.split34.us.us.us, %.preheader30.us
  %.02635.us.us = phi i64 [ 1, %.preheader30.us ], [ %23, %.split34.us.us.us ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #4
  call void @_ZN5Eigen8internal13TensorUInt128ImmEC2Emm(ptr noundef nonnull align 8 dereferenceable(16) %3, i64 noundef %.036.us, i64 noundef %.02635.us.us)
  %9 = zext i64 %.02635.us.us to i128
  %10 = or disjoint i128 %8, %9
  br label %.preheader.us.us.us

.preheader.us.us.us:                              ; preds = %._crit_edge.us.us.us, %.split.us.us.us
  %.02732.us.us.us = phi i64 [ 0, %.split.us.us.us ], [ %22, %._crit_edge.us.us.us ]
  %11 = zext nneg i64 %.02732.us.us.us to i128
  %12 = shl nuw nsw i128 %11, 64
  br label %13

13:                                               ; preds = %13, %.preheader.us.us.us
  %.02831.us.us.us = phi i64 [ 1, %.preheader.us.us.us ], [ %20, %13 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #4
  call void @_ZN5Eigen8internal13TensorUInt128ImmEC2Emm(ptr noundef nonnull align 8 dereferenceable(16) %4, i64 noundef %.02732.us.us.us, i64 noundef %.02831.us.us.us)
  %14 = zext i64 %.02831.us.us.us to i128
  %15 = or disjoint i128 %12, %14
  %16 = call { i64, i64 } @_ZN5Eigen8internalmlImmmmEENS0_13TensorUInt128ImmEERKNS2_IT_T0_EERKNS2_IT1_T2_EE(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(16) %4)
  %17 = extractvalue { i64, i64 } %16, 0
  %18 = extractvalue { i64, i64 } %16, 1
  %19 = mul i128 %15, %10
  %.sroa.0.0.extract.trunc.us.us.us = trunc i128 %19 to i64
  %.sroa.2.0.extract.shift.us.us.us = lshr i128 %19, 64
  %.sroa.2.0.extract.trunc.us.us.us = trunc nuw i128 %.sroa.2.0.extract.shift.us.us.us to i64
  call void @_Z12VERIFY_EQUALN5Eigen8internal13TensorUInt128ImmEEo(i64 %17, i64 %18, i64 noundef %.sroa.0.0.extract.trunc.us.us.us, i64 noundef %.sroa.2.0.extract.trunc.us.us.us)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #4
  %20 = add i64 %.02831.us.us.us, %5
  %21 = icmp ult i64 %20, %6
  br i1 %21, label %13, label %._crit_edge.us.us.us, !llvm.loop !9

._crit_edge.us.us.us:                             ; preds = %13
  %22 = add nuw nsw i64 %.02732.us.us.us, 1
  %exitcond.not = icmp eq i64 %22, 100
  br i1 %exitcond.not, label %.split34.us.us.us, label %.preheader.us.us.us, !llvm.loop !11

.split34.us.us.us:                                ; preds = %._crit_edge.us.us.us
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #4
  %23 = add i64 %.02635.us.us, %5
  %24 = icmp ult i64 %23, %6
  br i1 %24, label %.split.us.us.us, label %._crit_edge.split.us.us, !llvm.loop !12

._crit_edge.split.us.us:                          ; preds = %.split34.us.us.us
  %25 = add nuw nsw i64 %.036.us, 1
  %exitcond40.not = icmp eq i64 %25, 100
  br i1 %exitcond40.not, label %.split38.us, label %.preheader30.us, !llvm.loop !13

.split38.us:                                      ; preds = %._crit_edge.split.us.us, %0
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare hidden { i64, i64 } @_ZN5Eigen8internalmlImmmmEENS0_13TensorUInt128ImmEERKNS2_IT_T0_EERKNS2_IT1_T2_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { inlinehint 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 = { alwaysinline 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 #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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}


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