; LLVM IR from DionysiosB/CodeForces :: 1600-1699 (1612B-SpecialPermutation)

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

@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [1 x i8], align 1

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

20:                                               ; preds = %157, %155, %0
  %21 = load i64, ptr %2, align 8, !tbaa !5
  %22 = add nsw i64 %21, -1
  store i64 %22, ptr %2, align 8, !tbaa !5
  %23 = icmp ne i64 %21, 0
  br i1 %23, label %24, label %160

24:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  %25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %3, ptr noundef %4, ptr noundef %5)
  call void @llvm.lifetime.start.p0(i64 24, ptr %6) #5
  %26 = load i64, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  store i64 -1, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #5
  call void @_ZNSaIlEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #5
  invoke void @_ZNSt6vectorIlSaIlEEC2EmRKlRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %26, ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 1 dereferenceable(1) %8)
          to label %27 unwind label %41

27:                                               ; preds = %24
  call void @_ZNSt15__new_allocatorIlED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  %28 = load i64, ptr %4, align 8, !tbaa !5
  %29 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef 0) #5
  store i64 %28, ptr %29, align 8, !tbaa !5
  %30 = load i64, ptr %5, align 8, !tbaa !5
  %31 = load i64, ptr %3, align 8, !tbaa !5
  %32 = sub nsw i64 %31, 1
  %33 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %32) #5
  store i64 %30, ptr %33, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %34 = load i64, ptr %3, align 8, !tbaa !5
  store i64 %34, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  store i64 1, ptr %12, align 8, !tbaa !5
  br label %35

35:                                               ; preds = %64, %27
  %36 = load i64, ptr %12, align 8, !tbaa !5
  %37 = load i64, ptr %3, align 8, !tbaa !5
  %38 = sub nsw i64 %37, 1
  %39 = icmp slt i64 %36, %38
  br i1 %39, label %45, label %40

40:                                               ; preds = %35
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  br label %67

41:                                               ; preds = %24
  %42 = landingpad { ptr, i32 }
          cleanup
  %43 = extractvalue { ptr, i32 } %42, 0
  store ptr %43, ptr %9, align 8
  %44 = extractvalue { ptr, i32 } %42, 1
  store i32 %44, ptr %10, align 4
  call void @_ZNSt15__new_allocatorIlED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %8) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  br label %159

45:                                               ; preds = %35
  br label %46

46:                                               ; preds = %56, %45
  %47 = load i64, ptr %11, align 8, !tbaa !5
  %48 = load i64, ptr %4, align 8, !tbaa !5
  %49 = icmp eq i64 %47, %48
  br i1 %49, label %54, label %50

50:                                               ; preds = %46
  %51 = load i64, ptr %11, align 8, !tbaa !5
  %52 = load i64, ptr %5, align 8, !tbaa !5
  %53 = icmp eq i64 %51, %52
  br label %54

54:                                               ; preds = %50, %46
  %55 = phi i1 [ true, %46 ], [ %53, %50 ]
  br i1 %55, label %56, label %59

56:                                               ; preds = %54
  %57 = load i64, ptr %11, align 8, !tbaa !5
  %58 = add nsw i64 %57, -1
  store i64 %58, ptr %11, align 8, !tbaa !5
  br label %46, !llvm.loop !9

59:                                               ; preds = %54
  %60 = load i64, ptr %11, align 8, !tbaa !5
  %61 = add nsw i64 %60, -1
  store i64 %61, ptr %11, align 8, !tbaa !5
  %62 = load i64, ptr %12, align 8, !tbaa !5
  %63 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %62) #5
  store i64 %60, ptr %63, align 8, !tbaa !5
  br label %64

64:                                               ; preds = %59
  %65 = load i64, ptr %12, align 8, !tbaa !5
  %66 = add nsw i64 %65, 1
  store i64 %66, ptr %12, align 8, !tbaa !5
  br label %35, !llvm.loop !11

67:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %68 = load i64, ptr %3, align 8, !tbaa !5
  %69 = add nsw i64 %68, 1
  store i64 %69, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  store i64 -1, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  store i64 0, ptr %15, align 8, !tbaa !5
  br label %70

70:                                               ; preds = %90, %67
  %71 = load i64, ptr %15, align 8, !tbaa !5
  %72 = load i64, ptr %3, align 8, !tbaa !5
  %73 = sdiv i64 %72, 2
  %74 = icmp slt i64 %71, %73
  br i1 %74, label %76, label %75

75:                                               ; preds = %70
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  br label %93

76:                                               ; preds = %70
  %77 = load i64, ptr %13, align 8, !tbaa !5
  %78 = load i64, ptr %15, align 8, !tbaa !5
  %79 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %78) #5
  %80 = load i64, ptr %79, align 8, !tbaa !5
  %81 = icmp slt i64 %77, %80
  br i1 %81, label %82, label %84

82:                                               ; preds = %76
  %83 = load i64, ptr %13, align 8, !tbaa !5
  br label %88

84:                                               ; preds = %76
  %85 = load i64, ptr %15, align 8, !tbaa !5
  %86 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %85) #5
  %87 = load i64, ptr %86, align 8, !tbaa !5
  br label %88

88:                                               ; preds = %84, %82
  %89 = phi i64 [ %83, %82 ], [ %87, %84 ]
  store i64 %89, ptr %13, align 8, !tbaa !5
  br label %90

90:                                               ; preds = %88
  %91 = load i64, ptr %15, align 8, !tbaa !5
  %92 = add nsw i64 %91, 1
  store i64 %92, ptr %15, align 8, !tbaa !5
  br label %70, !llvm.loop !12

93:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %94 = load i64, ptr %3, align 8, !tbaa !5
  %95 = sdiv i64 %94, 2
  store i64 %95, ptr %16, align 8, !tbaa !5
  br label %96

96:                                               ; preds = %115, %93
  %97 = load i64, ptr %16, align 8, !tbaa !5
  %98 = load i64, ptr %3, align 8, !tbaa !5
  %99 = icmp slt i64 %97, %98
  br i1 %99, label %101, label %100

100:                                              ; preds = %96
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  br label %118

101:                                              ; preds = %96
  %102 = load i64, ptr %14, align 8, !tbaa !5
  %103 = load i64, ptr %16, align 8, !tbaa !5
  %104 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %103) #5
  %105 = load i64, ptr %104, align 8, !tbaa !5
  %106 = icmp sgt i64 %102, %105
  br i1 %106, label %107, label %109

107:                                              ; preds = %101
  %108 = load i64, ptr %14, align 8, !tbaa !5
  br label %113

109:                                              ; preds = %101
  %110 = load i64, ptr %16, align 8, !tbaa !5
  %111 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %110) #5
  %112 = load i64, ptr %111, align 8, !tbaa !5
  br label %113

113:                                              ; preds = %109, %107
  %114 = phi i64 [ %108, %107 ], [ %112, %109 ]
  store i64 %114, ptr %14, align 8, !tbaa !5
  br label %115

115:                                              ; preds = %113
  %116 = load i64, ptr %16, align 8, !tbaa !5
  %117 = add nsw i64 %116, 1
  store i64 %117, ptr %16, align 8, !tbaa !5
  br label %96, !llvm.loop !13

118:                                              ; preds = %100
  %119 = load i64, ptr %13, align 8, !tbaa !5
  %120 = load i64, ptr %4, align 8, !tbaa !5
  %121 = icmp ne i64 %119, %120
  br i1 %121, label %126, label %122

122:                                              ; preds = %118
  %123 = load i64, ptr %14, align 8, !tbaa !5
  %124 = load i64, ptr %5, align 8, !tbaa !5
  %125 = icmp ne i64 %123, %124
  br i1 %125, label %126, label %133

126:                                              ; preds = %122, %118
  %127 = invoke i32 @puts(ptr noundef @.str.2)
          to label %128 unwind label %129

128:                                              ; preds = %126
  store i32 2, ptr %17, align 4
  br label %155, !llvm.loop !14

129:                                              ; preds = %152, %126
  %130 = landingpad { ptr, i32 }
          cleanup
  %131 = extractvalue { ptr, i32 } %130, 0
  store ptr %131, ptr %9, align 8
  %132 = extractvalue { ptr, i32 } %130, 1
  store i32 %132, ptr %10, align 4
  br label %158

133:                                              ; preds = %122
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  store i64 0, ptr %18, align 8, !tbaa !5
  br label %134

134:                                              ; preds = %145, %133
  %135 = load i64, ptr %18, align 8, !tbaa !5
  %136 = load i64, ptr %3, align 8, !tbaa !5
  %137 = icmp slt i64 %135, %136
  br i1 %137, label %139, label %138

138:                                              ; preds = %134
  store i32 15, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  br label %152

139:                                              ; preds = %134
  %140 = load i64, ptr %18, align 8, !tbaa !5
  %141 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %140) #5
  %142 = load i64, ptr %141, align 8, !tbaa !5
  %143 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.3, i64 noundef %142)
          to label %144 unwind label %148

144:                                              ; preds = %139
  br label %145

145:                                              ; preds = %144
  %146 = load i64, ptr %18, align 8, !tbaa !5
  %147 = add nsw i64 %146, 1
  store i64 %147, ptr %18, align 8, !tbaa !5
  br label %134, !llvm.loop !15

148:                                              ; preds = %139
  %149 = landingpad { ptr, i32 }
          cleanup
  %150 = extractvalue { ptr, i32 } %149, 0
  store ptr %150, ptr %9, align 8
  %151 = extractvalue { ptr, i32 } %149, 1
  store i32 %151, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  br label %158

152:                                              ; preds = %138
  %153 = invoke i32 @puts(ptr noundef @.str.4)
          to label %154 unwind label %129

154:                                              ; preds = %152
  store i32 0, ptr %17, align 4
  br label %155

155:                                              ; preds = %154, %128
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @_ZNSt6vectorIlSaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  %156 = load i32, ptr %17, align 4
  switch i32 %156, label %167 [
    i32 0, label %157
    i32 2, label %20
  ]

157:                                              ; preds = %155
  br label %20, !llvm.loop !14

158:                                              ; preds = %148, %129
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @_ZNSt6vectorIlSaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #5
  br label %159

159:                                              ; preds = %158, %41
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  br label %162

160:                                              ; preds = %20
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  %161 = load i32, ptr %1, align 4
  ret i32 %161

162:                                              ; preds = %159
  %163 = load ptr, ptr %9, align 8
  %164 = load i32, ptr %10, align 4
  %165 = insertvalue { ptr, i32 } poison, ptr %163, 0
  %166 = insertvalue { ptr, i32 } %165, i32 %164, 1
  resume { ptr, i32 } %166

167:                                              ; preds = %155
  unreachable
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSaIlEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

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

declare i32 @__gxx_personality_v0(...)

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

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

declare i32 @puts(ptr noundef) #2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIlED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #4 = { 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 = { 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 = 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}


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

@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [1 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca %"class.std::vector", align 8
  %6 = alloca i64, align 8
  %7 = alloca %"class.std::allocator", align 1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #5
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %9 = load i64, ptr %1, align 8, !tbaa !5
  %10 = add nsw i64 %9, -1
  store i64 %10, ptr %1, align 8, !tbaa !5
  %.not53 = icmp eq i64 %9, 0
  br i1 %.not53, label %._crit_edge56, label %.lr.ph55

.lr.ph55:                                         ; preds = %0, %._crit_edge52
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %2, ptr noundef nonnull %3, ptr noundef nonnull %4)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #5
  %12 = load i64, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  store i64 -1, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %7) #5
  call void @_ZNSaIlEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #5
  invoke void @_ZNSt6vectorIlSaIlEEC2EmRKlRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %12, ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 1 dereferenceable(1) %7)
          to label %13 unwind label %28

13:                                               ; preds = %.lr.ph55
  call void @_ZNSt15__new_allocatorIlED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  %14 = load i64, ptr %3, align 8, !tbaa !5
  %15 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef 0) #5
  store i64 %14, ptr %15, align 8, !tbaa !5
  %16 = load i64, ptr %4, align 8, !tbaa !5
  %17 = load i64, ptr %2, align 8, !tbaa !5
  %18 = add nsw i64 %17, -1
  %19 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %18) #5
  store i64 %16, ptr %19, align 8, !tbaa !5
  %20 = load i64, ptr %2, align 8, !tbaa !5
  %21 = icmp sgt i64 %20, 2
  br i1 %21, label %.preheader, label %._crit_edge

.preheader:                                       ; preds = %13, %35
  %.03039 = phi i64 [ %37, %35 ], [ 1, %13 ]
  %.03138 = phi i64 [ %34, %35 ], [ %20, %13 ]
  %22 = load i64, ptr %3, align 8, !tbaa !5
  %23 = load i64, ptr %4, align 8
  br label %30

._crit_edge:                                      ; preds = %35, %13
  %24 = phi i64 [ %20, %13 ], [ %38, %35 ]
  %25 = add nsw i64 %24, 1
  %26 = sdiv i64 %24, 2
  %27 = icmp sgt i64 %24, 1
  br i1 %27, label %.lr.ph, label %.preheader36

28:                                               ; preds = %.lr.ph55
  %29 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIlED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %7) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #5
  resume { ptr, i32 } %29

30:                                               ; preds = %30, %.preheader
  %.1 = phi i64 [ %34, %30 ], [ %.03138, %.preheader ]
  %31 = icmp eq i64 %.1, %22
  %32 = icmp eq i64 %.1, %23
  %33 = select i1 %31, i1 true, i1 %32
  %34 = add nsw i64 %.1, -1
  br i1 %33, label %30, label %35, !llvm.loop !9

35:                                               ; preds = %30
  %36 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %.03039) #5
  store i64 %.1, ptr %36, align 8, !tbaa !5
  %37 = add nuw nsw i64 %.03039, 1
  %38 = load i64, ptr %2, align 8, !tbaa !5
  %39 = add nsw i64 %38, -1
  %40 = icmp slt i64 %37, %39
  br i1 %40, label %.preheader, label %._crit_edge, !llvm.loop !11

.preheader36:                                     ; preds = %49, %._crit_edge
  %41 = phi i64 [ %24, %._crit_edge ], [ %52, %49 ]
  %.029.lcssa = phi i64 [ %25, %._crit_edge ], [ %50, %49 ]
  %.lcssa37 = phi i64 [ %26, %._crit_edge ], [ %53, %49 ]
  %42 = icmp slt i64 %.lcssa37, %41
  br i1 %42, label %.lr.ph47, label %._crit_edge48

.lr.ph:                                           ; preds = %._crit_edge, %49
  %.02741 = phi i64 [ %51, %49 ], [ 0, %._crit_edge ]
  %.02940 = phi i64 [ %50, %49 ], [ %25, %._crit_edge ]
  %43 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %.02741) #5
  %44 = load i64, ptr %43, align 8, !tbaa !5
  %45 = icmp slt i64 %.02940, %44
  br i1 %45, label %49, label %46

46:                                               ; preds = %.lr.ph
  %47 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %.02741) #5
  %48 = load i64, ptr %47, align 8, !tbaa !5
  br label %49

49:                                               ; preds = %.lr.ph, %46
  %50 = phi i64 [ %48, %46 ], [ %.02940, %.lr.ph ]
  %51 = add nuw nsw i64 %.02741, 1
  %52 = load i64, ptr %2, align 8, !tbaa !5
  %53 = sdiv i64 %52, 2
  %54 = icmp slt i64 %51, %53
  br i1 %54, label %.lr.ph, label %.preheader36, !llvm.loop !12

._crit_edge48:                                    ; preds = %65, %.preheader36
  %55 = phi i64 [ %41, %.preheader36 ], [ %68, %65 ]
  %.028.lcssa = phi i64 [ -1, %.preheader36 ], [ %66, %65 ]
  %56 = load i64, ptr %3, align 8, !tbaa !5
  %.not33 = icmp eq i64 %.029.lcssa, %56
  %57 = load i64, ptr %4, align 8
  %.not34 = icmp eq i64 %.028.lcssa, %57
  %or.cond = select i1 %.not33, i1 %.not34, i1 false
  br i1 %or.cond, label %.preheader35, label %._crit_edge52, !llvm.loop !13

.preheader35:                                     ; preds = %._crit_edge48
  %58 = icmp sgt i64 %55, 0
  br i1 %58, label %.lr.ph51, label %._crit_edge52

.lr.ph47:                                         ; preds = %.preheader36, %65
  %.02646 = phi i64 [ %67, %65 ], [ %.lcssa37, %.preheader36 ]
  %.02845 = phi i64 [ %66, %65 ], [ -1, %.preheader36 ]
  %59 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %.02646) #5
  %60 = load i64, ptr %59, align 8, !tbaa !5
  %61 = icmp sgt i64 %.02845, %60
  br i1 %61, label %65, label %62

62:                                               ; preds = %.lr.ph47
  %63 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %.02646) #5
  %64 = load i64, ptr %63, align 8, !tbaa !5
  br label %65

65:                                               ; preds = %.lr.ph47, %62
  %66 = phi i64 [ %64, %62 ], [ %.02845, %.lr.ph47 ]
  %67 = add nsw i64 %.02646, 1
  %68 = load i64, ptr %2, align 8, !tbaa !5
  %69 = icmp slt i64 %67, %68
  br i1 %69, label %.lr.ph47, label %._crit_edge48, !llvm.loop !14

.lr.ph51:                                         ; preds = %.preheader35, %.lr.ph51
  %.050 = phi i64 [ %73, %.lr.ph51 ], [ 0, %.preheader35 ]
  %70 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIlSaIlEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %5, i64 noundef %.050) #5
  %71 = load i64, ptr %70, align 8, !tbaa !5
  %72 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %71)
  %73 = add nuw nsw i64 %.050, 1
  %74 = load i64, ptr %2, align 8, !tbaa !5
  %75 = icmp slt i64 %73, %74
  br i1 %75, label %.lr.ph51, label %._crit_edge52, !llvm.loop !15

._crit_edge52:                                    ; preds = %.lr.ph51, %.preheader35, %._crit_edge48
  %.str.4.sink = phi ptr [ @.str.2, %._crit_edge48 ], [ @.str.4, %.preheader35 ], [ @.str.4, %.lr.ph51 ]
  %76 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.4.sink)
  call void @_ZNSt6vectorIlSaIlEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  %77 = load i64, ptr %1, align 8, !tbaa !5
  %78 = add nsw i64 %77, -1
  store i64 %78, ptr %1, align 8, !tbaa !5
  %.not = icmp eq i64 %77, 0
  br i1 %.not, label %._crit_edge56, label %.lr.ph55

._crit_edge56:                                    ; preds = %._crit_edge52, %0
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #5
  ret i32 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: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSaIlEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIlED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 #4 = { 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 = { 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 = 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}


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