; LLVM IR from eyangch/competitive-programming :: USACOcontests/silver/2014.03 (mooomoo)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca [105 x i64], align 16
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i64, align 8
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %21 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %22 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %23 = getelementptr i8, ptr %22, i64 -24
  %24 = load i64, ptr %23, align 8
  %25 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %24
  %26 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %25, ptr noundef null)
  %27 = load ptr, ptr @stdin, align 8, !tbaa !8
  %28 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.1, ptr noundef %27)
  %29 = load ptr, ptr @stdout, align 8, !tbaa !8
  %30 = call ptr @freopen(ptr noundef @.str.2, ptr noundef @.str.3, ptr noundef %29)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  %31 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %32 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %31, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %33 = load i32, ptr %3, align 4, !tbaa !11
  %34 = zext i32 %33 to i64
  %35 = call ptr @llvm.stacksave.p0()
  store ptr %35, ptr %4, align 8
  %36 = alloca i32, i64 %34, align 16
  store i64 %34, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #8
  store i32 0, ptr %6, align 4, !tbaa !11
  br label %37

37:                                               ; preds = %47, %0
  %38 = load i32, ptr %6, align 4, !tbaa !11
  %39 = load i32, ptr %3, align 4, !tbaa !11
  %40 = icmp slt i32 %38, %39
  br i1 %40, label %42, label %41

41:                                               ; preds = %37
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  br label %50

42:                                               ; preds = %37
  %43 = load i32, ptr %6, align 4, !tbaa !11
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds i32, ptr %36, i64 %44
  %46 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %45)
  br label %47

47:                                               ; preds = %42
  %48 = load i32, ptr %6, align 4, !tbaa !11
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %6, align 4, !tbaa !11
  br label %37, !llvm.loop !13

50:                                               ; preds = %41
  %51 = load i32, ptr %2, align 4, !tbaa !11
  %52 = zext i32 %51 to i64
  %53 = alloca i32, i64 %52, align 16
  store i64 %52, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  store i32 0, ptr %8, align 4, !tbaa !11
  br label %54

54:                                               ; preds = %64, %50
  %55 = load i32, ptr %8, align 4, !tbaa !11
  %56 = load i32, ptr %2, align 4, !tbaa !11
  %57 = icmp slt i32 %55, %56
  br i1 %57, label %59, label %58

58:                                               ; preds = %54
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  br label %67

59:                                               ; preds = %54
  %60 = load i32, ptr %8, align 4, !tbaa !11
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds i32, ptr %53, i64 %61
  %63 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %62)
  br label %64

64:                                               ; preds = %59
  %65 = load i32, ptr %8, align 4, !tbaa !11
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %8, align 4, !tbaa !11
  br label %54, !llvm.loop !15

67:                                               ; preds = %58
  %68 = load i32, ptr %2, align 4, !tbaa !11
  %69 = zext i32 %68 to i64
  %70 = alloca i32, i64 %69, align 16
  store i64 %69, ptr %9, align 8
  %71 = getelementptr inbounds i32, ptr %53, i64 0
  %72 = load i32, ptr %71, align 16, !tbaa !11
  %73 = getelementptr inbounds i32, ptr %70, i64 0
  store i32 %72, ptr %73, align 16, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  store i32 1, ptr %10, align 4, !tbaa !11
  br label %74

74:                                               ; preds = %96, %67
  %75 = load i32, ptr %10, align 4, !tbaa !11
  %76 = load i32, ptr %2, align 4, !tbaa !11
  %77 = icmp slt i32 %75, %76
  br i1 %77, label %79, label %78

78:                                               ; preds = %74
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  br label %99

79:                                               ; preds = %74
  %80 = load i32, ptr %10, align 4, !tbaa !11
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds i32, ptr %53, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  store i32 0, ptr %11, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  %84 = load i32, ptr %10, align 4, !tbaa !11
  %85 = sub nsw i32 %84, 1
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds i32, ptr %53, i64 %86
  %88 = load i32, ptr %87, align 4, !tbaa !11
  %89 = sub nsw i32 %88, 1
  store i32 %89, ptr %12, align 4, !tbaa !11
  %90 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %12)
  %91 = load i32, ptr %90, align 4, !tbaa !11
  %92 = sub nsw i32 %83, %91
  %93 = load i32, ptr %10, align 4, !tbaa !11
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds i32, ptr %70, i64 %94
  store i32 %92, ptr %95, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  br label %96

96:                                               ; preds = %79
  %97 = load i32, ptr %10, align 4, !tbaa !11
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr %10, align 4, !tbaa !11
  br label %74, !llvm.loop !16

99:                                               ; preds = %78
  call void @llvm.lifetime.start.p0(i64 840, ptr %13) #8
  %100 = getelementptr inbounds [105 x i64], ptr %13, i64 0, i64 0
  %101 = getelementptr inbounds [105 x i64], ptr %13, i64 0, i64 0
  %102 = getelementptr inbounds i64, ptr %101, i64 105
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  store i32 2147483647, ptr %14, align 4, !tbaa !11
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef %100, ptr noundef %102, ptr noundef nonnull align 4 dereferenceable(4) %14)
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  %103 = getelementptr inbounds [105 x i64], ptr %13, i64 0, i64 0
  store i64 0, ptr %103, align 16, !tbaa !17
  %104 = load i32, ptr %2, align 4, !tbaa !11
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds i32, ptr %70, i64 %105
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef %70, ptr noundef %106)
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  store i32 0, ptr %15, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  store i64 0, ptr %16, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #8
  store i32 0, ptr %17, align 4, !tbaa !11
  br label %107

107:                                              ; preds = %184, %99
  %108 = load i32, ptr %17, align 4, !tbaa !11
  %109 = icmp slt i32 %108, 6000000
  br i1 %109, label %111, label %110

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

111:                                              ; preds = %107
  %112 = load i32, ptr %17, align 4, !tbaa !11
  %113 = icmp sgt i32 %112, 0
  br i1 %113, label %114, label %119

114:                                              ; preds = %111
  %115 = load i32, ptr %17, align 4, !tbaa !11
  %116 = srem i32 %115, 105
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [105 x i64], ptr %13, i64 0, i64 %117
  store i64 2147483647, ptr %118, align 8, !tbaa !17
  br label %119

119:                                              ; preds = %114, %111
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #8
  store i32 0, ptr %19, align 4, !tbaa !11
  br label %120

120:                                              ; preds = %156, %119
  %121 = load i32, ptr %19, align 4, !tbaa !11
  %122 = load i32, ptr %3, align 4, !tbaa !11
  %123 = icmp slt i32 %121, %122
  br i1 %123, label %125, label %124

124:                                              ; preds = %120
  store i32 14, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #8
  br label %159

125:                                              ; preds = %120
  %126 = load i32, ptr %17, align 4, !tbaa !11
  %127 = load i32, ptr %19, align 4, !tbaa !11
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds i32, ptr %36, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !11
  %131 = sub nsw i32 %126, %130
  %132 = icmp slt i32 %131, 0
  br i1 %132, label %133, label %134

133:                                              ; preds = %125
  br label %156

134:                                              ; preds = %125
  %135 = load i32, ptr %17, align 4, !tbaa !11
  %136 = srem i32 %135, 105
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [105 x i64], ptr %13, i64 0, i64 %137
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #8
  %139 = load i32, ptr %17, align 4, !tbaa !11
  %140 = load i32, ptr %19, align 4, !tbaa !11
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds i32, ptr %36, i64 %141
  %143 = load i32, ptr %142, align 4, !tbaa !11
  %144 = sub nsw i32 %139, %143
  %145 = srem i32 %144, 105
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [105 x i64], ptr %13, i64 0, i64 %146
  %148 = load i64, ptr %147, align 8, !tbaa !17
  %149 = add nsw i64 %148, 1
  store i64 %149, ptr %20, align 8, !tbaa !17
  %150 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %138, ptr noundef nonnull align 8 dereferenceable(8) %20)
  %151 = load i64, ptr %150, align 8, !tbaa !17
  %152 = load i32, ptr %17, align 4, !tbaa !11
  %153 = srem i32 %152, 105
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [105 x i64], ptr %13, i64 0, i64 %154
  store i64 %151, ptr %155, align 8, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #8
  br label %156

156:                                              ; preds = %134, %133
  %157 = load i32, ptr %19, align 4, !tbaa !11
  %158 = add nsw i32 %157, 1
  store i32 %158, ptr %19, align 4, !tbaa !11
  br label %120, !llvm.loop !19

159:                                              ; preds = %124
  br label %160

160:                                              ; preds = %173, %159
  %161 = load i32, ptr %15, align 4, !tbaa !11
  %162 = load i32, ptr %2, align 4, !tbaa !11
  %163 = icmp slt i32 %161, %162
  br i1 %163, label %164, label %171

164:                                              ; preds = %160
  %165 = load i32, ptr %15, align 4, !tbaa !11
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds i32, ptr %70, i64 %166
  %168 = load i32, ptr %167, align 4, !tbaa !11
  %169 = load i32, ptr %17, align 4, !tbaa !11
  %170 = icmp eq i32 %168, %169
  br label %171

171:                                              ; preds = %164, %160
  %172 = phi i1 [ false, %160 ], [ %170, %164 ]
  br i1 %172, label %173, label %183

173:                                              ; preds = %171
  %174 = load i32, ptr %17, align 4, !tbaa !11
  %175 = srem i32 %174, 105
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds [105 x i64], ptr %13, i64 0, i64 %176
  %178 = load i64, ptr %177, align 8, !tbaa !17
  %179 = load i64, ptr %16, align 8, !tbaa !17
  %180 = add nsw i64 %179, %178
  store i64 %180, ptr %16, align 8, !tbaa !17
  %181 = load i32, ptr %15, align 4, !tbaa !11
  %182 = add nsw i32 %181, 1
  store i32 %182, ptr %15, align 4, !tbaa !11
  br label %160, !llvm.loop !20

183:                                              ; preds = %171
  br label %184

184:                                              ; preds = %183
  %185 = load i32, ptr %17, align 4, !tbaa !11
  %186 = add nsw i32 %185, 1
  store i32 %186, ptr %17, align 4, !tbaa !11
  br label %107, !llvm.loop !21

187:                                              ; preds = %110
  %188 = load i64, ptr %16, align 8, !tbaa !17
  %189 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %188)
  %190 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %189, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 840, ptr %13) #8
  %191 = load ptr, ptr %4, align 8
  call void @llvm.stackrestore.p0(ptr %191)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  %192 = load i32, ptr %1, align 4
  ret i32 %192
}

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

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPiEvT_S1_(ptr noundef, ptr noundef) #6

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #7 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #6

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4

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

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

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


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca [105 x i64], align 16
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %9 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %10 = getelementptr i8, ptr %9, i64 -24
  %11 = load i64, ptr %10, align 8
  %12 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %11
  %13 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %12, ptr noundef null)
  %14 = load ptr, ptr @stdin, align 8, !tbaa !8
  %15 = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef %14)
  %16 = load ptr, ptr @stdout, align 8, !tbaa !8
  %17 = tail call ptr @freopen(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, ptr noundef %16)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  %18 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %18, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %20 = load i32, ptr %2, align 4, !tbaa !11
  %21 = zext i32 %20 to i64
  %22 = call ptr @llvm.stacksave.p0()
  %23 = alloca i32, i64 %21, align 16
  %24 = load i32, ptr %2, align 4, !tbaa !11
  %25 = icmp sgt i32 %24, 0
  br i1 %25, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  %26 = load i32, ptr %1, align 4, !tbaa !11
  %27 = zext i32 %26 to i64
  %28 = alloca i32, i64 %27, align 16
  %29 = icmp sgt i32 %26, 0
  br i1 %29, label %.lr.ph42, label %._crit_edge43.thread

._crit_edge43.thread:                             ; preds = %._crit_edge
  %30 = alloca i32, i64 %27, align 16
  br label %._crit_edge47

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %31 = getelementptr inbounds i32, ptr %23, i64 %indvars.iv
  %32 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %31)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %33 = load i32, ptr %2, align 4, !tbaa !11
  %34 = sext i32 %33 to i64
  %35 = icmp slt i64 %indvars.iv.next, %34
  br i1 %35, label %.lr.ph, label %._crit_edge, !llvm.loop !13

._crit_edge43:                                    ; preds = %.lr.ph42
  %.pre = load i32, ptr %28, align 16, !tbaa !11
  %.pre78 = zext i32 %40 to i64
  %36 = icmp sgt i32 %40, 1
  %37 = alloca i32, i64 %.pre78, align 16
  store i32 %.pre, ptr %37, align 16, !tbaa !11
  br i1 %36, label %.lr.ph46, label %._crit_edge47

.lr.ph42:                                         ; preds = %._crit_edge, %.lr.ph42
  %indvars.iv64 = phi i64 [ %indvars.iv.next65, %.lr.ph42 ], [ 0, %._crit_edge ]
  %38 = getelementptr inbounds i32, ptr %28, i64 %indvars.iv64
  %39 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %38)
  %indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, 1
  %40 = load i32, ptr %1, align 4, !tbaa !11
  %41 = sext i32 %40 to i64
  %42 = icmp slt i64 %indvars.iv.next65, %41
  br i1 %42, label %.lr.ph42, label %._crit_edge43, !llvm.loop !15

._crit_edge47:                                    ; preds = %.lr.ph46, %._crit_edge43.thread, %._crit_edge43
  %43 = phi ptr [ %30, %._crit_edge43.thread ], [ %37, %._crit_edge43 ], [ %37, %.lr.ph46 ]
  call void @llvm.lifetime.start.p0(i64 840, ptr nonnull %5) #8
  %44 = getelementptr inbounds i8, ptr %5, i64 840
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #8
  store i32 2147483647, ptr %6, align 4, !tbaa !11
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef nonnull %5, ptr noundef nonnull %44, ptr noundef nonnull align 4 dereferenceable(4) %6)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #8
  store i64 0, ptr %5, align 16, !tbaa !16
  %45 = load i32, ptr %1, align 4, !tbaa !11
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds i32, ptr %43, i64 %46
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull %43, ptr noundef nonnull %47)
  br label %63

.lr.ph46:                                         ; preds = %._crit_edge43, %.lr.ph46
  %indvars.iv67 = phi i64 [ %indvars.iv.next68, %.lr.ph46 ], [ 1, %._crit_edge43 ]
  %48 = getelementptr inbounds i32, ptr %28, i64 %indvars.iv67
  %49 = load i32, ptr %48, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #8
  store i32 0, ptr %3, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #8
  %50 = getelementptr i8, ptr %48, i64 -4
  %51 = load i32, ptr %50, align 4, !tbaa !11
  %52 = add nsw i32 %51, -1
  store i32 %52, ptr %4, align 4, !tbaa !11
  %53 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %54 = load i32, ptr %53, align 4, !tbaa !11
  %55 = sub nsw i32 %49, %54
  %56 = getelementptr inbounds i32, ptr %37, i64 %indvars.iv67
  store i32 %55, ptr %56, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %57 = load i32, ptr %1, align 4, !tbaa !11
  %58 = sext i32 %57 to i64
  %59 = icmp slt i64 %indvars.iv.next68, %58
  br i1 %59, label %.lr.ph46, label %._crit_edge47, !llvm.loop !18

60:                                               ; preds = %.critedge
  %61 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.1.lcssa)
  %62 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %61, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 840, ptr nonnull %5) #8
  call void @llvm.stackrestore.p0(ptr %22)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  ret i32 0

63:                                               ; preds = %._crit_edge47, %.critedge
  %.03161 = phi i32 [ 0, %._crit_edge47 ], [ %107, %.critedge ]
  %.03260 = phi i64 [ 0, %._crit_edge47 ], [ %.1.lcssa, %.critedge ]
  %.03359 = phi i32 [ 0, %._crit_edge47 ], [ %.134.lcssa, %.critedge ]
  %.not = icmp eq i32 %.03161, 0
  br i1 %.not, label %68, label %64

64:                                               ; preds = %63
  %65 = urem i32 %.03161, 105
  %66 = zext nneg i32 %65 to i64
  %67 = getelementptr inbounds [105 x i64], ptr %5, i64 0, i64 %66
  store i64 2147483647, ptr %67, align 8, !tbaa !16
  br label %68

68:                                               ; preds = %64, %63
  %69 = load i32, ptr %2, align 4, !tbaa !11
  %70 = icmp sgt i32 %69, 0
  br i1 %70, label %.lr.ph50, label %.preheader

.lr.ph50:                                         ; preds = %68
  %71 = urem i32 %.03161, 105
  %72 = zext nneg i32 %71 to i64
  %73 = getelementptr inbounds [105 x i64], ptr %5, i64 0, i64 %72
  br label %81

.preheader:                                       ; preds = %95, %68
  %74 = load i32, ptr %1, align 4, !tbaa !11
  %75 = icmp slt i32 %.03359, %74
  br i1 %75, label %.lr.ph53, label %.critedge

.lr.ph53:                                         ; preds = %.preheader
  %76 = urem i32 %.03161, 105
  %77 = zext nneg i32 %76 to i64
  %78 = getelementptr inbounds [105 x i64], ptr %5, i64 0, i64 %77
  %79 = sext i32 %.03359 to i64
  %80 = sext i32 %74 to i64
  br label %99

81:                                               ; preds = %.lr.ph50, %95
  %82 = phi i32 [ %69, %.lr.ph50 ], [ %96, %95 ]
  %indvars.iv70 = phi i64 [ 0, %.lr.ph50 ], [ %indvars.iv.next71, %95 ]
  %83 = getelementptr inbounds i32, ptr %23, i64 %indvars.iv70
  %84 = load i32, ptr %83, align 4, !tbaa !11
  %85 = icmp slt i32 %.03161, %84
  br i1 %85, label %95, label %86

86:                                               ; preds = %81
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  %87 = sub nsw i32 %.03161, %84
  %88 = srem i32 %87, 105
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [105 x i64], ptr %5, i64 0, i64 %89
  %91 = load i64, ptr %90, align 8, !tbaa !16
  %92 = add nsw i64 %91, 1
  store i64 %92, ptr %7, align 8, !tbaa !16
  %93 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %73, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %94 = load i64, ptr %93, align 8, !tbaa !16
  store i64 %94, ptr %73, align 8, !tbaa !16
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  %.pre77 = load i32, ptr %2, align 4, !tbaa !11
  br label %95

95:                                               ; preds = %81, %86
  %96 = phi i32 [ %82, %81 ], [ %.pre77, %86 ]
  %indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
  %97 = sext i32 %96 to i64
  %98 = icmp slt i64 %indvars.iv.next71, %97
  br i1 %98, label %81, label %.preheader, !llvm.loop !19

99:                                               ; preds = %.lr.ph53, %103
  %indvars.iv73 = phi i64 [ %79, %.lr.ph53 ], [ %indvars.iv.next74, %103 ]
  %.152 = phi i64 [ %.03260, %.lr.ph53 ], [ %105, %103 ]
  %100 = getelementptr inbounds i32, ptr %43, i64 %indvars.iv73
  %101 = load i32, ptr %100, align 4, !tbaa !11
  %102 = icmp eq i32 %101, %.03161
  br i1 %102, label %103, label %.critedge.loopexit.split.loop.exit

103:                                              ; preds = %99
  %104 = load i64, ptr %78, align 8, !tbaa !16
  %105 = add nsw i64 %104, %.152
  %indvars.iv.next74 = add nsw i64 %indvars.iv73, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next74, %80
  br i1 %exitcond.not, label %.critedge, label %99, !llvm.loop !20

.critedge.loopexit.split.loop.exit:               ; preds = %99
  %106 = trunc nsw i64 %indvars.iv73 to i32
  br label %.critedge

.critedge:                                        ; preds = %103, %.critedge.loopexit.split.loop.exit, %.preheader
  %.134.lcssa = phi i32 [ %.03359, %.preheader ], [ %106, %.critedge.loopexit.split.loop.exit ], [ %74, %103 ]
  %.1.lcssa = phi i64 [ %.03260, %.preheader ], [ %.152, %.critedge.loopexit.split.loop.exit ], [ %105, %103 ]
  %107 = add nuw nsw i32 %.03161, 1
  %exitcond76.not = icmp eq i32 %107, 6000000
  br i1 %exitcond76.not, label %60, label %63, !llvm.loop !21
}

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

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

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

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPiEvT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #6

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #6

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4

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

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

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


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