; 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] }>

; 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: mustprogress uwtable
declare dso_local void @_ZN17double_conversion6Bignum4ZeroEv(ptr noundef nonnull align 8 dereferenceable(536)) #2 align 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_conversion6Bignum16MultiplyByUInt64Em(ptr noundef nonnull align 8 dereferenceable(536) %0, i64 noundef %1) #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i64 %1, ptr %4, align 8, !tbaa !9
  %12 = load ptr, ptr %3, align 8
  %13 = load i64, ptr %4, align 8, !tbaa !9
  %14 = icmp eq i64 %13, 1
  br i1 %14, label %15, label %16

15:                                               ; preds = %2
  br label %88

16:                                               ; preds = %2
  %17 = load i64, ptr %4, align 8, !tbaa !9
  %18 = icmp eq i64 %17, 0
  br i1 %18, label %19, label %20

19:                                               ; preds = %16
  call void @_ZN17double_conversion6Bignum4ZeroEv(ptr noundef nonnull align 8 dereferenceable(536) %12)
  br label %88

20:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  store i64 0, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %21 = load i64, ptr %4, align 8, !tbaa !9
  %22 = and i64 %21, 4294967295
  store i64 %22, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %23 = load i64, ptr %4, align 8, !tbaa !9
  %24 = lshr i64 %23, 32
  store i64 %24, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  store i32 0, ptr %8, align 4, !tbaa !11
  br label %25

25:                                               ; preds = %64, %20
  %26 = load i32, ptr %8, align 4, !tbaa !11
  %27 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %12, i32 0, i32 2
  %28 = load i32, ptr %27, align 8, !tbaa !13
  %29 = icmp slt i32 %26, %28
  br i1 %29, label %31, label %30

30:                                               ; preds = %25
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  br label %67

31:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %32 = load i64, ptr %6, align 8, !tbaa !9
  %33 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %12, i32 0, i32 1
  %34 = load i32, ptr %8, align 4, !tbaa !11
  %35 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK17double_conversion6VectorIjEixEi(ptr noundef nonnull align 8 dereferenceable(12) %33, i32 noundef %34)
  %36 = load i32, ptr %35, align 4, !tbaa !11
  %37 = zext i32 %36 to i64
  %38 = mul i64 %32, %37
  store i64 %38, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %39 = load i64, ptr %7, align 8, !tbaa !9
  %40 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %12, i32 0, i32 1
  %41 = load i32, ptr %8, align 4, !tbaa !11
  %42 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK17double_conversion6VectorIjEixEi(ptr noundef nonnull align 8 dereferenceable(12) %40, i32 noundef %41)
  %43 = load i32, ptr %42, align 4, !tbaa !11
  %44 = zext i32 %43 to i64
  %45 = mul i64 %39, %44
  store i64 %45, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %46 = load i64, ptr %5, align 8, !tbaa !9
  %47 = and i64 %46, 268435455
  %48 = load i64, ptr %9, align 8, !tbaa !9
  %49 = add i64 %47, %48
  store i64 %49, ptr %11, align 8, !tbaa !9
  %50 = load i64, ptr %11, align 8, !tbaa !9
  %51 = and i64 %50, 268435455
  %52 = trunc i64 %51 to i32
  %53 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %12, i32 0, i32 1
  %54 = load i32, ptr %8, align 4, !tbaa !11
  %55 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK17double_conversion6VectorIjEixEi(ptr noundef nonnull align 8 dereferenceable(12) %53, i32 noundef %54)
  store i32 %52, ptr %55, align 4, !tbaa !11
  %56 = load i64, ptr %5, align 8, !tbaa !9
  %57 = lshr i64 %56, 28
  %58 = load i64, ptr %11, align 8, !tbaa !9
  %59 = lshr i64 %58, 28
  %60 = add i64 %57, %59
  %61 = load i64, ptr %10, align 8, !tbaa !9
  %62 = shl i64 %61, 4
  %63 = add i64 %60, %62
  store i64 %63, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  br label %64

64:                                               ; preds = %31
  %65 = load i32, ptr %8, align 4, !tbaa !11
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %8, align 4, !tbaa !11
  br label %25, !llvm.loop !16

67:                                               ; preds = %30
  br label %68

68:                                               ; preds = %71, %67
  %69 = load i64, ptr %5, align 8, !tbaa !9
  %70 = icmp ne i64 %69, 0
  br i1 %70, label %71, label %87

71:                                               ; preds = %68
  %72 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %12, i32 0, i32 2
  %73 = load i32, ptr %72, align 8, !tbaa !13
  %74 = add nsw i32 %73, 1
  call void @_ZN17double_conversion6Bignum14EnsureCapacityEi(ptr noundef nonnull align 8 dereferenceable(536) %12, i32 noundef %74)
  %75 = load i64, ptr %5, align 8, !tbaa !9
  %76 = and i64 %75, 268435455
  %77 = trunc i64 %76 to i32
  %78 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %12, i32 0, i32 1
  %79 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %12, i32 0, i32 2
  %80 = load i32, ptr %79, align 8, !tbaa !13
  %81 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK17double_conversion6VectorIjEixEi(ptr noundef nonnull align 8 dereferenceable(12) %78, i32 noundef %80)
  store i32 %77, ptr %81, align 4, !tbaa !11
  %82 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %12, i32 0, i32 2
  %83 = load i32, ptr %82, align 8, !tbaa !13
  %84 = add nsw i32 %83, 1
  store i32 %84, ptr %82, align 8, !tbaa !13
  %85 = load i64, ptr %5, align 8, !tbaa !9
  %86 = lshr i64 %85, 28
  store i64 %86, ptr %5, align 8, !tbaa !9
  br label %68, !llvm.loop !18

