; 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.22 = external hidden unnamed_addr constant [26 x i8], align 1
@__PRETTY_FUNCTION__._ZN17double_conversion6Bignum15BigitsShiftLeftEi = external hidden unnamed_addr constant [53 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [18 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 uwtable
define dso_local void @_ZN17double_conversion6Bignum15BigitsShiftLeftEi(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 i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  %8 = load ptr, ptr %3, align 8
  %9 = load i32, ptr %4, align 4, !tbaa !9
  %10 = icmp slt i32 %9, 28
  br i1 %10, label %11, label %12

11:                                               ; preds = %2
  br label %14

12:                                               ; preds = %2
  call void @__assert_fail(ptr noundef @.str.22, ptr noundef @.str.1, i32 noundef 723, ptr noundef @__PRETTY_FUNCTION__._ZN17double_conversion6Bignum15BigitsShiftLeftEi) #4
  unreachable

13:                                               ; No predecessors!
  br label %14

14:                                               ; preds = %13, %11
  %15 = load i32, ptr %4, align 4, !tbaa !9
  %16 = icmp sge i32 %15, 0
  br i1 %16, label %17, label %18

17:                                               ; preds = %14
  br label %20

18:                                               ; preds = %14
  call void @__assert_fail(ptr noundef @.str.23, ptr noundef @.str.1, i32 noundef 724, ptr noundef @__PRETTY_FUNCTION__._ZN17double_conversion6Bignum15BigitsShiftLeftEi) #4
  unreachable

19:                                               ; No predecessors!
  br label %20

20:                                               ; preds = %19, %17
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %21

21:                                               ; preds = %48, %20
  %22 = load i32, ptr %6, align 4, !tbaa !9
  %23 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %8, i32 0, i32 2
  %24 = load i32, ptr %23, align 8, !tbaa !11
  %25 = icmp slt i32 %22, %24
  br i1 %25, label %27, label %26

26:                                               ; preds = %21
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %51

27:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %28 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %8, i32 0, i32 1
  %29 = load i32, ptr %6, align 4, !tbaa !9
  %30 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK17double_conversion6VectorIjEixEi(ptr noundef nonnull align 8 dereferenceable(12) %28, i32 noundef %29)
  %31 = load i32, ptr %30, align 4, !tbaa !9
  %32 = load i32, ptr %4, align 4, !tbaa !9
  %33 = sub nsw i32 28, %32
  %34 = lshr i32 %31, %33
  store i32 %34, ptr %7, align 4, !tbaa !9
  %35 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %8, i32 0, i32 1
  %36 = load i32, ptr %6, align 4, !tbaa !9
  %37 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK17double_conversion6VectorIjEixEi(ptr noundef nonnull align 8 dereferenceable(12) %35, i32 noundef %36)
  %38 = load i32, ptr %37, align 4, !tbaa !9
  %39 = load i32, ptr %4, align 4, !tbaa !9
  %40 = shl i32 %38, %39
  %41 = load i32, ptr %5, align 4, !tbaa !9
  %42 = add i32 %40, %41
  %43 = and i32 %42, 268435455
  %44 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %8, i32 0, i32 1
  %45 = load i32, ptr %6, align 4, !tbaa !9
  %46 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK17double_conversion6VectorIjEixEi(ptr noundef nonnull align 8 dereferenceable(12) %44, i32 noundef %45)
  store i32 %43, ptr %46, align 4, !tbaa !9
  %47 = load i32, ptr %7, align 4, !tbaa !9
  store i32 %47, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %48

48:                                               ; preds = %27
  %49 = load i32, ptr %6, align 4, !tbaa !9
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr %6, align 4, !tbaa !9
  br label %21, !llvm.loop !14

51:                                               ; preds = %26
  %52 = load i32, ptr %5, align 4, !tbaa !9
  %53 = icmp ne i32 %52, 0
  br i1 %53, label %54, label %63

54:                                               ; preds = %51
  %55 = load i32, ptr %5, align 4, !tbaa !9
  %56 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %8, i32 0, i32 1
  %57 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %8, i32 0, i32 2
  %58 = load i32, ptr %57, align 8, !tbaa !11
  %59 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK17double_conversion6VectorIjEixEi(ptr noundef nonnull align 8 dereferenceable(12) %56, i32 noundef %58)
  store i32 %55, ptr %59, align 4, !tbaa !9
  %60 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %8, i32 0, i32 2
  %61 = load i32, ptr %60, align 8, !tbaa !11
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %60, align 8, !tbaa !11
  br label %63

63:                                               ; preds = %54, %51
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  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 = { 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 528}
!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.22 = external hidden unnamed_addr constant [26 x i8], align 1
@__PRETTY_FUNCTION__._ZN17double_conversion6Bignum15BigitsShiftLeftEi = external hidden unnamed_addr constant [53 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [18 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
define dso_local void @_ZN17double_conversion6Bignum15BigitsShiftLeftEi(ptr noundef nonnull align 8 dereferenceable(536) %0, i32 noundef %1) local_unnamed_addr #0 align 2 {
  %3 = icmp slt i32 %1, 28
  br i1 %3, label %5, label %4

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

5:                                                ; preds = %2
  %6 = icmp sgt i32 %1, -1
  br i1 %6, label %.preheader, label %12

.preheader:                                       ; preds = %5
  %7 = getelementptr inbounds i8, ptr %0, i64 528
  %8 = load i32, ptr %7, align 8, !tbaa !5
  %9 = icmp sgt i32 %8, 0
  br i1 %9, label %.lr.ph, label %._crit_edge.thread

.lr.ph:                                           ; preds = %.preheader
  %10 = getelementptr inbounds i8, ptr %0, i64 512
  %11 = sub nuw nsw i32 28, %1
  br label %13

12:                                               ; preds = %5
  tail call void @__assert_fail(ptr noundef nonnull @.str.23, ptr noundef nonnull @.str.1, i32 noundef 724, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN17double_conversion6Bignum15BigitsShiftLeftEi) #2
  unreachable

._crit_edge:                                      ; preds = %13
  %.not = icmp eq i32 %16, 0
  br i1 %.not, label %._crit_edge.thread, label %26

13:                                               ; preds = %.lr.ph, %13
  %.018 = phi i32 [ 0, %.lr.ph ], [ %16, %13 ]
  %.01317 = phi i32 [ 0, %.lr.ph ], [ %23, %13 ]
  %14 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK17double_conversion6VectorIjEixEi(ptr noundef nonnull align 8 dereferenceable(12) %10, i32 noundef %.01317)
  %15 = load i32, ptr %14, align 4, !tbaa !12
  %16 = lshr i32 %15, %11
  %17 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK17double_conversion6VectorIjEixEi(ptr noundef nonnull align 8 dereferenceable(12) %10, i32 noundef %.01317)
  %18 = load i32, ptr %17, align 4, !tbaa !12
  %19 = shl i32 %18, %1
  %20 = add i32 %19, %.018
  %21 = and i32 %20, 268435455
  %22 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK17double_conversion6VectorIjEixEi(ptr noundef nonnull align 8 dereferenceable(12) %10, i32 noundef %.01317)
  store i32 %21, ptr %22, align 4, !tbaa !12
  %23 = add nuw nsw i32 %.01317, 1
  %24 = load i32, ptr %7, align 8, !tbaa !5
  %25 = icmp slt i32 %23, %24
  br i1 %25, label %13, label %._crit_edge, !llvm.loop !13

26:                                               ; preds = %._crit_edge
  %27 = getelementptr inbounds i8, ptr %0, i64 512
  %28 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK17double_conversion6VectorIjEixEi(ptr noundef nonnull align 8 dereferenceable(12) %27, i32 noundef %24)
  store i32 %16, ptr %28, align 4, !tbaa !12
  %29 = load i32, ptr %7, align 8, !tbaa !5
  %30 = add nsw i32 %29, 1
  store i32 %30, ptr %7, align 8, !tbaa !5
  br label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %.preheader, %26, %._crit_edge
  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 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"}


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