; LLVM IR from AlgoGenesis/C :: Infix to Prefix/conversion (program)

; 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"

%struct.Stack = type { i32, [100 x i8] }

@stderr = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [43 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @initStack(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @isEmpty(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @push(ptr noundef, i8 noundef signext) #0

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #1

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local signext i8 @pop(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local signext i8 @peek(ptr noundef) #0

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @reverse(ptr noundef) #0

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @swapBrackets(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @isValidInfix(ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local void @infixToPrefix(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %struct.Stack, align 4
  %6 = alloca [100 x i8], align 16
  %7 = alloca i32, align 4
  %8 = 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 104, ptr %5) #5
  call void @initStack(ptr noundef %5)
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = call i32 @isValidInfix(ptr noundef %9)
  %11 = icmp ne i32 %10, 0
  br i1 %11, label %15, label %12

12:                                               ; preds = %2
  %13 = load ptr, ptr @stderr, align 8, !tbaa !5
  %14 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %13, ptr noundef @.str.2) #5
  call void @exit(i32 noundef 1) #6
  unreachable

15:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 100, ptr %6) #5
  %16 = getelementptr inbounds [100 x i8], ptr %6, i64 0, i64 0
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = call ptr @strcpy(ptr noundef %16, ptr noundef %17) #5
  %19 = getelementptr inbounds [100 x i8], ptr %6, i64 0, i64 0
  call void @reverse(ptr noundef %19)
  %20 = getelementptr inbounds [100 x i8], ptr %6, i64 0, i64 0
  call void @swapBrackets(ptr noundef %20)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !9
  br label %21

21:                                               ; preds = %139, %15
  %22 = load i32, ptr %7, align 4, !tbaa !9
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [100 x i8], ptr %6, i64 0, i64 %23
  %25 = load i8, ptr %24, align 1, !tbaa !11
  %26 = sext i8 %25 to i32
  %27 = icmp ne i32 %26, 0
  br i1 %27, label %28, label %142

28:                                               ; preds = %21
  %29 = call ptr @__ctype_b_loc() #7
  %30 = load ptr, ptr %29, align 8, !tbaa !5
  %31 = load i32, ptr %7, align 4, !tbaa !9
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [100 x i8], ptr %6, i64 0, i64 %32
  %34 = load i8, ptr %33, align 1, !tbaa !11
  %35 = sext i8 %34 to i32
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds i16, ptr %30, i64 %36
  %38 = load i16, ptr %37, align 2, !tbaa !12
  %39 = zext i16 %38 to i32
  %40 = and i32 %39, 8
  %41 = icmp ne i32 %40, 0
  br i1 %41, label %42, label %52

42:                                               ; preds = %28
  %43 = load i32, ptr %7, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [100 x i8], ptr %6, i64 0, i64 %44
  %46 = load i8, ptr %45, align 1, !tbaa !11
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = load i32, ptr %8, align 4, !tbaa !9
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %8, align 4, !tbaa !9
  %50 = sext i32 %48 to i64
  %51 = getelementptr inbounds i8, ptr %47, i64 %50
  store i8 %46, ptr %51, align 1, !tbaa !11
  br label %139

52:                                               ; preds = %28
  %53 = load i32, ptr %7, align 4, !tbaa !9
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [100 x i8], ptr %6, i64 0, i64 %54
  %56 = load i8, ptr %55, align 1, !tbaa !11
  %57 = sext i8 %56 to i32
  %58 = icmp eq i32 %57, 40
  br i1 %58, label %59, label %64

59:                                               ; preds = %52
  %60 = load i32, ptr %7, align 4, !tbaa !9
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [100 x i8], ptr %6, i64 0, i64 %61
  %63 = load i8, ptr %62, align 1, !tbaa !11
  call void @push(ptr noundef %5, i8 noundef signext %63)
  br label %138

64:                                               ; preds = %52
  %65 = load i32, ptr %7, align 4, !tbaa !9
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [100 x i8], ptr %6, i64 0, i64 %66
  %68 = load i8, ptr %67, align 1, !tbaa !11
  %69 = sext i8 %68 to i32
  %70 = icmp eq i32 %69, 41
  br i1 %70, label %71, label %94

71:                                               ; preds = %64
  br label %72

72:                                               ; preds = %81, %71
  %73 = call i32 @isEmpty(ptr noundef %5)
  %74 = icmp ne i32 %73, 0
  br i1 %74, label %79, label %75

75:                                               ; preds = %72
  %76 = call signext i8 @peek(ptr noundef %5)
  %77 = sext i8 %76 to i32
  %78 = icmp ne i32 %77, 40
  br label %79

79:                                               ; preds = %75, %72
  %80 = phi i1 [ false, %72 ], [ %78, %75 ]
  br i1 %80, label %81, label %88

81:                                               ; preds = %79
  %82 = call signext i8 @pop(ptr noundef %5)
  %83 = load ptr, ptr %4, align 8, !tbaa !5
  %84 = load i32, ptr %8, align 4, !tbaa !9
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %8, align 4, !tbaa !9
  %86 = sext i32 %84 to i64
  %87 = getelementptr inbounds i8, ptr %83, i64 %86
  store i8 %82, ptr %87, align 1, !tbaa !11
  br label %72, !llvm.loop !14

88:                                               ; preds = %79
  %89 = call i32 @isEmpty(ptr noundef %5)
  %90 = icmp ne i32 %89, 0
  br i1 %90, label %93, label %91

91:                                               ; preds = %88
  %92 = call signext i8 @pop(ptr noundef %5)
  br label %93

93:                                               ; preds = %91, %88
  br label %137

94:                                               ; preds = %64
  %95 = load i32, ptr %7, align 4, !tbaa !9
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [100 x i8], ptr %6, i64 0, i64 %96
  %98 = load i8, ptr %97, align 1, !tbaa !11
  %99 = call i32 @isOperator(i8 noundef signext %98)
  %100 = icmp ne i32 %99, 0
  br i1 %100, label %101, label %128

101:                                              ; preds = %94
  br label %102

102:                                              ; preds = %116, %101
  %103 = call i32 @isEmpty(ptr noundef %5)
  %104 = icmp ne i32 %103, 0
  br i1 %104, label %114, label %105

105:                                              ; preds = %102
  %106 = call signext i8 @peek(ptr noundef %5)
  %107 = call i32 @precedence(i8 noundef signext %106)
  %108 = load i32, ptr %7, align 4, !tbaa !9
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [100 x i8], ptr %6, i64 0, i64 %109
  %111 = load i8, ptr %110, align 1, !tbaa !11
  %112 = call i32 @precedence(i8 noundef signext %111)
  %113 = icmp sge i32 %107, %112
  br label %114

114:                                              ; preds = %105, %102
  %115 = phi i1 [ false, %102 ], [ %113, %105 ]
  br i1 %115, label %116, label %123

116:                                              ; preds = %114
  %117 = call signext i8 @pop(ptr noundef %5)
  %118 = load ptr, ptr %4, align 8, !tbaa !5
  %119 = load i32, ptr %8, align 4, !tbaa !9
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr %8, align 4, !tbaa !9
  %121 = sext i32 %119 to i64
  %122 = getelementptr inbounds i8, ptr %118, i64 %121
  store i8 %117, ptr %122, align 1, !tbaa !11
  br label %102, !llvm.loop !16

123:                                              ; preds = %114
  %124 = load i32, ptr %7, align 4, !tbaa !9
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [100 x i8], ptr %6, i64 0, i64 %125
  %127 = load i8, ptr %126, align 1, !tbaa !11
  call void @push(ptr noundef %5, i8 noundef signext %127)
  br label %136

128:                                              ; preds = %94
  %129 = load ptr, ptr @stderr, align 8, !tbaa !5
  %130 = load i32, ptr %7, align 4, !tbaa !9
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [100 x i8], ptr %6, i64 0, i64 %131
  %133 = load i8, ptr %132, align 1, !tbaa !11
  %134 = sext i8 %133 to i32
  %135 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %129, ptr noundef @.str.3, i32 noundef %134) #5
  call void @exit(i32 noundef 1) #6
  unreachable

136:                                              ; preds = %123
  br label %137

137:                                              ; preds = %136, %93
  br label %138

138:                                              ; preds = %137, %59
  br label %139

139:                                              ; preds = %138, %42
  %140 = load i32, ptr %7, align 4, !tbaa !9
  %141 = add nsw i32 %140, 1
  store i32 %141, ptr %7, align 4, !tbaa !9
  br label %21, !llvm.loop !17

142:                                              ; preds = %21
  br label %143

143:                                              ; preds = %147, %142
  %144 = call i32 @isEmpty(ptr noundef %5)
  %145 = icmp ne i32 %144, 0
  %146 = xor i1 %145, true
  br i1 %146, label %147, label %154

147:                                              ; preds = %143
  %148 = call signext i8 @pop(ptr noundef %5)
  %149 = load ptr, ptr %4, align 8, !tbaa !5
  %150 = load i32, ptr %8, align 4, !tbaa !9
  %151 = add nsw i32 %150, 1
  store i32 %151, ptr %8, align 4, !tbaa !9
  %152 = sext i32 %150 to i64
  %153 = getelementptr inbounds i8, ptr %149, i64 %152
  store i8 %148, ptr %153, align 1, !tbaa !11
  br label %143, !llvm.loop !18

154:                                              ; preds = %143
  %155 = load ptr, ptr %4, align 8, !tbaa !5
  %156 = load i32, ptr %8, align 4, !tbaa !9
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds i8, ptr %155, i64 %157
  store i8 0, ptr %158, align 1, !tbaa !11
  %159 = load ptr, ptr %4, align 8, !tbaa !5
  call void @reverse(ptr noundef %159)
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 100, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 104, ptr %5) #5
  ret void
}

; Function Attrs: nounwind
declare ptr @strcpy(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__ctype_b_loc() #4

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

!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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"short", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = distinct !{!17, !15}
!18 = distinct !{!18, !15}


; 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"

%struct.Stack = type { i32, [100 x i8] }

@stderr = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [43 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @initStack(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @isEmpty(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @push(ptr noundef, i8 noundef signext) local_unnamed_addr #0

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #1

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local signext i8 @pop(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local signext i8 @peek(ptr noundef) local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @reverse(ptr noundef) local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @swapBrackets(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @isValidInfix(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @infixToPrefix(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca %struct.Stack, align 4
  %4 = alloca [100 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %3) #6
  call void @initStack(ptr noundef nonnull %3)
  %5 = call i32 @isValidInfix(ptr noundef %0)
  %.not = icmp eq i32 %5, 0
  br i1 %.not, label %6, label %9

6:                                                ; preds = %2
  %7 = load ptr, ptr @stderr, align 8, !tbaa !5
  %8 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %7, ptr noundef nonnull @.str.2) #7
  call void @exit(i32 noundef 1) #8
  unreachable

9:                                                ; preds = %2
  call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %4) #6
  %10 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %4, ptr noundef nonnull dereferenceable(1) %0) #6
  call void @reverse(ptr noundef nonnull %4)
  call void @swapBrackets(ptr noundef nonnull %4)
  %11 = load i8, ptr %4, align 16, !tbaa !9
  %.not2750 = icmp eq i8 %11, 0
  br i1 %.not2750, label %.preheader, label %.lr.ph53

.lr.ph53:                                         ; preds = %9
  %12 = tail call ptr @__ctype_b_loc() #9
  br label %15

.preheader:                                       ; preds = %57, %9
  %.0.lcssa = phi i32 [ 0, %9 ], [ %.3, %57 ]
  %13 = call i32 @isEmpty(ptr noundef nonnull %3)
  %.not2855 = icmp eq i32 %13, 0
  br i1 %.not2855, label %.lr.ph57.preheader, label %._crit_edge

.lr.ph57.preheader:                               ; preds = %.preheader
  %14 = sext i32 %.0.lcssa to i64
  br label %.lr.ph57

15:                                               ; preds = %.lr.ph53, %57
  %indvars.iv66 = phi i64 [ 0, %.lr.ph53 ], [ %indvars.iv.next67, %57 ]
  %16 = phi i8 [ %11, %.lr.ph53 ], [ %59, %57 ]
  %17 = phi ptr [ %4, %.lr.ph53 ], [ %58, %57 ]
  %.052 = phi i32 [ 0, %.lr.ph53 ], [ %.3, %57 ]
  %18 = load ptr, ptr %12, align 8, !tbaa !5
  %19 = sext i8 %16 to i64
  %20 = getelementptr inbounds i16, ptr %18, i64 %19
  %21 = load i16, ptr %20, align 2, !tbaa !10
  %22 = and i16 %21, 8
  %.not29 = icmp eq i16 %22, 0
  br i1 %.not29, label %27, label %23

23:                                               ; preds = %15
  %24 = add nsw i32 %.052, 1
  %25 = sext i32 %.052 to i64
  %26 = getelementptr inbounds i8, ptr %1, i64 %25
  store i8 %16, ptr %26, align 1, !tbaa !9
  br label %57

27:                                               ; preds = %15
  switch i8 %16, label %39 [
    i8 40, label %30
    i8 41, label %.preheader37
  ]

.preheader37:                                     ; preds = %27
  %28 = call i32 @isEmpty(ptr noundef nonnull %3)
  %.not3340 = icmp eq i32 %28, 0
  br i1 %.not3340, label %.lr.ph.preheader, label %.critedge

.lr.ph.preheader:                                 ; preds = %.preheader37
  %29 = sext i32 %.052 to i64
  br label %.lr.ph

30:                                               ; preds = %27
  call void @push(ptr noundef nonnull %3, i8 noundef signext 40)
  br label %57

.lr.ph:                                           ; preds = %.lr.ph.preheader, %32
  %indvars.iv = phi i64 [ %29, %.lr.ph.preheader ], [ %indvars.iv.next, %32 ]
  %31 = call signext i8 @peek(ptr noundef nonnull %3)
  %.not34 = icmp eq i8 %31, 40
  br i1 %.not34, label %.critedge.loopexit, label %32

32:                                               ; preds = %.lr.ph
  %33 = call signext i8 @pop(ptr noundef nonnull %3)
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %34 = getelementptr inbounds i8, ptr %1, i64 %indvars.iv
  store i8 %33, ptr %34, align 1, !tbaa !9
  %35 = call i32 @isEmpty(ptr noundef nonnull %3)
  %.not33 = icmp eq i32 %35, 0
  br i1 %.not33, label %.lr.ph, label %.critedge.loopexit, !llvm.loop !12

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

.critedge:                                        ; preds = %.critedge.loopexit, %.preheader37
  %.1.lcssa = phi i32 [ %.052, %.preheader37 ], [ %.1.lcssa.ph, %.critedge.loopexit ]
  %36 = call i32 @isEmpty(ptr noundef nonnull %3)
  %.not35 = icmp eq i32 %36, 0
  br i1 %.not35, label %37, label %57

37:                                               ; preds = %.critedge
  %38 = call signext i8 @pop(ptr noundef nonnull %3)
  br label %57

39:                                               ; preds = %27
  %40 = call i32 @isOperator(i8 noundef signext %16)
  %.not30 = icmp eq i32 %40, 0
  br i1 %.not30, label %52, label %.preheader36

.preheader36:                                     ; preds = %39
  %41 = call i32 @isEmpty(ptr noundef nonnull %3)
  %.not3144 = icmp eq i32 %41, 0
  br i1 %.not3144, label %.lr.ph46.preheader, label %.critedge2

.lr.ph46.preheader:                               ; preds = %.preheader36
  %42 = sext i32 %.052 to i64
  br label %.lr.ph46

.lr.ph46:                                         ; preds = %.lr.ph46.preheader, %47
  %indvars.iv62 = phi i64 [ %42, %.lr.ph46.preheader ], [ %indvars.iv.next63, %47 ]
  %43 = call signext i8 @peek(ptr noundef nonnull %3)
  %44 = call i32 @precedence(i8 noundef signext %43)
  %45 = load i8, ptr %17, align 1, !tbaa !9
  %46 = call i32 @precedence(i8 noundef signext %45)
  %.not32 = icmp slt i32 %44, %46
  br i1 %.not32, label %.critedge2.loopexit, label %47

47:                                               ; preds = %.lr.ph46
  %48 = call signext i8 @pop(ptr noundef nonnull %3)
  %indvars.iv.next63 = add nsw i64 %indvars.iv62, 1
  %49 = getelementptr inbounds i8, ptr %1, i64 %indvars.iv62
  store i8 %48, ptr %49, align 1, !tbaa !9
  %50 = call i32 @isEmpty(ptr noundef nonnull %3)
  %.not31 = icmp eq i32 %50, 0
  br i1 %.not31, label %.lr.ph46, label %.critedge2.loopexit, !llvm.loop !14

.critedge2.loopexit:                              ; preds = %47, %.lr.ph46
  %.2.lcssa.ph.in = phi i64 [ %indvars.iv62, %.lr.ph46 ], [ %indvars.iv.next63, %47 ]
  %.2.lcssa.ph = trunc i64 %.2.lcssa.ph.in to i32
  br label %.critedge2

.critedge2:                                       ; preds = %.critedge2.loopexit, %.preheader36
  %.2.lcssa = phi i32 [ %.052, %.preheader36 ], [ %.2.lcssa.ph, %.critedge2.loopexit ]
  %51 = load i8, ptr %17, align 1, !tbaa !9
  call void @push(ptr noundef nonnull %3, i8 noundef signext %51)
  br label %57

52:                                               ; preds = %39
  %53 = load ptr, ptr @stderr, align 8, !tbaa !5
  %54 = load i8, ptr %17, align 1, !tbaa !9
  %55 = sext i8 %54 to i32
  %56 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %53, ptr noundef nonnull @.str.3, i32 noundef %55) #7
  call void @exit(i32 noundef 1) #8
  unreachable

57:                                               ; preds = %30, %.critedge, %37, %.critedge2, %23
  %.3 = phi i32 [ %24, %23 ], [ %.052, %30 ], [ %.1.lcssa, %.critedge ], [ %.1.lcssa, %37 ], [ %.2.lcssa, %.critedge2 ]
  %indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
  %58 = getelementptr inbounds [100 x i8], ptr %4, i64 0, i64 %indvars.iv.next67
  %59 = load i8, ptr %58, align 1, !tbaa !9
  %.not27 = icmp eq i8 %59, 0
  br i1 %.not27, label %.preheader, label %15, !llvm.loop !15

.lr.ph57:                                         ; preds = %.lr.ph57.preheader, %.lr.ph57
  %indvars.iv68 = phi i64 [ %14, %.lr.ph57.preheader ], [ %indvars.iv.next69, %.lr.ph57 ]
  %60 = call signext i8 @pop(ptr noundef nonnull %3)
  %indvars.iv.next69 = add nsw i64 %indvars.iv68, 1
  %61 = getelementptr inbounds i8, ptr %1, i64 %indvars.iv68
  store i8 %60, ptr %61, align 1, !tbaa !9
  %62 = call i32 @isEmpty(ptr noundef nonnull %3)
  %.not28 = icmp eq i32 %62, 0
  br i1 %.not28, label %.lr.ph57, label %._crit_edge.loopexit, !llvm.loop !16

._crit_edge.loopexit:                             ; preds = %.lr.ph57
  %63 = trunc nsw i64 %indvars.iv.next69 to i32
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %.4.lcssa = phi i32 [ %.0.lcssa, %.preheader ], [ %63, %._crit_edge.loopexit ]
  %64 = sext i32 %.4.lcssa to i64
  %65 = getelementptr inbounds i8, ptr %1, i64 %64
  store i8 0, ptr %65, align 1, !tbaa !9
  call void @reverse(ptr noundef %1)
  call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %3) #6
  ret void
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #4

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_b_loc() local_unnamed_addr #5

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

!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/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"short", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}


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