; LLVM IR from xxks-kkk/algo :: stack/balance-symbol (balanceSymbolMain)

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

@stderr = external global ptr, align 8
@.str.8 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [37 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 @printf(ptr noundef, ...) #1

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @balance_symbols_c(ptr noundef %0) #5 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  store i32 2, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #8
  %10 = load ptr, ptr %2, align 8, !tbaa !5
  %11 = call noalias ptr @fopen(ptr noundef %10, ptr noundef @.str.8)
  store ptr %11, ptr %4, align 8, !tbaa !5
  %12 = load ptr, ptr %4, 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.9, ptr noundef %16) #8
  call void @exit(i32 noundef 1) #9
  unreachable

18:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  store i32 1, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #8
  store i32 1, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  %19 = call ptr @createStack()
  store ptr %19, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  %20 = load i32, ptr %3, align 4, !tbaa !9
  %21 = sext i32 %20 to i64
  %22 = mul i64 %21, 1
  %23 = call noalias ptr @malloc(i64 noundef %22) #10
  store ptr %23, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  br label %24

24:                                               ; preds = %162, %18
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = call i32 @getc(ptr noundef %25)
  store i32 %26, ptr %9, align 4, !tbaa !9
  %27 = icmp ne i32 %26, -1
  br i1 %27, label %28, label %163

28:                                               ; preds = %24
  %29 = load i32, ptr %9, align 4, !tbaa !9
  switch i32 %29, label %162 [
    i32 10, label %30
    i32 47, label %33
    i32 42, label %67
    i32 40, label %90
    i32 91, label %93
    i32 123, label %96
    i32 41, label %99
    i32 93, label %120
    i32 125, label %141
  ]

30:                                               ; preds = %28
  %31 = load i32, ptr %5, align 4, !tbaa !9
  %32 = add nsw i32 %31, 1
  store i32 %32, ptr %5, align 4, !tbaa !9
  br label %162

33:                                               ; preds = %28
  %34 = load ptr, ptr %8, align 8, !tbaa !5
  %35 = getelementptr inbounds i8, ptr %34, i64 0
  %36 = load i8, ptr %35, align 1, !tbaa !11
  %37 = sext i8 %36 to i32
  %38 = icmp eq i32 %37, 42
  br i1 %38, label %39, label %61

39:                                               ; preds = %33
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  %41 = getelementptr inbounds i8, ptr %40, i64 1
  store i8 47, ptr %41, align 1, !tbaa !11
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  %43 = call i32 @isEmpty(ptr noundef %42)
  %44 = icmp ne i32 %43, 0
  br i1 %44, label %45, label %49

45:                                               ; preds = %39
  %46 = load ptr, ptr @stderr, align 8, !tbaa !5
  %47 = load i32, ptr %5, align 4, !tbaa !9
  %48 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %46, ptr noundef @.str.10, i32 noundef %47) #8
  call void @exit(i32 noundef 1) #9
  unreachable

49:                                               ; preds = %39
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = call ptr @topSymbol(ptr noundef %50)
  %52 = call i32 @strcmp(ptr noundef %51, ptr noundef @.str.11) #11
  %53 = icmp ne i32 %52, 0
  br i1 %53, label %54, label %59

54:                                               ; preds = %49
  %55 = load ptr, ptr @stderr, align 8, !tbaa !5
  %56 = load ptr, ptr %7, align 8, !tbaa !5
  %57 = call i32 @topLineNo(ptr noundef %56)
  %58 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %55, ptr noundef @.str.12, i32 noundef %57) #8
  call void @exit(i32 noundef 1) #9
  unreachable

59:                                               ; preds = %49
  %60 = load ptr, ptr %7, align 8, !tbaa !5
  call void @pop(ptr noundef %60)
  br label %66

61:                                               ; preds = %33
  %62 = load i32, ptr %9, align 4, !tbaa !9
  %63 = trunc i32 %62 to i8
  %64 = load ptr, ptr %8, align 8, !tbaa !5
  %65 = getelementptr inbounds i8, ptr %64, i64 0
  store i8 %63, ptr %65, align 1, !tbaa !11
  br label %66

66:                                               ; preds = %61, %59
  br label %162

67:                                               ; preds = %28
  %68 = load ptr, ptr %8, align 8, !tbaa !5
  %69 = getelementptr inbounds i8, ptr %68, i64 0
  %70 = load i8, ptr %69, align 1, !tbaa !11
  %71 = sext i8 %70 to i32
  %72 = icmp eq i32 %71, 47
  br i1 %72, label %73, label %84

73:                                               ; preds = %67
  %74 = load i32, ptr %9, align 4, !tbaa !9
  %75 = trunc i32 %74 to i8
  %76 = load ptr, ptr %8, align 8, !tbaa !5
  %77 = getelementptr inbounds i8, ptr %76, i64 1
  store i8 %75, ptr %77, align 1, !tbaa !11
  %78 = load ptr, ptr %8, align 8, !tbaa !5
  %79 = load i32, ptr %5, align 4, !tbaa !9
  %80 = load ptr, ptr %7, align 8, !tbaa !5
  call void @push(ptr noundef %78, i32 noundef %79, ptr noundef %80)
  %81 = load ptr, ptr %8, align 8, !tbaa !5
  %82 = load i32, ptr %3, align 4, !tbaa !9
  %83 = sext i32 %82 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %81, i8 0, i64 %83, i1 false)
  br label %89

84:                                               ; preds = %67
  %85 = load i32, ptr %9, align 4, !tbaa !9
  %86 = trunc i32 %85 to i8
  %87 = load ptr, ptr %8, align 8, !tbaa !5
  %88 = getelementptr inbounds i8, ptr %87, i64 0
  store i8 %86, ptr %88, align 1, !tbaa !11
  br label %89

89:                                               ; preds = %84, %73
  br label %162

90:                                               ; preds = %28
  %91 = load i32, ptr %5, align 4, !tbaa !9
  %92 = load ptr, ptr %7, align 8, !tbaa !5
  call void @push(ptr noundef @.str.13, i32 noundef %91, ptr noundef %92)
  br label %162

93:                                               ; preds = %28
  %94 = load i32, ptr %5, align 4, !tbaa !9
  %95 = load ptr, ptr %7, align 8, !tbaa !5
  call void @push(ptr noundef @.str.14, i32 noundef %94, ptr noundef %95)
  br label %162

96:                                               ; preds = %28
  %97 = load i32, ptr %5, align 4, !tbaa !9
  %98 = load ptr, ptr %7, align 8, !tbaa !5
  call void @push(ptr noundef @.str.15, i32 noundef %97, ptr noundef %98)
  br label %162

99:                                               ; preds = %28
  %100 = load ptr, ptr %7, align 8, !tbaa !5
  %101 = call i32 @isEmpty(ptr noundef %100)
  %102 = icmp ne i32 %101, 0
  br i1 %102, label %103, label %108

103:                                              ; preds = %99
  %104 = load ptr, ptr @stderr, align 8, !tbaa !5
  %105 = load i32, ptr %9, align 4, !tbaa !9
  %106 = load i32, ptr %5, align 4, !tbaa !9
  %107 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %104, ptr noundef @.str.16, i32 noundef %105, i32 noundef %106) #8
  call void @exit(i32 noundef 1) #9
  unreachable

108:                                              ; preds = %99
  %109 = load ptr, ptr %7, align 8, !tbaa !5
  %110 = call ptr @topSymbol(ptr noundef %109)
  %111 = call i32 @strcmp(ptr noundef %110, ptr noundef @.str.13) #11
  %112 = icmp ne i32 %111, 0
  br i1 %112, label %113, label %118

113:                                              ; preds = %108
  %114 = load ptr, ptr @stderr, align 8, !tbaa !5
  %115 = load ptr, ptr %7, align 8, !tbaa !5
  %116 = call i32 @topLineNo(ptr noundef %115)
  %117 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %114, ptr noundef @.str.17, i32 noundef %116) #8
  call void @exit(i32 noundef 1) #9
  unreachable

118:                                              ; preds = %108
  %119 = load ptr, ptr %7, align 8, !tbaa !5
  call void @pop(ptr noundef %119)
  br label %162

120:                                              ; preds = %28
  %121 = load ptr, ptr %7, align 8, !tbaa !5
  %122 = call i32 @isEmpty(ptr noundef %121)
  %123 = icmp ne i32 %122, 0
  br i1 %123, label %124, label %129

124:                                              ; preds = %120
  %125 = load ptr, ptr @stderr, align 8, !tbaa !5
  %126 = load i32, ptr %9, align 4, !tbaa !9
  %127 = load i32, ptr %5, align 4, !tbaa !9
  %128 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %125, ptr noundef @.str.18, i32 noundef %126, i32 noundef %127) #8
  call void @exit(i32 noundef 1) #9
  unreachable

129:                                              ; preds = %120
  %130 = load ptr, ptr %7, align 8, !tbaa !5
  %131 = call ptr @topSymbol(ptr noundef %130)
  %132 = call i32 @strcmp(ptr noundef %131, ptr noundef @.str.14) #11
  %133 = icmp ne i32 %132, 0
  br i1 %133, label %134, label %139

134:                                              ; preds = %129
  %135 = load ptr, ptr @stderr, align 8, !tbaa !5
  %136 = load ptr, ptr %7, align 8, !tbaa !5
  %137 = call i32 @topLineNo(ptr noundef %136)
  %138 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %135, ptr noundef @.str.19, i32 noundef %137) #8
  call void @exit(i32 noundef 1) #9
  unreachable

139:                                              ; preds = %129
  %140 = load ptr, ptr %7, align 8, !tbaa !5
  call void @pop(ptr noundef %140)
  br label %162

141:                                              ; preds = %28
  %142 = load ptr, ptr %7, align 8, !tbaa !5
  %143 = call i32 @isEmpty(ptr noundef %142)
  %144 = icmp ne i32 %143, 0
  br i1 %144, label %145, label %150

145:                                              ; preds = %141
  %146 = load ptr, ptr @stderr, align 8, !tbaa !5
  %147 = load i32, ptr %9, align 4, !tbaa !9
  %148 = load i32, ptr %5, align 4, !tbaa !9
  %149 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %146, ptr noundef @.str.18, i32 noundef %147, i32 noundef %148) #8
  call void @exit(i32 noundef 1) #9
  unreachable

150:                                              ; preds = %141
  %151 = load ptr, ptr %7, align 8, !tbaa !5
  %152 = call ptr @topSymbol(ptr noundef %151)
  %153 = call i32 @strcmp(ptr noundef %152, ptr noundef @.str.15) #11
  %154 = icmp ne i32 %153, 0
  br i1 %154, label %155, label %160

155:                                              ; preds = %150
  %156 = load ptr, ptr @stderr, align 8, !tbaa !5
  %157 = load ptr, ptr %7, align 8, !tbaa !5
  %158 = call i32 @topLineNo(ptr noundef %157)
  %159 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %156, ptr noundef @.str.20, i32 noundef %158) #8
  call void @exit(i32 noundef 1) #9
  unreachable

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

162:                                              ; preds = %160, %139, %118, %96, %93, %90, %89, %66, %30, %28
  br label %24, !llvm.loop !12

163:                                              ; preds = %24
  br label %164

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

169:                                              ; preds = %164
  %170 = load ptr, ptr %7, align 8, !tbaa !5
  %171 = call ptr @topSymbol(ptr noundef %170)
  %172 = load ptr, ptr %7, align 8, !tbaa !5
  %173 = call i32 @topLineNo(ptr noundef %172)
  %174 = call i32 (ptr, ...) @printf(ptr noundef @.str.21, ptr noundef %171, i32 noundef %173)
  %175 = load ptr, ptr %7, align 8, !tbaa !5
  call void @pop(ptr noundef %175)
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %164, !llvm.loop !14

176:                                              ; preds = %164
  %177 = load i32, ptr %6, align 4, !tbaa !9
  %178 = icmp ne i32 %177, 0
  br i1 %178, label %179, label %181

179:                                              ; preds = %176
  %180 = call i32 (ptr, ...) @printf(ptr noundef @.str.22)
  br label %181

181:                                              ; preds = %179, %176
  %182 = load ptr, ptr %7, align 8, !tbaa !5
  call void @disposeStack(ptr noundef %182)
  %183 = load ptr, ptr %8, align 8, !tbaa !5
  call void @free(ptr noundef %183) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  ret void
}

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

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

declare ptr @createStack() #1

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

declare i32 @getc(ptr noundef) #1

declare i32 @isEmpty(ptr noundef) #1

declare ptr @topSymbol(ptr noundef) #1

declare i32 @topLineNo(ptr noundef) #1

declare void @pop(ptr noundef) #1

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #7

declare void @disposeStack(ptr noundef) #1

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { 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 #5 = { 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 #6 = { 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 #7 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { nounwind }
attributes #9 = { noreturn nounwind }
attributes #10 = { nounwind allocsize(0) }
attributes #11 = { 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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !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"

@stderr = external local_unnamed_addr global ptr, align 8
@.str.8 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [37 x i8], align 1

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

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

; Function Attrs: noreturn nounwind
declare void @exit(i32 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 #2

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

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

7:                                                ; preds = %1
  %8 = tail call ptr @createStack() #9
  %9 = tail call noalias dereferenceable_or_null(2) ptr @malloc(i64 noundef 2) #10
  %10 = getelementptr inbounds i8, ptr %9, i64 1
  br label %11

11:                                               ; preds = %.backedge, %7
  %.0 = phi i32 [ 1, %7 ], [ %.0.be, %.backedge ]
  %12 = tail call i32 @getc(ptr noundef nonnull %2)
  switch i32 %12, label %.backedge [
    i32 -1, label %.preheader
    i32 10, label %14
    i32 47, label %16
    i32 42, label %33
    i32 40, label %38
    i32 91, label %39
    i32 123, label %40
    i32 41, label %41
    i32 93, label %54
    i32 125, label %67
  ]

.backedge:                                        ; preds = %11, %36, %37, %31, %32, %79, %66, %53, %40, %39, %38, %14
  %.0.be = phi i32 [ %.0, %79 ], [ %.0, %66 ], [ %.0, %53 ], [ %.0, %40 ], [ %.0, %39 ], [ %.0, %38 ], [ %.0, %36 ], [ %.0, %37 ], [ %.0, %31 ], [ %.0, %32 ], [ %15, %14 ], [ %.0, %11 ]
  br label %11, !llvm.loop !9

.preheader:                                       ; preds = %11
  %13 = tail call i32 @isEmpty(ptr noundef %8) #9
  %.not5985 = icmp eq i32 %13, 0
  br i1 %.not5985, label %.lr.ph, label %.critedge

14:                                               ; preds = %11
  %15 = add nsw i32 %.0, 1
  br label %.backedge

16:                                               ; preds = %11
  %17 = load i8, ptr %9, align 1, !tbaa !11
  %18 = icmp eq i8 %17, 42
  br i1 %18, label %19, label %32

19:                                               ; preds = %16
  store i8 47, ptr %10, align 1, !tbaa !11
  %20 = tail call i32 @isEmpty(ptr noundef %8) #9
  %.not67 = icmp eq i32 %20, 0
  br i1 %.not67, label %24, label %21

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

24:                                               ; preds = %19
  %25 = tail call ptr @topSymbol(ptr noundef %8) #9
  %26 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %25, ptr noundef nonnull dereferenceable(1) @.str.11) #11
  %.not68 = icmp eq i32 %26, 0
  br i1 %.not68, label %31, label %27

27:                                               ; preds = %24
  %28 = load ptr, ptr @stderr, align 8, !tbaa !5
  %29 = tail call i32 @topLineNo(ptr noundef %8) #9
  %30 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %28, ptr noundef nonnull @.str.12, i32 noundef %29) #7
  tail call void @exit(i32 noundef 1) #8
  unreachable

31:                                               ; preds = %24
  tail call void @pop(ptr noundef %8) #9
  br label %.backedge

32:                                               ; preds = %16
  store i8 47, ptr %9, align 1, !tbaa !11
  br label %.backedge

33:                                               ; preds = %11
  %34 = load i8, ptr %9, align 1, !tbaa !11
  %35 = icmp eq i8 %34, 47
  br i1 %35, label %36, label %37

36:                                               ; preds = %33
  store i8 42, ptr %10, align 1, !tbaa !11
  tail call void @push(ptr noundef nonnull %9, i32 noundef %.0, ptr noundef %8) #9
  store i16 0, ptr %9, align 1
  br label %.backedge

37:                                               ; preds = %33
  store i8 42, ptr %9, align 1, !tbaa !11
  br label %.backedge

38:                                               ; preds = %11
  tail call void @push(ptr noundef nonnull @.str.13, i32 noundef %.0, ptr noundef %8) #9
  br label %.backedge

39:                                               ; preds = %11
  tail call void @push(ptr noundef nonnull @.str.14, i32 noundef %.0, ptr noundef %8) #9
  br label %.backedge

40:                                               ; preds = %11
  tail call void @push(ptr noundef nonnull @.str.15, i32 noundef %.0, ptr noundef %8) #9
  br label %.backedge

41:                                               ; preds = %11
  %42 = tail call i32 @isEmpty(ptr noundef %8) #9
  %.not65 = icmp eq i32 %42, 0
  br i1 %.not65, label %46, label %43

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

46:                                               ; preds = %41
  %47 = tail call ptr @topSymbol(ptr noundef %8) #9
  %48 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %47, ptr noundef nonnull dereferenceable(1) @.str.13) #11
  %.not66 = icmp eq i32 %48, 0
  br i1 %.not66, label %53, label %49

49:                                               ; preds = %46
  %50 = load ptr, ptr @stderr, align 8, !tbaa !5
  %51 = tail call i32 @topLineNo(ptr noundef %8) #9
  %52 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %50, ptr noundef nonnull @.str.17, i32 noundef %51) #7
  tail call void @exit(i32 noundef 1) #8
  unreachable

53:                                               ; preds = %46
  tail call void @pop(ptr noundef %8) #9
  br label %.backedge

54:                                               ; preds = %11
  %55 = tail call i32 @isEmpty(ptr noundef %8) #9
  %.not63 = icmp eq i32 %55, 0
  br i1 %.not63, label %59, label %56

56:                                               ; preds = %54
  %57 = load ptr, ptr @stderr, align 8, !tbaa !5
  %58 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %57, ptr noundef nonnull @.str.18, i32 noundef 93, i32 noundef %.0) #7
  tail call void @exit(i32 noundef 1) #8
  unreachable

59:                                               ; preds = %54
  %60 = tail call ptr @topSymbol(ptr noundef %8) #9
  %61 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %60, ptr noundef nonnull dereferenceable(1) @.str.14) #11
  %.not64 = icmp eq i32 %61, 0
  br i1 %.not64, label %66, label %62

62:                                               ; preds = %59
  %63 = load ptr, ptr @stderr, align 8, !tbaa !5
  %64 = tail call i32 @topLineNo(ptr noundef %8) #9
  %65 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %63, ptr noundef nonnull @.str.19, i32 noundef %64) #7
  tail call void @exit(i32 noundef 1) #8
  unreachable

66:                                               ; preds = %59
  tail call void @pop(ptr noundef %8) #9
  br label %.backedge

67:                                               ; preds = %11
  %68 = tail call i32 @isEmpty(ptr noundef %8) #9
  %.not61 = icmp eq i32 %68, 0
  br i1 %.not61, label %72, label %69

69:                                               ; preds = %67
  %70 = load ptr, ptr @stderr, align 8, !tbaa !5
  %71 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %70, ptr noundef nonnull @.str.18, i32 noundef 125, i32 noundef %.0) #7
  tail call void @exit(i32 noundef 1) #8
  unreachable

72:                                               ; preds = %67
  %73 = tail call ptr @topSymbol(ptr noundef %8) #9
  %74 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %73, ptr noundef nonnull dereferenceable(1) @.str.15) #11
  %.not62 = icmp eq i32 %74, 0
  br i1 %.not62, label %79, label %75

75:                                               ; preds = %72
  %76 = load ptr, ptr @stderr, align 8, !tbaa !5
  %77 = tail call i32 @topLineNo(ptr noundef %8) #9
  %78 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %76, ptr noundef nonnull @.str.20, i32 noundef %77) #7
  tail call void @exit(i32 noundef 1) #8
  unreachable

79:                                               ; preds = %72
  tail call void @pop(ptr noundef %8) #9
  br label %.backedge

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %80 = tail call ptr @topSymbol(ptr noundef %8) #9
  %81 = tail call i32 @topLineNo(ptr noundef %8) #9
  %82 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.21, ptr noundef %80, i32 noundef %81)
  tail call void @pop(ptr noundef %8) #9
  %83 = tail call i32 @isEmpty(ptr noundef %8) #9
  %.not59 = icmp eq i32 %83, 0
  br i1 %.not59, label %.lr.ph, label %._crit_edge, !llvm.loop !12

.critedge:                                        ; preds = %.preheader
  %84 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.22)
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.critedge
  tail call void @disposeStack(ptr noundef %8) #9
  tail call void @free(ptr noundef %9) #9
  ret void
}

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

declare ptr @createStack() local_unnamed_addr #4

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

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

declare i32 @isEmpty(ptr noundef) local_unnamed_addr #4

declare ptr @topSymbol(ptr noundef) local_unnamed_addr #4

declare i32 @topLineNo(ptr noundef) local_unnamed_addr #4

declare void @pop(ptr noundef) local_unnamed_addr #4

declare void @push(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

declare void @disposeStack(ptr noundef) local_unnamed_addr #4

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

attributes #0 = { 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 #1 = { 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 #2 = { 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 #3 = { 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 = { "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 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 #6 = { 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 #7 = { cold nounwind }
attributes #8 = { noreturn nounwind }
attributes #9 = { nounwind }
attributes #10 = { nounwind allocsize(0) }
attributes #11 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}


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