; LLVM IR from ahr9n/psolving-paradigms :: 4.dynamic-programming/21.non-classical/CodeForces 706C - Hard problem.ll (Z2dpib)

; 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] }
%"class.std::initializer_list" = type { ptr, i64 }

@n = external dso_local global i64, align 8
@cost = external dso_local global [100005 x i64], align 16
@mem = external dso_local global [100005 x [2 x i64]], align 16
@_Z1sB5cxx11 = external dso_local global [100005 x %"class.std::__cxx11::basic_string"], align 16
@_Z3revB5cxx11 = external dso_local global [100005 x %"class.std::__cxx11::basic_string"], align 16

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_Z2dpib(i32 noundef %0, i1 noundef zeroext %1) #0 {
  %3 = alloca i64, align 8
  %4 = alloca i32, align 4
  %5 = alloca i8, align 1
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca %"class.std::initializer_list", align 8
  %12 = alloca [3 x i64], align 8
  store i32 %0, ptr %4, align 4, !tbaa !5
  %13 = zext i1 %1 to i8
  store i8 %13, ptr %5, align 1, !tbaa !9
  %14 = load i32, ptr %4, align 4, !tbaa !5
  %15 = sext i32 %14 to i64
  %16 = load i64, ptr @n, align 8, !tbaa !11
  %17 = icmp eq i64 %15, %16
  br i1 %17, label %18, label %19

18:                                               ; preds = %2
  store i64 0, ptr %3, align 8
  br label %159

19:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %20 = load i32, ptr %4, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [100005 x [2 x i64]], ptr @mem, i64 0, i64 %21
  %23 = load i8, ptr %5, align 1, !tbaa !9, !range !13, !noundef !14
  %24 = trunc i8 %23 to i1
  %25 = zext i1 %24 to i64
  %26 = getelementptr inbounds [2 x i64], ptr %22, i64 0, i64 %25
  store ptr %26, ptr %6, align 8, !tbaa !15
  %27 = load ptr, ptr %6, align 8, !tbaa !15
  %28 = load i64, ptr %27, align 8, !tbaa !11
  %29 = xor i64 %28, -1
  %30 = icmp ne i64 %29, 0
  br i1 %30, label %31, label %34

31:                                               ; preds = %19
  %32 = load ptr, ptr %6, align 8, !tbaa !15
  %33 = load i64, ptr %32, align 8, !tbaa !11
  store i64 %33, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %158

34:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  store i64 1000000000000000, ptr %8, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  store i64 1000000000000000, ptr %9, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  store i64 1000000000000000, ptr %10, align 8, !tbaa !11
  %35 = load i8, ptr %5, align 1, !tbaa !9, !range !13, !noundef !14
  %36 = trunc i8 %35 to i1
  br i1 %36, label %37, label %90

37:                                               ; preds = %34
  %38 = load i32, ptr %4, align 4, !tbaa !5
  %39 = sub nsw i32 %38, 1
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [100005 x %"class.std::__cxx11::basic_string"], ptr @_Z3revB5cxx11, i64 0, i64 %40
  %42 = load i32, ptr %4, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [100005 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %43
  %45 = call noundef zeroext i1 @_ZStleIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EESA_(ptr noundef nonnull align 8 dereferenceable(32) %41, ptr noundef nonnull align 8 dereferenceable(32) %44) #4
  br i1 %45, label %46, label %50

46:                                               ; preds = %37
  %47 = load i32, ptr %4, align 4, !tbaa !5
  %48 = add nsw i32 %47, 1
  %49 = call noundef i64 @_Z2dpib(i32 noundef %48, i1 noundef zeroext false)
  store i64 %49, ptr %8, align 8, !tbaa !11
  br label %71

50:                                               ; preds = %37
  %51 = load i32, ptr %4, align 4, !tbaa !5
  %52 = sub nsw i32 %51, 1
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [100005 x %"class.std::__cxx11::basic_string"], ptr @_Z3revB5cxx11, i64 0, i64 %53
  %55 = load i32, ptr %4, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [100005 x %"class.std::__cxx11::basic_string"], ptr @_Z3revB5cxx11, i64 0, i64 %56
  %58 = call noundef zeroext i1 @_ZStleIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EESA_(ptr noundef nonnull align 8 dereferenceable(32) %54, ptr noundef nonnull align 8 dereferenceable(32) %57) #4
  br i1 %58, label %59, label %68

59:                                               ; preds = %50
  %60 = load i32, ptr %4, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [100005 x i64], ptr @cost, i64 0, i64 %61
  %63 = load i64, ptr %62, align 8, !tbaa !11
  %64 = load i32, ptr %4, align 4, !tbaa !5
  %65 = add nsw i32 %64, 1
  %66 = call noundef i64 @_Z2dpib(i32 noundef %65, i1 noundef zeroext true)
  %67 = add nsw i64 %63, %66
  store i64 %67, ptr %9, align 8, !tbaa !11
  br label %70

68:                                               ; preds = %50
  %69 = load ptr, ptr %6, align 8, !tbaa !15
  store i64 1000000000000000, ptr %69, align 8, !tbaa !11
  store i64 1000000000000000, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %157

70:                                               ; preds = %59
  br label %71

71:                                               ; preds = %70, %46
  %72 = load i32, ptr %4, align 4, !tbaa !5
  %73 = sub nsw i32 %72, 1
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [100005 x %"class.std::__cxx11::basic_string"], ptr @_Z3revB5cxx11, i64 0, i64 %74
  %76 = load i32, ptr %4, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [100005 x %"class.std::__cxx11::basic_string"], ptr @_Z3revB5cxx11, i64 0, i64 %77
  %79 = call noundef zeroext i1 @_ZStleIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EESA_(ptr noundef nonnull align 8 dereferenceable(32) %75, ptr noundef nonnull align 8 dereferenceable(32) %78) #4
  br i1 %79, label %80, label %89

80:                                               ; preds = %71
  %81 = load i32, ptr %4, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [100005 x i64], ptr @cost, i64 0, i64 %82
  %84 = load i64, ptr %83, align 8, !tbaa !11
  %85 = load i32, ptr %4, align 4, !tbaa !5
  %86 = add nsw i32 %85, 1
  %87 = call noundef i64 @_Z2dpib(i32 noundef %86, i1 noundef zeroext true)
  %88 = add nsw i64 %84, %87
  store i64 %88, ptr %10, align 8, !tbaa !11
  br label %89

89:                                               ; preds = %80, %71
  br label %143

90:                                               ; preds = %34
  %91 = load i32, ptr %4, align 4, !tbaa !5
  %92 = sub nsw i32 %91, 1
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [100005 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %93
  %95 = load i32, ptr %4, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [100005 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %96
  %98 = call noundef zeroext i1 @_ZStleIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EESA_(ptr noundef nonnull align 8 dereferenceable(32) %94, ptr noundef nonnull align 8 dereferenceable(32) %97) #4
  br i1 %98, label %99, label %103

99:                                               ; preds = %90
  %100 = load i32, ptr %4, align 4, !tbaa !5
  %101 = add nsw i32 %100, 1
  %102 = call noundef i64 @_Z2dpib(i32 noundef %101, i1 noundef zeroext false)
  store i64 %102, ptr %8, align 8, !tbaa !11
  br label %124

103:                                              ; preds = %90
  %104 = load i32, ptr %4, align 4, !tbaa !5
  %105 = sub nsw i32 %104, 1
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [100005 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %106
  %108 = load i32, ptr %4, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [100005 x %"class.std::__cxx11::basic_string"], ptr @_Z3revB5cxx11, i64 0, i64 %109
  %111 = call noundef zeroext i1 @_ZStleIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EESA_(ptr noundef nonnull align 8 dereferenceable(32) %107, ptr noundef nonnull align 8 dereferenceable(32) %110) #4
  br i1 %111, label %112, label %121

112:                                              ; preds = %103
  %113 = load i32, ptr %4, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [100005 x i64], ptr @cost, i64 0, i64 %114
  %116 = load i64, ptr %115, align 8, !tbaa !11
  %117 = load i32, ptr %4, align 4, !tbaa !5
  %118 = add nsw i32 %117, 1
  %119 = call noundef i64 @_Z2dpib(i32 noundef %118, i1 noundef zeroext true)
  %120 = add nsw i64 %116, %119
  store i64 %120, ptr %9, align 8, !tbaa !11
  br label %123

121:                                              ; preds = %103
  %122 = load ptr, ptr %6, align 8, !tbaa !15
  store i64 1000000000000000, ptr %122, align 8, !tbaa !11
  store i64 1000000000000000, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %157

123:                                              ; preds = %112
  br label %124

124:                                              ; preds = %123, %99
  %125 = load i32, ptr %4, align 4, !tbaa !5
  %126 = sub nsw i32 %125, 1
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [100005 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %127
  %129 = load i32, ptr %4, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [100005 x %"class.std::__cxx11::basic_string"], ptr @_Z3revB5cxx11, i64 0, i64 %130
  %132 = call noundef zeroext i1 @_ZStleIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EESA_(ptr noundef nonnull align 8 dereferenceable(32) %128, ptr noundef nonnull align 8 dereferenceable(32) %131) #4
  br i1 %132, label %133, label %142

133:                                              ; preds = %124
  %134 = load i32, ptr %4, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [100005 x i64], ptr @cost, i64 0, i64 %135
  %137 = load i64, ptr %136, align 8, !tbaa !11
  %138 = load i32, ptr %4, align 4, !tbaa !5
  %139 = add nsw i32 %138, 1
  %140 = call noundef i64 @_Z2dpib(i32 noundef %139, i1 noundef zeroext true)
  %141 = add nsw i64 %137, %140
  store i64 %141, ptr %10, align 8, !tbaa !11
  br label %142

142:                                              ; preds = %133, %124
  br label %143

143:                                              ; preds = %142, %89
  call void @llvm.lifetime.start.p0(i64 24, ptr %12) #4
  %144 = load i64, ptr %8, align 8, !tbaa !11
  store i64 %144, ptr %12, align 8, !tbaa !11
  %145 = getelementptr inbounds i64, ptr %12, i64 1
  %146 = load i64, ptr %9, align 8, !tbaa !11
  store i64 %146, ptr %145, align 8, !tbaa !11
  %147 = getelementptr inbounds i64, ptr %12, i64 2
  %148 = load i64, ptr %10, align 8, !tbaa !11
  store i64 %148, ptr %147, align 8, !tbaa !11
  %149 = getelementptr inbounds %"class.std::initializer_list", ptr %11, i32 0, i32 0
  store ptr %12, ptr %149, align 8, !tbaa !17
  %150 = getelementptr inbounds %"class.std::initializer_list", ptr %11, i32 0, i32 1
  store i64 3, ptr %150, align 8, !tbaa !20
  %151 = getelementptr inbounds { ptr, i64 }, ptr %11, i32 0, i32 0
  %152 = load ptr, ptr %151, align 8
  %153 = getelementptr inbounds { ptr, i64 }, ptr %11, i32 0, i32 1
  %154 = load i64, ptr %153, align 8
  %155 = call noundef i64 @_ZSt3minIxET_St16initializer_listIS0_E(ptr %152, i64 %154)
  %156 = load ptr, ptr %6, align 8, !tbaa !15
  store i64 %155, ptr %156, align 8, !tbaa !11
  store i64 %155, ptr %3, align 8
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #4
  store i32 1, ptr %7, align 4
  br label %157

157:                                              ; preds = %143, %121, %68
  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
  br label %158

158:                                              ; preds = %157, %31
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  br label %159

159:                                              ; preds = %158, %18
  %160 = load i64, ptr %3, align 8
  ret i64 %160
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStleIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EESA_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_ZSt3minIxET_St16initializer_listIS0_E(ptr, i64) #3

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint 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 #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!16, !16, i64 0}
!16 = !{!"any pointer", !7, i64 0}
!17 = !{!18, !16, i64 0}
!18 = !{!"_ZTSSt16initializer_listIxE", !16, i64 0, !19, i64 8}
!19 = !{!"long", !7, i64 0}
!20 = !{!18, !19, i64 8}


; 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] }

@n = external dso_local local_unnamed_addr global i64, align 8
@cost = external dso_local local_unnamed_addr global [100005 x i64], align 16
@mem = external dso_local local_unnamed_addr global [100005 x [2 x i64]], align 16
@_Z1sB5cxx11 = external dso_local global [100005 x %"class.std::__cxx11::basic_string"], align 16
@_Z3revB5cxx11 = external dso_local global [100005 x %"class.std::__cxx11::basic_string"], align 16

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_Z2dpib(i32 noundef %0, i1 noundef zeroext %1) local_unnamed_addr #0 {
  %3 = alloca [3 x i64], align 8
  %4 = sext i32 %0 to i64
  %5 = load i64, ptr @n, align 8, !tbaa !5
  %6 = icmp eq i64 %5, %4
  br i1 %6, label %62, label %7

7:                                                ; preds = %2
  %8 = zext i1 %1 to i64
  %9 = getelementptr inbounds [100005 x [2 x i64]], ptr @mem, i64 0, i64 %4, i64 %8
  %10 = load i64, ptr %9, align 8, !tbaa !5
  %.not = icmp eq i64 %10, -1
  br i1 %.not, label %11, label %62

11:                                               ; preds = %7
  %12 = add nsw i32 %0, -1
  %13 = sext i32 %12 to i64
  %14 = getelementptr inbounds [100005 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %4
  br i1 %1, label %15, label %34

15:                                               ; preds = %11
  %16 = getelementptr inbounds [100005 x %"class.std::__cxx11::basic_string"], ptr @_Z3revB5cxx11, i64 0, i64 %13
  %17 = tail call noundef zeroext i1 @_ZStleIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EESA_(ptr noundef nonnull align 8 dereferenceable(32) %16, ptr noundef nonnull align 8 dereferenceable(32) %14) #4
  br i1 %17, label %18, label %21

18:                                               ; preds = %15
  %19 = add nsw i32 %0, 1
  %20 = tail call noundef i64 @_Z2dpib(i32 noundef %19, i1 noundef zeroext false)
  br label %31

21:                                               ; preds = %15
  %22 = getelementptr inbounds [100005 x %"class.std::__cxx11::basic_string"], ptr @_Z3revB5cxx11, i64 0, i64 %4
  %23 = tail call noundef zeroext i1 @_ZStleIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EESA_(ptr noundef nonnull align 8 dereferenceable(32) %16, ptr noundef nonnull align 8 dereferenceable(32) %22) #4
  br i1 %23, label %24, label %30

24:                                               ; preds = %21
  %25 = getelementptr inbounds [100005 x i64], ptr @cost, i64 0, i64 %4
  %26 = load i64, ptr %25, align 8, !tbaa !5
  %27 = add nsw i32 %0, 1
  %28 = tail call noundef i64 @_Z2dpib(i32 noundef %27, i1 noundef zeroext true)
  %29 = add nsw i64 %28, %26
  br label %31

30:                                               ; preds = %21
  store i64 1000000000000000, ptr %9, align 8, !tbaa !5
  br label %62

31:                                               ; preds = %24, %18
  %.038 = phi i64 [ %20, %18 ], [ 1000000000000000, %24 ]
  %.035 = phi i64 [ 1000000000000000, %18 ], [ %29, %24 ]
  %32 = getelementptr inbounds [100005 x %"class.std::__cxx11::basic_string"], ptr @_Z3revB5cxx11, i64 0, i64 %4
  %33 = tail call noundef zeroext i1 @_ZStleIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EESA_(ptr noundef nonnull align 8 dereferenceable(32) %16, ptr noundef nonnull align 8 dereferenceable(32) %32) #4
  br i1 %33, label %.sink.split, label %58

34:                                               ; preds = %11
  %35 = getelementptr inbounds [100005 x %"class.std::__cxx11::basic_string"], ptr @_Z1sB5cxx11, i64 0, i64 %13
  %36 = tail call noundef zeroext i1 @_ZStleIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EESA_(ptr noundef nonnull align 8 dereferenceable(32) %35, ptr noundef nonnull align 8 dereferenceable(32) %14) #4
  br i1 %36, label %37, label %40

37:                                               ; preds = %34
  %38 = add nsw i32 %0, 1
  %39 = tail call noundef i64 @_Z2dpib(i32 noundef %38, i1 noundef zeroext false)
  br label %50

40:                                               ; preds = %34
  %41 = getelementptr inbounds [100005 x %"class.std::__cxx11::basic_string"], ptr @_Z3revB5cxx11, i64 0, i64 %4
  %42 = tail call noundef zeroext i1 @_ZStleIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EESA_(ptr noundef nonnull align 8 dereferenceable(32) %35, ptr noundef nonnull align 8 dereferenceable(32) %41) #4
  br i1 %42, label %43, label %49

43:                                               ; preds = %40
  %44 = getelementptr inbounds [100005 x i64], ptr @cost, i64 0, i64 %4
  %45 = load i64, ptr %44, align 8, !tbaa !5
  %46 = add nsw i32 %0, 1
  %47 = tail call noundef i64 @_Z2dpib(i32 noundef %46, i1 noundef zeroext true)
  %48 = add nsw i64 %47, %45
  br label %50

49:                                               ; preds = %40
  store i64 1000000000000000, ptr %9, align 8, !tbaa !5
  br label %62

50:                                               ; preds = %43, %37
  %.139 = phi i64 [ %39, %37 ], [ 1000000000000000, %43 ]
  %.136 = phi i64 [ 1000000000000000, %37 ], [ %48, %43 ]
  %51 = getelementptr inbounds [100005 x %"class.std::__cxx11::basic_string"], ptr @_Z3revB5cxx11, i64 0, i64 %4
  %52 = tail call noundef zeroext i1 @_ZStleIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EESA_(ptr noundef nonnull align 8 dereferenceable(32) %35, ptr noundef nonnull align 8 dereferenceable(32) %51) #4
  br i1 %52, label %.sink.split, label %58

.sink.split:                                      ; preds = %50, %31
  %.240.ph = phi i64 [ %.038, %31 ], [ %.139, %50 ]
  %.237.ph = phi i64 [ %.035, %31 ], [ %.136, %50 ]
  %53 = getelementptr inbounds [100005 x i64], ptr @cost, i64 0, i64 %4
  %54 = load i64, ptr %53, align 8, !tbaa !5
  %55 = add nsw i32 %0, 1
  %56 = tail call noundef i64 @_Z2dpib(i32 noundef %55, i1 noundef zeroext true)
  %57 = add nsw i64 %56, %54
  br label %58

58:                                               ; preds = %.sink.split, %50, %31
  %.240 = phi i64 [ %.038, %31 ], [ %.139, %50 ], [ %.240.ph, %.sink.split ]
  %.237 = phi i64 [ %.035, %31 ], [ %.136, %50 ], [ %.237.ph, %.sink.split ]
  %.034 = phi i64 [ 1000000000000000, %31 ], [ 1000000000000000, %50 ], [ %57, %.sink.split ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #4
  store i64 %.240, ptr %3, align 8, !tbaa !5
  %59 = getelementptr inbounds i8, ptr %3, i64 8
  store i64 %.237, ptr %59, align 8, !tbaa !5
  %60 = getelementptr inbounds i8, ptr %3, i64 16
  store i64 %.034, ptr %60, align 8, !tbaa !5
  %61 = call noundef i64 @_ZSt3minIxET_St16initializer_listIS0_E(ptr nonnull %3, i64 3)
  store i64 %61, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #4
  br label %62

62:                                               ; preds = %7, %58, %49, %30, %2
  %.2 = phi i64 [ 0, %2 ], [ %10, %7 ], [ %61, %58 ], [ 1000000000000000, %30 ], [ 1000000000000000, %49 ]
  ret i64 %.2
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStleIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EESA_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_ZSt3minIxET_St16initializer_listIS0_E(ptr, i64) local_unnamed_addr #3

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

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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint 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 #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"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass