; LLVM IR from eyangch/competitive-programming :: USACOcontests/gold/2018.03 (milkorder)

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

@N = external dso_local global i32, align 4
@M = external dso_local global i32, align 4
@obs = external dso_local global [50000 x %"class.std::vector"], align 16
@.str = external hidden unnamed_addr constant [13 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5solvei(ptr dead_on_unwind noalias writable sret(%"class.std::vector") align 8, i32 noundef) #1

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #0 align 2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca %"class.std::vector", align 8
  %12 = alloca %"class.std::vector", align 8
  %13 = alloca %"class.std::vector", align 8
  %14 = alloca %"class.std::vector", align 8
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %18 = load ptr, ptr @stdin, align 8, !tbaa !5
  %19 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.2, ptr noundef %18)
  %20 = load ptr, ptr @stdout, align 8, !tbaa !5
  %21 = call ptr @freopen(ptr noundef @.str.3, ptr noundef @.str.4, ptr noundef %20)
  %22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.5, ptr noundef @N, ptr noundef @M)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 0, ptr %2, align 4, !tbaa !9
  br label %23

23:                                               ; preds = %46, %0
  %24 = load i32, ptr %2, align 4, !tbaa !9
  %25 = load i32, ptr @M, align 4, !tbaa !9
  %26 = icmp slt i32 %24, %25
  br i1 %26, label %28, label %27

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

28:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  %29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.6, ptr noundef %4)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %30

30:                                               ; preds = %42, %28
  %31 = load i32, ptr %5, align 4, !tbaa !9
  %32 = load i32, ptr %4, align 4, !tbaa !9
  %33 = icmp slt i32 %31, %32
  br i1 %33, label %35, label %34

34:                                               ; preds = %30
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %45

35:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %36 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.6, ptr noundef %6)
  %37 = load i32, ptr %2, align 4, !tbaa !9
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [50000 x %"class.std::vector"], ptr @obs, i64 0, i64 %38
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %40 = load i32, ptr %6, align 4, !tbaa !9
  %41 = sub nsw i32 %40, 1
  store i32 %41, ptr %7, align 4, !tbaa !9
  call void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %39, ptr noundef nonnull align 4 dereferenceable(4) %7)
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %42

42:                                               ; preds = %35
  %43 = load i32, ptr %5, align 4, !tbaa !9
  %44 = add nsw i32 %43, 1
  store i32 %44, ptr %5, align 4, !tbaa !9
  br label %30, !llvm.loop !11

45:                                               ; preds = %34
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %46

46:                                               ; preds = %45
  %47 = load i32, ptr %2, align 4, !tbaa !9
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %2, align 4, !tbaa !9
  br label %23, !llvm.loop !13

49:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %50 = load i32, ptr @M, align 4, !tbaa !9
  store i32 %50, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %51

51:                                               ; preds = %73, %49
  %52 = load i32, ptr %8, align 4, !tbaa !9
  %53 = load i32, ptr %9, align 4, !tbaa !9
  %54 = icmp slt i32 %52, %53
  br i1 %54, label %55, label %74

55:                                               ; preds = %51
  %56 = load i32, ptr %8, align 4, !tbaa !9
  %57 = load i32, ptr %9, align 4, !tbaa !9
  %58 = load i32, ptr %8, align 4, !tbaa !9
  %59 = sub nsw i32 %57, %58
  %60 = sdiv i32 %59, 2
  %61 = add nsw i32 %56, %60
  store i32 %61, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 24, ptr %11) #5
  %62 = load i32, ptr %10, align 4, !tbaa !9
  call void @_Z5solvei(ptr dead_on_unwind writable sret(%"class.std::vector") align 8 %11, i32 noundef %62)
  %63 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %11) #5
  %64 = trunc i64 %63 to i32
  %65 = load i32, ptr @N, align 4, !tbaa !9
  %66 = icmp slt i32 %64, %65
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %11) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #5
  br i1 %66, label %67, label %70

67:                                               ; preds = %55
  %68 = load i32, ptr %10, align 4, !tbaa !9
  %69 = sub nsw i32 %68, 1
  store i32 %69, ptr %9, align 4, !tbaa !9
  br label %73

70:                                               ; preds = %55
  %71 = load i32, ptr %10, align 4, !tbaa !9
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr %8, align 4, !tbaa !9
  br label %73

73:                                               ; preds = %70, %67
  br label %51, !llvm.loop !14

74:                                               ; preds = %51
  br label %75

75:                                               ; preds = %81, %74
  call void @llvm.lifetime.start.p0(i64 24, ptr %12) #5
  %76 = load i32, ptr %10, align 4, !tbaa !9
  call void @_Z5solvei(ptr dead_on_unwind writable sret(%"class.std::vector") align 8 %12, i32 noundef %76)
  %77 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #5
  %78 = trunc i64 %77 to i32
  %79 = load i32, ptr @N, align 4, !tbaa !9
  %80 = icmp eq i32 %78, %79
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #5
  br i1 %80, label %81, label %84

81:                                               ; preds = %75
  %82 = load i32, ptr %10, align 4, !tbaa !9
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr %10, align 4, !tbaa !9
  br label %75, !llvm.loop !15

84:                                               ; preds = %75
  br label %85

85:                                               ; preds = %91, %84
  call void @llvm.lifetime.start.p0(i64 24, ptr %13) #5
  %86 = load i32, ptr %10, align 4, !tbaa !9
  call void @_Z5solvei(ptr dead_on_unwind writable sret(%"class.std::vector") align 8 %13, i32 noundef %86)
  %87 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %13) #5
  %88 = trunc i64 %87 to i32
  %89 = load i32, ptr @N, align 4, !tbaa !9
  %90 = icmp slt i32 %88, %89
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %13) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %13) #5
  br i1 %90, label %91, label %94

91:                                               ; preds = %85
  %92 = load i32, ptr %10, align 4, !tbaa !9
  %93 = add nsw i32 %92, -1
  store i32 %93, ptr %10, align 4, !tbaa !9
  br label %85, !llvm.loop !16

94:                                               ; preds = %85
  call void @llvm.lifetime.start.p0(i64 24, ptr %14) #5
  %95 = load i32, ptr %10, align 4, !tbaa !9
  call void @_Z5solvei(ptr dead_on_unwind writable sret(%"class.std::vector") align 8 %14, i32 noundef %95)
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %96

96:                                               ; preds = %118, %94
  %97 = load i32, ptr %15, align 4, !tbaa !9
  %98 = load i32, ptr @N, align 4, !tbaa !9
  %99 = icmp slt i32 %97, %98
  br i1 %99, label %101, label %100

100:                                              ; preds = %96
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %125

101:                                              ; preds = %96
  %102 = load i32, ptr %15, align 4, !tbaa !9
  %103 = load i32, ptr @N, align 4, !tbaa !9
  %104 = sub nsw i32 %103, 1
  %105 = icmp eq i32 %102, %104
  br i1 %105, label %106, label %107

106:                                              ; preds = %101
  br label %108

107:                                              ; preds = %101
  br label %108

108:                                              ; preds = %107, %106
  %109 = phi ptr [ @.str.7, %106 ], [ @.str.8, %107 ]
  %110 = getelementptr inbounds [4 x i8], ptr %109, i64 0, i64 0
  %111 = load i32, ptr %15, align 4, !tbaa !9
  %112 = sext i32 %111 to i64
  %113 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %14, i64 noundef %112) #5
  %114 = load i32, ptr %113, align 4, !tbaa !9
  %115 = add nsw i32 %114, 1
  %116 = invoke i32 (ptr, ...) @printf(ptr noundef %110, i32 noundef %115)
          to label %117 unwind label %121

117:                                              ; preds = %108
  br label %118

118:                                              ; preds = %117
  %119 = load i32, ptr %15, align 4, !tbaa !9
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr %15, align 4, !tbaa !9
  br label %96, !llvm.loop !17

121:                                              ; preds = %108
  %122 = landingpad { ptr, i32 }
          cleanup
  %123 = extractvalue { ptr, i32 } %122, 0
  store ptr %123, ptr %16, align 8
  %124 = extractvalue { ptr, i32 } %122, 1
  store i32 %124, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %14) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %127

125:                                              ; preds = %100
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %14) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  %126 = load i32, ptr %1, align 4
  ret i32 %126

127:                                              ; preds = %121
  %128 = load ptr, ptr %16, align 8
  %129 = load i32, ptr %17, align 4
  %130 = insertvalue { ptr, i32 } poison, ptr %128, 0
  %131 = insertvalue { ptr, i32 } %130, i32 %129, 1
  resume { ptr, i32 } %131
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) #4

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) #1 align 2

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

attributes #0 = { 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 #1 = { 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { "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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@N = external dso_local global i32, align 4
@M = external dso_local global i32, align 4
@obs = external dso_local global [50000 x %"class.std::vector"], align 16
@.str = external hidden unnamed_addr constant [13 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5solvei(ptr dead_on_unwind noalias writable sret(%"class.std::vector") align 8, i32 noundef) local_unnamed_addr #1

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %"class.std::vector", align 8
  %5 = alloca %"class.std::vector", align 8
  %6 = alloca %"class.std::vector", align 8
  %7 = alloca %"class.std::vector", align 8
  %8 = load ptr, ptr @stdin, align 8, !tbaa !5
  %9 = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.2, ptr noundef %8)
  %10 = load ptr, ptr @stdout, align 8, !tbaa !5
  %11 = tail call ptr @freopen(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.4, ptr noundef %10)
  %12 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull @N, ptr noundef nonnull @M)
  %13 = load i32, ptr @M, align 4, !tbaa !9
  %14 = icmp sgt i32 %13, 0
  br i1 %14, label %.lr.ph37, label %.preheader32.preheader

.preheader33:                                     ; preds = %._crit_edge
  %15 = icmp sgt i32 %20, 0
  br i1 %15, label %.lr.ph40, label %.preheader32.preheader

.lr.ph37:                                         ; preds = %0, %._crit_edge
  %indvars.iv = phi i64 [ %indvars.iv.next, %._crit_edge ], [ 0, %0 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.6, ptr noundef nonnull %1)
  %17 = load i32, ptr %1, align 4, !tbaa !9
  %18 = icmp sgt i32 %17, 0
  br i1 %18, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph37
  %19 = getelementptr inbounds [50000 x %"class.std::vector"], ptr @obs, i64 0, i64 %indvars.iv
  br label %23

._crit_edge:                                      ; preds = %23, %.lr.ph37
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %20 = load i32, ptr @M, align 4, !tbaa !9
  %21 = sext i32 %20 to i64
  %22 = icmp slt i64 %indvars.iv.next, %21
  br i1 %22, label %.lr.ph37, label %.preheader33, !llvm.loop !11

23:                                               ; preds = %.lr.ph, %23
  %.02834 = phi i32 [ 0, %.lr.ph ], [ %27, %23 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.6, ptr noundef nonnull %2)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %25 = load i32, ptr %2, align 4, !tbaa !9
  %26 = add nsw i32 %25, -1
  store i32 %26, ptr %3, align 4, !tbaa !9
  call void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %19, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  %27 = add nuw nsw i32 %.02834, 1
  %28 = load i32, ptr %1, align 4, !tbaa !9
  %29 = icmp slt i32 %27, %28
  br i1 %29, label %23, label %._crit_edge, !llvm.loop !13

.lr.ph40:                                         ; preds = %.preheader33, %.lr.ph40
  %.02439 = phi i32 [ %.125, %.lr.ph40 ], [ %20, %.preheader33 ]
  %.02638 = phi i32 [ %.127, %.lr.ph40 ], [ 0, %.preheader33 ]
  %30 = sub nsw i32 %.02439, %.02638
  %31 = sdiv i32 %30, 2
  %32 = add nsw i32 %31, %.02638
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #6
  call void @_Z5solvei(ptr dead_on_unwind nonnull writable sret(%"class.std::vector") align 8 %4, i32 noundef %32)
  %33 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %4) #6
  %34 = trunc i64 %33 to i32
  %35 = load i32, ptr @N, align 4, !tbaa !9
  %36 = icmp sgt i32 %35, %34
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #6
  %37 = add nsw i32 %32, -1
  %38 = add nsw i32 %32, 1
  %.127 = select i1 %36, i32 %.02638, i32 %38
  %.125 = select i1 %36, i32 %37, i32 %.02439
  %39 = icmp slt i32 %.127, %.125
  br i1 %39, label %.lr.ph40, label %.preheader32.preheader, !llvm.loop !14

.preheader32.preheader:                           ; preds = %.lr.ph40, %0, %.preheader33
  %.1.ph = phi i32 [ 0, %0 ], [ 0, %.preheader33 ], [ %32, %.lr.ph40 ]
  br label %.preheader32

.preheader32:                                     ; preds = %.preheader32.preheader, %.preheader32
  %.1 = phi i32 [ %44, %.preheader32 ], [ %.1.ph, %.preheader32.preheader ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #6
  call void @_Z5solvei(ptr dead_on_unwind nonnull writable sret(%"class.std::vector") align 8 %5, i32 noundef %.1)
  %40 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %5) #6
  %41 = trunc i64 %40 to i32
  %42 = load i32, ptr @N, align 4, !tbaa !9
  %43 = icmp eq i32 %42, %41
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #6
  %44 = add nsw i32 %.1, 1
  br i1 %43, label %.preheader32, label %.preheader, !llvm.loop !15

.preheader:                                       ; preds = %.preheader32, %.preheader
  %.2 = phi i32 [ %49, %.preheader ], [ %.1, %.preheader32 ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #6
  call void @_Z5solvei(ptr dead_on_unwind nonnull writable sret(%"class.std::vector") align 8 %6, i32 noundef %.2)
  %45 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %6) #6
  %46 = trunc i64 %45 to i32
  %47 = load i32, ptr @N, align 4, !tbaa !9
  %48 = icmp sgt i32 %47, %46
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #6
  %49 = add nsw i32 %.2, -1
  br i1 %48, label %.preheader, label %50, !llvm.loop !16

50:                                               ; preds = %.preheader
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #6
  call void @_Z5solvei(ptr dead_on_unwind nonnull writable sret(%"class.std::vector") align 8 %7, i32 noundef %.2)
  %51 = load i32, ptr @N, align 4, !tbaa !9
  %52 = icmp sgt i32 %51, 0
  br i1 %52, label %.lr.ph44, label %._crit_edge45

._crit_edge45:                                    ; preds = %.lr.ph44, %50
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #6
  ret i32 0

.lr.ph44:                                         ; preds = %50, %.lr.ph44
  %indvars.iv49 = phi i64 [ %indvars.iv.next50, %.lr.ph44 ], [ 0, %50 ]
  %53 = phi i32 [ %61, %.lr.ph44 ], [ %51, %50 ]
  %54 = add nsw i32 %53, -1
  %55 = zext i32 %54 to i64
  %56 = icmp eq i64 %indvars.iv49, %55
  %.str.7..str.8 = select i1 %56, ptr @.str.7, ptr @.str.8
  %57 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %indvars.iv49) #6
  %58 = load i32, ptr %57, align 4, !tbaa !9
  %59 = add nsw i32 %58, 1
  %60 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.7..str.8, i32 noundef %59)
  %indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1
  %61 = load i32, ptr @N, align 4, !tbaa !9
  %62 = sext i32 %61 to i64
  %63 = icmp slt i64 %indvars.iv.next50, %62
  br i1 %63, label %.lr.ph44, label %._crit_edge45, !llvm.loop !17
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1 align 2

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

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


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