; 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
define dso_local void @_ZN17double_conversion6Bignum12AssignBignumERKS0_(ptr noundef nonnull align 8 dereferenceable(536) %0, ptr noundef nonnull align 8 dereferenceable(536) %1) #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %7 = load ptr, ptr %3, align 8
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  %9 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %8, i32 0, i32 3
  %10 = load i32, ptr %9, align 4, !tbaa !9
  %11 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %7, i32 0, i32 3
  store i32 %10, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 0, ptr %5, align 4, !tbaa !13
  br label %12

12:                                               ; preds = %28, %2
  %13 = load i32, ptr %5, align 4, !tbaa !13
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %14, i32 0, i32 2
  %16 = load i32, ptr %15, align 8, !tbaa !14
  %17 = icmp slt i32 %13, %16
  br i1 %17, label %19, label %18

18:                                               ; preds = %12
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  br label %31

19:                                               ; preds = %12
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %20, i32 0, i32 1
  %22 = load i32, ptr %5, align 4, !tbaa !13
  %23 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK17double_conversion6VectorIjEixEi(ptr noundef nonnull align 8 dereferenceable(12) %21, i32 noundef %22)
  %24 = load i32, ptr %23, align 4, !tbaa !13
  %25 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %7, i32 0, i32 1
  %26 = load i32, ptr %5, align 4, !tbaa !13
  %27 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK17double_conversion6VectorIjEixEi(ptr noundef nonnull align 8 dereferenceable(12) %25, i32 noundef %26)
  store i32 %24, ptr %27, align 4, !tbaa !13
  br label %28

28:                                               ; preds = %19
  %29 = load i32, ptr %5, align 4, !tbaa !13
  %30 = add nsw i32 %29, 1
  store i32 %30, ptr %5, align 4, !tbaa !13
  br label %12, !llvm.loop !15

31:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %32, i32 0, i32 2
  %34 = load i32, ptr %33, align 8, !tbaa !14
  store i32 %34, ptr %6, align 4, !tbaa !13
  br label %35

35:                                               ; preds = %45, %31
  %36 = load i32, ptr %6, align 4, !tbaa !13
  %37 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %7, i32 0, i32 2
  %38 = load i32, ptr %37, align 8, !tbaa !14
  %39 = icmp slt i32 %36, %38
  br i1 %39, label %41, label %40

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

41:                                               ; preds = %35
  %42 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %7, i32 0, i32 1
  %43 = load i32, ptr %6, align 4, !tbaa !13
  %44 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK17double_conversion6VectorIjEixEi(ptr noundef nonnull align 8 dereferenceable(12) %42, i32 noundef %43)
  store i32 0, ptr %44, align 4, !tbaa !13
  br label %45

45:                                               ; preds = %41
  %46 = load i32, ptr %6, align 4, !tbaa !13
  %47 = add nsw i32 %46, 1
  store i32 %47, ptr %6, align 4, !tbaa !13
  br label %35, !llvm.loop !17

48:                                               ; preds = %40
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %49, i32 0, i32 2
  %51 = load i32, ptr %50, align 8, !tbaa !14
  %52 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %7, i32 0, i32 2
  store i32 %51, ptr %52, align 8, !tbaa !14
  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, !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"

; 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 nounwind uwtable
define dso_local void @_ZN17double_conversion6Bignum12AssignBignumERKS0_(ptr noundef nonnull align 8 dereferenceable(536) %0, ptr noundef nonnull align 8 dereferenceable(536) %1) local_unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %1, i64 532
  %4 = load i32, ptr %3, align 4, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 532
  store i32 %4, ptr %5, align 4, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %1, i64 528
  %7 = load i32, ptr %6, align 8, !tbaa !12
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %.lr.ph, label %.preheader

.lr.ph:                                           ; preds = %2
  %9 = getelementptr inbounds i8, ptr %1, i64 512
  %10 = getelementptr inbounds i8, ptr %0, i64 512
  br label %15

.preheader:                                       ; preds = %15, %2
  %.lcssa14 = phi i32 [ %7, %2 ], [ %20, %15 ]
  %11 = getelementptr inbounds i8, ptr %0, i64 528
  %12 = load i32, ptr %11, align 8, !tbaa !12
  %13 = icmp slt i32 %.lcssa14, %12
  br i1 %13, label %.lr.ph18, label %._crit_edge

.lr.ph18:                                         ; preds = %.preheader
  %14 = getelementptr inbounds i8, ptr %0, i64 512
  br label %23

15:                                               ; preds = %.lr.ph, %15
  %.01216 = phi i32 [ 0, %.lr.ph ], [ %19, %15 ]
  %16 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK17double_conversion6VectorIjEixEi(ptr noundef nonnull align 8 dereferenceable(12) %9, i32 noundef %.01216)
  %17 = load i32, ptr %16, align 4, !tbaa !13
  %18 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK17double_conversion6VectorIjEixEi(ptr noundef nonnull align 8 dereferenceable(12) %10, i32 noundef %.01216)
  store i32 %17, ptr %18, align 4, !tbaa !13
  %19 = add nuw nsw i32 %.01216, 1
  %20 = load i32, ptr %6, align 8, !tbaa !12
  %21 = icmp slt i32 %19, %20
  br i1 %21, label %15, label %.preheader, !llvm.loop !14

._crit_edge.loopexit:                             ; preds = %23
  %.pre = load i32, ptr %6, align 8, !tbaa !12
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %22 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %.lcssa14, %.preheader ]
  store i32 %22, ptr %11, align 8, !tbaa !12
  ret void

23:                                               ; preds = %.lr.ph18, %23
  %.017 = phi i32 [ %.lcssa14, %.lr.ph18 ], [ %25, %23 ]
  %24 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK17double_conversion6VectorIjEixEi(ptr noundef nonnull align 8 dereferenceable(12) %14, i32 noundef %.017)
  store i32 0, ptr %24, align 4, !tbaa !13
  %25 = add nsw i32 %.017, 1
  %26 = load i32, ptr %11, align 8, !tbaa !12
  %27 = icmp slt i32 %25, %26
  br i1 %27, label %23, label %._crit_edge.loopexit, !llvm.loop !16
}

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

!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: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass