; LLVM IR from DionysiosB/CodeForces :: 1300-1399 (1327B-PrincessesAndPrinces)

; 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::_Bvector_base" }
%"struct.std::_Bvector_base" = type { %"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl" }
%"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl" = type { %"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl_data" }
%"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl_data" = type { %"struct.std::_Bit_iterator", %"struct.std::_Bit_iterator", ptr }
%"struct.std::_Bit_iterator" = type { %"struct.std::_Bit_iterator_base.base", [4 x i8] }
%"struct.std::_Bit_iterator_base.base" = type <{ ptr, i32 }>
%"class.std::allocator.0" = type { i8 }
%"struct.std::_Bit_reference" = type { ptr, i64 }

@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [17 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 %"class.std::vector", align 8
  %5 = alloca i8, align 1
  %6 = alloca %"class.std::allocator.0", align 1
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  %13 = alloca i64, align 8
  %14 = alloca i8, align 1
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca %"struct.std::_Bit_reference", align 8
  %18 = alloca %"struct.std::_Bit_reference", align 8
  %19 = alloca i64, align 8
  %20 = alloca %"struct.std::_Bit_reference", align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #5
  %21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2)
  br label %22

22:                                               ; preds = %149, %0
  %23 = load i64, ptr %2, align 8, !tbaa !5
  %24 = add nsw i64 %23, -1
  store i64 %24, ptr %2, align 8, !tbaa !5
  %25 = icmp ne i64 %23, 0
  br i1 %25, label %26, label %152

26:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %27 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %3)
  call void @llvm.lifetime.start.p0(i64 40, ptr %4) #5
  %28 = load i64, ptr %3, align 8, !tbaa !5
  %29 = add nsw i64 %28, 1
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #5
  store i8 0, ptr %5, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #5
  call void @_ZNSaIbEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #5
  invoke void @_ZNSt6vectorIbSaIbEEC2EmRKbRKS0_(ptr noundef nonnull align 8 dereferenceable(40) %4, i64 noundef %29, ptr noundef nonnull align 1 dereferenceable(1) %5, ptr noundef nonnull align 1 dereferenceable(1) %6)
          to label %30 unwind label %36

30:                                               ; preds = %26
  call void @_ZNSt15__new_allocatorIbED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  store i64 -1, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  store i64 -1, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  store i64 1, ptr %11, align 8, !tbaa !5
  br label %31

31:                                               ; preds = %103, %30
  %32 = load i64, ptr %11, align 8, !tbaa !5
  %33 = load i64, ptr %3, align 8, !tbaa !5
  %34 = icmp sle i64 %32, %33
  br i1 %34, label %40, label %35

35:                                               ; preds = %31
  store i32 4, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  br label %107

36:                                               ; preds = %26
  %37 = landingpad { ptr, i32 }
          cleanup
  %38 = extractvalue { ptr, i32 } %37, 0
  store ptr %38, ptr %7, align 8
  %39 = extractvalue { ptr, i32 } %37, 1
  store i32 %39, ptr %8, align 4
  call void @_ZNSt15__new_allocatorIbED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %6) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #5
  br label %151

40:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %41 = invoke i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %13)
          to label %42 unwind label %48

42:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 1, ptr %14) #5
  store i8 0, ptr %14, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  store i64 0, ptr %15, align 8, !tbaa !5
  br label %43

43:                                               ; preds = %89, %42
  %44 = load i64, ptr %15, align 8, !tbaa !5
  %45 = load i64, ptr %13, align 8, !tbaa !5
  %46 = icmp slt i64 %44, %45
  br i1 %46, label %52, label %47

47:                                               ; preds = %43
  store i32 7, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  br label %97

48:                                               ; preds = %40
  %49 = landingpad { ptr, i32 }
          cleanup
  %50 = extractvalue { ptr, i32 } %49, 0
  store ptr %50, ptr %7, align 8
  %51 = extractvalue { ptr, i32 } %49, 1
  store i32 %51, ptr %8, align 4
  br label %106

52:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %53 = invoke i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %16)
          to label %54 unwind label %69

54:                                               ; preds = %52
  %55 = load i8, ptr %14, align 1, !tbaa !9, !range !11, !noundef !12
  %56 = trunc i8 %55 to i1
  call void @llvm.lifetime.start.p0(i64 16, ptr %17) #5
  br i1 %56, label %66, label %57

57:                                               ; preds = %54
  %58 = load i64, ptr %16, align 8, !tbaa !5
  %59 = invoke { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) %4, i64 noundef %58)
          to label %60 unwind label %73

60:                                               ; preds = %57
  %61 = getelementptr inbounds { ptr, i64 }, ptr %17, i32 0, i32 0
  %62 = extractvalue { ptr, i64 } %59, 0
  store ptr %62, ptr %61, align 8
  %63 = getelementptr inbounds { ptr, i64 }, ptr %17, i32 0, i32 1
  %64 = extractvalue { ptr, i64 } %59, 1
  store i64 %64, ptr %63, align 8
  %65 = call noundef zeroext i1 @_ZNKSt14_Bit_referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %17) #5
  br label %66

66:                                               ; preds = %60, %54
  %67 = phi i1 [ true, %54 ], [ %65, %60 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr %17) #5
  br i1 %67, label %68, label %77

68:                                               ; preds = %66
  store i32 9, ptr %12, align 4
  br label %86

69:                                               ; preds = %52
  %70 = landingpad { ptr, i32 }
          cleanup
  %71 = extractvalue { ptr, i32 } %70, 0
  store ptr %71, ptr %7, align 8
  %72 = extractvalue { ptr, i32 } %70, 1
  store i32 %72, ptr %8, align 4
  br label %96

73:                                               ; preds = %57
  %74 = landingpad { ptr, i32 }
          cleanup
  %75 = extractvalue { ptr, i32 } %74, 0
  store ptr %75, ptr %7, align 8
  %76 = extractvalue { ptr, i32 } %74, 1
  store i32 %76, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %17) #5
  br label %96

77:                                               ; preds = %66
  store i8 1, ptr %14, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %18) #5
  %78 = load i64, ptr %16, align 8, !tbaa !5
  %79 = invoke { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) %4, i64 noundef %78)
          to label %80 unwind label %92

80:                                               ; preds = %77
  %81 = getelementptr inbounds { ptr, i64 }, ptr %18, i32 0, i32 0
  %82 = extractvalue { ptr, i64 } %79, 0
  store ptr %82, ptr %81, align 8
  %83 = getelementptr inbounds { ptr, i64 }, ptr %18, i32 0, i32 1
  %84 = extractvalue { ptr, i64 } %79, 1
  store i64 %84, ptr %83, align 8
  %85 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt14_Bit_referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16) %18, i1 noundef zeroext true) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #5
  store i32 0, ptr %12, align 4
  br label %86

86:                                               ; preds = %80, %68
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  %87 = load i32, ptr %12, align 4
  switch i32 %87, label %159 [
    i32 0, label %88
    i32 9, label %89
  ]

88:                                               ; preds = %86
  br label %89

89:                                               ; preds = %88, %86
  %90 = load i64, ptr %15, align 8, !tbaa !5
  %91 = add nsw i64 %90, 1
  store i64 %91, ptr %15, align 8, !tbaa !5
  br label %43, !llvm.loop !13

92:                                               ; preds = %77
  %93 = landingpad { ptr, i32 }
          cleanup
  %94 = extractvalue { ptr, i32 } %93, 0
  store ptr %94, ptr %7, align 8
  %95 = extractvalue { ptr, i32 } %93, 1
  store i32 %95, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #5
  br label %96

96:                                               ; preds = %92, %73, %69
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #5
  br label %106

97:                                               ; preds = %47
  %98 = load i8, ptr %14, align 1, !tbaa !9, !range !11, !noundef !12
  %99 = trunc i8 %98 to i1
  br i1 %99, label %102, label %100

100:                                              ; preds = %97
  %101 = load i64, ptr %11, align 8, !tbaa !5
  store i64 %101, ptr %9, align 8, !tbaa !5
  br label %102

102:                                              ; preds = %100, %97
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %103

103:                                              ; preds = %102
  %104 = load i64, ptr %11, align 8, !tbaa !5
  %105 = add nsw i64 %104, 1
  store i64 %105, ptr %11, align 8, !tbaa !5
  br label %31, !llvm.loop !15

106:                                              ; preds = %96, %48
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  br label %150

107:                                              ; preds = %35
  %108 = load i64, ptr %9, align 8, !tbaa !5
  %109 = icmp slt i64 %108, 0
  br i1 %109, label %110, label %117

110:                                              ; preds = %107
  %111 = invoke i32 @puts(ptr noundef @.str.1)
          to label %112 unwind label %113

112:                                              ; preds = %110
  br label %149

113:                                              ; preds = %144, %110
  %114 = landingpad { ptr, i32 }
          cleanup
  %115 = extractvalue { ptr, i32 } %114, 0
  store ptr %115, ptr %7, align 8
  %116 = extractvalue { ptr, i32 } %114, 1
  store i32 %116, ptr %8, align 4
  br label %150

117:                                              ; preds = %107
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  store i64 1, ptr %19, align 8, !tbaa !5
  br label %118

118:                                              ; preds = %140, %117
  %119 = load i64, ptr %19, align 8, !tbaa !5
  %120 = load i64, ptr %3, align 8, !tbaa !5
  %121 = icmp sle i64 %119, %120
  br i1 %121, label %123, label %122

122:                                              ; preds = %118
  store i32 10, ptr %12, align 4
  br label %143

123:                                              ; preds = %118
  call void @llvm.lifetime.start.p0(i64 16, ptr %20) #5
  %124 = load i64, ptr %19, align 8, !tbaa !5
  %125 = invoke { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) %4, i64 noundef %124)
          to label %126 unwind label %135

126:                                              ; preds = %123
  %127 = getelementptr inbounds { ptr, i64 }, ptr %20, i32 0, i32 0
  %128 = extractvalue { ptr, i64 } %125, 0
  store ptr %128, ptr %127, align 8
  %129 = getelementptr inbounds { ptr, i64 }, ptr %20, i32 0, i32 1
  %130 = extractvalue { ptr, i64 } %125, 1
  store i64 %130, ptr %129, align 8
  %131 = call noundef zeroext i1 @_ZNKSt14_Bit_referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %20) #5
  %132 = xor i1 %131, true
  call void @llvm.lifetime.end.p0(i64 16, ptr %20) #5
  br i1 %132, label %133, label %139

133:                                              ; preds = %126
  %134 = load i64, ptr %19, align 8, !tbaa !5
  store i64 %134, ptr %10, align 8, !tbaa !5
  store i32 10, ptr %12, align 4
  br label %143

135:                                              ; preds = %123
  %136 = landingpad { ptr, i32 }
          cleanup
  %137 = extractvalue { ptr, i32 } %136, 0
  store ptr %137, ptr %7, align 8
  %138 = extractvalue { ptr, i32 } %136, 1
  store i32 %138, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  br label %150

139:                                              ; preds = %126
  br label %140

140:                                              ; preds = %139
  %141 = load i64, ptr %19, align 8, !tbaa !5
  %142 = add nsw i64 %141, 1
  store i64 %142, ptr %19, align 8, !tbaa !5
  br label %118, !llvm.loop !16

143:                                              ; preds = %133, %122
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  br label %144

144:                                              ; preds = %143
  %145 = load i64, ptr %9, align 8, !tbaa !5
  %146 = load i64, ptr %10, align 8, !tbaa !5
  %147 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.2, i64 noundef %145, i64 noundef %146)
          to label %148 unwind label %113

148:                                              ; preds = %144
  br label %149

149:                                              ; preds = %148, %112
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @_ZNSt13_Bvector_baseISaIbEED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %4) #5
  call void @llvm.lifetime.end.p0(i64 40, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  br label %22, !llvm.loop !17

150:                                              ; preds = %135, %113, %106
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @_ZNSt13_Bvector_baseISaIbEED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %4) #5
  br label %151

151:                                              ; preds = %150, %36
  call void @llvm.lifetime.end.p0(i64 40, 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 %154

152:                                              ; preds = %22
  store i32 0, ptr %1, align 4
  store i32 1, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  %153 = load i32, ptr %1, align 4
  ret i32 %153

154:                                              ; preds = %151
  %155 = load ptr, ptr %7, align 8
  %156 = load i32, ptr %8, align 4
  %157 = insertvalue { ptr, i32 } poison, ptr %155, 0
  %158 = insertvalue { ptr, i32 } %157, i32 %156, 1
  resume { ptr, i32 } %158

159:                                              ; preds = %86
  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 @_ZNSaIbEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

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

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40), i64 noundef) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt14_Bit_referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt14_Bit_referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16), i1 noundef zeroext) #3 align 2

declare i32 @puts(ptr noundef) #2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt13_Bvector_baseISaIbEED2Ev(ptr noundef nonnull align 8 dereferenceable(40)) 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 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}


