; LLVM IR from AdarshGaur/Competitive-Programming :: Codeforces/Random Problems/B. Biridian Forest (main)

; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl_data" = type { 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 }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"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] }

@_Z6secondB5cxx11 = external dso_local global %"class.std::vector", align 8
@r = external dso_local global i64, align 8
@c = external dso_local global i64, align 8
@vis = external dso_local global [1002 x [1002 x i8]], align 16
@dis = external dso_local global [1002 x [1002 x i64]], align 16
@_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

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3bfsll(i64 noundef, i64 noundef) #1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4bfs2ll(i64 noundef, i64 noundef) #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca %"class.std::__cxx11::basic_string", align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %16 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %17 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %18 = getelementptr i8, ptr %17, i64 -24
  %19 = load i64, ptr %18, align 8
  %20 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %19
  %21 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %20, ptr noundef null)
  %22 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %23 = getelementptr i8, ptr %22, i64 -24
  %24 = load i64, ptr %23, align 8
  %25 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %24
  %26 = call noundef i64 @_ZNSt8ios_base9precisionEl(ptr noundef nonnull align 8 dereferenceable(216) %25, i64 noundef 20)
  %27 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @r)
  %28 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) %27, ptr noundef nonnull align 8 dereferenceable(8) @c)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #6
  store i64 0, ptr %2, align 8, !tbaa !8
  br label %29

29:                                               ; preds = %38, %0
  %30 = load i64, ptr %2, align 8, !tbaa !8
  %31 = load i64, ptr @r, align 8, !tbaa !8
  %32 = icmp slt i64 %30, %31
  br i1 %32, label %34, label %33

33:                                               ; preds = %29
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  br label %45

34:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 32, ptr %3) #6
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #6
  %35 = invoke 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) %3)
          to label %36 unwind label %41

36:                                               ; preds = %34
  invoke void @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE9push_backERKS5_(ptr noundef nonnull align 8 dereferenceable(24) @_Z6secondB5cxx11, ptr noundef nonnull align 8 dereferenceable(32) %3)
          to label %37 unwind label %41

37:                                               ; preds = %36
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %3) #6
  br label %38

38:                                               ; preds = %37
  %39 = load i64, ptr %2, align 8, !tbaa !8
  %40 = add nsw i64 %39, 1
  store i64 %40, ptr %2, align 8, !tbaa !8
  br label %29, !llvm.loop !11

41:                                               ; preds = %36, %34
  %42 = landingpad { ptr, i32 }
          cleanup
  %43 = extractvalue { ptr, i32 } %42, 0
  store ptr %43, ptr %4, align 8
  %44 = extractvalue { ptr, i32 } %42, 1
  store i32 %44, ptr %5, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  br label %196

45:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  store i64 0, ptr %6, align 8, !tbaa !8
  br label %46

46:                                               ; preds = %74, %45
  %47 = load i64, ptr %6, align 8, !tbaa !8
  %48 = load i64, ptr @r, align 8, !tbaa !8
  %49 = icmp slt i64 %47, %48
  br i1 %49, label %51, label %50

50:                                               ; preds = %46
  store i32 5, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  br label %77

51:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  store i64 0, ptr %8, align 8, !tbaa !8
  br label %52

52:                                               ; preds = %69, %51
  %53 = load i64, ptr %8, align 8, !tbaa !8
  %54 = load i64, ptr @c, align 8, !tbaa !8
  %55 = icmp slt i64 %53, %54
  br i1 %55, label %57, label %56

56:                                               ; preds = %52
  store i32 8, ptr %7, align 4
  br label %72

57:                                               ; preds = %52
  %58 = load i64, ptr %6, align 8, !tbaa !8
  %59 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @_Z6secondB5cxx11, i64 noundef %58) #6
  %60 = load i64, ptr %8, align 8, !tbaa !8
  %61 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %59, i64 noundef %60)
  %62 = load i8, ptr %61, align 1, !tbaa !13
  %63 = sext i8 %62 to i32
  %64 = icmp eq i32 %63, 83
  br i1 %64, label %65, label %68

65:                                               ; preds = %57
  %66 = load i64, ptr %6, align 8, !tbaa !8
  %67 = load i64, ptr %8, align 8, !tbaa !8
  call void @_Z3bfsll(i64 noundef %66, i64 noundef %67)
  store i32 8, ptr %7, align 4
  br label %72

68:                                               ; preds = %57
  br label %69

69:                                               ; preds = %68
  %70 = load i64, ptr %8, align 8, !tbaa !8
  %71 = add nsw i64 %70, 1
  store i64 %71, ptr %8, align 8, !tbaa !8
  br label %52, !llvm.loop !14

72:                                               ; preds = %65, %56
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %73

73:                                               ; preds = %72
  br label %74

74:                                               ; preds = %73
  %75 = load i64, ptr %6, align 8, !tbaa !8
  %76 = add nsw i64 %75, 1
  store i64 %76, ptr %6, align 8, !tbaa !8
  br label %46, !llvm.loop !15

77:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  store i64 0, ptr %9, align 8, !tbaa !8
  br label %78

78:                                               ; preds = %102, %77
  %79 = load i64, ptr %9, align 8, !tbaa !8
  %80 = load i64, ptr @r, align 8, !tbaa !8
  %81 = icmp slt i64 %79, %80
  br i1 %81, label %83, label %82

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

83:                                               ; preds = %78
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  store i64 0, ptr %10, align 8, !tbaa !8
  br label %84

84:                                               ; preds = %98, %83
  %85 = load i64, ptr %10, align 8, !tbaa !8
  %86 = load i64, ptr @c, align 8, !tbaa !8
  %87 = icmp slt i64 %85, %86
  br i1 %87, label %89, label %88

88:                                               ; preds = %84
  store i32 14, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %101

89:                                               ; preds = %84
  %90 = load i64, ptr %9, align 8, !tbaa !8
  %91 = getelementptr inbounds [1002 x [1002 x i8]], ptr @vis, i64 0, i64 %90
  %92 = load i64, ptr %10, align 8, !tbaa !8
  %93 = getelementptr inbounds [1002 x i8], ptr %91, i64 0, i64 %92
  store i8 0, ptr %93, align 1, !tbaa !16
  %94 = load i64, ptr %9, align 8, !tbaa !8
  %95 = getelementptr inbounds [1002 x [1002 x i64]], ptr @dis, i64 0, i64 %94
  %96 = load i64, ptr %10, align 8, !tbaa !8
  %97 = getelementptr inbounds [1002 x i64], ptr %95, i64 0, i64 %96
  store i64 0, ptr %97, align 8, !tbaa !8
  br label %98

98:                                               ; preds = %89
  %99 = load i64, ptr %10, align 8, !tbaa !8
  %100 = add nsw i64 %99, 1
  store i64 %100, ptr %10, align 8, !tbaa !8
  br label %84, !llvm.loop !18

101:                                              ; preds = %88
  br label %102

102:                                              ; preds = %101
  %103 = load i64, ptr %9, align 8, !tbaa !8
  %104 = add nsw i64 %103, 1
  store i64 %104, ptr %9, align 8, !tbaa !8
  br label %78, !llvm.loop !19

105:                                              ; preds = %82
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  store i64 0, ptr %11, align 8, !tbaa !8
  br label %106

106:                                              ; preds = %134, %105
  %107 = load i64, ptr %11, align 8, !tbaa !8
  %108 = load i64, ptr @r, align 8, !tbaa !8
  %109 = icmp slt i64 %107, %108
  br i1 %109, label %111, label %110

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

111:                                              ; preds = %106
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  store i64 0, ptr %12, align 8, !tbaa !8
  br label %112

112:                                              ; preds = %129, %111
  %113 = load i64, ptr %12, align 8, !tbaa !8
  %114 = load i64, ptr @c, align 8, !tbaa !8
  %115 = icmp slt i64 %113, %114
  br i1 %115, label %117, label %116

