; LLVM IR from eyangch/competitive-programming :: Codeforces/1513 (d)

; 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" }
%class.anon = type { i8 }

@T = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@P = external dso_local global i64, align 8
@a = external dso_local global [200000 x i64], align 16
@ids = external dso_local global [200000 x i64], align 16
@e = external dso_local global [200000 x i8], 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 [2 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 %class.anon, align 1
  %4 = alloca i8, align 1
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %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 = %147, %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 %156

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)
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %24, ptr noundef nonnull align 8 dereferenceable(8) @P)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #6
  store i64 0, ptr %2, align 8, !tbaa !8
  br label %26

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

30:                                               ; preds = %26
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  br label %38

31:                                               ; preds = %26
  %32 = load i64, ptr %2, align 8, !tbaa !8
  %33 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %32
  %34 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %33)
  br label %35

35:                                               ; preds = %31
  %36 = load i64, ptr %2, align 8, !tbaa !8
  %37 = add nsw i64 %36, 1
  store i64 %37, ptr %2, align 8, !tbaa !8
  br label %26, !llvm.loop !11

38:                                               ; preds = %30
  %39 = load i64, ptr @N, align 8, !tbaa !8
  %40 = getelementptr inbounds i64, ptr @ids, i64 %39
  call void @_ZSt4iotaIPxiEvT_S1_T0_(ptr noundef @ids, ptr noundef %40, i32 noundef 0)
  %41 = load i64, ptr @N, align 8, !tbaa !8
  %42 = getelementptr inbounds i64, ptr @ids, i64 %41
  call void @"_ZSt4sortIPxZ4mainE3$_0EvT_S2_T0_"(ptr noundef @ids, ptr noundef %42)
  %43 = load i64, ptr @N, align 8, !tbaa !8
  %44 = getelementptr inbounds i8, ptr @e, i64 %43
  call void @llvm.lifetime.start.p0(i64 1, ptr %4) #6
  store i8 0, ptr %4, align 1, !tbaa !13
  call void @_ZSt4fillIPbbEvT_S1_RKT0_(ptr noundef @e, ptr noundef %44, ptr noundef nonnull align 1 dereferenceable(1) %4)
  call void @llvm.lifetime.end.p0(i64 1, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  %45 = load i64, ptr @N, align 8, !tbaa !8
  %46 = sub nsw i64 %45, 1
  store i64 %46, ptr %5, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  store i64 0, ptr %6, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  store i64 0, ptr %7, align 8, !tbaa !8
  br label %47

47:                                               ; preds = %143, %38
  %48 = load i64, ptr %7, align 8, !tbaa !8
  %49 = load i64, ptr @N, align 8, !tbaa !8
  %50 = icmp slt i64 %48, %49
  br i1 %50, label %52, label %51

51:                                               ; preds = %47
  store i32 7, ptr %8, align 4
  br label %146

52:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %53 = load i64, ptr %7, align 8, !tbaa !8
  %54 = getelementptr inbounds [200000 x i64], ptr @ids, i64 0, i64 %53
  %55 = load i64, ptr %54, align 8, !tbaa !8
  store i64 %55, ptr %9, align 8, !tbaa !8
  %56 = load i64, ptr %9, align 8, !tbaa !8
  %57 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %56
  %58 = load i64, ptr %57, align 8, !tbaa !8
  %59 = load i64, ptr @P, align 8, !tbaa !8
  %60 = icmp sge i64 %58, %59
  br i1 %60, label %61, label %62

61:                                               ; preds = %52
  store i32 7, ptr %8, align 4
  br label %140

62:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %63 = load i64, ptr %9, align 8, !tbaa !8
  %64 = add nsw i64 %63, 1
  store i64 %64, ptr %10, align 8, !tbaa !8
  br label %65

65:                                               ; preds = %99, %62
  %66 = load i64, ptr %10, align 8, !tbaa !8
  %67 = load i64, ptr @N, align 8, !tbaa !8
  %68 = icmp slt i64 %66, %67
  br i1 %68, label %69, label %85

69:                                               ; preds = %65
  %70 = load i64, ptr %10, align 8, !tbaa !8
  %71 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %70
  %72 = load i64, ptr %71, align 8, !tbaa !8
  %73 = load i64, ptr %9, align 8, !tbaa !8
  %74 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %73
  %75 = load i64, ptr %74, align 8, !tbaa !8
  %76 = srem i64 %72, %75
  %77 = icmp eq i64 %76, 0
  br i1 %77, label %78, label %85

78:                                               ; preds = %69
  %79 = load i64, ptr %10, align 8, !tbaa !8
  %80 = sub nsw i64 %79, 1
  %81 = getelementptr inbounds [200000 x i8], ptr @e, i64 0, i64 %80
  %82 = load i8, ptr %81, align 1, !tbaa !13, !range !15, !noundef !16
  %83 = trunc i8 %82 to i1
  %84 = xor i1 %83, true
  br label %85

85:                                               ; preds = %78, %69, %65
  %86 = phi i1 [ false, %69 ], [ false, %65 ], [ %84, %78 ]
  br i1 %86, label %88, label %87

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

88:                                               ; preds = %85
  %89 = load i64, ptr %10, align 8, !tbaa !8
  %90 = sub nsw i64 %89, 1
  %91 = getelementptr inbounds [200000 x i8], ptr @e, i64 0, i64 %90
  store i8 1, ptr %91, align 1, !tbaa !13
  %92 = load i64, ptr %5, align 8, !tbaa !8
  %93 = add nsw i64 %92, -1
  store i64 %93, ptr %5, align 8, !tbaa !8
  %94 = load i64, ptr %9, align 8, !tbaa !8
  %95 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %94
  %96 = load i64, ptr %95, align 8, !tbaa !8
  %97 = load i64, ptr %6, align 8, !tbaa !8
  %98 = add nsw i64 %97, %96
  store i64 %98, ptr %6, align 8, !tbaa !8
  br label %99

99:                                               ; preds = %88
  %100 = load i64, ptr %10, align 8, !tbaa !8
  %101 = add nsw i64 %100, 1
  store i64 %101, ptr %10, align 8, !tbaa !8
  br label %65, !llvm.loop !17

102:                                              ; preds = %87
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %103 = load i64, ptr %9, align 8, !tbaa !8
  %104 = sub nsw i64 %103, 1
  store i64 %104, ptr %11, align 8, !tbaa !8
  br label %105

105:                                              ; preds = %136, %102
  %106 = load i64, ptr %11, align 8, !tbaa !8
  %107 = icmp sge i64 %106, 0
  br i1 %107, label %108, label %123

108:                                              ; preds = %105
  %109 = load i64, ptr %11, align 8, !tbaa !8
  %110 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %109
  %111 = load i64, ptr %110, align 8, !tbaa !8
  %112 = load i64, ptr %9, align 8, !tbaa !8
  %113 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %112
  %114 = load i64, ptr %113, align 8, !tbaa !8
  %115 = srem i64 %111, %114
  %116 = icmp eq i64 %115, 0
  br i1 %116, label %117, label %123

117:                                              ; preds = %108
  %118 = load i64, ptr %11, align 8, !tbaa !8
  %119 = getelementptr inbounds [200000 x i8], ptr @e, i64 0, i64 %118
  %120 = load i8, ptr %119, align 1, !tbaa !13, !range !15, !noundef !16
  %121 = trunc i8 %120 to i1
  %122 = xor i1 %121, true
  br label %123

123:                                              ; preds = %117, %108, %105
  %124 = phi i1 [ false, %108 ], [ false, %105 ], [ %122, %117 ]
  br i1 %124, label %126, label %125

125:                                              ; preds = %123
  store i32 13, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br label %139

126:                                              ; preds = %123
  %127 = load i64, ptr %11, align 8, !tbaa !8
  %128 = getelementptr inbounds [200000 x i8], ptr @e, i64 0, i64 %127
  store i8 1, ptr %128, align 1, !tbaa !13
  %129 = load i64, ptr %5, align 8, !tbaa !8
  %130 = add nsw i64 %129, -1
  store i64 %130, ptr %5, align 8, !tbaa !8
  %131 = load i64, ptr %9, align 8, !tbaa !8
  %132 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %131
  %133 = load i64, ptr %132, align 8, !tbaa !8
  %134 = load i64, ptr %6, align 8, !tbaa !8
  %135 = add nsw i64 %134, %133
  store i64 %135, ptr %6, align 8, !tbaa !8
  br label %136

136:                                              ; preds = %126
  %137 = load i64, ptr %11, align 8, !tbaa !8
  %138 = add nsw i64 %137, -1
  store i64 %138, ptr %11, align 8, !tbaa !8
  br label %105, !llvm.loop !18

139:                                              ; preds = %125
  store i32 0, ptr %8, align 4
  br label %140

140:                                              ; preds = %139, %61
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  %141 = load i32, ptr %8, align 4
  switch i32 %141, label %146 [
    i32 0, label %142
  ]

142:                                              ; preds = %140
  br label %143

143:                                              ; preds = %142
  %144 = load i64, ptr %7, align 8, !tbaa !8
  %145 = add nsw i64 %144, 1
  store i64 %145, ptr %7, align 8, !tbaa !8
  br label %47, !llvm.loop !19

146:                                              ; preds = %140, %51
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  br label %147

147:                                              ; preds = %146
  %148 = load i64, ptr %5, align 8, !tbaa !8
  %149 = load i64, ptr @P, align 8, !tbaa !8
  %150 = mul nsw i64 %148, %149
  %151 = load i64, ptr %6, align 8, !tbaa !8
  %152 = add nsw i64 %151, %150
  store i64 %152, ptr %6, align 8, !tbaa !8
  %153 = load i64, ptr %6, align 8, !tbaa !8
  %154 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %153)
  %155 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %154, ptr noundef @.str)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  br label %19, !llvm.loop !20

156:                                              ; preds = %19
  %157 = load i32, ptr %1, align 4
  ret i32 %157
}

; 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: mustprogress nounwind uwtable
declare dso_local void @_ZSt4iotaIPxiEvT_S1_T0_(ptr noundef, ptr noundef, i32 noundef) #1

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt4sortIPxZ4mainE3$_0EvT_S2_T0_"(ptr noundef, ptr noundef) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPbbEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) #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

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

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 = !{!14, !14, i64 0}
!14 = !{!"bool", !10, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !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
@P = external dso_local global i64, align 8
@a = external dso_local global [200000 x i64], align 16
@ids = external dso_local global [200000 x i64], align 16
@e = external dso_local global [200000 x i8], 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 [2 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i8, align 1
  %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 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %8 = 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)
  %9 = load i64, ptr @T, align 8, !tbaa !8
  %10 = add nsw i64 %9, -1
  store i64 %10, ptr @T, align 8, !tbaa !8
  %.not86 = icmp eq i64 %9, 0
  br i1 %.not86, label %._crit_edge89, label %.lr.ph88

.lr.ph88:                                         ; preds = %0, %.critedge2.thread
  %11 = 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)
  %12 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %11, ptr noundef nonnull align 8 dereferenceable(8) @P)
  %13 = load i64, ptr @N, align 8, !tbaa !8
  %14 = icmp sgt i64 %13, 0
  br i1 %14, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph88
  %.lcssa = phi i64 [ %13, %.lr.ph88 ], [ %26, %.lr.ph ]
  %15 = getelementptr inbounds i64, ptr @ids, i64 %.lcssa
  call void @_ZSt4iotaIPxiEvT_S1_T0_(ptr noundef nonnull @ids, ptr noundef nonnull %15, i32 noundef 0)
  %16 = load i64, ptr @N, align 8, !tbaa !8
  %17 = getelementptr inbounds i64, ptr @ids, i64 %16
  call void @"_ZSt4sortIPxZ4mainE3$_0EvT_S2_T0_"(ptr noundef nonnull @ids, ptr noundef nonnull %17)
  %18 = load i64, ptr @N, align 8, !tbaa !8
  %19 = getelementptr inbounds i8, ptr @e, i64 %18
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %1) #6
  store i8 0, ptr %1, align 1, !tbaa !11
  call void @_ZSt4fillIPbbEvT_S1_RKT0_(ptr noundef nonnull @e, ptr noundef nonnull %19, ptr noundef nonnull align 1 dereferenceable(1) %1)
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %1) #6
  %20 = load i64, ptr @N, align 8, !tbaa !8
  %21 = add nsw i64 %20, -1
  %22 = icmp sgt i64 %20, 0
  %.pre = load i64, ptr @P, align 8, !tbaa !8
  br i1 %22, label %.lr.ph80, label %.critedge2.thread

.lr.ph:                                           ; preds = %.lr.ph88, %.lr.ph
  %.03548 = phi i64 [ %25, %.lr.ph ], [ 0, %.lr.ph88 ]
  %23 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %.03548
  %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) %23)
  %25 = add nuw nsw i64 %.03548, 1
  %26 = load i64, ptr @N, align 8, !tbaa !8
  %27 = icmp slt i64 %25, %26
  br i1 %27, label %.lr.ph, label %._crit_edge, !llvm.loop !13

.lr.ph80:                                         ; preds = %._crit_edge, %.critedge2
  %.03778 = phi i64 [ %60, %.critedge2 ], [ 0, %._crit_edge ]
  %.03877 = phi i64 [ %.2.lcssa, %.critedge2 ], [ 0, %._crit_edge ]
  %.03976 = phi i64 [ %.241.lcssa, %.critedge2 ], [ %21, %._crit_edge ]
  %28 = getelementptr inbounds [200000 x i64], ptr @ids, i64 0, i64 %.03778
  %29 = load i64, ptr %28, align 8, !tbaa !8
  %30 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %29
  %31 = load i64, ptr %30, align 8, !tbaa !8
  %.not45 = icmp slt i64 %31, %.pre
  br i1 %.not45, label %.preheader, label %.critedge2.thread

.preheader:                                       ; preds = %.lr.ph80
  %.03449 = add nsw i64 %29, 1
  %32 = icmp slt i64 %.03449, %20
  br i1 %32, label %.lr.ph54, label %.critedge

.lr.ph54:                                         ; preds = %.preheader, %45
  %.03453 = phi i64 [ %.034, %45 ], [ %.03449, %.preheader ]
  %.034.in52 = phi i64 [ %.03453, %45 ], [ %29, %.preheader ]
  %.151 = phi i64 [ %47, %45 ], [ %.03877, %.preheader ]
  %.14050 = phi i64 [ %46, %45 ], [ %.03976, %.preheader ]
  %33 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %.03453
  %34 = load i64, ptr %33, align 8, !tbaa !8
  %35 = srem i64 %34, %31
  %36 = icmp eq i64 %35, 0
  br i1 %36, label %37, label %.critedge

37:                                               ; preds = %.lr.ph54
  %38 = getelementptr inbounds [200000 x i8], ptr @e, i64 0, i64 %.034.in52
  %39 = load i8, ptr %38, align 1, !tbaa !11, !range !15, !noundef !16
  %40 = trunc nuw i8 %39 to i1
  br i1 %40, label %.critedge, label %45

.critedge:                                        ; preds = %37, %45, %.lr.ph54, %.preheader
  %.140.lcssa = phi i64 [ %.03976, %.preheader ], [ %.14050, %.lr.ph54 ], [ %46, %45 ], [ %.14050, %37 ]
  %.1.lcssa = phi i64 [ %.03877, %.preheader ], [ %.151, %.lr.ph54 ], [ %47, %45 ], [ %.151, %37 ]
  %41 = icmp sgt i64 %29, 0
  br i1 %41, label %.lr.ph67.preheader, label %.critedge2

.lr.ph67.preheader:                               ; preds = %.critedge
  %42 = sub i64 %.140.lcssa, %29
  %43 = mul i64 %31, %29
  %44 = add i64 %.1.lcssa, %43
  br label %.lr.ph67

45:                                               ; preds = %37
  store i8 1, ptr %38, align 1, !tbaa !11
  %46 = add nsw i64 %.14050, -1
  %47 = add nsw i64 %.151, %31
  %.034 = add i64 %.03453, 1
  %exitcond.not = icmp eq i64 %.034, %20
  br i1 %exitcond.not, label %.critedge, label %.lr.ph54, !llvm.loop !17

.lr.ph67:                                         ; preds = %.lr.ph67.preheader, %56
  %.066.in = phi i64 [ %.066, %56 ], [ %29, %.lr.ph67.preheader ]
  %.265 = phi i64 [ %58, %56 ], [ %.1.lcssa, %.lr.ph67.preheader ]
  %.24164 = phi i64 [ %57, %56 ], [ %.140.lcssa, %.lr.ph67.preheader ]
  %.066 = add nsw i64 %.066.in, -1
  %48 = getelementptr inbounds [200000 x i64], ptr @a, i64 0, i64 %.066
  %49 = load i64, ptr %48, align 8, !tbaa !8
  %50 = srem i64 %49, %31
  %51 = icmp eq i64 %50, 0
  br i1 %51, label %52, label %.critedge2

52:                                               ; preds = %.lr.ph67
  %53 = getelementptr inbounds [200000 x i8], ptr @e, i64 0, i64 %.066
  %54 = load i8, ptr %53, align 1, !tbaa !11, !range !15, !noundef !16
  %55 = trunc nuw i8 %54 to i1
  br i1 %55, label %.critedge2, label %56

56:                                               ; preds = %52
  store i8 1, ptr %53, align 1, !tbaa !11
  %57 = add nsw i64 %.24164, -1
  %58 = add nsw i64 %.265, %31
  %59 = icmp ugt i64 %.066.in, 1
  br i1 %59, label %.lr.ph67, label %.critedge2, !llvm.loop !18

.critedge2:                                       ; preds = %.lr.ph67, %56, %52, %.critedge
  %.241.lcssa = phi i64 [ %.140.lcssa, %.critedge ], [ %.24164, %52 ], [ %42, %56 ], [ %.24164, %.lr.ph67 ]
  %.2.lcssa = phi i64 [ %.1.lcssa, %.critedge ], [ %.265, %52 ], [ %44, %56 ], [ %.265, %.lr.ph67 ]
  %60 = add nuw nsw i64 %.03778, 1
  %exitcond91.not = icmp eq i64 %60, %20
  br i1 %exitcond91.not, label %.critedge2.thread, label %.lr.ph80, !llvm.loop !19

.critedge2.thread:                                ; preds = %.critedge2, %.lr.ph80, %._crit_edge
  %.443 = phi i64 [ %21, %._crit_edge ], [ %.03976, %.lr.ph80 ], [ %.241.lcssa, %.critedge2 ]
  %.4 = phi i64 [ 0, %._crit_edge ], [ %.03877, %.lr.ph80 ], [ %.2.lcssa, %.critedge2 ]
  %61 = mul nsw i64 %.pre, %.443
  %62 = add nsw i64 %61, %.4
  %63 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %62)
  %64 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %63, ptr noundef nonnull @.str)
  %65 = load i64, ptr @T, align 8, !tbaa !8
  %66 = add nsw i64 %65, -1
  store i64 %66, ptr @T, align 8, !tbaa !8
  %.not = icmp eq i64 %65, 0
  br i1 %.not, label %._crit_edge89, label %.lr.ph88, !llvm.loop !20

._crit_edge89:                                    ; preds = %.critedge2.thread, %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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #4

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZSt4iotaIPxiEvT_S1_T0_(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt4sortIPxZ4mainE3$_0EvT_S2_T0_"(ptr noundef, ptr noundef) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPbbEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #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) local_unnamed_addr #5

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

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


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