; LLVM IR from tangjz/acm-icpc :: lydsy (1002)

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

%struct.node = type { [1000 x i32], i32 }
%"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" }

@f = external dso_local global [101 x %struct.node], align 16
@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

; 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
  store i32 0, ptr %1, align 4
  %4 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  %5 = 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)
  store i32 1, ptr getelementptr inbounds (%struct.node, ptr getelementptr inbounds ([101 x %struct.node], ptr @f, i64 0, i64 2), i32 0, i32 1), align 8, !tbaa !5
  store i32 1, ptr getelementptr inbounds (%struct.node, ptr getelementptr inbounds ([101 x %struct.node], ptr @f, i64 0, i64 1), i32 0, i32 1), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds ([101 x %struct.node], ptr @f, i64 0, i64 1), align 4, !tbaa !10
  store i32 5, ptr getelementptr inbounds ([101 x %struct.node], ptr @f, i64 0, i64 2), align 8, !tbaa !10
  store i32 3, ptr %2, align 4, !tbaa !10
  br label %6

6:                                                ; preds = %223, %0
  %7 = load i32, ptr %2, align 4, !tbaa !10
  %8 = load i32, ptr @n, align 4, !tbaa !10
  %9 = icmp sle i32 %7, %8
  br i1 %9, label %10, label %226

10:                                               ; preds = %6
  %11 = load i32, ptr %2, align 4, !tbaa !10
  %12 = sub nsw i32 %11, 1
  %13 = sext i32 %12 to i64
  %14 = getelementptr inbounds [101 x %struct.node], ptr @f, i64 0, i64 %13
  %15 = getelementptr inbounds %struct.node, ptr %14, i32 0, i32 1
  %16 = load i32, ptr %15, align 4, !tbaa !5
  %17 = load i32, ptr %2, align 4, !tbaa !10
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [101 x %struct.node], ptr @f, i64 0, i64 %18
  %20 = getelementptr inbounds %struct.node, ptr %19, i32 0, i32 1
  store i32 %16, ptr %20, align 4, !tbaa !5
  store i32 0, ptr %3, align 4, !tbaa !10
  br label %21

21:                                               ; preds = %47, %10
  %22 = load i32, ptr %3, align 4, !tbaa !10
  %23 = load i32, ptr %2, align 4, !tbaa !10
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [101 x %struct.node], ptr @f, i64 0, i64 %24
  %26 = getelementptr inbounds %struct.node, ptr %25, i32 0, i32 1
  %27 = load i32, ptr %26, align 4, !tbaa !5
  %28 = icmp slt i32 %22, %27
  br i1 %28, label %29, label %50

29:                                               ; preds = %21
  %30 = load i32, ptr %2, align 4, !tbaa !10
  %31 = sub nsw i32 %30, 1
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [101 x %struct.node], ptr @f, i64 0, i64 %32
  %34 = getelementptr inbounds %struct.node, ptr %33, i32 0, i32 0
  %35 = load i32, ptr %3, align 4, !tbaa !10
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [1000 x i32], ptr %34, i64 0, i64 %36
  %38 = load i32, ptr %37, align 4, !tbaa !10
  %39 = mul nsw i32 %38, 3
  %40 = load i32, ptr %2, align 4, !tbaa !10
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [101 x %struct.node], ptr @f, i64 0, i64 %41
  %43 = getelementptr inbounds %struct.node, ptr %42, i32 0, i32 0
  %44 = load i32, ptr %3, align 4, !tbaa !10
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [1000 x i32], ptr %43, i64 0, i64 %45
  store i32 %39, ptr %46, align 4, !tbaa !10
  br label %47

47:                                               ; preds = %29
  %48 = load i32, ptr %3, align 4, !tbaa !10
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %3, align 4, !tbaa !10
  br label %21, !llvm.loop !11

50:                                               ; preds = %21
  %51 = load i32, ptr %2, align 4, !tbaa !10
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [101 x %struct.node], ptr @f, i64 0, i64 %52
  %54 = getelementptr inbounds %struct.node, ptr %53, i32 0, i32 0
  %55 = getelementptr inbounds [1000 x i32], ptr %54, i64 0, i64 0
  %56 = load i32, ptr %55, align 4, !tbaa !10
  %57 = add nsw i32 %56, 2
  store i32 %57, ptr %55, align 4, !tbaa !10
  store i32 0, ptr %3, align 4, !tbaa !10
  br label %58

58:                                               ; preds = %106, %50
  %59 = load i32, ptr %3, align 4, !tbaa !10
  %60 = load i32, ptr %2, align 4, !tbaa !10
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [101 x %struct.node], ptr @f, i64 0, i64 %61
  %63 = getelementptr inbounds %struct.node, ptr %62, i32 0, i32 1
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = icmp slt i32 %59, %64
  br i1 %65, label %66, label %109

66:                                               ; preds = %58
  %67 = load i32, ptr %2, align 4, !tbaa !10
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [101 x %struct.node], ptr @f, i64 0, i64 %68
  %70 = getelementptr inbounds %struct.node, ptr %69, i32 0, i32 0
  %71 = load i32, ptr %3, align 4, !tbaa !10
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [1000 x i32], ptr %70, i64 0, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !10
  %75 = icmp sgt i32 %74, 9
  br i1 %75, label %76, label %105

76:                                               ; preds = %66
  %77 = load i32, ptr %2, align 4, !tbaa !10
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [101 x %struct.node], ptr @f, i64 0, i64 %78
  %80 = getelementptr inbounds %struct.node, ptr %79, i32 0, i32 0
  %81 = load i32, ptr %3, align 4, !tbaa !10
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [1000 x i32], ptr %80, i64 0, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !10
  %85 = sdiv i32 %84, 10
  %86 = load i32, ptr %2, align 4, !tbaa !10
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [101 x %struct.node], ptr @f, i64 0, i64 %87
  %89 = getelementptr inbounds %struct.node, ptr %88, i32 0, i32 0
  %90 = load i32, ptr %3, align 4, !tbaa !10
  %91 = add nsw i32 %90, 1
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [1000 x i32], ptr %89, i64 0, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !10
  %95 = add nsw i32 %94, %85
  store i32 %95, ptr %93, align 4, !tbaa !10
  %96 = load i32, ptr %2, align 4, !tbaa !10
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [101 x %struct.node], ptr @f, i64 0, i64 %97
  %99 = getelementptr inbounds %struct.node, ptr %98, i32 0, i32 0
  %100 = load i32, ptr %3, align 4, !tbaa !10
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [1000 x i32], ptr %99, i64 0, i64 %101
  %103 = load i32, ptr %102, align 4, !tbaa !10
  %104 = srem i32 %103, 10
  store i32 %104, ptr %102, align 4, !tbaa !10
  br label %105

105:                                              ; preds = %76, %66
  br label %106

106:                                              ; preds = %105
  %107 = load i32, ptr %3, align 4, !tbaa !10
  %108 = add nsw i32 %107, 1
  store i32 %108, ptr %3, align 4, !tbaa !10
  br label %58, !llvm.loop !13

109:                                              ; preds = %58
  %110 = load i32, ptr %2, align 4, !tbaa !10
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [101 x %struct.node], ptr @f, i64 0, i64 %111
  %113 = getelementptr inbounds %struct.node, ptr %112, i32 0, i32 0
  %114 = load i32, ptr %2, align 4, !tbaa !10
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [101 x %struct.node], ptr @f, i64 0, i64 %115
  %117 = getelementptr inbounds %struct.node, ptr %116, i32 0, i32 1
  %118 = load i32, ptr %117, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [1000 x i32], ptr %113, i64 0, i64 %119
  %121 = load i32, ptr %120, align 4, !tbaa !10
  %122 = icmp ne i32 %121, 0
  br i1 %122, label %123, label %130

123:                                              ; preds = %109
  %124 = load i32, ptr %2, align 4, !tbaa !10
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [101 x %struct.node], ptr @f, i64 0, i64 %125
  %127 = getelementptr inbounds %struct.node, ptr %126, i32 0, i32 1
  %128 = load i32, ptr %127, align 4, !tbaa !5
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr %127, align 4, !tbaa !5
  br label %130

130:                                              ; preds = %123, %109
  store i32 0, ptr %3, align 4, !tbaa !10
  br label %131

131:                                              ; preds = %197, %130
  %132 = load i32, ptr %3, align 4, !tbaa !10
  %133 = load i32, ptr %2, align 4, !tbaa !10
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [101 x %struct.node], ptr @f, i64 0, i64 %134
  %136 = getelementptr inbounds %struct.node, ptr %135, i32 0, i32 1
  %137 = load i32, ptr %136, align 4, !tbaa !5
  %138 = icmp slt i32 %132, %137
  br i1 %138, label %139, label %200

139:                                              ; preds = %131
  %140 = load i32, ptr %2, align 4, !tbaa !10
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [101 x %struct.node], ptr @f, i64 0, i64 %141
  %143 = getelementptr inbounds %struct.node, ptr %142, i32 0, i32 0
  %144 = load i32, ptr %3, align 4, !tbaa !10
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [1000 x i32], ptr %143, i64 0, i64 %145
  %147 = load i32, ptr %146, align 4, !tbaa !10
  %148 = load i32, ptr %2, align 4, !tbaa !10
  %149 = sub nsw i32 %148, 2
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [101 x %struct.node], ptr @f, i64 0, i64 %150
  %152 = getelementptr inbounds %struct.node, ptr %151, i32 0, i32 0
  %153 = load i32, ptr %3, align 4, !tbaa !10
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [1000 x i32], ptr %152, i64 0, i64 %154
  %156 = load i32, ptr %155, align 4, !tbaa !10
  %157 = icmp slt i32 %147, %156
  br i1 %157, label %158, label %178

158:                                              ; preds = %139
  %159 = load i32, ptr %2, align 4, !tbaa !10
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [101 x %struct.node], ptr @f, i64 0, i64 %160
  %162 = getelementptr inbounds %struct.node, ptr %161, i32 0, i32 0
  %163 = load i32, ptr %3, align 4, !tbaa !10
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds [1000 x i32], ptr %162, i64 0, i64 %164
  %166 = load i32, ptr %165, align 4, !tbaa !10
  %167 = add nsw i32 %166, 10
  store i32 %167, ptr %165, align 4, !tbaa !10
  %168 = load i32, ptr %2, align 4, !tbaa !10
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [101 x %struct.node], ptr @f, i64 0, i64 %169
  %171 = getelementptr inbounds %struct.node, ptr %170, i32 0, i32 0
  %172 = load i32, ptr %3, align 4, !tbaa !10
  %173 = add nsw i32 %172, 1
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds [1000 x i32], ptr %171, i64 0, i64 %174
  %176 = load i32, ptr %175, align 4, !tbaa !10
  %177 = add nsw i32 %176, -1
  store i32 %177, ptr %175, align 4, !tbaa !10
  br label %178

178:                                              ; preds = %158, %139
  %179 = load i32, ptr %2, align 4, !tbaa !10
  %180 = sub nsw i32 %179, 2
  %181 = sext i32 %180 to i64
  %182 = getelementptr inbounds [101 x %struct.node], ptr @f, i64 0, i64 %181
  %183 = getelementptr inbounds %struct.node, ptr %182, i32 0, i32 0
  %184 = load i32, ptr %3, align 4, !tbaa !10
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds [1000 x i32], ptr %183, i64 0, i64 %185
  %187 = load i32, ptr %186, align 4, !tbaa !10
  %188 = load i32, ptr %2, align 4, !tbaa !10
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds [101 x %struct.node], ptr @f, i64 0, i64 %189
  %191 = getelementptr inbounds %struct.node, ptr %190, i32 0, i32 0
  %192 = load i32, ptr %3, align 4, !tbaa !10
  %193 = sext i32 %192 to i64
  %194 = getelementptr inbounds [1000 x i32], ptr %191, i64 0, i64 %193
  %195 = load i32, ptr %194, align 4, !tbaa !10
  %196 = sub nsw i32 %195, %187
  store i32 %196, ptr %194, align 4, !tbaa !10
  br label %197

197:                                              ; preds = %178
  %198 = load i32, ptr %3, align 4, !tbaa !10
  %199 = add nsw i32 %198, 1
  store i32 %199, ptr %3, align 4, !tbaa !10
  br label %131, !llvm.loop !14

200:                                              ; preds = %131
  %201 = load i32, ptr %2, align 4, !tbaa !10
  %202 = sext i32 %201 to i64
  %203 = getelementptr inbounds [101 x %struct.node], ptr @f, i64 0, i64 %202
  %204 = getelementptr inbounds %struct.node, ptr %203, i32 0, i32 0
  %205 = load i32, ptr %2, align 4, !tbaa !10
  %206 = sext i32 %205 to i64
  %207 = getelementptr inbounds [101 x %struct.node], ptr @f, i64 0, i64 %206
  %208 = getelementptr inbounds %struct.node, ptr %207, i32 0, i32 1
  %209 = load i32, ptr %208, align 4, !tbaa !5
  %210 = sub nsw i32 %209, 1
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds [1000 x i32], ptr %204, i64 0, i64 %211
  %213 = load i32, ptr %212, align 4, !tbaa !10
  %214 = icmp ne i32 %213, 0
  br i1 %214, label %222, label %215

215:                                              ; preds = %200
  %216 = load i32, ptr %2, align 4, !tbaa !10
  %217 = sext i32 %216 to i64
  %218 = getelementptr inbounds [101 x %struct.node], ptr @f, i64 0, i64 %217
  %219 = getelementptr inbounds %struct.node, ptr %218, i32 0, i32 1
  %220 = load i32, ptr %219, align 4, !tbaa !5
  %221 = add nsw i32 %220, -1
  store i32 %221, ptr %219, align 4, !tbaa !5
  br label %222

222:                                              ; preds = %215, %200
  br label %223

223:                                              ; preds = %222
  %224 = load i32, ptr %2, align 4, !tbaa !10
  %225 = add nsw i32 %224, 1
  store i32 %225, ptr %2, align 4, !tbaa !10
  br label %6, !llvm.loop !15

226:                                              ; preds = %6
  %227 = load i32, ptr @n, align 4, !tbaa !10
  %228 = sext i32 %227 to i64
  %229 = getelementptr inbounds [101 x %struct.node], ptr @f, i64 0, i64 %228
  %230 = getelementptr inbounds %struct.node, ptr %229, i32 0, i32 1
  %231 = load i32, ptr %230, align 4, !tbaa !5
  %232 = sub nsw i32 %231, 1
  store i32 %232, ptr %2, align 4, !tbaa !10
  br label %233

233:                                              ; preds = %246, %226
  %234 = load i32, ptr %2, align 4, !tbaa !10
  %235 = icmp sge i32 %234, 0
  br i1 %235, label %236, label %249

236:                                              ; preds = %233
  %237 = load i32, ptr @n, align 4, !tbaa !10
  %238 = sext i32 %237 to i64
  %239 = getelementptr inbounds [101 x %struct.node], ptr @f, i64 0, i64 %238
  %240 = getelementptr inbounds %struct.node, ptr %239, i32 0, i32 0
  %241 = load i32, ptr %2, align 4, !tbaa !10
  %242 = sext i32 %241 to i64
  %243 = getelementptr inbounds [1000 x i32], ptr %240, i64 0, i64 %242
  %244 = load i32, ptr %243, align 4, !tbaa !10
  %245 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %244)
  br label %246

246:                                              ; preds = %236
  %247 = load i32, ptr %2, align 4, !tbaa !10
  %248 = add nsw i32 %247, -1
  store i32 %248, ptr %2, align 4, !tbaa !10
  br label %233, !llvm.loop !16

249:                                              ; preds = %233
  %250 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  ret i32 0
}

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

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

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #1

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #3 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)) #4

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { 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, !9, i64 4000}
!6 = !{!"_ZTS4node", !7, i64 0, !9, i64 4000}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{!9, !9, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}


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

%struct.node = type { [1000 x i32], i32 }
%"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" }

@f = external dso_local local_unnamed_addr global [101 x %struct.node], align 16
@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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %2 = 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)
  store i32 1, ptr getelementptr inbounds (i8, ptr @f, i64 12008), align 8, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @f, i64 8004), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @f, i64 4004), align 4, !tbaa !10
  store i32 5, ptr getelementptr inbounds (i8, ptr @f, i64 8008), align 8, !tbaa !10
  %3 = load i32, ptr @n, align 4, !tbaa !10
  %.not68 = icmp slt i32 %3, 3
  br i1 %.not68, label %._crit_edge72, label %.lr.ph71.preheader

.lr.ph71.preheader:                               ; preds = %0
  %4 = add nuw i32 %3, 1
  %wide.trip.count = zext i32 %4 to i64
  br label %.lr.ph71

.lr.ph71:                                         ; preds = %.lr.ph71.preheader, %72
  %5 = phi i32 [ 1, %.lr.ph71.preheader ], [ %73, %72 ]
  %indvars.iv87 = phi i64 [ 3, %.lr.ph71.preheader ], [ %indvars.iv.next88, %72 ]
  %6 = add nsw i64 %indvars.iv87, -1
  %7 = getelementptr inbounds [101 x %struct.node], ptr @f, i64 0, i64 %6
  %8 = getelementptr inbounds [101 x %struct.node], ptr @f, i64 0, i64 %indvars.iv87
  %9 = getelementptr inbounds i8, ptr %8, i64 4000
  store i32 %5, ptr %9, align 4, !tbaa !5
  %10 = icmp sgt i32 %5, 0
  br i1 %10, label %.lr.ph, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %.lr.ph71
  %11 = load i32, ptr %8, align 4, !tbaa !10
  %12 = add nsw i32 %11, 2
  store i32 %12, ptr %8, align 4, !tbaa !10
  br label %._crit_edge.._crit_edge62_crit_edge

.lr.ph:                                           ; preds = %.lr.ph71, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph71 ]
  %13 = getelementptr inbounds [1000 x i32], ptr %7, i64 0, i64 %indvars.iv
  %14 = load i32, ptr %13, align 4, !tbaa !10
  %15 = mul nsw i32 %14, 3
  %16 = getelementptr inbounds [1000 x i32], ptr %8, i64 0, i64 %indvars.iv
  store i32 %15, ptr %16, align 4, !tbaa !10
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %17 = load i32, ptr %9, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = icmp slt i64 %indvars.iv.next, %18
  br i1 %19, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge:                                      ; preds = %.lr.ph
  %20 = load i32, ptr %8, align 4, !tbaa !10
  %21 = add nsw i32 %20, 2
  store i32 %21, ptr %8, align 4, !tbaa !10
  %22 = icmp sgt i32 %17, 0
  br i1 %22, label %.lr.ph61, label %._crit_edge.._crit_edge62_crit_edge

._crit_edge.._crit_edge62_crit_edge:              ; preds = %._crit_edge.thread, %._crit_edge
  %23 = phi i32 [ %5, %._crit_edge.thread ], [ %17, %._crit_edge ]
  %.pre95 = sext i32 %23 to i64
  br label %._crit_edge62

.lr.ph61:                                         ; preds = %._crit_edge, %35
  %24 = phi i32 [ %36, %35 ], [ %17, %._crit_edge ]
  %indvars.iv81 = phi i64 [ %indvars.iv.next82.pre-phi, %35 ], [ 0, %._crit_edge ]
  %25 = getelementptr inbounds [1000 x i32], ptr %8, i64 0, i64 %indvars.iv81
  %26 = load i32, ptr %25, align 4, !tbaa !10
  %27 = icmp sgt i32 %26, 9
  br i1 %27, label %28, label %.lr.ph61._crit_edge

.lr.ph61._crit_edge:                              ; preds = %.lr.ph61
  %.pre94 = add nuw nsw i64 %indvars.iv81, 1
  br label %35

28:                                               ; preds = %.lr.ph61
  %29 = udiv i32 %26, 10
  %30 = add nuw nsw i64 %indvars.iv81, 1
  %31 = getelementptr inbounds [1000 x i32], ptr %8, i64 0, i64 %30
  %32 = load i32, ptr %31, align 4, !tbaa !10
  %33 = add nsw i32 %32, %29
  store i32 %33, ptr %31, align 4, !tbaa !10
  %34 = urem i32 %26, 10
  store i32 %34, ptr %25, align 4, !tbaa !10
  %.pre = load i32, ptr %9, align 4, !tbaa !5
  br label %35

35:                                               ; preds = %.lr.ph61._crit_edge, %28
  %indvars.iv.next82.pre-phi = phi i64 [ %.pre94, %.lr.ph61._crit_edge ], [ %30, %28 ]
  %36 = phi i32 [ %24, %.lr.ph61._crit_edge ], [ %.pre, %28 ]
  %37 = sext i32 %36 to i64
  %38 = icmp slt i64 %indvars.iv.next82.pre-phi, %37
  br i1 %38, label %.lr.ph61, label %._crit_edge62, !llvm.loop !13

._crit_edge62:                                    ; preds = %35, %._crit_edge.._crit_edge62_crit_edge
  %.pre-phi = phi i64 [ %.pre95, %._crit_edge.._crit_edge62_crit_edge ], [ %37, %35 ]
  %.lcssa = phi i32 [ %23, %._crit_edge.._crit_edge62_crit_edge ], [ %36, %35 ]
  %39 = getelementptr inbounds [1000 x i32], ptr %8, i64 0, i64 %.pre-phi
  %40 = load i32, ptr %39, align 4, !tbaa !10
  %.not54 = icmp eq i32 %40, 0
  br i1 %.not54, label %43, label %41

41:                                               ; preds = %._crit_edge62
  %42 = add nsw i32 %.lcssa, 1
  store i32 %42, ptr %9, align 4, !tbaa !5
  br label %43

43:                                               ; preds = %41, %._crit_edge62
  %44 = phi i32 [ %42, %41 ], [ %.lcssa, %._crit_edge62 ]
  %45 = icmp sgt i32 %44, 0
  br i1 %45, label %.lr.ph65, label %._crit_edge66

.lr.ph65:                                         ; preds = %43
  %46 = add nsw i64 %indvars.iv87, -2
  %47 = getelementptr inbounds [101 x %struct.node], ptr @f, i64 0, i64 %46
  br label %48

48:                                               ; preds = %.lr.ph65, %60
  %indvars.iv84 = phi i64 [ 0, %.lr.ph65 ], [ %indvars.iv.next85.pre-phi, %60 ]
  %49 = getelementptr inbounds [1000 x i32], ptr %8, i64 0, i64 %indvars.iv84
  %50 = load i32, ptr %49, align 4, !tbaa !10
  %51 = getelementptr inbounds [1000 x i32], ptr %47, i64 0, i64 %indvars.iv84
  %52 = load i32, ptr %51, align 4, !tbaa !10
  %53 = icmp slt i32 %50, %52
  br i1 %53, label %54, label %._crit_edge93

._crit_edge93:                                    ; preds = %48
  %.pre96 = add nuw nsw i64 %indvars.iv84, 1
  br label %60

54:                                               ; preds = %48
  %55 = add nsw i32 %50, 10
  %56 = add nuw nsw i64 %indvars.iv84, 1
  %57 = getelementptr inbounds [1000 x i32], ptr %8, i64 0, i64 %56
  %58 = load i32, ptr %57, align 4, !tbaa !10
  %59 = add nsw i32 %58, -1
  store i32 %59, ptr %57, align 4, !tbaa !10
  br label %60

60:                                               ; preds = %._crit_edge93, %54
  %indvars.iv.next85.pre-phi = phi i64 [ %.pre96, %._crit_edge93 ], [ %56, %54 ]
  %61 = phi i32 [ %50, %._crit_edge93 ], [ %55, %54 ]
  %62 = sub nsw i32 %61, %52
  store i32 %62, ptr %49, align 4, !tbaa !10
  %63 = load i32, ptr %9, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = icmp slt i64 %indvars.iv.next85.pre-phi, %64
  br i1 %65, label %48, label %._crit_edge66, !llvm.loop !14

._crit_edge66:                                    ; preds = %60, %43
  %66 = phi i32 [ %44, %43 ], [ %63, %60 ]
  %67 = add nsw i32 %66, -1
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [1000 x i32], ptr %8, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !10
  %.not55 = icmp eq i32 %70, 0
  br i1 %.not55, label %71, label %72

71:                                               ; preds = %._crit_edge66
  store i32 %67, ptr %9, align 4, !tbaa !5
  br label %72

72:                                               ; preds = %._crit_edge66, %71
  %73 = phi i32 [ %66, %._crit_edge66 ], [ %67, %71 ]
  %indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next88, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge72, label %.lr.ph71, !llvm.loop !15

._crit_edge72:                                    ; preds = %72, %0
  %74 = sext i32 %3 to i64
  %75 = getelementptr inbounds [101 x %struct.node], ptr @f, i64 0, i64 %74, i32 1
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = icmp sgt i32 %76, 0
  br i1 %77, label %.lr.ph76.preheader, label %._crit_edge77

.lr.ph76.preheader:                               ; preds = %._crit_edge72
  %78 = zext nneg i32 %76 to i64
  br label %.lr.ph76

.lr.ph76:                                         ; preds = %.lr.ph76.preheader, %.lr.ph76
  %indvars.iv90 = phi i64 [ %78, %.lr.ph76.preheader ], [ %indvars.iv.next91, %.lr.ph76 ]
  %indvars.iv.next91 = add nsw i64 %indvars.iv90, -1
  %79 = load i32, ptr @n, align 4, !tbaa !10
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [101 x %struct.node], ptr @f, i64 0, i64 %80
  %82 = getelementptr inbounds [1000 x i32], ptr %81, i64 0, i64 %indvars.iv.next91
  %83 = load i32, ptr %82, align 4, !tbaa !10
  %84 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %83)
  %85 = icmp ugt i64 %indvars.iv90, 1
  br i1 %85, label %.lr.ph76, label %._crit_edge77, !llvm.loop !16

._crit_edge77:                                    ; preds = %.lr.ph76, %._crit_edge72
  %86 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0
}

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

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #1

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

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 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 = { 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" }

!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, !9, i64 4000}
!6 = !{!"_ZTS4node", !7, i64 0, !9, i64 4000}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{!9, !9, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}


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