; LLVM IR from ahr9n/psolving-paradigms :: 4.dynamic-programming/12.strings (CodeForces 192C - Dynasty Puzzles)

; 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::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@dp = external dso_local global [123 x [123 x i32]], align 16
@n = external dso_local global i32, align 4
@ans = external dso_local global i32, align 4
@_Z1sB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external global ptr, align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %6 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %7 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %8 = getelementptr i8, ptr %7, i64 -24
  %9 = load i64, ptr %8, align 8
  %10 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %9
  %11 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %10, ptr noundef null)
  %12 = load ptr, ptr @stdin, align 8, !tbaa !8
  %13 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.2, ptr noundef %12)
  %14 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  call void @llvm.memset.p0.i64(ptr align 16 @dp, i8 -1, i64 60516, i1 false)
  br label %15

15:                                               ; preds = %68, %0
  %16 = load i32, ptr @n, align 4, !tbaa !11
  %17 = add nsw i32 %16, -1
  store i32 %17, ptr @n, align 4, !tbaa !11
  %18 = icmp ne i32 %16, 0
  br i1 %18, label %19, label %89

19:                                               ; preds = %15
  %20 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 97, ptr %2, align 4, !tbaa !11
  br label %21

21:                                               ; preds = %65, %19
  %22 = load i32, ptr %2, align 4, !tbaa !11
  %23 = icmp sle i32 %22, 122
  br i1 %23, label %25, label %24

24:                                               ; preds = %21
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %68

25:                                               ; preds = %21
  %26 = load i32, ptr %2, align 4, !tbaa !11
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [123 x [123 x i32]], ptr @dp, i64 0, i64 %27
  %29 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5frontEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11) #6
  %30 = load i8, ptr %29, align 1, !tbaa !13
  %31 = sext i8 %30 to i64
  %32 = getelementptr inbounds [123 x i32], ptr %28, i64 0, i64 %31
  %33 = load i32, ptr %32, align 4, !tbaa !11
  %34 = xor i32 %33, -1
  %35 = icmp ne i32 %34, 0
  br i1 %35, label %36, label %64

36:                                               ; preds = %25
  %37 = load i32, ptr %2, align 4, !tbaa !11
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [123 x [123 x i32]], ptr @dp, i64 0, i64 %38
  %40 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4backEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11) #6
  %41 = load i8, ptr %40, align 1, !tbaa !13
  %42 = sext i8 %41 to i64
  %43 = getelementptr inbounds [123 x i32], ptr %39, i64 0, i64 %42
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  %44 = load i32, ptr %2, align 4, !tbaa !11
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [123 x [123 x i32]], ptr @dp, i64 0, i64 %45
  %47 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5frontEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11) #6
  %48 = load i8, ptr %47, align 1, !tbaa !13
  %49 = sext i8 %48 to i64
  %50 = getelementptr inbounds [123 x i32], ptr %46, i64 0, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !11
  %52 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11) #6
  %53 = trunc i64 %52 to i32
  %54 = add nsw i32 %51, %53
  store i32 %54, ptr %3, align 4, !tbaa !11
  %55 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %43, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %56 = load i32, ptr %55, align 4, !tbaa !11
  %57 = load i32, ptr %2, align 4, !tbaa !11
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [123 x [123 x i32]], ptr @dp, i64 0, i64 %58
  %60 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4backEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11) #6
  %61 = load i8, ptr %60, align 1, !tbaa !13
  %62 = sext i8 %61 to i64
  %63 = getelementptr inbounds [123 x i32], ptr %59, i64 0, i64 %62
  store i32 %56, ptr %63, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %64

64:                                               ; preds = %36, %25
  br label %65

65:                                               ; preds = %64
  %66 = load i32, ptr %2, align 4, !tbaa !11
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %2, align 4, !tbaa !11
  br label %21, !llvm.loop !14

68:                                               ; preds = %24
  %69 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5frontEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11) #6
  %70 = load i8, ptr %69, align 1, !tbaa !13
  %71 = sext i8 %70 to i64
  %72 = getelementptr inbounds [123 x [123 x i32]], ptr @dp, i64 0, i64 %71
  %73 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4backEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11) #6
  %74 = load i8, ptr %73, align 1, !tbaa !13
  %75 = sext i8 %74 to i64
  %76 = getelementptr inbounds [123 x i32], ptr %72, i64 0, i64 %75
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  %77 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11) #6
  %78 = trunc i64 %77 to i32
  store i32 %78, ptr %4, align 4, !tbaa !11
  %79 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %76, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %80 = load i32, ptr %79, align 4, !tbaa !11
  %81 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5frontEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11) #6
  %82 = load i8, ptr %81, align 1, !tbaa !13
  %83 = sext i8 %82 to i64
  %84 = getelementptr inbounds [123 x [123 x i32]], ptr @dp, i64 0, i64 %83
  %85 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4backEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11) #6
  %86 = load i8, ptr %85, align 1, !tbaa !13
  %87 = sext i8 %86 to i64
  %88 = getelementptr inbounds [123 x i32], ptr %84, i64 0, i64 %87
  store i32 %80, ptr %88, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %15, !llvm.loop !16

89:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 97, ptr %5, align 4, !tbaa !11
  br label %90

90:                                               ; preds = %103, %89
  %91 = load i32, ptr %5, align 4, !tbaa !11
  %92 = icmp sle i32 %91, 122
  br i1 %92, label %94, label %93

93:                                               ; preds = %90
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %106

94:                                               ; preds = %90
  %95 = load i32, ptr %5, align 4, !tbaa !11
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [123 x [123 x i32]], ptr @dp, i64 0, i64 %96
  %98 = load i32, ptr %5, align 4, !tbaa !11
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [123 x i32], ptr %97, i64 0, i64 %99
  %101 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @ans, ptr noundef nonnull align 4 dereferenceable(4) %100)
  %102 = load i32, ptr %101, align 4, !tbaa !11
  store i32 %102, ptr @ans, align 4, !tbaa !11
  br label %103

103:                                              ; preds = %94
  %104 = load i32, ptr %5, align 4, !tbaa !11
  %105 = add nsw i32 %104, 1
  store i32 %105, ptr %5, align 4, !tbaa !11
  br label %90, !llvm.loop !17

106:                                              ; preds = %93
  %107 = load i32, ptr @ans, align 4, !tbaa !11
  %108 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %107)
  ret i32 0
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #1

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

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) #1

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) #1

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #5

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

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

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #1

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


; 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::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@dp = external dso_local global [123 x [123 x i32]], align 16
@n = external dso_local global i32, align 4
@ans = external dso_local global i32, align 4
@_Z1sB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %4 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %5 = getelementptr i8, ptr %4, i64 -24
  %6 = load i64, ptr %5, align 8
  %7 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %6
  %8 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %7, ptr noundef null)
  %9 = load ptr, ptr @stdin, align 8, !tbaa !8
  %10 = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.2, ptr noundef %9)
  %11 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(60516) @dp, i8 -1, i64 60516, i1 false)
  %12 = load i32, ptr @n, align 4, !tbaa !11
  %13 = add nsw i32 %12, -1
  store i32 %13, ptr @n, align 4, !tbaa !11
  %.not13 = icmp eq i32 %12, 0
  br i1 %.not13, label %.preheader, label %.lr.ph

.preheader:                                       ; preds = %68, %0
  %14 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @ans, ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @dp, i64 48112))
  %15 = load i32, ptr %14, align 4, !tbaa !11
  store i32 %15, ptr @ans, align 4, !tbaa !11
  %16 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @ans, ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @dp, i64 48608))
  %17 = load i32, ptr %16, align 4, !tbaa !11
  store i32 %17, ptr @ans, align 4, !tbaa !11
  %18 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @ans, ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @dp, i64 49104))
  %19 = load i32, ptr %18, align 4, !tbaa !11
  store i32 %19, ptr @ans, align 4, !tbaa !11
  %20 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @ans, ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @dp, i64 49600))
  %21 = load i32, ptr %20, align 4, !tbaa !11
  store i32 %21, ptr @ans, align 4, !tbaa !11
  %22 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @ans, ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @dp, i64 50096))
  %23 = load i32, ptr %22, align 4, !tbaa !11
  store i32 %23, ptr @ans, align 4, !tbaa !11
  %24 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @ans, ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @dp, i64 50592))
  %25 = load i32, ptr %24, align 4, !tbaa !11
  store i32 %25, ptr @ans, align 4, !tbaa !11
  %26 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @ans, ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @dp, i64 51088))
  %27 = load i32, ptr %26, align 4, !tbaa !11
  store i32 %27, ptr @ans, align 4, !tbaa !11
  %28 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @ans, ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @dp, i64 51584))
  %29 = load i32, ptr %28, align 4, !tbaa !11
  store i32 %29, ptr @ans, align 4, !tbaa !11
  %30 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @ans, ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @dp, i64 52080))
  %31 = load i32, ptr %30, align 4, !tbaa !11
  store i32 %31, ptr @ans, align 4, !tbaa !11
  %32 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @ans, ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @dp, i64 52576))
  %33 = load i32, ptr %32, align 4, !tbaa !11
  store i32 %33, ptr @ans, align 4, !tbaa !11
  %34 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @ans, ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @dp, i64 53072))
  %35 = load i32, ptr %34, align 4, !tbaa !11
  store i32 %35, ptr @ans, align 4, !tbaa !11
  %36 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @ans, ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @dp, i64 53568))
  %37 = load i32, ptr %36, align 4, !tbaa !11
  store i32 %37, ptr @ans, align 4, !tbaa !11
  %38 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @ans, ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @dp, i64 54064))
  %39 = load i32, ptr %38, align 4, !tbaa !11
  store i32 %39, ptr @ans, align 4, !tbaa !11
  %40 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @ans, ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @dp, i64 54560))
  %41 = load i32, ptr %40, align 4, !tbaa !11
  store i32 %41, ptr @ans, align 4, !tbaa !11
  %42 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @ans, ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @dp, i64 55056))
  %43 = load i32, ptr %42, align 4, !tbaa !11
  store i32 %43, ptr @ans, align 4, !tbaa !11
  %44 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @ans, ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @dp, i64 55552))
  %45 = load i32, ptr %44, align 4, !tbaa !11
  store i32 %45, ptr @ans, align 4, !tbaa !11
  %46 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @ans, ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @dp, i64 56048))
  %47 = load i32, ptr %46, align 4, !tbaa !11
  store i32 %47, ptr @ans, align 4, !tbaa !11
  %48 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @ans, ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @dp, i64 56544))
  %49 = load i32, ptr %48, align 4, !tbaa !11
  store i32 %49, ptr @ans, align 4, !tbaa !11
  %50 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @ans, ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @dp, i64 57040))
  %51 = load i32, ptr %50, align 4, !tbaa !11
  store i32 %51, ptr @ans, align 4, !tbaa !11
  %52 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @ans, ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @dp, i64 57536))
  %53 = load i32, ptr %52, align 4, !tbaa !11
  store i32 %53, ptr @ans, align 4, !tbaa !11
  %54 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @ans, ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @dp, i64 58032))
  %55 = load i32, ptr %54, align 4, !tbaa !11
  store i32 %55, ptr @ans, align 4, !tbaa !11
  %56 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @ans, ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @dp, i64 58528))
  %57 = load i32, ptr %56, align 4, !tbaa !11
  store i32 %57, ptr @ans, align 4, !tbaa !11
  %58 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @ans, ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @dp, i64 59024))
  %59 = load i32, ptr %58, align 4, !tbaa !11
  store i32 %59, ptr @ans, align 4, !tbaa !11
  %60 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @ans, ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @dp, i64 59520))
  %61 = load i32, ptr %60, align 4, !tbaa !11
  store i32 %61, ptr @ans, align 4, !tbaa !11
  %62 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @ans, ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @dp, i64 60016))
  %63 = load i32, ptr %62, align 4, !tbaa !11
  store i32 %63, ptr @ans, align 4, !tbaa !11
  %64 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @ans, ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @dp, i64 60512))
  %65 = load i32, ptr %64, align 4, !tbaa !11
  store i32 %65, ptr @ans, align 4, !tbaa !11
  %66 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %65)
  ret i32 0

.lr.ph:                                           ; preds = %0, %68
  %67 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11)
  br label %89

68:                                               ; preds = %114
  %69 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5frontEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11) #6
  %70 = load i8, ptr %69, align 1, !tbaa !13
  %71 = sext i8 %70 to i64
  %72 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4backEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11) #6
  %73 = load i8, ptr %72, align 1, !tbaa !13
  %74 = sext i8 %73 to i64
  %75 = getelementptr inbounds [123 x [123 x i32]], ptr @dp, i64 0, i64 %71, i64 %74
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %76 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11) #6
  %77 = trunc i64 %76 to i32
  store i32 %77, ptr %2, align 4, !tbaa !11
  %78 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %75, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %79 = load i32, ptr %78, align 4, !tbaa !11
  %80 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5frontEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11) #6
  %81 = load i8, ptr %80, align 1, !tbaa !13
  %82 = sext i8 %81 to i64
  %83 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4backEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11) #6
  %84 = load i8, ptr %83, align 1, !tbaa !13
  %85 = sext i8 %84 to i64
  %86 = getelementptr inbounds [123 x [123 x i32]], ptr @dp, i64 0, i64 %82, i64 %85
  store i32 %79, ptr %86, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  %87 = load i32, ptr @n, align 4, !tbaa !11
  %88 = add nsw i32 %87, -1
  store i32 %88, ptr @n, align 4, !tbaa !11
  %.not = icmp eq i32 %87, 0
  br i1 %.not, label %.preheader, label %.lr.ph, !llvm.loop !14

89:                                               ; preds = %.lr.ph, %114
  %indvars.iv = phi i64 [ 97, %.lr.ph ], [ %indvars.iv.next, %114 ]
  %90 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5frontEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11) #6
  %91 = load i8, ptr %90, align 1, !tbaa !13
  %92 = sext i8 %91 to i64
  %93 = getelementptr inbounds [123 x [123 x i32]], ptr @dp, i64 0, i64 %indvars.iv, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !11
  %.not11 = icmp eq i32 %94, -1
  br i1 %.not11, label %114, label %95

95:                                               ; preds = %89
  %96 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4backEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11) #6
  %97 = load i8, ptr %96, align 1, !tbaa !13
  %98 = sext i8 %97 to i64
  %99 = getelementptr inbounds [123 x [123 x i32]], ptr @dp, i64 0, i64 %indvars.iv, i64 %98
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %100 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5frontEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11) #6
  %101 = load i8, ptr %100, align 1, !tbaa !13
  %102 = sext i8 %101 to i64
  %103 = getelementptr inbounds [123 x [123 x i32]], ptr @dp, i64 0, i64 %indvars.iv, i64 %102
  %104 = load i32, ptr %103, align 4, !tbaa !11
  %105 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11) #6
  %106 = trunc i64 %105 to i32
  %107 = add nsw i32 %104, %106
  store i32 %107, ptr %1, align 4, !tbaa !11
  %108 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %99, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %109 = load i32, ptr %108, align 4, !tbaa !11
  %110 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4backEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11) #6
  %111 = load i8, ptr %110, align 1, !tbaa !13
  %112 = sext i8 %111 to i64
  %113 = getelementptr inbounds [123 x [123 x i32]], ptr @dp, i64 0, i64 %indvars.iv, i64 %112
  store i32 %109, ptr %113, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  br label %114

114:                                              ; preds = %89, %95
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 123
  br i1 %exitcond.not, label %68, label %89, !llvm.loop !16
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #1

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

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #5

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

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

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #1

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


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