; LLVM IR from Izaron/ACM-ICPC :: Timus Online Judge/Volume 8/1772. Ski-Trails for Robots (main)

; 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 }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.tree = type { i32, %"class.std::vector", %"class.std::vector" }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"struct.std::pair" = type { i32, i32 }

@n = external dso_local global i32, align 4
@s = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@nxt = external dso_local global [2 x %"class.std::vector"], align 16
@robots = external dso_local global %"class.std::vector.0", align 8
@t = external dso_local global %struct.tree, align 8
@ank = external dso_local global [100005 x [2 x i64]], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z9find_nextii(i32 noundef, 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 nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z2dpii(i32 noundef, i32 noundef) #0

; 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) #2 align 2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %5

5:                                                ; preds = %18, %0
  %6 = load i32, ptr %2, align 4, !tbaa !5
  %7 = icmp slt i32 %6, 100005
  br i1 %7, label %9, label %8

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

9:                                                ; preds = %5
  %10 = load i32, ptr %2, align 4, !tbaa !5
  %11 = sext i32 %10 to i64
  %12 = getelementptr inbounds [100005 x [2 x i64]], ptr @ank, i64 0, i64 %11
  %13 = getelementptr inbounds [2 x i64], ptr %12, i64 0, i64 0
  store i64 -1, ptr %13, align 16, !tbaa !9
  %14 = load i32, ptr %2, align 4, !tbaa !5
  %15 = sext i32 %14 to i64
  %16 = getelementptr inbounds [100005 x [2 x i64]], ptr @ank, i64 0, i64 %15
  %17 = getelementptr inbounds [2 x i64], ptr %16, i64 0, i64 1
  store i64 -1, ptr %17, align 8, !tbaa !9
  br label %18

18:                                               ; preds = %9
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = add nsw i32 %19, 1
  store i32 %20, ptr %2, align 4, !tbaa !5
  br label %5, !llvm.loop !11

21:                                               ; preds = %8
  %22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @s, ptr noundef @k)
  %23 = load i32, ptr @s, align 4, !tbaa !5
  %24 = add nsw i32 %23, -1
  store i32 %24, ptr @s, align 4, !tbaa !5
  %25 = load i32, ptr @k, align 4, !tbaa !5
  %26 = add nsw i32 %25, 1
  %27 = sext i32 %26 to i64
  call void @_ZNSt6vectorIiSaIiEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) @nxt, i64 noundef %27)
  %28 = load i32, ptr @k, align 4, !tbaa !5
  %29 = add nsw i32 %28, 1
  %30 = sext i32 %29 to i64
  call void @_ZNSt6vectorIiSaIiEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) getelementptr inbounds ([2 x %"class.std::vector"], ptr @nxt, i64 0, i64 1), i64 noundef %30)
  %31 = load i32, ptr @k, align 4, !tbaa !5
  %32 = add nsw i32 %31, 1
  %33 = sext i32 %32 to i64
  call void @_ZNSt6vectorISt4pairIiiESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) @robots, i64 noundef %33)
  %34 = load i32, ptr @s, align 4, !tbaa !5
  %35 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @robots, i64 noundef 0) #5
  %36 = getelementptr inbounds %"struct.std::pair", ptr %35, i32 0, i32 0
  store i32 %34, ptr %36, align 4, !tbaa !13
  %37 = load i32, ptr @s, align 4, !tbaa !5
  %38 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @robots, i64 noundef 0) #5
  %39 = getelementptr inbounds %"struct.std::pair", ptr %38, i32 0, i32 1
  store i32 %37, ptr %39, align 4, !tbaa !15
  %40 = load i32, ptr @n, align 4, !tbaa !5
  call void @_ZN4tree4initEi(ptr noundef nonnull align 8 dereferenceable(56) @t, i32 noundef %40)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %41

41:                                               ; preds = %68, %21
  %42 = load i32, ptr %3, align 4, !tbaa !5
  %43 = load i32, ptr @k, align 4, !tbaa !5
  %44 = icmp sle i32 %42, %43
  br i1 %44, label %46, label %45

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

46:                                               ; preds = %41
  %47 = load i32, ptr %3, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @robots, i64 noundef %48) #5
  %50 = getelementptr inbounds %"struct.std::pair", ptr %49, i32 0, i32 0
  %51 = load i32, ptr %3, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @robots, i64 noundef %52) #5
  %54 = getelementptr inbounds %"struct.std::pair", ptr %53, i32 0, i32 1
  %55 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef %50, ptr noundef %54)
  %56 = load i32, ptr %3, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @robots, i64 noundef %57) #5
  %59 = getelementptr inbounds %"struct.std::pair", ptr %58, i32 0, i32 0
  %60 = load i32, ptr %59, align 4, !tbaa !13
  %61 = add nsw i32 %60, -1
  store i32 %61, ptr %59, align 4, !tbaa !13
  %62 = load i32, ptr %3, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @robots, i64 noundef %63) #5
  %65 = getelementptr inbounds %"struct.std::pair", ptr %64, i32 0, i32 1
  %66 = load i32, ptr %65, align 4, !tbaa !15
  %67 = add nsw i32 %66, -1
  store i32 %67, ptr %65, align 4, !tbaa !15
  br label %68

68:                                               ; preds = %46
  %69 = load i32, ptr %3, align 4, !tbaa !5
  %70 = add nsw i32 %69, 1
  store i32 %70, ptr %3, align 4, !tbaa !5
  br label %41, !llvm.loop !16

71:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  %72 = load i32, ptr @k, align 4, !tbaa !5
  store i32 %72, ptr %4, align 4, !tbaa !5
  br label %73

73:                                               ; preds = %152, %71
  %74 = load i32, ptr %4, align 4, !tbaa !5
  %75 = icmp sge i32 %74, 0
  br i1 %75, label %77, label %76

76:                                               ; preds = %73
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %155

77:                                               ; preds = %73
  %78 = load i32, ptr %4, align 4, !tbaa !5
  %79 = icmp eq i32 %78, 0
  br i1 %79, label %80, label %98

80:                                               ; preds = %77
  %81 = load i32, ptr %4, align 4, !tbaa !5
  %82 = load i32, ptr %4, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @robots, i64 noundef %83) #5
  %85 = getelementptr inbounds %"struct.std::pair", ptr %84, i32 0, i32 0
  %86 = load i32, ptr %85, align 4, !tbaa !13
  %87 = call noundef i32 @_Z9find_nextii(i32 noundef %81, i32 noundef %86)
  %88 = load i32, ptr %4, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @nxt, i64 noundef %89) #5
  store i32 %87, ptr %90, align 4, !tbaa !5
  %91 = load i32, ptr %4, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @nxt, i64 noundef %92) #5
  %94 = load i32, ptr %93, align 4, !tbaa !5
  %95 = load i32, ptr %4, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) getelementptr inbounds ([2 x %"class.std::vector"], ptr @nxt, i64 0, i64 1), i64 noundef %96) #5
  store i32 %94, ptr %97, align 4, !tbaa !5
  br label %152

98:                                               ; preds = %77
  %99 = load i32, ptr %4, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @robots, i64 noundef %100) #5
  %102 = getelementptr inbounds %"struct.std::pair", ptr %101, i32 0, i32 0
  %103 = load i32, ptr %102, align 4, !tbaa !13
  %104 = icmp ne i32 %103, 0
  br i1 %104, label %105, label %117

105:                                              ; preds = %98
  %106 = load i32, ptr %4, align 4, !tbaa !5
  %107 = load i32, ptr %4, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @robots, i64 noundef %108) #5
  %110 = getelementptr inbounds %"struct.std::pair", ptr %109, i32 0, i32 0
  %111 = load i32, ptr %110, align 4, !tbaa !13
  %112 = sub nsw i32 %111, 1
  %113 = call noundef i32 @_Z9find_nextii(i32 noundef %106, i32 noundef %112)
  %114 = load i32, ptr %4, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @nxt, i64 noundef %115) #5
  store i32 %113, ptr %116, align 4, !tbaa !5
  br label %117

117:                                              ; preds = %105, %98
  %118 = load i32, ptr %4, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @robots, i64 noundef %119) #5
  %121 = getelementptr inbounds %"struct.std::pair", ptr %120, i32 0, i32 1
  %122 = load i32, ptr %121, align 4, !tbaa !15
  %123 = load i32, ptr @n, align 4, !tbaa !5
  %124 = sub nsw i32 %123, 1
  %125 = icmp ne i32 %122, %124
  br i1 %125, label %126, label %138

126:                                              ; preds = %117
  %127 = load i32, ptr %4, align 4, !tbaa !5
  %128 = load i32, ptr %4, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @robots, i64 noundef %129) #5
  %131 = getelementptr inbounds %"struct.std::pair", ptr %130, i32 0, i32 1
  %132 = load i32, ptr %131, align 4, !tbaa !15
  %133 = add nsw i32 %132, 1
  %134 = call noundef i32 @_Z9find_nextii(i32 noundef %127, i32 noundef %133)
  %135 = load i32, ptr %4, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) getelementptr inbounds ([2 x %"class.std::vector"], ptr @nxt, i64 0, i64 1), i64 noundef %136) #5
  store i32 %134, ptr %137, align 4, !tbaa !5
  br label %138

138:                                              ; preds = %126, %117
  %139 = load i32, ptr @t, align 8, !tbaa !17
  %140 = sub nsw i32 %139, 1
  %141 = load i32, ptr %4, align 4, !tbaa !5
  %142 = sext i32 %141 to i64
  %143 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @robots, i64 noundef %142) #5
  %144 = getelementptr inbounds %"struct.std::pair", ptr %143, i32 0, i32 0
  %145 = load i32, ptr %144, align 4, !tbaa !13
  %146 = load i32, ptr %4, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @robots, i64 noundef %147) #5
  %149 = getelementptr inbounds %"struct.std::pair", ptr %148, i32 0, i32 1
  %150 = load i32, ptr %149, align 4, !tbaa !15
  %151 = load i32, ptr %4, align 4, !tbaa !5
  call void @_ZN4tree6changeEiiiiii(ptr noundef nonnull align 8 dereferenceable(56) @t, i32 noundef 1, i32 noundef 0, i32 noundef %140, i32 noundef %145, i32 noundef %150, i32 noundef %151)
  br label %152

152:                                              ; preds = %138, %80
  %153 = load i32, ptr %4, align 4, !tbaa !5
  %154 = add nsw i32 %153, -1
  store i32 %154, ptr %4, align 4, !tbaa !5
  br label %73, !llvm.loop !24

155:                                              ; preds = %76
  %156 = call noundef i64 @_Z2dpii(i32 noundef 0, i32 noundef 0)
  %157 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %156)
  %158 = load i32, ptr %1, align 4
  ret i32 %158
}

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4tree4initEi(ptr noundef nonnull align 8 dereferenceable(56), i32 noundef) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4tree6changeEiiiiii(ptr noundef nonnull align 8 dereferenceable(56), i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #0 align 2

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

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 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 #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !6, i64 0}
!14 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!15 = !{!14, !6, i64 4}
!16 = distinct !{!16, !12}
!17 = !{!18, !6, i64 0}
!18 = !{!"_ZTS4tree", !6, i64 0, !19, i64 8, !19, i64 32}
!19 = !{!"_ZTSSt6vectorIiSaIiEE", !20, i64 0}
!20 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !23, i64 0, !23, i64 8, !23, i64 16}
!23 = !{!"any pointer", !7, i64 0}
!24 = distinct !{!24, !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 }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.tree = type { i32, %"class.std::vector", %"class.std::vector" }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@n = external dso_local global i32, align 4
@s = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@nxt = external dso_local global [2 x %"class.std::vector"], align 16
@robots = external dso_local global %"class.std::vector.0", align 8
@t = external dso_local global %struct.tree, align 8
@ank = external dso_local local_unnamed_addr global [100005 x [2 x i64]], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z2dpii(i32 noundef, i32 noundef) local_unnamed_addr #0

; 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 #1 align 2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1600080) @ank, i8 -1, i64 1600080, i1 false), !tbaa !5
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @s, ptr noundef nonnull @k)
  %2 = load i32, ptr @s, align 4, !tbaa !9
  %3 = add nsw i32 %2, -1
  store i32 %3, ptr @s, align 4, !tbaa !9
  %4 = load i32, ptr @k, align 4, !tbaa !9
  %5 = add nsw i32 %4, 1
  %6 = sext i32 %5 to i64
  tail call void @_ZNSt6vectorIiSaIiEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) @nxt, i64 noundef %6)
  %7 = load i32, ptr @k, align 4, !tbaa !9
  %8 = add nsw i32 %7, 1
  %9 = sext i32 %8 to i64
  tail call void @_ZNSt6vectorIiSaIiEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) getelementptr inbounds (i8, ptr @nxt, i64 24), i64 noundef %9)
  %10 = load i32, ptr @k, align 4, !tbaa !9
  %11 = add nsw i32 %10, 1
  %12 = sext i32 %11 to i64
  tail call void @_ZNSt6vectorISt4pairIiiESaIS1_EE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) @robots, i64 noundef %12)
  %13 = load i32, ptr @s, align 4, !tbaa !9
  %14 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @robots, i64 noundef 0) #5
  store i32 %13, ptr %14, align 4, !tbaa !11
  %15 = load i32, ptr @s, align 4, !tbaa !9
  %16 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @robots, i64 noundef 0) #5
  %17 = getelementptr inbounds i8, ptr %16, i64 4
  store i32 %15, ptr %17, align 4, !tbaa !13
  %18 = load i32, ptr @n, align 4, !tbaa !9
  tail call void @_ZN4tree4initEi(ptr noundef nonnull align 8 dereferenceable(56) @t, i32 noundef %18)
  %19 = load i32, ptr @k, align 4, !tbaa !9
  %.not36 = icmp slt i32 %19, 1
  br i1 %.not36, label %.preheader, label %.lr.ph

.preheader:                                       ; preds = %.lr.ph, %0
  %.lcssa = phi i32 [ %19, %0 ], [ %34, %.lr.ph ]
  %20 = icmp sgt i32 %.lcssa, -1
  br i1 %20, label %.lr.ph39.preheader, label %._crit_edge

.lr.ph39.preheader:                               ; preds = %.preheader
  %21 = icmp eq i32 %.lcssa, 0
  br i1 %21, label %.thread, label %.lr.ph51

.lr.ph51:                                         ; preds = %.lr.ph39.preheader
  %22 = zext nneg i32 %.lcssa to i64
  br label %45

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %23 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @robots, i64 noundef %indvars.iv) #5
  %24 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @robots, i64 noundef %indvars.iv) #5
  %25 = getelementptr inbounds i8, ptr %24, i64 4
  %26 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %23, ptr noundef nonnull %25)
  %27 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @robots, i64 noundef %indvars.iv) #5
  %28 = load i32, ptr %27, align 4, !tbaa !11
  %29 = add nsw i32 %28, -1
  store i32 %29, ptr %27, align 4, !tbaa !11
  %30 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @robots, i64 noundef %indvars.iv) #5
  %31 = getelementptr inbounds i8, ptr %30, i64 4
  %32 = load i32, ptr %31, align 4, !tbaa !13
  %33 = add nsw i32 %32, -1
  store i32 %33, ptr %31, align 4, !tbaa !13
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %34 = load i32, ptr @k, align 4, !tbaa !9
  %35 = sext i32 %34 to i64
  %.not.not = icmp slt i64 %indvars.iv, %35
  br i1 %.not.not, label %.lr.ph, label %.preheader, !llvm.loop !14

._crit_edge:                                      ; preds = %.thread, %.preheader
  %36 = tail call noundef i64 @_Z2dpii(i32 noundef 0, i32 noundef 0)
  %37 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %36)
  ret i32 0

.thread:                                          ; preds = %.lr.ph39, %.lr.ph39.preheader
  %38 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @robots, i64 noundef 0) #5
  %39 = load i32, ptr %38, align 4, !tbaa !11
  %40 = tail call noundef i32 @_Z9find_nextii(i32 noundef 0, i32 noundef %39)
  %41 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @nxt, i64 noundef 0) #5
  store i32 %40, ptr %41, align 4, !tbaa !9
  %42 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @nxt, i64 noundef 0) #5
  %43 = load i32, ptr %42, align 4, !tbaa !9
  %44 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) getelementptr inbounds (i8, ptr @nxt, i64 24), i64 noundef 0) #5
  store i32 %43, ptr %44, align 4, !tbaa !9
  br label %._crit_edge

45:                                               ; preds = %.lr.ph51, %.lr.ph39
  %indvars.iv4350 = phi i64 [ %22, %.lr.ph51 ], [ %indvars.iv.next44, %.lr.ph39 ]
  %46 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @robots, i64 noundef %indvars.iv4350) #5
  %47 = load i32, ptr %46, align 4, !tbaa !11
  %.not33 = icmp eq i32 %47, 0
  br i1 %.not33, label %55, label %48

48:                                               ; preds = %45
  %49 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @robots, i64 noundef %indvars.iv4350) #5
  %50 = load i32, ptr %49, align 4, !tbaa !11
  %51 = add nsw i32 %50, -1
  %52 = trunc nuw nsw i64 %indvars.iv4350 to i32
  %53 = tail call noundef i32 @_Z9find_nextii(i32 noundef %52, i32 noundef %51)
  %54 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @nxt, i64 noundef %indvars.iv4350) #5
  store i32 %53, ptr %54, align 4, !tbaa !9
  br label %55

55:                                               ; preds = %48, %45
  %56 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @robots, i64 noundef %indvars.iv4350) #5
  %57 = getelementptr inbounds i8, ptr %56, i64 4
  %58 = load i32, ptr %57, align 4, !tbaa !13
  %59 = load i32, ptr @n, align 4, !tbaa !9
  %60 = add nsw i32 %59, -1
  %.not34 = icmp eq i32 %58, %60
  br i1 %.not34, label %._crit_edge46, label %61

._crit_edge46:                                    ; preds = %55
  %.pre = trunc nuw nsw i64 %indvars.iv4350 to i32
  br label %.lr.ph39

61:                                               ; preds = %55
  %62 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @robots, i64 noundef %indvars.iv4350) #5
  %63 = getelementptr inbounds i8, ptr %62, i64 4
  %64 = load i32, ptr %63, align 4, !tbaa !13
  %65 = add nsw i32 %64, 1
  %66 = trunc nuw nsw i64 %indvars.iv4350 to i32
  %67 = tail call noundef i32 @_Z9find_nextii(i32 noundef %66, i32 noundef %65)
  %68 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) getelementptr inbounds (i8, ptr @nxt, i64 24), i64 noundef %indvars.iv4350) #5
  store i32 %67, ptr %68, align 4, !tbaa !9
  br label %.lr.ph39

.lr.ph39:                                         ; preds = %61, %._crit_edge46
  %.pre-phi = phi i32 [ %.pre, %._crit_edge46 ], [ %66, %61 ]
  %69 = load i32, ptr @t, align 8, !tbaa !16
  %70 = add nsw i32 %69, -1
  %71 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @robots, i64 noundef %indvars.iv4350) #5
  %72 = load i32, ptr %71, align 4, !tbaa !11
  %73 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorISt4pairIiiESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @robots, i64 noundef %indvars.iv4350) #5
  %74 = getelementptr inbounds i8, ptr %73, i64 4
  %75 = load i32, ptr %74, align 4, !tbaa !13
  tail call void @_ZN4tree6changeEiiiiii(ptr noundef nonnull align 8 dereferenceable(56) @t, i32 noundef 1, i32 noundef 0, i32 noundef %70, i32 noundef %72, i32 noundef %75, i32 noundef %.pre-phi)
  %indvars.iv.next44 = add nsw i64 %indvars.iv4350, -1
  %76 = icmp eq i64 %indvars.iv.next44, 0
  br i1 %76, label %.thread, label %45, !llvm.loop !23
}

; 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 @_ZNSt6vectorIiSaIiEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4tree4initEi(ptr noundef nonnull align 8 dereferenceable(56), i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4tree6changeEiiiiii(ptr noundef nonnull align 8 dereferenceable(56), i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0 align 2

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"_ZTSSt4pairIiiE", !10, i64 0, !10, i64 4}
!13 = !{!12, !10, i64 4}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!17, !10, i64 0}
!17 = !{!"_ZTS4tree", !10, i64 0, !18, i64 8, !18, i64 32}
!18 = !{!"_ZTSSt6vectorIiSaIiEE", !19, i64 0}
!19 = !{!"_ZTSSt12_Vector_baseIiSaIiEE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE12_Vector_implE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseIiSaIiEE17_Vector_impl_dataE", !22, i64 0, !22, i64 8, !22, i64 16}
!22 = !{!"any pointer", !7, i64 0}
!23 = distinct !{!23, !15}


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