; LLVM IR from VastoLorde95/Competitive-Programming :: CodeChef/SNACKDOWN/16/Pre-Elimination A/Problem E (E)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.seg = type { i32, i32, i32 }
%"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
@q = external dso_local global i32, align 4
@fst = external dso_local global [1001000 x i32], align 16
@s = external dso_local global [100100 x %struct.seg], align 16
@v = external dso_local global [1001000 x %"class.std::vector"], align 16
@jump = external dso_local global [20 x [100100 x i32]], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [125 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z10preprocessv() #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 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
  store i32 0, ptr %1, align 4
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @q)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %12

12:                                               ; preds = %27, %0
  %13 = load i32, ptr %2, align 4, !tbaa !5
  %14 = load i32, ptr @n, align 4, !tbaa !5
  %15 = icmp sle i32 %13, %14
  br i1 %15, label %17, label %16

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

17:                                               ; preds = %12
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [100100 x %struct.seg], ptr @s, i64 0, i64 %19
  %21 = getelementptr inbounds %struct.seg, ptr %20, i32 0, i32 0
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [100100 x %struct.seg], ptr @s, i64 0, i64 %23
  %25 = getelementptr inbounds %struct.seg, ptr %24, i32 0, i32 1
  %26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %21, ptr noundef %25)
  br label %27

27:                                               ; preds = %17
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = add nsw i32 %28, 1
  store i32 %29, ptr %2, align 4, !tbaa !5
  br label %12, !llvm.loop !9

30:                                               ; preds = %16
  %31 = load i32, ptr @n, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds %struct.seg, ptr @s, i64 %32
  %34 = getelementptr inbounds %struct.seg, ptr %33, i64 1
  call void @_ZSt4sortIP3segEvT_S2_(ptr noundef getelementptr inbounds (%struct.seg, ptr @s, i64 1), ptr noundef %34)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %35

35:                                               ; preds = %48, %30
  %36 = load i32, ptr %3, align 4, !tbaa !5
  %37 = load i32, ptr @n, align 4, !tbaa !5
  %38 = icmp sle i32 %36, %37
  br i1 %38, label %40, label %39

39:                                               ; preds = %35
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %51

40:                                               ; preds = %35
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [100100 x %struct.seg], ptr @s, i64 0, i64 %42
  %44 = getelementptr inbounds %struct.seg, ptr %43, i32 0, i32 0
  %45 = load i32, ptr %44, align 4, !tbaa !11
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [1001000 x %"class.std::vector"], ptr @v, i64 0, i64 %46
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %47, ptr noundef nonnull align 4 dereferenceable(4) %3)
  br label %48

48:                                               ; preds = %40
  %49 = load i32, ptr %3, align 4, !tbaa !5
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr %3, align 4, !tbaa !5
  br label %35, !llvm.loop !13

51:                                               ; preds = %39
  call void @_Z10preprocessv()
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %52

52:                                               ; preds = %163, %51
  %53 = load i32, ptr %4, align 4, !tbaa !5
  %54 = load i32, ptr @q, align 4, !tbaa !5
  %55 = icmp sle i32 %53, %54
  br i1 %55, label %57, label %56

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

57:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %58 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %6, ptr noundef %7)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %59

59:                                               ; preds = %159, %57
  %60 = load i32, ptr %6, align 4, !tbaa !5
  %61 = load i32, ptr %7, align 4, !tbaa !5
  %62 = icmp sle i32 %60, %61
  br i1 %62, label %63, label %160

63:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %64 = load i32, ptr %6, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [1001000 x i32], ptr @fst, i64 0, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !5
  store i32 %67, ptr %9, align 4, !tbaa !5
  %68 = load i32, ptr %9, align 4, !tbaa !5
  %69 = icmp eq i32 %68, 1000000000
  br i1 %69, label %78, label %70

70:                                               ; preds = %63
  %71 = load i32, ptr %9, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [100100 x %struct.seg], ptr @s, i64 0, i64 %72
  %74 = getelementptr inbounds %struct.seg, ptr %73, i32 0, i32 1
  %75 = load i32, ptr %74, align 4, !tbaa !14
  %76 = load i32, ptr %7, align 4, !tbaa !5
  %77 = icmp sgt i32 %75, %76
  br i1 %77, label %78, label %79

78:                                               ; preds = %70, %63
  store i32 12, ptr %5, align 4
  br label %157

79:                                               ; preds = %70
  %80 = load i32, ptr %9, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [100100 x i32], ptr @jump, i64 0, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %84 = icmp eq i32 %83, 1000000000
  br i1 %84, label %85, label %88

85:                                               ; preds = %79
  %86 = load i32, ptr %8, align 4, !tbaa !5
  %87 = add nsw i32 %86, 1
  store i32 %87, ptr %8, align 4, !tbaa !5
  store i32 12, ptr %5, align 4
  br label %157

88:                                               ; preds = %79
  %89 = load i32, ptr %9, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [100100 x i32], ptr @jump, i64 0, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [100100 x %struct.seg], ptr @s, i64 0, i64 %93
  %95 = getelementptr inbounds %struct.seg, ptr %94, i32 0, i32 1
  %96 = load i32, ptr %95, align 4, !tbaa !14
  %97 = load i32, ptr %7, align 4, !tbaa !5
  %98 = icmp sgt i32 %96, %97
  br i1 %98, label %99, label %102

99:                                               ; preds = %88
  %100 = load i32, ptr %8, align 4, !tbaa !5
  %101 = add nsw i32 %100, 1
  store i32 %101, ptr %8, align 4, !tbaa !5
  store i32 12, ptr %5, align 4
  br label %157

102:                                              ; preds = %88
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %103

103:                                              ; preds = %128, %102
  %104 = load i32, ptr %10, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [20 x [100100 x i32]], ptr @jump, i64 0, i64 %105
  %107 = load i32, ptr %9, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [100100 x i32], ptr %106, i64 0, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %111 = icmp ne i32 %110, 1000000000
  br i1 %111, label %112, label %126

112:                                              ; preds = %103
  %113 = load i32, ptr %10, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [20 x [100100 x i32]], ptr @jump, i64 0, i64 %114
  %116 = load i32, ptr %9, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [100100 x i32], ptr %115, i64 0, i64 %117
  %119 = load i32, ptr %118, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [100100 x %struct.seg], ptr @s, i64 0, i64 %120
  %122 = getelementptr inbounds %struct.seg, ptr %121, i32 0, i32 1
  %123 = load i32, ptr %122, align 4, !tbaa !14
  %124 = load i32, ptr %7, align 4, !tbaa !5
  %125 = icmp sle i32 %123, %124
  br label %126

126:                                              ; preds = %112, %103
  %127 = phi i1 [ false, %103 ], [ %125, %112 ]
  br i1 %127, label %128, label %131

128:                                              ; preds = %126
  %129 = load i32, ptr %10, align 4, !tbaa !5
  %130 = add nsw i32 %129, 1
  store i32 %130, ptr %10, align 4, !tbaa !5
  br label %103, !llvm.loop !15

131:                                              ; preds = %126
  %132 = load i32, ptr %10, align 4, !tbaa !5
  %133 = add nsw i32 %132, -1
  store i32 %133, ptr %10, align 4, !tbaa !5
  %134 = load i32, ptr %10, align 4, !tbaa !5
  %135 = icmp sge i32 %134, 0
  br i1 %135, label %136, label %137

136:                                              ; preds = %131
  br label %139

137:                                              ; preds = %131
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.3, i32 noundef 135, ptr noundef @__PRETTY_FUNCTION__.main) #7
  unreachable

138:                                              ; No predecessors!
  br label %139

139:                                              ; preds = %138, %136
  %140 = load i32, ptr %10, align 4, !tbaa !5
  %141 = shl i32 1, %140
  %142 = add nsw i32 %141, 1
  %143 = load i32, ptr %8, align 4, !tbaa !5
  %144 = add nsw i32 %143, %142
  store i32 %144, ptr %8, align 4, !tbaa !5
  %145 = load i32, ptr %10, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [20 x [100100 x i32]], ptr @jump, i64 0, i64 %146
  %148 = load i32, ptr %9, align 4, !tbaa !5
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [100100 x i32], ptr %147, i64 0, i64 %149
  %151 = load i32, ptr %150, align 4, !tbaa !5
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [100100 x %struct.seg], ptr @s, i64 0, i64 %152
  %154 = getelementptr inbounds %struct.seg, ptr %153, i32 0, i32 1
  %155 = load i32, ptr %154, align 4, !tbaa !14
  %156 = add nsw i32 %155, 1
  store i32 %156, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  store i32 0, ptr %5, align 4
  br label %157

157:                                              ; preds = %139, %99, %85, %78
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  %158 = load i32, ptr %5, align 4
  switch i32 %158, label %167 [
    i32 0, label %159
    i32 12, label %160
  ]

159:                                              ; preds = %157
  br label %59, !llvm.loop !16

160:                                              ; preds = %157, %59
  %161 = load i32, ptr %8, align 4, !tbaa !5
  %162 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %161)
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %163

163:                                              ; preds = %160
  %164 = load i32, ptr %4, align 4, !tbaa !5
  %165 = add nsw i32 %164, 1
  store i32 %165, ptr %4, align 4, !tbaa !5
  br label %52, !llvm.loop !17

166:                                              ; preds = %56
  ret i32 0

167:                                              ; preds = %157
  unreachable
}

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

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

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #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 = { noreturn 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 }
attributes #7 = { noreturn 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, !6, i64 0}
!12 = !{!"_ZTS3seg", !6, i64 0, !6, i64 4, !6, i64 8}
!13 = distinct !{!13, !10}
!14 = !{!12, !6, i64 4}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !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"

%struct.seg = type { i32, i32, i32 }
%"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
@q = external dso_local global i32, align 4
@fst = external dso_local local_unnamed_addr global [1001000 x i32], align 16
@s = external dso_local global [100100 x %struct.seg], align 16
@v = external dso_local global [1001000 x %"class.std::vector"], align 16
@jump = external dso_local local_unnamed_addr global [20 x [100100 x i32]], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [125 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z10preprocessv() 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 i32, align 4
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @q)
  %5 = load i32, ptr @n, align 4, !tbaa !5
  %.not49 = icmp slt i32 %5, 1
  br i1 %.not49, label %.._crit_edge_crit_edge, label %.lr.ph

.._crit_edge_crit_edge:                           ; preds = %0
  %.pre = sext i32 %5 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.._crit_edge_crit_edge ], [ %13, %.lr.ph ]
  %6 = getelementptr inbounds %struct.seg, ptr @s, i64 %.pre-phi
  %7 = getelementptr inbounds i8, ptr %6, i64 12
  tail call void @_ZSt4sortIP3segEvT_S2_(ptr noundef nonnull getelementptr inbounds (i8, ptr @s, i64 12), ptr noundef nonnull %7)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  store i32 1, ptr %1, align 4, !tbaa !5
  %8 = load i32, ptr @n, align 4, !tbaa !5
  %.not3751 = icmp slt i32 %8, 1
  br i1 %.not3751, label %._crit_edge55, label %.lr.ph54

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %9 = getelementptr inbounds [100100 x %struct.seg], ptr @s, i64 0, i64 %indvars.iv
  %10 = getelementptr inbounds i8, ptr %9, i64 4
  %11 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %9, ptr noundef nonnull %10)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %12 = load i32, ptr @n, align 4, !tbaa !5
  %13 = sext i32 %12 to i64
  %.not.not = icmp slt i64 %indvars.iv, %13
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge55:                                    ; preds = %.lr.ph54, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  call void @_Z10preprocessv()
  %14 = load i32, ptr @q, align 4, !tbaa !5
  %.not3871 = icmp slt i32 %14, 1
  br i1 %.not3871, label %._crit_edge75, label %.lr.ph74

.lr.ph54:                                         ; preds = %._crit_edge, %.lr.ph54
  %storemerge52 = phi i32 [ %21, %.lr.ph54 ], [ 1, %._crit_edge ]
  %15 = sext i32 %storemerge52 to i64
  %16 = getelementptr inbounds [100100 x %struct.seg], ptr @s, i64 0, i64 %15
  %17 = load i32, ptr %16, align 4, !tbaa !11
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [1001000 x %"class.std::vector"], ptr @v, i64 0, i64 %18
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %19, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %20 = load i32, ptr %1, align 4, !tbaa !5
  %21 = add nsw i32 %20, 1
  store i32 %21, ptr %1, align 4, !tbaa !5
  %22 = load i32, ptr @n, align 4, !tbaa !5
  %.not37.not = icmp slt i32 %20, %22
  br i1 %.not37.not, label %.lr.ph54, label %._crit_edge55, !llvm.loop !13

._crit_edge75:                                    ; preds = %.thread, %._crit_edge55
  ret i32 0

.lr.ph74:                                         ; preds = %._crit_edge55, %.thread
  %.02872 = phi i32 [ %69, %.thread ], [ 1, %._crit_edge55 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %24 = load i32, ptr %3, align 4, !tbaa !5
  %.promoted = load i32, ptr %2, align 4, !tbaa !5
  %.not3962 = icmp sgt i32 %.promoted, %24
  br i1 %.not3962, label %.thread, label %.lr.ph65

.lr.ph65:                                         ; preds = %.lr.ph74, %56
  %.02663 = phi i32 [ %60, %56 ], [ 0, %.lr.ph74 ]
  %25 = phi i32 [ %67, %56 ], [ %.promoted, %.lr.ph74 ]
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [1001000 x i32], ptr @fst, i64 0, i64 %26
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %29 = icmp eq i32 %28, 1000000000
  br i1 %29, label %.thread, label %30

30:                                               ; preds = %.lr.ph65
  %31 = sext i32 %28 to i64
  %32 = getelementptr inbounds [100100 x %struct.seg], ptr @s, i64 0, i64 %31, i32 1
  %33 = load i32, ptr %32, align 4, !tbaa !14
  %34 = icmp sgt i32 %33, %24
  br i1 %34, label %.thread, label %35

35:                                               ; preds = %30
  %36 = getelementptr inbounds [100100 x i32], ptr @jump, i64 0, i64 %31
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %38 = icmp eq i32 %37, 1000000000
  br i1 %38, label %39, label %41

39:                                               ; preds = %35
  %40 = add nsw i32 %.02663, 1
  br label %.thread

41:                                               ; preds = %35
  %42 = sext i32 %37 to i64
  %43 = getelementptr inbounds [100100 x %struct.seg], ptr @s, i64 0, i64 %42, i32 1
  %44 = load i32, ptr %43, align 4, !tbaa !14
  %45 = icmp sgt i32 %44, %24
  br i1 %45, label %46, label %.lr.ph58

46:                                               ; preds = %41
  %47 = add nsw i32 %.02663, 1
  br label %.thread

.lr.ph58:                                         ; preds = %41, %52
  %indvars.iv81 = phi i64 [ %indvars.iv.next82, %52 ], [ 0, %41 ]
  %48 = phi i32 [ %54, %52 ], [ %37, %41 ]
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [100100 x %struct.seg], ptr @s, i64 0, i64 %49, i32 1
  %51 = load i32, ptr %50, align 4, !tbaa !14
  %.not41 = icmp sgt i32 %51, %24
  br i1 %.not41, label %.critedge, label %52

52:                                               ; preds = %.lr.ph58
  %indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
  %53 = getelementptr inbounds [20 x [100100 x i32]], ptr @jump, i64 0, i64 %indvars.iv.next82, i64 %31
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %.not40 = icmp eq i32 %54, 1000000000
  br i1 %.not40, label %.critedge, label %.lr.ph58, !llvm.loop !15

.critedge:                                        ; preds = %.lr.ph58, %52
  %.0.lcssa.ph.in = phi i64 [ %indvars.iv81, %.lr.ph58 ], [ %indvars.iv.next82, %52 ]
  %.0.lcssa.ph = trunc i64 %.0.lcssa.ph.in to i32
  %.not42 = icmp eq i32 %.0.lcssa.ph, 0
  br i1 %.not42, label %55, label %56

55:                                               ; preds = %.critedge
  call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, i32 noundef 135, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #7
  unreachable

56:                                               ; preds = %.critedge
  %57 = add nsw i32 %.0.lcssa.ph, -1
  %58 = shl nuw i32 1, %57
  %59 = add i32 %.02663, 1
  %60 = add i32 %59, %58
  %61 = zext nneg i32 %57 to i64
  %62 = getelementptr inbounds [20 x [100100 x i32]], ptr @jump, i64 0, i64 %61, i64 %31
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [100100 x %struct.seg], ptr @s, i64 0, i64 %64, i32 1
  %66 = load i32, ptr %65, align 4, !tbaa !14
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %2, align 4, !tbaa !5
  %.not39.not = icmp slt i32 %66, %24
  br i1 %.not39.not, label %.lr.ph65, label %.thread

.thread:                                          ; preds = %56, %30, %.lr.ph65, %.lr.ph74, %46, %39
  %.2 = phi i32 [ %47, %46 ], [ %40, %39 ], [ 0, %.lr.ph74 ], [ %60, %56 ], [ %.02663, %30 ], [ %.02663, %.lr.ph65 ]
  %68 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %.2)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  %69 = add nuw nsw i32 %.02872, 1
  %70 = load i32, ptr @q, align 4, !tbaa !5
  %.not38.not = icmp slt i32 %.02872, %70
  br i1 %.not38.not, label %.lr.ph74, label %._crit_edge75, !llvm.loop !16
}

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

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

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #5

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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 = { 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 = { noreturn 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 }
attributes #7 = { noreturn 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, !6, i64 0}
!12 = !{!"_ZTS3seg", !6, i64 0, !6, i64 4, !6, i64 8}
!13 = distinct !{!13, !10}
!14 = !{!12, !6, i64 4}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}


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