; LLVM IR from eyangch/competitive-programming :: Codeforces/1696 (c)

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

@T = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@a = external dso_local global [50000 x i64], align 16
@K = external dso_local global i64, align 8
@b = external dso_local global [50000 x i64], align 16
@asp = external dso_local global [50000 x i64], align 16
@arm = external dso_local global [50000 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i8, align 1
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  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 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %20 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @T)
  br label %21

21:                                               ; preds = %235, %233, %0
  %22 = load i64, ptr @T, align 8, !tbaa !8
  %23 = add nsw i64 %22, -1
  store i64 %23, ptr @T, align 8, !tbaa !8
  %24 = icmp ne i64 %22, 0
  br i1 %24, label %25, label %236

25:                                               ; preds = %21
  %26 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %27 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %26, ptr noundef nonnull align 8 dereferenceable(8) @M)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #6
  store i64 0, ptr %2, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  store i64 0, ptr %3, align 8, !tbaa !8
  br label %28

28:                                               ; preds = %42, %25
  %29 = load i64, ptr %3, align 8, !tbaa !8
  %30 = load i64, ptr @N, align 8, !tbaa !8
  %31 = icmp slt i64 %29, %30
  br i1 %31, label %33, label %32

32:                                               ; preds = %28
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  br label %45

33:                                               ; preds = %28
  %34 = load i64, ptr %3, align 8, !tbaa !8
  %35 = getelementptr inbounds [50000 x i64], ptr @a, i64 0, i64 %34
  %36 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %35)
  %37 = load i64, ptr %3, align 8, !tbaa !8
  %38 = getelementptr inbounds [50000 x i64], ptr @a, i64 0, i64 %37
  %39 = load i64, ptr %38, align 8, !tbaa !8
  %40 = load i64, ptr %2, align 8, !tbaa !8
  %41 = add nsw i64 %40, %39
  store i64 %41, ptr %2, align 8, !tbaa !8
  br label %42

42:                                               ; preds = %33
  %43 = load i64, ptr %3, align 8, !tbaa !8
  %44 = add nsw i64 %43, 1
  store i64 %44, ptr %3, align 8, !tbaa !8
  br label %28, !llvm.loop !11

45:                                               ; preds = %32
  %46 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @K)
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  store i64 0, ptr %4, align 8, !tbaa !8
  br label %47

47:                                               ; preds = %61, %45
  %48 = load i64, ptr %4, align 8, !tbaa !8
  %49 = load i64, ptr @K, align 8, !tbaa !8
  %50 = icmp slt i64 %48, %49
  br i1 %50, label %52, label %51

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

52:                                               ; preds = %47
  %53 = load i64, ptr %4, align 8, !tbaa !8
  %54 = getelementptr inbounds [50000 x i64], ptr @b, i64 0, i64 %53
  %55 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %54)
  %56 = load i64, ptr %4, align 8, !tbaa !8
  %57 = getelementptr inbounds [50000 x i64], ptr @b, i64 0, i64 %56
  %58 = load i64, ptr %57, align 8, !tbaa !8
  %59 = load i64, ptr %2, align 8, !tbaa !8
  %60 = sub nsw i64 %59, %58
  store i64 %60, ptr %2, align 8, !tbaa !8
  br label %61

61:                                               ; preds = %52
  %62 = load i64, ptr %4, align 8, !tbaa !8
  %63 = add nsw i64 %62, 1
  store i64 %63, ptr %4, align 8, !tbaa !8
  br label %47, !llvm.loop !13

64:                                               ; preds = %51
  %65 = load i64, ptr %2, align 8, !tbaa !8
  %66 = icmp ne i64 %65, 0
  br i1 %66, label %67, label %70

67:                                               ; preds = %64
  %68 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  %69 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %68, i8 noundef signext 10)
  store i32 2, ptr %5, align 4
  br label %233, !llvm.loop !14

70:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  store i64 0, ptr %6, align 8, !tbaa !8
  br label %71

71:                                               ; preds = %103, %70
  %72 = load i64, ptr %6, align 8, !tbaa !8
  %73 = load i64, ptr @N, align 8, !tbaa !8
  %74 = icmp slt i64 %72, %73
  br i1 %74, label %76, label %75

75:                                               ; preds = %71
  store i32 10, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  br label %106

76:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %77 = load i64, ptr %6, align 8, !tbaa !8
  %78 = getelementptr inbounds [50000 x i64], ptr @a, i64 0, i64 %77
  %79 = load i64, ptr %78, align 8, !tbaa !8
  store i64 %79, ptr %7, align 8, !tbaa !8
  br label %80

80:                                               ; preds = %91, %76
  br label %81

81:                                               ; preds = %80
  %82 = load i64, ptr %7, align 8, !tbaa !8
  %83 = load i64, ptr @M, align 8, !tbaa !8
  %84 = srem i64 %82, %83
  %85 = icmp eq i64 %84, 0
  br i1 %85, label %86, label %90

86:                                               ; preds = %81
  %87 = load i64, ptr @M, align 8, !tbaa !8
  %88 = load i64, ptr %7, align 8, !tbaa !8
  %89 = sdiv i64 %88, %87
  store i64 %89, ptr %7, align 8, !tbaa !8
  br label %91

90:                                               ; preds = %81
  br label %92

91:                                               ; preds = %86
  br label %80, !llvm.loop !15

92:                                               ; preds = %90
  %93 = load i64, ptr %7, align 8, !tbaa !8
  %94 = load i64, ptr %6, align 8, !tbaa !8
  %95 = getelementptr inbounds [50000 x i64], ptr @asp, i64 0, i64 %94
  store i64 %93, ptr %95, align 8, !tbaa !8
  %96 = load i64, ptr %6, align 8, !tbaa !8
  %97 = getelementptr inbounds [50000 x i64], ptr @a, i64 0, i64 %96
  %98 = load i64, ptr %97, align 8, !tbaa !8
  %99 = load i64, ptr %7, align 8, !tbaa !8
  %100 = sdiv i64 %98, %99
  %101 = load i64, ptr %6, align 8, !tbaa !8
  %102 = getelementptr inbounds [50000 x i64], ptr @arm, i64 0, i64 %101
  store i64 %100, ptr %102, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  br label %103

103:                                              ; preds = %92
  %104 = load i64, ptr %6, align 8, !tbaa !8
  %105 = add nsw i64 %104, 1
  store i64 %105, ptr %6, align 8, !tbaa !8
  br label %71, !llvm.loop !16

106:                                              ; preds = %75
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  store i64 0, ptr %8, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #6
  store i8 0, ptr %9, align 1, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  store i64 0, ptr %10, align 8, !tbaa !8
  br label %107

107:                                              ; preds = %221, %106
  %108 = load i64, ptr %10, align 8, !tbaa !8
  %109 = load i64, ptr @K, align 8, !tbaa !8
  %110 = icmp slt i64 %108, %109
  br i1 %110, label %112, label %111

111:                                              ; preds = %107
  store i32 15, ptr %5, align 4
  br label %224

112:                                              ; preds = %107
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  store i64 0, ptr %11, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %113 = load i64, ptr %8, align 8, !tbaa !8
  %114 = getelementptr inbounds [50000 x i64], ptr @asp, i64 0, i64 %113
  %115 = load i64, ptr %114, align 8, !tbaa !8
  store i64 %115, ptr %12, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %116 = load i64, ptr %10, align 8, !tbaa !8
  %117 = getelementptr inbounds [50000 x i64], ptr @b, i64 0, i64 %116
  %118 = load i64, ptr %117, align 8, !tbaa !8
  %119 = load i64, ptr %12, align 8, !tbaa !8
  %120 = sdiv i64 %118, %119
  store i64 %120, ptr %13, align 8, !tbaa !8
  br label %121

121:                                              ; preds = %130, %112
  %122 = load i64, ptr %13, align 8, !tbaa !8
  %123 = icmp sgt i64 %122, 1
  br i1 %123, label %124, label %134

124:                                              ; preds = %121
  %125 = load i64, ptr %13, align 8, !tbaa !8
  %126 = load i64, ptr @M, align 8, !tbaa !8
  %127 = srem i64 %125, %126
  %128 = icmp ne i64 %127, 0
  br i1 %128, label %129, label %130

129:                                              ; preds = %124
  store i8 1, ptr %9, align 1, !tbaa !17
  br label %134

130:                                              ; preds = %124
  %131 = load i64, ptr @M, align 8, !tbaa !8
  %132 = load i64, ptr %13, align 8, !tbaa !8
  %133 = sdiv i64 %132, %131
  store i64 %133, ptr %13, align 8, !tbaa !8
  br label %121, !llvm.loop !19

134:                                              ; preds = %129, %121
  %135 = load i64, ptr %10, align 8, !tbaa !8
  %136 = getelementptr inbounds [50000 x i64], ptr @b, i64 0, i64 %135
  %137 = load i64, ptr %136, align 8, !tbaa !8
  %138 = load i64, ptr %12, align 8, !tbaa !8
  %139 = srem i64 %137, %138
  %140 = icmp ne i64 %139, 0
  br i1 %140, label %147, label %141

141:                                              ; preds = %134
  %142 = load i8, ptr %9, align 1, !tbaa !17, !range !20, !noundef !21
  %143 = trunc i8 %142 to i1
  br i1 %143, label %147, label %144

144:                                              ; preds = %141
  %145 = load i64, ptr %13, align 8, !tbaa !8
  %146 = icmp eq i64 %145, 0
  br i1 %146, label %147, label %150

147:                                              ; preds = %144, %141, %134
  %148 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  %149 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %148, i8 noundef signext 10)
  store i8 1, ptr %9, align 1, !tbaa !17
  store i32 15, ptr %5, align 4
  br label %218

150:                                              ; preds = %144
  br label %151

151:                                              ; preds = %207, %150
  %152 = load i64, ptr %11, align 8, !tbaa !8
  %153 = load i64, ptr %10, align 8, !tbaa !8
  %154 = getelementptr inbounds [50000 x i64], ptr @b, i64 0, i64 %153
  %155 = load i64, ptr %154, align 8, !tbaa !8
  %156 = icmp slt i64 %152, %155
  br i1 %156, label %157, label %208

157:                                              ; preds = %151
  %158 = load i64, ptr %8, align 8, !tbaa !8
  %159 = getelementptr inbounds [50000 x i64], ptr @asp, i64 0, i64 %158
  %160 = load i64, ptr %159, align 8, !tbaa !8
  %161 = load i64, ptr %12, align 8, !tbaa !8
  %162 = icmp ne i64 %160, %161
  br i1 %162, label %163, label %164

163:                                              ; preds = %157
  br label %208

164:                                              ; preds = %157
  %165 = load i64, ptr %10, align 8, !tbaa !8
  %166 = getelementptr inbounds [50000 x i64], ptr @b, i64 0, i64 %165
  %167 = load i64, ptr %166, align 8, !tbaa !8
  %168 = load i64, ptr %11, align 8, !tbaa !8
  %169 = sub nsw i64 %167, %168
  %170 = load i64, ptr %8, align 8, !tbaa !8
  %171 = getelementptr inbounds [50000 x i64], ptr @asp, i64 0, i64 %170
  %172 = load i64, ptr %171, align 8, !tbaa !8
  %173 = load i64, ptr %8, align 8, !tbaa !8
  %174 = getelementptr inbounds [50000 x i64], ptr @arm, i64 0, i64 %173
  %175 = load i64, ptr %174, align 8, !tbaa !8
  %176 = mul nsw i64 %172, %175
  %177 = icmp slt i64 %169, %176
  br i1 %177, label %178, label %195

178:                                              ; preds = %164
  %179 = load i64, ptr %10, align 8, !tbaa !8
  %180 = getelementptr inbounds [50000 x i64], ptr @b, i64 0, i64 %179
  %181 = load i64, ptr %180, align 8, !tbaa !8
  %182 = load i64, ptr %11, align 8, !tbaa !8
  %183 = sub nsw i64 %181, %182
  %184 = load i64, ptr %8, align 8, !tbaa !8
  %185 = getelementptr inbounds [50000 x i64], ptr @asp, i64 0, i64 %184
  %186 = load i64, ptr %185, align 8, !tbaa !8
  %187 = sdiv i64 %183, %186
  %188 = load i64, ptr %8, align 8, !tbaa !8
  %189 = getelementptr inbounds [50000 x i64], ptr @arm, i64 0, i64 %188
  %190 = load i64, ptr %189, align 8, !tbaa !8
  %191 = sub nsw i64 %190, %187
  store i64 %191, ptr %189, align 8, !tbaa !8
  %192 = load i64, ptr %10, align 8, !tbaa !8
  %193 = getelementptr inbounds [50000 x i64], ptr @b, i64 0, i64 %192
  %194 = load i64, ptr %193, align 8, !tbaa !8
  store i64 %194, ptr %11, align 8, !tbaa !8
  br label %207

195:                                              ; preds = %164
  %196 = load i64, ptr %8, align 8, !tbaa !8
  %197 = getelementptr inbounds [50000 x i64], ptr @arm, i64 0, i64 %196
  %198 = load i64, ptr %197, align 8, !tbaa !8
  %199 = load i64, ptr %8, align 8, !tbaa !8
  %200 = getelementptr inbounds [50000 x i64], ptr @asp, i64 0, i64 %199
  %201 = load i64, ptr %200, align 8, !tbaa !8
  %202 = mul nsw i64 %198, %201
  %203 = load i64, ptr %11, align 8, !tbaa !8
  %204 = add nsw i64 %203, %202
  store i64 %204, ptr %11, align 8, !tbaa !8
  %205 = load i64, ptr %8, align 8, !tbaa !8
  %206 = add nsw i64 %205, 1
  store i64 %206, ptr %8, align 8, !tbaa !8
  br label %207

207:                                              ; preds = %195, %178
  br label %151, !llvm.loop !22

208:                                              ; preds = %163, %151
  %209 = load i64, ptr %11, align 8, !tbaa !8
  %210 = load i64, ptr %10, align 8, !tbaa !8
  %211 = getelementptr inbounds [50000 x i64], ptr @b, i64 0, i64 %210
  %212 = load i64, ptr %211, align 8, !tbaa !8
  %213 = icmp ne i64 %209, %212
  br i1 %213, label %214, label %217

214:                                              ; preds = %208
  %215 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  %216 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %215, i8 noundef signext 10)
  store i8 1, ptr %9, align 1, !tbaa !17
  store i32 15, ptr %5, align 4
  br label %218

217:                                              ; preds = %208
  store i32 0, ptr %5, align 4
  br label %218

218:                                              ; preds = %217, %214, %147
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  %219 = load i32, ptr %5, align 4
  switch i32 %219, label %224 [
    i32 0, label %220
  ]

220:                                              ; preds = %218
  br label %221

221:                                              ; preds = %220
  %222 = load i64, ptr %10, align 8, !tbaa !8
  %223 = add nsw i64 %222, 1
  store i64 %223, ptr %10, align 8, !tbaa !8
  br label %107, !llvm.loop !23

224:                                              ; preds = %218, %111
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %225

225:                                              ; preds = %224
  %226 = load i8, ptr %9, align 1, !tbaa !17, !range !20, !noundef !21
  %227 = trunc i8 %226 to i1
  br i1 %227, label %228, label %229

228:                                              ; preds = %225
  store i32 2, ptr %5, align 4
  br label %232, !llvm.loop !14

229:                                              ; preds = %225
  %230 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.1)
  %231 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %230, i8 noundef signext 10)
  store i32 0, ptr %5, align 4
  br label %232

232:                                              ; preds = %229, %228
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %233

233:                                              ; preds = %232, %67
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  %234 = load i32, ptr %5, align 4
  switch i32 %234, label %238 [
    i32 0, label %235
    i32 2, label %21
  ]

235:                                              ; preds = %233
  br label %21, !llvm.loop !14

236:                                              ; preds = %21
  %237 = load i32, ptr %1, align 4
  ret i32 %237

238:                                              ; preds = %233
  unreachable
}

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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) #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) #5

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !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 = !{!18, !18, i64 0}
!18 = !{!"bool", !10, i64 0}
!19 = distinct !{!19, !12}
!20 = !{i8 0, i8 2}
!21 = !{}
!22 = distinct !{!22, !12}
!23 = distinct !{!23, !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 }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@T = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@a = external dso_local global [50000 x i64], align 16
@K = external dso_local global i64, align 8
@b = external dso_local global [50000 x i64], align 16
@asp = external dso_local local_unnamed_addr global [50000 x i64], align 16
@arm = external dso_local local_unnamed_addr global [50000 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %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 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %7 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @T)
  %8 = load i64, ptr @T, align 8, !tbaa !8
  %9 = add nsw i64 %8, -1
  store i64 %9, ptr @T, align 8, !tbaa !8
  %.not129 = icmp eq i64 %8, 0
  br i1 %.not129, label %._crit_edge132, label %.lr.ph131

.lr.ph131:                                        ; preds = %0, %.thread90
  %10 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %11 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull align 8 dereferenceable(8) @M)
  %12 = load i64, ptr @N, align 8, !tbaa !8
  %13 = icmp sgt i64 %12, 0
  br i1 %13, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph131
  %.056.lcssa = phi i64 [ 0, %.lr.ph131 ], [ %20, %.lr.ph ]
  %14 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @K)
  %15 = load i64, ptr @K, align 8, !tbaa !8
  %16 = icmp sgt i64 %15, 0
  br i1 %16, label %.lr.ph101, label %._crit_edge102

.lr.ph:                                           ; preds = %.lr.ph131, %.lr.ph
  %.05697 = phi i64 [ %20, %.lr.ph ], [ 0, %.lr.ph131 ]
  %.07096 = phi i64 [ %21, %.lr.ph ], [ 0, %.lr.ph131 ]
  %17 = getelementptr inbounds [50000 x i64], ptr @a, i64 0, i64 %.07096
  %18 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %17)
  %19 = load i64, ptr %17, align 8, !tbaa !8
  %20 = add nsw i64 %19, %.05697
  %21 = add nuw nsw i64 %.07096, 1
  %22 = load i64, ptr @N, align 8, !tbaa !8
  %23 = icmp slt i64 %21, %22
  br i1 %23, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge102:                                   ; preds = %.lr.ph101, %._crit_edge
  %24 = phi i64 [ %15, %._crit_edge ], [ %33, %.lr.ph101 ]
  %.1.lcssa = phi i64 [ %.056.lcssa, %._crit_edge ], [ %31, %.lr.ph101 ]
  %.not75 = icmp eq i64 %.1.lcssa, 0
  br i1 %.not75, label %.preheader94, label %.thread90, !llvm.loop !13

.preheader94:                                     ; preds = %._crit_edge102
  %25 = load i64, ptr @N, align 8, !tbaa !8
  %26 = icmp sgt i64 %25, 0
  br i1 %26, label %.lr.ph110, label %.preheader92

.lr.ph110:                                        ; preds = %.preheader94
  %27 = load i64, ptr @M, align 8, !tbaa !8
  br label %37

.lr.ph101:                                        ; preds = %._crit_edge, %.lr.ph101
  %.199 = phi i64 [ %31, %.lr.ph101 ], [ %.056.lcssa, %._crit_edge ]
  %.06998 = phi i64 [ %32, %.lr.ph101 ], [ 0, %._crit_edge ]
  %28 = getelementptr inbounds [50000 x i64], ptr @b, i64 0, i64 %.06998
  %29 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %28)
  %30 = load i64, ptr %28, align 8, !tbaa !8
  %31 = sub nsw i64 %.199, %30
  %32 = add nuw nsw i64 %.06998, 1
  %33 = load i64, ptr @K, align 8, !tbaa !8
  %34 = icmp slt i64 %32, %33
  br i1 %34, label %.lr.ph101, label %._crit_edge102, !llvm.loop !14

.preheader92:                                     ; preds = %._crit_edge107, %.preheader94
  %35 = icmp sgt i64 %24, 0
  br i1 %35, label %.lr.ph127, label %.thread90

.lr.ph127:                                        ; preds = %.preheader92
  %36 = load i64, ptr @M, align 8
  br label %51

37:                                               ; preds = %.lr.ph110, %._crit_edge107
  %.067109 = phi i64 [ 0, %.lr.ph110 ], [ %48, %._crit_edge107 ]
  %38 = getelementptr inbounds [50000 x i64], ptr @a, i64 0, i64 %.067109
  %39 = load i64, ptr %38, align 8, !tbaa !8
  %40 = srem i64 %39, %27
  %41 = icmp eq i64 %40, 0
  br i1 %41, label %.lr.ph106, label %._crit_edge107

.lr.ph106:                                        ; preds = %37, %.lr.ph106
  %.066104 = phi i64 [ %42, %.lr.ph106 ], [ %39, %37 ]
  %42 = sdiv i64 %.066104, %27
  %43 = srem i64 %42, %27
  %44 = icmp eq i64 %43, 0
  br i1 %44, label %.lr.ph106, label %._crit_edge107, !llvm.loop !15

._crit_edge107:                                   ; preds = %.lr.ph106, %37
  %.066.lcssa = phi i64 [ %39, %37 ], [ %42, %.lr.ph106 ]
  %45 = getelementptr inbounds [50000 x i64], ptr @asp, i64 0, i64 %.067109
  store i64 %.066.lcssa, ptr %45, align 8, !tbaa !8
  %46 = sdiv i64 %39, %.066.lcssa
  %47 = getelementptr inbounds [50000 x i64], ptr @arm, i64 0, i64 %.067109
  store i64 %46, ptr %47, align 8, !tbaa !8
  %48 = add nuw nsw i64 %.067109, 1
  %exitcond.not = icmp eq i64 %48, %25
  br i1 %exitcond.not, label %.preheader92, label %37, !llvm.loop !16

49:                                               ; preds = %._crit_edge119.thread, %._crit_edge119
  %.163.lcssa144 = phi i64 [ %.163116, %._crit_edge119.thread ], [ %.163.lcssa, %._crit_edge119 ]
  %50 = add nuw nsw i64 %.059126, 1
  %exitcond137.not = icmp eq i64 %50, %24
  br i1 %exitcond137.not, label %.thread90, label %51, !llvm.loop !17

51:                                               ; preds = %.lr.ph127, %49
  %.059126 = phi i64 [ 0, %.lr.ph127 ], [ %50, %49 ]
  %.062125 = phi i64 [ 0, %.lr.ph127 ], [ %.163.lcssa144, %49 ]
  %52 = getelementptr inbounds [50000 x i64], ptr @asp, i64 0, i64 %.062125
  %53 = load i64, ptr %52, align 8, !tbaa !8
  %54 = getelementptr inbounds [50000 x i64], ptr @b, i64 0, i64 %.059126
  %55 = load i64, ptr %54, align 8, !tbaa !8
  %56 = sdiv i64 %55, %53
  %57 = srem i64 %55, %53
  %58 = icmp sgt i64 %56, 1
  br i1 %58, label %.lr.ph113, label %._crit_edge114

.lr.ph113:                                        ; preds = %51, %61
  %.0111 = phi i64 [ %60, %61 ], [ %56, %51 ]
  %59 = srem i64 %.0111, %36
  %60 = sdiv i64 %.0111, %36
  %.not76 = icmp eq i64 %59, 0
  br i1 %.not76, label %61, label %.thread90

61:                                               ; preds = %.lr.ph113
  %62 = icmp sgt i64 %60, 1
  br i1 %62, label %.lr.ph113, label %._crit_edge114, !llvm.loop !18

._crit_edge114:                                   ; preds = %61, %51
  %.0.lcssa = phi i64 [ %56, %51 ], [ %60, %61 ]
  %.not77 = icmp ne i64 %57, 0
  %63 = icmp eq i64 %.0.lcssa, 0
  %or.cond81 = or i1 %63, %.not77
  br i1 %or.cond81, label %.thread90, label %.preheader

.preheader:                                       ; preds = %._crit_edge114
  %64 = icmp sgt i64 %55, 0
  br i1 %64, label %.lr.ph118, label %._crit_edge119

.lr.ph118:                                        ; preds = %.preheader, %76
  %.057117 = phi i64 [ %77, %76 ], [ 0, %.preheader ]
  %.163116 = phi i64 [ %78, %76 ], [ %.062125, %.preheader ]
  %65 = getelementptr inbounds [50000 x i64], ptr @asp, i64 0, i64 %.163116
  %66 = load i64, ptr %65, align 8, !tbaa !8
  %.not78 = icmp eq i64 %66, %53
  br i1 %.not78, label %67, label %._crit_edge119

67:                                               ; preds = %.lr.ph118
  %68 = sub nsw i64 %55, %.057117
  %69 = getelementptr inbounds [50000 x i64], ptr @arm, i64 0, i64 %.163116
  %70 = load i64, ptr %69, align 8, !tbaa !8
  %71 = mul nsw i64 %70, %53
  %72 = icmp slt i64 %68, %71
  br i1 %72, label %._crit_edge119.thread, label %76

._crit_edge119.thread:                            ; preds = %67
  %73 = getelementptr inbounds [50000 x i64], ptr @arm, i64 0, i64 %.163116
  %74 = sdiv i64 %68, %53
  %75 = sub nsw i64 %70, %74
  store i64 %75, ptr %73, align 8, !tbaa !8
  br label %49

76:                                               ; preds = %67
  %77 = add nsw i64 %71, %.057117
  %78 = add nsw i64 %.163116, 1
  %79 = icmp slt i64 %77, %55
  br i1 %79, label %.lr.ph118, label %._crit_edge119, !llvm.loop !19

._crit_edge119:                                   ; preds = %76, %.lr.ph118, %.preheader
  %.163.lcssa = phi i64 [ %.062125, %.preheader ], [ %.163116, %.lr.ph118 ], [ %78, %76 ]
  %.057.lcssa = phi i64 [ 0, %.preheader ], [ %.057117, %.lr.ph118 ], [ %77, %76 ]
  %.not79 = icmp eq i64 %.057.lcssa, %55
  br i1 %.not79, label %49, label %.thread90

.thread90:                                        ; preds = %49, %._crit_edge119, %._crit_edge114, %.lr.ph113, %.preheader92, %._crit_edge102
  %.str.sink = phi ptr [ @.str, %._crit_edge102 ], [ @.str.1, %.preheader92 ], [ @.str, %.lr.ph113 ], [ @.str, %._crit_edge114 ], [ @.str, %._crit_edge119 ], [ @.str.1, %49 ]
  %80 = tail 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.sink)
  %81 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %80, i8 noundef signext 10)
  %82 = load i64, ptr @T, align 8, !tbaa !8
  %83 = add nsw i64 %82, -1
  store i64 %83, ptr @T, align 8, !tbaa !8
  %.not = icmp eq i64 %82, 0
  br i1 %.not, label %._crit_edge132, label %.lr.ph131

._crit_edge132:                                   ; preds = %.thread90, %0
  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 #1 align 2

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

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

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

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

!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 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !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}
!19 = distinct !{!19, !12}


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