; LLVM IR from iyinoluwamt/Tensorframe :: main/ios/Pods/DoubleConversion/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 { [128 x i32], %"class.double_conversion::Vector", i32, i32 }
%"class.double_conversion::Vector" = type <{ ptr, i32, [4 x i8] }>

@.str.1 = external hidden unnamed_addr constant [116 x i8], align 1
@.str.20 = 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.21 = external hidden unnamed_addr constant [15 x i8], align 1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNK17double_conversion6VectorIjEixEi(ptr noundef nonnull align 8 dereferenceable(12), i32 noundef) #1 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN17double_conversion6Bignum14EnsureCapacityEi(ptr noundef nonnull align 8 dereferenceable(536), i32 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN17double_conversion6Bignum5AlignERKS0_(ptr noundef nonnull align 8 dereferenceable(536) %0, ptr noundef nonnull align 8 dereferenceable(536) %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 3
  %10 = load i32, ptr %9, align 4, !tbaa !9
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %11, i32 0, i32 3
  %13 = load i32, ptr %12, align 4, !tbaa !9
  %14 = icmp sgt i32 %10, %13
  br i1 %14, label %15, label %82

15:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %16 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %8, i32 0, i32 3
  %17 = load i32, ptr %16, align 4, !tbaa !9
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %18, i32 0, i32 3
  %20 = load i32, ptr %19, align 4, !tbaa !9
  %21 = sub nsw i32 %17, %20
  store i32 %21, ptr %5, align 4, !tbaa !13
  %22 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %8, i32 0, i32 2
  %23 = load i32, ptr %22, align 8, !tbaa !14
  %24 = load i32, ptr %5, align 4, !tbaa !13
  %25 = add nsw i32 %23, %24
  call void @_ZN17double_conversion6Bignum14EnsureCapacityEi(ptr noundef nonnull align 8 dereferenceable(536) %8, i32 noundef %25)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %26 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %8, i32 0, i32 2
  %27 = load i32, ptr %26, align 8, !tbaa !14
  %28 = sub nsw i32 %27, 1
  store i32 %28, ptr %6, align 4, !tbaa !13
  br label %29

29:                                               ; preds = %43, %15
  %30 = load i32, ptr %6, align 4, !tbaa !13
  %31 = icmp sge i32 %30, 0
  br i1 %31, label %33, label %32

32:                                               ; preds = %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %46

33:                                               ; preds = %29
  %34 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %8, i32 0, i32 1
  %35 = load i32, ptr %6, align 4, !tbaa !13
  %36 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK17double_conversion6VectorIjEixEi(ptr noundef nonnull align 8 dereferenceable(12) %34, i32 noundef %35)
  %37 = load i32, ptr %36, align 4, !tbaa !13
  %38 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %8, i32 0, i32 1
  %39 = load i32, ptr %6, align 4, !tbaa !13
  %40 = load i32, ptr %5, align 4, !tbaa !13
  %41 = add nsw i32 %39, %40
  %42 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK17double_conversion6VectorIjEixEi(ptr noundef nonnull align 8 dereferenceable(12) %38, i32 noundef %41)
  store i32 %37, ptr %42, align 4, !tbaa !13
  br label %43

43:                                               ; preds = %33
  %44 = load i32, ptr %6, align 4, !tbaa !13
  %45 = add nsw i32 %44, -1
  store i32 %45, ptr %6, align 4, !tbaa !13
  br label %29, !llvm.loop !15

46:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !13
  br label %47

47:                                               ; preds = %56, %46
  %48 = load i32, ptr %7, align 4, !tbaa !13
  %49 = load i32, ptr %5, align 4, !tbaa !13
  %50 = icmp slt i32 %48, %49
  br i1 %50, label %52, label %51

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

52:                                               ; preds = %47
  %53 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %8, i32 0, i32 1
  %54 = load i32, ptr %7, align 4, !tbaa !13
  %55 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK17double_conversion6VectorIjEixEi(ptr noundef nonnull align 8 dereferenceable(12) %53, i32 noundef %54)
  store i32 0, ptr %55, align 4, !tbaa !13
  br label %56

56:                                               ; preds = %52
  %57 = load i32, ptr %7, align 4, !tbaa !13
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %7, align 4, !tbaa !13
  br label %47, !llvm.loop !17

59:                                               ; preds = %51
  %60 = load i32, ptr %5, align 4, !tbaa !13
  %61 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %8, i32 0, i32 2
  %62 = load i32, ptr %61, align 8, !tbaa !14
  %63 = add nsw i32 %62, %60
  store i32 %63, ptr %61, align 8, !tbaa !14
  %64 = load i32, ptr %5, align 4, !tbaa !13
  %65 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %8, i32 0, i32 3
  %66 = load i32, ptr %65, align 4, !tbaa !9
  %67 = sub nsw i32 %66, %64
  store i32 %67, ptr %65, align 4, !tbaa !9
  %68 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %8, i32 0, i32 2
  %69 = load i32, ptr %68, align 8, !tbaa !14
  %70 = icmp sge i32 %69, 0
  br i1 %70, label %71, label %72

71:                                               ; preds = %59
  br label %74

72:                                               ; preds = %59
  call void @__assert_fail(ptr noundef @.str.20, ptr noundef @.str.1, i32 noundef 716, ptr noundef @__PRETTY_FUNCTION__._ZN17double_conversion6Bignum5AlignERKS0_) #5
  unreachable

73:                                               ; No predecessors!
  br label %74

74:                                               ; preds = %73, %71
  %75 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %8, i32 0, i32 3
  %76 = load i32, ptr %75, align 4, !tbaa !9
  %77 = icmp sge i32 %76, 0
  br i1 %77, label %78, label %79

78:                                               ; preds = %74
  br label %81

79:                                               ; preds = %74
  call void @__assert_fail(ptr noundef @.str.21, ptr noundef @.str.1, i32 noundef 717, ptr noundef @__PRETTY_FUNCTION__._ZN17double_conversion6Bignum5AlignERKS0_) #5
  unreachable

80:                                               ; No predecessors!
  br label %81

81:                                               ; preds = %80, %78
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %82

82:                                               ; preds = %81, %2
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #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, !12, i64 532}
!10 = !{!"_ZTSN17double_conversion6BignumE", !7, i64 0, !11, i64 512, !12, i64 528, !12, i64 532}
!11 = !{!"_ZTSN17double_conversion6VectorIjEE", !6, i64 0, !12, i64 8}
!12 = !{!"int", !7, i64 0}
!13 = !{!12, !12, i64 0}
!14 = !{!10, !12, i64 528}
!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 [116 x i8], align 1
@.str.20 = 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.21 = 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 @_ZNK17double_conversion6VectorIjEixEi(ptr noundef nonnull align 8 dereferenceable(12), 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(ptr noundef nonnull align 8 dereferenceable(536), i32 noundef) local_unnamed_addr #0 align 2

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

8:                                                ; preds = %2
  %9 = sub nsw i32 %4, %6
  %10 = getelementptr inbounds i8, ptr %0, i64 528
  %11 = load i32, ptr %10, align 8, !tbaa !12
  %12 = add nsw i32 %11, %9
  tail call void @_ZN17double_conversion6Bignum14EnsureCapacityEi(ptr noundef nonnull align 8 dereferenceable(536) %0, i32 noundef %12)
  %13 = load i32, ptr %10, align 8, !tbaa !12
  %14 = icmp sgt i32 %13, 0
  br i1 %14, label %.lr.ph, label %.preheader

.lr.ph:                                           ; preds = %8
  %15 = getelementptr inbounds i8, ptr %0, i64 512
  br label %18

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

.lr.ph20:                                         ; preds = %.preheader
  %17 = getelementptr inbounds i8, ptr %0, i64 512
  br label %29

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

._crit_edge:                                      ; preds = %29, %.preheader
  %24 = load i32, ptr %10, align 8, !tbaa !12
  %25 = add nsw i32 %24, %9
  store i32 %25, ptr %10, align 8, !tbaa !12
  %26 = load i32, ptr %3, align 4, !tbaa !5
  %27 = sub nsw i32 %26, %9
  store i32 %27, ptr %3, align 4, !tbaa !5
  %28 = icmp sgt i32 %25, -1
  br i1 %28, label %33, label %32

29:                                               ; preds = %.lr.ph20, %29
  %.019 = phi i32 [ 0, %.lr.ph20 ], [ %31, %29 ]
  %30 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK17double_conversion6VectorIjEixEi(ptr noundef nonnull align 8 dereferenceable(12) %17, i32 noundef %.019)
  store i32 0, ptr %30, align 4, !tbaa !13
  %31 = add nuw nsw i32 %.019, 1
  %exitcond.not = icmp eq i32 %31, %9
  br i1 %exitcond.not, label %._crit_edge, label %29, !llvm.loop !16

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

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

35:                                               ; preds = %33
  tail call void @__assert_fail(ptr noundef nonnull @.str.21, ptr noundef nonnull @.str.1, i32 noundef 717, 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, !11, i64 532}
!6 = !{!"_ZTSN17double_conversion6BignumE", !7, i64 0, !9, i64 512, !11, i64 528, !11, i64 532}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!"_ZTSN17double_conversion6VectorIjEE", !10, i64 0, !11, i64 8}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{!6, !11, i64 528}
!13 = !{!11, !11, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}


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