; LLVM IR from the-hyp0cr1t3/CC :: CSES/Dynamic Programming (Removal Game)

; 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::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::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<long long, std::allocator<long long>>::_Deque_impl" }
%"struct.std::_Deque_base<long long, std::allocator<long long>>::_Deque_impl" = type { %"struct.std::_Deque_base<long long, std::allocator<long long>>::_Deque_impl_data" }
%"struct.std::_Deque_base<long long, std::allocator<long long>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }

@a = external dso_local global [200005 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i64, align 8
  %6 = alloca %"class.std::deque", align 8
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  %14 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %15 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %16 = getelementptr i8, ptr %15, i64 -24
  %17 = load i64, ptr %16, align 8
  %18 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %17
  %19 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %18, ptr noundef null)
  %20 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 1, ptr %4, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  store i64 0, ptr %5, align 8, !tbaa !11
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %3)
  store i32 0, ptr %2, align 4, !tbaa !8
  br label %22

22:                                               ; preds = %31, %0
  %23 = load i32, ptr %2, align 4, !tbaa !8
  %24 = load i32, ptr %3, align 4, !tbaa !8
  %25 = icmp slt i32 %23, %24
  br i1 %25, label %26, label %34

26:                                               ; preds = %22
  %27 = load i32, ptr %2, align 4, !tbaa !8
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [200005 x i32], ptr @a, i64 0, i64 %28
  %30 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %29)
  br label %31

31:                                               ; preds = %26
  %32 = load i32, ptr %2, align 4, !tbaa !8
  %33 = add nsw i32 %32, 1
  store i32 %33, ptr %2, align 4, !tbaa !8
  br label %22, !llvm.loop !13

34:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 80, ptr %6) #6
  call void @_ZNSt5dequeIxSaIxEEC2Ev(ptr noundef nonnull align 8 dereferenceable(80) %6)
  store i32 0, ptr %2, align 4, !tbaa !8
  br label %35

35:                                               ; preds = %96, %34
  %36 = load i32, ptr %2, align 4, !tbaa !8
  %37 = load i32, ptr %3, align 4, !tbaa !8
  %38 = icmp slt i32 %36, %37
  br i1 %38, label %39, label %99

39:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %40 = load i32, ptr %2, align 4, !tbaa !8
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [200005 x i32], ptr @a, i64 0, i64 %41
  %43 = load i32, ptr %42, align 4, !tbaa !8
  %44 = sext i32 %43 to i64
  store i64 %44, ptr %7, align 8, !tbaa !11
  invoke void @_ZNSt5dequeIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(80) %6, ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %45 unwind label %77

45:                                               ; preds = %39
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  br label %46

46:                                               ; preds = %90, %45
  %47 = call noundef i64 @_ZNKSt5dequeIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %6) #6
  %48 = trunc i64 %47 to i32
  %49 = icmp sgt i32 %48, 2
  br i1 %49, label %50, label %95

50:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %51 = call noundef i64 @_ZNKSt5dequeIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %6) #6
  %52 = trunc i64 %51 to i32
  %53 = sub nsw i32 %52, 3
  %54 = sext i32 %53 to i64
  %55 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(80) %6, i64 noundef %54) #6
  %56 = load i64, ptr %55, align 8, !tbaa !11
  store i64 %56, ptr %10, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %57 = call noundef i64 @_ZNKSt5dequeIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %6) #6
  %58 = trunc i64 %57 to i32
  %59 = sub nsw i32 %58, 2
  %60 = sext i32 %59 to i64
  %61 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(80) %6, i64 noundef %60) #6
  %62 = load i64, ptr %61, align 8, !tbaa !11
  store i64 %62, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %63 = call noundef i64 @_ZNKSt5dequeIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %6) #6
  %64 = trunc i64 %63 to i32
  %65 = sub nsw i32 %64, 1
  %66 = sext i32 %65 to i64
  %67 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(80) %6, i64 noundef %66) #6
  %68 = load i64, ptr %67, align 8, !tbaa !11
  store i64 %68, ptr %12, align 8, !tbaa !11
  %69 = load i64, ptr %10, align 8, !tbaa !11
  %70 = load i64, ptr %11, align 8, !tbaa !11
  %71 = icmp sgt i64 %69, %70
  br i1 %71, label %76, label %72

72:                                               ; preds = %50
  %73 = load i64, ptr %11, align 8, !tbaa !11
  %74 = load i64, ptr %12, align 8, !tbaa !11
  %75 = icmp slt i64 %73, %74
  br i1 %75, label %76, label %81

76:                                               ; preds = %72, %50
  store i32 9, ptr %13, align 4
  br label %88

77:                                               ; preds = %39
  %78 = landingpad { ptr, i32 }
          cleanup
  %79 = extractvalue { ptr, i32 } %78, 0
  store ptr %79, ptr %8, align 8
  %80 = extractvalue { ptr, i32 } %78, 1
  store i32 %80, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  br label %140

81:                                               ; preds = %72
  call void @_ZNSt5dequeIxSaIxEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(80) %6) #6
  call void @_ZNSt5dequeIxSaIxEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(80) %6) #6
  call void @_ZNSt5dequeIxSaIxEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(80) %6) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %82 = load i64, ptr %10, align 8, !tbaa !11
  %83 = load i64, ptr %12, align 8, !tbaa !11
  %84 = add nsw i64 %82, %83
  %85 = load i64, ptr %11, align 8, !tbaa !11
  %86 = sub nsw i64 %84, %85
  store i64 %86, ptr %14, align 8, !tbaa !11
  invoke void @_ZNSt5dequeIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(80) %6, ptr noundef nonnull align 8 dereferenceable(8) %14)
          to label %87 unwind label %91

87:                                               ; preds = %81
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  store i32 0, ptr %13, align 4
  br label %88

88:                                               ; preds = %87, %76
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  %89 = load i32, ptr %13, align 4
  switch i32 %89, label %146 [
    i32 0, label %90
    i32 9, label %95
  ]

90:                                               ; preds = %88
  br label %46, !llvm.loop !15

91:                                               ; preds = %81
  %92 = landingpad { ptr, i32 }
          cleanup
  %93 = extractvalue { ptr, i32 } %92, 0
  store ptr %93, ptr %8, align 8
  %94 = extractvalue { ptr, i32 } %92, 1
  store i32 %94, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %140

95:                                               ; preds = %88, %46
  br label %96

96:                                               ; preds = %95
  %97 = load i32, ptr %2, align 4, !tbaa !8
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr %2, align 4, !tbaa !8
  br label %35, !llvm.loop !16

99:                                               ; preds = %35
  br label %100

100:                                              ; preds = %125, %99
  %101 = call noundef zeroext i1 @_ZNKSt5dequeIxSaIxEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %6) #6
  %102 = xor i1 %101, true
  br i1 %102, label %103, label %128

103:                                              ; preds = %100
  %104 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIxSaIxEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %6) #6
  %105 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIxSaIxEE4backEv(ptr noundef nonnull align 8 dereferenceable(80) %6) #6
  %106 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %104, ptr noundef nonnull align 8 dereferenceable(8) %105)
          to label %107 unwind label %120

107:                                              ; preds = %103
  %108 = load i64, ptr %106, align 8, !tbaa !11
  %109 = load i32, ptr %4, align 4, !tbaa !8
  %110 = sext i32 %109 to i64
  %111 = mul nsw i64 %108, %110
  %112 = load i64, ptr %5, align 8, !tbaa !11
  %113 = add nsw i64 %112, %111
  store i64 %113, ptr %5, align 8, !tbaa !11
  %114 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIxSaIxEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %6) #6
  %115 = load i64, ptr %114, align 8, !tbaa !11
  %116 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIxSaIxEE4backEv(ptr noundef nonnull align 8 dereferenceable(80) %6) #6
  %117 = load i64, ptr %116, align 8, !tbaa !11
  %118 = icmp sgt i64 %115, %117
  br i1 %118, label %119, label %124

119:                                              ; preds = %107
  call void @_ZNSt5dequeIxSaIxEE9pop_frontEv(ptr noundef nonnull align 8 dereferenceable(80) %6) #6
  br label %125

120:                                              ; preds = %133, %128, %103
  %121 = landingpad { ptr, i32 }
          cleanup
  %122 = extractvalue { ptr, i32 } %121, 0
  store ptr %122, ptr %8, align 8
  %123 = extractvalue { ptr, i32 } %121, 1
  store i32 %123, ptr %9, align 4
  br label %140

124:                                              ; preds = %107
  call void @_ZNSt5dequeIxSaIxEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(80) %6) #6
  br label %125

125:                                              ; preds = %124, %119
  %126 = load i32, ptr %4, align 4, !tbaa !8
  %127 = sub nsw i32 0, %126
  store i32 %127, ptr %4, align 4, !tbaa !8
  br label %100, !llvm.loop !17

128:                                              ; preds = %100
  %129 = load i32, ptr %3, align 4, !tbaa !8
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds i32, ptr @a, i64 %130
  %132 = invoke noundef i64 @_ZSt10accumulateIPixET0_T_S2_S1_(ptr noundef @a, ptr noundef %131, i64 noundef 0)
          to label %133 unwind label %120

133:                                              ; preds = %128
  %134 = load i64, ptr %5, align 8, !tbaa !11
  %135 = add nsw i64 %132, %134
  %136 = ashr i64 %135, 1
  %137 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %136)
          to label %138 unwind label %120

138:                                              ; preds = %133
  store i32 0, ptr %1, align 4
  store i32 1, ptr %13, align 4
  call void @_ZNSt5dequeIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %6) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  %139 = load i32, ptr %1, align 4
  ret i32 %139

140:                                              ; preds = %120, %91, %77
  call void @_ZNSt5dequeIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %6) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %141

141:                                              ; preds = %140
  %142 = load ptr, ptr %8, align 8
  %143 = load i32, ptr %9, align 4
  %144 = insertvalue { ptr, i32 } poison, ptr %142, 0
  %145 = insertvalue { ptr, i32 } %144, i32 %143, 1
  resume { ptr, i32 } %145

146:                                              ; preds = %88
  unreachable
}

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #1 align 2

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5dequeIxSaIxEEC2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5dequeIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 8 dereferenceable(8)) #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) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt5dequeIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(80), i64 noundef) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5dequeIxSaIxEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(80)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt5dequeIxSaIxEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80)) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIxSaIxEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIxSaIxEE4backEv(ptr noundef nonnull align 8 dereferenceable(80)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5dequeIxSaIxEE9pop_frontEv(ptr noundef nonnull align 8 dereferenceable(80)) #1 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZSt10accumulateIPixET0_T_S2_S1_(ptr noundef, ptr noundef, i64 noundef) #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5dequeIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #1 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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !10, i64 0}
!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::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::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<long long, std::allocator<long long>>::_Deque_impl" }
%"struct.std::_Deque_base<long long, std::allocator<long long>>::_Deque_impl" = type { %"struct.std::_Deque_base<long long, std::allocator<long long>>::_Deque_impl_data" }
%"struct.std::_Deque_base<long long, std::allocator<long long>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }

@a = external dso_local global [200005 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::deque", align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %6 = getelementptr i8, ptr %5, i64 -24
  %7 = load i64, ptr %6, align 8
  %8 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %7
  %9 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %8, ptr noundef null)
  %10 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %11 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %12 = load i32, ptr %1, align 4, !tbaa !8
  %13 = icmp sgt i32 %12, 0
  br i1 %13, label %.lr.ph, label %._crit_edge

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

._crit_edge:                                      ; preds = %.lr.ph, %0
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %2) #6
  call void @_ZNSt5dequeIxSaIxEEC2Ev(ptr noundef nonnull align 8 dereferenceable(80) %2)
  %19 = load i32, ptr %1, align 4, !tbaa !8
  %20 = icmp sgt i32 %19, 0
  br i1 %20, label %.lr.ph39, label %.preheader

.preheader:                                       ; preds = %.thread, %._crit_edge
  %21 = call noundef zeroext i1 @_ZNKSt5dequeIxSaIxEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %2) #6
  br i1 %21, label %._crit_edge43, label %.lr.ph42

.lr.ph39:                                         ; preds = %._crit_edge, %.thread
  %indvars.iv45 = phi i64 [ %indvars.iv.next46, %.thread ], [ 0, %._crit_edge ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %22 = getelementptr inbounds [200005 x i32], ptr @a, i64 0, i64 %indvars.iv45
  %23 = load i32, ptr %22, align 4, !tbaa !8
  %24 = sext i32 %23 to i64
  store i64 %24, ptr %3, align 8, !tbaa !13
  invoke void @_ZNSt5dequeIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(80) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %25 unwind label %46

25:                                               ; preds = %.lr.ph39
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  %26 = call noundef i64 @_ZNKSt5dequeIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %2) #6
  %27 = trunc i64 %26 to i32
  %28 = icmp sgt i32 %27, 2
  br i1 %28, label %.lr.ph35, label %.thread

.lr.ph35:                                         ; preds = %25, %51
  %29 = call noundef i64 @_ZNKSt5dequeIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %2) #6
  %30 = shl i64 %29, 32
  %sext = add i64 %30, -12884901888
  %31 = ashr exact i64 %sext, 32
  %32 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(80) %2, i64 noundef %31) #6
  %33 = load i64, ptr %32, align 8, !tbaa !13
  %34 = call noundef i64 @_ZNKSt5dequeIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %2) #6
  %35 = shl i64 %34, 32
  %sext28 = add i64 %35, -8589934592
  %36 = ashr exact i64 %sext28, 32
  %37 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(80) %2, i64 noundef %36) #6
  %38 = load i64, ptr %37, align 8, !tbaa !13
  %39 = call noundef i64 @_ZNKSt5dequeIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %2) #6
  %40 = shl i64 %39, 32
  %sext29 = add i64 %40, -4294967296
  %41 = ashr exact i64 %sext29, 32
  %42 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(80) %2, i64 noundef %41) #6
  %43 = load i64, ptr %42, align 8, !tbaa !13
  %44 = icmp sgt i64 %33, %38
  %45 = icmp slt i64 %38, %43
  %or.cond = select i1 %44, i1 true, i1 %45
  br i1 %or.cond, label %.thread, label %48

46:                                               ; preds = %.lr.ph39
  %47 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  br label %87

48:                                               ; preds = %.lr.ph35
  call void @_ZNSt5dequeIxSaIxEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(80) %2) #6
  call void @_ZNSt5dequeIxSaIxEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(80) %2) #6
  call void @_ZNSt5dequeIxSaIxEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(80) %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %49 = sub i64 %33, %38
  %50 = add i64 %49, %43
  store i64 %50, ptr %4, align 8, !tbaa !13
  invoke void @_ZNSt5dequeIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(80) %2, ptr noundef nonnull align 8 dereferenceable(8) %4)
          to label %51 unwind label %55

51:                                               ; preds = %48
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  %52 = call noundef i64 @_ZNKSt5dequeIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %2) #6
  %53 = trunc i64 %52 to i32
  %54 = icmp sgt i32 %53, 2
  br i1 %54, label %.lr.ph35, label %.thread

55:                                               ; preds = %48
  %56 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  br label %87

.thread:                                          ; preds = %51, %.lr.ph35, %25
  %indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1
  %57 = load i32, ptr %1, align 4, !tbaa !8
  %58 = sext i32 %57 to i64
  %59 = icmp slt i64 %indvars.iv.next46, %58
  br i1 %59, label %.lr.ph39, label %.preheader, !llvm.loop !15

.lr.ph42:                                         ; preds = %.preheader, %76
  %.02141 = phi i32 [ %77, %76 ], [ 1, %.preheader ]
  %.02440 = phi i64 [ %66, %76 ], [ 0, %.preheader ]
  %60 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIxSaIxEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %2) #6
  %61 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIxSaIxEE4backEv(ptr noundef nonnull align 8 dereferenceable(80) %2) #6
  %62 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %60, ptr noundef nonnull align 8 dereferenceable(8) %61)
  %63 = load i64, ptr %62, align 8, !tbaa !13
  %64 = sext i32 %.02141 to i64
  %65 = mul nsw i64 %63, %64
  %66 = add nsw i64 %65, %.02440
  %67 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIxSaIxEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %2) #6
  %68 = load i64, ptr %67, align 8, !tbaa !13
  %69 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIxSaIxEE4backEv(ptr noundef nonnull align 8 dereferenceable(80) %2) #6
  %70 = load i64, ptr %69, align 8, !tbaa !13
  %71 = icmp sgt i64 %68, %70
  br i1 %71, label %72, label %75

72:                                               ; preds = %.lr.ph42
  call void @_ZNSt5dequeIxSaIxEE9pop_frontEv(ptr noundef nonnull align 8 dereferenceable(80) %2) #6
  br label %76

73:                                               ; preds = %._crit_edge43
  %74 = landingpad { ptr, i32 }
          cleanup
  br label %87

75:                                               ; preds = %.lr.ph42
  call void @_ZNSt5dequeIxSaIxEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(80) %2) #6
  br label %76

76:                                               ; preds = %75, %72
  %77 = sub nsw i32 0, %.02141
  %78 = call noundef zeroext i1 @_ZNKSt5dequeIxSaIxEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %2) #6
  br i1 %78, label %._crit_edge43, label %.lr.ph42, !llvm.loop !16

._crit_edge43:                                    ; preds = %76, %.preheader
  %.024.lcssa = phi i64 [ 0, %.preheader ], [ %66, %76 ]
  %79 = load i32, ptr %1, align 4, !tbaa !8
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds i32, ptr @a, i64 %80
  %82 = call noundef i64 @_ZSt10accumulateIPixET0_T_S2_S1_(ptr noundef nonnull @a, ptr noundef nonnull %81, i64 noundef 0)
  %83 = add nsw i64 %82, %.024.lcssa
  %84 = ashr i64 %83, 1
  %85 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %84)
          to label %86 unwind label %73

86:                                               ; preds = %._crit_edge43
  call void @_ZNSt5dequeIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %2) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  ret i32 0

87:                                               ; preds = %73, %55, %46
  %.pn = phi { ptr, i32 } [ %56, %55 ], [ %47, %46 ], [ %74, %73 ]
  call void @_ZNSt5dequeIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %2) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  resume { ptr, i32 } %.pn
}

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) local_unnamed_addr #1 align 2

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #2

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

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 #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5dequeIxSaIxEEC2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5dequeIxSaIxEE9push_backEOx(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 8 dereferenceable(8)) local_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) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt5dequeIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5dequeIxSaIxEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt5dequeIxSaIxEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIxSaIxEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5dequeIxSaIxEE4backEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5dequeIxSaIxEE9pop_frontEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #1 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZSt10accumulateIPixET0_T_S2_S1_(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5dequeIxSaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #1 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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress 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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"long long", !10, i64 0}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}


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