; LLVM IR from tangjz/acm-icpc :: lydsy (2115)

; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, long long>, std::allocator<std::pair<int, long long>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, long long>, std::allocator<std::pair<int, long long>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, long long>, std::allocator<std::pair<int, long long>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, long long>, std::allocator<std::pair<int, long long>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { i32, i64 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@f = external dso_local global [50001 x i64], align 16
@g = external dso_local global [200001 x i64], align 16
@e = external dso_local global [50001 x %"class.std::vector"], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsi(i32 noundef) #0

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i64, align 8
  %5 = alloca %"struct.std::pair", align 8
  %6 = alloca %"struct.std::pair", align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i64, align 8
  %14 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  br label %16

16:                                               ; preds = %20, %0
  %17 = load i32, ptr @m, align 4, !tbaa !5
  %18 = add nsw i32 %17, -1
  store i32 %18, ptr @m, align 4, !tbaa !5
  %19 = icmp ne i32 %17, 0
  br i1 %19, label %20, label %38

20:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  %21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %2, ptr noundef %3, ptr noundef %4)
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [50001 x %"class.std::vector"], ptr @e, i64 0, i64 %23
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #6
  %25 = call { i32, i64 } @_ZSt9make_pairIRiRxESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %26 = getelementptr inbounds { i32, i64 }, ptr %5, i32 0, i32 0
  %27 = extractvalue { i32, i64 } %25, 0
  store i32 %27, ptr %26, align 8
  %28 = getelementptr inbounds { i32, i64 }, ptr %5, i32 0, i32 1
  %29 = extractvalue { i32, i64 } %25, 1
  store i64 %29, ptr %28, align 8
  call void @_ZNSt6vectorISt4pairIixESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %24, ptr noundef nonnull align 8 dereferenceable(16) %5)
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #6
  %30 = load i32, ptr %3, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [50001 x %"class.std::vector"], ptr @e, i64 0, i64 %31
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #6
  %33 = call { i32, i64 } @_ZSt9make_pairIRiRxESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %34 = getelementptr inbounds { i32, i64 }, ptr %6, i32 0, i32 0
  %35 = extractvalue { i32, i64 } %33, 0
  store i32 %35, ptr %34, align 8
  %36 = getelementptr inbounds { i32, i64 }, ptr %6, i32 0, i32 1
  %37 = extractvalue { i32, i64 } %33, 1
  store i64 %37, ptr %36, align 8
  call void @_ZNSt6vectorISt4pairIixESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %32, ptr noundef nonnull align 8 dereferenceable(16) %6)
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %16, !llvm.loop !9

38:                                               ; preds = %16
  store i32 0, ptr @m, align 4, !tbaa !5
  call void @_Z3dfsi(i32 noundef 1)
  %39 = load i32, ptr @m, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds i64, ptr @g, i64 %40
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef @g, ptr noundef %41)
  %42 = load i32, ptr @m, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds i64, ptr @g, i64 %43
  %45 = call noundef ptr @_ZSt6uniqueIPxET_S1_S1_(ptr noundef @g, ptr noundef %44)
  %46 = ptrtoint ptr %45 to i64
  %47 = sub i64 %46, ptrtoint (ptr @g to i64)
  %48 = sdiv exact i64 %47, 8
  %49 = trunc i64 %48 to i32
  store i32 %49, ptr @m, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 59, ptr %8, align 4, !tbaa !5
  br label %50

50:                                               ; preds = %128, %38
  %51 = load i32, ptr %8, align 4, !tbaa !5
  %52 = icmp sge i32 %51, 0
  br i1 %52, label %54, label %53

53:                                               ; preds = %50
  store i32 4, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %131

54:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 -1, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %55 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %55, ptr %11, align 4, !tbaa !5
  br label %56

56:                                               ; preds = %74, %54
  %57 = load i32, ptr %11, align 4, !tbaa !5
  %58 = load i32, ptr @m, align 4, !tbaa !5
  %59 = icmp slt i32 %57, %58
  br i1 %59, label %61, label %60

60:                                               ; preds = %56
  store i32 7, ptr %9, align 4
  br label %77

61:                                               ; preds = %56
  %62 = load i32, ptr %11, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [200001 x i64], ptr @g, i64 0, i64 %63
  %65 = load i64, ptr %64, align 8, !tbaa !11
  %66 = load i32, ptr %8, align 4, !tbaa !5
  %67 = zext i32 %66 to i64
  %68 = ashr i64 %65, %67
  %69 = and i64 %68, 1
  %70 = icmp ne i64 %69, 0
  br i1 %70, label %71, label %73

71:                                               ; preds = %61
  %72 = load i32, ptr %11, align 4, !tbaa !5
  store i32 %72, ptr %10, align 4, !tbaa !5
  store i32 7, ptr %9, align 4
  br label %77

73:                                               ; preds = %61
  br label %74

74:                                               ; preds = %73
  %75 = load i32, ptr %11, align 4, !tbaa !5
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %11, align 4, !tbaa !5
  br label %56, !llvm.loop !13

77:                                               ; preds = %71, %60
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %78

78:                                               ; preds = %77
  %79 = load i32, ptr %10, align 4, !tbaa !5
  %80 = icmp eq i32 %79, -1
  br i1 %80, label %81, label %82

81:                                               ; preds = %78
  store i32 6, ptr %9, align 4
  br label %125

82:                                               ; preds = %78
  %83 = load i32, ptr %7, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [200001 x i64], ptr @g, i64 0, i64 %84
  %86 = load i32, ptr %10, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [200001 x i64], ptr @g, i64 0, i64 %87
  call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) %85, ptr noundef nonnull align 8 dereferenceable(8) %88) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %89

89:                                               ; preds = %119, %82
  %90 = load i32, ptr %12, align 4, !tbaa !5
  %91 = load i32, ptr @m, align 4, !tbaa !5
  %92 = icmp slt i32 %90, %91
  br i1 %92, label %94, label %93

93:                                               ; preds = %89
  store i32 10, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %122

94:                                               ; preds = %89
  %95 = load i32, ptr %12, align 4, !tbaa !5
  %96 = load i32, ptr %7, align 4, !tbaa !5
  %97 = icmp ne i32 %95, %96
  br i1 %97, label %98, label %118

98:                                               ; preds = %94
  %99 = load i32, ptr %12, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [200001 x i64], ptr @g, i64 0, i64 %100
  %102 = load i64, ptr %101, align 8, !tbaa !11
  %103 = load i32, ptr %8, align 4, !tbaa !5
  %104 = zext i32 %103 to i64
  %105 = ashr i64 %102, %104
  %106 = and i64 %105, 1
  %107 = icmp ne i64 %106, 0
  br i1 %107, label %108, label %118

108:                                              ; preds = %98
  %109 = load i32, ptr %7, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [200001 x i64], ptr @g, i64 0, i64 %110
  %112 = load i64, ptr %111, align 8, !tbaa !11
  %113 = load i32, ptr %12, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [200001 x i64], ptr @g, i64 0, i64 %114
  %116 = load i64, ptr %115, align 8, !tbaa !11
  %117 = xor i64 %116, %112
  store i64 %117, ptr %115, align 8, !tbaa !11
  br label %118

118:                                              ; preds = %108, %98, %94
  br label %119

119:                                              ; preds = %118
  %120 = load i32, ptr %12, align 4, !tbaa !5
  %121 = add nsw i32 %120, 1
  store i32 %121, ptr %12, align 4, !tbaa !5
  br label %89, !llvm.loop !14

122:                                              ; preds = %93
  %123 = load i32, ptr %7, align 4, !tbaa !5
  %124 = add nsw i32 %123, 1
  store i32 %124, ptr %7, align 4, !tbaa !5
  store i32 0, ptr %9, align 4
  br label %125

125:                                              ; preds = %122, %81
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  %126 = load i32, ptr %9, align 4
  switch i32 %126, label %165 [
    i32 0, label %127
    i32 6, label %128
  ]

127:                                              ; preds = %125
  br label %128

128:                                              ; preds = %127, %125
  %129 = load i32, ptr %8, align 4, !tbaa !5
  %130 = add nsw i32 %129, -1
  store i32 %130, ptr %8, align 4, !tbaa !5
  br label %50, !llvm.loop !15

131:                                              ; preds = %53
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %132 = load i32, ptr @n, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [50001 x i64], ptr @f, i64 0, i64 %133
  %135 = load i64, ptr %134, align 8, !tbaa !11
  store i64 %135, ptr %13, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %136

136:                                              ; preds = %158, %131
  %137 = load i32, ptr %14, align 4, !tbaa !5
  %138 = load i32, ptr %7, align 4, !tbaa !5
  %139 = icmp slt i32 %137, %138
  br i1 %139, label %141, label %140

140:                                              ; preds = %136
  store i32 13, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %161

141:                                              ; preds = %136
  %142 = load i64, ptr %13, align 8, !tbaa !11
  %143 = load i64, ptr %13, align 8, !tbaa !11
  %144 = load i32, ptr %14, align 4, !tbaa !5
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [200001 x i64], ptr @g, i64 0, i64 %145
  %147 = load i64, ptr %146, align 8, !tbaa !11
  %148 = xor i64 %143, %147
  %149 = icmp slt i64 %142, %148
  br i1 %149, label %150, label %157

150:                                              ; preds = %141
  %151 = load i32, ptr %14, align 4, !tbaa !5
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [200001 x i64], ptr @g, i64 0, i64 %152
  %154 = load i64, ptr %153, align 8, !tbaa !11
  %155 = load i64, ptr %13, align 8, !tbaa !11
  %156 = xor i64 %155, %154
  store i64 %156, ptr %13, align 8, !tbaa !11
  br label %157

157:                                              ; preds = %150, %141
  br label %158

158:                                              ; preds = %157
  %159 = load i32, ptr %14, align 4, !tbaa !5
  %160 = add nsw i32 %159, 1
  store i32 %160, ptr %14, align 4, !tbaa !5
  br label %136, !llvm.loop !16

161:                                              ; preds = %140
  %162 = load i64, ptr %13, align 8, !tbaa !11
  %163 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i64 noundef %162)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  %164 = load i32, ptr %1, align 4
  ret i32 %164

165:                                              ; preds = %125
  unreachable
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorISt4pairIixESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(16)) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local { i32, i64 } @_ZSt9make_pairIRiRxESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 8 dereferenceable(8)) #0

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPxEvT_S1_(ptr noundef, ptr noundef) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt6uniqueIPxET_S1_S1_(ptr noundef, ptr noundef) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #5

declare i32 @printf(ptr noundef, ...) #3

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "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" }
attributes #5 = { inlinehint 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 #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}


; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, long long>, std::allocator<std::pair<int, long long>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, long long>, std::allocator<std::pair<int, long long>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, long long>, std::allocator<std::pair<int, long long>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, long long>, std::allocator<std::pair<int, long long>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.std::pair" = type { i32, i64 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@f = external dso_local local_unnamed_addr global [50001 x i64], align 16
@g = external dso_local global [200001 x i64], align 16
@e = external dso_local global [50001 x %"class.std::vector"], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsi(i32 noundef) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i64, align 8
  %4 = alloca %"struct.std::pair", align 8
  %5 = alloca %"struct.std::pair", align 8
  %6 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %7 = load i32, ptr @m, align 4, !tbaa !5
  %8 = add nsw i32 %7, -1
  store i32 %8, ptr @m, align 4, !tbaa !5
  %.not43 = icmp eq i32 %7, 0
  br i1 %.not43, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %0
  %9 = getelementptr inbounds i8, ptr %4, i64 8
  %10 = getelementptr inbounds i8, ptr %5, i64 8
  br label %11

11:                                               ; preds = %.lr.ph, %11
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %13 = load i32, ptr %1, align 4, !tbaa !5
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds [50001 x %"class.std::vector"], ptr @e, i64 0, i64 %14
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #7
  %16 = call { i32, i64 } @_ZSt9make_pairIRiRxESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %17 = extractvalue { i32, i64 } %16, 0
  store i32 %17, ptr %4, align 8
  %18 = extractvalue { i32, i64 } %16, 1
  store i64 %18, ptr %9, align 8
  call void @_ZNSt6vectorISt4pairIixESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %15, ptr noundef nonnull align 8 dereferenceable(16) %4)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #7
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [50001 x %"class.std::vector"], ptr @e, i64 0, i64 %20
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #7
  %22 = call { i32, i64 } @_ZSt9make_pairIRiRxESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %23 = extractvalue { i32, i64 } %22, 0
  store i32 %23, ptr %5, align 8
  %24 = extractvalue { i32, i64 } %22, 1
  store i64 %24, ptr %10, align 8
  call void @_ZNSt6vectorISt4pairIixESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %21, ptr noundef nonnull align 8 dereferenceable(16) %5)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  %25 = load i32, ptr @m, align 4, !tbaa !5
  %26 = add nsw i32 %25, -1
  store i32 %26, ptr @m, align 4, !tbaa !5
  %.not = icmp eq i32 %25, 0
  br i1 %.not, label %._crit_edge, label %11, !llvm.loop !9

._crit_edge:                                      ; preds = %11, %0
  store i32 0, ptr @m, align 4, !tbaa !5
  call void @_Z3dfsi(i32 noundef 1)
  %27 = load i32, ptr @m, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds i64, ptr @g, i64 %28
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef nonnull @g, ptr noundef nonnull %29)
  %30 = load i32, ptr @m, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds i64, ptr @g, i64 %31
  %33 = call noundef ptr @_ZSt6uniqueIPxET_S1_S1_(ptr noundef nonnull @g, ptr noundef nonnull %32)
  %34 = ptrtoint ptr %33 to i64
  %35 = sub i64 %34, ptrtoint (ptr @g to i64)
  %36 = lshr exact i64 %35, 3
  %37 = trunc i64 %36 to i32
  store i32 %37, ptr @m, align 4, !tbaa !5
  br label %.preheader

.preheader:                                       ; preds = %._crit_edge, %.thread
  %38 = phi i32 [ %37, %._crit_edge ], [ %89, %.thread ]
  %indvars.iv65 = phi i64 [ 59, %._crit_edge ], [ %indvars.iv.next66, %.thread ]
  %.03550 = phi i32 [ 0, %._crit_edge ], [ %.136, %.thread ]
  %39 = icmp slt i32 %.03550, %38
  br i1 %39, label %.lr.ph45, label %.thread

.lr.ph45:                                         ; preds = %.preheader
  %40 = shl nuw i64 1, %indvars.iv65
  %41 = sext i32 %.03550 to i64
  %wide.trip.count = sext i32 %38 to i64
  br label %49

42:                                               ; preds = %.thread
  %43 = load i32, ptr @n, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [50001 x i64], ptr @f, i64 0, i64 %44
  %46 = load i64, ptr %45, align 8, !tbaa !11
  %47 = icmp sgt i32 %.136, 0
  br i1 %47, label %.lr.ph56.preheader, label %._crit_edge57

.lr.ph56.preheader:                               ; preds = %42
  %wide.trip.count71 = zext nneg i32 %.136 to i64
  %xtraiter77 = and i64 %wide.trip.count71, 3
  %48 = icmp ult i32 %.136, 4
  br i1 %48, label %._crit_edge57.loopexit.unr-lcssa, label %.lr.ph56.preheader.new

.lr.ph56.preheader.new:                           ; preds = %.lr.ph56.preheader
  %unroll_iter80 = and i64 %wide.trip.count71, 2147483644
  br label %.lr.ph56

49:                                               ; preds = %.lr.ph45, %53
  %indvars.iv = phi i64 [ %41, %.lr.ph45 ], [ %indvars.iv.next, %53 ]
  %50 = getelementptr inbounds [200001 x i64], ptr @g, i64 0, i64 %indvars.iv
  %51 = load i64, ptr %50, align 8, !tbaa !11
  %52 = and i64 %51, %40
  %.not38 = icmp eq i64 %52, 0
  br i1 %.not38, label %53, label %54

53:                                               ; preds = %49
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.thread, label %49, !llvm.loop !13

54:                                               ; preds = %49
  %55 = icmp eq i64 %indvars.iv, -1
  br i1 %55, label %.thread, label %56

56:                                               ; preds = %54
  %57 = getelementptr inbounds [200001 x i64], ptr @g, i64 0, i64 %41
  %sext = shl i64 %indvars.iv, 32
  %58 = ashr exact i64 %sext, 32
  %59 = getelementptr inbounds [200001 x i64], ptr @g, i64 0, i64 %58
  call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) %57, ptr noundef nonnull align 8 dereferenceable(8) %59) #7
  %60 = load i32, ptr @m, align 4, !tbaa !5
  %61 = icmp sgt i32 %60, 0
  br i1 %61, label %.lr.ph48, label %._crit_edge49

.lr.ph48:                                         ; preds = %56
  %62 = zext i32 %.03550 to i64
  %wide.trip.count63 = zext nneg i32 %60 to i64
  %xtraiter = and i64 %wide.trip.count63, 1
  %63 = icmp eq i32 %60, 1
  br i1 %63, label %._crit_edge49.loopexit.unr-lcssa, label %.lr.ph48.new

.lr.ph48.new:                                     ; preds = %.lr.ph48
  %unroll_iter = and i64 %wide.trip.count63, 2147483646
  br label %72

._crit_edge49.loopexit.unr-lcssa:                 ; preds = %88, %.lr.ph48
  %indvars.iv60.unr = phi i64 [ 0, %.lr.ph48 ], [ %indvars.iv.next61.1, %88 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  %.not39.epil = icmp eq i64 %indvars.iv60.unr, %62
  %or.cond = select i1 %lcmp.mod.not, i1 true, i1 %.not39.epil
  br i1 %or.cond, label %._crit_edge49, label %64

64:                                               ; preds = %._crit_edge49.loopexit.unr-lcssa
  %65 = getelementptr inbounds [200001 x i64], ptr @g, i64 0, i64 %indvars.iv60.unr
  %66 = load i64, ptr %65, align 8, !tbaa !11
  %67 = and i64 %66, %40
  %.not40.epil = icmp eq i64 %67, 0
  br i1 %.not40.epil, label %._crit_edge49, label %68

68:                                               ; preds = %64
  %69 = load i64, ptr %57, align 8, !tbaa !11
  %70 = xor i64 %69, %66
  store i64 %70, ptr %65, align 8, !tbaa !11
  br label %._crit_edge49

._crit_edge49:                                    ; preds = %._crit_edge49.loopexit.unr-lcssa, %68, %64, %56
  %71 = add nsw i32 %.03550, 1
  br label %.thread

72:                                               ; preds = %88, %.lr.ph48.new
  %indvars.iv60 = phi i64 [ 0, %.lr.ph48.new ], [ %indvars.iv.next61.1, %88 ]
  %niter = phi i64 [ 0, %.lr.ph48.new ], [ %niter.next.1, %88 ]
  %.not39 = icmp eq i64 %indvars.iv60, %62
  br i1 %.not39, label %80, label %73

73:                                               ; preds = %72
  %74 = getelementptr inbounds [200001 x i64], ptr @g, i64 0, i64 %indvars.iv60
  %75 = load i64, ptr %74, align 16, !tbaa !11
  %76 = and i64 %75, %40
  %.not40 = icmp eq i64 %76, 0
  br i1 %.not40, label %80, label %77

77:                                               ; preds = %73
  %78 = load i64, ptr %57, align 8, !tbaa !11
  %79 = xor i64 %78, %75
  store i64 %79, ptr %74, align 16, !tbaa !11
  br label %80

80:                                               ; preds = %72, %73, %77
  %indvars.iv.next61 = or disjoint i64 %indvars.iv60, 1
  %.not39.1 = icmp eq i64 %indvars.iv.next61, %62
  br i1 %.not39.1, label %88, label %81

81:                                               ; preds = %80
  %82 = getelementptr inbounds [200001 x i64], ptr @g, i64 0, i64 %indvars.iv.next61
  %83 = load i64, ptr %82, align 8, !tbaa !11
  %84 = and i64 %83, %40
  %.not40.1 = icmp eq i64 %84, 0
  br i1 %.not40.1, label %88, label %85

85:                                               ; preds = %81
  %86 = load i64, ptr %57, align 8, !tbaa !11
  %87 = xor i64 %86, %83
  store i64 %87, ptr %82, align 8, !tbaa !11
  br label %88

88:                                               ; preds = %85, %81, %80
  %indvars.iv.next61.1 = add nuw nsw i64 %indvars.iv60, 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 %._crit_edge49.loopexit.unr-lcssa, label %72, !llvm.loop !14

.thread:                                          ; preds = %53, %.preheader, %54, %._crit_edge49
  %89 = phi i32 [ %60, %._crit_edge49 ], [ %38, %54 ], [ %38, %.preheader ], [ %38, %53 ]
  %.136 = phi i32 [ %71, %._crit_edge49 ], [ %.03550, %54 ], [ %.03550, %.preheader ], [ %.03550, %53 ]
  %indvars.iv.next66 = add nsw i64 %indvars.iv65, -1
  %.not73 = icmp eq i64 %indvars.iv65, 0
  br i1 %.not73, label %42, label %.preheader, !llvm.loop !15

._crit_edge57.loopexit.unr-lcssa:                 ; preds = %.lr.ph56, %.lr.ph56.preheader
  %spec.select.lcssa.ph = phi i64 [ poison, %.lr.ph56.preheader ], [ %spec.select.3, %.lr.ph56 ]
  %indvars.iv68.unr = phi i64 [ 0, %.lr.ph56.preheader ], [ %indvars.iv.next69.3, %.lr.ph56 ]
  %.03053.unr = phi i64 [ %46, %.lr.ph56.preheader ], [ %spec.select.3, %.lr.ph56 ]
  %lcmp.mod78.not = icmp eq i64 %xtraiter77, 0
  br i1 %lcmp.mod78.not, label %._crit_edge57, label %.lr.ph56.epil

.lr.ph56.epil:                                    ; preds = %._crit_edge57.loopexit.unr-lcssa, %.lr.ph56.epil
  %indvars.iv68.epil = phi i64 [ %indvars.iv.next69.epil, %.lr.ph56.epil ], [ %indvars.iv68.unr, %._crit_edge57.loopexit.unr-lcssa ]
  %.03053.epil = phi i64 [ %spec.select.epil, %.lr.ph56.epil ], [ %.03053.unr, %._crit_edge57.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph56.epil ], [ 0, %._crit_edge57.loopexit.unr-lcssa ]
  %90 = getelementptr inbounds [200001 x i64], ptr @g, i64 0, i64 %indvars.iv68.epil
  %91 = load i64, ptr %90, align 8, !tbaa !11
  %92 = xor i64 %91, %.03053.epil
  %spec.select.epil = call i64 @llvm.smax.i64(i64 %.03053.epil, i64 %92)
  %indvars.iv.next69.epil = add nuw nsw i64 %indvars.iv68.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter77
  br i1 %epil.iter.cmp.not, label %._crit_edge57, label %.lr.ph56.epil, !llvm.loop !16

._crit_edge57:                                    ; preds = %._crit_edge57.loopexit.unr-lcssa, %.lr.ph56.epil, %42
  %.030.lcssa = phi i64 [ %46, %42 ], [ %spec.select.lcssa.ph, %._crit_edge57.loopexit.unr-lcssa ], [ %spec.select.epil, %.lr.ph56.epil ]
  %93 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %.030.lcssa)
  ret i32 0

.lr.ph56:                                         ; preds = %.lr.ph56, %.lr.ph56.preheader.new
  %indvars.iv68 = phi i64 [ 0, %.lr.ph56.preheader.new ], [ %indvars.iv.next69.3, %.lr.ph56 ]
  %.03053 = phi i64 [ %46, %.lr.ph56.preheader.new ], [ %spec.select.3, %.lr.ph56 ]
  %niter81 = phi i64 [ 0, %.lr.ph56.preheader.new ], [ %niter81.next.3, %.lr.ph56 ]
  %94 = getelementptr inbounds [200001 x i64], ptr @g, i64 0, i64 %indvars.iv68
  %95 = load i64, ptr %94, align 16, !tbaa !11
  %96 = xor i64 %95, %.03053
  %spec.select = call i64 @llvm.smax.i64(i64 %.03053, i64 %96)
  %indvars.iv.next69 = or disjoint i64 %indvars.iv68, 1
  %97 = getelementptr inbounds [200001 x i64], ptr @g, i64 0, i64 %indvars.iv.next69
  %98 = load i64, ptr %97, align 8, !tbaa !11
  %99 = xor i64 %98, %spec.select
  %spec.select.1 = call i64 @llvm.smax.i64(i64 %spec.select, i64 %99)
  %indvars.iv.next69.1 = or disjoint i64 %indvars.iv68, 2
  %100 = getelementptr inbounds [200001 x i64], ptr @g, i64 0, i64 %indvars.iv.next69.1
  %101 = load i64, ptr %100, align 16, !tbaa !11
  %102 = xor i64 %101, %spec.select.1
  %spec.select.2 = call i64 @llvm.smax.i64(i64 %spec.select.1, i64 %102)
  %indvars.iv.next69.2 = or disjoint i64 %indvars.iv68, 3
  %103 = getelementptr inbounds [200001 x i64], ptr @g, i64 0, i64 %indvars.iv.next69.2
  %104 = load i64, ptr %103, align 8, !tbaa !11
  %105 = xor i64 %104, %spec.select.2
  %spec.select.3 = call i64 @llvm.smax.i64(i64 %spec.select.2, i64 %105)
  %indvars.iv.next69.3 = add nuw nsw i64 %indvars.iv68, 4
  %niter81.next.3 = add i64 %niter81, 4
  %niter81.ncmp.3 = icmp eq i64 %niter81.next.3, %unroll_iter80
  br i1 %niter81.ncmp.3, label %._crit_edge57.loopexit.unr-lcssa, label %.lr.ph56, !llvm.loop !18
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorISt4pairIixESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local { i32, i64 } @_ZSt9make_pairIRiRxESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPxEvT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt6uniqueIPxET_S1_S1_(ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #6

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nofree nounwind "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" }
attributes #5 = { inlinehint 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 #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.unroll.disable"}
!18 = distinct !{!18, !10}


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