; LLVM IR from priyankchheda/algorithms :: _other_languages/cpp/Stack (balancedParanthesis)

; 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_ostream" = type { ptr, %"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.Stack::Stack" = type { ptr, i32, i32 }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@_ZTIN5Stack17OverflowExceptionE = external dso_local constant { ptr, ptr, ptr }, align 8
@.str.3 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [48 x i8], align 1
@_ZTIN5Stack18UnderflowExceptionE = external dso_local constant { ptr, ptr, ptr }, align 8
@.str.5 = external hidden unnamed_addr constant [28 x i8], align 1

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

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) #0

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z22areParanthesisBalancedNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef %0) #1 personality ptr @__gxx_personality_v0 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  %4 = alloca %"class.Stack::Stack", align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %4) #6
  call void @_ZN5Stack5StackIcEC2Ei(ptr noundef nonnull align 8 dereferenceable(16) %4, i32 noundef 10)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %12 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %0) #6
  %13 = trunc i64 %12 to i32
  store i32 %13, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %14

14:                                               ; preds = %171, %1
  %15 = load i32, ptr %6, align 4, !tbaa !9
  %16 = load i32, ptr %5, align 4, !tbaa !9
  %17 = icmp slt i32 %15, %16
  br i1 %17, label %19, label %18

18:                                               ; preds = %14
  store i32 2, ptr %7, align 4
  br label %174

19:                                               ; preds = %14
  %20 = load i32, ptr %6, align 4, !tbaa !9
  %21 = sext i32 %20 to i64
  %22 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %21)
          to label %23 unwind label %51

23:                                               ; preds = %19
  %24 = load i8, ptr %22, align 1, !tbaa !11
  %25 = sext i8 %24 to i32
  %26 = icmp eq i32 %25, 40
  br i1 %26, label %43, label %27

27:                                               ; preds = %23
  %28 = load i32, ptr %6, align 4, !tbaa !9
  %29 = sext i32 %28 to i64
  %30 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %29)
          to label %31 unwind label %51

31:                                               ; preds = %27
  %32 = load i8, ptr %30, align 1, !tbaa !11
  %33 = sext i8 %32 to i32
  %34 = icmp eq i32 %33, 123
  br i1 %34, label %43, label %35

35:                                               ; preds = %31
  %36 = load i32, ptr %6, align 4, !tbaa !9
  %37 = sext i32 %36 to i64
  %38 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %37)
          to label %39 unwind label %51

39:                                               ; preds = %35
  %40 = load i8, ptr %38, align 1, !tbaa !11
  %41 = sext i8 %40 to i32
  %42 = icmp eq i32 %41, 91
  br i1 %42, label %43, label %76

43:                                               ; preds = %39, %31, %23
  %44 = load i32, ptr %6, align 4, !tbaa !9
  %45 = sext i32 %44 to i64
  %46 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %45)
          to label %47 unwind label %55

47:                                               ; preds = %43
  %48 = load i8, ptr %46, align 1, !tbaa !11
  %49 = invoke noundef i32 @_ZN5Stack5StackIcE4pushEc(ptr noundef nonnull align 8 dereferenceable(16) %4, i8 noundef signext %48)
          to label %50 unwind label %55

50:                                               ; preds = %47
  br label %75

51:                                               ; preds = %92, %84, %76, %35, %27, %19
  %52 = landingpad { ptr, i32 }
          cleanup
  %53 = extractvalue { ptr, i32 } %52, 0
  store ptr %53, ptr %8, align 8
  %54 = extractvalue { ptr, i32 } %52, 1
  store i32 %54, ptr %9, align 4
  br label %176

55:                                               ; preds = %47, %43
  %56 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTIN5Stack17OverflowExceptionE
  %57 = extractvalue { ptr, i32 } %56, 0
  store ptr %57, ptr %8, align 8
  %58 = extractvalue { ptr, i32 } %56, 1
  store i32 %58, ptr %9, align 4
  br label %59

59:                                               ; preds = %55
  %60 = load i32, ptr %9, align 4
  %61 = call i32 @llvm.eh.typeid.for.p0(ptr @_ZTIN5Stack17OverflowExceptionE) #6
  %62 = icmp eq i32 %60, %61
  br i1 %62, label %63, label %176

63:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %64 = load ptr, ptr %8, align 8
  %65 = call ptr @__cxa_begin_catch(ptr %64) #6
  store ptr %65, ptr %10, align 8
  %66 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.3)
          to label %67 unwind label %70

67:                                               ; preds = %63
  %68 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.4)
          to label %69 unwind label %70

69:                                               ; preds = %67
  invoke void @__cxa_rethrow() #7
          to label %197 unwind label %70

70:                                               ; preds = %69, %67, %63
  %71 = landingpad { ptr, i32 }
          cleanup
  %72 = extractvalue { ptr, i32 } %71, 0
  store ptr %72, ptr %8, align 8
  %73 = extractvalue { ptr, i32 } %71, 1
  store i32 %73, ptr %9, align 4
  invoke void @__cxa_end_catch()
          to label %74 unwind label %194

74:                                               ; preds = %70
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %176

75:                                               ; preds = %50
  br label %170

76:                                               ; preds = %39
  %77 = load i32, ptr %6, align 4, !tbaa !9
  %78 = sext i32 %77 to i64
  %79 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %78)
          to label %80 unwind label %51

80:                                               ; preds = %76
  %81 = load i8, ptr %79, align 1, !tbaa !11
  %82 = sext i8 %81 to i32
  %83 = icmp eq i32 %82, 41
  br i1 %83, label %100, label %84

84:                                               ; preds = %80
  %85 = load i32, ptr %6, align 4, !tbaa !9
  %86 = sext i32 %85 to i64
  %87 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %86)
          to label %88 unwind label %51

88:                                               ; preds = %84
  %89 = load i8, ptr %87, align 1, !tbaa !11
  %90 = sext i8 %89 to i32
  %91 = icmp eq i32 %90, 125
  br i1 %91, label %100, label %92

92:                                               ; preds = %88
  %93 = load i32, ptr %6, align 4, !tbaa !9
  %94 = sext i32 %93 to i64
  %95 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %94)
          to label %96 unwind label %51

96:                                               ; preds = %92
  %97 = load i8, ptr %95, align 1, !tbaa !11
  %98 = sext i8 %97 to i32
  %99 = icmp eq i32 %98, 93
  br i1 %99, label %100, label %169

100:                                              ; preds = %96, %88, %80
  %101 = load i32, ptr %6, align 4, !tbaa !9
  %102 = sext i32 %101 to i64
  %103 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %102)
          to label %104 unwind label %142

104:                                              ; preds = %100
  %105 = load i8, ptr %103, align 1, !tbaa !11
  %106 = sext i8 %105 to i32
  %107 = icmp eq i32 %106, 41
  br i1 %107, label %108, label %113

108:                                              ; preds = %104
  %109 = invoke noundef signext i8 @_ZN5Stack5StackIcE4peekEv(ptr noundef nonnull align 8 dereferenceable(16) %4)
          to label %110 unwind label %142

110:                                              ; preds = %108
  %111 = sext i8 %109 to i32
  %112 = icmp eq i32 %111, 40
  br i1 %112, label %139, label %113

113:                                              ; preds = %110, %104
  %114 = load i32, ptr %6, align 4, !tbaa !9
  %115 = sext i32 %114 to i64
  %116 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %115)
          to label %117 unwind label %142

117:                                              ; preds = %113
  %118 = load i8, ptr %116, align 1, !tbaa !11
  %119 = sext i8 %118 to i32
  %120 = icmp eq i32 %119, 125
  br i1 %120, label %121, label %126

121:                                              ; preds = %117
  %122 = invoke noundef signext i8 @_ZN5Stack5StackIcE4peekEv(ptr noundef nonnull align 8 dereferenceable(16) %4)
          to label %123 unwind label %142

123:                                              ; preds = %121
  %124 = sext i8 %122 to i32
  %125 = icmp eq i32 %124, 123
  br i1 %125, label %139, label %126

126:                                              ; preds = %123, %117
  %127 = load i32, ptr %6, align 4, !tbaa !9
  %128 = sext i32 %127 to i64
  %129 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %128)
          to label %130 unwind label %142

130:                                              ; preds = %126
  %131 = load i8, ptr %129, align 1, !tbaa !11
  %132 = sext i8 %131 to i32
  %133 = icmp eq i32 %132, 93
  br i1 %133, label %134, label %155

134:                                              ; preds = %130
  %135 = invoke noundef signext i8 @_ZN5Stack5StackIcE4peekEv(ptr noundef nonnull align 8 dereferenceable(16) %4)
          to label %136 unwind label %142

136:                                              ; preds = %134
  %137 = sext i8 %135 to i32
  %138 = icmp eq i32 %137, 91
  br i1 %138, label %139, label %155

139:                                              ; preds = %136, %123, %110
  %140 = invoke noundef signext i8 @_ZN5Stack5StackIcE3popEv(ptr noundef nonnull align 8 dereferenceable(16) %4)
          to label %141 unwind label %142

141:                                              ; preds = %139
  br label %156

142:                                              ; preds = %139, %134, %126, %121, %113, %108, %100
  %143 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTIN5Stack18UnderflowExceptionE
  %144 = extractvalue { ptr, i32 } %143, 0
  store ptr %144, ptr %8, align 8
  %145 = extractvalue { ptr, i32 } %143, 1
  store i32 %145, ptr %9, align 4
  br label %146

146:                                              ; preds = %142
  %147 = load i32, ptr %9, align 4
  %148 = call i32 @llvm.eh.typeid.for.p0(ptr @_ZTIN5Stack18UnderflowExceptionE) #6
  %149 = icmp eq i32 %147, %148
  br i1 %149, label %150, label %176

150:                                              ; preds = %146
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %151 = load ptr, ptr %8, align 8
  %152 = call ptr @__cxa_begin_catch(ptr %151) #6
  store ptr %152, ptr %11, align 8
  %153 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.5)
          to label %154 unwind label %157

154:                                              ; preds = %150
  store i1 false, ptr %2, align 1
  store i32 1, ptr %7, align 4
  invoke void @__cxa_end_catch()
          to label %161 unwind label %162

155:                                              ; preds = %136, %130
  store i1 false, ptr %2, align 1
  store i32 1, ptr %7, align 4
  br label %174

156:                                              ; preds = %141
  br label %168

157:                                              ; preds = %150
  %158 = landingpad { ptr, i32 }
          cleanup
  %159 = extractvalue { ptr, i32 } %158, 0
  store ptr %159, ptr %8, align 8
  %160 = extractvalue { ptr, i32 } %158, 1
  store i32 %160, ptr %9, align 4
  invoke void @__cxa_end_catch()
          to label %166 unwind label %194

161:                                              ; preds = %154
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br label %174

162:                                              ; preds = %154
  %163 = landingpad { ptr, i32 }
          cleanup
  %164 = extractvalue { ptr, i32 } %163, 0
  store ptr %164, ptr %8, align 8
  %165 = extractvalue { ptr, i32 } %163, 1
  store i32 %165, ptr %9, align 4
  br label %167

166:                                              ; preds = %157
  br label %167

167:                                              ; preds = %166, %162
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br label %176

168:                                              ; preds = %156
  br label %169

169:                                              ; preds = %168, %96
  br label %170

170:                                              ; preds = %169, %75
  br label %171

171:                                              ; preds = %170
  %172 = load i32, ptr %6, align 4, !tbaa !9
  %173 = add nsw i32 %172, 1
  store i32 %173, ptr %6, align 4, !tbaa !9
  br label %14, !llvm.loop !12

174:                                              ; preds = %161, %155, %18
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  %175 = load i32, ptr %7, align 4
  switch i32 %175, label %186 [
    i32 2, label %177
  ]

176:                                              ; preds = %167, %146, %74, %59, %51
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %188

177:                                              ; preds = %174
  %178 = invoke noundef zeroext i1 @_ZN5Stack5StackIcE7isEmptyEv(ptr noundef nonnull align 8 dereferenceable(16) %4)
          to label %179 unwind label %181

179:                                              ; preds = %177
  br i1 %178, label %185, label %180

180:                                              ; preds = %179
  store i1 false, ptr %2, align 1
  store i32 1, ptr %7, align 4
  br label %186

181:                                              ; preds = %177
  %182 = landingpad { ptr, i32 }
          cleanup
  %183 = extractvalue { ptr, i32 } %182, 0
  store ptr %183, ptr %8, align 8
  %184 = extractvalue { ptr, i32 } %182, 1
  store i32 %184, ptr %9, align 4
  br label %188

185:                                              ; preds = %179
  store i1 true, ptr %2, align 1
  store i32 1, ptr %7, align 4
  br label %186

186:                                              ; preds = %185, %180, %174
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @_ZN5Stack5StackIcED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %4) #6
  %187 = load i1, ptr %2, align 1
  ret i1 %187

188:                                              ; preds = %181, %176
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @_ZN5Stack5StackIcED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %4) #6
  br label %189

189:                                              ; preds = %188
  %190 = load ptr, ptr %8, align 8
  %191 = load i32, ptr %9, align 4
  %192 = insertvalue { ptr, i32 } poison, ptr %190, 0
  %193 = insertvalue { ptr, i32 } %192, i32 %191, 1
  resume { ptr, i32 } %193

194:                                              ; preds = %157, %70
  %195 = landingpad { ptr, i32 }
          catch ptr null
  %196 = extractvalue { ptr, i32 } %195, 0
  call void @__clang_call_terminate(ptr %196) #8
  unreachable

197:                                              ; preds = %69
  unreachable
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5Stack5StackIcEC2Ei(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN5Stack5StackIcE4pushEc(ptr noundef nonnull align 8 dereferenceable(16), i8 noundef signext) #1 align 2

; Function Attrs: nounwind memory(none)
declare i32 @llvm.eh.typeid.for.p0(ptr) #4

declare ptr @__cxa_begin_catch(ptr)

declare void @__cxa_rethrow()

declare void @__cxa_end_catch()

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) #5

; Function Attrs: mustprogress uwtable
declare dso_local noundef signext i8 @_ZN5Stack5StackIcE4peekEv(ptr noundef nonnull align 8 dereferenceable(16)) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef signext i8 @_ZN5Stack5StackIcE3popEv(ptr noundef nonnull align 8 dereferenceable(16)) #1 align 2

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

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


; 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_ostream" = type { ptr, %"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.Stack::Stack" = type { ptr, i32, i32 }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@_ZTIN5Stack17OverflowExceptionE = external dso_local constant { ptr, ptr, ptr }, align 8
@.str.3 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [48 x i8], align 1
@_ZTIN5Stack18UnderflowExceptionE = external dso_local constant { ptr, ptr, ptr }, align 8
@.str.5 = external hidden unnamed_addr constant [28 x i8], align 1

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

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) #0

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z22areParanthesisBalancedNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef %0) local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.Stack::Stack", align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #6
  call void @_ZN5Stack5StackIcEC2Ei(ptr noundef nonnull align 8 dereferenceable(16) %2, i32 noundef 10)
  %3 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) %0) #6
  %4 = trunc i64 %3 to i32
  %.not28 = icmp sgt i32 %4, 0
  br i1 %.not28, label %.lr.ph.preheader, label %.critedge

.lr.ph.preheader:                                 ; preds = %1
  %wide.trip.count = and i64 %3, 2147483647
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %86
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %86 ]
  %5 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %indvars.iv)
  %6 = load i8, ptr %5, align 1, !tbaa !5
  %7 = icmp eq i8 %6, 40
  br i1 %7, label %16, label %8

8:                                                ; preds = %.lr.ph
  %9 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %indvars.iv)
  %10 = load i8, ptr %9, align 1, !tbaa !5
  %11 = icmp eq i8 %10, 123
  br i1 %11, label %16, label %12

12:                                               ; preds = %8
  %13 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %indvars.iv)
  %14 = load i8, ptr %13, align 1, !tbaa !5
  %15 = icmp eq i8 %14, 91
  br i1 %15, label %16, label %34

16:                                               ; preds = %12, %8, %.lr.ph
  %17 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %indvars.iv)
  %18 = load i8, ptr %17, align 1, !tbaa !5
  %19 = invoke noundef i32 @_ZN5Stack5StackIcE4pushEc(ptr noundef nonnull align 8 dereferenceable(16) %2, i8 noundef signext %18)
          to label %86 unwind label %20

20:                                               ; preds = %16
  %21 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTIN5Stack17OverflowExceptionE
  %22 = extractvalue { ptr, i32 } %21, 1
  %23 = call i32 @llvm.eh.typeid.for.p0(ptr nonnull @_ZTIN5Stack17OverflowExceptionE) #6
  %24 = icmp eq i32 %22, %23
  br i1 %24, label %25, label %87

25:                                               ; preds = %20
  %26 = extractvalue { ptr, i32 } %21, 0
  %27 = call ptr @__cxa_begin_catch(ptr %26) #6
  %28 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.3)
          to label %29 unwind label %32

29:                                               ; preds = %25
  %30 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.4)
          to label %31 unwind label %32

31:                                               ; preds = %29
  invoke void @__cxa_rethrow() #7
          to label %92 unwind label %32

32:                                               ; preds = %31, %29, %25
  %33 = landingpad { ptr, i32 }
          cleanup
  invoke void @__cxa_end_catch()
          to label %87 unwind label %89

34:                                               ; preds = %12
  %35 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %indvars.iv)
  %36 = load i8, ptr %35, align 1, !tbaa !5
  %37 = icmp eq i8 %36, 41
  br i1 %37, label %46, label %38

38:                                               ; preds = %34
  %39 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %indvars.iv)
  %40 = load i8, ptr %39, align 1, !tbaa !5
  %41 = icmp eq i8 %40, 125
  br i1 %41, label %46, label %42

42:                                               ; preds = %38
  %43 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %indvars.iv)
  %44 = load i8, ptr %43, align 1, !tbaa !5
  %45 = icmp eq i8 %44, 93
  br i1 %45, label %46, label %86

46:                                               ; preds = %42, %38, %34
  %47 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %indvars.iv)
  %48 = load i8, ptr %47, align 1, !tbaa !5
  %49 = icmp eq i8 %48, 41
  br i1 %49, label %50, label %54

50:                                               ; preds = %46
  %51 = invoke noundef signext i8 @_ZN5Stack5StackIcE4peekEv(ptr noundef nonnull align 8 dereferenceable(16) %2)
          to label %52 unwind label %72

52:                                               ; preds = %50
  %53 = icmp eq i8 %51, 40
  br i1 %53, label %70, label %54

54:                                               ; preds = %52, %46
  %55 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %indvars.iv)
  %56 = load i8, ptr %55, align 1, !tbaa !5
  %57 = icmp eq i8 %56, 125
  br i1 %57, label %58, label %62

58:                                               ; preds = %54
  %59 = invoke noundef signext i8 @_ZN5Stack5StackIcE4peekEv(ptr noundef nonnull align 8 dereferenceable(16) %2)
          to label %60 unwind label %72

60:                                               ; preds = %58
  %61 = icmp eq i8 %59, 123
  br i1 %61, label %70, label %62

62:                                               ; preds = %60, %54
  %63 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %indvars.iv)
  %64 = load i8, ptr %63, align 1, !tbaa !5
  %65 = icmp eq i8 %64, 93
  br i1 %65, label %66, label %.loopexit

66:                                               ; preds = %62
  %67 = invoke noundef signext i8 @_ZN5Stack5StackIcE4peekEv(ptr noundef nonnull align 8 dereferenceable(16) %2)
          to label %68 unwind label %72

68:                                               ; preds = %66
  %69 = icmp eq i8 %67, 91
  br i1 %69, label %70, label %.loopexit

70:                                               ; preds = %68, %60, %52
  %71 = invoke noundef signext i8 @_ZN5Stack5StackIcE3popEv(ptr noundef nonnull align 8 dereferenceable(16) %2)
          to label %86 unwind label %72

72:                                               ; preds = %70, %66, %58, %50
  %73 = landingpad { ptr, i32 }
          cleanup
          catch ptr @_ZTIN5Stack18UnderflowExceptionE
  %74 = extractvalue { ptr, i32 } %73, 1
  %75 = call i32 @llvm.eh.typeid.for.p0(ptr nonnull @_ZTIN5Stack18UnderflowExceptionE) #6
  %76 = icmp eq i32 %74, %75
  br i1 %76, label %77, label %87

77:                                               ; preds = %72
  %78 = extractvalue { ptr, i32 } %73, 0
  %79 = call ptr @__cxa_begin_catch(ptr %78) #6
  %80 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.5)
          to label %81 unwind label %82

81:                                               ; preds = %77
  invoke void @__cxa_end_catch()
          to label %.loopexit unwind label %84

82:                                               ; preds = %77
  %83 = landingpad { ptr, i32 }
          cleanup
  invoke void @__cxa_end_catch()
          to label %87 unwind label %89

84:                                               ; preds = %81
  %85 = landingpad { ptr, i32 }
          cleanup
  br label %87

86:                                               ; preds = %16, %70, %42
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.critedge, label %.lr.ph, !llvm.loop !8

87:                                               ; preds = %84, %82, %32, %72, %20
  %.merged = phi { ptr, i32 } [ %21, %20 ], [ %73, %72 ], [ %33, %32 ], [ %85, %84 ], [ %83, %82 ]
  call void @_ZN5Stack5StackIcED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %2) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #6
  resume { ptr, i32 } %.merged

.critedge:                                        ; preds = %86, %1
  %88 = call noundef zeroext i1 @_ZN5Stack5StackIcE7isEmptyEv(ptr noundef nonnull align 8 dereferenceable(16) %2)
  br label %.loopexit

.loopexit:                                        ; preds = %68, %62, %81, %.critedge
  %.1 = phi i1 [ %88, %.critedge ], [ false, %81 ], [ false, %62 ], [ false, %68 ]
  call void @_ZN5Stack5StackIcED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %2) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #6
  ret i1 %.1

89:                                               ; preds = %82, %32
  %90 = landingpad { ptr, i32 }
          catch ptr null
  %91 = extractvalue { ptr, i32 } %90, 0
  call void @__clang_call_terminate(ptr %91) #8
  unreachable

92:                                               ; preds = %31
  unreachable
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5Stack5StackIcEC2Ei(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN5Stack5StackIcE4pushEc(ptr noundef nonnull align 8 dereferenceable(16), i8 noundef signext) local_unnamed_addr #1 align 2

; Function Attrs: nofree nosync nounwind memory(none)
declare i32 @llvm.eh.typeid.for.p0(ptr) #4

declare ptr @__cxa_begin_catch(ptr) local_unnamed_addr

declare void @__cxa_rethrow() local_unnamed_addr

declare void @__cxa_end_catch() local_unnamed_addr

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
declare dso_local noundef signext i8 @_ZN5Stack5StackIcE4peekEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef signext i8 @_ZN5Stack5StackIcE3popEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5Stack5StackIcED2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3 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 = { 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 #3 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nosync nounwind memory(none) }
attributes #5 = { noinline noreturn nounwind uwtable "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 }
attributes #7 = { noreturn }
attributes #8 = { noreturn 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass