; 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
@__const._ZN17double_conversion6Bignum20MultiplyByPowerOfTenEi.kFive1_to_12 = external hidden unnamed_addr constant [12 x i32], align 16
@.str.7 = external hidden unnamed_addr constant [14 x i8], align 1
@__PRETTY_FUNCTION__._ZN17double_conversion6Bignum20MultiplyByPowerOfTenEi = external hidden unnamed_addr constant [58 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: 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) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN17double_conversion6Bignum20MultiplyByPowerOfTenEi(ptr noundef nonnull align 8 dereferenceable(536) %0, i32 noundef %1) #3 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i64, align 8
  %6 = alloca i16, align 2
  %7 = alloca i16, align 2
  %8 = alloca i16, align 2
  %9 = alloca i16, align 2
  %10 = alloca i16, align 2
  %11 = alloca i16, align 2
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca [12 x i32], align 16
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  %22 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  store i64 7450580596923828125, ptr %5, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 2, ptr %6) #4
  store i16 5, ptr %6, align 2, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 2, ptr %7) #4
  store i16 25, ptr %7, align 2, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 2, ptr %8) #4
  store i16 125, ptr %8, align 2, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 2, ptr %9) #4
  store i16 625, ptr %9, align 2, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 2, ptr %10) #4
  store i16 3125, ptr %10, align 2, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 2, ptr %11) #4
  store i16 15625, ptr %11, align 2, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 78125, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 390625, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  store i32 1953125, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  store i32 9765625, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  store i32 48828125, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  store i32 244140625, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  store i32 1220703125, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 48, ptr %19) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %19, ptr align 16 @__const._ZN17double_conversion6Bignum20MultiplyByPowerOfTenEi.kFive1_to_12, i64 48, i1 false)
  %23 = load i32, ptr %4, align 4, !tbaa !9
  %24 = icmp sge i32 %23, 0
  br i1 %24, label %25, label %26

25:                                               ; preds = %2
  br label %28

26:                                               ; preds = %2
  call void @__assert_fail(ptr noundef @.str.7, ptr noundef @.str.1, i32 noundef 319, ptr noundef @__PRETTY_FUNCTION__._ZN17double_conversion6Bignum20MultiplyByPowerOfTenEi) #5
  unreachable

27:                                               ; No predecessors!
  br label %28

28:                                               ; preds = %27, %25
  %29 = load i32, ptr %4, align 4, !tbaa !9
  %30 = icmp eq i32 %29, 0
  br i1 %30, label %31, label %32

31:                                               ; preds = %28
  store i32 1, ptr %20, align 4
  br label %63

32:                                               ; preds = %28
  %33 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %22, i32 0, i32 2
  %34 = load i32, ptr %33, align 8, !tbaa !15
  %35 = icmp eq i32 %34, 0
  br i1 %35, label %36, label %37

36:                                               ; preds = %32
  store i32 1, ptr %20, align 4
  br label %63

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

39:                                               ; preds = %42, %37
  %40 = load i32, ptr %21, align 4, !tbaa !9
  %41 = icmp sge i32 %40, 27
  br i1 %41, label %42, label %45

42:                                               ; preds = %39
  call void @_ZN17double_conversion6Bignum16MultiplyByUInt64Em(ptr noundef nonnull align 8 dereferenceable(536) %22, i64 noundef 7450580596923828125)
  %43 = load i32, ptr %21, align 4, !tbaa !9
  %44 = sub nsw i32 %43, 27
  store i32 %44, ptr %21, align 4, !tbaa !9
  br label %39, !llvm.loop !18

45:                                               ; preds = %39
  br label %46

46:                                               ; preds = %49, %45
  %47 = load i32, ptr %21, align 4, !tbaa !9
  %48 = icmp sge i32 %47, 13
  br i1 %48, label %49, label %52

49:                                               ; preds = %46
  call void @_ZN17double_conversion6Bignum16MultiplyByUInt32Ej(ptr noundef nonnull align 8 dereferenceable(536) %22, i32 noundef 1220703125)
  %50 = load i32, ptr %21, align 4, !tbaa !9
  %51 = sub nsw i32 %50, 13
  store i32 %51, ptr %21, align 4, !tbaa !9
  br label %46, !llvm.loop !20

52:                                               ; preds = %46
  %53 = load i32, ptr %21, align 4, !tbaa !9
  %54 = icmp sgt i32 %53, 0
  br i1 %54, label %55, label %61

55:                                               ; preds = %52
  %56 = load i32, ptr %21, align 4, !tbaa !9
  %57 = sub nsw i32 %56, 1
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [12 x i32], ptr %19, i64 0, i64 %58
  %60 = load i32, ptr %59, align 4, !tbaa !9
  call void @_ZN17double_conversion6Bignum16MultiplyByUInt32Ej(ptr noundef nonnull align 8 dereferenceable(536) %22, i32 noundef %60)
  br label %61

61:                                               ; preds = %55, %52
  %62 = load i32, ptr %4, align 4, !tbaa !9
  call void @_ZN17double_conversion6Bignum9ShiftLeftEi(ptr noundef nonnull align 8 dereferenceable(536) %22, i32 noundef %62)
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #4
  store i32 0, ptr %20, align 4
  br label %63

63:                                               ; preds = %61, %36, %31
  call void @llvm.lifetime.end.p0(i64 48, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  %64 = load i32, ptr %20, align 4
  switch i32 %64, label %66 [
    i32 0, label %65
    i32 1, label %65
  ]

65:                                               ; preds = %63, %63
  ret void

66:                                               ; preds = %63
  unreachable
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN17double_conversion6Bignum16MultiplyByUInt64Em(ptr noundef nonnull align 8 dereferenceable(536), i64 noundef) #3 align 2

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 = { nocallback nofree 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"short", !7, i64 0}
!15 = !{!16, !10, i64 528}
!16 = !{!"_ZTSN17double_conversion6BignumE", !7, i64 0, !17, i64 512, !10, i64 528, !10, i64 532}
!17 = !{!"_ZTSN17double_conversion6VectorIjEE", !6, i64 0, !10, i64 8}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = distinct !{!20, !19}


; 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
@__const._ZN17double_conversion6Bignum20MultiplyByPowerOfTenEi.kFive1_to_12 = external hidden unnamed_addr constant [12 x i32], align 16
@.str.7 = external hidden unnamed_addr constant [14 x i8], align 1
@__PRETTY_FUNCTION__._ZN17double_conversion6Bignum20MultiplyByPowerOfTenEi = external hidden unnamed_addr constant [58 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
define dso_local void @_ZN17double_conversion6Bignum20MultiplyByPowerOfTenEi(ptr noundef nonnull align 8 dereferenceable(536) %0, i32 noundef %1) local_unnamed_addr #1 align 2 {
  %3 = icmp sgt i32 %1, -1
  br i1 %3, label %5, label %4

4:                                                ; preds = %2
  tail call void @__assert_fail(ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.1, i32 noundef 319, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN17double_conversion6Bignum20MultiplyByPowerOfTenEi) #2
  unreachable

5:                                                ; preds = %2
  %6 = icmp eq i32 %1, 0
  %7 = getelementptr inbounds i8, ptr %0, i64 528
  %8 = load i32, ptr %7, align 8
  %9 = icmp eq i32 %8, 0
  %or.cond = select i1 %6, i1 true, i1 %9
  br i1 %or.cond, label %22, label %.preheader13

.preheader13:                                     ; preds = %5
  %10 = icmp ugt i32 %1, 26
  br i1 %10, label %.lr.ph, label %.preheader

.preheader:                                       ; preds = %.lr.ph, %.preheader13
  %.0.lcssa = phi i32 [ %1, %.preheader13 ], [ %12, %.lr.ph ]
  %11 = icmp ugt i32 %.0.lcssa, 12
  br i1 %11, label %.lr.ph16, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader13, %.lr.ph
  %.014 = phi i32 [ %12, %.lr.ph ], [ %1, %.preheader13 ]
  tail call void @_ZN17double_conversion6Bignum16MultiplyByUInt64Em(ptr noundef nonnull align 8 dereferenceable(536) %0, i64 noundef 7450580596923828125)
  %12 = add nsw i32 %.014, -27
  %13 = icmp ugt i32 %.014, 53
  br i1 %13, label %.lr.ph, label %.preheader, !llvm.loop !5

.lr.ph16:                                         ; preds = %.preheader, %.lr.ph16
  %.115 = phi i32 [ %14, %.lr.ph16 ], [ %.0.lcssa, %.preheader ]
  tail call void @_ZN17double_conversion6Bignum16MultiplyByUInt32Ej(ptr noundef nonnull align 8 dereferenceable(536) %0, i32 noundef 1220703125)
  %14 = add nsw i32 %.115, -13
  %15 = icmp ugt i32 %.115, 25
  br i1 %15, label %.lr.ph16, label %._crit_edge, !llvm.loop !7

._crit_edge:                                      ; preds = %.lr.ph16, %.preheader
  %.1.lcssa = phi i32 [ %.0.lcssa, %.preheader ], [ %14, %.lr.ph16 ]
  %.not = icmp eq i32 %.1.lcssa, 0
  br i1 %.not, label %21, label %16

16:                                               ; preds = %._crit_edge
  %17 = add nsw i32 %.1.lcssa, -1
  %18 = zext nneg i32 %17 to i64
  %19 = getelementptr inbounds [12 x i32], ptr @__const._ZN17double_conversion6Bignum20MultiplyByPowerOfTenEi.kFive1_to_12, i64 0, i64 %18
  %20 = load i32, ptr %19, align 4, !tbaa !8
  tail call void @_ZN17double_conversion6Bignum16MultiplyByUInt32Ej(ptr noundef nonnull align 8 dereferenceable(536) %0, i32 noundef %20)
  br label %21

21:                                               ; preds = %16, %._crit_edge
  tail call void @_ZN17double_conversion6Bignum9ShiftLeftEi(ptr noundef nonnull align 8 dereferenceable(536) %0, i32 noundef %1)
  br label %22

22:                                               ; preds = %5, %21
  ret void
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN17double_conversion6Bignum16MultiplyByUInt64Em(ptr noundef nonnull align 8 dereferenceable(536), i64 noundef) local_unnamed_addr #1 align 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 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}


; Effective O3 passes: CorrelatedValuePropagationPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass