; LLVM IR from kazunetakahashi/atcoder :: 2018/0317_ARC092 (E)

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

%"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::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::allocator.4" = type { i8 }
%"struct.std::_Bit_reference" = type { ptr, i64 }

@N = external dso_local global i32, align 4
@a = external dso_local global [1010 x i64], align 16
@maxi = external dso_local global i64, align 8
@ans = external dso_local global %"class.std::vector", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5flushv() #1

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::vector", align 8
  %3 = alloca i8, align 1
  %4 = alloca %"class.std::allocator.4", align 1
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i8, align 1
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %"struct.std::_Bit_reference", align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i64, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca %"struct.std::_Bit_reference", align 8
  store i32 0, ptr %1, align 4
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @N)
  call void @llvm.lifetime.start.p0(i64 40, ptr %2) #5
  %20 = load i32, ptr @N, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #5
  store i8 0, ptr %3, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %4) #5
  call void @_ZNSaIbEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #5
  invoke void @_ZNSt6vectorIbSaIbEEC2EmRKbRKS0_(ptr noundef nonnull align 8 dereferenceable(40) %2, i64 noundef %21, ptr noundef nonnull align 1 dereferenceable(1) %3, ptr noundef nonnull align 1 dereferenceable(1) %4)
          to label %22 unwind label %29

22:                                               ; preds = %0
  %23 = call noundef nonnull align 8 dereferenceable(40) ptr @_ZNSt6vectorIbSaIbEEaSEOS1_(ptr noundef nonnull align 8 dereferenceable(40) @ans, ptr noundef nonnull align 8 dereferenceable(40) %2) #5
  call void @_ZNSt13_Bvector_baseISaIbEED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %2) #5
  call void @_ZNSt15__new_allocatorIbED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 40, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %38, %22
  %25 = load i32, ptr %7, align 4, !tbaa !5
  %26 = load i32, ptr @N, align 4, !tbaa !5
  %27 = icmp slt i32 %25, %26
  br i1 %27, label %33, label %28

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

29:                                               ; preds = %0
  %30 = landingpad { ptr, i32 }
          cleanup
  %31 = extractvalue { ptr, i32 } %30, 0
  store ptr %31, ptr %5, align 8
  %32 = extractvalue { ptr, i32 } %30, 1
  store i32 %32, ptr %6, align 4
  call void @_ZNSt15__new_allocatorIbED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 40, ptr %2) #5
  br label %156

33:                                               ; preds = %24
  %34 = load i32, ptr %7, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [1010 x i64], ptr @a, i64 0, i64 %35
  %37 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %36)
  br label %38

38:                                               ; preds = %33
  %39 = load i32, ptr %7, align 4, !tbaa !5
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %7, align 4, !tbaa !5
  br label %24, !llvm.loop !11

41:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #5
  store i8 1, ptr %8, align 1, !tbaa !9
  store i64 -1000000007, ptr @maxi, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %69, %41
  %43 = load i32, ptr %10, align 4, !tbaa !5
  %44 = load i32, ptr @N, align 4, !tbaa !5
  %45 = icmp slt i32 %43, %44
  br i1 %45, label %47, label %46

46:                                               ; preds = %42
  store i32 5, ptr %11, align 4
  br label %72

47:                                               ; preds = %42
  %48 = load i32, ptr %10, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [1010 x i64], ptr @a, i64 0, i64 %49
  %51 = load i64, ptr %50, align 8, !tbaa !13
  %52 = icmp sge i64 %51, 0
  br i1 %52, label %53, label %54

53:                                               ; preds = %47
  store i8 0, ptr %8, align 1, !tbaa !9
  store i32 5, ptr %11, align 4
  br label %72

54:                                               ; preds = %47
  %55 = load i64, ptr @maxi, align 8, !tbaa !13
  %56 = load i32, ptr %10, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [1010 x i64], ptr @a, i64 0, i64 %57
  %59 = load i64, ptr %58, align 8, !tbaa !13
  %60 = icmp slt i64 %55, %59
  br i1 %60, label %61, label %67

61:                                               ; preds = %54
  %62 = load i32, ptr %10, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [1010 x i64], ptr @a, i64 0, i64 %63
  %65 = load i64, ptr %64, align 8, !tbaa !13
  store i64 %65, ptr @maxi, align 8, !tbaa !13
  %66 = load i32, ptr %10, align 4, !tbaa !5
  store i32 %66, ptr %9, align 4, !tbaa !5
  br label %67

67:                                               ; preds = %61, %54
  br label %68

68:                                               ; preds = %67
  br label %69

69:                                               ; preds = %68
  %70 = load i32, ptr %10, align 4, !tbaa !5
  %71 = add nsw i32 %70, 1
  store i32 %71, ptr %10, align 4, !tbaa !5
  br label %42, !llvm.loop !15

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

73:                                               ; preds = %72
  %74 = load i8, ptr %8, align 1, !tbaa !9, !range !16, !noundef !17
  %75 = trunc i8 %74 to i1
  br i1 %75, label %76, label %85

76:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #5
  %77 = load i32, ptr %9, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = call { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) @ans, i64 noundef %78)
  %80 = getelementptr inbounds { ptr, i64 }, ptr %12, i32 0, i32 0
  %81 = extractvalue { ptr, i64 } %79, 0
  store ptr %81, ptr %80, align 8
  %82 = getelementptr inbounds { ptr, i64 }, ptr %12, i32 0, i32 1
  %83 = extractvalue { ptr, i64 } %79, 1
  store i64 %83, ptr %82, align 8
  %84 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt14_Bit_referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16) %12, i1 noundef zeroext true) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #5
  call void @_Z5flushv()
  store i32 0, ptr %1, align 4
  store i32 1, ptr %11, align 4
  br label %152

85:                                               ; preds = %73
  store i64 0, ptr @maxi, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 0, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %86

86:                                               ; preds = %122, %85
  %87 = load i32, ptr %14, align 4, !tbaa !5
  %88 = icmp slt i32 %87, 2
  br i1 %88, label %90, label %89

89:                                               ; preds = %86
  store i32 8, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %125

90:                                               ; preds = %86
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  store i64 0, ptr %15, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %91 = load i32, ptr %14, align 4, !tbaa !5
  store i32 %91, ptr %16, align 4, !tbaa !5
  br label %92

92:                                               ; preds = %111, %90
  %93 = load i32, ptr %16, align 4, !tbaa !5
  %94 = load i32, ptr @N, align 4, !tbaa !5
  %95 = icmp slt i32 %93, %94
  br i1 %95, label %97, label %96

96:                                               ; preds = %92
  store i32 11, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  br label %114

97:                                               ; preds = %92
  %98 = load i32, ptr %16, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [1010 x i64], ptr @a, i64 0, i64 %99
  %101 = load i64, ptr %100, align 8, !tbaa !13
  %102 = icmp sge i64 %101, 0
  br i1 %102, label %103, label %110

103:                                              ; preds = %97
  %104 = load i32, ptr %16, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [1010 x i64], ptr @a, i64 0, i64 %105
  %107 = load i64, ptr %106, align 8, !tbaa !13
  %108 = load i64, ptr %15, align 8, !tbaa !13
  %109 = add nsw i64 %108, %107
  store i64 %109, ptr %15, align 8, !tbaa !13
  br label %110

110:                                              ; preds = %103, %97
  br label %111

111:                                              ; preds = %110
  %112 = load i32, ptr %16, align 4, !tbaa !5
  %113 = add nsw i32 %112, 2
  store i32 %113, ptr %16, align 4, !tbaa !5
  br label %92, !llvm.loop !18

114:                                              ; preds = %96
  %115 = load i64, ptr @maxi, align 8, !tbaa !13
  %116 = load i64, ptr %15, align 8, !tbaa !13
  %117 = icmp slt i64 %115, %116
  br i1 %117, label %118, label %121

118:                                              ; preds = %114
  %119 = load i64, ptr %15, align 8, !tbaa !13
  store i64 %119, ptr @maxi, align 8, !tbaa !13
  %120 = load i32, ptr %14, align 4, !tbaa !5
  store i32 %120, ptr %13, align 4, !tbaa !5
  br label %121

121:                                              ; preds = %118, %114
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  br label %122

122:                                              ; preds = %121
  %123 = load i32, ptr %14, align 4, !tbaa !5
  %124 = add nsw i32 %123, 1
  store i32 %124, ptr %14, align 4, !tbaa !5
  br label %86, !llvm.loop !19

125:                                              ; preds = %89
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  %126 = load i32, ptr %13, align 4, !tbaa !5
  store i32 %126, ptr %17, align 4, !tbaa !5
  br label %127

127:                                              ; preds = %148, %125
  %128 = load i32, ptr %17, align 4, !tbaa !5
  %129 = load i32, ptr @N, align 4, !tbaa !5
  %130 = icmp slt i32 %128, %129
  br i1 %130, label %132, label %131

131:                                              ; preds = %127
  store i32 14, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %151

132:                                              ; preds = %127
  %133 = load i32, ptr %17, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [1010 x i64], ptr @a, i64 0, i64 %134
  %136 = load i64, ptr %135, align 8, !tbaa !13
  %137 = icmp sge i64 %136, 0
  br i1 %137, label %138, label %147

138:                                              ; preds = %132
  call void @llvm.lifetime.start.p0(i64 16, ptr %18) #5
  %139 = load i32, ptr %17, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = call { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) @ans, i64 noundef %140)
  %142 = getelementptr inbounds { ptr, i64 }, ptr %18, i32 0, i32 0
  %143 = extractvalue { ptr, i64 } %141, 0
  store ptr %143, ptr %142, align 8
  %144 = getelementptr inbounds { ptr, i64 }, ptr %18, i32 0, i32 1
  %145 = extractvalue { ptr, i64 } %141, 1
  store i64 %145, ptr %144, align 8
  %146 = 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
  br label %147

147:                                              ; preds = %138, %132
  br label %148

148:                                              ; preds = %147
  %149 = load i32, ptr %17, align 4, !tbaa !5
  %150 = add nsw i32 %149, 2
  store i32 %150, ptr %17, align 4, !tbaa !5
  br label %127, !llvm.loop !20

151:                                              ; preds = %131
  call void @_Z5flushv()
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  store i32 0, ptr %11, align 4
  br label %152

152:                                              ; preds = %151, %76
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #5
  %153 = load i32, ptr %11, align 4
  switch i32 %153, label %161 [
    i32 0, label %154
    i32 1, label %154
  ]

154:                                              ; preds = %152, %152
  %155 = load i32, ptr %1, align 4
  ret i32 %155

156:                                              ; preds = %29
  %157 = load ptr, ptr %5, align 8
  %158 = load i32, ptr %6, align 4
  %159 = insertvalue { ptr, i32 } poison, ptr %157, 0
  %160 = insertvalue { ptr, i32 } %159, i32 %158, 1
  resume { ptr, i32 } %160

161:                                              ; preds = %152
  unreachable
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSaIbEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 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 #1 align 2

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) #1 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) #0 align 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 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"long long", !7, i64 0}
!15 = distinct !{!15, !12}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::vector" = type { %"struct.std::_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::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::allocator.4" = type { i8 }
%"struct.std::_Bit_reference" = type { ptr, i64 }

@N = external dso_local global i32, align 4
@a = external dso_local global [1010 x i64], align 16
@maxi = external dso_local local_unnamed_addr global i64, align 8
@ans = external dso_local global %"class.std::vector", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5flushv() local_unnamed_addr #1

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::vector", align 8
  %2 = alloca i8, align 1
  %3 = alloca %"class.std::allocator.4", align 1
  %4 = alloca %"struct.std::_Bit_reference", align 8
  %5 = alloca %"struct.std::_Bit_reference", align 8
  %6 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @N)
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %1) #6
  %7 = load i32, ptr @N, align 4, !tbaa !5
  %8 = sext i32 %7 to i64
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %2) #6
  store i8 0, ptr %2, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %3) #6
  call void @_ZNSaIbEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #6
  invoke void @_ZNSt6vectorIbSaIbEEC2EmRKbRKS0_(ptr noundef nonnull align 8 dereferenceable(40) %1, i64 noundef %8, ptr noundef nonnull align 1 dereferenceable(1) %2, ptr noundef nonnull align 1 dereferenceable(1) %3)
          to label %9 unwind label %13

9:                                                ; preds = %0
  %10 = call noundef nonnull align 8 dereferenceable(40) ptr @_ZNSt6vectorIbSaIbEEaSEOS1_(ptr noundef nonnull align 8 dereferenceable(40) @ans, ptr noundef nonnull align 8 dereferenceable(40) %1) #6
  call void @_ZNSt13_Bvector_baseISaIbEED2Ev(ptr noundef nonnull align 8 dereferenceable(40) %1) #6
  call void @_ZNSt15__new_allocatorIbED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %1) #6
  %11 = load i32, ptr @N, align 4, !tbaa !5
  %12 = icmp sgt i32 %11, 0
  br i1 %12, label %.lr.ph, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %9
  store i64 -1000000007, ptr @maxi, align 8, !tbaa !11
  br label %.critedge

._crit_edge:                                      ; preds = %.lr.ph
  store i64 -1000000007, ptr @maxi, align 8, !tbaa !11
  %.not45 = icmp sgt i32 %17, 0
  br i1 %.not45, label %.lr.ph49.preheader, label %.critedge

.lr.ph49.preheader:                               ; preds = %._crit_edge
  %wide.trip.count = zext nneg i32 %17 to i64
  br label %.lr.ph49

13:                                               ; preds = %0
  %14 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIbED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %1) #6
  resume { ptr, i32 } %14

.lr.ph:                                           ; preds = %9, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %9 ]
  %15 = getelementptr inbounds [1010 x i64], ptr @a, i64 0, i64 %indvars.iv
  %16 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %15)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %17 = load i32, ptr @N, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = icmp slt i64 %indvars.iv.next, %18
  br i1 %19, label %.lr.ph, label %._crit_edge, !llvm.loop !13

.lr.ph49:                                         ; preds = %.lr.ph49.preheader, %28
  %indvars.iv67 = phi i64 [ 0, %.lr.ph49.preheader ], [ %indvars.iv.next68, %28 ]
  %.03546 = phi i32 [ 0, %.lr.ph49.preheader ], [ %.136, %28 ]
  %20 = phi i64 [ -1000000007, %.lr.ph49.preheader ], [ %29, %28 ]
  %21 = getelementptr inbounds [1010 x i64], ptr @a, i64 0, i64 %indvars.iv67
  %22 = load i64, ptr %21, align 8, !tbaa !11
  %23 = icmp sgt i64 %22, -1
  br i1 %23, label %.lr.ph53.preheader, label %24

24:                                               ; preds = %.lr.ph49
  %25 = icmp slt i64 %20, %22
  br i1 %25, label %26, label %28

26:                                               ; preds = %24
  store i64 %22, ptr @maxi, align 8, !tbaa !11
  %27 = trunc nuw nsw i64 %indvars.iv67 to i32
  br label %28

28:                                               ; preds = %26, %24
  %29 = phi i64 [ %22, %26 ], [ %20, %24 ]
  %.136 = phi i32 [ %27, %26 ], [ %.03546, %24 ]
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next68, %wide.trip.count
  br i1 %exitcond.not, label %.critedge.loopexit, label %.lr.ph49, !llvm.loop !15

.critedge.loopexit:                               ; preds = %28
  %30 = sext i32 %.136 to i64
  br label %.critedge

.critedge:                                        ; preds = %._crit_edge.thread, %.critedge.loopexit, %._crit_edge
  %.035.lcssa = phi i64 [ 0, %._crit_edge ], [ %30, %.critedge.loopexit ], [ 0, %._crit_edge.thread ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #6
  %31 = call { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) @ans, i64 noundef %.035.lcssa)
  %32 = extractvalue { ptr, i64 } %31, 0
  store ptr %32, ptr %4, align 8
  %33 = getelementptr inbounds i8, ptr %4, i64 8
  %34 = extractvalue { ptr, i64 } %31, 1
  store i64 %34, ptr %33, align 8
  %35 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt14_Bit_referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16) %4, i1 noundef zeroext true) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #6
  br label %._crit_edge64

.lr.ph53.preheader:                               ; preds = %.lr.ph49
  store i64 0, ptr @maxi, align 8, !tbaa !11
  %36 = zext nneg i32 %17 to i64
  %37 = add nsw i64 %wide.trip.count, -1
  %38 = lshr i64 %37, 1
  %39 = add nuw i64 %38, 1
  %xtraiter = and i64 %39, 3
  %40 = icmp ult i32 %17, 7
  br i1 %40, label %._crit_edge54.unr-lcssa, label %.lr.ph53.preheader.new

.lr.ph53.preheader.new:                           ; preds = %.lr.ph53.preheader
  %unroll_iter = and i64 %39, -4
  br label %.lr.ph53

.lr.ph63:                                         ; preds = %.preheader
  %41 = getelementptr inbounds i8, ptr %5, i64 8
  %42 = zext nneg i32 %.133.1 to i64
  br label %66

._crit_edge54.unr-lcssa:                          ; preds = %.lr.ph53, %.lr.ph53.preheader
  %spec.select.lcssa.ph = phi i64 [ poison, %.lr.ph53.preheader ], [ %spec.select.3, %.lr.ph53 ]
  %indvars.iv72.unr = phi i64 [ 0, %.lr.ph53.preheader ], [ %indvars.iv.next73.3, %.lr.ph53 ]
  %.03051.unr = phi i64 [ 0, %.lr.ph53.preheader ], [ %spec.select.3, %.lr.ph53 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge54, label %.lr.ph53.epil

.lr.ph53.epil:                                    ; preds = %._crit_edge54.unr-lcssa, %.lr.ph53.epil
  %indvars.iv72.epil = phi i64 [ %indvars.iv.next73.epil, %.lr.ph53.epil ], [ %indvars.iv72.unr, %._crit_edge54.unr-lcssa ]
  %.03051.epil = phi i64 [ %spec.select.epil, %.lr.ph53.epil ], [ %.03051.unr, %._crit_edge54.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph53.epil ], [ 0, %._crit_edge54.unr-lcssa ]
  %43 = getelementptr inbounds [1010 x i64], ptr @a, i64 0, i64 %indvars.iv72.epil
  %44 = load i64, ptr %43, align 16, !tbaa !11
  %45 = call i64 @llvm.smax.i64(i64 %44, i64 0)
  %spec.select.epil = add nuw nsw i64 %45, %.03051.epil
  %indvars.iv.next73.epil = add nuw nsw i64 %indvars.iv72.epil, 2
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge54, label %.lr.ph53.epil, !llvm.loop !16

._crit_edge54:                                    ; preds = %.lr.ph53.epil, %._crit_edge54.unr-lcssa
  %spec.select.lcssa = phi i64 [ %spec.select.lcssa.ph, %._crit_edge54.unr-lcssa ], [ %spec.select.epil, %.lr.ph53.epil ]
  %.not = icmp eq i64 %spec.select.lcssa, 0
  br i1 %.not, label %.preheader42.1, label %58

.lr.ph53:                                         ; preds = %.lr.ph53, %.lr.ph53.preheader.new
  %indvars.iv72 = phi i64 [ 0, %.lr.ph53.preheader.new ], [ %indvars.iv.next73.3, %.lr.ph53 ]
  %.03051 = phi i64 [ 0, %.lr.ph53.preheader.new ], [ %spec.select.3, %.lr.ph53 ]
  %niter = phi i64 [ 0, %.lr.ph53.preheader.new ], [ %niter.next.3, %.lr.ph53 ]
  %46 = getelementptr inbounds [1010 x i64], ptr @a, i64 0, i64 %indvars.iv72
  %47 = load i64, ptr %46, align 16, !tbaa !11
  %48 = call i64 @llvm.smax.i64(i64 %47, i64 0)
  %spec.select = add nuw nsw i64 %48, %.03051
  %indvars.iv.next73 = or disjoint i64 %indvars.iv72, 2
  %49 = getelementptr inbounds [1010 x i64], ptr @a, i64 0, i64 %indvars.iv.next73
  %50 = load i64, ptr %49, align 16, !tbaa !11
  %51 = call i64 @llvm.smax.i64(i64 %50, i64 0)
  %spec.select.185 = add nuw nsw i64 %51, %spec.select
  %indvars.iv.next73.186 = or disjoint i64 %indvars.iv72, 4
  %52 = getelementptr inbounds [1010 x i64], ptr @a, i64 0, i64 %indvars.iv.next73.186
  %53 = load i64, ptr %52, align 16, !tbaa !11
  %54 = call i64 @llvm.smax.i64(i64 %53, i64 0)
  %spec.select.2 = add nuw nsw i64 %54, %spec.select.185
  %indvars.iv.next73.2 = or disjoint i64 %indvars.iv72, 6
  %55 = getelementptr inbounds [1010 x i64], ptr @a, i64 0, i64 %indvars.iv.next73.2
  %56 = load i64, ptr %55, align 16, !tbaa !11
  %57 = call i64 @llvm.smax.i64(i64 %56, i64 0)
  %spec.select.3 = add nuw nsw i64 %57, %spec.select.2
  %indvars.iv.next73.3 = add nuw nsw i64 %indvars.iv72, 8
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3.not = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3.not, label %._crit_edge54.unr-lcssa, label %.lr.ph53, !llvm.loop !18

58:                                               ; preds = %._crit_edge54
  store i64 %spec.select.lcssa, ptr @maxi, align 8, !tbaa !11
  br label %.preheader42.1

.preheader42.1:                                   ; preds = %58, %._crit_edge54
  %.not80 = icmp eq i32 %17, 1
  br i1 %.not80, label %._crit_edge54.1, label %.lr.ph53.1

.lr.ph53.1:                                       ; preds = %.preheader42.1, %.lr.ph53.1
  %indvars.iv72.1 = phi i64 [ %indvars.iv.next73.1, %.lr.ph53.1 ], [ 1, %.preheader42.1 ]
  %.03051.1 = phi i64 [ %spec.select.1, %.lr.ph53.1 ], [ 0, %.preheader42.1 ]
  %59 = getelementptr inbounds [1010 x i64], ptr @a, i64 0, i64 %indvars.iv72.1
  %60 = load i64, ptr %59, align 8, !tbaa !11
  %61 = call i64 @llvm.smax.i64(i64 %60, i64 0)
  %spec.select.1 = add nuw nsw i64 %61, %.03051.1
  %indvars.iv.next73.1 = add nuw nsw i64 %indvars.iv72.1, 2
  %62 = icmp ult i64 %indvars.iv.next73.1, %36
  br i1 %62, label %.lr.ph53.1, label %._crit_edge54.1, !llvm.loop !18

._crit_edge54.1:                                  ; preds = %.lr.ph53.1, %.preheader42.1
  %.030.lcssa.1 = phi i64 [ 0, %.preheader42.1 ], [ %spec.select.1, %.lr.ph53.1 ]
  %63 = icmp slt i64 %spec.select.lcssa, %.030.lcssa.1
  br i1 %63, label %64, label %.preheader

64:                                               ; preds = %._crit_edge54.1
  store i64 %.030.lcssa.1, ptr @maxi, align 8, !tbaa !11
  br label %.preheader

.preheader:                                       ; preds = %64, %._crit_edge54.1
  %.133.1 = phi i32 [ 1, %64 ], [ 0, %._crit_edge54.1 ]
  %65 = icmp slt i32 %.133.1, %17
  br i1 %65, label %.lr.ph63, label %._crit_edge64

66:                                               ; preds = %.lr.ph63, %76
  %67 = phi i32 [ %17, %.lr.ph63 ], [ %77, %76 ]
  %indvars.iv77 = phi i64 [ %42, %.lr.ph63 ], [ %indvars.iv.next78, %76 ]
  %68 = getelementptr inbounds [1010 x i64], ptr @a, i64 0, i64 %indvars.iv77
  %69 = load i64, ptr %68, align 8, !tbaa !11
  %70 = icmp sgt i64 %69, -1
  br i1 %70, label %71, label %76

71:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #6
  %72 = call { ptr, i64 } @_ZNSt6vectorIbSaIbEEixEm(ptr noundef nonnull align 8 dereferenceable(40) @ans, i64 noundef %indvars.iv77)
  %73 = extractvalue { ptr, i64 } %72, 0
  store ptr %73, ptr %5, align 8
  %74 = extractvalue { ptr, i64 } %72, 1
  store i64 %74, ptr %41, align 8
  %75 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt14_Bit_referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16) %5, i1 noundef zeroext true) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #6
  %.pre = load i32, ptr @N, align 4, !tbaa !5
  br label %76

76:                                               ; preds = %66, %71
  %77 = phi i32 [ %67, %66 ], [ %.pre, %71 ]
  %indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 2
  %78 = sext i32 %77 to i64
  %79 = icmp slt i64 %indvars.iv.next78, %78
  br i1 %79, label %66, label %._crit_edge64, !llvm.loop !19

._crit_edge64:                                    ; preds = %76, %.preheader, %.critedge
  call void @_Z5flushv()
  ret i32 0
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSaIbEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 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 #1 align 2

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 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 #0 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #5

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 uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.unroll.disable"}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}


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