; 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::_Bvector_base" }
%"struct.std::_Bvector_base" = type { %"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl" }
%"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl" = type { %"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl_data" }
%"struct.std::_Bvector_base<std::allocator<bool>>::_Bvector_impl_data" = type { %"struct.std::_Bit_iterator", %"struct.std::_Bit_iterator", ptr }
%"struct.std::_Bit_iterator" = type { %"struct.std::_Bit_iterator_base.base", [4 x i8] }
%"struct.std::_Bit_iterator_base.base" = type <{ ptr, i32 }>
%"class.std::allocator.0" = type { i8 }
%"struct.std::_Bit_reference" = type { ptr, i64 }

@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [17 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 %"class.std::vector", align 8
  %4 = alloca i8, align 1
  %5 = alloca %"class.std::allocator.0", align 1
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca %"struct.std::_Bit_reference", align 8
  %9 = alloca %"struct.std::_Bit_reference", align 8
  %10 = alloca %"struct.std::_Bit_reference", align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #5
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %12 = load i64, ptr %1, align 8, !tbaa !5
  %13 = add nsw i64 %12, -1
  store i64 %13, ptr %1, align 8, !tbaa !5
  %.not52 = icmp eq i64 %12, 0
  br i1 %.not52, label %._crit_edge55, label %.lr.ph54

.lr.ph54:                                         ; preds = %0
  %14 = getelementptr inbounds i8, ptr %8, i64 8
  %15 = getelementptr inbounds i8, ptr %9, i64 8
  %16 = getelementptr inbounds i8, ptr %10, i64 8
  br label %17

17:                                               ; preds = %.lr.ph54, %69
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #5
  %18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %2)
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %3) #5
  %19 = load i64, ptr %2, align 8, !tbaa !5
  %20 = add nsw i64 %19, 1
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #5
  store i8 0, ptr %4, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #5
  call void @_ZNSaIbEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #5
  invoke void @_ZNSt6vectorIbSaIbEEC2EmRKbRKS0_(ptr noundef nonnull align 8 dereferenceable(40) %3, i64 noundef %20, ptr noundef nonnull align 1 dereferenceable(1) %4, ptr noundef nonnull align 1 dereferenceable(1) %5)
          to label %21 unwind label %24

21:                                               ; preds = %17
  call void @_ZNSt15__new_allocatorIbED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #5
  %22 = load i64, ptr %2, align 8, !tbaa !5
  %.not2738 = icmp slt i64 %22, 1
  br i1 %.not2738, label %._crit_edge43.thread, label %.lr.ph42

._crit_edge43:                                    ; preds = %._crit_edge
  %23 = icmp slt i64 %spec.select, 0
  br i1 %23, label %._crit_edge43.thread, label %.preheader

.preheader:                                       ; preds = %._crit_edge43
  %.not2845 = icmp slt i64 %31, 1
  br i1 %.not2845, label %._crit_edge48, label %.lr.ph47

24:                                               ; preds = %17
  %25 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIbED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #5
  br label %73

.lr.ph42:                                         ; preds = %21, %._crit_edge
  %.01840 = phi i64 [ %30, %._crit_edge ], [ 1, %21 ]
  %.02039 = phi i64 [ %spec.select, %._crit_edge ], [ -1, %21 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  %26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %6)
  %27 = load i64, ptr %6, align 8, !tbaa !5
  %28 = icmp sgt i64 %27, 0
  br i1 %28, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %50, %.lr.ph42
  %.017.lcssa = phi i8 [ 0, %.lr.ph42 ], [ %.1, %50 ]
  %29 = trunc nuw i8 %.017.lcssa to i1
  %spec.select = select i1 %29, i64 %.02039, i64 %.01840
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  %30 = add nuw nsw i64 %.01840, 1
  %31 = load i64, ptr %2, align 8, !tbaa !5
  %.not27.not = icmp slt i64 %.01840, %31
  br i1 %.not27.not, label %.lr.ph42, label %._crit_edge43, !llvm.loop !11

.lr.ph:                                           ; preds = %.lr.ph42, %50
  %.01637 = phi i64 [ %51, %50 ], [ 0, %.lr.ph42 ]
  %.01736 = phi i8 [ %.1, %50 ], [ 0, %.lr.ph42 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  %32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %7)
  %33 = trunc nuw i8 %.01736 to i1
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #5
  br i1 %33, label %.critedge, label %34

34:                                               ; preds = %.lr.ph
  %35 = load i64, ptr %7, align 8, !tbaa !5
  %36 = invoke { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) %3, i64 noundef %35)
          to label %37 unwind label %41

37:                                               ; preds = %34
  %38 = extractvalue { ptr, i64 } %36, 0
  store ptr %38, ptr %8, align 8
  %39 = extractvalue { ptr, i64 } %36, 1
  store i64 %39, ptr %14, align 8
  %40 = call noundef zeroext i1 @_ZNKSt14_Bit_referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %8) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #5
  br i1 %40, label %50, label %43

.critedge:                                        ; preds = %.lr.ph
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #5
  br label %50

41:                                               ; preds = %34
  %42 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #5
  br label %56

43:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #5
  %44 = load i64, ptr %7, align 8, !tbaa !5
  %45 = invoke { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) %3, i64 noundef %44)
          to label %46 unwind label %54

46:                                               ; preds = %43
  %47 = extractvalue { ptr, i64 } %45, 0
  store ptr %47, ptr %9, align 8
  %48 = extractvalue { ptr, i64 } %45, 1
  store i64 %48, ptr %15, align 8
  %49 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt14_Bit_referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16) %9, i1 noundef zeroext true) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #5
  br label %50

50:                                               ; preds = %37, %.critedge, %46
  %.1 = phi i8 [ 1, %46 ], [ %.01736, %.critedge ], [ %.01736, %37 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  %51 = add nuw nsw i64 %.01637, 1
  %52 = load i64, ptr %6, align 8, !tbaa !5
  %53 = icmp slt i64 %51, %52
  br i1 %53, label %.lr.ph, label %._crit_edge, !llvm.loop !13

54:                                               ; preds = %43
  %55 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #5
  br label %56

56:                                               ; preds = %54, %41
  %.pn = phi { ptr, i32 } [ %55, %54 ], [ %42, %41 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  br label %72

._crit_edge43.thread:                             ; preds = %21, %._crit_edge43
  %57 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
  br label %69

.lr.ph47:                                         ; preds = %.preheader, %65
  %.046 = phi i64 [ %66, %65 ], [ 1, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %10) #5
  %58 = invoke { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) %3, i64 noundef %.046)
          to label %59 unwind label %63

59:                                               ; preds = %.lr.ph47
  %60 = extractvalue { ptr, i64 } %58, 0
  store ptr %60, ptr %10, align 8
  %61 = extractvalue { ptr, i64 } %58, 1
  store i64 %61, ptr %16, align 8
  %62 = call noundef zeroext i1 @_ZNKSt14_Bit_referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %10) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #5
  br i1 %62, label %65, label %._crit_edge48

63:                                               ; preds = %.lr.ph47
  %64 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #5
  br label %72

65:                                               ; preds = %59
  %66 = add nuw nsw i64 %.046, 1
  %67 = load i64, ptr %2, align 8, !tbaa !5
  %.not28.not = icmp slt i64 %.046, %67
  br i1 %.not28.not, label %.lr.ph47, label %._crit_edge48, !llvm.loop !14

._crit_edge48:                                    ; preds = %65, %59, %.preheader
  %.019 = phi i64 [ -1, %.preheader ], [ %.046, %59 ], [ -1, %65 ]
  %68 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %spec.select, i64 noundef %.019)
  br label %69

69:                                               ; preds = %._crit_edge48, %._crit_edge43.thread
  call void @_ZNSt13_Bvector_baseISaIbEED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %3) #5
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  %70 = load i64, ptr %1, align 8, !tbaa !5
  %71 = add nsw i64 %70, -1
  store i64 %71, ptr %1, align 8, !tbaa !5
  %.not = icmp eq i64 %70, 0
  br i1 %.not, label %._crit_edge55, label %17, !llvm.loop !15

72:                                               ; preds = %63, %56
  %.pn.pn = phi { ptr, i32 } [ %.pn, %56 ], [ %64, %63 ]
  call void @_ZNSt13_Bvector_baseISaIbEED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %3) #5
  br label %73

73:                                               ; preds = %72, %24
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %72 ], [ %25, %24 ]
  call void @llvm.lifetime.end.p0(i64 40, 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 } %.pn.pn.pn

._crit_edge55:                                    ; preds = %69, %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 @_ZNSaIbEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

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

declare i32 @__gxx_personality_v0(...)

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

; 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 uwtable
declare dso_local { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40), i64 noundef) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt14_Bit_referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt14_Bit_referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16), i1 noundef zeroext) 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 @_ZNSt13_Bvector_baseISaIbEED2Ev(ptr noundef nonnull align 8 dereferenceable(40)) 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 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}


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