116:                                              ; preds = %112
  store i32 20, ptr %7, align 4
  br label %132

117:                                              ; preds = %112
  %118 = load i64, ptr %11, align 8, !tbaa !8
  %119 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @_Z6secondB5cxx11, i64 noundef %118) #6
  %120 = load i64, ptr %12, align 8, !tbaa !8
  %121 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %119, i64 noundef %120)
  %122 = load i8, ptr %121, align 1, !tbaa !13
  %123 = sext i8 %122 to i32
  %124 = icmp eq i32 %123, 69
  br i1 %124, label %125, label %128

125:                                              ; preds = %117
  %126 = load i64, ptr %11, align 8, !tbaa !8
  %127 = load i64, ptr %12, align 8, !tbaa !8
  call void @_Z4bfs2ll(i64 noundef %126, i64 noundef %127)
  store i32 20, ptr %7, align 4
  br label %132

128:                                              ; preds = %117
  br label %129

129:                                              ; preds = %128
  %130 = load i64, ptr %12, align 8, !tbaa !8
  %131 = add nsw i64 %130, 1
  store i64 %131, ptr %12, align 8, !tbaa !8
  br label %112, !llvm.loop !20

132:                                              ; preds = %125, %116
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  br label %133

133:                                              ; preds = %132
  br label %134

134:                                              ; preds = %133
  %135 = load i64, ptr %11, align 8, !tbaa !8
  %136 = add nsw i64 %135, 1
  store i64 %136, ptr %11, align 8, !tbaa !8
  br label %106, !llvm.loop !21

137:                                              ; preds = %110
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  store i64 0, ptr %13, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  store i64 0, ptr %14, align 8, !tbaa !8
  br label %138

138:                                              ; preds = %188, %137
  %139 = load i64, ptr %14, align 8, !tbaa !8
  %140 = load i64, ptr @r, align 8, !tbaa !8
  %141 = icmp slt i64 %139, %140
  br i1 %141, label %143, label %142

142:                                              ; preds = %138
  store i32 23, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %191

143:                                              ; preds = %138
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  store i64 0, ptr %15, align 8, !tbaa !8
  br label %144

144:                                              ; preds = %184, %143
  %145 = load i64, ptr %15, align 8, !tbaa !8
  %146 = load i64, ptr @c, align 8, !tbaa !8
  %147 = icmp slt i64 %145, %146
  br i1 %147, label %149, label %148

148:                                              ; preds = %144
  store i32 26, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  br label %187

149:                                              ; preds = %144
  %150 = load i64, ptr %14, align 8, !tbaa !8
  %151 = getelementptr inbounds [1002 x [1002 x i8]], ptr @vis, i64 0, i64 %150
  %152 = load i64, ptr %15, align 8, !tbaa !8
  %153 = getelementptr inbounds [1002 x i8], ptr %151, i64 0, i64 %152
  %154 = load i8, ptr %153, align 1, !tbaa !16, !range !22, !noundef !23
  %155 = trunc i8 %154 to i1
  br i1 %155, label %156, label %183

156:                                              ; preds = %149
  %157 = load i64, ptr %14, align 8, !tbaa !8
  %158 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @_Z6secondB5cxx11, i64 noundef %157) #6
  %159 = load i64, ptr %15, align 8, !tbaa !8
  %160 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %158, i64 noundef %159)
  %161 = load i8, ptr %160, align 1, !tbaa !13
  %162 = sext i8 %161 to i32
  %163 = icmp ne i32 %162, 69
  br i1 %163, label %164, label %183

164:                                              ; preds = %156
  %165 = load i64, ptr %14, align 8, !tbaa !8
  %166 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @_Z6secondB5cxx11, i64 noundef %165) #6
  %167 = load i64, ptr %15, align 8, !tbaa !8
  %168 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %166, i64 noundef %167)
  %169 = load i8, ptr %168, align 1, !tbaa !13
  %170 = sext i8 %169 to i32
  %171 = icmp ne i32 %170, 83
  br i1 %171, label %172, label %183

172:                                              ; preds = %164
  %173 = load i64, ptr %14, align 8, !tbaa !8
  %174 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @_Z6secondB5cxx11, i64 noundef %173) #6
  %175 = load i64, ptr %15, align 8, !tbaa !8
  %176 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %174, i64 noundef %175)
  %177 = load i8, ptr %176, align 1, !tbaa !13
  %178 = sext i8 %177 to i32
  %179 = sub nsw i32 %178, 48
  %180 = sext i32 %179 to i64
  %181 = load i64, ptr %13, align 8, !tbaa !8
  %182 = add nsw i64 %181, %180
  store i64 %182, ptr %13, align 8, !tbaa !8
  br label %183

183:                                              ; preds = %172, %164, %156, %149
  br label %184

184:                                              ; preds = %183
  %185 = load i64, ptr %15, align 8, !tbaa !8
  %186 = add nsw i64 %185, 1
  store i64 %186, ptr %15, align 8, !tbaa !8
  br label %144, !llvm.loop !24

187:                                              ; preds = %148
  br label %188

188:                                              ; preds = %187
  %189 = load i64, ptr %14, align 8, !tbaa !8
  %190 = add nsw i64 %189, 1
  store i64 %190, ptr %14, align 8, !tbaa !8
  br label %138, !llvm.loop !25

191:                                              ; preds = %142
  %192 = load i64, ptr %13, align 8, !tbaa !8
  %193 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %192)
  %194 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %193, ptr noundef @.str)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  %195 = load i32, ptr %1, align 4
  ret i32 %195

196:                                              ; preds = %41
  %197 = load ptr, ptr %4, align 8
  %198 = load i32, ptr %5, align 4
  %199 = insertvalue { ptr, i32 } poison, ptr %197, 0
  %200 = insertvalue { ptr, i32 } %199, i32 %198, 1
  resume { ptr, i32 } %200
}

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

; 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: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNSt8ios_base9precisionEl(ptr noundef nonnull align 8 dereferenceable(216), i64 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2 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)) #4

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

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

; 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) #5

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

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 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 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 #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 = { 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 #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 = !{!"long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!10, !10, i64 0}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = !{!17, !17, i64 0}
!17 = !{!"bool", !10, i64 0}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = !{i8 0, i8 2}
!23 = !{}
!24 = distinct !{!24, !12}
!25 = distinct !{!25, !12}


; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::__cxx11::basic_string<char>, std::allocator<std::__cxx11::basic_string<char>>>::_Vector_impl_data" = type { 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 }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"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] }

@_Z6secondB5cxx11 = external dso_local global %"class.std::vector", align 8
@r = external dso_local global i64, align 8
@c = external dso_local global i64, align 8
@vis = external dso_local local_unnamed_addr global [1002 x [1002 x i8]], align 16
@dis = external dso_local local_unnamed_addr global [1002 x [1002 x i64]], align 16
@_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

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3bfsll(i64 noundef, i64 noundef) local_unnamed_addr #1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4bfs2ll(i64 noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::__cxx11::basic_string", align 8
  %2 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %3 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %4 = getelementptr i8, ptr %3, i64 -24
  %5 = load i64, ptr %4, align 8
  %6 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %5
  %7 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %6, ptr noundef null)
  %8 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %9 = getelementptr i8, ptr %8, i64 -24
  %10 = load i64, ptr %9, align 8
  %11 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %10
  %12 = tail call noundef i64 @_ZNSt8ios_base9precisionEl(ptr noundef nonnull align 8 dereferenceable(216) %11, i64 noundef 20)
  %13 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @r)
  %14 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 8 dereferenceable(8) @c)
  %15 = load i64, ptr @r, align 8, !tbaa !8
  %16 = icmp sgt i64 %15, 0
  br i1 %16, label %.lr.ph, label %._crit_edge80

.preheader59:                                     ; preds = %22
  %17 = icmp sgt i64 %24, 0
  %18 = load i64, ptr @c, align 8
  %19 = icmp sgt i64 %18, 0
  %or.cond = select i1 %17, i1 %19, i1 false
  br i1 %or.cond, label %.preheader57, label %._crit_edge80

.lr.ph:                                           ; preds = %0, %22
  %.05062 = phi i64 [ %23, %22 ], [ 0, %0 ]
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %1) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #7
  %20 = invoke 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) %1)
          to label %21 unwind label %26

21:                                               ; preds = %.lr.ph
  invoke void @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE9push_backERKS5_(ptr noundef nonnull align 8 dereferenceable(24) @_Z6secondB5cxx11, ptr noundef nonnull align 8 dereferenceable(32) %1)
          to label %22 unwind label %26

22:                                               ; preds = %21
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #7
  %23 = add nuw nsw i64 %.05062, 1
  %24 = load i64, ptr @r, align 8, !tbaa !8
  %25 = icmp slt i64 %23, %24
  br i1 %25, label %.lr.ph, label %.preheader59, !llvm.loop !11

26:                                               ; preds = %21, %.lr.ph
  %27 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #7
  resume { ptr, i32 } %27

.preheader57:                                     ; preds = %.preheader59, %.loopexit58
  %28 = phi i64 [ %55, %.loopexit58 ], [ %18, %.preheader59 ]
  %.04965 = phi i64 [ %56, %.loopexit58 ], [ 0, %.preheader59 ]
  %29 = icmp sgt i64 %28, 0
  br i1 %29, label %.lr.ph64, label %.loopexit58

.preheader56:                                     ; preds = %.loopexit58
  %30 = icmp sgt i64 %57, 0
  br i1 %30, label %.preheader55.lr.ph, label %._crit_edge80

.preheader55.lr.ph:                               ; preds = %.preheader56
  %.pr = load i64, ptr @c, align 8, !tbaa !8
  %31 = icmp sgt i64 %.pr, 0
  br i1 %31, label %.preheader55.us.preheader, label %._crit_edge80

.preheader55.us.preheader:                        ; preds = %.preheader55.lr.ph
  %32 = shl nuw i64 %.pr, 3
  %xtraiter = and i64 %57, 3
  %33 = icmp ult i64 %57, 4
  br i1 %33, label %.preheader54.unr-lcssa, label %.preheader55.us.preheader.new

.preheader55.us.preheader.new:                    ; preds = %.preheader55.us.preheader
  %unroll_iter = and i64 %57, 9223372036854775804
  br label %.preheader55.us

.preheader55.us:                                  ; preds = %.preheader55.us, %.preheader55.us.preheader.new
  %.04769.us = phi i64 [ 0, %.preheader55.us.preheader.new ], [ %45, %.preheader55.us ]
  %niter = phi i64 [ 0, %.preheader55.us.preheader.new ], [ %niter.next.3, %.preheader55.us ]
  %34 = mul nuw nsw i64 %.04769.us, 8016
  %scevgep90 = getelementptr i8, ptr @dis, i64 %34
  %35 = mul nuw nsw i64 %.04769.us, 1002
  %scevgep = getelementptr i8, ptr @vis, i64 %35
  call void @llvm.memset.p0.i64(ptr align 8 %scevgep, i8 0, i64 %.pr, i1 false), !tbaa !13
  call void @llvm.memset.p0.i64(ptr align 16 %scevgep90, i8 0, i64 %32, i1 false), !tbaa !8
  %36 = or disjoint i64 %.04769.us, 1
  %37 = mul nuw nsw i64 %36, 8016
  %scevgep90.1 = getelementptr i8, ptr @dis, i64 %37
  %38 = mul nuw nsw i64 %36, 1002
  %scevgep.1 = getelementptr i8, ptr @vis, i64 %38
  call void @llvm.memset.p0.i64(ptr align 2 %scevgep.1, i8 0, i64 %.pr, i1 false), !tbaa !13
  call void @llvm.memset.p0.i64(ptr align 16 %scevgep90.1, i8 0, i64 %32, i1 false), !tbaa !8
  %39 = or disjoint i64 %.04769.us, 2
  %40 = mul nuw nsw i64 %39, 8016
  %scevgep90.2 = getelementptr i8, ptr @dis, i64 %40
  %41 = mul nuw nsw i64 %39, 1002
  %scevgep.2 = getelementptr i8, ptr @vis, i64 %41
  call void @llvm.memset.p0.i64(ptr align 4 %scevgep.2, i8 0, i64 %.pr, i1 false), !tbaa !13
  call void @llvm.memset.p0.i64(ptr align 16 %scevgep90.2, i8 0, i64 %32, i1 false), !tbaa !8
  %42 = or disjoint i64 %.04769.us, 3
  %43 = mul nuw nsw i64 %42, 8016
  %scevgep90.3 = getelementptr i8, ptr @dis, i64 %43
  %44 = mul nuw nsw i64 %42, 1002
  %scevgep.3 = getelementptr i8, ptr @vis, i64 %44
  call void @llvm.memset.p0.i64(ptr align 2 %scevgep.3, i8 0, i64 %.pr, i1 false), !tbaa !13
  call void @llvm.memset.p0.i64(ptr align 16 %scevgep90.3, i8 0, i64 %32, i1 false), !tbaa !8
  %45 = add nuw nsw i64 %.04769.us, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %.preheader54.unr-lcssa, label %.preheader55.us, !llvm.loop !15

.lr.ph64:                                         ; preds = %.preheader57, %51
  %.04863 = phi i64 [ %52, %51 ], [ 0, %.preheader57 ]
  %46 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @_Z6secondB5cxx11, i64 noundef %.04965) #7
  %47 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %46, i64 noundef %.04863)
  %48 = load i8, ptr %47, align 1, !tbaa !16
  %49 = icmp eq i8 %48, 83
  br i1 %49, label %50, label %51

50:                                               ; preds = %.lr.ph64
  call void @_Z3bfsll(i64 noundef %.04965, i64 noundef %.04863)
  %.pre = load i64, ptr @c, align 8, !tbaa !8
  br label %.loopexit58

51:                                               ; preds = %.lr.ph64
  %52 = add nuw nsw i64 %.04863, 1
  %53 = load i64, ptr @c, align 8, !tbaa !8
  %54 = icmp slt i64 %52, %53
  br i1 %54, label %.lr.ph64, label %.loopexit58, !llvm.loop !17

.loopexit58:                                      ; preds = %51, %.preheader57, %50
  %55 = phi i64 [ %28, %.preheader57 ], [ %.pre, %50 ], [ %53, %51 ]
  %56 = add nuw nsw i64 %.04965, 1
  %57 = load i64, ptr @r, align 8, !tbaa !8
  %58 = icmp slt i64 %56, %57
  br i1 %58, label %.preheader57, label %.preheader56, !llvm.loop !18

.preheader54.unr-lcssa:                           ; preds = %.preheader55.us, %.preheader55.us.preheader
  %.04769.us.unr = phi i64 [ 0, %.preheader55.us.preheader ], [ %45, %.preheader55.us ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader54, label %.preheader55.us.epil

.preheader55.us.epil:                             ; preds = %.preheader54.unr-lcssa, %.preheader55.us.epil
  %.04769.us.epil = phi i64 [ %61, %.preheader55.us.epil ], [ %.04769.us.unr, %.preheader54.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.preheader55.us.epil ], [ 0, %.preheader54.unr-lcssa ]
  %59 = mul nuw nsw i64 %.04769.us.epil, 8016
  %scevgep90.epil = getelementptr i8, ptr @dis, i64 %59
  %60 = mul nuw nsw i64 %.04769.us.epil, 1002
  %scevgep.epil = getelementptr i8, ptr @vis, i64 %60
  call void @llvm.memset.p0.i64(ptr align 2 %scevgep.epil, i8 0, i64 %.pr, i1 false), !tbaa !13
  call void @llvm.memset.p0.i64(ptr align 16 %scevgep90.epil, i8 0, i64 %32, i1 false), !tbaa !8
  %61 = add nuw nsw i64 %.04769.us.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %.preheader54, label %.preheader55.us.epil, !llvm.loop !20

.preheader54:                                     ; preds = %.preheader55.us.epil, %.preheader54.unr-lcssa
  %.pr98 = load i64, ptr @c, align 8
  %62 = icmp sgt i64 %.pr98, 0
  %or.cond113 = select i1 %30, i1 %62, i1 false
  br i1 %or.cond113, label %.preheader53, label %.preheader52

.preheader53:                                     ; preds = %.preheader54, %.loopexit
  %63 = phi i64 [ %77, %.loopexit ], [ %.pr98, %.preheader54 ]
  %.04572 = phi i64 [ %78, %.loopexit ], [ 0, %.preheader54 ]
  %64 = icmp sgt i64 %63, 0
  br i1 %64, label %.lr.ph71, label %.loopexit

.preheader52:                                     ; preds = %.loopexit, %.preheader54
  %65 = phi i64 [ %57, %.preheader54 ], [ %79, %.loopexit ]
  %66 = icmp sgt i64 %65, 0
  %.pr103 = load i64, ptr @c, align 8
  %67 = icmp sgt i64 %.pr103, 0
  %or.cond114 = select i1 %66, i1 %67, i1 false
  br i1 %or.cond114, label %.preheader, label %._crit_edge80

.lr.ph71:                                         ; preds = %.preheader53, %73
  %.04470 = phi i64 [ %74, %73 ], [ 0, %.preheader53 ]
  %68 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @_Z6secondB5cxx11, i64 noundef %.04572) #7
  %69 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %68, i64 noundef %.04470)
  %70 = load i8, ptr %69, align 1, !tbaa !16
  %71 = icmp eq i8 %70, 69
  br i1 %71, label %72, label %73

72:                                               ; preds = %.lr.ph71
  call void @_Z4bfs2ll(i64 noundef %.04572, i64 noundef %.04470)
  %.pre92 = load i64, ptr @c, align 8, !tbaa !8
  br label %.loopexit

73:                                               ; preds = %.lr.ph71
  %74 = add nuw nsw i64 %.04470, 1
  %75 = load i64, ptr @c, align 8, !tbaa !8
  %76 = icmp slt i64 %74, %75
  br i1 %76, label %.lr.ph71, label %.loopexit, !llvm.loop !22

.loopexit:                                        ; preds = %73, %.preheader53, %72
  %77 = phi i64 [ %63, %.preheader53 ], [ %.pre92, %72 ], [ %75, %73 ]
  %78 = add nuw nsw i64 %.04572, 1
  %79 = load i64, ptr @r, align 8, !tbaa !8
  %80 = icmp slt i64 %78, %79
  br i1 %80, label %.preheader53, label %.preheader52, !llvm.loop !23

.preheader:                                       ; preds = %.preheader52, %._crit_edge
  %81 = phi i64 [ %86, %._crit_edge ], [ %65, %.preheader52 ]
  %82 = phi i64 [ %87, %._crit_edge ], [ %.pr103, %.preheader52 ]
  %.04279 = phi i64 [ %88, %._crit_edge ], [ 0, %.preheader52 ]
  %.04378 = phi i64 [ %.1.lcssa, %._crit_edge ], [ 0, %.preheader52 ]
  %83 = icmp sgt i64 %82, 0
  br i1 %83, label %.lr.ph76, label %._crit_edge

._crit_edge80:                                    ; preds = %._crit_edge, %.preheader55.lr.ph, %.preheader56, %0, %.preheader59, %.preheader52
  %.043.lcssa = phi i64 [ 0, %.preheader52 ], [ 0, %.preheader59 ], [ 0, %0 ], [ 0, %.preheader56 ], [ 0, %.preheader55.lr.ph ], [ %.1.lcssa, %._crit_edge ]
  %84 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.043.lcssa)
  %85 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %84, ptr noundef nonnull @.str)
  ret i32 0

._crit_edge.loopexit:                             ; preds = %108
  %.pre94 = load i64, ptr @r, align 8, !tbaa !8
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %86 = phi i64 [ %81, %.preheader ], [ %.pre94, %._crit_edge.loopexit ]
  %87 = phi i64 [ %82, %.preheader ], [ %110, %._crit_edge.loopexit ]
  %.1.lcssa = phi i64 [ %.04378, %.preheader ], [ %.2, %._crit_edge.loopexit ]
  %88 = add nuw nsw i64 %.04279, 1
  %89 = icmp slt i64 %88, %86
  br i1 %89, label %.preheader, label %._crit_edge80, !llvm.loop !24

.lr.ph76:                                         ; preds = %.preheader, %108
  %.075 = phi i64 [ %109, %108 ], [ 0, %.preheader ]
  %.174 = phi i64 [ %.2, %108 ], [ %.04378, %.preheader ]
  %90 = getelementptr inbounds [1002 x [1002 x i8]], ptr @vis, i64 0, i64 %.04279, i64 %.075
  %91 = load i8, ptr %90, align 1, !tbaa !13, !range !25, !noundef !26
  %92 = trunc nuw i8 %91 to i1
  br i1 %92, label %93, label %108

93:                                               ; preds = %.lr.ph76
  %94 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @_Z6secondB5cxx11, i64 noundef %.04279) #7
  %95 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %94, i64 noundef %.075)
  %96 = load i8, ptr %95, align 1, !tbaa !16
  %.not = icmp eq i8 %96, 69
  br i1 %.not, label %108, label %97

97:                                               ; preds = %93
  %98 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @_Z6secondB5cxx11, i64 noundef %.04279) #7
  %99 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %98, i64 noundef %.075)
  %100 = load i8, ptr %99, align 1, !tbaa !16
  %.not51 = icmp eq i8 %100, 83
  br i1 %.not51, label %108, label %101

101:                                              ; preds = %97
  %102 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @_Z6secondB5cxx11, i64 noundef %.04279) #7
  %103 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %102, i64 noundef %.075)
  %104 = load i8, ptr %103, align 1, !tbaa !16
  %105 = sext i8 %104 to i64
  %106 = add i64 %.174, -48
  %107 = add i64 %106, %105
  br label %108

108:                                              ; preds = %.lr.ph76, %93, %97, %101
  %.2 = phi i64 [ %107, %101 ], [ %.174, %97 ], [ %.174, %93 ], [ %.174, %.lr.ph76 ]
  %109 = add nuw nsw i64 %.075, 1
  %110 = load i64, ptr @c, align 8, !tbaa !8
  %111 = icmp slt i64 %109, %110
  br i1 %111, label %.lr.ph76, label %._crit_edge.loopexit, !llvm.loop !27
}

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

; 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 nounwind uwtable
declare dso_local noundef i64 @_ZNSt8ios_base9precisionEl(ptr noundef nonnull align 8 dereferenceable(216), i64 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2 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: mustprogress uwtable
declare dso_local void @_ZNSt6vectorINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESaIS5_EE9push_backERKS5_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1 align 2

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

; 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 #5

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

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

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 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 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 #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 = { 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 #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { 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 = !{!"long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"bool", !10, i64 0}
!15 = distinct !{!15, !12}
!16 = !{!10, !10, i64 0}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12, !19}
!19 = !{!"llvm.loop.unswitch.partial.disable"}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.unroll.disable"}
!22 = distinct !{!22, !12}
!23 = distinct !{!23, !12, !19}
!24 = distinct !{!24, !12, !19}
!25 = !{i8 0, i8 2}
!26 = !{}
!27 = distinct !{!27, !12}


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