; LLVM IR from VastoLorde95/Competitive-Programming :: CodeChef/WF/Medium Hard/FNCS/A.ll (Z10preprocessv)

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

@n = external dso_local global i64, align 8
@BLOCK = external dso_local global i64, align 8
@a = external dso_local global [100100 x i64], align 16
@l = external dso_local global [100100 x i64], align 16
@r = external dso_local global [100100 x i64], align 16
@freq = external dso_local global [333 x [100100 x i64]], align 16
@sum1 = external dso_local global [333 x [333 x i64]], align 16
@sum2 = external dso_local global [333 x i64], align 16
@qsum1 = external dso_local global [333 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_Z10preprocessv() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i64, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERy(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #3
  store i32 1, ptr %1, align 4, !tbaa !5
  br label %17

17:                                               ; preds = %28, %0
  %18 = load i32, ptr %1, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = load i64, ptr @n, align 8, !tbaa !9
  %21 = icmp ule i64 %19, %20
  br i1 %21, label %23, label %22

22:                                               ; preds = %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #3
  br label %31

23:                                               ; preds = %17
  %24 = load i32, ptr %1, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %25
  %27 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERy(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %26)
  br label %28

28:                                               ; preds = %23
  %29 = load i32, ptr %1, align 4, !tbaa !5
  %30 = add nsw i32 %29, 1
  store i32 %30, ptr %1, align 4, !tbaa !5
  br label %17, !llvm.loop !11

31:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #3
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %32

32:                                               ; preds = %47, %31
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = load i64, ptr @n, align 8, !tbaa !9
  %36 = icmp ule i64 %34, %35
  br i1 %36, label %38, label %37

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

38:                                               ; preds = %32
  %39 = load i32, ptr %2, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [100100 x i64], ptr @l, i64 0, i64 %40
  %42 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERy(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %41)
  %43 = load i32, ptr %2, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [100100 x i64], ptr @r, i64 0, i64 %44
  %46 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERy(ptr noundef nonnull align 8 dereferenceable(16) %42, ptr noundef nonnull align 8 dereferenceable(8) %45)
  br label %47

47:                                               ; preds = %38
  %48 = load i32, ptr %2, align 4, !tbaa !5
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %2, align 4, !tbaa !5
  br label %32, !llvm.loop !13

50:                                               ; preds = %37
  %51 = load i64, ptr @n, align 8, !tbaa !9
  %52 = call noundef double @_ZSt4sqrtIyEN9__gnu_cxx11__enable_ifIXsr12__is_integerIT_EE7__valueEdE6__typeES2_(i64 noundef %51)
  %53 = fadd double %52, 1.000000e+00
  %54 = fptoui double %53 to i64
  store i64 %54, ptr @BLOCK, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %55

55:                                               ; preds = %128, %50
  %56 = load i32, ptr %3, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = load i64, ptr @BLOCK, align 8, !tbaa !9
  %59 = icmp ule i64 %57, %58
  br i1 %59, label %61, label %60

60:                                               ; preds = %55
  store i32 8, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  br label %131

61:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  %62 = load i64, ptr @BLOCK, align 8, !tbaa !9
  %63 = load i32, ptr %3, align 4, !tbaa !5
  %64 = sub nsw i32 %63, 1
  %65 = sext i32 %64 to i64
  %66 = mul i64 %62, %65
  %67 = add i64 %66, 1
  %68 = trunc i64 %67 to i32
  store i32 %68, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %69 = load i64, ptr @BLOCK, align 8, !tbaa !9
  %70 = load i32, ptr %3, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = mul i64 %69, %71
  store i64 %72, ptr %7, align 8, !tbaa !9
  %73 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIyERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) @n)
  %74 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIyERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %73, ptr noundef nonnull align 8 dereferenceable(8) @n)
  %75 = load i64, ptr %74, align 8, !tbaa !9
  %76 = trunc i64 %75 to i32
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  store i32 %76, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  %77 = load i32, ptr %5, align 4, !tbaa !5
  store i32 %77, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  store i32 1, ptr %9, align 4, !tbaa !5
  br label %78

78:                                               ; preds = %103, %61
  %79 = load i32, ptr %8, align 4, !tbaa !5
  %80 = load i32, ptr %6, align 4, !tbaa !5
  %81 = icmp sle i32 %79, %80
  br i1 %81, label %83, label %82

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

83:                                               ; preds = %78
  %84 = load i32, ptr %3, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [333 x [333 x i64]], ptr @sum1, i64 0, i64 %85
  %87 = load i32, ptr %9, align 4, !tbaa !5
  %88 = sub nsw i32 %87, 1
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [333 x i64], ptr %86, i64 0, i64 %89
  %91 = load i64, ptr %90, align 8, !tbaa !9
  %92 = load i32, ptr %8, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %93
  %95 = load i64, ptr %94, align 8, !tbaa !9
  %96 = add i64 %91, %95
  %97 = load i32, ptr %3, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [333 x [333 x i64]], ptr @sum1, i64 0, i64 %98
  %100 = load i32, ptr %9, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [333 x i64], ptr %99, i64 0, i64 %101
  store i64 %96, ptr %102, align 8, !tbaa !9
  br label %103

103:                                              ; preds = %83
  %104 = load i32, ptr %8, align 4, !tbaa !5
  %105 = add nsw i32 %104, 1
  store i32 %105, ptr %8, align 4, !tbaa !5
  %106 = load i32, ptr %9, align 4, !tbaa !5
  %107 = add nsw i32 %106, 1
  store i32 %107, ptr %9, align 4, !tbaa !5
  br label %78, !llvm.loop !14

108:                                              ; preds = %82
  %109 = load i32, ptr %3, align 4, !tbaa !5
  %110 = sub nsw i32 %109, 1
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [333 x i64], ptr @sum2, i64 0, i64 %111
  %113 = load i64, ptr %112, align 8, !tbaa !9
  %114 = load i32, ptr %3, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [333 x [333 x i64]], ptr @sum1, i64 0, i64 %115
  %117 = load i32, ptr %6, align 4, !tbaa !5
  %118 = load i32, ptr %5, align 4, !tbaa !5
  %119 = sub nsw i32 %117, %118
  %120 = add nsw i32 %119, 1
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [333 x i64], ptr %116, i64 0, i64 %121
  %123 = load i64, ptr %122, align 8, !tbaa !9
  %124 = add i64 %113, %123
  %125 = load i32, ptr %3, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [333 x i64], ptr @sum2, i64 0, i64 %126
  store i64 %124, ptr %127, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  br label %128

128:                                              ; preds = %108
  %129 = load i32, ptr %3, align 4, !tbaa !5
  %130 = add nsw i32 %129, 1
  store i32 %130, ptr %3, align 4, !tbaa !5
  br label %55, !llvm.loop !15

131:                                              ; preds = %60
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %132

132:                                              ; preds = %230, %131
  %133 = load i32, ptr %10, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = load i64, ptr @BLOCK, align 8, !tbaa !9
  %136 = icmp ule i64 %134, %135
  br i1 %136, label %138, label %137

137:                                              ; preds = %132
  store i32 14, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  br label %233

138:                                              ; preds = %132
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  %139 = load i64, ptr @BLOCK, align 8, !tbaa !9
  %140 = load i32, ptr %10, align 4, !tbaa !5
  %141 = sub nsw i32 %140, 1
  %142 = sext i32 %141 to i64
  %143 = mul i64 %139, %142
  %144 = add i64 %143, 1
  %145 = trunc i64 %144 to i32
  store i32 %145, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  %146 = load i64, ptr @BLOCK, align 8, !tbaa !9
  %147 = load i32, ptr %10, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = mul i64 %146, %148
  store i64 %149, ptr %13, align 8, !tbaa !9
  %150 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIyERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 8 dereferenceable(8) @n)
  %151 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIyERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %150, ptr noundef nonnull align 8 dereferenceable(8) @n)
  %152 = load i64, ptr %151, align 8, !tbaa !9
  %153 = trunc i64 %152 to i32
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  store i32 %153, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  %154 = load i32, ptr %11, align 4, !tbaa !5
  store i32 %154, ptr %14, align 4, !tbaa !5
  br label %155

155:                                              ; preds = %182, %138
  %156 = load i32, ptr %14, align 4, !tbaa !5
  %157 = load i32, ptr %12, align 4, !tbaa !5
  %158 = icmp sle i32 %156, %157
  br i1 %158, label %160, label %159

159:                                              ; preds = %155
  store i32 17, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  br label %185

160:                                              ; preds = %155
  %161 = load i32, ptr %10, align 4, !tbaa !5
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds [333 x [100100 x i64]], ptr @freq, i64 0, i64 %162
  %164 = load i32, ptr %14, align 4, !tbaa !5
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [100100 x i64], ptr @l, i64 0, i64 %165
  %167 = load i64, ptr %166, align 8, !tbaa !9
  %168 = getelementptr inbounds [100100 x i64], ptr %163, i64 0, i64 %167
  %169 = load i64, ptr %168, align 8, !tbaa !9
  %170 = add i64 %169, 1
  store i64 %170, ptr %168, align 8, !tbaa !9
  %171 = load i32, ptr %10, align 4, !tbaa !5
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds [333 x [100100 x i64]], ptr @freq, i64 0, i64 %172
  %174 = load i32, ptr %14, align 4, !tbaa !5
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [100100 x i64], ptr @r, i64 0, i64 %175
  %177 = load i64, ptr %176, align 8, !tbaa !9
  %178 = add i64 %177, 1
  %179 = getelementptr inbounds [100100 x i64], ptr %173, i64 0, i64 %178
  %180 = load i64, ptr %179, align 8, !tbaa !9
  %181 = add i64 %180, -1
  store i64 %181, ptr %179, align 8, !tbaa !9
  br label %182

182:                                              ; preds = %160
  %183 = load i32, ptr %14, align 4, !tbaa !5
  %184 = add nsw i32 %183, 1
  store i32 %184, ptr %14, align 4, !tbaa !5
  br label %155, !llvm.loop !16

185:                                              ; preds = %159
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  store i32 1, ptr %15, align 4, !tbaa !5
  br label %186

186:                                              ; preds = %226, %185
  %187 = load i32, ptr %15, align 4, !tbaa !5
  %188 = sext i32 %187 to i64
  %189 = load i64, ptr @n, align 8, !tbaa !9
  %190 = icmp ule i64 %188, %189
  br i1 %190, label %192, label %191

191:                                              ; preds = %186
  store i32 20, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  br label %229

192:                                              ; preds = %186
  %193 = load i32, ptr %10, align 4, !tbaa !5
  %194 = sext i32 %193 to i64
  %195 = getelementptr inbounds [333 x [100100 x i64]], ptr @freq, i64 0, i64 %194
  %196 = load i32, ptr %15, align 4, !tbaa !5
  %197 = sub nsw i32 %196, 1
  %198 = sext i32 %197 to i64
  %199 = getelementptr inbounds [100100 x i64], ptr %195, i64 0, i64 %198
  %200 = load i64, ptr %199, align 8, !tbaa !9
  %201 = load i32, ptr %10, align 4, !tbaa !5
  %202 = sext i32 %201 to i64
  %203 = getelementptr inbounds [333 x [100100 x i64]], ptr @freq, i64 0, i64 %202
  %204 = load i32, ptr %15, align 4, !tbaa !5
  %205 = sext i32 %204 to i64
  %206 = getelementptr inbounds [100100 x i64], ptr %203, i64 0, i64 %205
  %207 = load i64, ptr %206, align 8, !tbaa !9
  %208 = add i64 %207, %200
  store i64 %208, ptr %206, align 8, !tbaa !9
  %209 = load i32, ptr %15, align 4, !tbaa !5
  %210 = sext i32 %209 to i64
  %211 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %210
  %212 = load i64, ptr %211, align 8, !tbaa !9
  %213 = load i32, ptr %10, align 4, !tbaa !5
  %214 = sext i32 %213 to i64
  %215 = getelementptr inbounds [333 x [100100 x i64]], ptr @freq, i64 0, i64 %214
  %216 = load i32, ptr %15, align 4, !tbaa !5
  %217 = sext i32 %216 to i64
  %218 = getelementptr inbounds [100100 x i64], ptr %215, i64 0, i64 %217
  %219 = load i64, ptr %218, align 8, !tbaa !9
  %220 = mul i64 %212, %219
  %221 = load i32, ptr %10, align 4, !tbaa !5
  %222 = sext i32 %221 to i64
  %223 = getelementptr inbounds [333 x i64], ptr @qsum1, i64 0, i64 %222
  %224 = load i64, ptr %223, align 8, !tbaa !9
  %225 = add i64 %224, %220
  store i64 %225, ptr %223, align 8, !tbaa !9
  br label %226

226:                                              ; preds = %192
  %227 = load i32, ptr %15, align 4, !tbaa !5
  %228 = add nsw i32 %227, 1
  store i32 %228, ptr %15, align 4, !tbaa !5
  br label %186, !llvm.loop !17

229:                                              ; preds = %191
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  br label %230

230:                                              ; preds = %229
  %231 = load i32, ptr %10, align 4, !tbaa !5
  %232 = add nsw i32 %231, 1
  store i32 %232, ptr %10, align 4, !tbaa !5
  br label %132, !llvm.loop !18

233:                                              ; preds = %137
  ret void
}

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt4sqrtIyEN9__gnu_cxx11__enable_ifIXsr12__is_integerIT_EE7__valueEdE6__typeES2_(i64 noundef) #2

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, 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}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}


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

%"class.std::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 }

@n = external dso_local global i64, align 8
@BLOCK = external dso_local local_unnamed_addr global i64, align 8
@a = external dso_local global [100100 x i64], align 16
@l = external dso_local global [100100 x i64], align 16
@r = external dso_local global [100100 x i64], align 16
@freq = external dso_local local_unnamed_addr global [333 x [100100 x i64]], align 16
@sum1 = external dso_local local_unnamed_addr global [333 x [333 x i64]], align 16
@sum2 = external dso_local local_unnamed_addr global [333 x i64], align 16
@qsum1 = external dso_local local_unnamed_addr global [333 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_Z10preprocessv() local_unnamed_addr #0 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERy(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @n)
  %4 = load i64, ptr @n, align 8, !tbaa !5
  %.not72 = icmp eq i64 %4, 0
  br i1 %.not72, label %._crit_edge, label %.lr.ph

.preheader71:                                     ; preds = %.lr.ph
  %5 = icmp eq i64 %8, 0
  br i1 %5, label %._crit_edge, label %.lr.ph76

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %6 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %indvars.iv
  %7 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERy(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %8 = load i64, ptr @n, align 8, !tbaa !5
  %.not.not = icmp ugt i64 %8, %indvars.iv
  br i1 %.not.not, label %.lr.ph, label %.preheader71, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph76, %0, %.preheader71
  %.lcssa = phi i64 [ 0, %.preheader71 ], [ 0, %0 ], [ %16, %.lr.ph76 ]
  %9 = tail call noundef double @_ZSt4sqrtIyEN9__gnu_cxx11__enable_ifIXsr12__is_integerIT_EE7__valueEdE6__typeES2_(i64 noundef %.lcssa)
  %10 = fadd double %9, 1.000000e+00
  %11 = fptoui double %10 to i64
  store i64 %11, ptr @BLOCK, align 8, !tbaa !5
  %.not6583 = icmp eq i64 %11, 0
  br i1 %.not6583, label %._crit_edge100, label %.lr.ph86

.lr.ph76:                                         ; preds = %.preheader71, %.lr.ph76
  %indvars.iv104 = phi i64 [ %indvars.iv.next105, %.lr.ph76 ], [ 1, %.preheader71 ]
  %12 = getelementptr inbounds [100100 x i64], ptr @l, i64 0, i64 %indvars.iv104
  %13 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERy(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %12)
  %14 = getelementptr inbounds [100100 x i64], ptr @r, i64 0, i64 %indvars.iv104
  %15 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERy(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 8 dereferenceable(8) %14)
  %indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1
  %16 = load i64, ptr @n, align 8, !tbaa !5
  %.not64.not = icmp ugt i64 %16, %indvars.iv104
  br i1 %.not64.not, label %.lr.ph76, label %._crit_edge, !llvm.loop !11

.preheader70:                                     ; preds = %._crit_edge82
  %.not6697 = icmp eq i64 %47, 0
  br i1 %.not6697, label %._crit_edge100, label %.lr.ph99

.lr.ph86:                                         ; preds = %._crit_edge, %._crit_edge82
  %indvars.iv116 = phi i64 [ %indvars.iv.next117, %._crit_edge82 ], [ 1, %._crit_edge ]
  %indvars.iv109 = phi i32 [ %indvars.iv.next110, %._crit_edge82 ], [ 0, %._crit_edge ]
  %17 = phi i64 [ %47, %._crit_edge82 ], [ %11, %._crit_edge ]
  %18 = add nsw i64 %indvars.iv116, -1
  %19 = trunc i64 %17 to i32
  %20 = trunc nuw nsw i64 %18 to i32
  %21 = mul i32 %20, %19
  %22 = add i32 %21, 1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #3
  %23 = mul i64 %17, %indvars.iv116
  store i64 %23, ptr %1, align 8, !tbaa !5
  %24 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIyERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) @n)
  %25 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIyERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %24, ptr noundef nonnull align 8 dereferenceable(8) @n)
  %26 = load i64, ptr %25, align 8, !tbaa !5
  %27 = trunc i64 %26 to i32
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #3
  %.not6977 = icmp sgt i32 %22, %27
  br i1 %.not6977, label %._crit_edge82, label %.lr.ph81.preheader

.lr.ph81.preheader:                               ; preds = %.lr.ph86
  %28 = mul i32 %indvars.iv109, %19
  %29 = add i32 %28, 1
  %30 = sext i32 %29 to i64
  %.phi.trans.insert = getelementptr inbounds [333 x [333 x i64]], ptr @sum1, i64 0, i64 %indvars.iv116, i64 0
  %.pre = load i64, ptr %.phi.trans.insert, align 8, !tbaa !5
  %31 = mul i32 %indvars.iv109, %19
  %32 = sub i32 %27, %31
  %xtraiter = and i32 %32, 1
  %33 = add i32 %27, -1
  %34 = icmp eq i32 %31, %33
  br i1 %34, label %._crit_edge82.loopexit.unr-lcssa, label %.lr.ph81.preheader.new

.lr.ph81.preheader.new:                           ; preds = %.lr.ph81.preheader
  %unroll_iter = and i32 %32, -2
  br label %.lr.ph81

._crit_edge82.loopexit.unr-lcssa:                 ; preds = %.lr.ph81, %.lr.ph81.preheader
  %.unr = phi i64 [ %.pre, %.lr.ph81.preheader ], [ %55, %.lr.ph81 ]
  %indvars.iv111.unr = phi i64 [ %30, %.lr.ph81.preheader ], [ %indvars.iv.next112.1, %.lr.ph81 ]
  %indvars.iv107.unr = phi i64 [ 1, %.lr.ph81.preheader ], [ %indvars.iv.next108.1, %.lr.ph81 ]
  %lcmp.mod.not = icmp eq i32 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge82, label %.lr.ph81.epil

.lr.ph81.epil:                                    ; preds = %._crit_edge82.loopexit.unr-lcssa
  %35 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %indvars.iv111.unr
  %36 = load i64, ptr %35, align 8, !tbaa !5
  %37 = add i64 %36, %.unr
  %38 = getelementptr inbounds [333 x [333 x i64]], ptr @sum1, i64 0, i64 %indvars.iv116, i64 %indvars.iv107.unr
  store i64 %37, ptr %38, align 8, !tbaa !5
  br label %._crit_edge82

._crit_edge82:                                    ; preds = %.lr.ph81.epil, %._crit_edge82.loopexit.unr-lcssa, %.lr.ph86
  %39 = getelementptr inbounds [333 x i64], ptr @sum2, i64 0, i64 %18
  %40 = load i64, ptr %39, align 8, !tbaa !5
  %41 = sub i32 %27, %21
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [333 x [333 x i64]], ptr @sum1, i64 0, i64 %indvars.iv116, i64 %42
  %44 = load i64, ptr %43, align 8, !tbaa !5
  %45 = add i64 %44, %40
  %46 = getelementptr inbounds [333 x i64], ptr @sum2, i64 0, i64 %indvars.iv116
  store i64 %45, ptr %46, align 8, !tbaa !5
  %indvars.iv.next117 = add nuw nsw i64 %indvars.iv116, 1
  %47 = load i64, ptr @BLOCK, align 8, !tbaa !5
  %.not65.not = icmp ugt i64 %47, %indvars.iv116
  %indvars.iv.next110 = add nuw nsw i32 %indvars.iv109, 1
  br i1 %.not65.not, label %.lr.ph86, label %.preheader70, !llvm.loop !12

.lr.ph81:                                         ; preds = %.lr.ph81, %.lr.ph81.preheader.new
  %48 = phi i64 [ %.pre, %.lr.ph81.preheader.new ], [ %55, %.lr.ph81 ]
  %indvars.iv111 = phi i64 [ %30, %.lr.ph81.preheader.new ], [ %indvars.iv.next112.1, %.lr.ph81 ]
  %indvars.iv107 = phi i64 [ 1, %.lr.ph81.preheader.new ], [ %indvars.iv.next108.1, %.lr.ph81 ]
  %niter = phi i32 [ 0, %.lr.ph81.preheader.new ], [ %niter.next.1, %.lr.ph81 ]
  %49 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %indvars.iv111
  %50 = load i64, ptr %49, align 8, !tbaa !5
  %51 = add i64 %50, %48
  %52 = getelementptr inbounds [333 x [333 x i64]], ptr @sum1, i64 0, i64 %indvars.iv116, i64 %indvars.iv107
  store i64 %51, ptr %52, align 8, !tbaa !5
  %indvars.iv.next112 = add nsw i64 %indvars.iv111, 1
  %indvars.iv.next108 = add nuw nsw i64 %indvars.iv107, 1
  %53 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %indvars.iv.next112
  %54 = load i64, ptr %53, align 8, !tbaa !5
  %55 = add i64 %54, %51
  %56 = getelementptr inbounds [333 x [333 x i64]], ptr @sum1, i64 0, i64 %indvars.iv116, i64 %indvars.iv.next108
  store i64 %55, ptr %56, align 8, !tbaa !5
  %indvars.iv.next112.1 = add nsw i64 %indvars.iv111, 2
  %indvars.iv.next108.1 = add nuw nsw i64 %indvars.iv107, 2
  %niter.next.1 = add i32 %niter, 2
  %niter.ncmp.1 = icmp eq i32 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge82.loopexit.unr-lcssa, label %.lr.ph81, !llvm.loop !13

._crit_edge100:                                   ; preds = %89, %._crit_edge, %.preheader70
  ret void

.lr.ph99:                                         ; preds = %.preheader70, %89
  %indvars.iv123 = phi i64 [ %indvars.iv.next124, %89 ], [ 1, %.preheader70 ]
  %57 = phi i64 [ %90, %89 ], [ %47, %.preheader70 ]
  %58 = trunc i64 %57 to i32
  %59 = trunc i64 %indvars.iv123 to i32
  %60 = add i32 %59, -1
  %61 = mul i32 %60, %58
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  %62 = mul i64 %57, %indvars.iv123
  store i64 %62, ptr %2, align 8, !tbaa !5
  %63 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIyERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) @n)
  %64 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIyERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %63, ptr noundef nonnull align 8 dereferenceable(8) @n)
  %65 = load i64, ptr %64, align 8, !tbaa !5
  %66 = trunc i64 %65 to i32
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  %.04887 = add i32 %61, 1
  %.not6788 = icmp sgt i32 %.04887, %66
  br i1 %.not6788, label %.preheader, label %.lr.ph91

.preheader:                                       ; preds = %.lr.ph91, %.lr.ph99
  %67 = load i64, ptr @n, align 8, !tbaa !5
  %.not6892 = icmp eq i64 %67, 0
  br i1 %.not6892, label %89, label %.lr.ph94

.lr.ph94:                                         ; preds = %.preheader
  %68 = getelementptr inbounds [333 x i64], ptr @qsum1, i64 0, i64 %indvars.iv123
  %.promoted = load i64, ptr %68, align 8, !tbaa !5
  %.phi.trans.insert126 = getelementptr inbounds [333 x [100100 x i64]], ptr @freq, i64 0, i64 %indvars.iv123, i64 0
  %.pre127 = load i64, ptr %.phi.trans.insert126, align 16, !tbaa !5
  %xtraiter142 = and i64 %67, 1
  %69 = icmp eq i64 %67, 1
  br i1 %69, label %._crit_edge95.unr-lcssa, label %.lr.ph94.new

.lr.ph94.new:                                     ; preds = %.lr.ph94
  %unroll_iter147 = and i64 %67, -2
  br label %91

.lr.ph91:                                         ; preds = %.lr.ph99, %.lr.ph91
  %.04889 = phi i32 [ %.048, %.lr.ph91 ], [ %.04887, %.lr.ph99 ]
  %70 = sext i32 %.04889 to i64
  %71 = getelementptr inbounds [100100 x i64], ptr @l, i64 0, i64 %70
  %72 = load i64, ptr %71, align 8, !tbaa !5
  %73 = getelementptr inbounds [333 x [100100 x i64]], ptr @freq, i64 0, i64 %indvars.iv123, i64 %72
  %74 = load i64, ptr %73, align 8, !tbaa !5
  %75 = add i64 %74, 1
  store i64 %75, ptr %73, align 8, !tbaa !5
  %76 = getelementptr inbounds [100100 x i64], ptr @r, i64 0, i64 %70
  %77 = load i64, ptr %76, align 8, !tbaa !5
  %78 = add i64 %77, 1
  %79 = getelementptr inbounds [333 x [100100 x i64]], ptr @freq, i64 0, i64 %indvars.iv123, i64 %78
  %80 = load i64, ptr %79, align 8, !tbaa !5
  %81 = add i64 %80, -1
  store i64 %81, ptr %79, align 8, !tbaa !5
  %.048 = add i32 %.04889, 1
  %.not67 = icmp sgt i32 %.048, %66
  br i1 %.not67, label %.preheader, label %.lr.ph91, !llvm.loop !14

._crit_edge95.unr-lcssa:                          ; preds = %91, %.lr.ph94
  %.lcssa138.ph = phi i64 [ poison, %.lr.ph94 ], [ %107, %91 ]
  %.unr143 = phi i64 [ %.pre127, %.lr.ph94 ], [ %103, %91 ]
  %indvars.iv119.unr = phi i64 [ 1, %.lr.ph94 ], [ %indvars.iv.next120.1, %91 ]
  %.unr144 = phi i64 [ %.promoted, %.lr.ph94 ], [ %107, %91 ]
  %lcmp.mod145.not = icmp eq i64 %xtraiter142, 0
  br i1 %lcmp.mod145.not, label %._crit_edge95, label %._crit_edge95.epilog-lcssa

._crit_edge95.epilog-lcssa:                       ; preds = %._crit_edge95.unr-lcssa
  %82 = getelementptr inbounds [333 x [100100 x i64]], ptr @freq, i64 0, i64 %indvars.iv123, i64 %indvars.iv119.unr
  %83 = load i64, ptr %82, align 8, !tbaa !5
  %84 = add i64 %83, %.unr143
  store i64 %84, ptr %82, align 8, !tbaa !5
  %85 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %indvars.iv119.unr
  %86 = load i64, ptr %85, align 8, !tbaa !5
  %87 = mul i64 %86, %84
  %88 = add i64 %.unr144, %87
  br label %._crit_edge95

._crit_edge95:                                    ; preds = %._crit_edge95.unr-lcssa, %._crit_edge95.epilog-lcssa
  %.lcssa138 = phi i64 [ %.lcssa138.ph, %._crit_edge95.unr-lcssa ], [ %88, %._crit_edge95.epilog-lcssa ]
  store i64 %.lcssa138, ptr %68, align 8, !tbaa !5
  br label %89

89:                                               ; preds = %._crit_edge95, %.preheader
  %indvars.iv.next124 = add nuw nsw i64 %indvars.iv123, 1
  %90 = load i64, ptr @BLOCK, align 8, !tbaa !5
  %.not66.not = icmp ugt i64 %90, %indvars.iv123
  br i1 %.not66.not, label %.lr.ph99, label %._crit_edge100, !llvm.loop !15

91:                                               ; preds = %91, %.lr.ph94.new
  %92 = phi i64 [ %.pre127, %.lr.ph94.new ], [ %103, %91 ]
  %indvars.iv119 = phi i64 [ 1, %.lr.ph94.new ], [ %indvars.iv.next120.1, %91 ]
  %93 = phi i64 [ %.promoted, %.lr.ph94.new ], [ %107, %91 ]
  %niter148 = phi i64 [ 0, %.lr.ph94.new ], [ %niter148.next.1, %91 ]
  %94 = getelementptr inbounds [333 x [100100 x i64]], ptr @freq, i64 0, i64 %indvars.iv123, i64 %indvars.iv119
  %95 = load i64, ptr %94, align 8, !tbaa !5
  %96 = add i64 %95, %92
  store i64 %96, ptr %94, align 8, !tbaa !5
  %97 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %indvars.iv119
  %98 = load i64, ptr %97, align 8, !tbaa !5
  %99 = mul i64 %98, %96
  %100 = add i64 %93, %99
  %indvars.iv.next120 = add nuw nsw i64 %indvars.iv119, 1
  %101 = getelementptr inbounds [333 x [100100 x i64]], ptr @freq, i64 0, i64 %indvars.iv123, i64 %indvars.iv.next120
  %102 = load i64, ptr %101, align 8, !tbaa !5
  %103 = add i64 %102, %96
  store i64 %103, ptr %101, align 8, !tbaa !5
  %104 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %indvars.iv.next120
  %105 = load i64, ptr %104, align 8, !tbaa !5
  %106 = mul i64 %105, %103
  %107 = add i64 %100, %106
  %indvars.iv.next120.1 = add nuw nsw i64 %indvars.iv119, 2
  %niter148.next.1 = add i64 %niter148, 2
  %niter148.ncmp.1 = icmp eq i64 %niter148.next.1, %unroll_iter147
  br i1 %niter148.ncmp.1, label %._crit_edge95.unr-lcssa, label %91, !llvm.loop !16
}

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt4sqrtIyEN9__gnu_cxx11__enable_ifIXsr12__is_integerIT_EE7__valueEdE6__typeES2_(i64 noundef) local_unnamed_addr #2

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nounwind }

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

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


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