; LLVM IR from xirc/cp-algorithm :: codeforces/1369/B/main.ll/Z5solveRKNSt7 (cxx1112basic_stringIcSt11char_traitsIcESaIcEEE)

; 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::__cxx11::list" = type { %"class.std::__cxx11::_List_base" }
%"class.std::__cxx11::_List_base" = type { %"struct.std::__cxx11::_List_base<char, std::allocator<char>>::_List_impl" }
%"struct.std::__cxx11::_List_base<char, std::allocator<char>>::_List_impl" = type { %"struct.std::__detail::_List_node_header" }
%"struct.std::__detail::_List_node_header" = type { %"struct.std::__detail::_List_node_base", i64 }
%"struct.std::__detail::_List_node_base" = type { ptr, ptr }
%"class.std::reverse_iterator" = type { %"class.__gnu_cxx::__normal_iterator" }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%"class.std::allocator" = type { i8 }
%"struct.std::_List_iterator" = type { ptr }
%"struct.std::_List_const_iterator" = type { ptr }
%"class.std::reverse_iterator.3" = type { %"struct.std::_List_iterator" }

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solveRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8 %0, ptr noundef nonnull align 8 dereferenceable(32) %1) #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %"class.std::__cxx11::list", align 8
  %6 = alloca %"class.std::reverse_iterator", align 8
  %7 = alloca %"class.std::reverse_iterator", align 8
  %8 = alloca %"class.std::allocator", align 1
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca %"struct.std::_List_iterator", align 8
  %12 = alloca %"struct.std::_List_iterator", align 8
  %13 = alloca %"struct.std::_List_iterator", align 8
  %14 = alloca %"struct.std::_List_iterator", align 8
  %15 = alloca %"struct.std::_List_iterator", align 8
  %16 = alloca %"struct.std::_List_iterator", align 8
  %17 = alloca %"struct.std::_List_iterator", align 8
  %18 = alloca %"struct.std::_List_iterator", align 8
  %19 = alloca %"struct.std::_List_const_iterator", align 8
  %20 = alloca %"struct.std::_List_iterator", align 8
  %21 = alloca %"struct.std::_List_const_iterator", align 8
  %22 = alloca %"struct.std::_List_iterator", align 8
  %23 = alloca i32, align 4
  %24 = alloca %"struct.std::_List_iterator", align 8
  %25 = alloca %"class.std::reverse_iterator.3", align 8
  %26 = alloca %"class.std::reverse_iterator.3", align 8
  %27 = alloca %"class.std::allocator", align 1
  store ptr %0, ptr %3, align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %5) #4
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6rbeginEv(ptr dead_on_unwind writable sret(%"class.std::reverse_iterator") align 8 %6, ptr noundef nonnull align 8 dereferenceable(32) %28) #4
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4rendEv(ptr dead_on_unwind writable sret(%"class.std::reverse_iterator") align 8 %7, ptr noundef nonnull align 8 dereferenceable(32) %29) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #4
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #4
  invoke void @_ZNSt7__cxx114listIcSaIcEEC2ISt16reverse_iteratorIN9__gnu_cxx17__normal_iteratorIPKcNS_12basic_stringIcSt11char_traitsIcES1_EEEEEvEET_SF_RKS1_(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef %6, ptr noundef %7, ptr noundef nonnull align 1 dereferenceable(1) %8)
          to label %30 unwind label %72

30:                                               ; preds = %2
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %31 = call ptr @_ZNSt7__cxx114listIcSaIcEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #4
  %32 = getelementptr inbounds %"struct.std::_List_iterator", ptr %11, i32 0, i32 0
  store ptr %31, ptr %32, align 8
  br label %33

33:                                               ; preds = %87, %84, %30
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %34 = call ptr @_ZNSt7__cxx114listIcSaIcEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #4
  %35 = getelementptr inbounds %"struct.std::_List_iterator", ptr %12, i32 0, i32 0
  store ptr %34, ptr %35, align 8
  %36 = call noundef zeroext i1 @_ZStneRKSt14_List_iteratorIcES2_(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 8 dereferenceable(8) %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  br i1 %36, label %37, label %90

37:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %38 = call ptr @_ZNSt7__cxx114listIcSaIcEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #4
  %39 = getelementptr inbounds %"struct.std::_List_iterator", ptr %13, i32 0, i32 0
  store ptr %38, ptr %39, align 8
  %40 = call noundef zeroext i1 @_ZStneRKSt14_List_iteratorIcES2_(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 8 dereferenceable(8) %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  br i1 %40, label %41, label %87

41:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %14, ptr align 8 %11, i64 8, i1 false), !tbaa.struct !9
  %42 = call ptr @_ZNSt14_List_iteratorIcEmmEi(ptr noundef nonnull align 8 dereferenceable(8) %14, i32 noundef 0) #4
  %43 = getelementptr inbounds %"struct.std::_List_iterator", ptr %15, i32 0, i32 0
  store ptr %42, ptr %43, align 8
  %44 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt14_List_iteratorIcEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %11) #4
  %45 = load i8, ptr %44, align 1, !tbaa !10
  %46 = sext i8 %45 to i32
  %47 = icmp eq i32 %46, 49
  br i1 %47, label %48, label %83

48:                                               ; preds = %41
  %49 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt14_List_iteratorIcEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %14) #4
  %50 = load i8, ptr %49, align 1, !tbaa !10
  %51 = sext i8 %50 to i32
  %52 = icmp eq i32 %51, 48
  br i1 %52, label %53, label %83

53:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %16, ptr align 8 %14, i64 8, i1 false), !tbaa.struct !9
  %54 = call ptr @_ZNSt14_List_iteratorIcEmmEi(ptr noundef nonnull align 8 dereferenceable(8) %16, i32 noundef 0) #4
  %55 = getelementptr inbounds %"struct.std::_List_iterator", ptr %17, i32 0, i32 0
  store ptr %54, ptr %55, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  %56 = call ptr @_ZNSt7__cxx114listIcSaIcEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #4
  %57 = getelementptr inbounds %"struct.std::_List_iterator", ptr %18, i32 0, i32 0
  store ptr %56, ptr %57, align 8
  %58 = call noundef zeroext i1 @_ZSteqRKSt14_List_iteratorIcES2_(ptr noundef nonnull align 8 dereferenceable(8) %14, ptr noundef nonnull align 8 dereferenceable(8) %18) #4
  br i1 %58, label %64, label %59

59:                                               ; preds = %53
  %60 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt14_List_iteratorIcEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %16) #4
  %61 = load i8, ptr %60, align 1, !tbaa !10
  %62 = sext i8 %61 to i32
  %63 = icmp ne i32 %62, 48
  br label %64

64:                                               ; preds = %59, %53
  %65 = phi i1 [ true, %53 ], [ %63, %59 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  br i1 %65, label %66, label %76

66:                                               ; preds = %64
  call void @_ZNSt20_List_const_iteratorIcEC2ERKSt14_List_iteratorIcE(ptr noundef nonnull align 8 dereferenceable(8) %19, ptr noundef nonnull align 8 dereferenceable(8) %14) #4
  %67 = getelementptr inbounds %"struct.std::_List_const_iterator", ptr %19, i32 0, i32 0
  %68 = load ptr, ptr %67, align 8
  %69 = call ptr @_ZNSt7__cxx114listIcSaIcEE5eraseESt20_List_const_iteratorIcE(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr %68) #4
  %70 = getelementptr inbounds %"struct.std::_List_iterator", ptr %20, i32 0, i32 0
  store ptr %69, ptr %70, align 8
  %71 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt14_List_iteratorIcEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %11) #4
  store i8 48, ptr %71, align 1, !tbaa !10
  br label %82

72:                                               ; preds = %2
  %73 = landingpad { ptr, i32 }
          cleanup
  %74 = extractvalue { ptr, i32 } %73, 0
  store ptr %74, ptr %9, align 8
  %75 = extractvalue { ptr, i32 } %73, 1
  store i32 %75, ptr %10, align 4
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #4
  br label %96

76:                                               ; preds = %64
  call void @_ZNSt20_List_const_iteratorIcEC2ERKSt14_List_iteratorIcE(ptr noundef nonnull align 8 dereferenceable(8) %21, ptr noundef nonnull align 8 dereferenceable(8) %14) #4
  %77 = getelementptr inbounds %"struct.std::_List_const_iterator", ptr %21, i32 0, i32 0
  %78 = load ptr, ptr %77, align 8
  %79 = call ptr @_ZNSt7__cxx114listIcSaIcEE5eraseESt20_List_const_iteratorIcE(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr %78) #4
  %80 = getelementptr inbounds %"struct.std::_List_iterator", ptr %22, i32 0, i32 0
  store ptr %79, ptr %80, align 8
  %81 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt14_List_iteratorIcEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %11) #4
  store i8 49, ptr %81, align 1, !tbaa !10
  br label %82

82:                                               ; preds = %76, %66
  store i32 2, ptr %23, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  br label %84

83:                                               ; preds = %48, %41
  store i32 0, ptr %23, align 4
  br label %84

