; LLVM IR from Tudor67/Competitive-Programming :: AtCoder/ABC336/E_sol1_dp_on_digits.ll (Z16countGoodNumbersxi)

; 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.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

@p10 = external dso_local global [16 x i64], align 16

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z18precomputePowsOf10i(i32 noundef) #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z9resetMemoiii(i32 noundef, i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z1fiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_Z16countGoodNumbersxi(i64 noundef %0, i32 noundef %1) #2 personality ptr @__gxx_personality_v0 {
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca %"class.std::__cxx11::basic_string", align 8
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  store i64 %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 32, ptr %6) #4
  %19 = load i64, ptr %4, align 8, !tbaa !5
  call void @_ZNSt7__cxx119to_stringEx(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %6, i64 noundef %19)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %20 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %6) #4
  %21 = trunc i64 %20 to i32
  store i32 %21, ptr %7, align 4, !tbaa !9
  %22 = load i32, ptr %7, align 4, !tbaa !9
  call void @_Z18precomputePowsOf10i(i32 noundef %22)
  %23 = load i32, ptr %7, align 4, !tbaa !9
  %24 = load i32, ptr %5, align 4, !tbaa !9
  %25 = load i32, ptr %5, align 4, !tbaa !9
  call void @_Z9resetMemoiii(i32 noundef %23, i32 noundef %24, i32 noundef %25)
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  store i64 0, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  store i64 0, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  store i64 0, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %26

26:                                               ; preds = %143, %2
  %27 = load i32, ptr %11, align 4, !tbaa !9
  %28 = load i32, ptr %7, align 4, !tbaa !9
  %29 = icmp slt i32 %27, %28
  br i1 %29, label %31, label %30

30:                                               ; preds = %26
  store i32 2, ptr %12, align 4
  br label %147

31:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %32 = load i32, ptr %11, align 4, !tbaa !9
  %33 = sext i32 %32 to i64
  %34 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %6, i64 noundef %33)
          to label %35 unwind label %51

35:                                               ; preds = %31
  %36 = load i8, ptr %34, align 1, !tbaa !11
  %37 = sext i8 %36 to i32
  %38 = sub nsw i32 %37, 48
  %39 = load i32, ptr %11, align 4, !tbaa !9
  %40 = add nsw i32 %39, 1
  %41 = load i32, ptr %7, align 4, !tbaa !9
  %42 = icmp eq i32 %40, %41
  %43 = zext i1 %42 to i64
  %44 = select i1 %42, i32 0, i32 1
  %45 = sub nsw i32 %38, %44
  store i32 %45, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %46

46:                                               ; preds = %94, %35
  %47 = load i32, ptr %16, align 4, !tbaa !9
  %48 = load i32, ptr %13, align 4, !tbaa !9
  %49 = icmp sle i32 %47, %48
  br i1 %49, label %55, label %50

50:                                               ; preds = %46
  store i32 5, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  br label %101

51:                                               ; preds = %106, %101, %31
  %52 = landingpad { ptr, i32 }
          cleanup
  %53 = extractvalue { ptr, i32 } %52, 0
  store ptr %53, ptr %14, align 8
  %54 = extractvalue { ptr, i32 } %52, 1
  store i32 %54, ptr %15, align 4
  br label %146

55:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  %56 = load i64, ptr %9, align 8, !tbaa !5
  %57 = load i32, ptr %16, align 4, !tbaa !9
  %58 = sext i32 %57 to i64
  %59 = load i32, ptr %7, align 4, !tbaa !9
  %60 = sub nsw i32 %59, 1
  %61 = load i32, ptr %11, align 4, !tbaa !9
  %62 = sub nsw i32 %60, %61
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [16 x i64], ptr @p10, i64 0, i64 %63
  %65 = load i64, ptr %64, align 8, !tbaa !5
  %66 = mul nsw i64 %58, %65
  %67 = add nsw i64 %56, %66
  %68 = load i32, ptr %5, align 4, !tbaa !9
  %69 = sext i32 %68 to i64
  %70 = srem i64 %67, %69
  %71 = trunc i64 %70 to i32
  store i32 %71, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  %72 = load i64, ptr %10, align 8, !tbaa !5
  %73 = load i32, ptr %16, align 4, !tbaa !9
  %74 = sext i32 %73 to i64
  %75 = add nsw i64 %72, %74
  %76 = trunc i64 %75 to i32
  store i32 %76, ptr %18, align 4, !tbaa !9
  %77 = load i32, ptr %7, align 4, !tbaa !9
  %78 = sub nsw i32 %77, 1
  %79 = load i32, ptr %11, align 4, !tbaa !9
  %80 = sub nsw i32 %78, %79
  %81 = load i32, ptr %5, align 4, !tbaa !9
  %82 = load i32, ptr %18, align 4, !tbaa !9
  %83 = sub nsw i32 %81, %82
  %84 = load i32, ptr %5, align 4, !tbaa !9
  %85 = load i32, ptr %17, align 4, !tbaa !9
  %86 = sub nsw i32 %84, %85
  %87 = load i32, ptr %5, align 4, !tbaa !9
  %88 = srem i32 %86, %87
  %89 = load i32, ptr %5, align 4, !tbaa !9
  %90 = invoke noundef i64 @_Z1fiiii(i32 noundef %80, i32 noundef %83, i32 noundef %88, i32 noundef %89)
          to label %91 unwind label %97

91:                                               ; preds = %55
  %92 = load i64, ptr %8, align 8, !tbaa !5
  %93 = add nsw i64 %92, %90
  store i64 %93, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  br label %94

94:                                               ; preds = %91
  %95 = load i32, ptr %16, align 4, !tbaa !9
  %96 = add nsw i32 %95, 1
  store i32 %96, ptr %16, align 4, !tbaa !9
  br label %46, !llvm.loop !12

97:                                               ; preds = %55
  %98 = landingpad { ptr, i32 }
          cleanup
  %99 = extractvalue { ptr, i32 } %98, 0
  store ptr %99, ptr %14, align 8
  %100 = extractvalue { ptr, i32 } %98, 1
  store i32 %100, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  br label %146

101:                                              ; preds = %50
  %102 = load i64, ptr %9, align 8, !tbaa !5
  %103 = load i32, ptr %11, align 4, !tbaa !9
  %104 = sext i32 %103 to i64
  %105 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %6, i64 noundef %104)
          to label %106 unwind label %51

106:                                              ; preds = %101
  %107 = load i8, ptr %105, align 1, !tbaa !11
  %108 = sext i8 %107 to i32
  %109 = sub nsw i32 %108, 48
  %110 = sext i32 %109 to i64
  %111 = load i32, ptr %7, align 4, !tbaa !9
  %112 = sub nsw i32 %111, 1
  %113 = load i32, ptr %11, align 4, !tbaa !9
  %114 = sub nsw i32 %112, %113
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [16 x i64], ptr @p10, i64 0, i64 %115
  %117 = load i64, ptr %116, align 8, !tbaa !5
  %118 = mul nsw i64 %110, %117
  %119 = add nsw i64 %102, %118
  %120 = load i32, ptr %5, align 4, !tbaa !9
  %121 = sext i32 %120 to i64
  %122 = srem i64 %119, %121
  store i64 %122, ptr %9, align 8, !tbaa !5
  %123 = load i32, ptr %11, align 4, !tbaa !9
  %124 = sext i32 %123 to i64
  %125 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %6, i64 noundef %124)
          to label %126 unwind label %51

126:                                              ; preds = %106
  %127 = load i8, ptr %125, align 1, !tbaa !11
  %128 = sext i8 %127 to i32
  %129 = sub nsw i32 %128, 48
  %130 = sext i32 %129 to i64
  %131 = load i64, ptr %10, align 8, !tbaa !5
  %132 = add nsw i64 %131, %130
  store i64 %132, ptr %10, align 8, !tbaa !5
  %133 = load i64, ptr %10, align 8, !tbaa !5
  %134 = load i32, ptr %5, align 4, !tbaa !9
  %135 = sext i32 %134 to i64
  %136 = icmp sgt i64 %133, %135
  br i1 %136, label %137, label %139

137:                                              ; preds = %126
  %138 = load i64, ptr %8, align 8, !tbaa !5
  store i64 %138, ptr %3, align 8
  store i32 1, ptr %12, align 4
  br label %140

139:                                              ; preds = %126
  store i32 0, ptr %12, align 4
  br label %140

140:                                              ; preds = %139, %137
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  %141 = load i32, ptr %12, align 4
  switch i32 %141, label %147 [
    i32 0, label %142
  ]

142:                                              ; preds = %140
  br label %143

143:                                              ; preds = %142
  %144 = load i32, ptr %11, align 4, !tbaa !9
  %145 = add nsw i32 %144, 1
  store i32 %145, ptr %11, align 4, !tbaa !9
  br label %26, !llvm.loop !14

146:                                              ; preds = %97, %51
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #4
  br label %153

147:                                              ; preds = %140, %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  %148 = load i32, ptr %12, align 4
  switch i32 %148, label %151 [
    i32 2, label %149
  ]

149:                                              ; preds = %147
  %150 = load i64, ptr %8, align 8, !tbaa !5
  store i64 %150, ptr %3, align 8
  store i32 1, ptr %12, align 4
  br label %151

151:                                              ; preds = %149, %147
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #4
  %152 = load i64, ptr %3, align 8
  ret i64 %152

153:                                              ; preds = %146
  %154 = load ptr, ptr %14, align 8
  %155 = load i32, ptr %15, align 4
  %156 = insertvalue { ptr, i32 } poison, ptr %154, 0
  %157 = insertvalue { ptr, i32 } %156, i32 %155, 1
  resume { ptr, i32 } %157
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNSt7__cxx119to_stringEx(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, i64 noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) 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" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { inlinehint 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 = { 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 = !{!"long long", !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 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}


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

%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

@p10 = external dso_local local_unnamed_addr global [16 x i64], align 16

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z18precomputePowsOf10i(i32 noundef) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z9resetMemoiii(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z1fiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_Z16countGoodNumbersxi(i64 noundef %0, i32 noundef %1) local_unnamed_addr #2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.std::__cxx11::basic_string", align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #5
  call void @_ZNSt7__cxx119to_stringEx(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %3, i64 noundef %0)
  %4 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %3) #5
  %5 = trunc i64 %4 to i32
  call void @_Z18precomputePowsOf10i(i32 noundef %5)
  call void @_Z9resetMemoiii(i32 noundef %5, i32 noundef %1, i32 noundef %1)
  %6 = sext i32 %1 to i64
  %zext = and i64 %4, 4294967295
  %smax = call i32 @llvm.smax.i32(i32 %5, i32 0)
  %wide.trip.count69 = zext nneg i32 %smax to i64
  br label %7

7:                                                ; preds = %._crit_edge, %2
  %indvars.iv66 = phi i64 [ %indvars.iv.next67, %._crit_edge ], [ 0, %2 ]
  %.051 = phi i64 [ %36, %._crit_edge ], [ 0, %2 ]
  %.050 = phi i64 [ %31, %._crit_edge ], [ 0, %2 ]
  %.046 = phi i64 [ %.147.lcssa, %._crit_edge ], [ 0, %2 ]
  %exitcond70.not = icmp eq i64 %indvars.iv66, %wide.trip.count69
  br i1 %exitcond70.not, label %53, label %8

8:                                                ; preds = %7
  %9 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %3, i64 noundef %indvars.iv66)
  %10 = load i8, ptr %9, align 1, !tbaa !5
  %11 = sext i8 %10 to i32
  %indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
  %12 = icmp eq i64 %indvars.iv.next67, %zext
  %13 = select i1 %12, i32 -48, i32 -49
  %14 = add nsw i32 %13, %11
  %.not61 = icmp slt i32 %14, 0
  br i1 %.not61, label %.._crit_edge_crit_edge, label %.lr.ph

.._crit_edge_crit_edge:                           ; preds = %8
  %.pre71 = xor i64 %indvars.iv66, -1
  %.pre73 = add i64 %4, %.pre71
  %sext = shl i64 %.pre73, 32
  %.pre75 = ashr exact i64 %sext, 32
  br label %._crit_edge

.lr.ph:                                           ; preds = %8
  %15 = trunc i64 %indvars.iv66 to i32
  %16 = xor i32 %15, -1
  %17 = add i32 %16, %5
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [16 x i64], ptr @p10, i64 0, i64 %18
  %20 = trunc i64 %.051 to i32
  %21 = add nuw nsw i32 %13, 1
  %22 = add nsw i32 %21, %11
  %wide.trip.count = zext i32 %22 to i64
  br label %37

._crit_edge:                                      ; preds = %49, %.._crit_edge_crit_edge
  %.pre-phi76 = phi i64 [ %.pre75, %.._crit_edge_crit_edge ], [ %18, %49 ]
  %.147.lcssa = phi i64 [ %.046, %.._crit_edge_crit_edge ], [ %50, %49 ]
  %23 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %3, i64 noundef %indvars.iv66)
  %24 = load i8, ptr %23, align 1, !tbaa !5
  %25 = sext i8 %24 to i64
  %26 = add nsw i64 %25, -48
  %27 = getelementptr inbounds [16 x i64], ptr @p10, i64 0, i64 %.pre-phi76
  %28 = load i64, ptr %27, align 8, !tbaa !8
  %29 = mul nsw i64 %26, %28
  %30 = add nsw i64 %29, %.050
  %31 = srem i64 %30, %6
  %32 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %3, i64 noundef %indvars.iv66)
  %33 = load i8, ptr %32, align 1, !tbaa !5
  %34 = sext i8 %33 to i64
  %35 = add i64 %.051, -48
  %36 = add i64 %35, %34
  %.not56 = icmp sgt i64 %36, %6
  br i1 %.not56, label %53, label %7, !llvm.loop !10

37:                                               ; preds = %.lr.ph, %49
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %49 ]
  %.14763 = phi i64 [ %.046, %.lr.ph ], [ %50, %49 ]
  %38 = load i64, ptr %19, align 8, !tbaa !8
  %39 = mul nsw i64 %38, %indvars.iv
  %40 = add nsw i64 %39, %.050
  %41 = srem i64 %40, %6
  %42 = trunc nsw i64 %41 to i32
  %43 = trunc nuw nsw i64 %indvars.iv to i32
  %44 = add i32 %43, %20
  %45 = sub i32 %1, %44
  %46 = sub nsw i32 %1, %42
  %47 = srem i32 %46, %1
  %48 = invoke noundef i64 @_Z1fiiii(i32 noundef %17, i32 noundef %45, i32 noundef %47, i32 noundef %1)
          to label %49 unwind label %51

49:                                               ; preds = %37
  %50 = add nsw i64 %48, %.14763
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %37, !llvm.loop !12

51:                                               ; preds = %37
  %52 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #5
  resume { ptr, i32 } %52

53:                                               ; preds = %7, %._crit_edge
  %spec.select = phi i64 [ %.147.lcssa, %._crit_edge ], [ %.046, %7 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #5
  ret i64 %spec.select
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNSt7__cxx119to_stringEx(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, i64 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) local_unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4

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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { inlinehint 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long long", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}


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