; LLVM IR from wesley-a-leung/Resources :: Tests/C++/math/CombinatoricsFuzzTest.ll (Z6mulModooo)

; 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.Montgomery = type { i128, i128, i128 }
%"struct.Montgomery::u256" = type { i128, i128 }

@_ZZ6mulModoooE4mont = external hidden global %struct.Montgomery, align 16
@_ZGVZ6mulModoooE4mont = external hidden global i64, align 8

; Function Attrs: mustprogress uwtable
define dso_local noundef { i64, i64 } @_Z6mulModooo(i64 noundef %0, i64 noundef %1, i64 noundef %2, i64 noundef %3, i64 noundef %4, i64 noundef %5) #0 personality ptr @__gxx_personality_v0 {
  %7 = alloca i128, align 16
  %8 = alloca i128, align 16
  %9 = alloca i128, align 16
  %10 = alloca i128, align 16
  %11 = alloca i128, align 16
  %12 = alloca i128, align 16
  %13 = alloca i128, align 16
  %14 = alloca i128, align 16
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca %struct.Montgomery, align 16
  %18 = alloca i128, align 16
  %19 = alloca %"struct.Montgomery::u256", align 16
  %20 = alloca i128, align 16
  %21 = alloca i128, align 16
  %22 = alloca i128, align 16
  %23 = alloca i128, align 16
  %24 = alloca i128, align 16
  %25 = alloca i128, align 16
  %26 = alloca i128, align 16
  %27 = alloca i128, align 16
  %28 = alloca i128, align 16
  %29 = getelementptr inbounds { i64, i64 }, ptr %8, i32 0, i32 0
  store i64 %0, ptr %29, align 16
  %30 = getelementptr inbounds { i64, i64 }, ptr %8, i32 0, i32 1
  store i64 %1, ptr %30, align 8
  %31 = load i128, ptr %8, align 16, !tbaa !5
  %32 = getelementptr inbounds { i64, i64 }, ptr %9, i32 0, i32 0
  store i64 %2, ptr %32, align 16
  %33 = getelementptr inbounds { i64, i64 }, ptr %9, i32 0, i32 1
  store i64 %3, ptr %33, align 8
  %34 = load i128, ptr %9, align 16, !tbaa !5
  %35 = getelementptr inbounds { i64, i64 }, ptr %10, i32 0, i32 0
  store i64 %4, ptr %35, align 16
  %36 = getelementptr inbounds { i64, i64 }, ptr %10, i32 0, i32 1
  store i64 %5, ptr %36, align 8
  %37 = load i128, ptr %10, align 16, !tbaa !5
  store i128 %31, ptr %11, align 16, !tbaa !5
  store i128 %34, ptr %12, align 16, !tbaa !5
  store i128 %37, ptr %13, align 16, !tbaa !5
  %38 = load atomic i8, ptr @_ZGVZ6mulModoooE4mont acquire, align 8
  %39 = icmp eq i8 %38, 0
  br i1 %39, label %40, label %49, !prof !9

40:                                               ; preds = %6
  %41 = call i32 @__cxa_guard_acquire(ptr @_ZGVZ6mulModoooE4mont) #1
  %42 = icmp ne i32 %41, 0
  br i1 %42, label %43, label %49

43:                                               ; preds = %40
  store i128 1, ptr %14, align 16, !tbaa !5
  %44 = getelementptr inbounds { i64, i64 }, ptr %14, i32 0, i32 0
  %45 = load i64, ptr %44, align 16
  %46 = getelementptr inbounds { i64, i64 }, ptr %14, i32 0, i32 1
  %47 = load i64, ptr %46, align 8
  invoke void @_ZN10MontgomeryC2Eo(ptr noundef nonnull align 16 dereferenceable(48) @_ZZ6mulModoooE4mont, i64 noundef %45, i64 noundef %47)
          to label %48 unwind label %59

48:                                               ; preds = %43
  call void @__cxa_guard_release(ptr @_ZGVZ6mulModoooE4mont) #1
  br label %49

49:                                               ; preds = %48, %40, %6
  %50 = load i128, ptr @_ZZ6mulModoooE4mont, align 16, !tbaa !10
  %51 = load i128, ptr %13, align 16, !tbaa !5
  %52 = icmp ne i128 %50, %51
  br i1 %52, label %53, label %63

53:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 48, ptr %17) #1
  %54 = load i128, ptr %13, align 16, !tbaa !5
  store i128 %54, ptr %18, align 16, !tbaa !5
  %55 = getelementptr inbounds { i64, i64 }, ptr %18, i32 0, i32 0
  %56 = load i64, ptr %55, align 16
  %57 = getelementptr inbounds { i64, i64 }, ptr %18, i32 0, i32 1
  %58 = load i64, ptr %57, align 8
  call void @_ZN10MontgomeryC2Eo(ptr noundef nonnull align 16 dereferenceable(48) %17, i64 noundef %56, i64 noundef %58)
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 @_ZZ6mulModoooE4mont, ptr align 16 %17, i64 48, i1 false), !tbaa.struct !12
  call void @llvm.lifetime.end.p0(i64 48, ptr %17) #1
  br label %63

59:                                               ; preds = %43
  %60 = landingpad { ptr, i32 }
          cleanup
  %61 = extractvalue { ptr, i32 } %60, 0
  store ptr %61, ptr %15, align 8
  %62 = extractvalue { ptr, i32 } %60, 1
  store i32 %62, ptr %16, align 4
  call void @__cxa_guard_abort(ptr @_ZGVZ6mulModoooE4mont) #1
  br label %111

63:                                               ; preds = %53, %49
  %64 = load i128, ptr %11, align 16, !tbaa !5
  store i128 %64, ptr %20, align 16, !tbaa !5
  %65 = getelementptr inbounds { i64, i64 }, ptr %20, i32 0, i32 0
  %66 = load i64, ptr %65, align 16
  %67 = getelementptr inbounds { i64, i64 }, ptr %20, i32 0, i32 1
  %68 = load i64, ptr %67, align 8
  %69 = call noundef { i64, i64 } @_ZN10Montgomery4initEo(ptr noundef nonnull align 16 dereferenceable(48) @_ZZ6mulModoooE4mont, i64 noundef %66, i64 noundef %68)
  %70 = getelementptr inbounds { i64, i64 }, ptr %21, i32 0, i32 0
  %71 = extractvalue { i64, i64 } %69, 0
  store i64 %71, ptr %70, align 16
  %72 = getelementptr inbounds { i64, i64 }, ptr %21, i32 0, i32 1
  %73 = extractvalue { i64, i64 } %69, 1
  store i64 %73, ptr %72, align 8
  %74 = load i128, ptr %21, align 16, !tbaa !5
  %75 = load i128, ptr %12, align 16, !tbaa !5
  store i128 %75, ptr %22, align 16, !tbaa !5
  %76 = getelementptr inbounds { i64, i64 }, ptr %22, i32 0, i32 0
  %77 = load i64, ptr %76, align 16
  %78 = getelementptr inbounds { i64, i64 }, ptr %22, i32 0, i32 1
  %79 = load i64, ptr %78, align 8
  %80 = call noundef { i64, i64 } @_ZN10Montgomery4initEo(ptr noundef nonnull align 16 dereferenceable(48) @_ZZ6mulModoooE4mont, i64 noundef %77, i64 noundef %79)
  %81 = getelementptr inbounds { i64, i64 }, ptr %23, i32 0, i32 0
  %82 = extractvalue { i64, i64 } %80, 0
  store i64 %82, ptr %81, align 16
  %83 = getelementptr inbounds { i64, i64 }, ptr %23, i32 0, i32 1
  %84 = extractvalue { i64, i64 } %80, 1
  store i64 %84, ptr %83, align 8
  %85 = load i128, ptr %23, align 16, !tbaa !5
  store i128 %74, ptr %24, align 16, !tbaa !5
  %86 = getelementptr inbounds { i64, i64 }, ptr %24, i32 0, i32 0
  %87 = load i64, ptr %86, align 16
  %88 = getelementptr inbounds { i64, i64 }, ptr %24, i32 0, i32 1
  %89 = load i64, ptr %88, align 8
  store i128 %85, ptr %25, align 16, !tbaa !5
  %90 = getelementptr inbounds { i64, i64 }, ptr %25, i32 0, i32 0
  %91 = load i64, ptr %90, align 16
  %92 = getelementptr inbounds { i64, i64 }, ptr %25, i32 0, i32 1
  %93 = load i64, ptr %92, align 8
  %94 = call noundef { i64, i64 } @_ZN10Montgomery3mulEoo(ptr noundef nonnull align 16 dereferenceable(48) @_ZZ6mulModoooE4mont, i64 noundef %87, i64 noundef %89, i64 noundef %91, i64 noundef %93)
  %95 = getelementptr inbounds { i64, i64 }, ptr %26, i32 0, i32 0
  %96 = extractvalue { i64, i64 } %94, 0
  store i64 %96, ptr %95, align 16
  %97 = getelementptr inbounds { i64, i64 }, ptr %26, i32 0, i32 1
  %98 = extractvalue { i64, i64 } %94, 1
  store i64 %98, ptr %97, align 8
  %99 = load i128, ptr %26, align 16, !tbaa !5
  store i128 %99, ptr %27, align 16, !tbaa !5
  %100 = getelementptr inbounds { i64, i64 }, ptr %27, i32 0, i32 0
  %101 = load i64, ptr %100, align 16
  %102 = getelementptr inbounds { i64, i64 }, ptr %27, i32 0, i32 1
  %103 = load i64, ptr %102, align 8
  call void @_ZN10Montgomery4u256C2Eo(ptr noundef nonnull align 16 dereferenceable(32) %19, i64 noundef %101, i64 noundef %103)
  %104 = call noundef { i64, i64 } @_ZN10Montgomery6reduceENS_4u256E(ptr noundef nonnull align 16 dereferenceable(48) @_ZZ6mulModoooE4mont, ptr noundef byval(%"struct.Montgomery::u256") align 16 %19)
  %105 = getelementptr inbounds { i64, i64 }, ptr %28, i32 0, i32 0
  %106 = extractvalue { i64, i64 } %104, 0
  store i64 %106, ptr %105, align 16
  %107 = getelementptr inbounds { i64, i64 }, ptr %28, i32 0, i32 1
  %108 = extractvalue { i64, i64 } %104, 1
  store i64 %108, ptr %107, align 8
  %109 = load i128, ptr %28, align 16, !tbaa !5
  store i128 %109, ptr %7, align 16
  %110 = load { i64, i64 }, ptr %7, align 16
  ret { i64, i64 } %110

111:                                              ; preds = %59
  %112 = load ptr, ptr %15, align 8
  %113 = load i32, ptr %16, align 4
  %114 = insertvalue { ptr, i32 } poison, ptr %112, 0
  %115 = insertvalue { ptr, i32 } %114, i32 %113, 1
  resume { ptr, i32 } %115
}

; Function Attrs: nounwind
declare i32 @__cxa_guard_acquire(ptr) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10MontgomeryC2Eo(ptr noundef nonnull align 16 dereferenceable(48), i64 noundef, i64 noundef) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nounwind
declare void @__cxa_guard_abort(ptr) #1

; Function Attrs: nounwind
declare void @__cxa_guard_release(ptr) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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) #3

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef { i64, i64 } @_ZN10Montgomery6reduceENS_4u256E(ptr noundef nonnull align 16 dereferenceable(48), ptr noundef byval(%"struct.Montgomery::u256") align 16) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef { i64, i64 } @_ZN10Montgomery3mulEoo(ptr noundef nonnull align 16 dereferenceable(48), i64 noundef, i64 noundef, i64 noundef, i64 noundef) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef { i64, i64 } @_ZN10Montgomery4initEo(ptr noundef nonnull align 16 dereferenceable(48), i64 noundef, i64 noundef) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN10Montgomery4u256C2Eo(ptr noundef nonnull align 16 dereferenceable(32), i64 noundef, i64 noundef) unnamed_addr #4 align 2

attributes #0 = { 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 #1 = { nounwind }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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" }

!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 = !{!"__int128", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!"branch_weights", i32 1, i32 1048575}
!10 = !{!11, !6, i64 0}
!11 = !{!"_ZTS10Montgomery", !6, i64 0, !6, i64 16, !6, i64 32}
!12 = !{i64 0, i64 16, !5, i64 16, i64 16, !5, i64 32, i64 16, !5}


; 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.Montgomery = type { i128, i128, i128 }
%"struct.Montgomery::u256" = type { i128, i128 }

@_ZZ6mulModoooE4mont = external hidden global %struct.Montgomery, align 16
@_ZGVZ6mulModoooE4mont = external hidden global i64, align 8

; Function Attrs: mustprogress uwtable
define dso_local noundef { i64, i64 } @_Z6mulModooo(i64 noundef %0, i64 noundef %1, i64 noundef %2, i64 noundef %3, i64 noundef %4, i64 noundef %5) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %7 = alloca %struct.Montgomery, align 16
  %8 = alloca %"struct.Montgomery::u256", align 16
  %.sroa.226.0.insert.ext = zext i64 %5 to i128
  %.sroa.226.0.insert.shift = shl nuw i128 %.sroa.226.0.insert.ext, 64
  %.sroa.025.0.insert.ext = zext i64 %4 to i128
  %.sroa.025.0.insert.insert = or disjoint i128 %.sroa.226.0.insert.shift, %.sroa.025.0.insert.ext
  %9 = load atomic i8, ptr @_ZGVZ6mulModoooE4mont acquire, align 8
  %10 = icmp eq i8 %9, 0
  br i1 %10, label %11, label %15, !prof !5

11:                                               ; preds = %6
  %12 = tail call i32 @__cxa_guard_acquire(ptr nonnull @_ZGVZ6mulModoooE4mont) #5
  %.not = icmp eq i32 %12, 0
  br i1 %.not, label %15, label %13

13:                                               ; preds = %11
  invoke void @_ZN10MontgomeryC2Eo(ptr noundef nonnull align 16 dereferenceable(48) @_ZZ6mulModoooE4mont, i64 noundef 1, i64 noundef 0)
          to label %14 unwind label %18

14:                                               ; preds = %13
  tail call void @__cxa_guard_release(ptr nonnull @_ZGVZ6mulModoooE4mont) #5
  br label %15

15:                                               ; preds = %14, %11, %6
  %16 = load i128, ptr @_ZZ6mulModoooE4mont, align 16, !tbaa !6
  %.not33 = icmp eq i128 %16, %.sroa.025.0.insert.insert
  br i1 %.not33, label %20, label %17

17:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %7) #5
  call void @_ZN10MontgomeryC2Eo(ptr noundef nonnull align 16 dereferenceable(48) %7, i64 noundef %4, i64 noundef %5)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(48) @_ZZ6mulModoooE4mont, ptr noundef nonnull align 16 dereferenceable(48) %7, i64 48, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %7) #5
  br label %20

18:                                               ; preds = %13
  %19 = landingpad { ptr, i32 }
          cleanup
  tail call void @__cxa_guard_abort(ptr nonnull @_ZGVZ6mulModoooE4mont) #5
  resume { ptr, i32 } %19

20:                                               ; preds = %17, %15
  %21 = call noundef { i64, i64 } @_ZN10Montgomery4initEo(ptr noundef nonnull align 16 dereferenceable(48) @_ZZ6mulModoooE4mont, i64 noundef %0, i64 noundef %1)
  %22 = extractvalue { i64, i64 } %21, 0
  %23 = extractvalue { i64, i64 } %21, 1
  %24 = call noundef { i64, i64 } @_ZN10Montgomery4initEo(ptr noundef nonnull align 16 dereferenceable(48) @_ZZ6mulModoooE4mont, i64 noundef %2, i64 noundef %3)
  %25 = extractvalue { i64, i64 } %24, 0
  %26 = extractvalue { i64, i64 } %24, 1
  %27 = call noundef { i64, i64 } @_ZN10Montgomery3mulEoo(ptr noundef nonnull align 16 dereferenceable(48) @_ZZ6mulModoooE4mont, i64 noundef %22, i64 noundef %23, i64 noundef %25, i64 noundef %26)
  %28 = extractvalue { i64, i64 } %27, 0
  %29 = extractvalue { i64, i64 } %27, 1
  call void @_ZN10Montgomery4u256C2Eo(ptr noundef nonnull align 16 dereferenceable(32) %8, i64 noundef %28, i64 noundef %29)
  %30 = call noundef { i64, i64 } @_ZN10Montgomery6reduceENS_4u256E(ptr noundef nonnull align 16 dereferenceable(48) @_ZZ6mulModoooE4mont, ptr noundef nonnull byval(%"struct.Montgomery::u256") align 16 %8)
  ret { i64, i64 } %30
}

; Function Attrs: nofree nounwind
declare i32 @__cxa_guard_acquire(ptr) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10MontgomeryC2Eo(ptr noundef nonnull align 16 dereferenceable(48), i64 noundef, i64 noundef) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nofree nounwind
declare void @__cxa_guard_abort(ptr) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare void @__cxa_guard_release(ptr) local_unnamed_addr #1

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

; Function Attrs: mustprogress 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) #3

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef { i64, i64 } @_ZN10Montgomery6reduceENS_4u256E(ptr noundef nonnull align 16 dereferenceable(48), ptr noundef byval(%"struct.Montgomery::u256") align 16) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef { i64, i64 } @_ZN10Montgomery3mulEoo(ptr noundef nonnull align 16 dereferenceable(48), i64 noundef, i64 noundef, i64 noundef, i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef { i64, i64 } @_ZN10Montgomery4initEo(ptr noundef nonnull align 16 dereferenceable(48), i64 noundef, i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN10Montgomery4u256C2Eo(ptr noundef nonnull align 16 dereferenceable(32), i64 noundef, i64 noundef) unnamed_addr #4 align 2

attributes #0 = { 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 #1 = { nofree nounwind }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #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 = !{!"branch_weights", i32 1, i32 1048575}
!6 = !{!7, !8, i64 0}
!7 = !{!"_ZTS10Montgomery", !8, i64 0, !8, i64 16, !8, i64 32}
!8 = !{!"__int128", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{i64 0, i64 16, !12, i64 16, i64 16, !12, i64 32, i64 16, !12}
!12 = !{!8, !8, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass