; LLVM IR from tangjz/acm-icpc :: codeforces/complete (1335E1)

; 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 }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@que = external dso_local global [201 x i32], align 16
@tim = external dso_local global [201 x i32], align 16
@pos = external dso_local global [200001 x %"class.std::vector"], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

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

; 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 norecurse uwtable
define dso_local noundef i32 @main() #1 {
  %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 %"class.std::vector", 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 i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %20

20:                                               ; preds = %194, %0
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = load i32, ptr @t, align 4, !tbaa !5
  %23 = icmp sle i32 %21, %22
  br i1 %23, label %25, label %24

24:                                               ; preds = %20
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %197

25:                                               ; preds = %20
  %26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  store i32 0, ptr @m, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %27

27:                                               ; preds = %57, %25
  %28 = load i32, ptr %4, align 4, !tbaa !5
  %29 = load i32, ptr @n, align 4, !tbaa !5
  %30 = icmp slt i32 %28, %29
  br i1 %30, label %32, label %31

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

32:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  %33 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %5)
  %34 = load i32, ptr %5, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [201 x i32], ptr @tim, i64 0, i64 %35
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %38 = load i32, ptr %2, align 4, !tbaa !5
  %39 = icmp ne i32 %37, %38
  br i1 %39, label %40, label %53

40:                                               ; preds = %32
  %41 = load i32, ptr %2, align 4, !tbaa !5
  %42 = load i32, ptr %5, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [201 x i32], ptr @tim, i64 0, i64 %43
  store i32 %41, ptr %44, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %6) #7
  call void @llvm.memset.p0.i64(ptr align 8 %6, i8 0, i64 24, i1 false)
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #7
  %45 = load i32, ptr %5, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [200001 x %"class.std::vector"], ptr @pos, i64 0, i64 %46
  call void @_ZNSt6vectorIiSaIiEE4swapERS1_(ptr noundef nonnull align 8 dereferenceable(24) %6, ptr noundef nonnull align 8 dereferenceable(24) %47) #7
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #7
  %48 = load i32, ptr %5, align 4, !tbaa !5
  %49 = load i32, ptr @m, align 4, !tbaa !5
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr @m, align 4, !tbaa !5
  %51 = sext i32 %49 to i64
  %52 = getelementptr inbounds [201 x i32], ptr @que, i64 0, i64 %51
  store i32 %48, ptr %52, align 4, !tbaa !5
  br label %53

53:                                               ; preds = %40, %32
  %54 = load i32, ptr %5, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [200001 x %"class.std::vector"], ptr @pos, i64 0, i64 %55
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %56, ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  br label %57

57:                                               ; preds = %53
  %58 = load i32, ptr %4, align 4, !tbaa !5
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %4, align 4, !tbaa !5
  br label %27, !llvm.loop !9

60:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 0, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %61

61:                                               ; preds = %188, %60
  %62 = load i32, ptr %8, align 4, !tbaa !5
  %63 = load i32, ptr @m, align 4, !tbaa !5
  %64 = icmp slt i32 %62, %63
  br i1 %64, label %66, label %65

65:                                               ; preds = %61
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %191

66:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  %67 = load i32, ptr %8, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [201 x i32], ptr @que, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !5
  store i32 %70, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %71 = load i32, ptr %9, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [200001 x %"class.std::vector"], ptr @pos, i64 0, i64 %72
  %74 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %73) #7
  %75 = trunc i64 %74 to i32
  store i32 %75, ptr %10, align 4, !tbaa !5
  %76 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %77 = load i32, ptr %76, align 4, !tbaa !5
  store i32 %77, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %78

78:                                               ; preds = %184, %66
  %79 = load i32, ptr %11, align 4, !tbaa !5
  %80 = load i32, ptr @m, align 4, !tbaa !5
  %81 = icmp slt i32 %79, %80
  br i1 %81, label %83, label %82

82:                                               ; preds = %78
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %187

83:                                               ; preds = %78
  %84 = load i32, ptr %8, align 4, !tbaa !5
  %85 = load i32, ptr %11, align 4, !tbaa !5
  %86 = icmp eq i32 %84, %85
  br i1 %86, label %87, label %88

87:                                               ; preds = %83
  br label %184

88:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %89 = load i32, ptr %11, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [201 x i32], ptr @que, i64 0, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !5
  store i32 %92, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  %93 = load i32, ptr %12, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [200001 x %"class.std::vector"], ptr @pos, i64 0, i64 %94
  %96 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %95) #7
  %97 = trunc i64 %96 to i32
  store i32 %97, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 0, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %98 = load i32, ptr %10, align 4, !tbaa !5
  %99 = sub nsw i32 %98, 1
  store i32 %99, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  store i32 0, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  %100 = load i32, ptr %13, align 4, !tbaa !5
  %101 = sub nsw i32 %100, 1
  store i32 %101, ptr %17, align 4, !tbaa !5
  br label %102

102:                                              ; preds = %177, %88
  %103 = load i32, ptr %14, align 4, !tbaa !5
  %104 = load i32, ptr %15, align 4, !tbaa !5
  %105 = icmp slt i32 %103, %104
  br i1 %105, label %107, label %106

106:                                              ; preds = %102
  store i32 14, ptr %3, align 4
  br label %182

107:                                              ; preds = %102
  br label %108

108:                                              ; preds = %131, %107
  %109 = load i32, ptr %16, align 4, !tbaa !5
  %110 = load i32, ptr %17, align 4, !tbaa !5
  %111 = icmp sle i32 %109, %110
  br i1 %111, label %112, label %128

112:                                              ; preds = %108
  %113 = load i32, ptr %12, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [200001 x %"class.std::vector"], ptr @pos, i64 0, i64 %114
  %116 = load i32, ptr %16, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %115, i64 noundef %117) #7
  %119 = load i32, ptr %118, align 4, !tbaa !5
  %120 = load i32, ptr %9, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [200001 x %"class.std::vector"], ptr @pos, i64 0, i64 %121
  %123 = load i32, ptr %14, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %122, i64 noundef %124) #7
  %126 = load i32, ptr %125, align 4, !tbaa !5
  %127 = icmp slt i32 %119, %126
  br label %128

128:                                              ; preds = %112, %108
  %129 = phi i1 [ false, %108 ], [ %127, %112 ]
  br i1 %129, label %130, label %134

130:                                              ; preds = %128
  br label %131

131:                                              ; preds = %130
  %132 = load i32, ptr %16, align 4, !tbaa !5
  %133 = add nsw i32 %132, 1
  store i32 %133, ptr %16, align 4, !tbaa !5
  br label %108, !llvm.loop !11

134:                                              ; preds = %128
  br label %135

135:                                              ; preds = %158, %134
  %136 = load i32, ptr %16, align 4, !tbaa !5
  %137 = load i32, ptr %17, align 4, !tbaa !5
  %138 = icmp sle i32 %136, %137
  br i1 %138, label %139, label %155

139:                                              ; preds = %135
  %140 = load i32, ptr %9, align 4, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [200001 x %"class.std::vector"], ptr @pos, i64 0, i64 %141
  %143 = load i32, ptr %15, align 4, !tbaa !5
  %144 = sext i32 %143 to i64
  %145 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %142, i64 noundef %144) #7
  %146 = load i32, ptr %145, align 4, !tbaa !5
  %147 = load i32, ptr %12, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [200001 x %"class.std::vector"], ptr @pos, i64 0, i64 %148
  %150 = load i32, ptr %17, align 4, !tbaa !5
  %151 = sext i32 %150 to i64
  %152 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %149, i64 noundef %151) #7
  %153 = load i32, ptr %152, align 4, !tbaa !5
  %154 = icmp slt i32 %146, %153
  br label %155

155:                                              ; preds = %139, %135
  %156 = phi i1 [ false, %135 ], [ %154, %139 ]
  br i1 %156, label %157, label %161

157:                                              ; preds = %155
  br label %158

158:                                              ; preds = %157
  %159 = load i32, ptr %17, align 4, !tbaa !5
  %160 = add nsw i32 %159, -1
  store i32 %160, ptr %17, align 4, !tbaa !5
  br label %135, !llvm.loop !12

161:                                              ; preds = %155
  %162 = load i32, ptr %16, align 4, !tbaa !5
  %163 = load i32, ptr %17, align 4, !tbaa !5
  %164 = icmp sgt i32 %162, %163
  br i1 %164, label %165, label %166

165:                                              ; preds = %161
  store i32 14, ptr %3, align 4
  br label %182

166:                                              ; preds = %161
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  %167 = load i32, ptr %17, align 4, !tbaa !5
  %168 = load i32, ptr %16, align 4, !tbaa !5
  %169 = sub nsw i32 %167, %168
  %170 = add nsw i32 %169, 1
  %171 = load i32, ptr %14, align 4, !tbaa !5
  %172 = add nsw i32 %171, 1
  %173 = mul nsw i32 %172, 2
  %174 = add nsw i32 %170, %173
  store i32 %174, ptr %18, align 4, !tbaa !5
  %175 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %18)
  %176 = load i32, ptr %175, align 4, !tbaa !5
  store i32 %176, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  br label %177

177:                                              ; preds = %166
  %178 = load i32, ptr %14, align 4, !tbaa !5
  %179 = add nsw i32 %178, 1
  store i32 %179, ptr %14, align 4, !tbaa !5
  %180 = load i32, ptr %15, align 4, !tbaa !5
  %181 = add nsw i32 %180, -1
  store i32 %181, ptr %15, align 4, !tbaa !5
  br label %102, !llvm.loop !13

182:                                              ; preds = %165, %106
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %183

183:                                              ; preds = %182
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %184

184:                                              ; preds = %183, %87
  %185 = load i32, ptr %11, align 4, !tbaa !5
  %186 = add nsw i32 %185, 1
  store i32 %186, ptr %11, align 4, !tbaa !5
  br label %78, !llvm.loop !14

187:                                              ; preds = %82
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %188

188:                                              ; preds = %187
  %189 = load i32, ptr %8, align 4, !tbaa !5
  %190 = add nsw i32 %189, 1
  store i32 %190, ptr %8, align 4, !tbaa !5
  br label %61, !llvm.loop !15

191:                                              ; preds = %65
  %192 = load i32, ptr %7, align 4, !tbaa !5
  %193 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %192)
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %194

194:                                              ; preds = %191
  %195 = load i32, ptr %2, align 4, !tbaa !5
  %196 = add nsw i32 %195, 1
  store i32 %196, ptr %2, align 4, !tbaa !5
  br label %20, !llvm.loop !16

197:                                              ; preds = %24
  ret i32 0
}

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

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

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

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #6

; 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

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

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 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 #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 #6 = { 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 #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 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!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<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 }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local local_unnamed_addr global i32, align 4
@que = external dso_local local_unnamed_addr global [201 x i32], align 16
@tim = external dso_local local_unnamed_addr global [201 x i32], align 16
@pos = external dso_local global [200001 x %"class.std::vector"], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

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

; 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 norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"class.std::vector", align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %8 = load i32, ptr @t, align 4, !tbaa !5
  %.not73 = icmp slt i32 %8, 1
  br i1 %.not73, label %._crit_edge77, label %.lr.ph76

._crit_edge77:                                    ; preds = %._crit_edge72, %0
  ret i32 0

.lr.ph76:                                         ; preds = %0, %._crit_edge72
  %.04474 = phi i32 [ %35, %._crit_edge72 ], [ 1, %0 ]
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  store i32 0, ptr @m, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  store i32 0, ptr %1, align 4, !tbaa !5
  %10 = load i32, ptr @n, align 4, !tbaa !5
  %11 = icmp sgt i32 %10, 0
  br i1 %11, label %.lr.ph, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %.lr.ph76
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %._crit_edge72

._crit_edge:                                      ; preds = %27
  %.pre = load i32, ptr @m, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  store i32 0, ptr %4, align 4, !tbaa !5
  %12 = icmp sgt i32 %.pre, 0
  br i1 %12, label %.lr.ph71, label %._crit_edge72

.lr.ph:                                           ; preds = %.lr.ph76, %27
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  %13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %2)
  %14 = load i32, ptr %2, align 4, !tbaa !5
  %15 = sext i32 %14 to i64
  %16 = getelementptr inbounds [201 x i32], ptr @tim, i64 0, i64 %15
  %17 = load i32, ptr %16, align 4, !tbaa !5
  %.not49 = icmp eq i32 %17, %.04474
  br i1 %.not49, label %27, label %18

18:                                               ; preds = %.lr.ph
  store i32 %.04474, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #7
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %3, i8 0, i64 24, i1 false)
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #7
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [200001 x %"class.std::vector"], ptr @pos, i64 0, i64 %20
  call void @_ZNSt6vectorIiSaIiEE4swapERS1_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %21) #7
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #7
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = load i32, ptr @m, align 4, !tbaa !5
  %24 = add nsw i32 %23, 1
  store i32 %24, ptr @m, align 4, !tbaa !5
  %25 = sext i32 %23 to i64
  %26 = getelementptr inbounds [201 x i32], ptr @que, i64 0, i64 %25
  store i32 %22, ptr %26, align 4, !tbaa !5
  %.pre98 = sext i32 %22 to i64
  br label %27

