; LLVM IR from matz/streem :: src (main)

; 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.parser_state = type { i32, ptr, ptr, i32, i32 }
%struct.strm_array = type { i32, ptr, i64, ptr }

@strm_option_verbose = external dso_local global i32, align 4
@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [24 x i8], align 1
@stdin = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [10 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %struct.parser_state, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i64, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %17 = load ptr, ptr %5, align 8, !tbaa !9
  %18 = getelementptr inbounds ptr, ptr %17, i64 0
  %19 = load ptr, ptr %18, align 8, !tbaa !9
  store ptr %19, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  store ptr null, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %12) #5
  br label %20

20:                                               ; preds = %78, %2
  %21 = load i32, ptr %4, align 4, !tbaa !5
  %22 = icmp sgt i32 %21, 1
  br i1 %22, label %23, label %31

23:                                               ; preds = %20
  %24 = load ptr, ptr %5, align 8, !tbaa !9
  %25 = getelementptr inbounds ptr, ptr %24, i64 1
  %26 = load ptr, ptr %25, align 8, !tbaa !9
  %27 = getelementptr inbounds i8, ptr %26, i64 0
  %28 = load i8, ptr %27, align 1, !tbaa !11
  %29 = sext i8 %28 to i32
  %30 = icmp eq i32 %29, 45
  br label %31

31:                                               ; preds = %23, %20
  %32 = phi i1 [ false, %20 ], [ %30, %23 ]
  br i1 %32, label %33, label %83

33:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %34 = load ptr, ptr %5, align 8, !tbaa !9
  %35 = getelementptr inbounds ptr, ptr %34, i64 1
  %36 = load ptr, ptr %35, align 8, !tbaa !9
  %37 = getelementptr inbounds i8, ptr %36, i64 1
  store ptr %37, ptr %13, align 8, !tbaa !9
  br label %38

38:                                               ; preds = %74, %33
  %39 = load ptr, ptr %13, align 8, !tbaa !9
  %40 = load i8, ptr %39, align 1, !tbaa !11
  %41 = icmp ne i8 %40, 0
  br i1 %41, label %42, label %77

42:                                               ; preds = %38
  %43 = load ptr, ptr %13, align 8, !tbaa !9
  %44 = load i8, ptr %43, align 1, !tbaa !11
  %45 = sext i8 %44 to i32
  switch i32 %45, label %67 [
    i32 118, label %46
    i32 119, label %47
    i32 99, label %48
    i32 101, label %49
  ]

46:                                               ; preds = %42
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %47

47:                                               ; preds = %46, %42
  store i32 1, ptr @strm_option_verbose, align 4, !tbaa !5
  br label %74

48:                                               ; preds = %42
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %74

49:                                               ; preds = %42
  %50 = load ptr, ptr %13, align 8, !tbaa !9
  %51 = getelementptr inbounds i8, ptr %50, i64 1
  %52 = load i8, ptr %51, align 1, !tbaa !11
  %53 = sext i8 %52 to i32
  %54 = icmp eq i32 %53, 0
  br i1 %54, label %55, label %63

55:                                               ; preds = %49
  %56 = load ptr, ptr %5, align 8, !tbaa !9
  %57 = getelementptr inbounds ptr, ptr %56, i64 2
  %58 = load ptr, ptr %57, align 8, !tbaa !9
  store ptr %58, ptr %7, align 8, !tbaa !9
  %59 = load i32, ptr %4, align 4, !tbaa !5
  %60 = add nsw i32 %59, -1
  store i32 %60, ptr %4, align 4, !tbaa !5
  %61 = load ptr, ptr %5, align 8, !tbaa !9
  %62 = getelementptr inbounds ptr, ptr %61, i32 1
  store ptr %62, ptr %5, align 8, !tbaa !9
  br label %66

63:                                               ; preds = %49
  %64 = load ptr, ptr %13, align 8, !tbaa !9
  %65 = getelementptr inbounds i8, ptr %64, i64 1
  store ptr %65, ptr %7, align 8, !tbaa !9
  br label %66

66:                                               ; preds = %63, %55
  br label %78

67:                                               ; preds = %42
  %68 = load ptr, ptr @stderr, align 8, !tbaa !9
  %69 = load ptr, ptr %6, align 8, !tbaa !9
  %70 = load ptr, ptr %13, align 8, !tbaa !9
  %71 = load i8, ptr %70, align 1, !tbaa !11
  %72 = sext i8 %71 to i32
  %73 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %68, ptr noundef @.str, ptr noundef %69, i32 noundef %72) #5
  br label %74

74:                                               ; preds = %67, %48, %47
  %75 = load ptr, ptr %13, align 8, !tbaa !9
  %76 = getelementptr inbounds i8, ptr %75, i32 1
  store ptr %76, ptr %13, align 8, !tbaa !9
  br label %38, !llvm.loop !12

77:                                               ; preds = %38
  br label %78

78:                                               ; preds = %77, %66
  %79 = load i32, ptr %4, align 4, !tbaa !5
  %80 = add nsw i32 %79, -1
  store i32 %80, ptr %4, align 4, !tbaa !5
  %81 = load ptr, ptr %5, align 8, !tbaa !9
  %82 = getelementptr inbounds ptr, ptr %81, i32 1
  store ptr %82, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %20, !llvm.loop !14

83:                                               ; preds = %31
  call void @node_parse_init(ptr noundef %12)
  %84 = load ptr, ptr %7, align 8, !tbaa !9
  %85 = icmp ne ptr %84, null
  br i1 %85, label %86, label %91

86:                                               ; preds = %83
  %87 = load ptr, ptr %7, align 8, !tbaa !9
  %88 = call i32 @node_parse_string(ptr noundef %12, ptr noundef %87)
  %89 = load i32, ptr %9, align 4, !tbaa !5
  %90 = add nsw i32 %89, %88
  store i32 %90, ptr %9, align 4, !tbaa !5
  br label %116

91:                                               ; preds = %83
  %92 = load i32, ptr %4, align 4, !tbaa !5
  %93 = icmp eq i32 %92, 1
  br i1 %93, label %94, label %97

94:                                               ; preds = %91
  %95 = load ptr, ptr @stdin, align 8, !tbaa !9
  %96 = call i32 @node_parse_input(ptr noundef %12, ptr noundef %95, ptr noundef @.str.1)
  store i32 %96, ptr %9, align 4, !tbaa !5
  br label %115

97:                                               ; preds = %91
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %98

98:                                               ; preds = %111, %97
  %99 = load i32, ptr %8, align 4, !tbaa !5
  %100 = load i32, ptr %4, align 4, !tbaa !5
  %101 = icmp slt i32 %99, %100
  br i1 %101, label %102, label %114

102:                                              ; preds = %98
  %103 = load ptr, ptr %5, align 8, !tbaa !9
  %104 = load i32, ptr %8, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds ptr, ptr %103, i64 %105
  %107 = load ptr, ptr %106, align 8, !tbaa !9
  %108 = call i32 @node_parse_file(ptr noundef %12, ptr noundef %107)
  %109 = load i32, ptr %9, align 4, !tbaa !5
  %110 = add nsw i32 %109, %108
  store i32 %110, ptr %9, align 4, !tbaa !5
  br label %111

111:                                              ; preds = %102
  %112 = load i32, ptr %8, align 4, !tbaa !5
  %113 = add nsw i32 %112, 1
  store i32 %113, ptr %8, align 4, !tbaa !5
  br label %98, !llvm.loop !15

114:                                              ; preds = %98
  br label %115

115:                                              ; preds = %114, %94
  br label %116

116:                                              ; preds = %115, %86
  %117 = load i32, ptr %9, align 4, !tbaa !5
  %118 = icmp eq i32 %117, 0
  br i1 %118, label %119, label %168

119:                                              ; preds = %116
  %120 = load i32, ptr %10, align 4, !tbaa !5
  %121 = icmp ne i32 %120, 0
  br i1 %121, label %122, label %125

122:                                              ; preds = %119
  %123 = getelementptr inbounds %struct.parser_state, ptr %12, i32 0, i32 1
  %124 = load ptr, ptr %123, align 8, !tbaa !16
  call void @dump_node(ptr noundef %124, i32 noundef 0)
  br label %125

125:                                              ; preds = %122, %119
  %126 = load i32, ptr %11, align 4, !tbaa !5
  %127 = icmp ne i32 %126, 0
  br i1 %127, label %128, label %130

128:                                              ; preds = %125
  %129 = call i32 @puts(ptr noundef @.str.2)
  br label %167

130:                                              ; preds = %125
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %131 = load i32, ptr %4, align 4, !tbaa !5
  %132 = call i64 @strm_ary_new(ptr noundef null, i32 noundef %131)
  store i64 %132, ptr %14, align 8, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %133 = load i64, ptr %14, align 8, !tbaa !18
  %134 = call ptr @strm_ary_struct(i64 noundef %133)
  %135 = getelementptr inbounds %struct.strm_array, ptr %134, i32 0, i32 1
  %136 = load ptr, ptr %135, align 8, !tbaa !20
  store ptr %136, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  store i32 0, ptr %16, align 4, !tbaa !5
  br label %137

137:                                              ; preds = %159, %130
  %138 = load i32, ptr %16, align 4, !tbaa !5
  %139 = load i32, ptr %4, align 4, !tbaa !5
  %140 = icmp slt i32 %138, %139
  br i1 %140, label %141, label %162

141:                                              ; preds = %137
  %142 = load ptr, ptr %5, align 8, !tbaa !9
  %143 = load i32, ptr %16, align 4, !tbaa !5
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds ptr, ptr %142, i64 %144
  %146 = load ptr, ptr %145, align 8, !tbaa !9
  %147 = load ptr, ptr %5, align 8, !tbaa !9
  %148 = load i32, ptr %16, align 4, !tbaa !5
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds ptr, ptr %147, i64 %149
  %151 = load ptr, ptr %150, align 8, !tbaa !9
  %152 = call i64 @strlen(ptr noundef %151) #6
  %153 = trunc i64 %152 to i32
  %154 = call i64 @strm_str_new(ptr noundef %146, i32 noundef %153)
  %155 = load ptr, ptr %15, align 8, !tbaa !9
  %156 = load i32, ptr %16, align 4, !tbaa !5
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds i64, ptr %155, i64 %157
  store i64 %154, ptr %158, align 8, !tbaa !18
  br label %159

159:                                              ; preds = %141
  %160 = load i32, ptr %16, align 4, !tbaa !5
  %161 = add nsw i32 %160, 1
  store i32 %161, ptr %16, align 4, !tbaa !5
  br label %137, !llvm.loop !22

162:                                              ; preds = %137
  %163 = load i64, ptr %14, align 8, !tbaa !18
  %164 = call i32 @strm_var_def(ptr noundef null, ptr noundef @.str.3, i64 noundef %163)
  %165 = call i32 @node_run(ptr noundef %12)
  %166 = call i32 (...) @strm_loop()
  call void (...) @node_stop()
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  br label %167

167:                                              ; preds = %162, %128
  br label %174

168:                                              ; preds = %116
  %169 = load i32, ptr %11, align 4, !tbaa !5
  %170 = icmp ne i32 %169, 0
  br i1 %170, label %171, label %173

171:                                              ; preds = %168
  %172 = call i32 @puts(ptr noundef @.str.4)
  br label %173

173:                                              ; preds = %171, %168
  br label %174

174:                                              ; preds = %173, %167
  call void @node_parse_free(ptr noundef %12)
  %175 = load i32, ptr %9, align 4, !tbaa !5
  %176 = icmp sgt i32 %175, 0
  %177 = zext i1 %176 to i64
  %178 = select i1 %176, i32 1, i32 0
  call void @llvm.lifetime.end.p0(i64 32, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  ret i32 %178
}

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

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

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

declare void @node_parse_init(ptr noundef) #3

declare i32 @node_parse_string(ptr noundef, ptr noundef) #3

declare i32 @node_parse_input(ptr noundef, ptr noundef, ptr noundef) #3

declare i32 @node_parse_file(ptr noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
declare hidden void @dump_node(ptr noundef, i32 noundef) #0

declare i32 @puts(ptr noundef) #3

declare i64 @strm_ary_new(ptr noundef, i32 noundef) #3

declare ptr @strm_ary_struct(i64 noundef) #3

declare i64 @strm_str_new(ptr noundef, i32 noundef) #3

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #4

declare i32 @strm_var_def(ptr noundef, ptr noundef, i64 noundef) #3

declare i32 @node_run(ptr noundef) #3

declare i32 @strm_loop(...) #3

declare void @node_stop(...) #3

declare void @node_parse_free(ptr noundef) #3

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 = { 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 = { "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 }
attributes #6 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !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 = !{!17, !10, i64 8}
!17 = !{!"parser_state", !6, i64 0, !10, i64 8, !10, i64 16, !6, i64 24, !6, i64 28}
!18 = !{!19, !19, i64 0}
!19 = !{!"long", !7, i64 0}
!20 = !{!21, !10, i64 8}
!21 = !{!"strm_array", !6, i64 0, !10, i64 8, !19, i64 16, !10, i64 24}
!22 = distinct !{!22, !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"

%struct.parser_state = type { i32, ptr, ptr, i32, i32 }

@strm_option_verbose = external dso_local local_unnamed_addr global i32, align 4
@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [24 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [10 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @main(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = alloca %struct.parser_state, align 8
  %4 = load ptr, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #5
  %5 = icmp sgt i32 %0, 1
  br i1 %5, label %.lr.ph, label %.critedge.thread

.critedge.thread:                                 ; preds = %2
  call void @node_parse_init(ptr noundef nonnull %3) #5
  br label %31

.lr.ph:                                           ; preds = %2, %.loopexit62
  %.04272 = phi i32 [ %24, %.loopexit62 ], [ %0, %2 ]
  %.04371 = phi ptr [ %25, %.loopexit62 ], [ %1, %2 ]
  %.04670 = phi i32 [ %.147.ph149, %.loopexit62 ], [ 0, %2 ]
  %.04869 = phi i32 [ %.149.ph, %.loopexit62 ], [ 0, %2 ]
  %.05468 = phi ptr [ %.155, %.loopexit62 ], [ null, %2 ]
  %6 = getelementptr inbounds i8, ptr %.04371, i64 8
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %8 = load i8, ptr %7, align 1, !tbaa !9
  %9 = icmp eq i8 %8, 45
  br i1 %9, label %.preheader61.outer, label %.critedge

.preheader61.outer:                               ; preds = %.lr.ph, %11
  %.149.ph = phi i32 [ %.250, %11 ], [ %.04869, %.lr.ph ]
  %.147.ph = phi i32 [ %.147.ph149, %11 ], [ %.04670, %.lr.ph ]
  %.pn.ph = phi ptr [ %.045, %11 ], [ %7, %.lr.ph ]
  br label %.preheader61.outer148

.preheader61.outer148:                            ; preds = %.preheader61, %.preheader61.outer
  %.147.ph149 = phi i32 [ %.147.ph, %.preheader61.outer ], [ 1, %.preheader61 ]
  %.pn.ph150 = phi ptr [ %.pn.ph, %.preheader61.outer ], [ %.045, %.preheader61 ]
  br label %.preheader61

.preheader61:                                     ; preds = %.preheader61.outer148, %20
  %.pn = phi ptr [ %.045, %20 ], [ %.pn.ph150, %.preheader61.outer148 ]
  %.045 = getelementptr inbounds i8, ptr %.pn, i64 1
  %10 = load i8, ptr %.045, align 1, !tbaa !9
  switch i8 %10, label %20 [
    i8 0, label %.loopexit62
    i8 118, label %11
    i8 119, label %.loopexit147
    i8 99, label %.preheader61.outer148
    i8 101, label %12
  ], !llvm.loop !10

.loopexit147:                                     ; preds = %.preheader61
  br label %11

11:                                               ; preds = %.preheader61, %.loopexit147
  %.250 = phi i32 [ %.149.ph, %.loopexit147 ], [ 1, %.preheader61 ]
  store i32 1, ptr @strm_option_verbose, align 4, !tbaa !12
  br label %.preheader61.outer, !llvm.loop !10

12:                                               ; preds = %.preheader61
  %13 = getelementptr inbounds i8, ptr %.pn, i64 2
  %14 = load i8, ptr %13, align 1, !tbaa !9
  %15 = icmp eq i8 %14, 0
  br i1 %15, label %16, label %.loopexit62

16:                                               ; preds = %12
  %17 = getelementptr inbounds i8, ptr %.04371, i64 16
  %18 = load ptr, ptr %17, align 8, !tbaa !5
  %19 = add nsw i32 %.04272, -1
  br label %.loopexit62

20:                                               ; preds = %.preheader61
  %21 = sext i8 %10 to i32
  %22 = load ptr, ptr @stderr, align 8, !tbaa !5
  %23 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %22, ptr noundef nonnull @.str, ptr noundef %4, i32 noundef %21) #6
  br label %.preheader61, !llvm.loop !10

.loopexit62:                                      ; preds = %.preheader61, %12, %16
  %.155 = phi ptr [ %18, %16 ], [ %13, %12 ], [ %.05468, %.preheader61 ]
  %.144 = phi ptr [ %6, %16 ], [ %.04371, %12 ], [ %.04371, %.preheader61 ]
  %.1 = phi i32 [ %19, %16 ], [ %.04272, %12 ], [ %.04272, %.preheader61 ]
  %24 = add nsw i32 %.1, -1
  %25 = getelementptr inbounds i8, ptr %.144, i64 8
  %26 = icmp sgt i32 %.1, 2
  br i1 %26, label %.lr.ph, label %.critedge, !llvm.loop !14

.critedge:                                        ; preds = %.lr.ph, %.loopexit62
  %.054.lcssa.ph = phi ptr [ %.05468, %.lr.ph ], [ %.155, %.loopexit62 ]
  %.048.lcssa.ph = phi i32 [ %.04869, %.lr.ph ], [ %.149.ph, %.loopexit62 ]
  %.046.lcssa.ph = phi i32 [ %.04670, %.lr.ph ], [ %.147.ph149, %.loopexit62 ]
  %.043.lcssa.ph = phi ptr [ %.04371, %.lr.ph ], [ %25, %.loopexit62 ]
  %.042.lcssa.ph = phi i32 [ %.04272, %.lr.ph ], [ %24, %.loopexit62 ]
  %27 = icmp eq i32 %.046.lcssa.ph, 0
  %28 = icmp eq i32 %.048.lcssa.ph, 0
  call void @node_parse_init(ptr noundef nonnull %3) #5
  %.not = icmp eq ptr %.054.lcssa.ph, null
  br i1 %.not, label %31, label %29

29:                                               ; preds = %.critedge
  %30 = call i32 @node_parse_string(ptr noundef nonnull %3, ptr noundef nonnull %.054.lcssa.ph) #5
  br label %.loopexit

31:                                               ; preds = %.critedge.thread, %.critedge
  %.042.lcssa112 = phi i32 [ %0, %.critedge.thread ], [ %.042.lcssa.ph, %.critedge ]
  %.043.lcssa110 = phi ptr [ %1, %.critedge.thread ], [ %.043.lcssa.ph, %.critedge ]
  %.046.lcssa109 = phi i1 [ true, %.critedge.thread ], [ %27, %.critedge ]
  %.048.lcssa107 = phi i1 [ true, %.critedge.thread ], [ %28, %.critedge ]
  %32 = icmp eq i32 %.042.lcssa112, 1
  br i1 %32, label %34, label %.preheader

.preheader:                                       ; preds = %31
  %33 = icmp sgt i32 %.042.lcssa112, 1
  br i1 %33, label %.lr.ph85.preheader, label %.loopexit.thread

.loopexit.thread:                                 ; preds = %.preheader
  br i1 %.048.lcssa107, label %46, label %43

.lr.ph85.preheader:                               ; preds = %.preheader
  %wide.trip.count = zext nneg i32 %.042.lcssa112 to i64
  br label %.lr.ph85

34:                                               ; preds = %31
  %35 = load ptr, ptr @stdin, align 8, !tbaa !5
  %36 = call i32 @node_parse_input(ptr noundef nonnull %3, ptr noundef %35, ptr noundef nonnull @.str.1) #5
  br label %.loopexit

.lr.ph85:                                         ; preds = %.lr.ph85.preheader, %.lr.ph85
  %indvars.iv = phi i64 [ 1, %.lr.ph85.preheader ], [ %indvars.iv.next, %.lr.ph85 ]
  %.05184 = phi i32 [ 0, %.lr.ph85.preheader ], [ %40, %.lr.ph85 ]
  %37 = getelementptr inbounds ptr, ptr %.043.lcssa110, i64 %indvars.iv
  %38 = load ptr, ptr %37, align 8, !tbaa !5
  %39 = call i32 @node_parse_file(ptr noundef nonnull %3, ptr noundef %38) #5
  %40 = add nsw i32 %39, %.05184
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.loopexit, label %.lr.ph85, !llvm.loop !15

.loopexit:                                        ; preds = %.lr.ph85, %34, %29
  %.042.lcssa113 = phi i32 [ %.042.lcssa.ph, %29 ], [ 1, %34 ], [ %.042.lcssa112, %.lr.ph85 ]
  %.043.lcssa111 = phi ptr [ %.043.lcssa.ph, %29 ], [ %.043.lcssa110, %34 ], [ %.043.lcssa110, %.lr.ph85 ]
  %.046.lcssa108 = phi i1 [ %27, %29 ], [ %.046.lcssa109, %34 ], [ %.046.lcssa109, %.lr.ph85 ]
  %.048.lcssa106 = phi i1 [ %28, %29 ], [ %.048.lcssa107, %34 ], [ %.048.lcssa107, %.lr.ph85 ]
  %.152 = phi i32 [ %30, %29 ], [ %36, %34 ], [ %40, %.lr.ph85 ]
  %41 = icmp eq i32 %.152, 0
  br i1 %41, label %42, label %64

42:                                               ; preds = %.loopexit
  br i1 %.048.lcssa106, label %46, label %43

43:                                               ; preds = %.loopexit.thread, %42
  %.042.lcssa113119131 = phi i32 [ %.042.lcssa112, %.loopexit.thread ], [ %.042.lcssa113, %42 ]
  %.043.lcssa111120129 = phi ptr [ %.043.lcssa110, %.loopexit.thread ], [ %.043.lcssa111, %42 ]
  %.046.lcssa108121127 = phi i1 [ %.046.lcssa109, %.loopexit.thread ], [ %.046.lcssa108, %42 ]
  %44 = getelementptr inbounds i8, ptr %3, i64 8
  %45 = load ptr, ptr %44, align 8, !tbaa !16
  call void @dump_node(ptr noundef %45, i32 noundef 0)
  br i1 %.046.lcssa108121127, label %49, label %47

46:                                               ; preds = %.loopexit.thread, %42
  %.042.lcssa113119132 = phi i32 [ %.042.lcssa112, %.loopexit.thread ], [ %.042.lcssa113, %42 ]
  %.043.lcssa111120130 = phi ptr [ %.043.lcssa110, %.loopexit.thread ], [ %.043.lcssa111, %42 ]
  %.046.lcssa108121128 = phi i1 [ %.046.lcssa109, %.loopexit.thread ], [ %.046.lcssa108, %42 ]
  br i1 %.046.lcssa108121128, label %49, label %47

47:                                               ; preds = %43, %46
  %48 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %67

49:                                               ; preds = %43, %46
  %.043.lcssa111120130134 = phi ptr [ %.043.lcssa111120129, %43 ], [ %.043.lcssa111120130, %46 ]
  %.042.lcssa113119132133 = phi i32 [ %.042.lcssa113119131, %43 ], [ %.042.lcssa113119132, %46 ]
  %50 = call i64 @strm_ary_new(ptr noundef null, i32 noundef %.042.lcssa113119132133) #5
  %51 = call ptr @strm_ary_struct(i64 noundef %50) #5
  %52 = getelementptr inbounds i8, ptr %51, i64 8
  %53 = load ptr, ptr %52, align 8, !tbaa !18
  %54 = icmp sgt i32 %.042.lcssa113119132133, 0
  br i1 %54, label %.lr.ph88.preheader, label %._crit_edge

.lr.ph88.preheader:                               ; preds = %49
  %wide.trip.count98 = zext nneg i32 %.042.lcssa113119132133 to i64
  br label %.lr.ph88

.lr.ph88:                                         ; preds = %.lr.ph88.preheader, %.lr.ph88
  %indvars.iv95 = phi i64 [ 0, %.lr.ph88.preheader ], [ %indvars.iv.next96, %.lr.ph88 ]
  %55 = getelementptr inbounds ptr, ptr %.043.lcssa111120130134, i64 %indvars.iv95
  %56 = load ptr, ptr %55, align 8, !tbaa !5
  %57 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %56) #7
  %58 = trunc i64 %57 to i32
  %59 = call i64 @strm_str_new(ptr noundef %56, i32 noundef %58) #5
  %60 = getelementptr inbounds i64, ptr %53, i64 %indvars.iv95
  store i64 %59, ptr %60, align 8, !tbaa !21
  %indvars.iv.next96 = add nuw nsw i64 %indvars.iv95, 1
  %exitcond99.not = icmp eq i64 %indvars.iv.next96, %wide.trip.count98
  br i1 %exitcond99.not, label %._crit_edge, label %.lr.ph88, !llvm.loop !22

._crit_edge:                                      ; preds = %.lr.ph88, %49
  %61 = call i32 @strm_var_def(ptr noundef null, ptr noundef nonnull @.str.3, i64 noundef %50) #5
  %62 = call i32 @node_run(ptr noundef nonnull %3) #5
  %63 = call i32 (...) @strm_loop() #5
  call void (...) @node_stop() #5
  br label %67

64:                                               ; preds = %.loopexit
  br i1 %.046.lcssa108, label %67, label %65

65:                                               ; preds = %64
  %66 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.4)
  br label %67

67:                                               ; preds = %64, %65, %47, %._crit_edge
  %.152123 = phi i32 [ %.152, %64 ], [ %.152, %65 ], [ 0, %47 ], [ 0, %._crit_edge ]
  call void @node_parse_free(ptr noundef nonnull %3) #5
  %68 = icmp sgt i32 %.152123, 0
  %69 = zext i1 %68 to i32
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #5
  ret i32 %69
}

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

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

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

declare void @node_parse_init(ptr noundef) local_unnamed_addr #3

declare i32 @node_parse_string(ptr noundef, ptr noundef) local_unnamed_addr #3

declare i32 @node_parse_input(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare i32 @node_parse_file(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare hidden void @dump_node(ptr noundef, i32 noundef) local_unnamed_addr #0

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

declare i64 @strm_ary_new(ptr noundef, i32 noundef) local_unnamed_addr #3

declare ptr @strm_ary_struct(i64 noundef) local_unnamed_addr #3

declare i64 @strm_str_new(ptr noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4

declare i32 @strm_var_def(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #3

declare i32 @node_run(ptr noundef) local_unnamed_addr #3

declare i32 @strm_loop(...) local_unnamed_addr #3

declare void @node_stop(...) local_unnamed_addr #3

declare void @node_parse_free(ptr noundef) local_unnamed_addr #3

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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 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 #5 = { nounwind }
attributes #6 = { cold nounwind }
attributes #7 = { 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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = distinct !{!14, !11}
!15 = distinct !{!15, !11}
!16 = !{!17, !6, i64 8}
!17 = !{!"parser_state", !13, i64 0, !6, i64 8, !6, i64 16, !13, i64 24, !13, i64 28}
!18 = !{!19, !6, i64 8}
!19 = !{!"strm_array", !13, i64 0, !6, i64 8, !20, i64 16, !6, i64 24}
!20 = !{!"long", !7, i64 0}
!21 = !{!20, !20, i64 0}
!22 = distinct !{!22, !11}


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