; LLVM IR from ritikbanger/Hacktoberfest2022-DSA :: 11. Stack/infix_to_postfix.ll (Z14infixToPostfixPcS_)

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z9isOperandc(i8 noundef signext) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z15checkPrecedencec(i8 noundef signext) #0

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z14infixToPostfixPcS_(ptr noundef %0, ptr noundef %1) #1 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca %"class.std::stack", align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 80, ptr %7) #4
  call void @_ZNSt5stackIcSt5dequeIcSaIcEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
  br label %10

10:                                               ; preds = %133, %2
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = load i32, ptr %5, align 4, !tbaa !9
  %13 = sext i32 %12 to i64
  %14 = getelementptr inbounds i8, ptr %11, i64 %13
  %15 = load i8, ptr %14, align 1, !tbaa !11
  %16 = icmp ne i8 %15, 0
  br i1 %16, label %17, label %136

17:                                               ; preds = %10
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = load i32, ptr %5, align 4, !tbaa !9
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds i8, ptr %18, i64 %20
  %22 = load i8, ptr %21, align 1, !tbaa !11
  %23 = call noundef i32 @_Z9isOperandc(i8 noundef signext %22)
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %25, label %36

25:                                               ; preds = %17
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = load i32, ptr %5, align 4, !tbaa !9
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds i8, ptr %26, i64 %28
  %30 = load i8, ptr %29, align 1, !tbaa !11
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = load i32, ptr %6, align 4, !tbaa !9
  %33 = add nsw i32 %32, 1
  store i32 %33, ptr %6, align 4, !tbaa !9
  %34 = sext i32 %32 to i64
  %35 = getelementptr inbounds i8, ptr %31, i64 %34
  store i8 %30, ptr %35, align 1, !tbaa !11
  br label %133

36:                                               ; preds = %17
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %38 = load i32, ptr %5, align 4, !tbaa !9
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds i8, ptr %37, i64 %39
  %41 = load i8, ptr %40, align 1, !tbaa !11
  %42 = sext i8 %41 to i32
  %43 = icmp eq i32 %42, 40
  br i1 %43, label %44, label %54

44:                                               ; preds = %36
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = load i32, ptr %5, align 4, !tbaa !9
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds i8, ptr %45, i64 %47
  invoke void @_ZNSt5stackIcSt5dequeIcSaIcEEE4pushERKc(ptr noundef nonnull align 8 dereferenceable(80) %7, ptr noundef nonnull align 1 dereferenceable(1) %48)
          to label %49 unwind label %50

49:                                               ; preds = %44
  br label %132

50:                                               ; preds = %143, %141, %137, %125, %117, %115, %101, %98, %94, %87, %84, %76, %74, %66, %63, %44
  %51 = landingpad { ptr, i32 }
          cleanup
  %52 = extractvalue { ptr, i32 } %51, 0
  store ptr %52, ptr %8, align 8
  %53 = extractvalue { ptr, i32 } %51, 1
  store i32 %53, ptr %9, align 4
  call void @_ZNSt5stackIcSt5dequeIcSaIcEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %7) #4
  call void @llvm.lifetime.end.p0(i64 80, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %157

54:                                               ; preds = %36
  %55 = load ptr, ptr %3, align 8, !tbaa !5
  %56 = load i32, ptr %5, align 4, !tbaa !9
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds i8, ptr %55, i64 %57
  %59 = load i8, ptr %58, align 1, !tbaa !11
  %60 = sext i8 %59 to i32
  %61 = icmp eq i32 %60, 41
  br i1 %61, label %62, label %97

62:                                               ; preds = %54
  br label %63

63:                                               ; preds = %83, %62
  %64 = invoke noundef zeroext i1 @_ZNKSt5stackIcSt5dequeIcSaIcEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
          to label %65 unwind label %50

65:                                               ; preds = %63
  br i1 %64, label %72, label %66

66:                                               ; preds = %65
  %67 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt5stackIcSt5dequeIcSaIcEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
          to label %68 unwind label %50

68:                                               ; preds = %66
  %69 = load i8, ptr %67, align 1, !tbaa !11
  %70 = sext i8 %69 to i32
  %71 = icmp ne i32 %70, 40
  br label %72

72:                                               ; preds = %68, %65
  %73 = phi i1 [ false, %65 ], [ %71, %68 ]
  br i1 %73, label %74, label %84

74:                                               ; preds = %72
  %75 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt5stackIcSt5dequeIcSaIcEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
          to label %76 unwind label %50

76:                                               ; preds = %74
  %77 = load i8, ptr %75, align 1, !tbaa !11
  %78 = load ptr, ptr %4, align 8, !tbaa !5
  %79 = load i32, ptr %6, align 4, !tbaa !9
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr %6, align 4, !tbaa !9
  %81 = sext i32 %79 to i64
  %82 = getelementptr inbounds i8, ptr %78, i64 %81
  store i8 %77, ptr %82, align 1, !tbaa !11
  invoke void @_ZNSt5stackIcSt5dequeIcSaIcEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
          to label %83 unwind label %50

83:                                               ; preds = %76
  br label %63, !llvm.loop !12

84:                                               ; preds = %72
  %85 = invoke noundef zeroext i1 @_ZNKSt5stackIcSt5dequeIcSaIcEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
          to label %86 unwind label %50

86:                                               ; preds = %84
  br i1 %85, label %94, label %87

87:                                               ; preds = %86
  %88 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt5stackIcSt5dequeIcSaIcEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
          to label %89 unwind label %50

89:                                               ; preds = %87
  %90 = load i8, ptr %88, align 1, !tbaa !11
  %91 = sext i8 %90 to i32
  %92 = icmp ne i32 %91, 40
  br i1 %92, label %93, label %94

93:                                               ; preds = %89
  call void @_ZNSt5stackIcSt5dequeIcSaIcEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %7) #4
  call void @llvm.lifetime.end.p0(i64 80, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  ret i32 -1

94:                                               ; preds = %89, %86
  invoke void @_ZNSt5stackIcSt5dequeIcSaIcEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
          to label %95 unwind label %50

95:                                               ; preds = %94
  br label %96

96:                                               ; preds = %95
  br label %131

97:                                               ; preds = %54
  br label %98

98:                                               ; preds = %124, %97
  %99 = invoke noundef zeroext i1 @_ZNKSt5stackIcSt5dequeIcSaIcEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
          to label %100 unwind label %50

100:                                              ; preds = %98
  br i1 %99, label %113, label %101

101:                                              ; preds = %100
  %102 = load ptr, ptr %3, align 8, !tbaa !5
  %103 = load i32, ptr %5, align 4, !tbaa !9
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds i8, ptr %102, i64 %104
  %106 = load i8, ptr %105, align 1, !tbaa !11
  %107 = call noundef i32 @_Z15checkPrecedencec(i8 noundef signext %106)
  %108 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt5stackIcSt5dequeIcSaIcEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
          to label %109 unwind label %50

109:                                              ; preds = %101
  %110 = load i8, ptr %108, align 1, !tbaa !11
  %111 = call noundef i32 @_Z15checkPrecedencec(i8 noundef signext %110)
  %112 = icmp sle i32 %107, %111
  br label %113

113:                                              ; preds = %109, %100
  %114 = phi i1 [ false, %100 ], [ %112, %109 ]
  br i1 %114, label %115, label %125

115:                                              ; preds = %113
  %116 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt5stackIcSt5dequeIcSaIcEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
          to label %117 unwind label %50

117:                                              ; preds = %115
  %118 = load i8, ptr %116, align 1, !tbaa !11
  %119 = load ptr, ptr %4, align 8, !tbaa !5
  %120 = load i32, ptr %6, align 4, !tbaa !9
  %121 = add nsw i32 %120, 1
  store i32 %121, ptr %6, align 4, !tbaa !9
  %122 = sext i32 %120 to i64
  %123 = getelementptr inbounds i8, ptr %119, i64 %122
  store i8 %118, ptr %123, align 1, !tbaa !11
  invoke void @_ZNSt5stackIcSt5dequeIcSaIcEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
          to label %124 unwind label %50

124:                                              ; preds = %117
  br label %98, !llvm.loop !14

125:                                              ; preds = %113
  %126 = load ptr, ptr %3, align 8, !tbaa !5
  %127 = load i32, ptr %5, align 4, !tbaa !9
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds i8, ptr %126, i64 %128
  invoke void @_ZNSt5stackIcSt5dequeIcSaIcEEE4pushERKc(ptr noundef nonnull align 8 dereferenceable(80) %7, ptr noundef nonnull align 1 dereferenceable(1) %129)
          to label %130 unwind label %50

130:                                              ; preds = %125
  br label %131

131:                                              ; preds = %130, %96
  br label %132

132:                                              ; preds = %131, %49
  br label %133

133:                                              ; preds = %132, %25
  %134 = load i32, ptr %5, align 4, !tbaa !9
  %135 = add nsw i32 %134, 1
  store i32 %135, ptr %5, align 4, !tbaa !9
  br label %10, !llvm.loop !15

136:                                              ; preds = %10
  br label %137

137:                                              ; preds = %150, %136
  %138 = invoke noundef zeroext i1 @_ZNKSt5stackIcSt5dequeIcSaIcEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
          to label %139 unwind label %50

139:                                              ; preds = %137
  %140 = xor i1 %138, true
  br i1 %140, label %141, label %151

141:                                              ; preds = %139
  %142 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt5stackIcSt5dequeIcSaIcEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
          to label %143 unwind label %50

143:                                              ; preds = %141
  %144 = load i8, ptr %142, align 1, !tbaa !11
  %145 = load ptr, ptr %4, align 8, !tbaa !5
  %146 = load i32, ptr %6, align 4, !tbaa !9
  %147 = add nsw i32 %146, 1
  store i32 %147, ptr %6, align 4, !tbaa !9
  %148 = sext i32 %146 to i64
  %149 = getelementptr inbounds i8, ptr %145, i64 %148
  store i8 %144, ptr %149, align 1, !tbaa !11
  invoke void @_ZNSt5stackIcSt5dequeIcSaIcEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
          to label %150 unwind label %50

150:                                              ; preds = %143
  br label %137, !llvm.loop !16

151:                                              ; preds = %139
  %152 = load ptr, ptr %4, align 8, !tbaa !5
  %153 = load i32, ptr %6, align 4, !tbaa !9
  %154 = add nsw i32 %153, 1
  store i32 %154, ptr %6, align 4, !tbaa !9
  %155 = sext i32 %153 to i64
  %156 = getelementptr inbounds i8, ptr %152, i64 %155
  store i8 0, ptr %156, align 1, !tbaa !11
  unreachable

157:                                              ; preds = %50
  %158 = load ptr, ptr %8, align 8
  %159 = load i32, ptr %9, align 4
  %160 = insertvalue { ptr, i32 } poison, ptr %158, 0
  %161 = insertvalue { ptr, i32 } %160, i32 %159, 1
  resume { ptr, i32 } %161
}

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt5stackIcSt5dequeIcSaIcEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #3 align 2

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

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


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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z9isOperandc(i8 noundef signext) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z15checkPrecedencec(i8 noundef signext) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z14infixToPostfixPcS_(ptr noundef %0, ptr nocapture noundef writeonly %1) local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.std::stack", align 8
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %3) #5
  call void @_ZNSt5stackIcSt5dequeIcSaIcEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %4 = load i8, ptr %0, align 1, !tbaa !5
  %.not47 = icmp eq i8 %4, 0
  br i1 %.not47, label %.preheader.preheader, label %.lr.ph50

.preheader.preheader:                             ; preds = %.preheader.loopexit, %2
  %indvars.iv59.ph = phi i64 [ %5, %.preheader.loopexit ], [ 0, %2 ]
  br label %.preheader

.preheader.loopexit:                              ; preds = %45
  %5 = sext i32 %.3 to i64
  br label %.preheader.preheader

.lr.ph50:                                         ; preds = %2, %45
  %indvars.iv57 = phi i64 [ %indvars.iv.next58, %45 ], [ 0, %2 ]
  %6 = phi i8 [ %47, %45 ], [ %4, %2 ]
  %.02848 = phi i32 [ %.3, %45 ], [ 0, %2 ]
  %7 = getelementptr inbounds i8, ptr %0, i64 %indvars.iv57
  %8 = call noundef i32 @_Z9isOperandc(i8 noundef signext %6)
  %.not31 = icmp eq i32 %8, 0
  %9 = load i8, ptr %7, align 1, !tbaa !5
  br i1 %.not31, label %14, label %10

10:                                               ; preds = %.lr.ph50
  %11 = add nsw i32 %.02848, 1
  %12 = sext i32 %.02848 to i64
  %13 = getelementptr inbounds i8, ptr %1, i64 %12
  store i8 %9, ptr %13, align 1, !tbaa !5
  br label %45

14:                                               ; preds = %.lr.ph50
  switch i8 %9, label %.preheader35 [
    i8 40, label %19
    i8 41, label %.preheader36
  ]

.preheader36:                                     ; preds = %14
  %15 = call noundef zeroext i1 @_ZNKSt5stackIcSt5dequeIcSaIcEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  br i1 %15, label %.critedge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.preheader36
  %16 = sext i32 %.02848 to i64
  br label %.lr.ph

.preheader35:                                     ; preds = %14
  %17 = call noundef zeroext i1 @_ZNKSt5stackIcSt5dequeIcSaIcEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  br i1 %17, label %.critedge2, label %.lr.ph43.preheader

.lr.ph43.preheader:                               ; preds = %.preheader35
  %18 = sext i32 %.02848 to i64
  br label %.lr.ph43

19:                                               ; preds = %14
  invoke void @_ZNSt5stackIcSt5dequeIcSaIcEEE4pushERKc(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 1 dereferenceable(1) %7)
          to label %45 unwind label %20

20:                                               ; preds = %.critedge2, %19
  %21 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt5stackIcSt5dequeIcSaIcEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %3) #5
  resume { ptr, i32 } %21

.lr.ph:                                           ; preds = %.lr.ph.preheader, %24
  %indvars.iv = phi i64 [ %16, %.lr.ph.preheader ], [ %indvars.iv.next, %24 ]
  %22 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt5stackIcSt5dequeIcSaIcEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %23 = load i8, ptr %22, align 1, !tbaa !5
  %.not33 = icmp eq i8 %23, 40
  br i1 %.not33, label %.critedge.loopexit, label %24

24:                                               ; preds = %.lr.ph
  %25 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt5stackIcSt5dequeIcSaIcEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %26 = load i8, ptr %25, align 1, !tbaa !5
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %27 = getelementptr inbounds i8, ptr %1, i64 %indvars.iv
  store i8 %26, ptr %27, align 1, !tbaa !5
  call void @_ZNSt5stackIcSt5dequeIcSaIcEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %28 = call noundef zeroext i1 @_ZNKSt5stackIcSt5dequeIcSaIcEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  br i1 %28, label %.critedge.loopexit, label %.lr.ph, !llvm.loop !8

.critedge.loopexit:                               ; preds = %24, %.lr.ph
  %.1.lcssa.ph.in = phi i64 [ %indvars.iv, %.lr.ph ], [ %indvars.iv.next, %24 ]
  %.1.lcssa.ph = trunc i64 %.1.lcssa.ph.in to i32
  br label %.critedge

.critedge:                                        ; preds = %.critedge.loopexit, %.preheader36
  %.1.lcssa = phi i32 [ %.02848, %.preheader36 ], [ %.1.lcssa.ph, %.critedge.loopexit ]
  %29 = call noundef zeroext i1 @_ZNKSt5stackIcSt5dequeIcSaIcEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  br i1 %29, label %34, label %30

30:                                               ; preds = %.critedge
  %31 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt5stackIcSt5dequeIcSaIcEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %32 = load i8, ptr %31, align 1, !tbaa !5
  %.not34 = icmp eq i8 %32, 40
  br i1 %.not34, label %34, label %33

33:                                               ; preds = %30
  call void @_ZNSt5stackIcSt5dequeIcSaIcEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %3) #5
  ret i32 -1

34:                                               ; preds = %30, %.critedge
  call void @_ZNSt5stackIcSt5dequeIcSaIcEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  br label %45

.lr.ph43:                                         ; preds = %.lr.ph43.preheader, %40
  %indvars.iv53 = phi i64 [ %18, %.lr.ph43.preheader ], [ %indvars.iv.next54, %40 ]
  %35 = load i8, ptr %7, align 1, !tbaa !5
  %36 = call noundef i32 @_Z15checkPrecedencec(i8 noundef signext %35)
  %37 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt5stackIcSt5dequeIcSaIcEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %38 = load i8, ptr %37, align 1, !tbaa !5
  %39 = call noundef i32 @_Z15checkPrecedencec(i8 noundef signext %38)
  %.not32 = icmp sgt i32 %36, %39
  br i1 %.not32, label %.critedge2.loopexit, label %40

40:                                               ; preds = %.lr.ph43
  %41 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt5stackIcSt5dequeIcSaIcEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %42 = load i8, ptr %41, align 1, !tbaa !5
  %indvars.iv.next54 = add nsw i64 %indvars.iv53, 1
  %43 = getelementptr inbounds i8, ptr %1, i64 %indvars.iv53
  store i8 %42, ptr %43, align 1, !tbaa !5
  call void @_ZNSt5stackIcSt5dequeIcSaIcEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %44 = call noundef zeroext i1 @_ZNKSt5stackIcSt5dequeIcSaIcEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  br i1 %44, label %.critedge2.loopexit, label %.lr.ph43, !llvm.loop !10

.critedge2.loopexit:                              ; preds = %40, %.lr.ph43
  %.2.lcssa.ph.in = phi i64 [ %indvars.iv53, %.lr.ph43 ], [ %indvars.iv.next54, %40 ]
  %.2.lcssa.ph = trunc i64 %.2.lcssa.ph.in to i32
  br label %.critedge2

.critedge2:                                       ; preds = %.critedge2.loopexit, %.preheader35
  %.2.lcssa = phi i32 [ %.02848, %.preheader35 ], [ %.2.lcssa.ph, %.critedge2.loopexit ]
  invoke void @_ZNSt5stackIcSt5dequeIcSaIcEEE4pushERKc(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 1 dereferenceable(1) %7)
          to label %45 unwind label %20

45:                                               ; preds = %19, %.critedge2, %34, %10
  %.3 = phi i32 [ %11, %10 ], [ %.02848, %19 ], [ %.1.lcssa, %34 ], [ %.2.lcssa, %.critedge2 ]
  %indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
  %46 = getelementptr inbounds i8, ptr %0, i64 %indvars.iv.next58
  %47 = load i8, ptr %46, align 1, !tbaa !5
  %.not = icmp eq i8 %47, 0
  br i1 %.not, label %.preheader.loopexit, label %.lr.ph50, !llvm.loop !11

.preheader:                                       ; preds = %.preheader.preheader, %.preheader
  %indvars.iv59 = phi i64 [ %indvars.iv.next60, %.preheader ], [ %indvars.iv59.ph, %.preheader.preheader ]
  %48 = call noundef zeroext i1 @_ZNKSt5stackIcSt5dequeIcSaIcEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %49 = xor i1 %48, true
  call void @llvm.assume(i1 %49)
  %50 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt5stackIcSt5dequeIcSaIcEEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %51 = load i8, ptr %50, align 1, !tbaa !5
  %indvars.iv.next60 = add nsw i64 %indvars.iv59, 1
  %52 = getelementptr inbounds i8, ptr %1, i64 %indvars.iv59
  store i8 %51, ptr %52, align 1, !tbaa !5
  call void @_ZNSt5stackIcSt5dequeIcSaIcEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  br label %.preheader, !llvm.loop !12
}

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt5stackIcSt5dequeIcSaIcEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #3 align 2

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #4

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

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

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


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