; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/279 Division 2/Problem C (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::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"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" }

@_Z1sB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@a = external dso_local global i32, align 4
@b = external dso_local global i32, align 4
@l = external dso_local global i32, align 4
@r1 = external dso_local global [1000000 x i32], align 16
@r2 = external dso_local global [1000000 x i32], 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 [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %9 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %10 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %11 = getelementptr i8, ptr %10, i64 -24
  %12 = load i64, ptr %11, align 8
  %13 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %12
  %14 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %13, ptr noundef null)
  %15 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %16 = getelementptr i8, ptr %15, i64 -24
  %17 = load i64, ptr %16, align 8
  %18 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %17
  %19 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %18, ptr noundef null)
  %20 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11)
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @a)
  %22 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %21, ptr noundef nonnull align 4 dereferenceable(4) @b)
  %23 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11) #5
  %24 = trunc i64 %23 to i32
  store i32 %24, ptr @l, align 4, !tbaa !8
  %25 = load i32, ptr @l, align 4, !tbaa !8
  %26 = icmp eq i32 %25, 1
  br i1 %26, label %27, label %29

27:                                               ; preds = %0
  %28 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  store i32 0, ptr %1, align 4
  br label %187

29:                                               ; preds = %0
  %30 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef 0)
  %31 = load i8, ptr %30, align 1, !tbaa !11
  %32 = sext i8 %31 to i32
  %33 = sub nsw i32 %32, 48
  %34 = load i32, ptr @a, align 4, !tbaa !8
  %35 = srem i32 %33, %34
  store i32 %35, ptr @r1, align 16, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1, ptr %2, align 4, !tbaa !8
  br label %36

36:                                               ; preds = %62, %29
  %37 = load i32, ptr %2, align 4, !tbaa !8
  %38 = load i32, ptr @l, align 4, !tbaa !8
  %39 = icmp slt i32 %37, %38
  br i1 %39, label %41, label %40

40:                                               ; preds = %36
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %65

41:                                               ; preds = %36
  %42 = load i32, ptr %2, align 4, !tbaa !8
  %43 = sub nsw i32 %42, 1
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [1000000 x i32], ptr @r1, i64 0, i64 %44
  %46 = load i32, ptr %45, align 4, !tbaa !8
  %47 = mul nsw i32 %46, 10
  %48 = load i32, ptr @a, align 4, !tbaa !8
  %49 = srem i32 %47, %48
  %50 = load i32, ptr %2, align 4, !tbaa !8
  %51 = sext i32 %50 to i64
  %52 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %51)
  %53 = load i8, ptr %52, align 1, !tbaa !11
  %54 = sext i8 %53 to i32
  %55 = sub nsw i32 %54, 48
  %56 = add nsw i32 %49, %55
  %57 = load i32, ptr @a, align 4, !tbaa !8
  %58 = srem i32 %56, %57
  %59 = load i32, ptr %2, align 4, !tbaa !8
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [1000000 x i32], ptr @r1, i64 0, i64 %60
  store i32 %58, ptr %61, align 4, !tbaa !8
  br label %62

62:                                               ; preds = %41
  %63 = load i32, ptr %2, align 4, !tbaa !8
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %2, align 4, !tbaa !8
  br label %36, !llvm.loop !12

65:                                               ; preds = %40
  %66 = load i32, ptr @l, align 4, !tbaa !8
  %67 = sub nsw i32 %66, 1
  %68 = sext i32 %67 to i64
  %69 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %68)
  %70 = load i8, ptr %69, align 1, !tbaa !11
  %71 = sext i8 %70 to i32
  %72 = sub nsw i32 %71, 48
  %73 = load i32, ptr @b, align 4, !tbaa !8
  %74 = srem i32 %72, %73
  %75 = load i32, ptr @l, align 4, !tbaa !8
  %76 = sub nsw i32 %75, 1
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [1000000 x i32], ptr @r2, i64 0, i64 %77
  store i32 %74, ptr %78, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 1, ptr %3, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  %79 = load i32, ptr @l, align 4, !tbaa !8
  %80 = sub nsw i32 %79, 2
  store i32 %80, ptr %4, align 4, !tbaa !8
  br label %81

81:                                               ; preds = %111, %65
  %82 = load i32, ptr %4, align 4, !tbaa !8
  %83 = icmp sge i32 %82, 0
  br i1 %83, label %85, label %84

84:                                               ; preds = %81
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %114

85:                                               ; preds = %81
  %86 = load i32, ptr %3, align 4, !tbaa !8
  %87 = mul nsw i32 %86, 10
  %88 = load i32, ptr @b, align 4, !tbaa !8
  %89 = srem i32 %87, %88
  store i32 %89, ptr %3, align 4, !tbaa !8
  %90 = load i32, ptr %3, align 4, !tbaa !8
  %91 = load i32, ptr %4, align 4, !tbaa !8
  %92 = sext i32 %91 to i64
  %93 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %92)
  %94 = load i8, ptr %93, align 1, !tbaa !11
  %95 = sext i8 %94 to i32
  %96 = sub nsw i32 %95, 48
  %97 = mul nsw i32 %90, %96
  %98 = load i32, ptr @b, align 4, !tbaa !8
  %99 = srem i32 %97, %98
  %100 = load i32, ptr %4, align 4, !tbaa !8
  %101 = add nsw i32 %100, 1
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [1000000 x i32], ptr @r2, i64 0, i64 %102
  %104 = load i32, ptr %103, align 4, !tbaa !8
  %105 = add nsw i32 %99, %104
  %106 = load i32, ptr @b, align 4, !tbaa !8
  %107 = srem i32 %105, %106
  %108 = load i32, ptr %4, align 4, !tbaa !8
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [1000000 x i32], ptr @r2, i64 0, i64 %109
  store i32 %107, ptr %110, align 4, !tbaa !8
  br label %111

111:                                              ; preds = %85
  %112 = load i32, ptr %4, align 4, !tbaa !8
  %113 = add nsw i32 %112, -1
  store i32 %113, ptr %4, align 4, !tbaa !8
  br label %81, !llvm.loop !14

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

115:                                              ; preds = %179, %114
  %116 = load i32, ptr %5, align 4, !tbaa !8
  %117 = load i32, ptr @l, align 4, !tbaa !8
  %118 = sub nsw i32 %117, 1
  %119 = icmp slt i32 %116, %118
  br i1 %119, label %121, label %120

120:                                              ; preds = %115
  store i32 8, ptr %6, align 4
  br label %182

121:                                              ; preds = %115
  %122 = load i32, ptr %5, align 4, !tbaa !8
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [1000000 x i32], ptr @r1, i64 0, i64 %123
  %125 = load i32, ptr %124, align 4, !tbaa !8
  %126 = icmp eq i32 %125, 0
  br i1 %126, label %127, label %178

127:                                              ; preds = %121
  %128 = load i32, ptr %5, align 4, !tbaa !8
  %129 = add nsw i32 %128, 1
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [1000000 x i32], ptr @r2, i64 0, i64 %130
  %132 = load i32, ptr %131, align 4, !tbaa !8
  %133 = icmp eq i32 %132, 0
  br i1 %133, label %134, label %178

134:                                              ; preds = %127
  %135 = load i32, ptr %5, align 4, !tbaa !8
  %136 = add nsw i32 %135, 1
  %137 = sext i32 %136 to i64
  %138 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %137)
  %139 = load i8, ptr %138, align 1, !tbaa !11
  %140 = sext i8 %139 to i32
  %141 = icmp ne i32 %140, 48
  br i1 %141, label %142, label %178

142:                                              ; preds = %134
  %143 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.2)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !8
  br label %144

144:                                              ; preds = %155, %142
  %145 = load i32, ptr %7, align 4, !tbaa !8
  %146 = load i32, ptr %5, align 4, !tbaa !8
  %147 = icmp sle i32 %145, %146
  br i1 %147, label %149, label %148

148:                                              ; preds = %144
  store i32 11, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %158

149:                                              ; preds = %144
  %150 = load i32, ptr %7, align 4, !tbaa !8
  %151 = sext i32 %150 to i64
  %152 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %151)
  %153 = load i8, ptr %152, align 1, !tbaa !11
  %154 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext %153)
  br label %155

155:                                              ; preds = %149
  %156 = load i32, ptr %7, align 4, !tbaa !8
  %157 = add nsw i32 %156, 1
  store i32 %157, ptr %7, align 4, !tbaa !8
  br label %144, !llvm.loop !15

158:                                              ; preds = %148
  %159 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.3)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %160 = load i32, ptr %5, align 4, !tbaa !8
  %161 = add nsw i32 %160, 1
  store i32 %161, ptr %8, align 4, !tbaa !8
  br label %162

162:                                              ; preds = %173, %158
  %163 = load i32, ptr %8, align 4, !tbaa !8
  %164 = load i32, ptr @l, align 4, !tbaa !8
  %165 = icmp slt i32 %163, %164
  br i1 %165, label %167, label %166

166:                                              ; preds = %162
  store i32 14, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %176

167:                                              ; preds = %162
  %168 = load i32, ptr %8, align 4, !tbaa !8
  %169 = sext i32 %168 to i64
  %170 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %169)
  %171 = load i8, ptr %170, align 1, !tbaa !11
  %172 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext %171)
  br label %173

173:                                              ; preds = %167
  %174 = load i32, ptr %8, align 4, !tbaa !8
  %175 = add nsw i32 %174, 1
  store i32 %175, ptr %8, align 4, !tbaa !8
  br label %162, !llvm.loop !16

176:                                              ; preds = %166
  %177 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.3)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %6, align 4
  br label %182

178:                                              ; preds = %134, %127, %121
  br label %179

179:                                              ; preds = %178
  %180 = load i32, ptr %5, align 4, !tbaa !8
  %181 = add nsw i32 %180, 1
  store i32 %181, ptr %5, align 4, !tbaa !8
  br label %115, !llvm.loop !17

182:                                              ; preds = %176, %120
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  %183 = load i32, ptr %6, align 4
  switch i32 %183, label %186 [
    i32 8, label %184
  ]

184:                                              ; preds = %182
  %185 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %6, align 4
  br label %186

186:                                              ; preds = %184, %182
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %187

187:                                              ; preds = %186, %27
  %188 = load i32, ptr %1, align 4
  ret i32 %188
}

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) #1

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) #2 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) #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 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 = { 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 #4 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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, !6, i64 0}
!6 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!10, !10, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}
!17 = distinct !{!17, !13}


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

%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"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" }

@_Z1sB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@a = external dso_local global i32, align 4
@b = external dso_local global i32, align 4
@l = external dso_local local_unnamed_addr global i32, align 4
@r1 = external dso_local local_unnamed_addr global [1000000 x i32], align 16
@r2 = external dso_local local_unnamed_addr global [1000000 x i32], 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 [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1

; 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 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %3 = getelementptr i8, ptr %2, i64 -24
  %4 = load i64, ptr %3, align 8
  %5 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %4
  %6 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %5, ptr noundef null)
  %7 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %8 = getelementptr i8, ptr %7, i64 -24
  %9 = load i64, ptr %8, align 8
  %10 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %9
  %11 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %10, ptr noundef null)
  %12 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11)
  %13 = 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) @a)
  %14 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 4 dereferenceable(4) @b)
  %15 = tail call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11) #4
  %16 = trunc i64 %15 to i32
  store i32 %16, ptr @l, align 4, !tbaa !8
  %17 = icmp eq i32 %16, 1
  br i1 %17, label %._crit_edge51, label %18

18:                                               ; preds = %0
  %19 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef 0)
  %20 = load i8, ptr %19, align 1, !tbaa !11
  %21 = sext i8 %20 to i32
  %22 = add nsw i32 %21, -48
  %23 = load i32, ptr @a, align 4, !tbaa !8
  %24 = srem i32 %22, %23
  store i32 %24, ptr @r1, align 16, !tbaa !8
  %25 = load i32, ptr @l, align 4, !tbaa !8
  %26 = icmp sgt i32 %25, 1
  br i1 %26, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %18
  %.lcssa38 = phi i32 [ %25, %18 ], [ %54, %.lr.ph ]
  %27 = add nsw i32 %.lcssa38, -1
  %28 = sext i32 %27 to i64
  %29 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %28)
  %30 = load i8, ptr %29, align 1, !tbaa !11
  %31 = sext i8 %30 to i32
  %32 = add nsw i32 %31, -48
  %33 = load i32, ptr @b, align 4, !tbaa !8
  %34 = srem i32 %32, %33
  %35 = load i32, ptr @l, align 4, !tbaa !8
  %36 = add nsw i32 %35, -1
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [1000000 x i32], ptr @r2, i64 0, i64 %37
  store i32 %34, ptr %38, align 4, !tbaa !8
  %39 = icmp sgt i32 %35, 1
  br i1 %39, label %.lr.ph43.preheader, label %._crit_edge51

.lr.ph43.preheader:                               ; preds = %._crit_edge
  %40 = add nsw i32 %35, -2
  %41 = zext nneg i32 %40 to i64
  br label %.lr.ph43

.lr.ph:                                           ; preds = %18, %.lr.ph
  %42 = phi i32 [ %51, %.lr.ph ], [ %23, %18 ]
  %43 = phi i32 [ %52, %.lr.ph ], [ %24, %18 ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %18 ]
  %44 = mul nsw i32 %43, 10
  %45 = srem i32 %44, %42
  %46 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %indvars.iv)
  %47 = load i8, ptr %46, align 1, !tbaa !11
  %48 = sext i8 %47 to i32
  %49 = add i32 %45, -48
  %50 = add i32 %49, %48
  %51 = load i32, ptr @a, align 4, !tbaa !8
  %52 = srem i32 %50, %51
  %53 = getelementptr inbounds [1000000 x i32], ptr @r1, i64 0, i64 %indvars.iv
  store i32 %52, ptr %53, align 4, !tbaa !8
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %54 = load i32, ptr @l, align 4, !tbaa !8
  %55 = sext i32 %54 to i64
  %56 = icmp slt i64 %indvars.iv.next, %55
  br i1 %56, label %.lr.ph, label %._crit_edge, !llvm.loop !12

.preheader:                                       ; preds = %.lr.ph43
  %.pre = load i32, ptr @l, align 4, !tbaa !8
  %.not3644 = icmp sgt i32 %.pre, 1
  br i1 %.not3644, label %.lr.ph46, label %._crit_edge51

.lr.ph43:                                         ; preds = %.lr.ph43.preheader, %.lr.ph43
  %57 = phi i32 [ %33, %.lr.ph43.preheader ], [ %65, %.lr.ph43 ]
  %indvars.iv55 = phi i64 [ %41, %.lr.ph43.preheader ], [ %indvars.iv.next56, %.lr.ph43 ]
  %.03140 = phi i32 [ 1, %.lr.ph43.preheader ], [ %59, %.lr.ph43 ]
  %58 = mul nsw i32 %.03140, 10
  %59 = srem i32 %58, %57
  %60 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %indvars.iv55)
  %61 = load i8, ptr %60, align 1, !tbaa !11
  %62 = sext i8 %61 to i32
  %63 = add nsw i32 %62, -48
  %64 = mul nsw i32 %63, %59
  %65 = load i32, ptr @b, align 4, !tbaa !8
  %66 = srem i32 %64, %65
  %67 = add nuw nsw i64 %indvars.iv55, 1
  %68 = getelementptr inbounds [1000000 x i32], ptr @r2, i64 0, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !8
  %70 = add nsw i32 %69, %66
  %71 = srem i32 %70, %65
  %72 = getelementptr inbounds [1000000 x i32], ptr @r2, i64 0, i64 %indvars.iv55
  store i32 %71, ptr %72, align 4, !tbaa !8
  %indvars.iv.next56 = add nsw i64 %indvars.iv55, -1
  %.not80 = icmp eq i64 %indvars.iv55, 0
  br i1 %.not80, label %.preheader, label %.lr.ph43, !llvm.loop !14

.lr.ph46:                                         ; preds = %.preheader, %.lr.ph46._crit_edge
  %73 = phi i32 [ %102, %.lr.ph46._crit_edge ], [ %.pre, %.preheader ]
  %indvars.iv67 = phi i64 [ %indvars.iv.next68, %.lr.ph46._crit_edge ], [ 1, %.preheader ]
  %indvars.iv64 = phi i32 [ %indvars.iv.next65, %.lr.ph46._crit_edge ], [ 1, %.preheader ]
  %indvars.iv58 = phi i64 [ %77, %.lr.ph46._crit_edge ], [ 0, %.preheader ]
  %74 = getelementptr inbounds [1000000 x i32], ptr @r1, i64 0, i64 %indvars.iv58
  %75 = load i32, ptr %74, align 4, !tbaa !8
  %76 = icmp eq i32 %75, 0
  %77 = add nuw nsw i64 %indvars.iv58, 1
  br i1 %76, label %78, label %.lr.ph46._crit_edge

78:                                               ; preds = %.lr.ph46
  %79 = getelementptr inbounds [1000000 x i32], ptr @r2, i64 0, i64 %77
  %80 = load i32, ptr %79, align 4, !tbaa !8
  %81 = icmp eq i32 %80, 0
  br i1 %81, label %82, label %.lr.ph46._crit_edge

82:                                               ; preds = %78
  %83 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %77)
  %84 = load i8, ptr %83, align 1, !tbaa !11
  %.not = icmp eq i8 %84, 48
  br i1 %.not, label %._crit_edge73, label %85

._crit_edge73:                                    ; preds = %82
  %.pre74 = load i32, ptr @l, align 4, !tbaa !8
  br label %.lr.ph46._crit_edge

85:                                               ; preds = %82
  %86 = 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.2)
  %wide.trip.count = zext nneg i32 %indvars.iv64 to i64
  br label %92

87:                                               ; preds = %92
  %88 = trunc nuw nsw i64 %77 to i32
  %89 = 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.3)
  %90 = load i32, ptr @l, align 4, !tbaa !8
  %91 = icmp sgt i32 %90, %88
  br i1 %91, label %.lr.ph50, label %._crit_edge51

92:                                               ; preds = %85, %92
  %indvars.iv61 = phi i64 [ 0, %85 ], [ %indvars.iv.next62, %92 ]
  %93 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %indvars.iv61)
  %94 = load i8, ptr %93, align 1, !tbaa !11
  %95 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext %94)
  %indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next62, %wide.trip.count
  br i1 %exitcond.not, label %87, label %92, !llvm.loop !15

.lr.ph50:                                         ; preds = %87, %.lr.ph50
  %indvars.iv70 = phi i64 [ %indvars.iv.next71, %.lr.ph50 ], [ %indvars.iv67, %87 ]
  %96 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %indvars.iv70)
  %97 = load i8, ptr %96, align 1, !tbaa !11
  %98 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext %97)
  %indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
  %99 = load i32, ptr @l, align 4, !tbaa !8
  %100 = sext i32 %99 to i64
  %101 = icmp slt i64 %indvars.iv.next71, %100
  br i1 %101, label %.lr.ph50, label %._crit_edge51, !llvm.loop !16

.lr.ph46._crit_edge:                              ; preds = %.lr.ph46, %._crit_edge73, %78
  %102 = phi i32 [ %.pre74, %._crit_edge73 ], [ %73, %78 ], [ %73, %.lr.ph46 ]
  %103 = add nsw i32 %102, -1
  %104 = sext i32 %103 to i64
  %.not36 = icmp slt i64 %77, %104
  %indvars.iv.next65 = add nuw nsw i32 %indvars.iv64, 1
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  br i1 %.not36, label %.lr.ph46, label %._crit_edge51, !llvm.loop !17

._crit_edge51:                                    ; preds = %.lr.ph46._crit_edge, %.lr.ph50, %.preheader, %._crit_edge, %87, %0
  %.str.3.sink = phi ptr [ @.str, %0 ], [ @.str.3, %87 ], [ @.str, %._crit_edge ], [ @.str, %.preheader ], [ @.str.3, %.lr.ph50 ], [ @.str, %.lr.ph46._crit_edge ]
  %105 = 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.3.sink)
  ret i32 0
}

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) 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

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) local_unnamed_addr #2 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 #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 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 = { 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 #4 = { nounwind }

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

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


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