; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/99 Beta Division 1/Problem A (A)

; 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::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<char, std::pair<const char, int>, std::_Select1st<std::pair<const char, int>>, std::less<char>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<char, std::pair<const char, int>, std::_Select1st<std::pair<const char, int>>, std::less<char>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"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 }

@n = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@res = external dso_local global i32, align 4
@cnt = external dso_local global i32, align 4
@t = external dso_local global [2500 x [4 x i32]], align 16
@flag = external dso_local global i32, align 4
@_Z1wB5cxx11 = external dso_local global [4 x %"class.std::__cxx11::basic_string"], align 16
@v = external dso_local global %"class.std::map", align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [5 x i8], align 1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z2c1v() #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z2c2v() #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z2c3v() #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i8, align 1
  %3 = alloca i8, align 1
  %4 = alloca i8, align 1
  %5 = alloca i8, align 1
  %6 = alloca i8, align 1
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @k)
  call void @llvm.lifetime.start.p0(i64 1, ptr %2) #4
  store i8 97, ptr %2, align 1, !tbaa !5
  %13 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEEixEOc(ptr noundef nonnull align 8 dereferenceable(48) @v, ptr noundef nonnull align 1 dereferenceable(1) %2)
  store i32 1, ptr %13, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 1, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #4
  store i8 101, ptr %3, align 1, !tbaa !5
  %14 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEEixEOc(ptr noundef nonnull align 8 dereferenceable(48) @v, ptr noundef nonnull align 1 dereferenceable(1) %3)
  store i32 1, ptr %14, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %4) #4
  store i8 105, ptr %4, align 1, !tbaa !5
  %15 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEEixEOc(ptr noundef nonnull align 8 dereferenceable(48) @v, ptr noundef nonnull align 1 dereferenceable(1) %4)
  store i32 1, ptr %15, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 1, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #4
  store i8 111, ptr %5, align 1, !tbaa !5
  %16 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEEixEOc(ptr noundef nonnull align 8 dereferenceable(48) @v, ptr noundef nonnull align 1 dereferenceable(1) %5)
  store i32 1, ptr %16, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #4
  store i8 117, ptr %6, align 1, !tbaa !5
  %17 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEEixEOc(ptr noundef nonnull align 8 dereferenceable(48) @v, ptr noundef nonnull align 1 dereferenceable(1) %6)
  store i32 1, ptr %17, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !8
  br label %18

18:                                               ; preds = %52, %0
  %19 = load i32, ptr %7, align 4, !tbaa !8
  %20 = load i32, ptr @n, align 4, !tbaa !8
  %21 = icmp slt i32 %19, %20
  br i1 %21, label %23, label %22

22:                                               ; preds = %18
  store i32 2, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %55

23:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !8
  br label %24

24:                                               ; preds = %33, %23
  %25 = load i32, ptr %9, align 4, !tbaa !8
  %26 = icmp slt i32 %25, 4
  br i1 %26, label %28, label %27

27:                                               ; preds = %24
  store i32 5, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %36

28:                                               ; preds = %24
  %29 = load i32, ptr %9, align 4, !tbaa !8
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [4 x %"class.std::__cxx11::basic_string"], ptr @_Z1wB5cxx11, i64 0, i64 %30
  %32 = 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) %31)
  br label %33

33:                                               ; preds = %28
  %34 = load i32, ptr %9, align 4, !tbaa !8
  %35 = add nsw i32 %34, 1
  store i32 %35, ptr %9, align 4, !tbaa !8
  br label %24, !llvm.loop !10

36:                                               ; preds = %27
  store i32 0, ptr @cnt, align 4, !tbaa !8
  %37 = call noundef i32 @_Z2c1v()
  %38 = load i32, ptr %7, align 4, !tbaa !8
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [2500 x [4 x i32]], ptr @t, i64 0, i64 %39
  %41 = getelementptr inbounds [4 x i32], ptr %40, i64 0, i64 0
  store i32 %37, ptr %41, align 16, !tbaa !8
  %42 = call noundef i32 @_Z2c2v()
  %43 = load i32, ptr %7, align 4, !tbaa !8
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [2500 x [4 x i32]], ptr @t, i64 0, i64 %44
  %46 = getelementptr inbounds [4 x i32], ptr %45, i64 0, i64 1
  store i32 %42, ptr %46, align 4, !tbaa !8
  %47 = call noundef i32 @_Z2c3v()
  %48 = load i32, ptr %7, align 4, !tbaa !8
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [2500 x [4 x i32]], ptr @t, i64 0, i64 %49
  %51 = getelementptr inbounds [4 x i32], ptr %50, i64 0, i64 2
  store i32 %47, ptr %51, align 8, !tbaa !8
  br label %52

