; LLVM IR from abeaumont/competitive-programming :: hackerrank/data-structures (waiter)

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z11calc_primesi(i32 noundef) #1

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

20:                                               ; preds = %0
  call void @_ZNSt15__new_allocatorISt5stackIiSt5dequeIiSaIiEEEED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #6
  br label %21

21:                                               ; preds = %31, %20
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = add nsw i32 %22, -1
  store i32 %23, ptr %2, align 4, !tbaa !5
  %24 = icmp ne i32 %22, 0
  br i1 %24, label %25, label %40

25:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %26 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %8)
          to label %27 unwind label %36

27:                                               ; preds = %25
  %28 = load i32, ptr %3, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = call noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt6vectorISt5stackIiSt5dequeIiSaIiEEESaIS4_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %29) #6
  invoke void @_ZNSt5stackIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %30, ptr noundef nonnull align 4 dereferenceable(4) %8)
          to label %31 unwind label %36

31:                                               ; preds = %27
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %21, !llvm.loop !9

32:                                               ; preds = %0
  %33 = landingpad { ptr, i32 }
          cleanup
  %34 = extractvalue { ptr, i32 } %33, 0
  store ptr %34, ptr %6, align 8
  %35 = extractvalue { ptr, i32 } %33, 1
  store i32 %35, ptr %7, align 4
  call void @_ZNSt15__new_allocatorISt5stackIiSt5dequeIiSaIiEEEED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #6
  br label %147

36:                                               ; preds = %27, %25
  %37 = landingpad { ptr, i32 }
          cleanup
  %38 = extractvalue { ptr, i32 } %37, 0
  store ptr %38, ptr %6, align 8
  %39 = extractvalue { ptr, i32 } %37, 1
  store i32 %39, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %146

40:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %41

41:                                               ; preds = %102, %40
  %42 = load i32, ptr %9, align 4, !tbaa !5
  %43 = load i32, ptr %3, align 4, !tbaa !5
  %44 = icmp slt i32 %42, %43
  br i1 %44, label %46, label %45

45:                                               ; preds = %41
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %106

46:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %47 = load i32, ptr %3, align 4, !tbaa !5
  %48 = load i32, ptr %9, align 4, !tbaa !5
  %49 = srem i32 %48, 2
  %50 = add nsw i32 %47, %49
  store i32 %50, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %51 = load i32, ptr %3, align 4, !tbaa !5
  %52 = load i32, ptr %9, align 4, !tbaa !5
  %53 = srem i32 %52, 2
  %54 = icmp eq i32 %53, 0
  %55 = zext i1 %54 to i32
  %56 = add nsw i32 %51, %55
  store i32 %56, ptr %11, align 4, !tbaa !5
  br label %57

57:                                               ; preds = %100, %46
  %58 = load i32, ptr %10, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = call noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt6vectorISt5stackIiSt5dequeIiSaIiEEESaIS4_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %59) #6
  %61 = invoke noundef zeroext i1 @_ZNKSt5stackIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %60)
          to label %62 unwind label %87

62:                                               ; preds = %57
  %63 = xor i1 %61, true
  br i1 %63, label %64, label %101

64:                                               ; preds = %62
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %65 = load i32, ptr %10, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = call noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt6vectorISt5stackIiSt5dequeIiSaIiEEESaIS4_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %66) #6
  %68 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5stackIiSt5dequeIiSaIiEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %67)
          to label %69 unwind label %91

69:                                               ; preds = %64
  %70 = load i32, ptr %68, align 4, !tbaa !5
  store i32 %70, ptr %12, align 4, !tbaa !5
  %71 = load i32, ptr %10, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = call noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt6vectorISt5stackIiSt5dequeIiSaIiEEESaIS4_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %72) #6
  invoke void @_ZNSt5stackIiSt5dequeIiSaIiEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %73)
          to label %74 unwind label %91

74:                                               ; preds = %69
  %75 = load i32, ptr %12, align 4, !tbaa !5
  %76 = load i32, ptr %9, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [1201 x i32], ptr @primes, i64 0, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = srem i32 %75, %79
  %81 = icmp ne i32 %80, 0
  br i1 %81, label %82, label %95

82:                                               ; preds = %74
  %83 = load i32, ptr %11, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = call noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt6vectorISt5stackIiSt5dequeIiSaIiEEESaIS4_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %84) #6
  invoke void @_ZNSt5stackIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %85, ptr noundef nonnull align 4 dereferenceable(4) %12)
          to label %86 unwind label %91

86:                                               ; preds = %82
  br label %100

87:                                               ; preds = %57
  %88 = landingpad { ptr, i32 }
          cleanup
  %89 = extractvalue { ptr, i32 } %88, 0
  store ptr %89, ptr %6, align 8
  %90 = extractvalue { ptr, i32 } %88, 1
  store i32 %90, ptr %7, align 4
  br label %105

91:                                               ; preds = %95, %82, %69, %64
  %92 = landingpad { ptr, i32 }
          cleanup
  %93 = extractvalue { ptr, i32 } %92, 0
  store ptr %93, ptr %6, align 8
  %94 = extractvalue { ptr, i32 } %92, 1
  store i32 %94, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %105

95:                                               ; preds = %74
  %96 = load i32, ptr %9, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = call noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt6vectorISt5stackIiSt5dequeIiSaIiEEESaIS4_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %97) #6
  invoke void @_ZNSt5stackIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %98, ptr noundef nonnull align 4 dereferenceable(4) %12)
          to label %99 unwind label %91

99:                                               ; preds = %95
  br label %100

100:                                              ; preds = %99, %86
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %57, !llvm.loop !11

101:                                              ; preds = %62
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %102

102:                                              ; preds = %101
  %103 = load i32, ptr %9, align 4, !tbaa !5
  %104 = add nsw i32 %103, 1
  store i32 %104, ptr %9, align 4, !tbaa !5
  br label %41, !llvm.loop !12

105:                                              ; preds = %91, %87
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %146

106:                                              ; preds = %45
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %107

107:                                              ; preds = %141, %106
  %108 = load i32, ptr %13, align 4, !tbaa !5
  %109 = load i32, ptr %3, align 4, !tbaa !5
  %110 = add nsw i32 %109, 2
  %111 = icmp slt i32 %108, %110
  br i1 %111, label %113, label %112

112:                                              ; preds = %107
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %144

113:                                              ; preds = %107
  br label %114

114:                                              ; preds = %135, %113
  %115 = load i32, ptr %13, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = call noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt6vectorISt5stackIiSt5dequeIiSaIiEEESaIS4_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %116) #6
  %118 = invoke noundef zeroext i1 @_ZNKSt5stackIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %117)
          to label %119 unwind label %136

119:                                              ; preds = %114
  %120 = xor i1 %118, true
  br i1 %120, label %121, label %140

121:                                              ; preds = %119
  %122 = load i32, ptr %13, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = call noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt6vectorISt5stackIiSt5dequeIiSaIiEEESaIS4_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %123) #6
  %125 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5stackIiSt5dequeIiSaIiEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %124)
          to label %126 unwind label %136

126:                                              ; preds = %121
  %127 = load i32, ptr %125, align 4, !tbaa !5
  %128 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %127)
          to label %129 unwind label %136

129:                                              ; preds = %126
  %130 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %128, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %131 unwind label %136

131:                                              ; preds = %129
  %132 = load i32, ptr %13, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = call noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt6vectorISt5stackIiSt5dequeIiSaIiEEESaIS4_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %4, i64 noundef %133) #6
  invoke void @_ZNSt5stackIiSt5dequeIiSaIiEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %134)
          to label %135 unwind label %136

135:                                              ; preds = %131
  br label %114, !llvm.loop !13

136:                                              ; preds = %131, %129, %126, %121, %114
  %137 = landingpad { ptr, i32 }
          cleanup
  %138 = extractvalue { ptr, i32 } %137, 0
  store ptr %138, ptr %6, align 8
  %139 = extractvalue { ptr, i32 } %137, 1
  store i32 %139, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %146

140:                                              ; preds = %119
  br label %141

141:                                              ; preds = %140
  %142 = load i32, ptr %13, align 4, !tbaa !5
  %143 = add nsw i32 %142, 1
  store i32 %143, ptr %13, align 4, !tbaa !5
  br label %107, !llvm.loop !14

144:                                              ; preds = %112
  call void @_ZNSt6vectorISt5stackIiSt5dequeIiSaIiEEESaIS4_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #6
  call void @llvm.lifetime.end.p0(i64 24, 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
  %145 = load i32, ptr %1, align 4
  ret i32 %145

146:                                              ; preds = %136, %105, %36
  call void @_ZNSt6vectorISt5stackIiSt5dequeIiSaIiEEESaIS4_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #6
  br label %147

147:                                              ; preds = %146, %32
  call void @llvm.lifetime.end.p0(i64 24, 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 %148

148:                                              ; preds = %147
  %149 = load ptr, ptr %6, align 8
  %150 = load i32, ptr %7, align 4
  %151 = insertvalue { ptr, i32 } poison, ptr %149, 0
  %152 = insertvalue { ptr, i32 } %151, i32 %150, 1
  resume { ptr, i32 } %152
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorISt5stackIiSt5dequeIiSaIiEEESaIS4_EEC2EmRKS5_(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, 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(80) ptr @_ZNSt6vectorISt5stackIiSt5dequeIiSaIiEEESaIS4_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #4 align 2

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

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

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

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #3

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #5

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

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

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

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

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


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

@primes = external dso_local local_unnamed_addr global [1201 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z11calc_primesi(i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"class.std::vector", align 8
  %4 = alloca %"class.std::allocator", align 1
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %7 = 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)
  %8 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %9 = load i32, ptr %2, align 4, !tbaa !5
  call void @_Z11calc_primesi(i32 noundef %9)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #6
  %10 = load i32, ptr %2, align 4, !tbaa !5
  %11 = add nsw i32 %10, 2
  %12 = sext i32 %11 to i64
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #6
  call void @_ZNSaISt5stackIiSt5dequeIiSaIiEEEEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #6
  invoke void @_ZNSt6vectorISt5stackIiSt5dequeIiSaIiEEESaIS4_EEC2EmRKS5_(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %12, ptr noundef nonnull align 1 dereferenceable(1) %4)
          to label %13 unwind label %26

13:                                               ; preds = %0
  call void @_ZNSt15__new_allocatorISt5stackIiSt5dequeIiSaIiEEEED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #6
  %14 = load i32, ptr %1, align 4, !tbaa !5
  %15 = add nsw i32 %14, -1
  store i32 %15, ptr %1, align 4, !tbaa !5
  %.not27 = icmp eq i32 %14, 0
  br i1 %.not27, label %.preheader26, label %.lr.ph

.preheader26:                                     ; preds = %23, %13
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = icmp sgt i32 %16, 0
  br i1 %17, label %.lr.ph30, label %.preheader25

.lr.ph:                                           ; preds = %13, %23
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  %18 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %5)
          to label %19 unwind label %28

19:                                               ; preds = %.lr.ph
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = call noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt6vectorISt5stackIiSt5dequeIiSaIiEEESaIS4_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %21) #6
  invoke void @_ZNSt5stackIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %22, ptr noundef nonnull align 4 dereferenceable(4) %5)
          to label %23 unwind label %28

23:                                               ; preds = %19
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  %24 = load i32, ptr %1, align 4, !tbaa !5
  %25 = add nsw i32 %24, -1
  store i32 %25, ptr %1, align 4, !tbaa !5
  %.not = icmp eq i32 %24, 0
  br i1 %.not, label %.preheader26, label %.lr.ph, !llvm.loop !9

26:                                               ; preds = %0
  %27 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorISt5stackIiSt5dequeIiSaIiEEEED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %4) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #6
  br label %76

28:                                               ; preds = %19, %.lr.ph
  %29 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  br label %75

.preheader25:                                     ; preds = %._crit_edge, %.preheader26
  %30 = phi i32 [ %16, %.preheader26 ], [ %56, %._crit_edge ]
  %31 = icmp sgt i32 %30, -2
  br i1 %31, label %.preheader, label %._crit_edge34

.lr.ph30:                                         ; preds = %.preheader26, %._crit_edge
  %indvars.iv = phi i64 [ %indvars.iv.next, %._crit_edge ], [ 0, %.preheader26 ]
  %32 = phi i32 [ %56, %._crit_edge ], [ %16, %.preheader26 ]
  %33 = trunc nuw nsw i64 %indvars.iv to i32
  %34 = and i32 %33, 1
  %35 = add nsw i32 %32, %34
  %36 = sext i32 %35 to i64
  %37 = call noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt6vectorISt5stackIiSt5dequeIiSaIiEEESaIS4_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %36) #6
  %38 = call noundef zeroext i1 @_ZNKSt5stackIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %37)
  br i1 %38, label %._crit_edge, label %.lr.ph28

.lr.ph28:                                         ; preds = %.lr.ph30
  %39 = xor i32 %34, 1
  %40 = add nsw i32 %39, %32
  %41 = getelementptr inbounds [1201 x i32], ptr @primes, i64 0, i64 %indvars.iv
  %42 = sext i32 %40 to i64
  br label %.invoke

.invoke:                                          ; preds = %.lr.ph28, %53
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #6
  %43 = call noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt6vectorISt5stackIiSt5dequeIiSaIiEEESaIS4_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %36) #6
  %44 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5stackIiSt5dequeIiSaIiEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %43)
  %45 = load i32, ptr %44, align 4, !tbaa !5
  store i32 %45, ptr %6, align 4, !tbaa !5
  %46 = call noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt6vectorISt5stackIiSt5dequeIiSaIiEEESaIS4_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %36) #6
  call void @_ZNSt5stackIiSt5dequeIiSaIiEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %46)
  %47 = load i32, ptr %6, align 4, !tbaa !5
  %48 = load i32, ptr %41, align 4, !tbaa !5
  %49 = srem i32 %47, %48
  %.not22 = icmp eq i32 %49, 0
  %indvars.iv. = select i1 %.not22, i64 %indvars.iv, i64 %42
  %50 = call noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt6vectorISt5stackIiSt5dequeIiSaIiEEESaIS4_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %indvars.iv.) #6
  invoke void @_ZNSt5stackIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %50, ptr noundef nonnull align 4 dereferenceable(4) %6)
          to label %53 unwind label %51

51:                                               ; preds = %.invoke
  %52 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  br label %75

53:                                               ; preds = %.invoke
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  %54 = call noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt6vectorISt5stackIiSt5dequeIiSaIiEEESaIS4_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %36) #6
  %55 = call noundef zeroext i1 @_ZNKSt5stackIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %54)
  br i1 %55, label %._crit_edge, label %.invoke, !llvm.loop !11

._crit_edge:                                      ; preds = %53, %.lr.ph30
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %56 = load i32, ptr %2, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = icmp slt i64 %indvars.iv.next, %57
  br i1 %58, label %.lr.ph30, label %.preheader25, !llvm.loop !12

.preheader:                                       ; preds = %.preheader25, %._crit_edge32
  %indvars.iv37 = phi i64 [ %indvars.iv.next38, %._crit_edge32 ], [ 0, %.preheader25 ]
  %59 = call noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt6vectorISt5stackIiSt5dequeIiSaIiEEESaIS4_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %indvars.iv37) #6
  %60 = call noundef zeroext i1 @_ZNKSt5stackIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %59)
  br i1 %60, label %._crit_edge32, label %.lr.ph31

._crit_edge34:                                    ; preds = %._crit_edge32, %.preheader25
  call void @_ZNSt6vectorISt5stackIiSt5dequeIiSaIiEEESaIS4_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  ret i32 0

.lr.ph31:                                         ; preds = %.preheader, %67
  %61 = call noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt6vectorISt5stackIiSt5dequeIiSaIiEEESaIS4_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %indvars.iv37) #6
  %62 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5stackIiSt5dequeIiSaIiEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %61)
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %63)
          to label %65 unwind label %71

65:                                               ; preds = %.lr.ph31
  %66 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %64, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %67 unwind label %71

67:                                               ; preds = %65
  %68 = call noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt6vectorISt5stackIiSt5dequeIiSaIiEEESaIS4_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %indvars.iv37) #6
  call void @_ZNSt5stackIiSt5dequeIiSaIiEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %68)
  %69 = call noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt6vectorISt5stackIiSt5dequeIiSaIiEEESaIS4_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %3, i64 noundef %indvars.iv37) #6
  %70 = call noundef zeroext i1 @_ZNKSt5stackIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %69)
  br i1 %70, label %._crit_edge32, label %.lr.ph31, !llvm.loop !13

71:                                               ; preds = %65, %.lr.ph31
  %72 = landingpad { ptr, i32 }
          cleanup
  br label %75

._crit_edge32:                                    ; preds = %67, %.preheader
  %indvars.iv.next38 = add nuw nsw i64 %indvars.iv37, 1
  %73 = load i32, ptr %2, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %.not35 = icmp sgt i64 %indvars.iv37, %74
  br i1 %.not35, label %._crit_edge34, label %.preheader, !llvm.loop !14

75:                                               ; preds = %71, %51, %28
  %.pn = phi { ptr, i32 } [ %29, %28 ], [ %52, %51 ], [ %72, %71 ]
  call void @_ZNSt6vectorISt5stackIiSt5dequeIiSaIiEEESaIS4_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #6
  br label %76

76:                                               ; preds = %75, %26
  %.pn.pn = phi { ptr, i32 } [ %.pn, %75 ], [ %27, %26 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  resume { ptr, i32 } %.pn.pn
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorISt5stackIiSt5dequeIiSaIiEEESaIS4_EEC2EmRKS5_(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, 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(80) ptr @_ZNSt6vectorISt5stackIiSt5dequeIiSaIiEEESaIS4_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #4 align 2

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

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

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

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #3

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #5

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

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

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

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

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


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