; LLVM IR from eyangch/competitive-programming :: Codeforces/1714 (e)

; 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
@A = external dso_local global [200000 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 i8, align 1
  %3 = alloca i8, align 1
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca i8, align 1
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i8, align 1
  %11 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %12 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %13 = getelementptr i8, ptr %12, i64 -24
  %14 = load i64, ptr %13, align 8
  %15 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %14
  %16 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %15, ptr noundef null)
  %17 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %18 = 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 %19

19:                                               ; preds = %189, %187, %0
  %20 = load i64, ptr @T, align 8, !tbaa !8
  %21 = add nsw i64 %20, -1
  store i64 %21, ptr @T, align 8, !tbaa !8
  %22 = icmp ne i64 %20, 0
  br i1 %22, label %23, label %190

23:                                               ; preds = %19
  %24 = 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)
  call void @llvm.lifetime.start.p0(i64 1, ptr %2) #6
  store i8 0, ptr %2, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #6
  store i8 0, ptr %3, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  store i64 0, ptr %4, align 8, !tbaa !8
  br label %25

25:                                               ; preds = %63, %23
  %26 = load i64, ptr %4, align 8, !tbaa !8
  %27 = load i64, ptr @N, align 8, !tbaa !8
  %28 = icmp slt i64 %26, %27
  br i1 %28, label %30, label %29

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

30:                                               ; preds = %25
  %31 = load i64, ptr %4, align 8, !tbaa !8
  %32 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %31
  %33 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %32)
  %34 = load i64, ptr %4, align 8, !tbaa !8
  %35 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %34
  %36 = load i64, ptr %35, align 8, !tbaa !8
  %37 = srem i64 %36, 10
  %38 = icmp eq i64 %37, 0
  br i1 %38, label %45, label %39

39:                                               ; preds = %30
  %40 = load i64, ptr %4, align 8, !tbaa !8
  %41 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %40
  %42 = load i64, ptr %41, align 8, !tbaa !8
  %43 = srem i64 %42, 10
  %44 = icmp eq i64 %43, 5
  br i1 %44, label %45, label %46

45:                                               ; preds = %39, %30
  store i8 1, ptr %3, align 1, !tbaa !11
  br label %47

46:                                               ; preds = %39
  store i8 1, ptr %2, align 1, !tbaa !11
  br label %47

47:                                               ; preds = %46, %45
  %48 = load i64, ptr %4, align 8, !tbaa !8
  %49 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %48
  %50 = load i64, ptr %49, align 8, !tbaa !8
  %51 = srem i64 %50, 2
  %52 = icmp eq i64 %51, 1
  br i1 %52, label %53, label %62

53:                                               ; preds = %47
  %54 = load i64, ptr %4, align 8, !tbaa !8
  %55 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %54
  %56 = load i64, ptr %55, align 8, !tbaa !8
  %57 = srem i64 %56, 10
  %58 = load i64, ptr %4, align 8, !tbaa !8
  %59 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %58
  %60 = load i64, ptr %59, align 8, !tbaa !8
  %61 = add nsw i64 %60, %57
  store i64 %61, ptr %59, align 8, !tbaa !8
  br label %62

62:                                               ; preds = %53, %47
  br label %63

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

66:                                               ; preds = %29
  %67 = load i8, ptr %3, align 1, !tbaa !11, !range !15, !noundef !16
  %68 = trunc i8 %67 to i1
  br i1 %68, label %69, label %75

69:                                               ; preds = %66
  %70 = load i8, ptr %2, align 1, !tbaa !11, !range !15, !noundef !16
  %71 = trunc i8 %70 to i1
  br i1 %71, label %72, label %75

72:                                               ; preds = %69
  %73 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  %74 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %73, i8 noundef signext 10)
  store i32 2, ptr %5, align 4
  br label %187, !llvm.loop !17

75:                                               ; preds = %69, %66
  %76 = load i8, ptr %3, align 1, !tbaa !11, !range !15, !noundef !16
  %77 = trunc i8 %76 to i1
  br i1 %77, label %78, label %129

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

79:                                               ; preds = %96, %78
  %80 = load i64, ptr %6, align 8, !tbaa !8
  %81 = load i64, ptr @N, align 8, !tbaa !8
  %82 = icmp slt i64 %80, %81
  br i1 %82, label %84, label %83

83:                                               ; preds = %79
  store i32 7, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  br label %99

84:                                               ; preds = %79
  %85 = load i64, ptr %6, align 8, !tbaa !8
  %86 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %85
  %87 = load i64, ptr %86, align 8, !tbaa !8
  %88 = srem i64 %87, 10
  %89 = icmp eq i64 %88, 5
  br i1 %89, label %90, label %95

90:                                               ; preds = %84
  %91 = load i64, ptr %6, align 8, !tbaa !8
  %92 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %91
  %93 = load i64, ptr %92, align 8, !tbaa !8
  %94 = add nsw i64 %93, 5
  store i64 %94, ptr %92, align 8, !tbaa !8
  br label %95

95:                                               ; preds = %90, %84
  br label %96

96:                                               ; preds = %95
  %97 = load i64, ptr %6, align 8, !tbaa !8
  %98 = add nsw i64 %97, 1
  store i64 %98, ptr %6, align 8, !tbaa !8
  br label %79, !llvm.loop !18

99:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #6
  store i8 1, ptr %7, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  store i64 1, ptr %8, align 8, !tbaa !8
  br label %100

100:                                              ; preds = %116, %99
  %101 = load i64, ptr %8, align 8, !tbaa !8
  %102 = load i64, ptr @N, align 8, !tbaa !8
  %103 = icmp slt i64 %101, %102
  br i1 %103, label %105, label %104

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

105:                                              ; preds = %100
  %106 = load i64, ptr %8, align 8, !tbaa !8
  %107 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %106
  %108 = load i64, ptr %107, align 8, !tbaa !8
  %109 = load i64, ptr %8, align 8, !tbaa !8
  %110 = sub nsw i64 %109, 1
  %111 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %110
  %112 = load i64, ptr %111, align 8, !tbaa !8
  %113 = icmp ne i64 %108, %112
  br i1 %113, label %114, label %115

114:                                              ; preds = %105
  store i8 0, ptr %7, align 1, !tbaa !11
  br label %115

115:                                              ; preds = %114, %105
  br label %116

116:                                              ; preds = %115
  %117 = load i64, ptr %8, align 8, !tbaa !8
  %118 = add nsw i64 %117, 1
  store i64 %118, ptr %8, align 8, !tbaa !8
  br label %100, !llvm.loop !19

119:                                              ; preds = %104
  %120 = load i8, ptr %7, align 1, !tbaa !11, !range !15, !noundef !16
  %121 = trunc i8 %120 to i1
  br i1 %121, label %122, label %125

122:                                              ; preds = %119
  %123 = 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)
  %124 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %123, i8 noundef signext 10)
  br label %128

125:                                              ; preds = %119
  %126 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  %127 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %126, i8 noundef signext 10)
  br label %128

128:                                              ; preds = %125, %122
  store i32 2, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #6
  br label %187

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

130:                                              ; preds = %151, %129
  %131 = load i64, ptr %9, align 8, !tbaa !8
  %132 = load i64, ptr @N, align 8, !tbaa !8
  %133 = icmp slt i64 %131, %132
  br i1 %133, label %135, label %134

134:                                              ; preds = %130
  store i32 13, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %154

135:                                              ; preds = %130
  %136 = load i64, ptr %9, align 8, !tbaa !8
  %137 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %136
  %138 = load i64, ptr %137, align 8, !tbaa !8
  %139 = srem i64 %138, 10
  %140 = icmp eq i64 %139, 6
  br i1 %140, label %141, label %146

141:                                              ; preds = %135
  %142 = load i64, ptr %9, align 8, !tbaa !8
  %143 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %142
  %144 = load i64, ptr %143, align 8, !tbaa !8
  %145 = add nsw i64 %144, 10
  store i64 %145, ptr %143, align 8, !tbaa !8
  br label %146

146:                                              ; preds = %141, %135
  %147 = load i64, ptr %9, align 8, !tbaa !8
  %148 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %147
  %149 = load i64, ptr %148, align 8, !tbaa !8
  %150 = sdiv i64 %149, 10
  store i64 %150, ptr %148, align 8, !tbaa !8
  br label %151

151:                                              ; preds = %146
  %152 = load i64, ptr %9, align 8, !tbaa !8
  %153 = add nsw i64 %152, 1
  store i64 %153, ptr %9, align 8, !tbaa !8
  br label %130, !llvm.loop !20

154:                                              ; preds = %134
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #6
  store i8 1, ptr %10, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  store i64 1, ptr %11, align 8, !tbaa !8
  br label %155

155:                                              ; preds = %173, %154
  %156 = load i64, ptr %11, align 8, !tbaa !8
  %157 = load i64, ptr @N, align 8, !tbaa !8
  %158 = icmp slt i64 %156, %157
  br i1 %158, label %160, label %159

159:                                              ; preds = %155
  store i32 16, ptr %5, align 4
  br label %176

160:                                              ; preds = %155
  %161 = load i64, ptr %11, align 8, !tbaa !8
  %162 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %161
  %163 = load i64, ptr %162, align 8, !tbaa !8
  %164 = srem i64 %163, 2
  %165 = load i64, ptr %11, align 8, !tbaa !8
  %166 = sub nsw i64 %165, 1
  %167 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %166
  %168 = load i64, ptr %167, align 8, !tbaa !8
  %169 = srem i64 %168, 2
  %170 = icmp ne i64 %164, %169
  br i1 %170, label %171, label %172

171:                                              ; preds = %160
  store i8 0, ptr %10, align 1, !tbaa !11
  store i32 16, ptr %5, align 4
  br label %176

172:                                              ; preds = %160
  br label %173

173:                                              ; preds = %172
  %174 = load i64, ptr %11, align 8, !tbaa !8
  %175 = add nsw i64 %174, 1
  store i64 %175, ptr %11, align 8, !tbaa !8
  br label %155, !llvm.loop !21

176:                                              ; preds = %171, %159
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br label %177

177:                                              ; preds = %176
  %178 = load i8, ptr %10, align 1, !tbaa !11, !range !15, !noundef !16
  %179 = trunc i8 %178 to i1
  br i1 %179, label %180, label %183

180:                                              ; preds = %177
  %181 = 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)
  %182 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %181, i8 noundef signext 10)
  br label %186

183:                                              ; preds = %177
  %184 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  %185 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %184, i8 noundef signext 10)
  br label %186

186:                                              ; preds = %183, %180
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #6
  store i32 0, ptr %5, align 4
  br label %187

187:                                              ; preds = %186, %128, %72
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %2) #6
  %188 = load i32, ptr %5, align 4
  switch i32 %188, label %192 [
    i32 0, label %189
    i32 2, label %19
  ]

189:                                              ; preds = %187
  br label %19, !llvm.loop !17

190:                                              ; preds = %19
  %191 = load i32, ptr %1, align 4
  ret i32 %191

192:                                              ; preds = %187
  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 = !{!12, !12, i64 0}
!12 = !{!"bool", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !14}
!21 = distinct !{!21, !14}


; 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
@A = external dso_local global [200000 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
  %.not66 = icmp eq i64 %8, 0
  br i1 %.not66, label %._crit_edge69, label %.lr.ph68

.lr.ph68:                                         ; preds = %0, %.critedge70
  %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 = load i64, ptr @N, align 8, !tbaa !8
  %12 = icmp sgt i64 %11, 0
  br i1 %12, label %.lr.ph, label %.critedge70

._crit_edge:                                      ; preds = %25
  br i1 %.138, label %29, label %.critedge.preheader

.critedge.preheader:                              ; preds = %._crit_edge
  %13 = icmp sgt i64 %27, 0
  br i1 %13, label %.lr.ph55, label %.critedge70

.lr.ph:                                           ; preds = %.lr.ph68, %25
  %.03651 = phi i64 [ %26, %25 ], [ 0, %.lr.ph68 ]
  %.03750 = phi i1 [ %.138, %25 ], [ false, %.lr.ph68 ]
  %.03949 = phi i1 [ %.140, %25 ], [ false, %.lr.ph68 ]
  %14 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %.03651
  %15 = 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) %14)
  %16 = load i64, ptr %14, align 8, !tbaa !8
  %17 = srem i64 %16, 10
  switch i64 %17, label %18 [
    i64 0, label %19
    i64 5, label %19
  ]