52:                                               ; preds = %36
  %53 = load i32, ptr %7, align 4, !tbaa !8
  %54 = add nsw i32 %53, 1
  store i32 %54, ptr %7, align 4, !tbaa !8
  br label %18, !llvm.loop !12

55:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !8
  br label %56

56:                                               ; preds = %90, %55
  %57 = load i32, ptr %10, align 4, !tbaa !8
  %58 = icmp slt i32 %57, 3
  br i1 %58, label %60, label %59

59:                                               ; preds = %56
  store i32 8, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %93

60:                                               ; preds = %56
  store i32 1, ptr @flag, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 0, ptr %11, align 4, !tbaa !8
  br label %61

61:                                               ; preds = %77, %60
  %62 = load i32, ptr %11, align 4, !tbaa !8
  %63 = load i32, ptr @n, align 4, !tbaa !8
  %64 = icmp slt i32 %62, %63
  br i1 %64, label %66, label %65

65:                                               ; preds = %61
  store i32 11, ptr %8, align 4
  br label %80

66:                                               ; preds = %61
  %67 = load i32, ptr %11, align 4, !tbaa !8
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [2500 x [4 x i32]], ptr @t, i64 0, i64 %68
  %70 = load i32, ptr %10, align 4, !tbaa !8
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [4 x i32], ptr %69, i64 0, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !8
  %74 = icmp eq i32 %73, 0
  br i1 %74, label %75, label %76

75:                                               ; preds = %66
  store i32 0, ptr @flag, align 4, !tbaa !8
  store i32 11, ptr %8, align 4
  br label %80

76:                                               ; preds = %66
  br label %77

77:                                               ; preds = %76
  %78 = load i32, ptr %11, align 4, !tbaa !8
  %79 = add nsw i32 %78, 1
  store i32 %79, ptr %11, align 4, !tbaa !8
  br label %61, !llvm.loop !13

80:                                               ; preds = %75, %65
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %81

81:                                               ; preds = %80
  %82 = load i32, ptr @flag, align 4, !tbaa !8
  %83 = icmp ne i32 %82, 0
  br i1 %83, label %84, label %89

84:                                               ; preds = %81
  %85 = load i32, ptr %10, align 4, !tbaa !8
  %86 = shl i32 1, %85
  %87 = load i32, ptr @res, align 4, !tbaa !8
  %88 = or i32 %87, %86
  store i32 %88, ptr @res, align 4, !tbaa !8
  br label %89

89:                                               ; preds = %84, %81
  br label %90

90:                                               ; preds = %89
  %91 = load i32, ptr %10, align 4, !tbaa !8
  %92 = add nsw i32 %91, 1
  store i32 %92, ptr %10, align 4, !tbaa !8
  br label %56, !llvm.loop !14

93:                                               ; preds = %59
  %94 = load i32, ptr @res, align 4, !tbaa !8
  %95 = icmp eq i32 %94, 0
  br i1 %95, label %96, label %98

96:                                               ; preds = %93
  %97 = call i32 @puts(ptr noundef @.str.3)
  br label %120

98:                                               ; preds = %93
  %99 = load i32, ptr @res, align 4, !tbaa !8
  %100 = icmp eq i32 %99, 7
  br i1 %100, label %101, label %103

101:                                              ; preds = %98
  %102 = call i32 @puts(ptr noundef @.str.4)
  br label %119

103:                                              ; preds = %98
  %104 = load i32, ptr @res, align 4, !tbaa !8
  %105 = and i32 %104, 1
  %106 = icmp ne i32 %105, 0
  br i1 %106, label %107, label %109

107:                                              ; preds = %103
  %108 = call i32 @puts(ptr noundef @.str.5)
  br label %118

109:                                              ; preds = %103
  %110 = load i32, ptr @res, align 4, !tbaa !8
  %111 = and i32 %110, 2
  %112 = icmp ne i32 %111, 0
  br i1 %112, label %113, label %115

113:                                              ; preds = %109
  %114 = call i32 @puts(ptr noundef @.str.6)
  br label %117

115:                                              ; preds = %109
  %116 = call i32 @puts(ptr noundef @.str.7)
  br label %117

117:                                              ; preds = %115, %113
  br label %118

118:                                              ; preds = %117, %107
  br label %119

119:                                              ; preds = %118, %101
  br label %120

120:                                              ; preds = %119, %96
  ret i32 0
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEEixEOc(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 1 dereferenceable(1)) #1 align 2

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)) #3

declare i32 @puts(ptr noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
!14 = distinct !{!14, !11}


; 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::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<char, std::pair<const char, int>, std::_Select1st<std::pair<const char, int>>, std::less<char>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<char, std::pair<const char, int>, std::_Select1st<std::pair<const char, int>>, std::less<char>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"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 }

@n = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@res = external dso_local local_unnamed_addr global i32, align 4
@cnt = external dso_local local_unnamed_addr global i32, align 4
@t = external dso_local local_unnamed_addr global [2500 x [4 x i32]], align 16
@flag = external dso_local local_unnamed_addr global i32, align 4
@_Z1wB5cxx11 = external dso_local global [4 x %"class.std::__cxx11::basic_string"], align 16
@v = external dso_local global %"class.std::map", align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [5 x i8], align 1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z2c1v() local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z2c2v() local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z2c3v() local_unnamed_addr #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca i8, align 1
  %2 = alloca i8, align 1
  %3 = alloca i8, align 1
  %4 = alloca i8, align 1
  %5 = alloca i8, align 1
  %6 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @k)
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %1) #5
  store i8 97, ptr %1, align 1, !tbaa !5
  %7 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEEixEOc(ptr noundef nonnull align 8 dereferenceable(48) @v, ptr noundef nonnull align 1 dereferenceable(1) %1)
  store i32 1, ptr %7, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %2) #5
  store i8 101, ptr %2, align 1, !tbaa !5
  %8 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEEixEOc(ptr noundef nonnull align 8 dereferenceable(48) @v, ptr noundef nonnull align 1 dereferenceable(1) %2)
  store i32 1, ptr %8, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %3) #5
  store i8 105, ptr %3, align 1, !tbaa !5
  %9 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEEixEOc(ptr noundef nonnull align 8 dereferenceable(48) @v, ptr noundef nonnull align 1 dereferenceable(1) %3)
  store i32 1, ptr %9, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #5
  store i8 111, ptr %4, align 1, !tbaa !5
  %10 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEEixEOc(ptr noundef nonnull align 8 dereferenceable(48) @v, ptr noundef nonnull align 1 dereferenceable(1) %4)
  store i32 1, ptr %10, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #5
  store i8 117, ptr %5, align 1, !tbaa !5
  %11 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEEixEOc(ptr noundef nonnull align 8 dereferenceable(48) @v, ptr noundef nonnull align 1 dereferenceable(1) %5)
  store i32 1, ptr %11, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #5
  %12 = load i32, ptr @n, align 4, !tbaa !8
  %13 = icmp sgt i32 %12, 0
  br i1 %13, label %.preheader22, label %.preheader.thread

.preheader.thread:                                ; preds = %0
  %res.promoted48 = load i32, ptr @res, align 4, !tbaa !8
  br label %.preheader.split.split.preheader

.preheader22:                                     ; preds = %0, %.preheader22
  %indvars.iv = phi i64 [ %indvars.iv.next, %.preheader22 ], [ 0, %0 ]
  %14 = 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) @_Z1wB5cxx11)
  %15 = 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) getelementptr inbounds (i8, ptr @_Z1wB5cxx11, i64 32))
  %16 = 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) getelementptr inbounds (i8, ptr @_Z1wB5cxx11, i64 64))
  %17 = 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) getelementptr inbounds (i8, ptr @_Z1wB5cxx11, i64 96))
  store i32 0, ptr @cnt, align 4, !tbaa !8
  %18 = call noundef i32 @_Z2c1v()
  %19 = getelementptr inbounds [2500 x [4 x i32]], ptr @t, i64 0, i64 %indvars.iv
  store i32 %18, ptr %19, align 16, !tbaa !8
  %20 = call noundef i32 @_Z2c2v()
  %21 = getelementptr inbounds i8, ptr %19, i64 4
  store i32 %20, ptr %21, align 4, !tbaa !8
  %22 = call noundef i32 @_Z2c3v()
  %23 = getelementptr inbounds i8, ptr %19, i64 8
  store i32 %22, ptr %23, align 8, !tbaa !8
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %24 = load i32, ptr @n, align 4, !tbaa !8
  %25 = sext i32 %24 to i64
  %26 = icmp slt i64 %indvars.iv.next, %25
  br i1 %26, label %.preheader22, label %.preheader, !llvm.loop !10

.preheader:                                       ; preds = %.preheader22
  %27 = icmp sgt i32 %24, 0
  %res.promoted = load i32, ptr @res, align 4, !tbaa !8
  br i1 %27, label %.lr.ph.us.preheader, label %.preheader.split.split.preheader

.lr.ph.us.preheader:                              ; preds = %.preheader
  %wide.trip.count = zext nneg i32 %24 to i64
  br label %29

28:                                               ; preds = %29
  %indvars.iv.next41 = add nuw nsw i64 %indvars.iv40, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next41, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge.us, label %29, !llvm.loop !12