87:                                               ; preds = %68
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  br label %88

88:                                               ; preds = %87, %19, %15
  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 = { 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 = { 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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !12, i64 528}
!14 = !{!"_ZTSN17double_conversion6BignumE", !7, i64 0, !15, i64 512, !12, i64 528, !12, i64 532}
!15 = !{!"_ZTSN17double_conversion6VectorIjEE", !6, i64 0, !12, i64 8}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}


; 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"

; 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: mustprogress uwtable
declare dso_local void @_ZN17double_conversion6Bignum4ZeroEv(ptr noundef nonnull align 8 dereferenceable(536)) local_unnamed_addr #1 align 2

; 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 uwtable
define dso_local void @_ZN17double_conversion6Bignum16MultiplyByUInt64Em(ptr noundef nonnull align 8 dereferenceable(536) %0, i64 noundef %1) local_unnamed_addr #1 align 2 {
  switch i64 %1, label %4 [
    i64 1, label %.loopexit
    i64 0, label %3
  ]

3:                                                ; preds = %2
  tail call void @_ZN17double_conversion6Bignum4ZeroEv(ptr noundef nonnull align 8 dereferenceable(536) %0)
  br label %.loopexit

4:                                                ; preds = %2
  %5 = and i64 %1, 4294967295
  %6 = getelementptr inbounds i8, ptr %0, i64 528
  %7 = load i32, ptr %6, align 8, !tbaa !5
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %4
  %9 = getelementptr inbounds i8, ptr %0, i64 512
  %10 = lshr i64 %1, 28
  %11 = and i64 %10, 68719476720
  br label %13

.preheader:                                       ; preds = %13
  %.not24 = icmp eq i64 %30, 0
  br i1 %.not24, label %.loopexit, label %.lr.ph26

.lr.ph26:                                         ; preds = %.preheader
  %12 = getelementptr inbounds i8, ptr %0, i64 512
  br label %34

13:                                               ; preds = %.lr.ph, %13
  %.023 = phi i64 [ 0, %.lr.ph ], [ %30, %13 ]
  %.02022 = phi i32 [ 0, %.lr.ph ], [ %31, %13 ]
  %14 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK17double_conversion6VectorIjEixEi(ptr noundef nonnull align 8 dereferenceable(12) %9, i32 noundef %.02022)
  %15 = load i32, ptr %14, align 4, !tbaa !12
  %16 = zext i32 %15 to i64
  %17 = mul nuw i64 %5, %16
  %18 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK17double_conversion6VectorIjEixEi(ptr noundef nonnull align 8 dereferenceable(12) %9, i32 noundef %.02022)
  %19 = load i32, ptr %18, align 4, !tbaa !12
  %20 = zext i32 %19 to i64
  %21 = and i64 %.023, 268435455
  %22 = add nuw i64 %17, %21
  %23 = trunc i64 %22 to i32
  %24 = and i32 %23, 268435455
  %25 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK17double_conversion6VectorIjEixEi(ptr noundef nonnull align 8 dereferenceable(12) %9, i32 noundef %.02022)
  store i32 %24, ptr %25, align 4, !tbaa !12
  %26 = lshr i64 %.023, 28
  %27 = lshr i64 %22, 28
  %28 = add nuw nsw i64 %27, %26
  %29 = mul i64 %11, %20
  %30 = add i64 %28, %29
  %31 = add nuw nsw i32 %.02022, 1
  %32 = load i32, ptr %6, align 8, !tbaa !5
  %33 = icmp slt i32 %31, %32
  br i1 %33, label %13, label %.preheader, !llvm.loop !13

34:                                               ; preds = %.lr.ph26, %34
  %35 = phi i32 [ %32, %.lr.ph26 ], [ %42, %34 ]
  %.125 = phi i64 [ %30, %.lr.ph26 ], [ %43, %34 ]
  %36 = add nsw i32 %35, 1
  tail call void @_ZN17double_conversion6Bignum14EnsureCapacityEi(ptr noundef nonnull align 8 dereferenceable(536) %0, i32 noundef %36)
  %37 = trunc i64 %.125 to i32
  %38 = and i32 %37, 268435455
  %39 = load i32, ptr %6, align 8, !tbaa !5
  %40 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK17double_conversion6VectorIjEixEi(ptr noundef nonnull align 8 dereferenceable(12) %12, i32 noundef %39)
  store i32 %38, ptr %40, align 4, !tbaa !12
  %41 = load i32, ptr %6, align 8, !tbaa !5
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %6, align 8, !tbaa !5
  %43 = lshr i64 %.125, 28
  %.not = icmp ult i64 %.125, 268435456
  br i1 %.not, label %.loopexit, label %34, !llvm.loop !15

.loopexit:                                        ; preds = %34, %4, %.preheader, %2, %3
  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 = { 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" }

!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 528}
!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 = !{!11, !11, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


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