18:                                               ; preds = %.lr.ph
  br label %19

19:                                               ; preds = %.lr.ph, %.lr.ph, %18
  %.140 = phi i1 [ true, %18 ], [ %.03949, %.lr.ph ], [ %.03949, %.lr.ph ]
  %.138 = phi i1 [ %.03750, %18 ], [ true, %.lr.ph ], [ true, %.lr.ph ]
  %20 = and i64 %16, -9223372036854775807
  %21 = icmp eq i64 %20, 1
  br i1 %21, label %22, label %25

22:                                               ; preds = %19
  %23 = urem i64 %16, 10
  %24 = add nuw nsw i64 %23, %16
  store i64 %24, ptr %14, align 8, !tbaa !8
  br label %25

25:                                               ; preds = %19, %22
  %26 = add nuw nsw i64 %.03651, 1
  %27 = load i64, ptr @N, align 8, !tbaa !8
  %28 = icmp slt i64 %26, %27
  br i1 %28, label %.lr.ph, label %._crit_edge, !llvm.loop !11

29:                                               ; preds = %._crit_edge
  br i1 %.140, label %.critedge70, label %.preheader47, !llvm.loop !13

.preheader47:                                     ; preds = %29
  %30 = icmp sgt i64 %27, 0
  br i1 %30, label %.lr.ph60.preheader, label %.critedge70

.lr.ph60.preheader:                               ; preds = %.preheader47
  %31 = add nsw i64 %27, -1
  %xtraiter = and i64 %27, 1
  %32 = icmp eq i64 %31, 0
  br i1 %32, label %.preheader.unr-lcssa, label %.lr.ph60.preheader.new

.lr.ph60.preheader.new:                           ; preds = %.lr.ph60.preheader
  %unroll_iter = and i64 %27, 9223372036854775806
  br label %.lr.ph60

.preheader.unr-lcssa:                             ; preds = %54, %.lr.ph60.preheader
  %.03559.unr = phi i64 [ 0, %.lr.ph60.preheader ], [ %55, %54 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader, label %.lr.ph60.epil

.lr.ph60.epil:                                    ; preds = %.preheader.unr-lcssa
  %33 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %.03559.unr
  %34 = load i64, ptr %33, align 8, !tbaa !8
  %35 = srem i64 %34, 10
  %36 = icmp eq i64 %35, 5
  br i1 %36, label %37, label %.preheader

37:                                               ; preds = %.lr.ph60.epil
  %38 = add nsw i64 %34, 5
  store i64 %38, ptr %33, align 8, !tbaa !8
  br label %.preheader

.preheader:                                       ; preds = %.lr.ph60.epil, %37, %.preheader.unr-lcssa
  %.not86 = icmp eq i64 %27, 1
  br i1 %.not86, label %.critedge70, label %.lr.ph63.preheader

.lr.ph63.preheader:                               ; preds = %.preheader
  %.pre75 = load i64, ptr @A, align 16, !tbaa !8
  %39 = add nsw i64 %27, -2
  %xtraiter87 = and i64 %31, 3
  %40 = icmp ult i64 %39, 3
  br i1 %40, label %._crit_edge64.unr-lcssa, label %.lr.ph63.preheader.new

.lr.ph63.preheader.new:                           ; preds = %.lr.ph63.preheader
  %unroll_iter90 = and i64 %31, -4
  br label %.lr.ph63

.lr.ph60:                                         ; preds = %54, %.lr.ph60.preheader.new
  %.03559 = phi i64 [ 0, %.lr.ph60.preheader.new ], [ %55, %54 ]
  %niter = phi i64 [ 0, %.lr.ph60.preheader.new ], [ %niter.next.1, %54 ]
  %41 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %.03559
  %42 = load i64, ptr %41, align 16, !tbaa !8
  %43 = srem i64 %42, 10
  %44 = icmp eq i64 %43, 5
  br i1 %44, label %45, label %.lr.ph60.1

45:                                               ; preds = %.lr.ph60
  %46 = add nsw i64 %42, 5
  store i64 %46, ptr %41, align 16, !tbaa !8
  br label %.lr.ph60.1

.lr.ph60.1:                                       ; preds = %.lr.ph60, %45
  %47 = or disjoint i64 %.03559, 1
  %48 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %47
  %49 = load i64, ptr %48, align 8, !tbaa !8
  %50 = srem i64 %49, 10
  %51 = icmp eq i64 %50, 5
  br i1 %51, label %52, label %54

52:                                               ; preds = %.lr.ph60.1
  %53 = add nsw i64 %49, 5
  store i64 %53, ptr %48, align 8, !tbaa !8
  br label %54

54:                                               ; preds = %52, %.lr.ph60.1
  %55 = add nuw nsw i64 %.03559, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %.preheader.unr-lcssa, label %.lr.ph60, !llvm.loop !14

._crit_edge64.unr-lcssa:                          ; preds = %.lr.ph63, %.lr.ph63.preheader
  %spec.select.lcssa.ph = phi i1 [ poison, %.lr.ph63.preheader ], [ %spec.select.3, %.lr.ph63 ]
  %.unr = phi i64 [ %.pre75, %.lr.ph63.preheader ], [ %71, %.lr.ph63 ]
  %.03362.unr = phi i64 [ 1, %.lr.ph63.preheader ], [ %75, %.lr.ph63 ]
  %.03461.unr = phi i1 [ true, %.lr.ph63.preheader ], [ %spec.select.3, %.lr.ph63 ]
  %lcmp.mod88.not = icmp eq i64 %xtraiter87, 0
  br i1 %lcmp.mod88.not, label %._crit_edge64, label %.lr.ph63.epil

.lr.ph63.epil:                                    ; preds = %._crit_edge64.unr-lcssa, %.lr.ph63.epil
  %56 = phi i64 [ %58, %.lr.ph63.epil ], [ %.unr, %._crit_edge64.unr-lcssa ]
  %.03362.epil = phi i64 [ %59, %.lr.ph63.epil ], [ %.03362.unr, %._crit_edge64.unr-lcssa ]
  %.03461.epil = phi i1 [ %spec.select.epil, %.lr.ph63.epil ], [ %.03461.unr, %._crit_edge64.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph63.epil ], [ 0, %._crit_edge64.unr-lcssa ]
  %57 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %.03362.epil
  %58 = load i64, ptr %57, align 8, !tbaa !8
  %.not44.epil = icmp eq i64 %58, %56
  %spec.select.epil = select i1 %.not44.epil, i1 %.03461.epil, i1 false
  %59 = add nuw nsw i64 %.03362.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter87
  br i1 %epil.iter.cmp.not, label %._crit_edge64, label %.lr.ph63.epil, !llvm.loop !15

._crit_edge64:                                    ; preds = %.lr.ph63.epil, %._crit_edge64.unr-lcssa
  %spec.select.lcssa = phi i1 [ %spec.select.lcssa.ph, %._crit_edge64.unr-lcssa ], [ %spec.select.epil, %.lr.ph63.epil ]
  %spec.select85 = select i1 %spec.select.lcssa, ptr @.str.1, ptr @.str
  br label %.critedge70

.lr.ph63:                                         ; preds = %.lr.ph63, %.lr.ph63.preheader.new
  %60 = phi i64 [ %.pre75, %.lr.ph63.preheader.new ], [ %71, %.lr.ph63 ]
  %.03362 = phi i64 [ 1, %.lr.ph63.preheader.new ], [ %75, %.lr.ph63 ]
  %.03461 = phi i1 [ true, %.lr.ph63.preheader.new ], [ %spec.select.3, %.lr.ph63 ]
  %niter91 = phi i64 [ 0, %.lr.ph63.preheader.new ], [ %niter91.next.3, %.lr.ph63 ]
  %61 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %.03362
  %62 = load i64, ptr %61, align 8, !tbaa !8
  %.not44 = icmp eq i64 %62, %60
  %63 = add nuw nsw i64 %.03362, 1
  %64 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %63
  %65 = load i64, ptr %64, align 8, !tbaa !8
  %.not44.1 = icmp eq i64 %65, %62
  %66 = add nuw nsw i64 %.03362, 2
  %67 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %66
  %68 = load i64, ptr %67, align 8, !tbaa !8
  %.not44.2 = icmp eq i64 %68, %65
  %69 = add nuw nsw i64 %.03362, 3
  %70 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %69
  %71 = load i64, ptr %70, align 8, !tbaa !8
  %.not44.3 = icmp eq i64 %71, %68
  %72 = select i1 %.not44.3, i1 %.not44.2, i1 false
  %73 = select i1 %72, i1 %.not44.1, i1 false
  %74 = select i1 %73, i1 %.not44, i1 false
  %spec.select.3 = select i1 %74, i1 %.03461, i1 false
  %75 = add nuw nsw i64 %.03362, 4
  %niter91.next.3 = add i64 %niter91, 4
  %niter91.ncmp.3 = icmp eq i64 %niter91.next.3, %unroll_iter90
  br i1 %niter91.ncmp.3, label %._crit_edge64.unr-lcssa, label %.lr.ph63, !llvm.loop !17

.preheader48:                                     ; preds = %.lr.ph55
  %.not4356.not = icmp eq i64 %27, 1
  br i1 %.not4356.not, label %.critedge70, label %.lr.ph58.preheader

.lr.ph58.preheader:                               ; preds = %.preheader48
  %.pre = load i64, ptr @A, align 16, !tbaa !8
  br label %.lr.ph58

.lr.ph55:                                         ; preds = %.critedge.preheader, %.lr.ph55
  %.03254 = phi i64 [ %82, %.lr.ph55 ], [ 0, %.critedge.preheader ]
  %76 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %.03254
  %77 = load i64, ptr %76, align 8, !tbaa !8
  %78 = srem i64 %77, 10
  %79 = icmp eq i64 %78, 6
  %80 = add nsw i64 %77, 10
  %spec.select84 = select i1 %79, i64 %80, i64 %77
  %81 = sdiv i64 %spec.select84, 10
  store i64 %81, ptr %76, align 8, !tbaa !8
  %82 = add nuw nsw i64 %.03254, 1
  %exitcond.not = icmp eq i64 %82, %27
  br i1 %exitcond.not, label %.preheader48, label %.lr.ph55, !llvm.loop !18

83:                                               ; preds = %.lr.ph58
  %84 = add nuw nsw i64 %.057, 1
  %exitcond72.not = icmp eq i64 %84, %27
  br i1 %exitcond72.not, label %.critedge70, label %.lr.ph58, !llvm.loop !19

.lr.ph58:                                         ; preds = %.lr.ph58.preheader, %83
  %85 = phi i64 [ %87, %83 ], [ %.pre, %.lr.ph58.preheader ]
  %.057 = phi i64 [ %84, %83 ], [ 1, %.lr.ph58.preheader ]
  %86 = getelementptr inbounds [200000 x i64], ptr @A, i64 0, i64 %.057
  %87 = load i64, ptr %86, align 8, !tbaa !8
  %88 = srem i64 %87, 2
  %89 = srem i64 %85, 2
  %.not42 = icmp eq i64 %88, %89
  br i1 %.not42, label %83, label %.critedge70

.critedge70:                                      ; preds = %.lr.ph58, %83, %._crit_edge64, %.preheader48, %.critedge.preheader, %.lr.ph68, %.preheader, %.preheader47, %29
  %.str.1.sink = phi ptr [ @.str, %29 ], [ @.str.1, %.preheader47 ], [ @.str.1, %.preheader ], [ @.str.1, %.lr.ph68 ], [ @.str.1, %.critedge.preheader ], [ @.str.1, %.preheader48 ], [ %spec.select85, %._crit_edge64 ], [ @.str.1, %83 ], [ @.str, %.lr.ph58 ]
  %90 = 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.1.sink)
  %91 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %90, i8 noundef signext 10)
  %92 = load i64, ptr @T, align 8, !tbaa !8
  %93 = add nsw i64 %92, -1
  store i64 %93, ptr @T, align 8, !tbaa !8
  %.not = icmp eq i64 %92, 0
  br i1 %.not, label %._crit_edge69, label %.lr.ph68

._crit_edge69:                                    ; preds = %.critedge70, %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, !16}
!16 = !{!"llvm.loop.unroll.disable"}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}


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