29:                                               ; preds = %.lr.ph.us.preheader, %28
  %indvars.iv40 = phi i64 [ 0, %.lr.ph.us.preheader ], [ %indvars.iv.next41, %28 ]
  %30 = getelementptr inbounds [2500 x [4 x i32]], ptr @t, i64 0, i64 %indvars.iv40, i64 0
  %31 = load i32, ptr %30, align 16, !tbaa !8
  %32 = icmp eq i32 %31, 0
  br i1 %32, label %.thread.us, label %28

.thread.us:                                       ; preds = %29, %._crit_edge.us
  %33 = phi i32 [ %47, %._crit_edge.us ], [ %res.promoted, %29 ]
  br label %34

34:                                               ; preds = %38, %.thread.us
  %indvars.iv40.1 = phi i64 [ 0, %.thread.us ], [ %indvars.iv.next41.1, %38 ]
  %35 = getelementptr inbounds [2500 x [4 x i32]], ptr @t, i64 0, i64 %indvars.iv40.1, i64 1
  %36 = load i32, ptr %35, align 4, !tbaa !8
  %37 = icmp eq i32 %36, 0
  br i1 %37, label %.thread.us.1, label %38

38:                                               ; preds = %34
  %indvars.iv.next41.1 = add nuw nsw i64 %indvars.iv40.1, 1
  %exitcond.1.not = icmp eq i64 %indvars.iv.next41.1, %wide.trip.count
  br i1 %exitcond.1.not, label %._crit_edge.us.1, label %34, !llvm.loop !12

._crit_edge.us.1:                                 ; preds = %38
  %39 = or i32 %33, 2
  store i32 %39, ptr @res, align 4, !tbaa !8
  br label %.thread.us.1

.thread.us.1:                                     ; preds = %34, %._crit_edge.us.1
  %40 = phi i32 [ %39, %._crit_edge.us.1 ], [ %33, %34 ]
  br label %41

41:                                               ; preds = %45, %.thread.us.1
  %indvars.iv40.2 = phi i64 [ 0, %.thread.us.1 ], [ %indvars.iv.next41.2, %45 ]
  %42 = getelementptr inbounds [2500 x [4 x i32]], ptr @t, i64 0, i64 %indvars.iv40.2, i64 2
  %43 = load i32, ptr %42, align 8, !tbaa !8
  %44 = icmp eq i32 %43, 0
  br i1 %44, label %.split.us, label %45

45:                                               ; preds = %41
  %indvars.iv.next41.2 = add nuw nsw i64 %indvars.iv40.2, 1
  %exitcond.2.not = icmp eq i64 %indvars.iv.next41.2, %wide.trip.count
  br i1 %exitcond.2.not, label %._crit_edge.us.2, label %41, !llvm.loop !12

._crit_edge.us.2:                                 ; preds = %45
  %46 = or i32 %40, 4
  br label %.split.us.sink.split

._crit_edge.us:                                   ; preds = %28
  %47 = or i32 %res.promoted, 1
  store i32 %47, ptr @res, align 4, !tbaa !8
  br label %.thread.us

.preheader.split.split.preheader:                 ; preds = %.preheader, %.preheader.thread
  %res.promoted49 = phi i32 [ %res.promoted48, %.preheader.thread ], [ %res.promoted, %.preheader ]
  %48 = or i32 %res.promoted49, 7
  br label %.split.us.sink.split

.split.us.sink.split:                             ; preds = %.preheader.split.split.preheader, %._crit_edge.us.2
  %.sink = phi i32 [ %46, %._crit_edge.us.2 ], [ %48, %.preheader.split.split.preheader ]
  store i32 %.sink, ptr @res, align 4, !tbaa !8
  br label %.split.us

.split.us:                                        ; preds = %41, %.split.us.sink.split
  %49 = phi i32 [ %.sink, %.split.us.sink.split ], [ %40, %41 ]
  %.us-phi = phi i32 [ 1, %.split.us.sink.split ], [ 0, %41 ]
  store i32 %.us-phi, ptr @flag, align 4, !tbaa !8
  switch i32 %49, label %51 [
    i32 0, label %55
    i32 7, label %50
  ]

50:                                               ; preds = %.split.us
  br label %55

51:                                               ; preds = %.split.us
  %52 = and i32 %49, 1
  %.not = icmp eq i32 %52, 0
  br i1 %.not, label %53, label %55

53:                                               ; preds = %51
  %54 = and i32 %49, 2
  %.not19 = icmp eq i32 %54, 0
  %.str.7..str.6 = select i1 %.not19, ptr @.str.7, ptr @.str.6
  br label %55

55:                                               ; preds = %53, %51, %.split.us, %50
  %.str.4.sink = phi ptr [ @.str.4, %50 ], [ @.str.3, %.split.us ], [ @.str.5, %51 ], [ %.str.7..str.6, %53 ]
  %56 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.4.sink)
  ret i32 0
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEEixEOc(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #1 align 2

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 #4

; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "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 }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}


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