27:                                               ; preds = %18, %.lr.ph
  %.pre-phi = phi i64 [ %.pre98, %18 ], [ %15, %.lr.ph ]
  %28 = getelementptr inbounds [200001 x %"class.std::vector"], ptr @pos, i64 0, i64 %.pre-phi
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %28, ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  %29 = load i32, ptr %1, align 4, !tbaa !5
  %30 = add nsw i32 %29, 1
  store i32 %30, ptr %1, align 4, !tbaa !5
  %31 = load i32, ptr @n, align 4, !tbaa !5
  %32 = icmp slt i32 %30, %31
  br i1 %32, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge72.loopexit:                           ; preds = %._crit_edge68
  %.pre97 = load i32, ptr %4, align 4, !tbaa !5
  br label %._crit_edge72

._crit_edge72:                                    ; preds = %._crit_edge.thread, %._crit_edge72.loopexit, %._crit_edge
  %33 = phi i32 [ %.pre97, %._crit_edge72.loopexit ], [ 0, %._crit_edge ], [ 0, %._crit_edge.thread ]
  %34 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %33)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  %35 = add nuw nsw i32 %.04474, 1
  %36 = load i32, ptr @t, align 4, !tbaa !5
  %.not.not = icmp slt i32 %.04474, %36
  br i1 %.not.not, label %.lr.ph76, label %._crit_edge77, !llvm.loop !11

.lr.ph71:                                         ; preds = %._crit_edge, %._crit_edge68
  %indvars.iv94 = phi i64 [ %indvars.iv.next95, %._crit_edge68 ], [ 0, %._crit_edge ]
  %37 = getelementptr inbounds [201 x i32], ptr @que, i64 0, i64 %indvars.iv94
  %38 = load i32, ptr %37, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #7
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [200001 x %"class.std::vector"], ptr @pos, i64 0, i64 %39
  %41 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %40) #7
  %42 = trunc i64 %41 to i32
  store i32 %42, ptr %5, align 4, !tbaa !5
  %43 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %44 = load i32, ptr %43, align 4, !tbaa !5
  store i32 %44, ptr %4, align 4, !tbaa !5
  %45 = load i32, ptr @m, align 4, !tbaa !5
  %46 = icmp sgt i32 %45, 0
  br i1 %46, label %.lr.ph67, label %.lr.ph71.._crit_edge68_crit_edge

.lr.ph71.._crit_edge68_crit_edge:                 ; preds = %.lr.ph71
  %.pre99 = sext i32 %45 to i64
  br label %._crit_edge68

._crit_edge68:                                    ; preds = %.critedge2.thread, %.lr.ph71.._crit_edge68_crit_edge
  %.pre-phi100 = phi i64 [ %.pre99, %.lr.ph71.._crit_edge68_crit_edge ], [ %90, %.critedge2.thread ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  %indvars.iv.next95 = add nuw nsw i64 %indvars.iv94, 1
  %47 = icmp slt i64 %indvars.iv.next95, %.pre-phi100
  br i1 %47, label %.lr.ph71, label %._crit_edge72.loopexit, !llvm.loop !12

.lr.ph67:                                         ; preds = %.lr.ph71, %.critedge2.thread
  %indvars.iv91 = phi i64 [ %indvars.iv.next92, %.critedge2.thread ], [ 0, %.lr.ph71 ]
  %48 = icmp eq i64 %indvars.iv94, %indvars.iv91
  br i1 %48, label %.critedge2.thread, label %49

49:                                               ; preds = %.lr.ph67
  %50 = getelementptr inbounds [201 x i32], ptr @que, i64 0, i64 %indvars.iv91
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [200001 x %"class.std::vector"], ptr @pos, i64 0, i64 %52
  %54 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %53) #7
  %55 = load i32, ptr %5, align 4, !tbaa !5
  %56 = icmp sgt i32 %55, 1
  br i1 %56, label %.preheader.preheader, label %.critedge2.thread

.preheader.preheader:                             ; preds = %49
  %57 = trunc i64 %54 to i32
  %58 = add nsw i32 %57, -1
  %59 = zext nneg i32 %55 to i64
  %60 = add nsw i64 %59, -1
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %.critedge2
  %indvars.iv86 = phi i64 [ 0, %.preheader.preheader ], [ %indvars.iv.next87, %.critedge2 ]
  %indvars.iv84 = phi i64 [ %60, %.preheader.preheader ], [ %indvars.iv.next85, %.critedge2 ]
  %.063 = phi i32 [ %58, %.preheader.preheader ], [ %81, %.critedge2 ]
  %.04062 = phi i32 [ 0, %.preheader.preheader ], [ %.141.lcssa, %.critedge2 ]
  %.not4752 = icmp sgt i32 %.04062, %.063
  br i1 %.not4752, label %.critedge, label %.lr.ph54

.lr.ph54:                                         ; preds = %.preheader
  %61 = sext i32 %.04062 to i64
  %62 = sext i32 %.063 to i64
  %63 = add i32 %.063, 1
  br label %64

64:                                               ; preds = %.lr.ph54, %70
  %indvars.iv = phi i64 [ %61, %.lr.ph54 ], [ %indvars.iv.next, %70 ]
  %65 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %53, i64 noundef %indvars.iv) #7
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %40, i64 noundef %indvars.iv86) #7
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = icmp slt i32 %66, %68
  br i1 %69, label %70, label %.critedge.loopexit.split.loop.exit103

70:                                               ; preds = %64
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %.not47.not = icmp slt i64 %indvars.iv, %62
  br i1 %.not47.not, label %64, label %.critedge, !llvm.loop !13

.critedge.loopexit.split.loop.exit103:            ; preds = %64
  %71 = trunc nsw i64 %indvars.iv to i32
  br label %.critedge

.critedge:                                        ; preds = %70, %.critedge.loopexit.split.loop.exit103, %.preheader
  %.141.lcssa = phi i32 [ %.04062, %.preheader ], [ %71, %.critedge.loopexit.split.loop.exit103 ], [ %63, %70 ]
  %.not4857 = icmp sgt i32 %.141.lcssa, %.063
  br i1 %.not4857, label %.critedge2.thread, label %.lr.ph59

.lr.ph59:                                         ; preds = %.critedge
  %72 = sext i32 %.063 to i64
  %73 = sext i32 %.141.lcssa to i64
  br label %74

74:                                               ; preds = %.lr.ph59, %80
  %indvars.iv81 = phi i64 [ %72, %.lr.ph59 ], [ %indvars.iv.next82, %80 ]
  %75 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %40, i64 noundef %indvars.iv84) #7
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %53, i64 noundef %indvars.iv81) #7
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = icmp slt i32 %76, %78
  br i1 %79, label %80, label %.critedge2

80:                                               ; preds = %74
  %indvars.iv.next82 = add nsw i64 %indvars.iv81, -1
  %.not48.not = icmp sgt i64 %indvars.iv81, %73
  br i1 %.not48.not, label %74, label %.critedge2.thread, !llvm.loop !14

.critedge2:                                       ; preds = %74
  %81 = trunc nsw i64 %indvars.iv81 to i32
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #7
  %indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1
  %indvars.iv.next87.tr = trunc i64 %indvars.iv.next87 to i32
  %82 = shl i32 %indvars.iv.next87.tr, 1
  %83 = or disjoint i32 %82, 1
  %84 = sub i32 %83, %.141.lcssa
  %85 = add i32 %84, %81
  store i32 %85, ptr %6, align 4, !tbaa !5
  %86 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %87 = load i32, ptr %86, align 4, !tbaa !5
  store i32 %87, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  %indvars.iv.next85 = add nsw i64 %indvars.iv84, -1
  %88 = icmp slt i64 %indvars.iv.next87, %indvars.iv.next85
  br i1 %88, label %.preheader, label %.critedge2.thread, !llvm.loop !15

.critedge2.thread:                                ; preds = %.critedge2, %.critedge, %80, %49, %.lr.ph67
  %indvars.iv.next92 = add nuw nsw i64 %indvars.iv91, 1
  %89 = load i32, ptr @m, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = icmp slt i64 %indvars.iv.next92, %90
  br i1 %91, label %.lr.ph67, label %._crit_edge68, !llvm.loop !16
}

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

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

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

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

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

; 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 #5 align 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #6

; 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: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

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 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 #2 = { 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 #6 = { 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 #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 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}


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