84:                                               ; preds = %83, %82
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  %85 = load i32, ptr %23, align 4
  switch i32 %85, label %102 [
    i32 0, label %86
    i32 2, label %33
  ]

86:                                               ; preds = %84
  br label %87

87:                                               ; preds = %86, %37
  %88 = call ptr @_ZNSt14_List_iteratorIcEppEi(ptr noundef nonnull align 8 dereferenceable(8) %11, i32 noundef 0) #4
  %89 = getelementptr inbounds %"struct.std::_List_iterator", ptr %24, i32 0, i32 0
  store ptr %88, ptr %89, align 8
  br label %33, !llvm.loop !11

90:                                               ; preds = %33
  call void @_ZNSt7__cxx114listIcSaIcEE6rbeginEv(ptr dead_on_unwind writable sret(%"class.std::reverse_iterator.3") align 8 %25, ptr noundef nonnull align 8 dereferenceable(24) %5) #4
  call void @_ZNSt7__cxx114listIcSaIcEE4rendEv(ptr dead_on_unwind writable sret(%"class.std::reverse_iterator.3") align 8 %26, ptr noundef nonnull align 8 dereferenceable(24) %5) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %27) #4
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %27) #4
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ISt16reverse_iteratorISt14_List_iteratorIcEEvEET_SA_RKS3_(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef %25, ptr noundef %26, ptr noundef nonnull align 1 dereferenceable(1) %27)
          to label %91 unwind label %92

91:                                               ; preds = %90
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %27) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %27) #4
  store i32 1, ptr %23, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @_ZNSt7__cxx1110_List_baseIcSaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %5) #4
  ret void

92:                                               ; preds = %90
  %93 = landingpad { ptr, i32 }
          cleanup
  %94 = extractvalue { ptr, i32 } %93, 0
  store ptr %94, ptr %9, align 8
  %95 = extractvalue { ptr, i32 } %93, 1
  store i32 %95, ptr %10, align 4
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %27) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %27) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @_ZNSt7__cxx1110_List_baseIcSaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #4
  br label %96

96:                                               ; preds = %92, %72
  call void @llvm.lifetime.end.p0(i64 24, ptr %5) #4
  br label %97

97:                                               ; preds = %96
  %98 = load ptr, ptr %9, align 8
  %99 = load i32, ptr %10, align 4
  %100 = insertvalue { ptr, i32 } poison, ptr %98, 0
  %101 = insertvalue { ptr, i32 } %100, i32 %99, 1
  resume { ptr, i32 } %101

102:                                              ; preds = %84
  unreachable
}

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

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6rbeginEv(ptr dead_on_unwind noalias writable sret(%"class.std::reverse_iterator") align 8, ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4rendEv(ptr dead_on_unwind noalias writable sret(%"class.std::reverse_iterator") align 8, ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx114listIcSaIcEEC2ISt16reverse_iteratorIN9__gnu_cxx17__normal_iteratorIPKcNS_12basic_stringIcSt11char_traitsIcES1_EEEEEvEET_SF_RKS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef, ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; 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 ptr @_ZNSt7__cxx114listIcSaIcEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt7__cxx114listIcSaIcEE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt14_List_iteratorIcEmmEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt14_List_iteratorIcEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt7__cxx114listIcSaIcEE5eraseESt20_List_const_iteratorIcE(ptr noundef nonnull align 8 dereferenceable(24), ptr) #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt14_List_iteratorIcEppEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt7__cxx114listIcSaIcEE6rbeginEv(ptr dead_on_unwind noalias writable sret(%"class.std::reverse_iterator.3") align 8, ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt7__cxx114listIcSaIcEE4rendEv(ptr dead_on_unwind noalias writable sret(%"class.std::reverse_iterator.3") align 8, ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ISt16reverse_iteratorISt14_List_iteratorIcEEvEET_SA_RKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt7__cxx1110_List_baseIcSaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{i64 0, i64 8, !5}
!10 = !{!7, !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"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"

%"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::__cxx11::list" = type { %"class.std::__cxx11::_List_base" }
%"class.std::__cxx11::_List_base" = type { %"struct.std::__cxx11::_List_base<char, std::allocator<char>>::_List_impl" }
%"struct.std::__cxx11::_List_base<char, std::allocator<char>>::_List_impl" = type { %"struct.std::__detail::_List_node_header" }
%"struct.std::__detail::_List_node_header" = type { %"struct.std::__detail::_List_node_base", i64 }
%"struct.std::__detail::_List_node_base" = type { ptr, ptr }
%"class.std::reverse_iterator" = type { %"class.__gnu_cxx::__normal_iterator" }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%"class.std::allocator" = type { i8 }
%"struct.std::_List_iterator" = type { ptr }
%"struct.std::_List_const_iterator" = type { ptr }
%"class.std::reverse_iterator.3" = type { %"struct.std::_List_iterator" }

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solveRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8 %0, ptr noundef nonnull align 8 dereferenceable(32) %1) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.std::__cxx11::list", align 8
  %4 = alloca %"class.std::reverse_iterator", align 8
  %5 = alloca %"class.std::reverse_iterator", align 8
  %6 = alloca %"class.std::allocator", align 1
  %7 = alloca %"struct.std::_List_iterator", align 8
  %8 = alloca %"struct.std::_List_iterator", align 8
  %9 = alloca %"struct.std::_List_iterator", align 8
  %10 = alloca %"struct.std::_List_iterator", align 8
  %11 = alloca %"struct.std::_List_iterator", align 8
  %12 = alloca %"struct.std::_List_iterator", align 8
  %13 = alloca %"struct.std::_List_const_iterator", align 8
  %14 = alloca %"struct.std::_List_const_iterator", align 8
  %15 = alloca %"class.std::reverse_iterator.3", align 8
  %16 = alloca %"class.std::reverse_iterator.3", align 8
  %17 = alloca %"class.std::allocator", align 1
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #3
  call void @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6rbeginEv(ptr dead_on_unwind nonnull writable sret(%"class.std::reverse_iterator") align 8 %4, ptr noundef nonnull align 8 dereferenceable(32) %1) #3
  call void @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4rendEv(ptr dead_on_unwind nonnull writable sret(%"class.std::reverse_iterator") align 8 %5, ptr noundef nonnull align 8 dereferenceable(32) %1) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %6) #3
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #3
  invoke void @_ZNSt7__cxx114listIcSaIcEEC2ISt16reverse_iteratorIN9__gnu_cxx17__normal_iteratorIPKcNS_12basic_stringIcSt11char_traitsIcES1_EEEEEvEET_SF_RKS1_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull %4, ptr noundef nonnull %5, ptr noundef nonnull align 1 dereferenceable(1) %6)
          to label %18 unwind label %42

18:                                               ; preds = %2
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #3
  %19 = call ptr @_ZNSt7__cxx114listIcSaIcEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #3
  store ptr %19, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #3
  %20 = call ptr @_ZNSt7__cxx114listIcSaIcEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #3
  store ptr %20, ptr %8, align 8
  %21 = call noundef zeroext i1 @_ZStneRKSt14_List_iteratorIcES2_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #3
  br i1 %21, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %18, %.backedge
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #3
  %22 = call ptr @_ZNSt7__cxx114listIcSaIcEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #3
  store ptr %22, ptr %9, align 8
  %23 = call noundef zeroext i1 @_ZStneRKSt14_List_iteratorIcES2_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #3
  br i1 %23, label %24, label %47

24:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #3
  %25 = load i64, ptr %7, align 8, !tbaa !5
  store i64 %25, ptr %10, align 8, !tbaa !5
  %26 = call ptr @_ZNSt14_List_iteratorIcEmmEi(ptr noundef nonnull align 8 dereferenceable(8) %10, i32 noundef 0) #3
  %27 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt14_List_iteratorIcEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #3
  %28 = load i8, ptr %27, align 1, !tbaa !9
  %29 = icmp eq i8 %28, 49
  br i1 %29, label %30, label %.thread

30:                                               ; preds = %24
  %31 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt14_List_iteratorIcEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %10) #3
  %32 = load i8, ptr %31, align 1, !tbaa !9
  %33 = icmp eq i8 %32, 48
  br i1 %33, label %34, label %.thread

34:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #3
  %35 = load i64, ptr %10, align 8, !tbaa !5
  store i64 %35, ptr %11, align 8, !tbaa !5
  %36 = call ptr @_ZNSt14_List_iteratorIcEmmEi(ptr noundef nonnull align 8 dereferenceable(8) %11, i32 noundef 0) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #3
  %37 = call ptr @_ZNSt7__cxx114listIcSaIcEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #3
  store ptr %37, ptr %12, align 8
  %38 = call noundef zeroext i1 @_ZSteqRKSt14_List_iteratorIcES2_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %12) #3
  br i1 %38, label %.critedge, label %39

39:                                               ; preds = %34
  %40 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt14_List_iteratorIcEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %11) #3
  %41 = load i8, ptr %40, align 1, !tbaa !9
  %.not = icmp eq i8 %41, 48
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #3
  %spec.select = select i1 %.not, ptr %14, ptr %13
  %spec.select16 = select i1 %.not, i8 49, i8 48
  br label %44

.critedge:                                        ; preds = %34
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #3
  br label %44

42:                                               ; preds = %2
  %43 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #3
  br label %54

.thread:                                          ; preds = %30, %24
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #3
  br label %47

44:                                               ; preds = %39, %.critedge
  %.sink15 = phi ptr [ %13, %.critedge ], [ %spec.select, %39 ]
  %.sink = phi i8 [ 48, %.critedge ], [ %spec.select16, %39 ]
  call void @_ZNSt20_List_const_iteratorIcEC2ERKSt14_List_iteratorIcE(ptr noundef nonnull align 8 dereferenceable(8) %.sink15, ptr noundef nonnull align 8 dereferenceable(8) %10) #3
  %.sink14 = load ptr, ptr %.sink15, align 8
  %45 = call ptr @_ZNSt7__cxx114listIcSaIcEE5eraseESt20_List_const_iteratorIcE(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr %.sink14) #3
  %46 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt14_List_iteratorIcEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #3
  store i8 %.sink, ptr %46, align 1, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #3
  br label %.backedge

47:                                               ; preds = %.thread, %.lr.ph
  %48 = call ptr @_ZNSt14_List_iteratorIcEppEi(ptr noundef nonnull align 8 dereferenceable(8) %7, i32 noundef 0) #3
  br label %.backedge

.backedge:                                        ; preds = %47, %44
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #3
  %49 = call ptr @_ZNSt7__cxx114listIcSaIcEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %3) #3
  store ptr %49, ptr %8, align 8
  %50 = call noundef zeroext i1 @_ZStneRKSt14_List_iteratorIcES2_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #3
  br i1 %50, label %.lr.ph, label %._crit_edge, !llvm.loop !10

._crit_edge:                                      ; preds = %.backedge, %18
  call void @_ZNSt7__cxx114listIcSaIcEE6rbeginEv(ptr dead_on_unwind nonnull writable sret(%"class.std::reverse_iterator.3") align 8 %15, ptr noundef nonnull align 8 dereferenceable(24) %3) #3
  call void @_ZNSt7__cxx114listIcSaIcEE4rendEv(ptr dead_on_unwind nonnull writable sret(%"class.std::reverse_iterator.3") align 8 %16, ptr noundef nonnull align 8 dereferenceable(24) %3) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %17) #3
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %17) #3
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ISt16reverse_iteratorISt14_List_iteratorIcEEvEET_SA_RKS3_(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull %15, ptr noundef nonnull %16, ptr noundef nonnull align 1 dereferenceable(1) %17)
          to label %51 unwind label %52

51:                                               ; preds = %._crit_edge
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %17) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #3
  call void @_ZNSt7__cxx1110_List_baseIcSaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #3
  ret void

52:                                               ; preds = %._crit_edge
  %53 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %17) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #3
  call void @_ZNSt7__cxx1110_List_baseIcSaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #3
  br label %54

54:                                               ; preds = %52, %42
  %.pn = phi { ptr, i32 } [ %53, %52 ], [ %43, %42 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #3
  resume { ptr, i32 } %.pn
}

; 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 nounwind uwtable
declare void @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6rbeginEv(ptr dead_on_unwind noalias writable sret(%"class.std::reverse_iterator") align 8, ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4rendEv(ptr dead_on_unwind noalias writable sret(%"class.std::reverse_iterator") align 8, ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx114listIcSaIcEEC2ISt16reverse_iteratorIN9__gnu_cxx17__normal_iteratorIPKcNS_12basic_stringIcSt11char_traitsIcES1_EEEEEvEET_SF_RKS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef, ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; 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 ptr @_ZNSt7__cxx114listIcSaIcEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt7__cxx114listIcSaIcEE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt14_List_iteratorIcEmmEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt14_List_iteratorIcEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt7__cxx114listIcSaIcEE5eraseESt20_List_const_iteratorIcE(ptr noundef nonnull align 8 dereferenceable(24), ptr) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt14_List_iteratorIcEppEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt7__cxx114listIcSaIcEE6rbeginEv(ptr dead_on_unwind noalias writable sret(%"class.std::reverse_iterator.3") align 8, ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt7__cxx114listIcSaIcEE4rendEv(ptr dead_on_unwind noalias writable sret(%"class.std::reverse_iterator.3") align 8, ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2ISt16reverse_iteratorISt14_List_iteratorIcEEvEET_SA_RKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt7__cxx1110_List_baseIcSaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 align 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { 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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass