; 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.17 = external hidden unnamed_addr constant [14 x i8], align 1
@__PRETTY_FUNCTION__._ZN17double_conversion6Bignum7CompareERKS0_S2_ = external hidden unnamed_addr constant [78 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [14 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: 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) #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK17double_conversion6Bignum9IsClampedEv(ptr noundef nonnull align 8 dereferenceable(536)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK17double_conversion6Bignum11BigitLengthEv(ptr noundef nonnull align 8 dereferenceable(536)) #3 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN17double_conversion6Bignum7CompareERKS0_S2_(ptr noundef nonnull align 8 dereferenceable(536) %0, ptr noundef nonnull align 8 dereferenceable(536) %1) #2 align 2 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = call noundef zeroext i1 @_ZNK17double_conversion6Bignum9IsClampedEv(ptr noundef nonnull align 8 dereferenceable(536) %12)
  br i1 %13, label %14, label %15

14:                                               ; preds = %2
  br label %17

15:                                               ; preds = %2
  call void @__assert_fail(ptr noundef @.str.17, ptr noundef @.str.1, i32 noundef 619, ptr noundef @__PRETTY_FUNCTION__._ZN17double_conversion6Bignum7CompareERKS0_S2_) #4
  unreachable

16:                                               ; No predecessors!
  br label %17

17:                                               ; preds = %16, %14
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = call noundef zeroext i1 @_ZNK17double_conversion6Bignum9IsClampedEv(ptr noundef nonnull align 8 dereferenceable(536) %18)
  br i1 %19, label %20, label %21

20:                                               ; preds = %17
  br label %23

21:                                               ; preds = %17
  call void @__assert_fail(ptr noundef @.str.18, ptr noundef @.str.1, i32 noundef 620, ptr noundef @__PRETTY_FUNCTION__._ZN17double_conversion6Bignum7CompareERKS0_S2_) #4
  unreachable

22:                                               ; No predecessors!
  br label %23

23:                                               ; preds = %22, %20
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = call noundef i32 @_ZNK17double_conversion6Bignum11BigitLengthEv(ptr noundef nonnull align 8 dereferenceable(536) %24)
  store i32 %25, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = call noundef i32 @_ZNK17double_conversion6Bignum11BigitLengthEv(ptr noundef nonnull align 8 dereferenceable(536) %26)
  store i32 %27, ptr %7, align 4, !tbaa !9
  %28 = load i32, ptr %6, align 4, !tbaa !9
  %29 = load i32, ptr %7, align 4, !tbaa !9
  %30 = icmp slt i32 %28, %29
  br i1 %30, label %31, label %32

31:                                               ; preds = %23
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %77

32:                                               ; preds = %23
  %33 = load i32, ptr %6, align 4, !tbaa !9
  %34 = load i32, ptr %7, align 4, !tbaa !9
  %35 = icmp sgt i32 %33, %34
  br i1 %35, label %36, label %37

36:                                               ; preds = %32
  store i32 1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %77

37:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %38 = load i32, ptr %6, align 4, !tbaa !9
  %39 = sub nsw i32 %38, 1
  store i32 %39, ptr %9, align 4, !tbaa !9
  br label %40

40:                                               ; preds = %71, %37
  %41 = load i32, ptr %9, align 4, !tbaa !9
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %42, i32 0, i32 3
  %44 = load i32, ptr %43, align 4, !tbaa !11
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %45, i32 0, i32 3
  %47 = load i32, ptr %46, align 4, !tbaa !11
  %48 = call noundef i32 @_ZN17double_conversionL3MinIiEET_S1_S1_(i32 noundef %44, i32 noundef %47)
  %49 = icmp sge i32 %41, %48
  br i1 %49, label %51, label %50

50:                                               ; preds = %40
  store i32 2, ptr %8, align 4
  br label %74

51:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = load i32, ptr %9, align 4, !tbaa !9
  %54 = call noundef i32 @_ZNK17double_conversion6Bignum7BigitAtEi(ptr noundef nonnull align 8 dereferenceable(536) %52, i32 noundef %53)
  store i32 %54, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %55 = load ptr, ptr %5, align 8, !tbaa !5
  %56 = load i32, ptr %9, align 4, !tbaa !9
  %57 = call noundef i32 @_ZNK17double_conversion6Bignum7BigitAtEi(ptr noundef nonnull align 8 dereferenceable(536) %55, i32 noundef %56)
  store i32 %57, ptr %11, align 4, !tbaa !9
  %58 = load i32, ptr %10, align 4, !tbaa !9
  %59 = load i32, ptr %11, align 4, !tbaa !9
  %60 = icmp ult i32 %58, %59
  br i1 %60, label %61, label %62

61:                                               ; preds = %51
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %68

62:                                               ; preds = %51
  %63 = load i32, ptr %10, align 4, !tbaa !9
  %64 = load i32, ptr %11, align 4, !tbaa !9
  %65 = icmp ugt i32 %63, %64
  br i1 %65, label %66, label %67

66:                                               ; preds = %62
  store i32 1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %68

67:                                               ; preds = %62
  store i32 0, ptr %8, align 4
  br label %68

68:                                               ; preds = %67, %66, %61
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  %69 = load i32, ptr %8, align 4
  switch i32 %69, label %74 [
    i32 0, label %70
  ]

70:                                               ; preds = %68
  br label %71

71:                                               ; preds = %70
  %72 = load i32, ptr %9, align 4, !tbaa !9
  %73 = add nsw i32 %72, -1
  store i32 %73, ptr %9, align 4, !tbaa !9
  br label %40, !llvm.loop !14

74:                                               ; preds = %68, %50
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  %75 = load i32, ptr %8, align 4
  switch i32 %75, label %77 [
    i32 2, label %76
  ]

76:                                               ; preds = %74
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %77

77:                                               ; preds = %76, %74, %36, %31
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  %78 = load i32, ptr %3, align 4
  ret i32 %78
}

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZN17double_conversionL3MinIiEET_S1_S1_(i32 noundef, i32 noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { 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 = { noreturn nounwind }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 532}
!12 = !{!"_ZTSN17double_conversion6BignumE", !7, i64 0, !13, i64 512, !10, i64 528, !10, i64 532}
!13 = !{!"_ZTSN17double_conversion6VectorIjEE", !6, i64 0, !10, i64 8}
!14 = distinct !{!14, !15}
!15 = !{!"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"

@.str.1 = external hidden unnamed_addr constant [116 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [14 x i8], align 1
@__PRETTY_FUNCTION__._ZN17double_conversion6Bignum7CompareERKS0_S2_ = external hidden unnamed_addr constant [78 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [14 x i8], align 1

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK17double_conversion6Bignum9IsClampedEv(ptr noundef nonnull align 8 dereferenceable(536)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK17double_conversion6Bignum11BigitLengthEv(ptr noundef nonnull align 8 dereferenceable(536)) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN17double_conversion6Bignum7CompareERKS0_S2_(ptr noundef nonnull align 8 dereferenceable(536) %0, ptr noundef nonnull align 8 dereferenceable(536) %1) local_unnamed_addr #1 align 2 {
  %3 = tail call noundef zeroext i1 @_ZNK17double_conversion6Bignum9IsClampedEv(ptr noundef nonnull align 8 dereferenceable(536) %0)
  br i1 %3, label %5, label %4

4:                                                ; preds = %2
  tail call void @__assert_fail(ptr noundef nonnull @.str.17, ptr noundef nonnull @.str.1, i32 noundef 619, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN17double_conversion6Bignum7CompareERKS0_S2_) #3
  unreachable

5:                                                ; preds = %2
  %6 = tail call noundef zeroext i1 @_ZNK17double_conversion6Bignum9IsClampedEv(ptr noundef nonnull align 8 dereferenceable(536) %1)
  br i1 %6, label %8, label %7

7:                                                ; preds = %5
  tail call void @__assert_fail(ptr noundef nonnull @.str.18, ptr noundef nonnull @.str.1, i32 noundef 620, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN17double_conversion6Bignum7CompareERKS0_S2_) #3
  unreachable

8:                                                ; preds = %5
  %9 = tail call noundef i32 @_ZNK17double_conversion6Bignum11BigitLengthEv(ptr noundef nonnull align 8 dereferenceable(536) %0)
  %10 = tail call noundef i32 @_ZNK17double_conversion6Bignum11BigitLengthEv(ptr noundef nonnull align 8 dereferenceable(536) %1)
  %11 = icmp slt i32 %9, %10
  br i1 %11, label %.thread, label %12

12:                                               ; preds = %8
  %13 = icmp sgt i32 %9, %10
  br i1 %13, label %.thread, label %.preheader

.preheader:                                       ; preds = %12
  %14 = getelementptr inbounds i8, ptr %0, i64 532
  %15 = getelementptr inbounds i8, ptr %1, i64 532
  br label %16

16:                                               ; preds = %.preheader, %24
  %.026.in = phi i32 [ %.026, %24 ], [ %9, %.preheader ]
  %.026 = add nsw i32 %.026.in, -1
  %17 = load i32, ptr %14, align 4, !tbaa !5
  %18 = load i32, ptr %15, align 4, !tbaa !5
  %19 = tail call noundef i32 @_ZN17double_conversionL3MinIiEET_S1_S1_(i32 noundef %17, i32 noundef %18)
  %.not.not.not = icmp sgt i32 %.026.in, %19
  br i1 %.not.not.not, label %20, label %.thread

20:                                               ; preds = %16
  %21 = tail call noundef i32 @_ZNK17double_conversion6Bignum7BigitAtEi(ptr noundef nonnull align 8 dereferenceable(536) %0, i32 noundef %.026)
  %22 = tail call noundef i32 @_ZNK17double_conversion6Bignum7BigitAtEi(ptr noundef nonnull align 8 dereferenceable(536) %1, i32 noundef %.026)
  %23 = icmp ult i32 %21, %22
  br i1 %23, label %.thread, label %24

24:                                               ; preds = %20
  %.not = icmp ugt i32 %21, %22
  br i1 %.not, label %.thread, label %16, !llvm.loop !12

.thread:                                          ; preds = %24, %16, %20, %12, %8
  %.3 = phi i32 [ -1, %8 ], [ 1, %12 ], [ -1, %20 ], [ 0, %16 ], [ 1, %24 ]
  ret i32 %.3
}

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZN17double_conversionL3MinIiEET_S1_S1_(i32 noundef, i32 noundef) local_unnamed_addr #2

attributes #0 = { 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 #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 = { 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 #3 = { 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 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopSimplifyPass,LoopUnrollPass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass