; LLVM IR from DionysiosB/CodeForces :: 2008B-SquareOrNot (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::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::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<long, std::pair<const long, long>, std::_Select1st<std::pair<const long, long>>, std::less<long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<long, std::pair<const long, long>, std::_Select1st<std::pair<const long, long>>, std::less<long>>::_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::__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] }

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::map", align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca %"class.std::__cxx11::basic_string", align 8
  %10 = alloca i64, align 8
  %11 = alloca i32, align 4
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i8, align 1
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca i8, align 1
  %18 = alloca i8, align 1
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 48, ptr %2) #5
  call void @_ZNSt3mapIllSt4lessIlESaISt4pairIKllEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  store i64 1, ptr %3, align 8, !tbaa !5
  br label %19

19:                                               ; preds = %30, %0
  %20 = load i64, ptr %3, align 8, !tbaa !5
  %21 = icmp sle i64 %20, 1000
  br i1 %21, label %23, label %22

22:                                               ; preds = %19
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  br label %37

23:                                               ; preds = %19
  %24 = load i64, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  %25 = load i64, ptr %3, align 8, !tbaa !5
  %26 = load i64, ptr %3, align 8, !tbaa !5
  %27 = mul nsw i64 %25, %26
  store i64 %27, ptr %4, align 8, !tbaa !5
  %28 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIllSt4lessIlESaISt4pairIKllEEEixEOl(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 8 dereferenceable(8) %4)
          to label %29 unwind label %33

29:                                               ; preds = %23
  store i64 %24, ptr %28, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  br label %30

30:                                               ; preds = %29
  %31 = load i64, ptr %3, align 8, !tbaa !5
  %32 = add nsw i64 %31, 1
  store i64 %32, ptr %3, align 8, !tbaa !5
  br label %19, !llvm.loop !9

33:                                               ; preds = %23
  %34 = landingpad { ptr, i32 }
          cleanup
  %35 = extractvalue { ptr, i32 } %34, 0
  store ptr %35, ptr %5, align 8
  %36 = extractvalue { ptr, i32 } %34, 1
  store i32 %36, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  br label %175

37:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %38 = invoke i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %7)
          to label %39 unwind label %57

39:                                               ; preds = %37
  br label %40

40:                                               ; preds = %163, %161, %39
  %41 = load i64, ptr %7, align 8, !tbaa !5
  %42 = add nsw i64 %41, -1
  store i64 %42, ptr %7, align 8, !tbaa !5
  %43 = icmp ne i64 %41, 0
  br i1 %43, label %44, label %172

44:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %45 = invoke i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %8)
          to label %46 unwind label %61

46:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 32, ptr %9) #5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #5
  %47 = 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) %9)
          to label %48 unwind label %65

48:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %49 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %9) #5
  store i64 %49, ptr %10, align 8, !tbaa !5
  %50 = invoke noundef i64 @_ZNKSt3mapIllSt4lessIlESaISt4pairIKllEEE5countERS3_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 8 dereferenceable(8) %10)
          to label %51 unwind label %69

51:                                               ; preds = %48
  %52 = icmp ne i64 %50, 0
  %53 = xor i1 %52, true
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br i1 %53, label %54, label %73

54:                                               ; preds = %51
  %55 = invoke i32 @puts(ptr noundef @.str.1)
          to label %56 unwind label %65

56:                                               ; preds = %54
  store i32 5, ptr %11, align 4
  br label %161, !llvm.loop !11

57:                                               ; preds = %37
  %58 = landingpad { ptr, i32 }
          cleanup
  %59 = extractvalue { ptr, i32 } %58, 0
  store ptr %59, ptr %5, align 8
  %60 = extractvalue { ptr, i32 } %58, 1
  store i32 %60, ptr %6, align 4
  br label %174

61:                                               ; preds = %44
  %62 = landingpad { ptr, i32 }
          cleanup
  %63 = extractvalue { ptr, i32 } %62, 0
  store ptr %63, ptr %5, align 8
  %64 = extractvalue { ptr, i32 } %62, 1
  store i32 %64, ptr %6, align 4
  br label %171

65:                                               ; preds = %54, %46
  %66 = landingpad { ptr, i32 }
          cleanup
  %67 = extractvalue { ptr, i32 } %66, 0
  store ptr %67, ptr %5, align 8
  %68 = extractvalue { ptr, i32 } %66, 1
  store i32 %68, ptr %6, align 4
  br label %170

69:                                               ; preds = %48
  %70 = landingpad { ptr, i32 }
          cleanup
  %71 = extractvalue { ptr, i32 } %70, 0
  store ptr %71, ptr %5, align 8
  %72 = extractvalue { ptr, i32 } %70, 1
  store i32 %72, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %170

73:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %74 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %9) #5
  store i64 %74, ptr %13, align 8, !tbaa !5
  %75 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIllSt4lessIlESaISt4pairIKllEEEixEOl(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 8 dereferenceable(8) %13)
          to label %76 unwind label %88

76:                                               ; preds = %73
  %77 = load i64, ptr %75, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  store i64 %77, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %14) #5
  store i8 1, ptr %14, align 1, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  store i64 0, ptr %15, align 8, !tbaa !5
  br label %78

78:                                               ; preds = %151, %76
  %79 = load i8, ptr %14, align 1, !tbaa !12, !range !14, !noundef !15
  %80 = trunc i8 %79 to i1
  br i1 %80, label %81, label %85

81:                                               ; preds = %78
  %82 = load i64, ptr %15, align 8, !tbaa !5
  %83 = load i64, ptr %12, align 8, !tbaa !5
  %84 = icmp slt i64 %82, %83
  br label %85

85:                                               ; preds = %81, %78
  %86 = phi i1 [ false, %78 ], [ %84, %81 ]
  br i1 %86, label %92, label %87

87:                                               ; preds = %85
  store i32 7, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  br label %154

88:                                               ; preds = %73
  %89 = landingpad { ptr, i32 }
          cleanup
  %90 = extractvalue { ptr, i32 } %89, 0
  store ptr %90, ptr %5, align 8
  %91 = extractvalue { ptr, i32 } %89, 1
  store i32 %91, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %169

92:                                               ; preds = %85
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  store i64 0, ptr %16, align 8, !tbaa !5
  br label %93

93:                                               ; preds = %147, %92
  %94 = load i8, ptr %14, align 1, !tbaa !12, !range !14, !noundef !15
  %95 = trunc i8 %94 to i1
  br i1 %95, label %96, label %100

96:                                               ; preds = %93
  %97 = load i64, ptr %16, align 8, !tbaa !5
  %98 = load i64, ptr %12, align 8, !tbaa !5
  %99 = icmp slt i64 %97, %98
  br label %100

100:                                              ; preds = %96, %93
  %101 = phi i1 [ false, %93 ], [ %99, %96 ]
  br i1 %101, label %103, label %102

102:                                              ; preds = %100
  store i32 10, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  br label %150

103:                                              ; preds = %100
  call void @llvm.lifetime.start.p0(i64 1, ptr %17) #5
  %104 = load i64, ptr %15, align 8, !tbaa !5
  %105 = load i64, ptr %12, align 8, !tbaa !5
  %106 = mul nsw i64 %104, %105
  %107 = load i64, ptr %16, align 8, !tbaa !5
  %108 = add nsw i64 %106, %107
  %109 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %9, i64 noundef %108)
          to label %110 unwind label %142

110:                                              ; preds = %103
  %111 = load i8, ptr %109, align 1, !tbaa !16
  %112 = sext i8 %111 to i32
  %113 = icmp eq i32 %112, 49
  %114 = zext i1 %113 to i8
  store i8 %114, ptr %17, align 1, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 1, ptr %18) #5
  %115 = load i64, ptr %15, align 8, !tbaa !5
  %116 = icmp eq i64 %115, 0
  br i1 %116, label %130, label %117

117:                                              ; preds = %110
  %118 = load i64, ptr %15, align 8, !tbaa !5
  %119 = load i64, ptr %12, align 8, !tbaa !5
  %120 = sub nsw i64 %119, 1
  %121 = icmp eq i64 %118, %120
  br i1 %121, label %130, label %122

122:                                              ; preds = %117
  %123 = load i64, ptr %16, align 8, !tbaa !5
  %124 = icmp eq i64 %123, 0
  br i1 %124, label %130, label %125

125:                                              ; preds = %122
  %126 = load i64, ptr %16, align 8, !tbaa !5
  %127 = load i64, ptr %12, align 8, !tbaa !5
  %128 = sub nsw i64 %127, 1
  %129 = icmp eq i64 %126, %128
  br label %130

130:                                              ; preds = %125, %122, %117, %110
  %131 = phi i1 [ true, %122 ], [ true, %117 ], [ true, %110 ], [ %129, %125 ]
  %132 = zext i1 %131 to i8
  store i8 %132, ptr %18, align 1, !tbaa !12
  %133 = load i8, ptr %18, align 1, !tbaa !12, !range !14, !noundef !15
  %134 = trunc i8 %133 to i1
  %135 = zext i1 %134 to i32
  %136 = load i8, ptr %17, align 1, !tbaa !12, !range !14, !noundef !15
  %137 = trunc i8 %136 to i1
  %138 = zext i1 %137 to i32
  %139 = xor i32 %135, %138
  %140 = icmp ne i32 %139, 0
  br i1 %140, label %141, label %146

141:                                              ; preds = %130
  store i8 0, ptr %14, align 1, !tbaa !12
  br label %146

142:                                              ; preds = %103
  %143 = landingpad { ptr, i32 }
          cleanup
  %144 = extractvalue { ptr, i32 } %143, 0
  store ptr %144, ptr %5, align 8
  %145 = extractvalue { ptr, i32 } %143, 1
  store i32 %145, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  br label %168

146:                                              ; preds = %141, %130
  call void @llvm.lifetime.end.p0(i64 1, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %17) #5
  br label %147

147:                                              ; preds = %146
  %148 = load i64, ptr %16, align 8, !tbaa !5
  %149 = add nsw i64 %148, 1
  store i64 %149, ptr %16, align 8, !tbaa !5
  br label %93, !llvm.loop !17

150:                                              ; preds = %102
  br label %151

151:                                              ; preds = %150
  %152 = load i64, ptr %15, align 8, !tbaa !5
  %153 = add nsw i64 %152, 1
  store i64 %153, ptr %15, align 8, !tbaa !5
  br label %78, !llvm.loop !18

154:                                              ; preds = %87
  %155 = load i8, ptr %14, align 1, !tbaa !12, !range !14, !noundef !15
  %156 = trunc i8 %155 to i1
  %157 = zext i1 %156 to i64
  %158 = select i1 %156, ptr @.str.2, ptr @.str.1
  %159 = invoke i32 @puts(ptr noundef %158)
          to label %160 unwind label %164

160:                                              ; preds = %154
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  store i32 0, ptr %11, align 4
  br label %161

161:                                              ; preds = %160, %56
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  %162 = load i32, ptr %11, align 4
  switch i32 %162, label %181 [
    i32 0, label %163
    i32 5, label %40
  ]

163:                                              ; preds = %161
  br label %40, !llvm.loop !11

164:                                              ; preds = %154
  %165 = landingpad { ptr, i32 }
          cleanup
  %166 = extractvalue { ptr, i32 } %165, 0
  store ptr %166, ptr %5, align 8
  %167 = extractvalue { ptr, i32 } %165, 1
  store i32 %167, ptr %6, align 4
  br label %168

168:                                              ; preds = %164, %142
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #5
  br label %169

169:                                              ; preds = %168, %88
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  br label %170

170:                                              ; preds = %169, %69, %65
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #5
  br label %171

171:                                              ; preds = %170, %61
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %174

172:                                              ; preds = %40
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @_ZNSt3mapIllSt4lessIlESaISt4pairIKllEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr %2) #5
  %173 = load i32, ptr %1, align 4
  ret i32 %173

174:                                              ; preds = %171, %57
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  br label %175

175:                                              ; preds = %174, %33
  call void @_ZNSt3mapIllSt4lessIlESaISt4pairIKllEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr %2) #5
  br label %176

176:                                              ; preds = %175
  %177 = load ptr, ptr %5, align 8
  %178 = load i32, ptr %6, align 4
  %179 = insertvalue { ptr, i32 } poison, ptr %177, 0
  %180 = insertvalue { ptr, i32 } %179, i32 %178, 1
  resume { ptr, i32 } %180

181:                                              ; preds = %161
  unreachable
}

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

; 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 noundef i64 @_ZNKSt3mapIllSt4lessIlESaISt4pairIKllEEE5countERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

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

declare i32 @puts(ptr noundef) #4

; 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 nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3mapIllSt4lessIlESaISt4pairIKllEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #2 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!13, !13, i64 0}
!13 = !{!"bool", !7, i64 0}
!14 = !{i8 0, i8 2}
!15 = !{}
!16 = !{!7, !7, i64 0}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}


; 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::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<long, std::pair<const long, long>, std::_Select1st<std::pair<const long, long>>, std::less<long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<long, std::pair<const long, long>, std::_Select1st<std::pair<const long, long>>, std::less<long>>::_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::__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] }

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::map", align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca %"class.std::__cxx11::basic_string", align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %1) #6
  call void @_ZNSt3mapIllSt4lessIlESaISt4pairIKllEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #6
  br label %12

8:                                                ; preds = %15
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %3)
  %10 = load i64, ptr %3, align 8, !tbaa !5
  %11 = add nsw i64 %10, -1
  store i64 %11, ptr %3, align 8, !tbaa !5
  %.not51 = icmp eq i64 %10, 0
  br i1 %.not51, label %._crit_edge54, label %.lr.ph53

12:                                               ; preds = %0, %15
  %.042 = phi i64 [ 1, %0 ], [ %16, %15 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %13 = mul nuw nsw i64 %.042, %.042
  store i64 %13, ptr %2, align 8, !tbaa !5
  %14 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIllSt4lessIlESaISt4pairIKllEEEixEOl(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
          to label %15 unwind label %17

15:                                               ; preds = %12
  store i64 %.042, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  %16 = add nuw nsw i64 %.042, 1
  %exitcond.not = icmp eq i64 %16, 1001
  br i1 %exitcond.not, label %8, label %12, !llvm.loop !9

17:                                               ; preds = %12
  %18 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  br label %66

.lr.ph53:                                         ; preds = %8, %._crit_edge47.split.thread62
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %4)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #6
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #6
  %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) %5)
          to label %21 unwind label %25

21:                                               ; preds = %.lr.ph53
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  %22 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %5) #6
  store i64 %22, ptr %6, align 8, !tbaa !5
  %23 = invoke noundef i64 @_ZNKSt3mapIllSt4lessIlESaISt4pairIKllEEE5countERS3_(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %6)
          to label %24 unwind label %27

24:                                               ; preds = %21
  %.not37 = icmp eq i64 %23, 0
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  br i1 %.not37, label %._crit_edge47.split.thread62, label %29, !llvm.loop !11

25:                                               ; preds = %.lr.ph53
  %26 = landingpad { ptr, i32 }
          cleanup
  br label %65

27:                                               ; preds = %21
  %28 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  br label %65

29:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %30 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %5) #6
  store i64 %30, ptr %7, align 8, !tbaa !5
  %31 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIllSt4lessIlESaISt4pairIKllEEEixEOl(ptr noundef nonnull align 8 dereferenceable(48) %1, ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %32 unwind label %46

32:                                               ; preds = %29
  %33 = load i64, ptr %31, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  %34 = icmp sgt i64 %33, 0
  br i1 %34, label %.preheader.lr.ph, label %._crit_edge47.split.thread

.preheader.lr.ph:                                 ; preds = %32
  %35 = add nsw i64 %33, -1
  br label %.preheader

.preheader:                                       ; preds = %.preheader.lr.ph, %._crit_edge
  %.03046 = phi i64 [ 0, %.preheader.lr.ph ], [ %48, %._crit_edge ]
  %.03145 = phi i8 [ 1, %.preheader.lr.ph ], [ %.132.lcssa, %._crit_edge ]
  %36 = trunc nuw i8 %.03145 to i1
  br i1 %36, label %.lr.ph, label %._crit_edge47.split.thread62

.lr.ph:                                           ; preds = %.preheader
  %37 = mul nuw nsw i64 %.03046, %33
  %38 = icmp eq i64 %.03046, 0
  %39 = icmp eq i64 %.03046, %35
  br i1 %38, label %.lr.ph.split.us, label %.lr.ph.split

.lr.ph.split.us:                                  ; preds = %.lr.ph, %.lr.ph.split.us
  %.02944.us = phi i64 [ %42, %.lr.ph.split.us ], [ 0, %.lr.ph ]
  %.13243.us = phi i8 [ %spec.select41.us, %.lr.ph.split.us ], [ %.03145, %.lr.ph ]
  %40 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %5, i64 noundef %.02944.us)
  %41 = load i8, ptr %40, align 1, !tbaa !12
  %.not55 = icmp eq i8 %41, 49
  %spec.select41.us = select i1 %.not55, i8 %.13243.us, i8 0
  %42 = add nuw nsw i64 %.02944.us, 1
  %43 = trunc nuw i8 %spec.select41.us to i1
  %44 = icmp slt i64 %42, %33
  %45 = select i1 %43, i1 %44, i1 false
  br i1 %45, label %.lr.ph.split.us, label %._crit_edge, !llvm.loop !13

._crit_edge47.split:                              ; preds = %._crit_edge
  br i1 %cond.fr, label %._crit_edge47.split.thread, label %._crit_edge47.split.thread62

._crit_edge47.split.thread:                       ; preds = %32, %._crit_edge47.split
  br label %._crit_edge47.split.thread62

46:                                               ; preds = %29
  %47 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  br label %65

._crit_edge:                                      ; preds = %.lr.ph.split, %.lr.ph.split.us
  %.pre-phi = phi i1 [ %43, %.lr.ph.split.us ], [ %59, %.lr.ph.split ]
  %.132.lcssa = phi i8 [ %spec.select41.us, %.lr.ph.split.us ], [ %spec.select41, %.lr.ph.split ]
  %cond.fr = freeze i1 %.pre-phi
  %48 = add nuw nsw i64 %.03046, 1
  %49 = icmp slt i64 %48, %33
  %50 = select i1 %cond.fr, i1 %49, i1 false
  br i1 %50, label %.preheader, label %._crit_edge47.split, !llvm.loop !14

.lr.ph.split:                                     ; preds = %.lr.ph, %.lr.ph.split
  %.02944 = phi i64 [ %58, %.lr.ph.split ], [ 0, %.lr.ph ]
  %.13243 = phi i8 [ %spec.select41, %.lr.ph.split ], [ %.03145, %.lr.ph ]
  %51 = add nuw nsw i64 %.02944, %37
  %52 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %5, i64 noundef %51)
  %53 = load i8, ptr %52, align 1, !tbaa !12
  %54 = icmp eq i8 %53, 49
  %55 = icmp eq i64 %.02944, 0
  %or.cond = or i1 %39, %55
  %56 = icmp eq i64 %.02944, %35
  %spec.select = or i1 %or.cond, %56
  %57 = xor i1 %54, %spec.select
  %spec.select41 = select i1 %57, i8 0, i8 %.13243
  %58 = add nuw nsw i64 %.02944, 1
  %59 = trunc nuw i8 %spec.select41 to i1
  %60 = icmp slt i64 %58, %33
  %61 = select i1 %59, i1 %60, i1 false
  br i1 %61, label %.lr.ph.split, label %._crit_edge, !llvm.loop !13

._crit_edge47.split.thread62:                     ; preds = %.preheader, %._crit_edge47.split.thread, %._crit_edge47.split, %24
  %.sink = phi ptr [ @.str.1, %24 ], [ @.str.2, %._crit_edge47.split.thread ], [ @.str.1, %._crit_edge47.split ], [ @.str.1, %.preheader ]
  %62 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.sink)
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  %63 = load i64, ptr %3, align 8, !tbaa !5
  %64 = add nsw i64 %63, -1
  store i64 %64, ptr %3, align 8, !tbaa !5
  %.not = icmp eq i64 %63, 0
  br i1 %.not, label %._crit_edge54, label %.lr.ph53

65:                                               ; preds = %46, %27, %25
  %.pn = phi { ptr, i32 } [ %47, %46 ], [ %28, %27 ], [ %26, %25 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  br label %66

._crit_edge54:                                    ; preds = %._crit_edge47.split.thread62, %8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  call void @_ZNSt3mapIllSt4lessIlESaISt4pairIKllEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %1) #6
  ret i32 0

66:                                               ; preds = %65, %17
  %.pn39 = phi { ptr, i32 } [ %18, %17 ], [ %.pn, %65 ]
  call void @_ZNSt3mapIllSt4lessIlESaISt4pairIKllEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %1) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %1) #6
  resume { ptr, i32 } %.pn39
}

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNKSt3mapIllSt4lessIlESaISt4pairIKllEEE5countERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 2

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

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

; 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 nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3mapIllSt4lessIlESaISt4pairIKllEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #2 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #4 = { 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 #5 = { "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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!7, !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}


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