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

10:                                               ; preds = %18, %1
  %11 = load i32, ptr %3, align 4, !tbaa !14
  %12 = icmp slt i32 %11, 128
  br i1 %12, label %14, label %13

13:                                               ; preds = %10
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  br label %21

14:                                               ; preds = %10
  %15 = getelementptr inbounds %"class.double_conversion::Bignum", ptr %4, i32 0, i32 1
  %16 = load i32, ptr %3, align 4, !tbaa !14
  %17 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK17double_conversion6VectorIjEixEi(ptr noundef nonnull align 8 dereferenceable(12) %15, i32 noundef %16)
  store i32 0, ptr %17, align 4, !tbaa !14
  br label %18

18:                                               ; preds = %14
  %19 = load i32, ptr %3, align 4, !tbaa !14
  %20 = add nsw i32 %19, 1
  store i32 %20, ptr %3, align 4, !tbaa !14
  br label %10, !llvm.loop !15

21:                                               ; preds = %13
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN17double_conversion6VectorIjEC2EPji(ptr noundef nonnull align 8 dereferenceable(12), ptr noundef, i32 noundef) unnamed_addr #1 align 2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2

; 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) #2

attributes #0 = { 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 #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 528}
!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 = !{!10, !12, i64 532}
!14 = !{!12, !12, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"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"

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN17double_conversion6BignumC2Ev(ptr noundef nonnull align 8 dereferenceable(536) %0) unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 512
  tail call void @_ZN17double_conversion6VectorIjEC2EPji(ptr noundef nonnull align 8 dereferenceable(12) %2, ptr noundef nonnull %0, i32 noundef 128)
  %3 = getelementptr inbounds i8, ptr %0, i64 528
  store i32 0, ptr %3, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 532
  store i32 0, ptr %4, align 4, !tbaa !12
  br label %6

5:                                                ; preds = %6
  ret void

6:                                                ; preds = %1, %6
  %.03 = phi i32 [ 0, %1 ], [ %8, %6 ]
  %7 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK17double_conversion6VectorIjEixEi(ptr noundef nonnull align 8 dereferenceable(12) %2, i32 noundef %.03)
  store i32 0, ptr %7, align 4, !tbaa !13
  %8 = add nuw nsw i32 %.03, 1
  %exitcond.not = icmp eq i32 %8, 128
  br i1 %exitcond.not, label %5, label %6, !llvm.loop !14
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN17double_conversion6VectorIjEC2EPji(ptr noundef nonnull align 8 dereferenceable(12), ptr noundef, i32 noundef) unnamed_addr #0 align 2

; 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

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


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass