; LLVM IR from viveakrt/Competitive-programing :: Codeforces (pawns_revenge)

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5validii(i32 noundef, i32 noundef) #0

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

33:                                               ; preds = %71, %0
  %34 = load i32, ptr %7, align 4, !tbaa !8
  %35 = load i32, ptr @n, align 4, !tbaa !8
  %36 = icmp slt i32 %34, %35
  br i1 %36, label %38, label %37

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

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

39:                                               ; preds = %67, %38
  %40 = load i32, ptr %9, align 4, !tbaa !8
  %41 = load i32, ptr @n, align 4, !tbaa !8
  %42 = icmp slt i32 %40, %41
  br i1 %42, label %44, label %43

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

44:                                               ; preds = %39
  %45 = load i32, ptr %7, align 4, !tbaa !8
  %46 = sext i32 %45 to i64
  %47 = mul nsw i64 %46, %29
  %48 = getelementptr inbounds i8, ptr %32, i64 %47
  %49 = load i32, ptr %9, align 4, !tbaa !8
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds i8, ptr %48, i64 %50
  %52 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 1 dereferenceable(1) %51)
  %53 = load i32, ptr %7, align 4, !tbaa !8
  %54 = sext i32 %53 to i64
  %55 = mul nsw i64 %54, %29
  %56 = getelementptr inbounds i8, ptr %32, i64 %55
  %57 = load i32, ptr %9, align 4, !tbaa !8
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds i8, ptr %56, i64 %58
  %60 = load i8, ptr %59, align 1, !tbaa !11
  %61 = sext i8 %60 to i32
  %62 = icmp eq i32 %61, 75
  br i1 %62, label %63, label %66

63:                                               ; preds = %44
  %64 = load i32, ptr %7, align 4, !tbaa !8
  store i32 %64, ptr %5, align 4, !tbaa !8
  %65 = load i32, ptr %9, align 4, !tbaa !8
  store i32 %65, ptr %6, align 4, !tbaa !8
  br label %66

66:                                               ; preds = %63, %44
  br label %67

67:                                               ; preds = %66
  %68 = load i32, ptr %9, align 4, !tbaa !8
  %69 = add nsw i32 %68, 1
  store i32 %69, ptr %9, align 4, !tbaa !8
  br label %39, !llvm.loop !12

70:                                               ; preds = %43
  br label %71

71:                                               ; preds = %70
  %72 = load i32, ptr %7, align 4, !tbaa !8
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr %7, align 4, !tbaa !8
  br label %33, !llvm.loop !14

74:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  store i64 0, ptr %10, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #8
  store i8 0, ptr %11, align 1, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  store i32 0, ptr %12, align 4, !tbaa !8
  br label %75

75:                                               ; preds = %223, %74
  %76 = load i32, ptr %12, align 4, !tbaa !8
  %77 = load i32, ptr @n, align 4, !tbaa !8
  %78 = icmp slt i32 %76, %77
  br i1 %78, label %80, label %79

79:                                               ; preds = %75
  store i32 8, ptr %8, align 4
  br label %226

80:                                               ; preds = %75
  %81 = load i8, ptr %11, align 1, !tbaa !17, !range !19, !noundef !20
  %82 = trunc i8 %81 to i1
  br i1 %82, label %83, label %84

83:                                               ; preds = %80
  store i32 8, ptr %8, align 4
  br label %226

84:                                               ; preds = %80
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  store i32 0, ptr %13, align 4, !tbaa !8
  br label %85

85:                                               ; preds = %218, %84
  %86 = load i32, ptr %13, align 4, !tbaa !8
  %87 = load i32, ptr @n, align 4, !tbaa !8
  %88 = icmp slt i32 %86, %87
  br i1 %88, label %90, label %89

89:                                               ; preds = %85
  store i32 11, ptr %8, align 4
  br label %221

90:                                               ; preds = %85
  %91 = load i32, ptr %12, align 4, !tbaa !8
  %92 = sext i32 %91 to i64
  %93 = mul nsw i64 %92, %29
  %94 = getelementptr inbounds i8, ptr %32, i64 %93
  %95 = load i32, ptr %13, align 4, !tbaa !8
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds i8, ptr %94, i64 %96
  %98 = load i8, ptr %97, align 1, !tbaa !11
  %99 = sext i8 %98 to i32
  %100 = icmp eq i32 %99, 42
  br i1 %100, label %101, label %217

101:                                              ; preds = %90
  %102 = load i32, ptr %5, align 4, !tbaa !8
  %103 = load i32, ptr %12, align 4, !tbaa !8
  %104 = sub nsw i32 %102, %103
  %105 = call i32 @llvm.abs.i32(i32 %104, i1 true)
  %106 = icmp sle i32 %105, 1
  br i1 %106, label %107, label %121

107:                                              ; preds = %101
  %108 = load i32, ptr %6, align 4, !tbaa !8
  %109 = load i32, ptr %13, align 4, !tbaa !8
  %110 = sub nsw i32 %108, %109
  %111 = call i32 @llvm.abs.i32(i32 %110, i1 true)
  %112 = icmp sle i32 %111, 1
  br i1 %112, label %113, label %121

113:                                              ; preds = %107
  %114 = load i32, ptr %12, align 4, !tbaa !8
  %115 = sext i32 %114 to i64
  %116 = mul nsw i64 %115, %29
  %117 = getelementptr inbounds i8, ptr %32, i64 %116
  %118 = load i32, ptr %13, align 4, !tbaa !8
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds i8, ptr %117, i64 %119
  store i8 45, ptr %120, align 1, !tbaa !11
  br label %218

121:                                              ; preds = %107, %101
  %122 = load i32, ptr %12, align 4, !tbaa !8
  %123 = load i32, ptr %13, align 4, !tbaa !8
  %124 = add nsw i32 %123, 2
  %125 = call noundef zeroext i1 @_Z5validii(i32 noundef %122, i32 noundef %124)
  br i1 %125, label %126, label %169

126:                                              ; preds = %121
  %127 = load i32, ptr %12, align 4, !tbaa !8
  %128 = sext i32 %127 to i64
  %129 = mul nsw i64 %128, %29
  %130 = getelementptr inbounds i8, ptr %32, i64 %129
  %131 = load i32, ptr %13, align 4, !tbaa !8
  %132 = add nsw i32 %131, 2
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds i8, ptr %130, i64 %133
  %135 = load i8, ptr %134, align 1, !tbaa !11
  %136 = sext i8 %135 to i32
  %137 = icmp eq i32 %136, 42
  br i1 %137, label %138, label %169

138:                                              ; preds = %126
  %139 = load i32, ptr %12, align 4, !tbaa !8
  %140 = add nsw i32 %139, 1
  %141 = sext i32 %140 to i64
  %142 = mul nsw i64 %141, %29
  %143 = getelementptr inbounds i8, ptr %32, i64 %142
  %144 = load i32, ptr %13, align 4, !tbaa !8
  %145 = add nsw i32 %144, 1
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds i8, ptr %143, i64 %146
  %148 = load i8, ptr %147, align 1, !tbaa !11
  %149 = sext i8 %148 to i32
  %150 = icmp eq i32 %149, 45
  br i1 %150, label %151, label %169

151:                                              ; preds = %138
  %152 = load i64, ptr %10, align 8, !tbaa !15
  %153 = add nsw i64 %152, 1
  store i64 %153, ptr %10, align 8, !tbaa !15
  %154 = load i32, ptr %12, align 4, !tbaa !8
  %155 = sext i32 %154 to i64
  %156 = mul nsw i64 %155, %29
  %157 = getelementptr inbounds i8, ptr %32, i64 %156
  %158 = load i32, ptr %13, align 4, !tbaa !8
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds i8, ptr %157, i64 %159
  store i8 45, ptr %160, align 1, !tbaa !11
  %161 = load i32, ptr %12, align 4, !tbaa !8
  %162 = sext i32 %161 to i64
  %163 = mul nsw i64 %162, %29
  %164 = getelementptr inbounds i8, ptr %32, i64 %163
  %165 = load i32, ptr %13, align 4, !tbaa !8
  %166 = add nsw i32 %165, 2
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds i8, ptr %164, i64 %167
  store i8 45, ptr %168, align 1, !tbaa !11
  br label %216

169:                                              ; preds = %138, %126, %121
  %170 = load i32, ptr %12, align 4, !tbaa !8
  %171 = add nsw i32 %170, 1
  %172 = load i32, ptr %13, align 4, !tbaa !8
  %173 = sub nsw i32 %172, 1
  %174 = call noundef zeroext i1 @_Z5validii(i32 noundef %171, i32 noundef %173)
  br i1 %174, label %175, label %191

175:                                              ; preds = %169
  %176 = load i32, ptr %12, align 4, !tbaa !8
  %177 = add nsw i32 %176, 1
  %178 = sext i32 %177 to i64
  %179 = mul nsw i64 %178, %29
  %180 = getelementptr inbounds i8, ptr %32, i64 %179
  %181 = load i32, ptr %13, align 4, !tbaa !8
  %182 = sub nsw i32 %181, 1
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds i8, ptr %180, i64 %183
  %185 = load i8, ptr %184, align 1, !tbaa !11
  %186 = sext i8 %185 to i32
  %187 = icmp eq i32 %186, 45
  br i1 %187, label %188, label %191

188:                                              ; preds = %175
  %189 = load i64, ptr %10, align 8, !tbaa !15
  %190 = add nsw i64 %189, 1
  store i64 %190, ptr %10, align 8, !tbaa !15
  br label %215

191:                                              ; preds = %175, %169
  %192 = load i32, ptr %12, align 4, !tbaa !8
  %193 = add nsw i32 %192, 1
  %194 = load i32, ptr %13, align 4, !tbaa !8
  %195 = add nsw i32 %194, 1
  %196 = call noundef zeroext i1 @_Z5validii(i32 noundef %193, i32 noundef %195)
  br i1 %196, label %197, label %213

197:                                              ; preds = %191
  %198 = load i32, ptr %12, align 4, !tbaa !8
  %199 = add nsw i32 %198, 1
  %200 = sext i32 %199 to i64
  %201 = mul nsw i64 %200, %29
  %202 = getelementptr inbounds i8, ptr %32, i64 %201
  %203 = load i32, ptr %13, align 4, !tbaa !8
  %204 = add nsw i32 %203, 1
  %205 = sext i32 %204 to i64
  %206 = getelementptr inbounds i8, ptr %202, i64 %205
  %207 = load i8, ptr %206, align 1, !tbaa !11
  %208 = sext i8 %207 to i32
  %209 = icmp eq i32 %208, 45
  br i1 %209, label %210, label %213

210:                                              ; preds = %197
  %211 = load i64, ptr %10, align 8, !tbaa !15
  %212 = add nsw i64 %211, 1
  store i64 %212, ptr %10, align 8, !tbaa !15
  br label %214

213:                                              ; preds = %197, %191
  store i8 1, ptr %11, align 1, !tbaa !17
  store i32 11, ptr %8, align 4
  br label %221

214:                                              ; preds = %210
  br label %215

215:                                              ; preds = %214, %188
  br label %216

216:                                              ; preds = %215, %151
  br label %217

217:                                              ; preds = %216, %90
  br label %218

218:                                              ; preds = %217, %113
  %219 = load i32, ptr %13, align 4, !tbaa !8
  %220 = add nsw i32 %219, 1
  store i32 %220, ptr %13, align 4, !tbaa !8
  br label %85, !llvm.loop !21

221:                                              ; preds = %213, %89
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  br label %222

222:                                              ; preds = %221
  br label %223

223:                                              ; preds = %222
  %224 = load i32, ptr %12, align 4, !tbaa !8
  %225 = add nsw i32 %224, 1
  store i32 %225, ptr %12, align 4, !tbaa !8
  br label %75, !llvm.loop !22

226:                                              ; preds = %83, %79
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  br label %227

227:                                              ; preds = %226
  %228 = load i8, ptr %11, align 1, !tbaa !17, !range !19, !noundef !20
  %229 = trunc i8 %228 to i1
  br i1 %229, label %230, label %232

230:                                              ; preds = %227
  %231 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  br label %236

232:                                              ; preds = %227
  %233 = load i64, ptr %10, align 8, !tbaa !15
  %234 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %233)
  %235 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %234, i8 noundef signext 10)
  br label %236

236:                                              ; preds = %232, %230
  store i32 0, ptr %1, align 4
  store i32 1, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  %237 = load ptr, ptr %2, align 8
  call void @llvm.stackrestore.p0(ptr %237)
  %238 = load i32, ptr %1, align 4
  ret i32 %238
}

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

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

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

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 1 dereferenceable(1)) #2

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #5

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) #6

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

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

attributes #0 = { 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 #1 = { 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 #2 = { "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 }
attributes #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!10, !10, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = !{!16, !16, i64 0}
!16 = !{!"long", !10, i64 0}
!17 = !{!18, !18, i64 0}
!18 = !{!"bool", !10, i64 0}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = distinct !{!21, !13}
!22 = distinct !{!22, !13}


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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z5validii(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %2 = getelementptr i8, ptr %1, i64 -24
  %3 = load i64, ptr %2, align 8
  %4 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %3
  %5 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %4, ptr noundef null)
  %6 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %7 = getelementptr i8, ptr %6, i64 -24
  %8 = load i64, ptr %7, align 8
  %9 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %8
  %10 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %9, ptr noundef null)
  %11 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %12 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %13 = load i32, ptr @n, align 4, !tbaa !8
  %14 = zext i32 %13 to i64
  %15 = mul nuw i64 %14, %14
  %16 = alloca i8, i64 %15, align 16
  %17 = icmp sgt i32 %13, 0
  br i1 %17, label %.preheader61, label %._crit_edge97.thread

.preheader61:                                     ; preds = %0, %._crit_edge
  %18 = phi i32 [ %24, %._crit_edge ], [ %13, %0 ]
  %indvars.iv109 = phi i64 [ %indvars.iv.next110, %._crit_edge ], [ 0, %0 ]
  %.05367 = phi i32 [ %.154.lcssa, %._crit_edge ], [ -10, %0 ]
  %.05666 = phi i32 [ %.157.lcssa, %._crit_edge ], [ -10, %0 ]
  %19 = icmp sgt i32 %18, 0
  br i1 %19, label %.lr.ph, label %.preheader61.._crit_edge_crit_edge

.preheader61.._crit_edge_crit_edge:               ; preds = %.preheader61
  %.pre = sext i32 %18 to i64
  br label %._crit_edge

.lr.ph:                                           ; preds = %.preheader61
  %20 = mul nuw nsw i64 %indvars.iv109, %14
  %21 = getelementptr inbounds i8, ptr %16, i64 %20
  %22 = trunc nuw nsw i64 %indvars.iv109 to i32
  br label %26

.preheader60:                                     ; preds = %._crit_edge
  %invariant.gep90 = getelementptr inbounds i8, ptr %16, i64 1
  %23 = icmp sgt i32 %24, 0
  br i1 %23, label %.lr.ph96, label %._crit_edge97.thread

._crit_edge:                                      ; preds = %26, %.preheader61.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.preheader61.._crit_edge_crit_edge ], [ %33, %26 ]
  %24 = phi i32 [ %18, %.preheader61.._crit_edge_crit_edge ], [ %32, %26 ]
  %.157.lcssa = phi i32 [ %.05666, %.preheader61.._crit_edge_crit_edge ], [ %spec.select, %26 ]
  %.154.lcssa = phi i32 [ %.05367, %.preheader61.._crit_edge_crit_edge ], [ %spec.select59, %26 ]
  %indvars.iv.next110 = add nuw nsw i64 %indvars.iv109, 1
  %25 = icmp slt i64 %indvars.iv.next110, %.pre-phi
  br i1 %25, label %.preheader61, label %.preheader60, !llvm.loop !11

26:                                               ; preds = %.lr.ph, %26
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %26 ]
  %.15463 = phi i32 [ %.05367, %.lr.ph ], [ %spec.select59, %26 ]
  %.15762 = phi i32 [ %.05666, %.lr.ph ], [ %spec.select, %26 ]
  %27 = getelementptr inbounds i8, ptr %21, i64 %indvars.iv
  %28 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 1 dereferenceable(1) %27)
  %29 = load i8, ptr %27, align 1, !tbaa !14
  %30 = icmp eq i8 %29, 75
  %spec.select = select i1 %30, i32 %22, i32 %.15762
  %31 = trunc nuw nsw i64 %indvars.iv to i32
  %spec.select59 = select i1 %30, i32 %31, i32 %.15463
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %32 = load i32, ptr @n, align 4, !tbaa !8
  %33 = sext i32 %32 to i64
  %34 = icmp slt i64 %indvars.iv.next, %33
  br i1 %34, label %26, label %._crit_edge, !llvm.loop !15

.lr.ph96:                                         ; preds = %.preheader60, %._crit_edge75
  %35 = phi i32 [ %134, %._crit_edge75 ], [ %24, %.preheader60 ]
  %indvars.iv118 = phi i64 [ %indvars.iv.next119, %._crit_edge75 ], [ 0, %.preheader60 ]
  %.04893 = phi i8 [ %.1, %._crit_edge75 ], [ 0, %.preheader60 ]
  %.04992 = phi i64 [ %.150.lcssa, %._crit_edge75 ], [ 0, %.preheader60 ]
  %36 = trunc nuw i8 %.04893 to i1
  br i1 %36, label %._crit_edge97, label %.preheader

.preheader:                                       ; preds = %.lr.ph96
  %indvars.iv.next119 = add nuw nsw i64 %indvars.iv118, 1
  %37 = mul nuw nsw i64 %indvars.iv.next119, %14
  %38 = getelementptr inbounds i8, ptr %16, i64 %37
  %39 = icmp sgt i32 %35, 0
  br i1 %39, label %.lr.ph74, label %._crit_edge75

.lr.ph74:                                         ; preds = %.preheader
  %40 = mul nuw nsw i64 %indvars.iv118, %14
  %41 = getelementptr inbounds i8, ptr %16, i64 %40
  %42 = trunc i64 %indvars.iv118 to i32
  %43 = sub i32 %.157.lcssa, %42
  %44 = call i32 @llvm.abs.i32(i32 %43, i1 true)
  %.fr103 = freeze i32 %44
  %45 = icmp ult i32 %.fr103, 2
  %gep91 = getelementptr inbounds i8, ptr %invariant.gep90, i64 %37
  %46 = trunc nuw nsw i64 %indvars.iv118 to i32
  %47 = trunc nuw nsw i64 %indvars.iv.next119 to i32
  br i1 %45, label %.lr.ph74.split.us, label %.lr.ph74.split

.lr.ph74.split.us:                                ; preds = %.lr.ph74, %90
  %indvars.iv115 = phi i64 [ %indvars.iv.next116, %90 ], [ 0, %.lr.ph74 ]
  %.15072.us = phi i64 [ %.2.us, %90 ], [ %.04992, %.lr.ph74 ]
  %48 = getelementptr inbounds i8, ptr %41, i64 %indvars.iv115
  %49 = load i8, ptr %48, align 1, !tbaa !14
  %50 = icmp eq i8 %49, 42
  br i1 %50, label %51, label %90

51:                                               ; preds = %.lr.ph74.split.us
  %52 = trunc i64 %indvars.iv115 to i32
  %53 = sub i32 %.154.lcssa, %52
  %54 = call i32 @llvm.abs.i32(i32 %53, i1 true)
  %55 = icmp ult i32 %54, 2
  br i1 %55, label %89, label %56

56:                                               ; preds = %51
  %57 = add nuw nsw i64 %indvars.iv115, 2
  %58 = trunc nsw i64 %57 to i32
  %59 = call noundef zeroext i1 @_Z5validii(i32 noundef %46, i32 noundef %58)
  br i1 %59, label %60, label %67

60:                                               ; preds = %56
  %61 = getelementptr inbounds i8, ptr %41, i64 %57
  %62 = load i8, ptr %61, align 1, !tbaa !14
  %63 = icmp eq i8 %62, 42
  br i1 %63, label %64, label %67

64:                                               ; preds = %60
  %gep.us = getelementptr inbounds i8, ptr %gep91, i64 %indvars.iv115
  %65 = load i8, ptr %gep.us, align 1, !tbaa !14
  %66 = icmp eq i8 %65, 45
  br i1 %66, label %87, label %67

67:                                               ; preds = %64, %60, %56
  %68 = add nsw i64 %indvars.iv115, -1
  %69 = trunc nsw i64 %68 to i32
  %70 = call noundef zeroext i1 @_Z5validii(i32 noundef %47, i32 noundef %69)
  br i1 %70, label %71, label %75

71:                                               ; preds = %67
  %72 = getelementptr inbounds i8, ptr %38, i64 %68
  %73 = load i8, ptr %72, align 1, !tbaa !14
  %74 = icmp eq i8 %73, 45
  br i1 %74, label %85, label %75

75:                                               ; preds = %71, %67
  %76 = add nuw nsw i64 %indvars.iv115, 1
  %77 = trunc nuw nsw i64 %76 to i32
  %78 = call noundef zeroext i1 @_Z5validii(i32 noundef %47, i32 noundef %77)
  br i1 %78, label %79, label %._crit_edge75

79:                                               ; preds = %75
  %80 = getelementptr inbounds i8, ptr %38, i64 %76
  %81 = load i8, ptr %80, align 1, !tbaa !14
  %82 = icmp eq i8 %81, 45
  br i1 %82, label %83, label %._crit_edge75

83:                                               ; preds = %79
  %84 = add nsw i64 %.15072.us, 1
  br label %90

85:                                               ; preds = %71
  %86 = add nsw i64 %.15072.us, 1
  br label %90

87:                                               ; preds = %64
  %88 = add nsw i64 %.15072.us, 1
  store i8 45, ptr %48, align 1, !tbaa !14
  store i8 45, ptr %61, align 1, !tbaa !14
  br label %90

89:                                               ; preds = %51
  store i8 45, ptr %48, align 1, !tbaa !14
  br label %90

90:                                               ; preds = %89, %87, %85, %83, %.lr.ph74.split.us
  %.2.us = phi i64 [ %.15072.us, %89 ], [ %88, %87 ], [ %86, %85 ], [ %84, %83 ], [ %.15072.us, %.lr.ph74.split.us ]
  %indvars.iv.next116 = add nuw nsw i64 %indvars.iv115, 1
  %91 = load i32, ptr @n, align 4, !tbaa !8
  %92 = sext i32 %91 to i64
  %93 = icmp slt i64 %indvars.iv.next116, %92
  br i1 %93, label %.lr.ph74.split.us, label %._crit_edge75, !llvm.loop !16

.lr.ph74.split:                                   ; preds = %.lr.ph74, %130
  %indvars.iv112 = phi i64 [ %indvars.iv.next113, %130 ], [ 0, %.lr.ph74 ]
  %.15072 = phi i64 [ %.2, %130 ], [ %.04992, %.lr.ph74 ]
  %94 = getelementptr inbounds i8, ptr %41, i64 %indvars.iv112
  %95 = load i8, ptr %94, align 1, !tbaa !14
  %96 = icmp eq i8 %95, 42
  br i1 %96, label %97, label %130

97:                                               ; preds = %.lr.ph74.split
  %98 = add nuw nsw i64 %indvars.iv112, 2
  %99 = trunc nsw i64 %98 to i32
  %100 = call noundef zeroext i1 @_Z5validii(i32 noundef %46, i32 noundef %99)
  br i1 %100, label %101, label %110

101:                                              ; preds = %97
  %102 = getelementptr inbounds i8, ptr %41, i64 %98
  %103 = load i8, ptr %102, align 1, !tbaa !14
  %104 = icmp eq i8 %103, 42
  br i1 %104, label %105, label %110

105:                                              ; preds = %101
  %gep = getelementptr inbounds i8, ptr %gep91, i64 %indvars.iv112
  %106 = load i8, ptr %gep, align 1, !tbaa !14
  %107 = icmp eq i8 %106, 45
  br i1 %107, label %108, label %110

108:                                              ; preds = %105
  %109 = add nsw i64 %.15072, 1
  store i8 45, ptr %94, align 1, !tbaa !14
  store i8 45, ptr %102, align 1, !tbaa !14
  br label %130

110:                                              ; preds = %105, %101, %97
  %111 = add nsw i64 %indvars.iv112, -1
  %112 = trunc nsw i64 %111 to i32
  %113 = call noundef zeroext i1 @_Z5validii(i32 noundef %47, i32 noundef %112)
  br i1 %113, label %114, label %120

114:                                              ; preds = %110
  %115 = getelementptr inbounds i8, ptr %38, i64 %111
  %116 = load i8, ptr %115, align 1, !tbaa !14
  %117 = icmp eq i8 %116, 45
  br i1 %117, label %118, label %120

118:                                              ; preds = %114
  %119 = add nsw i64 %.15072, 1
  br label %130

120:                                              ; preds = %114, %110
  %121 = add nuw nsw i64 %indvars.iv112, 1
  %122 = trunc nuw nsw i64 %121 to i32
  %123 = call noundef zeroext i1 @_Z5validii(i32 noundef %47, i32 noundef %122)
  br i1 %123, label %124, label %._crit_edge75

124:                                              ; preds = %120
  %125 = getelementptr inbounds i8, ptr %38, i64 %121
  %126 = load i8, ptr %125, align 1, !tbaa !14
  %127 = icmp eq i8 %126, 45
  br i1 %127, label %128, label %._crit_edge75

128:                                              ; preds = %124
  %129 = add nsw i64 %.15072, 1
  br label %130

130:                                              ; preds = %.lr.ph74.split, %118, %128, %108
  %.2 = phi i64 [ %109, %108 ], [ %119, %118 ], [ %129, %128 ], [ %.15072, %.lr.ph74.split ]
  %indvars.iv.next113 = add nuw nsw i64 %indvars.iv112, 1
  %131 = load i32, ptr @n, align 4, !tbaa !8
  %132 = sext i32 %131 to i64
  %133 = icmp slt i64 %indvars.iv.next113, %132
  br i1 %133, label %.lr.ph74.split, label %._crit_edge75, !llvm.loop !16

._crit_edge75:                                    ; preds = %130, %124, %120, %90, %79, %75, %.preheader
  %.150.lcssa = phi i64 [ %.04992, %.preheader ], [ %.15072.us, %75 ], [ %.15072.us, %79 ], [ %.2.us, %90 ], [ %.15072, %120 ], [ %.15072, %124 ], [ %.2, %130 ]
  %.1 = phi i8 [ %.04893, %.preheader ], [ 1, %75 ], [ 1, %79 ], [ %.04893, %90 ], [ 1, %120 ], [ 1, %124 ], [ %.04893, %130 ]
  %134 = load i32, ptr @n, align 4, !tbaa !8
  %135 = sext i32 %134 to i64
  %136 = icmp slt i64 %indvars.iv.next119, %135
  br i1 %136, label %.lr.ph96, label %._crit_edge97, !llvm.loop !17

._crit_edge97:                                    ; preds = %._crit_edge75, %.lr.ph96
  %.049.lcssa.ph = phi i64 [ %.150.lcssa, %._crit_edge75 ], [ %.04992, %.lr.ph96 ]
  %.048.lcssa.ph = phi i8 [ %.1, %._crit_edge75 ], [ %.04893, %.lr.ph96 ]
  %137 = trunc nuw i8 %.048.lcssa.ph to i1
  br i1 %137, label %138, label %._crit_edge97.thread

138:                                              ; preds = %._crit_edge97
  %139 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str)
  br label %142

._crit_edge97.thread:                             ; preds = %0, %.preheader60, %._crit_edge97
  %.049.lcssa125 = phi i64 [ %.049.lcssa.ph, %._crit_edge97 ], [ 0, %.preheader60 ], [ 0, %0 ]
  %140 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.049.lcssa125)
  %141 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %140, i8 noundef signext 10)
  br label %142

142:                                              ; preds = %._crit_edge97.thread, %138
  ret i32 0
}

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

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #3

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

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

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

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

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


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