; LLVM IR from xxks-kkk/algo :: stack/postfix-c (postfix2)

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

@.str = external hidden unnamed_addr constant [2 x i8], align 1
@stderr = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @infixTopostfix(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #9
  store i32 20, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #9
  %8 = load i32, ptr %3, align 4, !tbaa !9
  %9 = call ptr @createStack(i32 noundef %8)
  store ptr %9, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #9
  %10 = load ptr, ptr %2, align 8, !tbaa !5
  %11 = call noalias ptr @fopen(ptr noundef %10, ptr noundef @.str)
  store ptr %11, ptr %5, align 8, !tbaa !5
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = icmp eq ptr %12, null
  br i1 %13, label %14, label %18

14:                                               ; preds = %1
  %15 = load ptr, ptr @stderr, align 8, !tbaa !5
  %16 = load ptr, ptr %2, align 8, !tbaa !5
  %17 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %15, ptr noundef @.str.1, ptr noundef %16) #9
  call void @exit(i32 noundef 1) #10
  unreachable

18:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #9
  %19 = call noalias ptr @malloc(i64 noundef 1) #11
  store ptr %19, ptr %7, align 8, !tbaa !5
  br label %20

20:                                               ; preds = %163, %18
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = call i32 @getc(ptr noundef %21)
  store i32 %22, ptr %6, align 4, !tbaa !9
  %23 = icmp ne i32 %22, -1
  br i1 %23, label %24, label %164

24:                                               ; preds = %20
  %25 = call ptr @__ctype_b_loc() #12
  %26 = load ptr, ptr %25, align 8, !tbaa !5
  %27 = load i32, ptr %6, align 4, !tbaa !9
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds i16, ptr %26, i64 %28
  %30 = load i16, ptr %29, align 2, !tbaa !11
  %31 = zext i16 %30 to i32
  %32 = and i32 %31, 1024
  %33 = icmp ne i32 %32, 0
  br i1 %33, label %44, label %34

34:                                               ; preds = %24
  %35 = call ptr @__ctype_b_loc() #12
  %36 = load ptr, ptr %35, align 8, !tbaa !5
  %37 = load i32, ptr %6, align 4, !tbaa !9
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds i16, ptr %36, i64 %38
  %40 = load i16, ptr %39, align 2, !tbaa !11
  %41 = zext i16 %40 to i32
  %42 = and i32 %41, 2048
  %43 = icmp ne i32 %42, 0
  br i1 %43, label %44, label %47

44:                                               ; preds = %34, %24
  %45 = load i32, ptr %6, align 4, !tbaa !9
  %46 = call i32 @putchar(i32 noundef %45)
  br label %163

47:                                               ; preds = %34
  %48 = load i32, ptr %6, align 4, !tbaa !9
  switch i32 %48, label %158 [
    i32 32, label %162
    i32 45, label %49
    i32 43, label %49
    i32 47, label %75
    i32 42, label %75
    i32 40, label %129
    i32 41, label %136
    i32 94, label %151
  ]

49:                                               ; preds = %47, %47
  br label %50

50:                                               ; preds = %61, %49
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = call i32 @isEmpty(ptr noundef %51)
  %53 = icmp ne i32 %52, 0
  br i1 %53, label %59, label %54

54:                                               ; preds = %50
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = call ptr @top(ptr noundef %55)
  %57 = call i32 @strcmp(ptr noundef %56, ptr noundef @.str.2) #13
  %58 = icmp ne i32 %57, 0
  br label %59

59:                                               ; preds = %54, %50
  %60 = phi i1 [ false, %50 ], [ %58, %54 ]
  br i1 %60, label %61, label %68

61:                                               ; preds = %59
  %62 = load ptr, ptr %4, align 8, !tbaa !5
  %63 = call ptr @topAndPop(ptr noundef %62)
  %64 = getelementptr inbounds i8, ptr %63, i64 0
  %65 = load i8, ptr %64, align 1, !tbaa !13
  %66 = sext i8 %65 to i32
  %67 = call i32 @putchar(i32 noundef %66)
  br label %50, !llvm.loop !14

68:                                               ; preds = %59
  %69 = load i32, ptr %6, align 4, !tbaa !9
  %70 = trunc i32 %69 to i8
  %71 = load ptr, ptr %7, align 8, !tbaa !5
  %72 = getelementptr inbounds i8, ptr %71, i64 0
  store i8 %70, ptr %72, align 1, !tbaa !13
  %73 = load ptr, ptr %7, align 8, !tbaa !5
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  call void @push(ptr noundef %73, ptr noundef %74)
  br label %162

75:                                               ; preds = %47, %47
  %76 = load ptr, ptr %4, align 8, !tbaa !5
  %77 = call i32 @isEmpty(ptr noundef %76)
  %78 = icmp ne i32 %77, 0
  br i1 %78, label %94, label %79

79:                                               ; preds = %75
  %80 = load ptr, ptr %4, align 8, !tbaa !5
  %81 = call ptr @top(ptr noundef %80)
  %82 = call i32 @strcmp(ptr noundef %81, ptr noundef @.str.3) #13
  %83 = icmp ne i32 %82, 0
  br i1 %83, label %84, label %94

84:                                               ; preds = %79
  %85 = load ptr, ptr %4, align 8, !tbaa !5
  %86 = call ptr @top(ptr noundef %85)
  %87 = call i32 @strcmp(ptr noundef %86, ptr noundef @.str.4) #13
  %88 = icmp ne i32 %87, 0
  br i1 %88, label %89, label %94

89:                                               ; preds = %84
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = call ptr @top(ptr noundef %90)
  %92 = call i32 @strcmp(ptr noundef %91, ptr noundef @.str.2) #13
  %93 = icmp ne i32 %92, 0
  br i1 %93, label %101, label %94

94:                                               ; preds = %89, %84, %79, %75
  %95 = load i32, ptr %6, align 4, !tbaa !9
  %96 = trunc i32 %95 to i8
  %97 = load ptr, ptr %7, align 8, !tbaa !5
  %98 = getelementptr inbounds i8, ptr %97, i64 0
  store i8 %96, ptr %98, align 1, !tbaa !13
  %99 = load ptr, ptr %7, align 8, !tbaa !5
  %100 = load ptr, ptr %4, align 8, !tbaa !5
  call void @push(ptr noundef %99, ptr noundef %100)
  br label %128

101:                                              ; preds = %89
  br label %102

102:                                              ; preds = %114, %101
  %103 = load ptr, ptr %4, align 8, !tbaa !5
  %104 = call ptr @top(ptr noundef %103)
  %105 = call i32 @strcmp(ptr noundef %104, ptr noundef @.str.2) #13
  %106 = icmp ne i32 %105, 0
  br i1 %106, label %107, label %112

107:                                              ; preds = %102
  %108 = load ptr, ptr %4, align 8, !tbaa !5
  %109 = call i32 @isEmpty(ptr noundef %108)
  %110 = icmp ne i32 %109, 0
  %111 = xor i1 %110, true
  br label %112

112:                                              ; preds = %107, %102
  %113 = phi i1 [ false, %102 ], [ %111, %107 ]
  br i1 %113, label %114, label %121

114:                                              ; preds = %112
  %115 = load ptr, ptr %4, align 8, !tbaa !5
  %116 = call ptr @topAndPop(ptr noundef %115)
  %117 = getelementptr inbounds i8, ptr %116, i64 0
  %118 = load i8, ptr %117, align 1, !tbaa !13
  %119 = sext i8 %118 to i32
  %120 = call i32 @putchar(i32 noundef %119)
  br label %102, !llvm.loop !16

121:                                              ; preds = %112
  %122 = load i32, ptr %6, align 4, !tbaa !9
  %123 = trunc i32 %122 to i8
  %124 = load ptr, ptr %7, align 8, !tbaa !5
  %125 = getelementptr inbounds i8, ptr %124, i64 0
  store i8 %123, ptr %125, align 1, !tbaa !13
  %126 = load ptr, ptr %7, align 8, !tbaa !5
  %127 = load ptr, ptr %4, align 8, !tbaa !5
  call void @push(ptr noundef %126, ptr noundef %127)
  br label %128

128:                                              ; preds = %121, %94
  br label %162

129:                                              ; preds = %47
  %130 = load i32, ptr %6, align 4, !tbaa !9
  %131 = trunc i32 %130 to i8
  %132 = load ptr, ptr %7, align 8, !tbaa !5
  %133 = getelementptr inbounds i8, ptr %132, i64 0
  store i8 %131, ptr %133, align 1, !tbaa !13
  %134 = load ptr, ptr %7, align 8, !tbaa !5
  %135 = load ptr, ptr %4, align 8, !tbaa !5
  call void @push(ptr noundef %134, ptr noundef %135)
  br label %162

136:                                              ; preds = %47
  br label %137

137:                                              ; preds = %142, %136
  %138 = load ptr, ptr %4, align 8, !tbaa !5
  %139 = call ptr @top(ptr noundef %138)
  %140 = call i32 @strcmp(ptr noundef %139, ptr noundef @.str.2) #13
  %141 = icmp ne i32 %140, 0
  br i1 %141, label %142, label %149

142:                                              ; preds = %137
  %143 = load ptr, ptr %4, align 8, !tbaa !5
  %144 = call ptr @topAndPop(ptr noundef %143)
  %145 = getelementptr inbounds i8, ptr %144, i64 0
  %146 = load i8, ptr %145, align 1, !tbaa !13
  %147 = sext i8 %146 to i32
  %148 = call i32 @putchar(i32 noundef %147)
  br label %137, !llvm.loop !17

149:                                              ; preds = %137
  %150 = load ptr, ptr %4, align 8, !tbaa !5
  call void @pop(ptr noundef %150)
  br label %162

151:                                              ; preds = %47
  %152 = load i32, ptr %6, align 4, !tbaa !9
  %153 = trunc i32 %152 to i8
  %154 = load ptr, ptr %7, align 8, !tbaa !5
  %155 = getelementptr inbounds i8, ptr %154, i64 0
  store i8 %153, ptr %155, align 1, !tbaa !13
  %156 = load ptr, ptr %7, align 8, !tbaa !5
  %157 = load ptr, ptr %4, align 8, !tbaa !5
  call void @push(ptr noundef %156, ptr noundef %157)
  br label %162

158:                                              ; preds = %47
  %159 = load ptr, ptr @stderr, align 8, !tbaa !5
  %160 = load i32, ptr %6, align 4, !tbaa !9
  %161 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %159, ptr noundef @.str.5, i32 noundef %160) #9
  call void @exit(i32 noundef 1) #10
  unreachable

162:                                              ; preds = %151, %149, %129, %128, %68, %47
  br label %163

163:                                              ; preds = %162, %44
  br label %20, !llvm.loop !18

164:                                              ; preds = %20
  br label %165

165:                                              ; preds = %170, %164
  %166 = load ptr, ptr %4, align 8, !tbaa !5
  %167 = call i32 @isEmpty(ptr noundef %166)
  %168 = icmp ne i32 %167, 0
  %169 = xor i1 %168, true
  br i1 %169, label %170, label %177

170:                                              ; preds = %165
  %171 = load ptr, ptr %4, align 8, !tbaa !5
  %172 = call ptr @topAndPop(ptr noundef %171)
  %173 = getelementptr inbounds i8, ptr %172, i64 0
  %174 = load i8, ptr %173, align 1, !tbaa !13
  %175 = sext i8 %174 to i32
  %176 = call i32 @putchar(i32 noundef %175)
  br label %165, !llvm.loop !19

177:                                              ; preds = %165
  %178 = load ptr, ptr %4, align 8, !tbaa !5
  call void @disposeStack(ptr noundef %178)
  %179 = load ptr, ptr %7, align 8, !tbaa !5
  call void @free(ptr noundef %179) #9
  %180 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #9
  ret void
}

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

declare ptr @createStack(i32 noundef) #2

declare noalias ptr @fopen(ptr noundef, ptr noundef) #2

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

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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #5

declare i32 @getc(ptr noundef) #2

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

; Function Attrs: inlinehint nounwind uwtable
declare i32 @putchar(i32 noundef) #7

declare i32 @isEmpty(ptr noundef) #2

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #8

declare ptr @top(ptr noundef) #2

declare ptr @topAndPop(ptr noundef) #2

declare void @push(ptr noundef, ptr noundef) #2

declare void @pop(ptr noundef) #2

declare void @disposeStack(ptr noundef) #2

; Function Attrs: nounwind
declare void @free(ptr noundef) #3

declare i32 @printf(ptr noundef, ...) #2

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

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

!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 = !{!12, !12, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = distinct !{!17, !15}
!18 = distinct !{!18, !15}
!19 = distinct !{!19, !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"

@.str = external hidden unnamed_addr constant [2 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @infixTopostfix(ptr noundef %0) local_unnamed_addr #0 {
  %2 = tail call ptr @createStack(i32 noundef 20) #9
  %3 = tail call noalias ptr @fopen(ptr noundef %0, ptr noundef nonnull @.str)
  %4 = icmp eq ptr %3, null
  br i1 %4, label %5, label %8

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

8:                                                ; preds = %1
  %9 = tail call noalias dereferenceable_or_null(1) ptr @malloc(i64 noundef 1) #12
  %10 = tail call i32 @getc(ptr noundef nonnull %3)
  %.not72 = icmp eq i32 %10, -1
  br i1 %.not72, label %.preheader, label %.lr.ph74

.lr.ph74:                                         ; preds = %8
  %11 = tail call ptr @__ctype_b_loc() #13
  br label %13

.preheader:                                       ; preds = %71, %8
  %12 = tail call i32 @isEmpty(ptr noundef %2) #9
  %.not4975 = icmp eq i32 %12, 0
  br i1 %.not4975, label %.lr.ph76, label %._crit_edge77

13:                                               ; preds = %.lr.ph74, %71
  %14 = phi i32 [ %10, %.lr.ph74 ], [ %72, %71 ]
  %15 = load ptr, ptr %11, align 8, !tbaa !5
  %16 = sext i32 %14 to i64
  %17 = getelementptr inbounds i16, ptr %15, i64 %16
  %18 = load i16, ptr %17, align 2, !tbaa !9
  %19 = and i16 %18, 3072
  %or.cond = icmp eq i16 %19, 0
  br i1 %or.cond, label %22, label %20

20:                                               ; preds = %13
  %21 = tail call i32 @putchar(i32 noundef %14)
  br label %71

22:                                               ; preds = %13
  switch i32 %14, label %68 [
    i32 32, label %71
    i32 45, label %25
    i32 43, label %25
    i32 47, label %36
    i32 42, label %36
    i32 40, label %60
    i32 41, label %.preheader62
    i32 94, label %67
  ]

.preheader62:                                     ; preds = %22
  %23 = tail call ptr @top(ptr noundef %2) #9
  %24 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %23, ptr noundef nonnull dereferenceable(1) @.str.2) #14
  %.not5264 = icmp eq i32 %24, 0
  br i1 %.not5264, label %._crit_edge, label %.lr.ph

25:                                               ; preds = %22, %22
  %26 = tail call i32 @isEmpty(ptr noundef %2) #9
  %.not5968 = icmp eq i32 %26, 0
  br i1 %.not5968, label %.lr.ph70, label %.critedge

.lr.ph70:                                         ; preds = %25, %29
  %27 = tail call ptr @top(ptr noundef %2) #9
  %28 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %27, ptr noundef nonnull dereferenceable(1) @.str.2) #14
  %.not60 = icmp eq i32 %28, 0
  br i1 %.not60, label %.critedge, label %29

29:                                               ; preds = %.lr.ph70
  %30 = tail call ptr @topAndPop(ptr noundef %2) #9
  %31 = load i8, ptr %30, align 1, !tbaa !11
  %32 = sext i8 %31 to i32
  %33 = tail call i32 @putchar(i32 noundef %32)
  %34 = tail call i32 @isEmpty(ptr noundef %2) #9
  %.not59 = icmp eq i32 %34, 0
  br i1 %.not59, label %.lr.ph70, label %.critedge, !llvm.loop !12

.critedge:                                        ; preds = %.lr.ph70, %29, %25
  %35 = trunc i32 %14 to i8
  store i8 %35, ptr %9, align 1, !tbaa !11
  tail call void @push(ptr noundef nonnull %9, ptr noundef %2) #9
  br label %71

36:                                               ; preds = %22, %22
  %37 = tail call i32 @isEmpty(ptr noundef %2) #9
  %.not53 = icmp eq i32 %37, 0
  br i1 %.not53, label %38, label %49

38:                                               ; preds = %36
  %39 = tail call ptr @top(ptr noundef %2) #9
  %40 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %39, ptr noundef nonnull dereferenceable(1) @.str.3) #14
  %.not54 = icmp eq i32 %40, 0
  br i1 %.not54, label %49, label %41

41:                                               ; preds = %38
  %42 = tail call ptr @top(ptr noundef %2) #9
  %43 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %42, ptr noundef nonnull dereferenceable(1) @.str.4) #14
  %.not55 = icmp eq i32 %43, 0
  br i1 %.not55, label %49, label %44

44:                                               ; preds = %41
  %45 = tail call ptr @top(ptr noundef %2) #9
  %46 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %45, ptr noundef nonnull dereferenceable(1) @.str.2) #14
  %.not56 = icmp eq i32 %46, 0
  br i1 %.not56, label %49, label %.preheader61

.preheader61:                                     ; preds = %44
  %47 = tail call ptr @top(ptr noundef %2) #9
  %48 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %47, ptr noundef nonnull dereferenceable(1) @.str.2) #14
  %.not5765 = icmp eq i32 %48, 0
  br i1 %.not5765, label %.critedge2, label %.lr.ph66

49:                                               ; preds = %44, %41, %38, %36
  %50 = trunc i32 %14 to i8
  store i8 %50, ptr %9, align 1, !tbaa !11
  tail call void @push(ptr noundef nonnull %9, ptr noundef %2) #9
  br label %71

.lr.ph66:                                         ; preds = %.preheader61, %52
  %51 = tail call i32 @isEmpty(ptr noundef %2) #9
  %.not58 = icmp eq i32 %51, 0
  br i1 %.not58, label %52, label %.critedge2

52:                                               ; preds = %.lr.ph66
  %53 = tail call ptr @topAndPop(ptr noundef %2) #9
  %54 = load i8, ptr %53, align 1, !tbaa !11
  %55 = sext i8 %54 to i32
  %56 = tail call i32 @putchar(i32 noundef %55)
  %57 = tail call ptr @top(ptr noundef %2) #9
  %58 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %57, ptr noundef nonnull dereferenceable(1) @.str.2) #14
  %.not57 = icmp eq i32 %58, 0
  br i1 %.not57, label %.critedge2, label %.lr.ph66, !llvm.loop !14

.critedge2:                                       ; preds = %.lr.ph66, %52, %.preheader61
  %59 = trunc i32 %14 to i8
  store i8 %59, ptr %9, align 1, !tbaa !11
  tail call void @push(ptr noundef nonnull %9, ptr noundef %2) #9
  br label %71

60:                                               ; preds = %22
  store i8 40, ptr %9, align 1, !tbaa !11
  tail call void @push(ptr noundef nonnull %9, ptr noundef %2) #9
  br label %71

.lr.ph:                                           ; preds = %.preheader62, %.lr.ph
  %61 = tail call ptr @topAndPop(ptr noundef %2) #9
  %62 = load i8, ptr %61, align 1, !tbaa !11
  %63 = sext i8 %62 to i32
  %64 = tail call i32 @putchar(i32 noundef %63)
  %65 = tail call ptr @top(ptr noundef %2) #9
  %66 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %65, ptr noundef nonnull dereferenceable(1) @.str.2) #14
  %.not52 = icmp eq i32 %66, 0
  br i1 %.not52, label %._crit_edge, label %.lr.ph, !llvm.loop !15

._crit_edge:                                      ; preds = %.lr.ph, %.preheader62
  tail call void @pop(ptr noundef %2) #9
  br label %71

67:                                               ; preds = %22
  store i8 94, ptr %9, align 1, !tbaa !11
  tail call void @push(ptr noundef nonnull %9, ptr noundef %2) #9
  br label %71

68:                                               ; preds = %22
  %69 = load ptr, ptr @stderr, align 8, !tbaa !5
  %70 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %69, ptr noundef nonnull @.str.5, i32 noundef %14) #10
  tail call void @exit(i32 noundef 1) #11
  unreachable

71:                                               ; preds = %22, %.critedge, %60, %._crit_edge, %67, %.critedge2, %49, %20
  %72 = tail call i32 @getc(ptr noundef nonnull %3)
  %.not = icmp eq i32 %72, -1
  br i1 %.not, label %.preheader, label %13, !llvm.loop !16

.lr.ph76:                                         ; preds = %.preheader, %.lr.ph76
  %73 = tail call ptr @topAndPop(ptr noundef %2) #9
  %74 = load i8, ptr %73, align 1, !tbaa !11
  %75 = sext i8 %74 to i32
  %76 = tail call i32 @putchar(i32 noundef %75)
  %77 = tail call i32 @isEmpty(ptr noundef %2) #9
  %.not49 = icmp eq i32 %77, 0
  br i1 %.not49, label %.lr.ph76, label %._crit_edge77, !llvm.loop !17

._crit_edge77:                                    ; preds = %.lr.ph76, %.preheader
  tail call void @disposeStack(ptr noundef %2) #9
  tail call void @free(ptr noundef %9) #9
  %78 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  ret void
}

declare ptr @createStack(i32 noundef) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #2

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

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

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4

; Function Attrs: nofree nounwind
declare noundef i32 @getc(ptr nocapture noundef) local_unnamed_addr #2

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

; Function Attrs: inlinehint nofree nounwind uwtable
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #6

declare i32 @isEmpty(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #7

declare ptr @top(ptr noundef) local_unnamed_addr #1

declare ptr @topAndPop(ptr noundef) local_unnamed_addr #1

declare void @push(ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @pop(ptr noundef) local_unnamed_addr #1

declare void @disposeStack(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #8

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

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 = { "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 = { 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 #3 = { 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 #4 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { inlinehint nofree 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 #7 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 #8 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #9 = { nounwind }
attributes #10 = { cold nounwind }
attributes #11 = { noreturn nounwind }
attributes #12 = { nounwind allocsize(0) }
attributes #13 = { nounwind willreturn memory(none) }
attributes #14 = { nounwind willreturn memory(read) }

!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 = !{!"short", !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}
!17 = distinct !{!17, !13}


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