; LLVM IR from iyinoluwamt/Tensorframe :: main/ios/Pods/DoubleConversion/double-conversion (double-conversion)

; 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::DoubleToStringConverter" = type <{ i32, [4 x i8], ptr, ptr, i8, [3 x i8], i32, i32, i32, i32, [4 x i8] }>

@.str.2 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [127 x i8], align 1
@__PRETTY_FUNCTION__._ZNK17double_conversion23DoubleToStringConverter31CreateExponentialRepresentationEPKciiPNS_13StringBuilderE = external hidden unnamed_addr constant [128 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [15 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: mustprogress uwtable
declare dso_local void @_ZN17double_conversion13StringBuilder12AddCharacterEc(ptr noundef nonnull align 8 dereferenceable(20), i8 noundef signext) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK17double_conversion23DoubleToStringConverter31CreateExponentialRepresentationEPKciiPNS_13StringBuilderE(ptr noundef nonnull align 8 dereferenceable(44) %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, ptr noundef %4) #1 align 2 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca [6 x i8], align 1
  %13 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store i32 %2, ptr %8, align 4, !tbaa !9
  store i32 %3, ptr %9, align 4, !tbaa !9
  store ptr %4, ptr %10, align 8, !tbaa !5
  %14 = load ptr, ptr %6, align 8
  %15 = load i32, ptr %8, align 4, !tbaa !9
  %16 = icmp ne i32 %15, 0
  br i1 %16, label %17, label %18

17:                                               ; preds = %5
  br label %20

18:                                               ; preds = %5
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.3, i32 noundef 80, ptr noundef @__PRETTY_FUNCTION__._ZNK17double_conversion23DoubleToStringConverter31CreateExponentialRepresentationEPKciiPNS_13StringBuilderE) #3
  unreachable

19:                                               ; No predecessors!
  br label %20

20:                                               ; preds = %19, %17
  %21 = load ptr, ptr %10, align 8, !tbaa !5
  %22 = load ptr, ptr %7, align 8, !tbaa !5
  %23 = getelementptr inbounds i8, ptr %22, i64 0
  %24 = load i8, ptr %23, align 1, !tbaa !11
  call void @_ZN17double_conversion13StringBuilder12AddCharacterEc(ptr noundef nonnull align 8 dereferenceable(20) %21, i8 noundef signext %24)
  %25 = load i32, ptr %8, align 4, !tbaa !9
  %26 = icmp ne i32 %25, 1
  br i1 %26, label %27, label %34

27:                                               ; preds = %20
  %28 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN17double_conversion13StringBuilder12AddCharacterEc(ptr noundef nonnull align 8 dereferenceable(20) %28, i8 noundef signext 46)
  %29 = load ptr, ptr %10, align 8, !tbaa !5
  %30 = load ptr, ptr %7, align 8, !tbaa !5
  %31 = getelementptr inbounds i8, ptr %30, i64 1
  %32 = load i32, ptr %8, align 4, !tbaa !9
  %33 = sub nsw i32 %32, 1
  call void @_ZN17double_conversion13StringBuilder12AddSubstringEPKci(ptr noundef nonnull align 8 dereferenceable(20) %29, ptr noundef %31, i32 noundef %33)
  br label %34

34:                                               ; preds = %27, %20
  %35 = load ptr, ptr %10, align 8, !tbaa !5
  %36 = getelementptr inbounds %"class.double_conversion::DoubleToStringConverter", ptr %14, i32 0, i32 4
  %37 = load i8, ptr %36, align 8, !tbaa !12
  call void @_ZN17double_conversion13StringBuilder12AddCharacterEc(ptr noundef nonnull align 8 dereferenceable(20) %35, i8 noundef signext %37)
  %38 = load i32, ptr %9, align 4, !tbaa !9
  %39 = icmp slt i32 %38, 0
  br i1 %39, label %40, label %44

40:                                               ; preds = %34
  %41 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN17double_conversion13StringBuilder12AddCharacterEc(ptr noundef nonnull align 8 dereferenceable(20) %41, i8 noundef signext 45)
  %42 = load i32, ptr %9, align 4, !tbaa !9
  %43 = sub nsw i32 0, %42
  store i32 %43, ptr %9, align 4, !tbaa !9
  br label %52

44:                                               ; preds = %34
  %45 = getelementptr inbounds %"class.double_conversion::DoubleToStringConverter", ptr %14, i32 0, i32 0
  %46 = load i32, ptr %45, align 8, !tbaa !14
  %47 = and i32 %46, 1
  %48 = icmp ne i32 %47, 0
  br i1 %48, label %49, label %51

49:                                               ; preds = %44
  %50 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN17double_conversion13StringBuilder12AddCharacterEc(ptr noundef nonnull align 8 dereferenceable(20) %50, i8 noundef signext 43)
  br label %51

51:                                               ; preds = %49, %44
  br label %52

52:                                               ; preds = %51, %40
  %53 = load i32, ptr %9, align 4, !tbaa !9
  %54 = icmp eq i32 %53, 0
  br i1 %54, label %55, label %57

55:                                               ; preds = %52
  %56 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN17double_conversion13StringBuilder12AddCharacterEc(ptr noundef nonnull align 8 dereferenceable(20) %56, i8 noundef signext 48)
  br label %87

57:                                               ; preds = %52
  %58 = load i32, ptr %9, align 4, !tbaa !9
  %59 = sitofp i32 %58 to double
  %60 = fcmp olt double %59, 1.000000e+04
  br i1 %60, label %61, label %62

61:                                               ; preds = %57
  br label %64

62:                                               ; preds = %57
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.3, i32 noundef 99, ptr noundef @__PRETTY_FUNCTION__._ZNK17double_conversion23DoubleToStringConverter31CreateExponentialRepresentationEPKciiPNS_13StringBuilderE) #3
  unreachable

63:                                               ; No predecessors!
  br label %64

64:                                               ; preds = %63, %61
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 5, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 6, ptr %12) #4
  %65 = getelementptr inbounds [6 x i8], ptr %12, i64 0, i64 5
  store i8 0, ptr %65, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 5, ptr %13, align 4, !tbaa !9
  br label %66

66:                                               ; preds = %69, %64
  %67 = load i32, ptr %9, align 4, !tbaa !9
  %68 = icmp sgt i32 %67, 0
  br i1 %68, label %69, label %80

69:                                               ; preds = %66
  %70 = load i32, ptr %9, align 4, !tbaa !9
  %71 = srem i32 %70, 10
  %72 = add nsw i32 48, %71
  %73 = trunc i32 %72 to i8
  %74 = load i32, ptr %13, align 4, !tbaa !9
  %75 = add nsw i32 %74, -1
  store i32 %75, ptr %13, align 4, !tbaa !9
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [6 x i8], ptr %12, i64 0, i64 %76
  store i8 %73, ptr %77, align 1, !tbaa !11
  %78 = load i32, ptr %9, align 4, !tbaa !9
  %79 = sdiv i32 %78, 10
  store i32 %79, ptr %9, align 4, !tbaa !9
  br label %66, !llvm.loop !15

80:                                               ; preds = %66
  %81 = load ptr, ptr %10, align 8, !tbaa !5
  %82 = load i32, ptr %13, align 4, !tbaa !9
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [6 x i8], ptr %12, i64 0, i64 %83
  %85 = load i32, ptr %13, align 4, !tbaa !9
  %86 = sub nsw i32 5, %85
  call void @_ZN17double_conversion13StringBuilder12AddSubstringEPKci(ptr noundef nonnull align 8 dereferenceable(20) %81, ptr noundef %84, i32 noundef %86)
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 6, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %87

87:                                               ; preds = %80, %55
  ret void
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #2

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 "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 = { noreturn nounwind }
attributes #4 = { 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 = !{!7, !7, i64 0}
!12 = !{!13, !7, i64 24}
!13 = !{!"_ZTSN17double_conversion23DoubleToStringConverterE", !10, i64 0, !6, i64 8, !6, i64 16, !7, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40}
!14 = !{!13, !10, 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"

@.str.2 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [127 x i8], align 1
@__PRETTY_FUNCTION__._ZNK17double_conversion23DoubleToStringConverter31CreateExponentialRepresentationEPKciiPNS_13StringBuilderE = external hidden unnamed_addr constant [128 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [15 x i8], align 1

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

; Function Attrs: mustprogress 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_conversion13StringBuilder12AddCharacterEc(ptr noundef nonnull align 8 dereferenceable(20), i8 noundef signext) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK17double_conversion23DoubleToStringConverter31CreateExponentialRepresentationEPKciiPNS_13StringBuilderE(ptr nocapture noundef nonnull readonly align 8 dereferenceable(44) %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, ptr noundef %4) local_unnamed_addr #1 align 2 {
  %6 = alloca [6 x i8], align 1
  %.not = icmp eq i32 %2, 0
  br i1 %.not, label %7, label %8

7:                                                ; preds = %5
  tail call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, i32 noundef 80, ptr noundef nonnull @__PRETTY_FUNCTION__._ZNK17double_conversion23DoubleToStringConverter31CreateExponentialRepresentationEPKciiPNS_13StringBuilderE) #3
  unreachable

8:                                                ; preds = %5
  %9 = load i8, ptr %1, align 1, !tbaa !5
  tail call void @_ZN17double_conversion13StringBuilder12AddCharacterEc(ptr noundef nonnull align 8 dereferenceable(20) %4, i8 noundef signext %9)
  %.not27 = icmp eq i32 %2, 1
  br i1 %.not27, label %13, label %10

10:                                               ; preds = %8
  tail call void @_ZN17double_conversion13StringBuilder12AddCharacterEc(ptr noundef nonnull align 8 dereferenceable(20) %4, i8 noundef signext 46)
  %11 = getelementptr inbounds i8, ptr %1, i64 1
  %12 = add nsw i32 %2, -1
  tail call void @_ZN17double_conversion13StringBuilder12AddSubstringEPKci(ptr noundef nonnull align 8 dereferenceable(20) %4, ptr noundef nonnull %11, i32 noundef %12)
  br label %13

13:                                               ; preds = %10, %8
  %14 = getelementptr inbounds i8, ptr %0, i64 24
  %15 = load i8, ptr %14, align 8, !tbaa !8
  tail call void @_ZN17double_conversion13StringBuilder12AddCharacterEc(ptr noundef nonnull align 8 dereferenceable(20) %4, i8 noundef signext %15)
  %16 = icmp slt i32 %3, 0
  br i1 %16, label %.thread, label %18

.thread:                                          ; preds = %13
  tail call void @_ZN17double_conversion13StringBuilder12AddCharacterEc(ptr noundef nonnull align 8 dereferenceable(20) %4, i8 noundef signext 45)
  %17 = sub nsw i32 0, %3
  br label %25

18:                                               ; preds = %13
  %19 = load i32, ptr %0, align 8, !tbaa !12
  %20 = and i32 %19, 1
  %.not28 = icmp eq i32 %20, 0
  br i1 %.not28, label %22, label %21

21:                                               ; preds = %18
  tail call void @_ZN17double_conversion13StringBuilder12AddCharacterEc(ptr noundef nonnull align 8 dereferenceable(20) %4, i8 noundef signext 43)
  br label %22

22:                                               ; preds = %18, %21
  %23 = icmp eq i32 %3, 0
  br i1 %23, label %24, label %25

24:                                               ; preds = %22
  tail call void @_ZN17double_conversion13StringBuilder12AddCharacterEc(ptr noundef nonnull align 8 dereferenceable(20) %4, i8 noundef signext 48)
  br label %38

25:                                               ; preds = %.thread, %22
  %.02330 = phi i32 [ %17, %.thread ], [ %3, %22 ]
  %26 = icmp ult i32 %.02330, 10000
  br i1 %26, label %.lr.ph.preheader, label %27

27:                                               ; preds = %25
  tail call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.3, i32 noundef 99, ptr noundef nonnull @__PRETTY_FUNCTION__._ZNK17double_conversion23DoubleToStringConverter31CreateExponentialRepresentationEPKciiPNS_13StringBuilderE) #3
  unreachable

.lr.ph.preheader:                                 ; preds = %25
  call void @llvm.lifetime.start.p0(i64 6, ptr nonnull %6) #4
  %28 = getelementptr inbounds i8, ptr %6, i64 5
  store i8 0, ptr %28, align 1, !tbaa !5
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 5, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %.131 = phi i32 [ %.02330, %.lr.ph.preheader ], [ %33, %.lr.ph ]
  %29 = urem i32 %.131, 10
  %30 = trunc nuw nsw i32 %29 to i8
  %31 = or disjoint i8 %30, 48
  %indvars.iv.next = add nsw i64 %indvars.iv, -1
  %32 = getelementptr inbounds [6 x i8], ptr %6, i64 0, i64 %indvars.iv.next
  store i8 %31, ptr %32, align 1, !tbaa !5
  %33 = udiv i32 %.131, 10
  %.not34 = icmp ult i32 %.131, 10
  br i1 %.not34, label %._crit_edge, label %.lr.ph, !llvm.loop !13

._crit_edge:                                      ; preds = %.lr.ph
  %34 = trunc nsw i64 %indvars.iv.next to i32
  %sext = shl i64 %indvars.iv.next, 32
  %35 = ashr exact i64 %sext, 32
  %36 = getelementptr inbounds [6 x i8], ptr %6, i64 0, i64 %35
  %37 = sub nsw i32 5, %34
  call void @_ZN17double_conversion13StringBuilder12AddSubstringEPKci(ptr noundef nonnull align 8 dereferenceable(20) %4, ptr noundef nonnull %36, i32 noundef %37)
  call void @llvm.lifetime.end.p0(i64 6, ptr nonnull %6) #4
  br label %38

38:                                               ; preds = %._crit_edge, %24
  ret void
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 "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 = { noreturn nounwind }
attributes #4 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !6, i64 24}
!9 = !{!"_ZTSN17double_conversion23DoubleToStringConverterE", !10, i64 0, !11, i64 8, !11, i64 16, !6, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40}
!10 = !{!"int", !6, i64 0}
!11 = !{!"any pointer", !6, i64 0}
!12 = !{!9, !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


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