; LLVM IR from eyangch/competitive-programming :: Codeforces/1506 (f)

; 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 i32, align 4
@N = external dso_local global i32, align 4
@r = external dso_local global [200001 x i32], align 16
@c = external dso_local global [200001 x i32], align 16
@id = external dso_local global [200001 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 [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 %class.anon, align 1
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %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 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %16 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @T)
  br label %17

17:                                               ; preds = %164, %0
  %18 = load i32, ptr @T, align 4, !tbaa !8
  %19 = add nsw i32 %18, -1
  store i32 %19, ptr @T, align 4, !tbaa !8
  %20 = icmp ne i32 %18, 0
  br i1 %20, label %21, label %168

21:                                               ; preds = %17
  %22 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @N)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 0, ptr %2, align 4, !tbaa !8
  br label %23

23:                                               ; preds = %33, %21
  %24 = load i32, ptr %2, align 4, !tbaa !8
  %25 = load i32, ptr @N, align 4, !tbaa !8
  %26 = icmp slt i32 %24, %25
  br i1 %26, label %28, label %27

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

28:                                               ; preds = %23
  %29 = load i32, ptr %2, align 4, !tbaa !8
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [200001 x i32], ptr @r, i64 0, i64 %30
  %32 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %31)
  br label %33

33:                                               ; preds = %28
  %34 = load i32, ptr %2, align 4, !tbaa !8
  %35 = add nsw i32 %34, 1
  store i32 %35, ptr %2, align 4, !tbaa !8
  br label %23, !llvm.loop !11

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

37:                                               ; preds = %47, %36
  %38 = load i32, ptr %3, align 4, !tbaa !8
  %39 = load i32, ptr @N, align 4, !tbaa !8
  %40 = icmp slt i32 %38, %39
  br i1 %40, label %42, label %41

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

42:                                               ; preds = %37
  %43 = load i32, ptr %3, align 4, !tbaa !8
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [200001 x i32], ptr @c, i64 0, i64 %44
  %46 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %45)
  br label %47

47:                                               ; preds = %42
  %48 = load i32, ptr %3, align 4, !tbaa !8
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %3, align 4, !tbaa !8
  br label %37, !llvm.loop !13

50:                                               ; preds = %41
  %51 = load i32, ptr @N, align 4, !tbaa !8
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [200001 x i32], ptr @c, i64 0, i64 %52
  store i32 1, ptr %53, align 4, !tbaa !8
  %54 = load i32, ptr @N, align 4, !tbaa !8
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [200001 x i32], ptr @r, i64 0, i64 %55
  store i32 1, ptr %56, align 4, !tbaa !8
  %57 = load i32, ptr @N, align 4, !tbaa !8
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr @N, align 4, !tbaa !8
  %59 = load i32, ptr @N, align 4, !tbaa !8
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds i32, ptr @id, i64 %60
  call void @_ZSt4iotaIPiiEvT_S1_T0_(ptr noundef @id, ptr noundef %61, i32 noundef 0)
  %62 = load i32, ptr @N, align 4, !tbaa !8
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds i32, ptr @id, i64 %63
  call void @"_ZSt4sortIPiZ4mainE3$_0EvT_S2_T0_"(ptr noundef @id, ptr noundef %64)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 1, ptr %6, align 4, !tbaa !8
  br label %65

65:                                               ; preds = %161, %50
  %66 = load i32, ptr %6, align 4, !tbaa !8
  %67 = load i32, ptr @N, align 4, !tbaa !8
  %68 = icmp slt i32 %66, %67
  br i1 %68, label %70, label %69

69:                                               ; preds = %65
  store i32 10, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %164

70:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %71 = load i32, ptr %6, align 4, !tbaa !8
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [200001 x i32], ptr @id, i64 0, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !8
  store i32 %74, ptr %8, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %75 = load i32, ptr %6, align 4, !tbaa !8
  %76 = sub nsw i32 %75, 1
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [200001 x i32], ptr @id, i64 0, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !8
  store i32 %79, ptr %9, align 4, !tbaa !8
  %80 = load i32, ptr %8, align 4, !tbaa !8
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [200001 x i32], ptr @c, i64 0, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !8
  %84 = load i32, ptr %8, align 4, !tbaa !8
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [200001 x i32], ptr @r, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !8
  %88 = sub nsw i32 %83, %87
  %89 = load i32, ptr %9, align 4, !tbaa !8
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [200001 x i32], ptr @c, i64 0, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !8
  %93 = load i32, ptr %9, align 4, !tbaa !8
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [200001 x i32], ptr @r, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !8
  %97 = sub nsw i32 %92, %96
  %98 = icmp eq i32 %88, %97
  br i1 %98, label %99, label %124

99:                                               ; preds = %70
  %100 = load i32, ptr %8, align 4, !tbaa !8
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [200001 x i32], ptr @c, i64 0, i64 %101
  %103 = load i32, ptr %102, align 4, !tbaa !8
  %104 = load i32, ptr %8, align 4, !tbaa !8
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [200001 x i32], ptr @r, i64 0, i64 %105
  %107 = load i32, ptr %106, align 4, !tbaa !8
  %108 = add nsw i32 %103, %107
  %109 = srem i32 %108, 2
  %110 = icmp eq i32 %109, 0
  br i1 %110, label %111, label %123

111:                                              ; preds = %99
  %112 = load i32, ptr %8, align 4, !tbaa !8
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [200001 x i32], ptr @r, i64 0, i64 %113
  %115 = load i32, ptr %114, align 4, !tbaa !8
  %116 = load i32, ptr %9, align 4, !tbaa !8
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [200001 x i32], ptr @r, i64 0, i64 %117
  %119 = load i32, ptr %118, align 4, !tbaa !8
  %120 = sub nsw i32 %115, %119
  %121 = load i32, ptr %5, align 4, !tbaa !8
  %122 = add nsw i32 %121, %120
  store i32 %122, ptr %5, align 4, !tbaa !8
  br label %123

123:                                              ; preds = %111, %99
  store i32 12, ptr %7, align 4
  br label %158

124:                                              ; preds = %70
  %125 = load i32, ptr %8, align 4, !tbaa !8
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [200001 x i32], ptr @r, i64 0, i64 %126
  %128 = load i32, ptr %127, align 4, !tbaa !8
  %129 = load i32, ptr %9, align 4, !tbaa !8
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [200001 x i32], ptr @r, i64 0, i64 %130
  %132 = load i32, ptr %131, align 4, !tbaa !8
  %133 = sub nsw i32 %128, %132
  %134 = load i32, ptr %8, align 4, !tbaa !8
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [200001 x i32], ptr @c, i64 0, i64 %135
  %137 = load i32, ptr %136, align 4, !tbaa !8
  %138 = load i32, ptr %9, align 4, !tbaa !8
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [200001 x i32], ptr @c, i64 0, i64 %139
  %141 = load i32, ptr %140, align 4, !tbaa !8
  %142 = sub nsw i32 %137, %141
  %143 = sub nsw i32 %133, %142
  %144 = load i32, ptr %9, align 4, !tbaa !8
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [200001 x i32], ptr @r, i64 0, i64 %145
  %147 = load i32, ptr %146, align 4, !tbaa !8
  %148 = load i32, ptr %9, align 4, !tbaa !8
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [200001 x i32], ptr @c, i64 0, i64 %149
  %151 = load i32, ptr %150, align 4, !tbaa !8
  %152 = add nsw i32 %147, %151
  %153 = srem i32 %152, 2
  %154 = add nsw i32 %143, %153
  %155 = sdiv i32 %154, 2
  %156 = load i32, ptr %5, align 4, !tbaa !8
  %157 = add nsw i32 %156, %155
  store i32 %157, ptr %5, align 4, !tbaa !8
  store i32 0, ptr %7, align 4
  br label %158

158:                                              ; preds = %124, %123
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  %159 = load i32, ptr %7, align 4
  switch i32 %159, label %170 [
    i32 0, label %160
    i32 12, label %161
  ]

160:                                              ; preds = %158
  br label %161

161:                                              ; preds = %160, %158
  %162 = load i32, ptr %6, align 4, !tbaa !8
  %163 = add nsw i32 %162, 1
  store i32 %163, ptr %6, align 4, !tbaa !8
  br label %65, !llvm.loop !14

164:                                              ; preds = %69
  %165 = load i32, ptr %5, align 4, !tbaa !8
  %166 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %165)
  %167 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %166, ptr noundef @.str)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %17, !llvm.loop !15

168:                                              ; preds = %17
  %169 = load i32, ptr %1, align 4
  ret i32 %169

170:                                              ; preds = %158
  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

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt4sortIPiZ4mainE3$_0EvT_S2_T0_"(ptr noundef, ptr noundef) #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) #4

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !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 i32, align 4
@N = external dso_local global i32, align 4
@r = external dso_local global [200001 x i32], align 16
@c = external dso_local global [200001 x i32], align 16
@id = external dso_local global [200001 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 [2 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 @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @T)
  %8 = load i32, ptr @T, align 4, !tbaa !8
  %9 = add nsw i32 %8, -1
  store i32 %9, ptr @T, align 4, !tbaa !8
  %.not43 = icmp eq i32 %8, 0
  br i1 %.not43, label %._crit_edge46, label %.lr.ph45

.lr.ph45:                                         ; preds = %0, %._crit_edge41
  %10 = 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) @N)
  %11 = load i32, ptr @N, align 4, !tbaa !8
  %12 = icmp sgt i32 %11, 0
  br i1 %12, label %.lr.ph, label %.preheader.._crit_edge_crit_edge

.preheader:                                       ; preds = %.lr.ph
  %13 = icmp sgt i32 %17, 0
  br i1 %13, label %.lr.ph36, label %.preheader.._crit_edge_crit_edge

.preheader.._crit_edge_crit_edge:                 ; preds = %.lr.ph45, %.preheader
  %14 = phi i32 [ %17, %.preheader ], [ %11, %.lr.ph45 ]
  %.pre59 = sext i32 %14 to i64
  br label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph45, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph45 ]
  %15 = getelementptr inbounds [200001 x i32], ptr @r, i64 0, i64 %indvars.iv
  %16 = 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) %15)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %17 = load i32, ptr @N, align 4, !tbaa !8
  %18 = sext i32 %17 to i64
  %19 = icmp slt i64 %indvars.iv.next, %18
  br i1 %19, label %.lr.ph, label %.preheader, !llvm.loop !11

._crit_edge:                                      ; preds = %.lr.ph36, %.preheader.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre59, %.preheader.._crit_edge_crit_edge ], [ %33, %.lr.ph36 ]
  %.lcssa = phi i32 [ %14, %.preheader.._crit_edge_crit_edge ], [ %32, %.lr.ph36 ]
  %20 = getelementptr inbounds [200001 x i32], ptr @c, i64 0, i64 %.pre-phi
  store i32 1, ptr %20, align 4, !tbaa !8
  %21 = getelementptr inbounds [200001 x i32], ptr @r, i64 0, i64 %.pre-phi
  store i32 1, ptr %21, align 4, !tbaa !8
  %22 = add nsw i32 %.lcssa, 1
  store i32 %22, ptr @N, align 4, !tbaa !8
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds i32, ptr @id, i64 %23
  tail call void @_ZSt4iotaIPiiEvT_S1_T0_(ptr noundef nonnull @id, ptr noundef nonnull %24, i32 noundef 0)
  %25 = load i32, ptr @N, align 4, !tbaa !8
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds i32, ptr @id, i64 %26
  tail call void @"_ZSt4sortIPiZ4mainE3$_0EvT_S2_T0_"(ptr noundef nonnull @id, ptr noundef nonnull %27)
  %28 = load i32, ptr @N, align 4, !tbaa !8
  %29 = icmp sgt i32 %28, 1
  br i1 %29, label %.lr.ph40.preheader, label %._crit_edge41

.lr.ph40.preheader:                               ; preds = %._crit_edge
  %wide.trip.count = zext nneg i32 %28 to i64
  %.pre = load i32, ptr @id, align 16, !tbaa !8
  %.phi.trans.insert = sext i32 %.pre to i64
  %.phi.trans.insert55 = getelementptr inbounds [200001 x i32], ptr @c, i64 0, i64 %.phi.trans.insert
  %.pre56 = load i32, ptr %.phi.trans.insert55, align 4, !tbaa !8
  %.phi.trans.insert57 = getelementptr inbounds [200001 x i32], ptr @r, i64 0, i64 %.phi.trans.insert
  %.pre58 = load i32, ptr %.phi.trans.insert57, align 4, !tbaa !8
  br label %.lr.ph40

.lr.ph36:                                         ; preds = %.preheader, %.lr.ph36
  %indvars.iv49 = phi i64 [ %indvars.iv.next50, %.lr.ph36 ], [ 0, %.preheader ]
  %30 = getelementptr inbounds [200001 x i32], ptr @c, i64 0, i64 %indvars.iv49
  %31 = 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) %30)
  %indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1
  %32 = load i32, ptr @N, align 4, !tbaa !8
  %33 = sext i32 %32 to i64
  %34 = icmp slt i64 %indvars.iv.next50, %33
  br i1 %34, label %.lr.ph36, label %._crit_edge, !llvm.loop !13

._crit_edge41:                                    ; preds = %65, %._crit_edge
  %.030.lcssa = phi i32 [ 0, %._crit_edge ], [ %.2, %65 ]
  %35 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.030.lcssa)
  %36 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %35, ptr noundef nonnull @.str)
  %37 = load i32, ptr @T, align 4, !tbaa !8
  %38 = add nsw i32 %37, -1
  store i32 %38, ptr @T, align 4, !tbaa !8
  %.not = icmp eq i32 %37, 0
  br i1 %.not, label %._crit_edge46, label %.lr.ph45, !llvm.loop !14

.lr.ph40:                                         ; preds = %.lr.ph40.preheader, %65
  %39 = phi i32 [ %.pre58, %.lr.ph40.preheader ], [ %47, %65 ]
  %40 = phi i32 [ %.pre56, %.lr.ph40.preheader ], [ %45, %65 ]
  %indvars.iv52 = phi i64 [ 1, %.lr.ph40.preheader ], [ %indvars.iv.next53, %65 ]
  %.03037 = phi i32 [ 0, %.lr.ph40.preheader ], [ %.2, %65 ]
  %41 = getelementptr inbounds [200001 x i32], ptr @id, i64 0, i64 %indvars.iv52
  %42 = load i32, ptr %41, align 4, !tbaa !8
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [200001 x i32], ptr @c, i64 0, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !8
  %46 = getelementptr inbounds [200001 x i32], ptr @r, i64 0, i64 %43
  %47 = load i32, ptr %46, align 4, !tbaa !8
  %48 = sub nsw i32 %45, %47
  %49 = sub nsw i32 %40, %39
  %50 = icmp eq i32 %48, %49
  br i1 %50, label %51, label %57

51:                                               ; preds = %.lr.ph40
  %52 = add nsw i32 %47, %45
  %53 = and i32 %52, 1
  %54 = icmp eq i32 %53, 0
  %55 = sub nsw i32 %47, %39
  %56 = select i1 %54, i32 %55, i32 0
  br label %65

57:                                               ; preds = %.lr.ph40
  %58 = add nsw i32 %39, %40
  %59 = srem i32 %58, 2
  %60 = add i32 %47, %40
  %61 = add i32 %45, %39
  %62 = sub i32 %60, %61
  %63 = add nsw i32 %62, %59
  %64 = sdiv i32 %63, 2
  br label %65

65:                                               ; preds = %57, %51
  %.pn = phi i32 [ %56, %51 ], [ %64, %57 ]
  %.2 = add nsw i32 %.pn, %.03037
  %indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next53, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge41, label %.lr.ph40, !llvm.loop !15

._crit_edge46:                                    ; preds = %._crit_edge41, %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

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 #2

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

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

; 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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #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 = { 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 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}


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