; LLVM IR from AdarshGaur/Competitive-Programming :: SPOJ (ACODE - Alphacode)

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

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca [5001 x i64], align 16
  %3 = alloca [5001 x i8], align 16
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %9 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %10 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %11 = getelementptr i8, ptr %10, i64 -24
  %12 = load i64, ptr %11, align 8
  %13 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %12
  %14 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %13, ptr noundef null)
  %15 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %16 = getelementptr i8, ptr %15, i64 -24
  %17 = load i64, ptr %16, align 8
  %18 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %17
  %19 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %18, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 40008, ptr %2) #7
  call void @llvm.lifetime.start.p0(i64 5001, ptr %3) #7
  br label %20

20:                                               ; preds = %147, %145, %0
  br label %21

21:                                               ; preds = %20
  %22 = getelementptr inbounds [5001 x i8], ptr %3, i64 0, i64 0
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef %22)
  %24 = getelementptr inbounds [5001 x i8], ptr %3, i64 0, i64 0
  %25 = load i8, ptr %24, align 16, !tbaa !8
  %26 = sext i8 %25 to i32
  %27 = icmp eq i32 %26, 48
  br i1 %27, label %28, label %30

28:                                               ; preds = %21
  store i32 0, ptr %1, align 4
  store i32 1, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 5001, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 40008, ptr %2) #7
  %29 = load i32, ptr %1, align 4
  ret i32 %29

30:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  %31 = getelementptr inbounds [5001 x i8], ptr %3, i64 0, i64 0
  %32 = call i64 @strlen(ptr noundef %31) #8
  %33 = trunc i64 %32 to i32
  store i32 %33, ptr %5, align 4, !tbaa !10
  %34 = getelementptr inbounds [5001 x i64], ptr %2, i64 0, i64 0
  store i64 1, ptr %34, align 16, !tbaa !12
  %35 = load i32, ptr %5, align 4, !tbaa !10
  %36 = icmp eq i32 %35, 1
  br i1 %36, label %37, label %40

37:                                               ; preds = %30
  %38 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  %39 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %38, ptr noundef @.str.1)
  store i32 2, ptr %4, align 4
  br label %145, !llvm.loop !14

40:                                               ; preds = %30
  %41 = getelementptr inbounds [5001 x i64], ptr %2, i64 0, i64 1
  store i64 1, ptr %41, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  %42 = getelementptr inbounds [5001 x i8], ptr %3, i64 0, i64 0
  %43 = load i8, ptr %42, align 16, !tbaa !8
  %44 = sext i8 %43 to i32
  %45 = sub nsw i32 %44, 48
  store i32 %45, ptr %7, align 4, !tbaa !10
  %46 = getelementptr inbounds [5001 x i8], ptr %3, i64 0, i64 1
  %47 = load i8, ptr %46, align 1, !tbaa !8
  %48 = sext i8 %47 to i32
  %49 = sub nsw i32 %48, 48
  store i32 %49, ptr %6, align 4, !tbaa !10
  %50 = load i32, ptr %6, align 4, !tbaa !10
  %51 = icmp eq i32 %50, 0
  br i1 %51, label %52, label %63

52:                                               ; preds = %40
  %53 = load i32, ptr %7, align 4, !tbaa !10
  %54 = icmp eq i32 %53, 1
  br i1 %54, label %58, label %55

55:                                               ; preds = %52
  %56 = load i32, ptr %7, align 4, !tbaa !10
  %57 = icmp eq i32 %56, 2
  br i1 %57, label %58, label %60

58:                                               ; preds = %55, %52
  %59 = getelementptr inbounds [5001 x i64], ptr %2, i64 0, i64 1
  store i64 1, ptr %59, align 8, !tbaa !12
  br label %62

60:                                               ; preds = %55
  %61 = getelementptr inbounds [5001 x i64], ptr %2, i64 0, i64 1
  store i64 0, ptr %61, align 8, !tbaa !12
  br label %62

62:                                               ; preds = %60, %58
  br label %77

63:                                               ; preds = %40
  %64 = load i32, ptr %7, align 4, !tbaa !10
  %65 = icmp eq i32 %64, 1
  br i1 %65, label %72, label %66

66:                                               ; preds = %63
  %67 = load i32, ptr %7, align 4, !tbaa !10
  %68 = icmp eq i32 %67, 2
  br i1 %68, label %69, label %74

69:                                               ; preds = %66
  %70 = load i32, ptr %6, align 4, !tbaa !10
  %71 = icmp sle i32 %70, 6
  br i1 %71, label %72, label %74

72:                                               ; preds = %69, %63
  %73 = getelementptr inbounds [5001 x i64], ptr %2, i64 0, i64 1
  store i64 2, ptr %73, align 8, !tbaa !12
  br label %76

74:                                               ; preds = %69, %66
  %75 = getelementptr inbounds [5001 x i64], ptr %2, i64 0, i64 1
  store i64 1, ptr %75, align 8, !tbaa !12
  br label %76

76:                                               ; preds = %74, %72
  br label %77

77:                                               ; preds = %76, %62
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 2, ptr %8, align 4, !tbaa !10
  br label %78

78:                                               ; preds = %134, %77
  %79 = load i32, ptr %8, align 4, !tbaa !10
  %80 = load i32, ptr %5, align 4, !tbaa !10
  %81 = icmp slt i32 %79, %80
  br i1 %81, label %83, label %82

82:                                               ; preds = %78
  store i32 4, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %137

83:                                               ; preds = %78
  %84 = load i32, ptr %8, align 4, !tbaa !10
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [5001 x i64], ptr %2, i64 0, i64 %85
  store i64 0, ptr %86, align 8, !tbaa !12
  %87 = load i32, ptr %8, align 4, !tbaa !10
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [5001 x i8], ptr %3, i64 0, i64 %88
  %90 = load i8, ptr %89, align 1, !tbaa !8
  %91 = sext i8 %90 to i32
  %92 = sub nsw i32 %91, 48
  store i32 %92, ptr %6, align 4, !tbaa !10
  %93 = load i32, ptr %8, align 4, !tbaa !10
  %94 = sub nsw i32 %93, 1
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [5001 x i8], ptr %3, i64 0, i64 %95
  %97 = load i8, ptr %96, align 1, !tbaa !8
  %98 = sext i8 %97 to i32
  %99 = sub nsw i32 %98, 48
  store i32 %99, ptr %7, align 4, !tbaa !10
  %100 = load i32, ptr %6, align 4, !tbaa !10
  %101 = icmp ne i32 %100, 0
  br i1 %101, label %102, label %113

102:                                              ; preds = %83
  %103 = load i32, ptr %8, align 4, !tbaa !10
  %104 = sub nsw i32 %103, 1
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [5001 x i64], ptr %2, i64 0, i64 %105
  %107 = load i64, ptr %106, align 8, !tbaa !12
  %108 = load i32, ptr %8, align 4, !tbaa !10
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [5001 x i64], ptr %2, i64 0, i64 %109
  %111 = load i64, ptr %110, align 8, !tbaa !12
  %112 = add nsw i64 %111, %107
  store i64 %112, ptr %110, align 8, !tbaa !12
  br label %113

113:                                              ; preds = %102, %83
  %114 = load i32, ptr %7, align 4, !tbaa !10
  %115 = icmp eq i32 %114, 1
  br i1 %115, label %122, label %116

116:                                              ; preds = %113
  %117 = load i32, ptr %7, align 4, !tbaa !10
  %118 = icmp eq i32 %117, 2
  br i1 %118, label %119, label %133

119:                                              ; preds = %116
  %120 = load i32, ptr %6, align 4, !tbaa !10
  %121 = icmp slt i32 %120, 7
  br i1 %121, label %122, label %133

122:                                              ; preds = %119, %113
  %123 = load i32, ptr %8, align 4, !tbaa !10
  %124 = sub nsw i32 %123, 2
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [5001 x i64], ptr %2, i64 0, i64 %125
  %127 = load i64, ptr %126, align 8, !tbaa !12
  %128 = load i32, ptr %8, align 4, !tbaa !10
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [5001 x i64], ptr %2, i64 0, i64 %129
  %131 = load i64, ptr %130, align 8, !tbaa !12
  %132 = add nsw i64 %131, %127
  store i64 %132, ptr %130, align 8, !tbaa !12
  br label %133

133:                                              ; preds = %122, %119, %116
  br label %134

134:                                              ; preds = %133
  %135 = load i32, ptr %8, align 4, !tbaa !10
  %136 = add nsw i32 %135, 1
  store i32 %136, ptr %8, align 4, !tbaa !10
  br label %78, !llvm.loop !16

137:                                              ; preds = %82
  %138 = load i32, ptr %5, align 4, !tbaa !10
  %139 = sub nsw i32 %138, 1
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [5001 x i64], ptr %2, i64 0, i64 %140
  %142 = load i64, ptr %141, align 8, !tbaa !12
  %143 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %142)
  %144 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %143, ptr noundef @.str.1)
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  store i32 0, ptr %4, align 4
  br label %145

145:                                              ; preds = %137, %37
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  %146 = load i32, ptr %4, align 4
  switch i32 %146, label %148 [
    i32 0, label %147
    i32 2, label %20
  ]

147:                                              ; preds = %145
  br label %20, !llvm.loop !14

148:                                              ; preds = %145
  unreachable
}

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull) #4

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #5

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #4

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #6 align 2

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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { nounwind willreturn memory(read) "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 = { 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 #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }

!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 = !{!"omnipotent char", !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !9, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"long long", !9, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !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::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" }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca [5001 x i64], align 16
  %2 = alloca [5001 x i8], align 16
  %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 @_ZSt4cout, align 8, !tbaa !5
  %10 = getelementptr i8, ptr %9, i64 -24
  %11 = load i64, ptr %10, align 8
  %12 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %11
  %13 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %12, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 40008, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 5001, ptr nonnull %2) #7
  %14 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef %2)
  %15 = load i8, ptr %2, align 16, !tbaa !8
  %16 = icmp eq i8 %15, 48
  br i1 %16, label %._crit_edge35, label %.lr.ph34

.lr.ph34:                                         ; preds = %0
  %17 = getelementptr inbounds i8, ptr %1, i64 8
  %18 = getelementptr inbounds i8, ptr %2, i64 1
  br label %19

._crit_edge35:                                    ; preds = %67, %0
  call void @llvm.lifetime.end.p0(i64 5001, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 40008, ptr nonnull %1) #7
  ret i32 0

19:                                               ; preds = %.lr.ph34, %67
  %20 = phi i8 [ %15, %.lr.ph34 ], [ %70, %67 ]
  %21 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %2) #8
  %22 = trunc i64 %21 to i32
  store i64 1, ptr %1, align 16, !tbaa !10
  %23 = icmp eq i32 %22, 1
  br i1 %23, label %24, label %26

24:                                               ; preds = %19
  %25 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str)
  br label %67, !llvm.loop !12

26:                                               ; preds = %19
  %27 = sext i8 %20 to i32
  %28 = add nsw i32 %27, -48
  %29 = load i8, ptr %18, align 1, !tbaa !8
  %30 = icmp eq i8 %29, 48
  br i1 %30, label %31, label %33

31:                                               ; preds = %26
  %32 = add nsw i32 %27, -49
  %or.cond = icmp ult i32 %32, 2
  %. = zext i1 %or.cond to i64
  br label %38

33:                                               ; preds = %26
  %34 = icmp eq i32 %28, 1
  br i1 %34, label %38, label %35

35:                                               ; preds = %33
  %36 = icmp eq i32 %28, 2
  %37 = icmp slt i8 %29, 55
  %or.cond3 = and i1 %36, %37
  %spec.select = select i1 %or.cond3, i64 2, i64 1
  br label %38

38:                                               ; preds = %35, %33, %31
  %.sink = phi i64 [ %., %31 ], [ 2, %33 ], [ %spec.select, %35 ]
  store i64 %.sink, ptr %17, align 8, !tbaa !10
  %39 = icmp sgt i32 %22, 2
  br i1 %39, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %38
  %wide.trip.count = and i64 %21, 2147483647
  br label %.lr.ph

._crit_edge:                                      ; preds = %66, %38
  %40 = shl i64 %21, 32
  %sext = add i64 %40, -4294967296
  %41 = ashr exact i64 %sext, 32
  %42 = getelementptr inbounds [5001 x i64], ptr %1, i64 0, i64 %41
  %43 = load i64, ptr %42, align 8, !tbaa !10
  %44 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %43)
  br label %67

.lr.ph:                                           ; preds = %.lr.ph.preheader, %66
  %45 = phi i8 [ %29, %.lr.ph.preheader ], [ %48, %66 ]
  %indvars.iv = phi i64 [ 2, %.lr.ph.preheader ], [ %indvars.iv.next, %66 ]
  %46 = getelementptr inbounds [5001 x i64], ptr %1, i64 0, i64 %indvars.iv
  store i64 0, ptr %46, align 8, !tbaa !10
  %47 = getelementptr inbounds [5001 x i8], ptr %2, i64 0, i64 %indvars.iv
  %48 = load i8, ptr %47, align 1, !tbaa !8
  %49 = sext i8 %45 to i32
  %50 = add nsw i32 %49, -48
  %.not = icmp eq i8 %48, 48
  br i1 %.not, label %55, label %51

51:                                               ; preds = %.lr.ph
  %52 = add nsw i64 %indvars.iv, -1
  %53 = getelementptr inbounds [5001 x i64], ptr %1, i64 0, i64 %52
  %54 = load i64, ptr %53, align 8, !tbaa !10
  store i64 %54, ptr %46, align 8, !tbaa !10
  br label %55

55:                                               ; preds = %51, %.lr.ph
  %56 = icmp eq i32 %50, 1
  br i1 %56, label %60, label %57

57:                                               ; preds = %55
  %58 = icmp eq i32 %50, 2
  %59 = icmp slt i8 %48, 55
  %or.cond5 = and i1 %59, %58
  br i1 %or.cond5, label %60, label %66

60:                                               ; preds = %57, %55
  %61 = add nsw i64 %indvars.iv, -2
  %62 = getelementptr inbounds [5001 x i64], ptr %1, i64 0, i64 %61
  %63 = load i64, ptr %62, align 8, !tbaa !10
  %64 = load i64, ptr %46, align 8, !tbaa !10
  %65 = add nsw i64 %64, %63
  store i64 %65, ptr %46, align 8, !tbaa !10
  br label %66

66:                                               ; preds = %57, %60
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !14

67:                                               ; preds = %._crit_edge, %24
  %.sink37 = phi ptr [ %44, %._crit_edge ], [ %25, %24 ]
  %68 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %.sink37, ptr noundef nonnull @.str.1)
  %69 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef %2)
  %70 = load i8, ptr %2, align 16, !tbaa !8
  %71 = icmp eq i8 %70, 48
  br i1 %71, label %._crit_edge35, label %19
}

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull) local_unnamed_addr #4

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #4

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #6 align 2

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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 = { 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 #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }

!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 = !{!"omnipotent char", !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"long long", !9, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}


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