; LLVM IR from ftylitak/qzxing :: src/zxing/bigint/BigIntegerAlgorithms.ll (Z17extendedEuclidean10BigIntegerS_RS_S0_S0_)

; 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.BigInteger = type { i32, %class.BigUnsigned }
%class.BigUnsigned = type { %class.NumberlikeArray }
%class.NumberlikeArray = type { i32, i32, ptr }

@.str = external hidden unnamed_addr constant [50 x i8], align 1
@_ZTIPKc = external constant ptr

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

declare i32 @__gxx_personality_v0(...)

; 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 @_Z17extendedEuclidean10BigIntegerS_RS_S0_S0_(ptr noundef %0, ptr noundef %1, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %4) #1 personality ptr @__gxx_personality_v0 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca %class.BigInteger, align 8
  %12 = alloca %class.BigInteger, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca %class.BigInteger, align 8
  %16 = alloca %class.BigInteger, align 8
  %17 = alloca %class.BigInteger, align 8
  %18 = alloca i32, align 4
  %19 = alloca %class.BigInteger, align 8
  %20 = alloca %class.BigInteger, align 8
  %21 = alloca %class.BigInteger, align 8
  %22 = alloca %class.BigInteger, 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 ptr %4, ptr %10, align 8, !tbaa !5
  %23 = load ptr, ptr %8, align 8, !tbaa !5
  %24 = load ptr, ptr %9, align 8, !tbaa !5
  %25 = icmp eq ptr %23, %24
  br i1 %25, label %34, label %26

26:                                               ; preds = %5
  %27 = load ptr, ptr %8, align 8, !tbaa !5
  %28 = load ptr, ptr %10, align 8, !tbaa !5
  %29 = icmp eq ptr %27, %28
  br i1 %29, label %34, label %30

30:                                               ; preds = %26
  %31 = load ptr, ptr %9, align 8, !tbaa !5
  %32 = load ptr, ptr %10, align 8, !tbaa !5
  %33 = icmp eq ptr %31, %32
  br i1 %33, label %34, label %36

34:                                               ; preds = %30, %26, %5
  %35 = call ptr @__cxa_allocate_exception(i64 8) #6
  store ptr @.str, ptr %35, align 16, !tbaa !5
  call void @__cxa_throw(ptr %35, ptr @_ZTIPKc, ptr null) #7
  unreachable

36:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 24, ptr %11) #6
  call void @_ZN10BigIntegerC1Ei(ptr noundef nonnull align 8 dereferenceable(24) %11, i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 24, ptr %12) #6
  invoke void @_ZN10BigIntegerC1Ei(ptr noundef nonnull align 8 dereferenceable(24) %12, i32 noundef 0)
          to label %37 unwind label %51

37:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 24, ptr %15) #6
  invoke void @_ZN10BigIntegerC1Ei(ptr noundef nonnull align 8 dereferenceable(24) %15, i32 noundef 0)
          to label %38 unwind label %55

38:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 24, ptr %16) #6
  invoke void @_ZN10BigIntegerC1Ei(ptr noundef nonnull align 8 dereferenceable(24) %16, i32 noundef 1)
          to label %39 unwind label %59

39:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 24, ptr %17) #6
  invoke void @_ZN10BigIntegerC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %17)
          to label %40 unwind label %63

40:                                               ; preds = %39
  br label %41

41:                                               ; preds = %109, %40
  %42 = invoke noundef zeroext i1 @_ZNK10BigInteger6isZeroEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
          to label %43 unwind label %67

43:                                               ; preds = %41
  br i1 %42, label %44, label %71

44:                                               ; preds = %43
  %45 = load ptr, ptr %9, align 8, !tbaa !5
  invoke void @_ZN10BigIntegeraSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %45, ptr noundef nonnull align 8 dereferenceable(24) %11)
          to label %46 unwind label %67

46:                                               ; preds = %44
  %47 = load ptr, ptr %10, align 8, !tbaa !5
  invoke void @_ZN10BigIntegeraSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %47, ptr noundef nonnull align 8 dereferenceable(24) %12)
          to label %48 unwind label %67

48:                                               ; preds = %46
  %49 = load ptr, ptr %8, align 8, !tbaa !5
  invoke void @_ZN10BigIntegeraSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %49, ptr noundef nonnull align 8 dereferenceable(24) %0)
          to label %50 unwind label %67

50:                                               ; preds = %48
  store i32 1, ptr %18, align 4
  br label %128

51:                                               ; preds = %36
  %52 = landingpad { ptr, i32 }
          cleanup
  %53 = extractvalue { ptr, i32 } %52, 0
  store ptr %53, ptr %13, align 8
  %54 = extractvalue { ptr, i32 } %52, 1
  store i32 %54, ptr %14, align 4
  br label %133

55:                                               ; preds = %37
  %56 = landingpad { ptr, i32 }
          cleanup
  %57 = extractvalue { ptr, i32 } %56, 0
  store ptr %57, ptr %13, align 8
  %58 = extractvalue { ptr, i32 } %56, 1
  store i32 %58, ptr %14, align 4
  br label %132

59:                                               ; preds = %38
  %60 = landingpad { ptr, i32 }
          cleanup
  %61 = extractvalue { ptr, i32 } %60, 0
  store ptr %61, ptr %13, align 8
  %62 = extractvalue { ptr, i32 } %60, 1
  store i32 %62, ptr %14, align 4
  br label %131

63:                                               ; preds = %39
  %64 = landingpad { ptr, i32 }
          cleanup
  %65 = extractvalue { ptr, i32 } %64, 0
  store ptr %65, ptr %13, align 8
  %66 = extractvalue { ptr, i32 } %64, 1
  store i32 %66, ptr %14, align 4
  br label %130

67:                                               ; preds = %104, %83, %81, %79, %76, %71, %48, %46, %44, %41
  %68 = landingpad { ptr, i32 }
          cleanup
  %69 = extractvalue { ptr, i32 } %68, 0
  store ptr %69, ptr %13, align 8
  %70 = extractvalue { ptr, i32 } %68, 1
  store i32 %70, ptr %14, align 4
  br label %129

71:                                               ; preds = %43
  invoke void @_ZN10BigInteger19divideWithRemainderERKS_RS_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %17)
          to label %72 unwind label %67

72:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 24, ptr %19) #6
  invoke void @_ZNK10BigIntegermlERKS_(ptr dead_on_unwind writable sret(%class.BigInteger) align 8 %19, ptr noundef nonnull align 8 dereferenceable(24) %17, ptr noundef nonnull align 8 dereferenceable(24) %15)
          to label %73 unwind label %86

73:                                               ; preds = %72
  invoke void @_ZN10BigIntegermIERKS_(ptr noundef nonnull align 8 dereferenceable(24) %11, ptr noundef nonnull align 8 dereferenceable(24) %19)
          to label %74 unwind label %90

74:                                               ; preds = %73
  call void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %19) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %19) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr %20) #6
  invoke void @_ZNK10BigIntegermlERKS_(ptr dead_on_unwind writable sret(%class.BigInteger) align 8 %20, ptr noundef nonnull align 8 dereferenceable(24) %17, ptr noundef nonnull align 8 dereferenceable(24) %16)
          to label %75 unwind label %95

75:                                               ; preds = %74
  invoke void @_ZN10BigIntegermIERKS_(ptr noundef nonnull align 8 dereferenceable(24) %12, ptr noundef nonnull align 8 dereferenceable(24) %20)
          to label %76 unwind label %99

76:                                               ; preds = %75
  call void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %20) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %20) #6
  %77 = invoke noundef zeroext i1 @_ZNK10BigInteger6isZeroEv(ptr noundef nonnull align 8 dereferenceable(24) %0)
          to label %78 unwind label %67

78:                                               ; preds = %76
  br i1 %77, label %79, label %104

79:                                               ; preds = %78
  %80 = load ptr, ptr %9, align 8, !tbaa !5
  invoke void @_ZN10BigIntegeraSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %80, ptr noundef nonnull align 8 dereferenceable(24) %15)
          to label %81 unwind label %67

81:                                               ; preds = %79
  %82 = load ptr, ptr %10, align 8, !tbaa !5
  invoke void @_ZN10BigIntegeraSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %82, ptr noundef nonnull align 8 dereferenceable(24) %16)
          to label %83 unwind label %67

83:                                               ; preds = %81
  %84 = load ptr, ptr %8, align 8, !tbaa !5
  invoke void @_ZN10BigIntegeraSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %84, ptr noundef nonnull align 8 dereferenceable(24) %1)
          to label %85 unwind label %67

85:                                               ; preds = %83
  store i32 1, ptr %18, align 4
  br label %128

86:                                               ; preds = %72
  %87 = landingpad { ptr, i32 }
          cleanup
  %88 = extractvalue { ptr, i32 } %87, 0
  store ptr %88, ptr %13, align 8
  %89 = extractvalue { ptr, i32 } %87, 1
  store i32 %89, ptr %14, align 4
  br label %94

90:                                               ; preds = %73
  %91 = landingpad { ptr, i32 }
          cleanup
  %92 = extractvalue { ptr, i32 } %91, 0
  store ptr %92, ptr %13, align 8
  %93 = extractvalue { ptr, i32 } %91, 1
  store i32 %93, ptr %14, align 4
  call void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %19) #6
  br label %94

94:                                               ; preds = %90, %86
  call void @llvm.lifetime.end.p0(i64 24, ptr %19) #6
  br label %129

95:                                               ; preds = %74
  %96 = landingpad { ptr, i32 }
          cleanup
  %97 = extractvalue { ptr, i32 } %96, 0
  store ptr %97, ptr %13, align 8
  %98 = extractvalue { ptr, i32 } %96, 1
  store i32 %98, ptr %14, align 4
  br label %103

99:                                               ; preds = %75
  %100 = landingpad { ptr, i32 }
          cleanup
  %101 = extractvalue { ptr, i32 } %100, 0
  store ptr %101, ptr %13, align 8
  %102 = extractvalue { ptr, i32 } %100, 1
  store i32 %102, ptr %14, align 4
  call void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %20) #6
  br label %103

103:                                              ; preds = %99, %95
  call void @llvm.lifetime.end.p0(i64 24, ptr %20) #6
  br label %129

104:                                              ; preds = %78
  invoke void @_ZN10BigInteger19divideWithRemainderERKS_RS_(ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %17)
          to label %105 unwind label %67

105:                                              ; preds = %104
  call void @llvm.lifetime.start.p0(i64 24, ptr %21) #6
  invoke void @_ZNK10BigIntegermlERKS_(ptr dead_on_unwind writable sret(%class.BigInteger) align 8 %21, ptr noundef nonnull align 8 dereferenceable(24) %17, ptr noundef nonnull align 8 dereferenceable(24) %11)
          to label %106 unwind label %110

106:                                              ; preds = %105
  invoke void @_ZN10BigIntegermIERKS_(ptr noundef nonnull align 8 dereferenceable(24) %15, ptr noundef nonnull align 8 dereferenceable(24) %21)
          to label %107 unwind label %114

107:                                              ; preds = %106
  call void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %21) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %21) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr %22) #6
  invoke void @_ZNK10BigIntegermlERKS_(ptr dead_on_unwind writable sret(%class.BigInteger) align 8 %22, ptr noundef nonnull align 8 dereferenceable(24) %17, ptr noundef nonnull align 8 dereferenceable(24) %12)
          to label %108 unwind label %119

108:                                              ; preds = %107
  invoke void @_ZN10BigIntegermIERKS_(ptr noundef nonnull align 8 dereferenceable(24) %16, ptr noundef nonnull align 8 dereferenceable(24) %22)
          to label %109 unwind label %123

109:                                              ; preds = %108
  call void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %22) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %22) #6
  br label %41, !llvm.loop !9

110:                                              ; preds = %105
  %111 = landingpad { ptr, i32 }
          cleanup
  %112 = extractvalue { ptr, i32 } %111, 0
  store ptr %112, ptr %13, align 8
  %113 = extractvalue { ptr, i32 } %111, 1
  store i32 %113, ptr %14, align 4
  br label %118

114:                                              ; preds = %106
  %115 = landingpad { ptr, i32 }
          cleanup
  %116 = extractvalue { ptr, i32 } %115, 0
  store ptr %116, ptr %13, align 8
  %117 = extractvalue { ptr, i32 } %115, 1
  store i32 %117, ptr %14, align 4
  call void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %21) #6
  br label %118

118:                                              ; preds = %114, %110
  call void @llvm.lifetime.end.p0(i64 24, ptr %21) #6
  br label %129

119:                                              ; preds = %107
  %120 = landingpad { ptr, i32 }
          cleanup
  %121 = extractvalue { ptr, i32 } %120, 0
  store ptr %121, ptr %13, align 8
  %122 = extractvalue { ptr, i32 } %120, 1
  store i32 %122, ptr %14, align 4
  br label %127

123:                                              ; preds = %108
  %124 = landingpad { ptr, i32 }
          cleanup
  %125 = extractvalue { ptr, i32 } %124, 0
  store ptr %125, ptr %13, align 8
  %126 = extractvalue { ptr, i32 } %124, 1
  store i32 %126, ptr %14, align 4
  call void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %22) #6
  br label %127

127:                                              ; preds = %123, %119
  call void @llvm.lifetime.end.p0(i64 24, ptr %22) #6
  br label %129

128:                                              ; preds = %85, %50
  call void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %17) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %17) #6
  call void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %16) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %16) #6
  call void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %15) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %15) #6
  call void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #6
  call void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %11) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #6
  ret void

129:                                              ; preds = %127, %118, %103, %94, %67
  call void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %17) #6
  br label %130

130:                                              ; preds = %129, %63
  call void @llvm.lifetime.end.p0(i64 24, ptr %17) #6
  call void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %16) #6
  br label %131

131:                                              ; preds = %130, %59
  call void @llvm.lifetime.end.p0(i64 24, ptr %16) #6
  call void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %15) #6
  br label %132

132:                                              ; preds = %131, %55
  call void @llvm.lifetime.end.p0(i64 24, ptr %15) #6
  call void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #6
  br label %133

133:                                              ; preds = %132, %51
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #6
  call void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %11) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #6
  br label %134

134:                                              ; preds = %133
  %135 = load ptr, ptr %13, align 8
  %136 = load i32, ptr %14, align 4
  %137 = insertvalue { ptr, i32 } poison, ptr %135, 0
  %138 = insertvalue { ptr, i32 } %137, i32 %136, 1
  resume { ptr, i32 } %138
}

declare ptr @__cxa_allocate_exception(i64)

declare void @__cxa_throw(ptr, ptr, ptr)

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10BigIntegerC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK10BigInteger6isZeroEv(ptr noundef nonnull align 8 dereferenceable(24)) #3 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK10BigIntegermlERKS_(ptr dead_on_unwind noalias writable sret(%class.BigInteger) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN10BigIntegermIERKS_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #5 align 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 = { "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 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 = { 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 #5 = { 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 #6 = { nounwind }
attributes #7 = { noreturn }

!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 = distinct !{!9, !10}
!10 = !{!"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"

%class.BigInteger = type { i32, %class.BigUnsigned }
%class.BigUnsigned = type { %class.NumberlikeArray }
%class.NumberlikeArray = type { i32, i32, ptr }

@.str = external hidden unnamed_addr constant [50 x i8], align 1
@_ZTIPKc = external constant ptr

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

declare i32 @__gxx_personality_v0(...)

; 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
define dso_local void @_Z17extendedEuclidean10BigIntegerS_RS_S0_S0_(ptr noundef %0, ptr noundef %1, ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %4) local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %6 = alloca %class.BigInteger, align 8
  %7 = alloca %class.BigInteger, align 8
  %8 = alloca %class.BigInteger, align 8
  %9 = alloca %class.BigInteger, align 8
  %10 = alloca %class.BigInteger, align 8
  %11 = alloca %class.BigInteger, align 8
  %12 = alloca %class.BigInteger, align 8
  %13 = alloca %class.BigInteger, align 8
  %14 = alloca %class.BigInteger, align 8
  %15 = icmp eq ptr %2, %3
  %16 = icmp eq ptr %2, %4
  %or.cond = or i1 %15, %16
  %17 = icmp eq ptr %3, %4
  %or.cond38 = or i1 %17, %or.cond
  br i1 %or.cond38, label %18, label %20

18:                                               ; preds = %5
  %19 = tail call ptr @__cxa_allocate_exception(i64 8) #6
  store ptr @.str, ptr %19, align 16, !tbaa !5
  tail call void @__cxa_throw(ptr nonnull %19, ptr nonnull @_ZTIPKc, ptr null) #7
  unreachable

20:                                               ; preds = %5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #6
  call void @_ZN10BigIntegerC1Ei(ptr noundef nonnull align 8 dereferenceable(24) %6, i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #6
  invoke void @_ZN10BigIntegerC1Ei(ptr noundef nonnull align 8 dereferenceable(24) %7, i32 noundef 0)
          to label %21 unwind label %27

21:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8) #6
  invoke void @_ZN10BigIntegerC1Ei(ptr noundef nonnull align 8 dereferenceable(24) %8, i32 noundef 0)
          to label %22 unwind label %29

22:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %9) #6
  invoke void @_ZN10BigIntegerC1Ei(ptr noundef nonnull align 8 dereferenceable(24) %9, i32 noundef 1)
          to label %23 unwind label %31

23:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %10) #6
  invoke void @_ZN10BigIntegerC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %10)
          to label %.preheader unwind label %33

.preheader:                                       ; preds = %23
  %24 = call noundef zeroext i1 @_ZNK10BigInteger6isZeroEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  br i1 %24, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %58, %.preheader
  invoke void @_ZN10BigIntegeraSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %6)
          to label %25 unwind label %.loopexit.split-lp

25:                                               ; preds = %._crit_edge
  invoke void @_ZN10BigIntegeraSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(24) %7)
          to label %.invoke unwind label %.loopexit.split-lp

.invoke:                                          ; preds = %25, %42
  %26 = phi ptr [ %1, %42 ], [ %0, %25 ]
  invoke void @_ZN10BigIntegeraSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(24) %26)
          to label %70 unwind label %.loopexit.split-lp

27:                                               ; preds = %20
  %28 = landingpad { ptr, i32 }
          cleanup
  br label %75

29:                                               ; preds = %21
  %30 = landingpad { ptr, i32 }
          cleanup
  br label %74

31:                                               ; preds = %22
  %32 = landingpad { ptr, i32 }
          cleanup
  br label %73

33:                                               ; preds = %23
  %34 = landingpad { ptr, i32 }
          cleanup
  br label %72

.loopexit:                                        ; preds = %.lr.ph, %53
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %71

.loopexit.split-lp:                               ; preds = %.invoke, %._crit_edge, %25, %41, %42
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %71

.lr.ph:                                           ; preds = %.preheader, %58
  invoke void @_ZN10BigInteger19divideWithRemainderERKS_RS_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %10)
          to label %35 unwind label %.loopexit

35:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %11) #6
  invoke void @_ZNK10BigIntegermlERKS_(ptr dead_on_unwind nonnull writable sret(%class.BigInteger) align 8 %11, ptr noundef nonnull align 8 dereferenceable(24) %10, ptr noundef nonnull align 8 dereferenceable(24) %8)
          to label %36 unwind label %43

36:                                               ; preds = %35
  invoke void @_ZN10BigIntegermIERKS_(ptr noundef nonnull align 8 dereferenceable(24) %6, ptr noundef nonnull align 8 dereferenceable(24) %11)
          to label %37 unwind label %45

37:                                               ; preds = %36
  call void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %11) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %11) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %12) #6
  invoke void @_ZNK10BigIntegermlERKS_(ptr dead_on_unwind nonnull writable sret(%class.BigInteger) align 8 %12, ptr noundef nonnull align 8 dereferenceable(24) %10, ptr noundef nonnull align 8 dereferenceable(24) %9)
          to label %38 unwind label %48

38:                                               ; preds = %37
  invoke void @_ZN10BigIntegermIERKS_(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef nonnull align 8 dereferenceable(24) %12)
          to label %39 unwind label %50

39:                                               ; preds = %38
  call void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %12) #6
  %40 = call noundef zeroext i1 @_ZNK10BigInteger6isZeroEv(ptr noundef nonnull align 8 dereferenceable(24) %0)
  br i1 %40, label %41, label %53

41:                                               ; preds = %39
  invoke void @_ZN10BigIntegeraSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %8)
          to label %42 unwind label %.loopexit.split-lp

42:                                               ; preds = %41
  invoke void @_ZN10BigIntegeraSERKS_(ptr noundef nonnull align 8 dereferenceable(24) %4, ptr noundef nonnull align 8 dereferenceable(24) %9)
          to label %.invoke unwind label %.loopexit.split-lp

43:                                               ; preds = %35
  %44 = landingpad { ptr, i32 }
          cleanup
  br label %47

45:                                               ; preds = %36
  %46 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %11) #6
  br label %47

47:                                               ; preds = %45, %43
  %.pn = phi { ptr, i32 } [ %46, %45 ], [ %44, %43 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %11) #6
  br label %71

48:                                               ; preds = %37
  %49 = landingpad { ptr, i32 }
          cleanup
  br label %52

50:                                               ; preds = %38
  %51 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #6
  br label %52

52:                                               ; preds = %50, %48
  %.pn26 = phi { ptr, i32 } [ %51, %50 ], [ %49, %48 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %12) #6
  br label %71

53:                                               ; preds = %39
  invoke void @_ZN10BigInteger19divideWithRemainderERKS_RS_(ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %10)
          to label %54 unwind label %.loopexit

54:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %13) #6
  invoke void @_ZNK10BigIntegermlERKS_(ptr dead_on_unwind nonnull writable sret(%class.BigInteger) align 8 %13, ptr noundef nonnull align 8 dereferenceable(24) %10, ptr noundef nonnull align 8 dereferenceable(24) %6)
          to label %55 unwind label %60

55:                                               ; preds = %54
  invoke void @_ZN10BigIntegermIERKS_(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef nonnull align 8 dereferenceable(24) %13)
          to label %56 unwind label %62

56:                                               ; preds = %55
  call void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %13) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %13) #6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %14) #6
  invoke void @_ZNK10BigIntegermlERKS_(ptr dead_on_unwind nonnull writable sret(%class.BigInteger) align 8 %14, ptr noundef nonnull align 8 dereferenceable(24) %10, ptr noundef nonnull align 8 dereferenceable(24) %7)
          to label %57 unwind label %65

57:                                               ; preds = %56
  invoke void @_ZN10BigIntegermIERKS_(ptr noundef nonnull align 8 dereferenceable(24) %9, ptr noundef nonnull align 8 dereferenceable(24) %14)
          to label %58 unwind label %67

58:                                               ; preds = %57
  call void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %14) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %14) #6
  %59 = call noundef zeroext i1 @_ZNK10BigInteger6isZeroEv(ptr noundef nonnull align 8 dereferenceable(24) %1)
  br i1 %59, label %._crit_edge, label %.lr.ph, !llvm.loop !9

60:                                               ; preds = %54
  %61 = landingpad { ptr, i32 }
          cleanup
  br label %64

62:                                               ; preds = %55
  %63 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %13) #6
  br label %64

64:                                               ; preds = %62, %60
  %.pn28 = phi { ptr, i32 } [ %63, %62 ], [ %61, %60 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %13) #6
  br label %71

65:                                               ; preds = %56
  %66 = landingpad { ptr, i32 }
          cleanup
  br label %69

67:                                               ; preds = %57
  %68 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %14) #6
  br label %69

69:                                               ; preds = %67, %65
  %.pn30 = phi { ptr, i32 } [ %68, %67 ], [ %66, %65 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %14) #6
  br label %71

70:                                               ; preds = %.invoke
  call void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %10) #6
  call void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %9) #6
  call void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %8) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #6
  call void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #6
  call void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #6
  ret void

71:                                               ; preds = %.loopexit, %.loopexit.split-lp, %69, %64, %52, %47
  %.pn32 = phi { ptr, i32 } [ %.pn30, %69 ], [ %.pn28, %64 ], [ %.pn26, %52 ], [ %.pn, %47 ], [ %lpad.loopexit, %.loopexit ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #6
  br label %72

72:                                               ; preds = %71, %33
  %.pn32.pn = phi { ptr, i32 } [ %.pn32, %71 ], [ %34, %33 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %10) #6
  call void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %9) #6
  br label %73

73:                                               ; preds = %72, %31
  %.pn32.pn.pn = phi { ptr, i32 } [ %.pn32.pn, %72 ], [ %32, %31 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %9) #6
  call void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %8) #6
  br label %74

74:                                               ; preds = %73, %29
  %.pn32.pn.pn.pn = phi { ptr, i32 } [ %.pn32.pn.pn, %73 ], [ %30, %29 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8) #6
  call void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #6
  br label %75

75:                                               ; preds = %74, %27
  %.pn32.pn.pn.pn.pn = phi { ptr, i32 } [ %.pn32.pn.pn.pn, %74 ], [ %28, %27 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #6
  call void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #6
  resume { ptr, i32 } %.pn32.pn.pn.pn.pn
}

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

declare void @__cxa_throw(ptr, ptr, ptr) local_unnamed_addr

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10BigIntegerC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK10BigInteger6isZeroEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK10BigIntegermlERKS_(ptr dead_on_unwind noalias writable sret(%class.BigInteger) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN10BigIntegermIERKS_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN10BigIntegerD2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #5 align 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 = { "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 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 = { 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 #5 = { 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 #6 = { nounwind }
attributes #7 = { noreturn }

!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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


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