; LLVM IR from InsightSoftwareConsortium/ITK :: Modules/ThirdParty/DoubleConversion/src/double-conversion (bignum)

; 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.double_conversion::Bignum" = type { i16, i16, [128 x i32] }

@.str.1 = external hidden unnamed_addr constant [131 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [18 x i8], align 1
@__PRETTY_FUNCTION__._ZN17double_conversion6Bignum5AlignERKS0_ = external hidden unnamed_addr constant [54 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [15 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZN17double_conversion6Bignum8RawBigitEi(ptr noundef nonnull align 4 dereferenceable(516), i32 noundef) #0 align 2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN17double_conversion6Bignum14EnsureCapacityEi(i32 noundef) #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN17double_conversion6Bignum5AlignERKS0_(ptr noundef nonnull align 4 dereferenceable(516) %0, ptr noundef nonnull align 4 dereferenceable(516) %1) #3 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %8 = load ptr, ptr %3, align 8
  %9 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %8, i32 0, i32 1
  %10 = load i16, ptr %9, align 2, !tbaa !9
  %11 = sext i16 %10 to i32
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %12, i32 0, i32 1
  %14 = load i16, ptr %13, align 2, !tbaa !9
  %15 = sext i16 %14 to i32
  %16 = icmp sgt i32 %11, %15
  br i1 %16, label %17, label %95

17:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %18 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %8, i32 0, i32 1
  %19 = load i16, ptr %18, align 2, !tbaa !9
  %20 = sext i16 %19 to i32
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %21, i32 0, i32 1
  %23 = load i16, ptr %22, align 2, !tbaa !9
  %24 = sext i16 %23 to i32
  %25 = sub nsw i32 %20, %24
  store i32 %25, ptr %5, align 4, !tbaa !12
  %26 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %8, i32 0, i32 0
  %27 = load i16, ptr %26, align 4, !tbaa !14
  %28 = sext i16 %27 to i32
  %29 = load i32, ptr %5, align 4, !tbaa !12
  %30 = add nsw i32 %28, %29
  call void @_ZN17double_conversion6Bignum14EnsureCapacityEi(i32 noundef %30)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %31 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %8, i32 0, i32 0
  %32 = load i16, ptr %31, align 4, !tbaa !14
  %33 = sext i16 %32 to i32
  %34 = sub nsw i32 %33, 1
  store i32 %34, ptr %6, align 4, !tbaa !12
  br label %35

35:                                               ; preds = %47, %17
  %36 = load i32, ptr %6, align 4, !tbaa !12
  %37 = icmp sge i32 %36, 0
  br i1 %37, label %39, label %38

38:                                               ; preds = %35
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %50

39:                                               ; preds = %35
  %40 = load i32, ptr %6, align 4, !tbaa !12
  %41 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN17double_conversion6Bignum8RawBigitEi(ptr noundef nonnull align 4 dereferenceable(516) %8, i32 noundef %40)
  %42 = load i32, ptr %41, align 4, !tbaa !12
  %43 = load i32, ptr %6, align 4, !tbaa !12
  %44 = load i32, ptr %5, align 4, !tbaa !12
  %45 = add nsw i32 %43, %44
  %46 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN17double_conversion6Bignum8RawBigitEi(ptr noundef nonnull align 4 dereferenceable(516) %8, i32 noundef %45)
  store i32 %42, ptr %46, align 4, !tbaa !12
  br label %47

47:                                               ; preds = %39
  %48 = load i32, ptr %6, align 4, !tbaa !12
  %49 = add nsw i32 %48, -1
  store i32 %49, ptr %6, align 4, !tbaa !12
  br label %35, !llvm.loop !15

50:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !12
  br label %51

51:                                               ; preds = %59, %50
  %52 = load i32, ptr %7, align 4, !tbaa !12
  %53 = load i32, ptr %5, align 4, !tbaa !12
  %54 = icmp slt i32 %52, %53
  br i1 %54, label %56, label %55

55:                                               ; preds = %51
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %62

56:                                               ; preds = %51
  %57 = load i32, ptr %7, align 4, !tbaa !12
  %58 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN17double_conversion6Bignum8RawBigitEi(ptr noundef nonnull align 4 dereferenceable(516) %8, i32 noundef %57)
  store i32 0, ptr %58, align 4, !tbaa !12
  br label %59

59:                                               ; preds = %56
  %60 = load i32, ptr %7, align 4, !tbaa !12
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr %7, align 4, !tbaa !12
  br label %51, !llvm.loop !17

62:                                               ; preds = %55
  %63 = load i32, ptr %5, align 4, !tbaa !12
  %64 = trunc i32 %63 to i16
  %65 = sext i16 %64 to i32
  %66 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %8, i32 0, i32 0
  %67 = load i16, ptr %66, align 4, !tbaa !14
  %68 = sext i16 %67 to i32
  %69 = add nsw i32 %68, %65
  %70 = trunc i32 %69 to i16
  store i16 %70, ptr %66, align 4, !tbaa !14
  %71 = load i32, ptr %5, align 4, !tbaa !12
  %72 = trunc i32 %71 to i16
  %73 = sext i16 %72 to i32
  %74 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %8, i32 0, i32 1
  %75 = load i16, ptr %74, align 2, !tbaa !9
  %76 = sext i16 %75 to i32
  %77 = sub nsw i32 %76, %73
  %78 = trunc i32 %77 to i16
  store i16 %78, ptr %74, align 2, !tbaa !9
  %79 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %8, i32 0, i32 0
  %80 = load i16, ptr %79, align 4, !tbaa !14
  %81 = sext i16 %80 to i32
  %82 = icmp sge i32 %81, 0
  br i1 %82, label %83, label %84

83:                                               ; preds = %62
  br label %86

84:                                               ; preds = %62
  call void @__assert_fail(ptr noundef @.str.23, ptr noundef @.str.1, i32 noundef 745, ptr noundef @__PRETTY_FUNCTION__._ZN17double_conversion6Bignum5AlignERKS0_) #5
  unreachable

85:                                               ; No predecessors!
  br label %86

86:                                               ; preds = %85, %83
  %87 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %8, i32 0, i32 1
  %88 = load i16, ptr %87, align 2, !tbaa !9
  %89 = sext i16 %88 to i32
  %90 = icmp sge i32 %89, 0
  br i1 %90, label %91, label %92

91:                                               ; preds = %86
  br label %94

92:                                               ; preds = %86
  call void @__assert_fail(ptr noundef @.str.24, ptr noundef @.str.1, i32 noundef 746, ptr noundef @__PRETTY_FUNCTION__._ZN17double_conversion6Bignum5AlignERKS0_) #5
  unreachable

93:                                               ; No predecessors!
  br label %94

94:                                               ; preds = %93, %91
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %95

95:                                               ; preds = %94, %2
  ret void
}

attributes #0 = { 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 = { noreturn 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { noreturn 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, !11, i64 2}
!10 = !{!"_ZTSN17double_conversion6BignumE", !11, i64 0, !11, i64 2, !7, i64 4}
!11 = !{!"short", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!10, !11, 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"

@.str.1 = external hidden unnamed_addr constant [131 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [18 x i8], align 1
@__PRETTY_FUNCTION__._ZN17double_conversion6Bignum5AlignERKS0_ = external hidden unnamed_addr constant [54 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [15 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZN17double_conversion6Bignum8RawBigitEi(ptr noundef nonnull align 4 dereferenceable(516), i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN17double_conversion6Bignum14EnsureCapacityEi(i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN17double_conversion6Bignum5AlignERKS0_(ptr noundef nonnull align 4 dereferenceable(516) %0, ptr nocapture noundef nonnull readonly align 4 dereferenceable(516) %1) local_unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 2
  %4 = load i16, ptr %3, align 2, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %1, i64 2
  %6 = load i16, ptr %5, align 2, !tbaa !5
  %7 = icmp sgt i16 %4, %6
  br i1 %7, label %8, label %36

8:                                                ; preds = %2
  %9 = sext i16 %6 to i32
  %10 = sext i16 %4 to i32
  %11 = sub nsw i32 %10, %9
  %12 = load i16, ptr %0, align 4, !tbaa !10
  %13 = sext i16 %12 to i32
  %14 = add nsw i32 %11, %13
  tail call void @_ZN17double_conversion6Bignum14EnsureCapacityEi(i32 noundef %14)
  %15 = load i16, ptr %0, align 4, !tbaa !10
  %16 = icmp sgt i16 %15, 0
  br i1 %16, label %.lr.ph.preheader, label %.preheader

.lr.ph.preheader:                                 ; preds = %8
  %17 = zext nneg i16 %15 to i32
  br label %.lr.ph

.preheader:                                       ; preds = %.lr.ph, %8
  %18 = icmp sgt i32 %11, 0
  br i1 %18, label %.lr.ph20, label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %.014.in18 = phi i32 [ %.014, %.lr.ph ], [ %17, %.lr.ph.preheader ]
  %.014 = add nsw i32 %.014.in18, -1
  %19 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN17double_conversion6Bignum8RawBigitEi(ptr noundef nonnull align 4 dereferenceable(516) %0, i32 noundef %.014)
  %20 = load i32, ptr %19, align 4, !tbaa !11
  %21 = add nsw i32 %.014, %11
  %22 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN17double_conversion6Bignum8RawBigitEi(ptr noundef nonnull align 4 dereferenceable(516) %0, i32 noundef %21)
  store i32 %20, ptr %22, align 4, !tbaa !11
  %23 = icmp ugt i32 %.014.in18, 1
  br i1 %23, label %.lr.ph, label %.preheader, !llvm.loop !13

._crit_edge:                                      ; preds = %.lr.ph20, %.preheader
  %24 = load i16, ptr %0, align 4, !tbaa !10
  %25 = trunc i32 %11 to i16
  %26 = add i16 %24, %25
  store i16 %26, ptr %0, align 4, !tbaa !10
  %27 = load i16, ptr %3, align 2, !tbaa !5
  %28 = sub i16 %27, %25
  store i16 %28, ptr %3, align 2, !tbaa !5
  %29 = icmp sgt i16 %26, -1
  br i1 %29, label %33, label %32

.lr.ph20:                                         ; preds = %.preheader, %.lr.ph20
  %.019 = phi i32 [ %31, %.lr.ph20 ], [ 0, %.preheader ]
  %30 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN17double_conversion6Bignum8RawBigitEi(ptr noundef nonnull align 4 dereferenceable(516) %0, i32 noundef %.019)
  store i32 0, ptr %30, align 4, !tbaa !11
  %31 = add nuw nsw i32 %.019, 1
  %exitcond.not = icmp eq i32 %31, %11
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph20, !llvm.loop !15

32:                                               ; preds = %._crit_edge
  tail call void @__assert_fail(ptr noundef nonnull @.str.23, ptr noundef nonnull @.str.1, i32 noundef 745, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN17double_conversion6Bignum5AlignERKS0_) #2
  unreachable

33:                                               ; preds = %._crit_edge
  %34 = icmp sgt i16 %28, -1
  br i1 %34, label %36, label %35

35:                                               ; preds = %33
  tail call void @__assert_fail(ptr noundef nonnull @.str.24, ptr noundef nonnull @.str.1, i32 noundef 746, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN17double_conversion6Bignum5AlignERKS0_) #2
  unreachable

36:                                               ; preds = %33, %2
  ret void
}

attributes #0 = { 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 = { noreturn 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 #2 = { noreturn 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, !7, i64 2}
!6 = !{!"_ZTSN17double_conversion6BignumE", !7, i64 0, !7, i64 2, !8, i64 4}
!7 = !{!"short", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!6, !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !8, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


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