; LLVM IR from buzz-lang/Buzz :: src/buzz (buzzparser)

; 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.buzzparser_s = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32 }

@stderr = external global ptr, align 8
@.str.82 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.83 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.84 = external hidden unnamed_addr constant [2 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

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @string_add(ptr noundef, ptr noundef) #3

; Function Attrs: nounwind
declare noalias ptr @strdup(ptr noundef) #2

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

; Function Attrs: nounwind uwtable
declare dso_local void @symt_destroy(i32 noundef, ptr noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local void @chunk_destroy(i32 noundef, ptr noundef, ptr noundef) #3

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

declare ptr @buzzdict_new(i32 noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) #5

declare i32 @buzzdict_strkeyhash(ptr noundef) #5

declare i32 @buzzdict_strkeycmp(ptr noundef, ptr noundef) #5

declare ptr @buzzdarray_new(i32 noundef, i32 noundef, ptr noundef) #5

; Function Attrs: nounwind uwtable
define dso_local ptr @buzzparser_new(i32 noundef %0, ptr noundef %1) #3 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca [1024 x i8], align 16
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  %11 = load i32, ptr %4, align 4, !tbaa !5
  %12 = icmp slt i32 %11, 3
  br i1 %12, label %16, label %13

13:                                               ; preds = %2
  %14 = load i32, ptr %4, align 4, !tbaa !5
  %15 = icmp sgt i32 %14, 4
  br i1 %15, label %16, label %20

16:                                               ; preds = %13, %2
  %17 = load ptr, ptr @stderr, align 8, !tbaa !9
  %18 = load i32, ptr %4, align 4, !tbaa !5
  %19 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %17, ptr noundef @.str.82, i32 noundef %18) #6
  store ptr null, ptr %3, align 8
  br label %138

20:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %21 = call noalias ptr @malloc(i64 noundef 88) #7
  store ptr %21, ptr %6, align 8, !tbaa !9
  %22 = load ptr, ptr %5, align 8, !tbaa !9
  %23 = getelementptr inbounds ptr, ptr %22, i64 1
  %24 = load ptr, ptr %23, align 8, !tbaa !9
  %25 = call ptr @buzzlex_new(ptr noundef %24)
  %26 = load ptr, ptr %6, align 8, !tbaa !9
  %27 = getelementptr inbounds %struct.buzzparser_s, ptr %26, i32 0, i32 3
  store ptr %25, ptr %27, align 8, !tbaa !11
  %28 = load ptr, ptr %6, align 8, !tbaa !9
  %29 = getelementptr inbounds %struct.buzzparser_s, ptr %28, i32 0, i32 3
  %30 = load ptr, ptr %29, align 8, !tbaa !11
  %31 = icmp ne ptr %30, null
  br i1 %31, label %34, label %32

32:                                               ; preds = %20
  %33 = load ptr, ptr %6, align 8, !tbaa !9
  call void @free(ptr noundef %33) #6
  store ptr null, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %137

34:                                               ; preds = %20
  %35 = load ptr, ptr %5, align 8, !tbaa !9
  %36 = getelementptr inbounds ptr, ptr %35, i64 1
  %37 = load ptr, ptr %36, align 8, !tbaa !9
  %38 = call noalias ptr @strdup(ptr noundef %37) #6
  %39 = load ptr, ptr %6, align 8, !tbaa !9
  %40 = getelementptr inbounds %struct.buzzparser_s, ptr %39, i32 0, i32 0
  store ptr %38, ptr %40, align 8, !tbaa !13
  %41 = load ptr, ptr %5, align 8, !tbaa !9
  %42 = getelementptr inbounds ptr, ptr %41, i64 2
  %43 = load ptr, ptr %42, align 8, !tbaa !9
  %44 = call noalias ptr @strdup(ptr noundef %43) #6
  %45 = load ptr, ptr %6, align 8, !tbaa !9
  %46 = getelementptr inbounds %struct.buzzparser_s, ptr %45, i32 0, i32 1
  store ptr %44, ptr %46, align 8, !tbaa !14
  %47 = load ptr, ptr %6, align 8, !tbaa !9
  %48 = getelementptr inbounds %struct.buzzparser_s, ptr %47, i32 0, i32 1
  %49 = load ptr, ptr %48, align 8, !tbaa !14
  %50 = call noalias ptr @fopen(ptr noundef %49, ptr noundef @.str.83)
  %51 = load ptr, ptr %6, align 8, !tbaa !9
  %52 = getelementptr inbounds %struct.buzzparser_s, ptr %51, i32 0, i32 2
  store ptr %50, ptr %52, align 8, !tbaa !15
  %53 = load ptr, ptr %6, align 8, !tbaa !9
  %54 = getelementptr inbounds %struct.buzzparser_s, ptr %53, i32 0, i32 2
  %55 = load ptr, ptr %54, align 8, !tbaa !15
  %56 = icmp ne ptr %55, null
  br i1 %56, label %65, label %57

57:                                               ; preds = %34
  %58 = load ptr, ptr %6, align 8, !tbaa !9
  %59 = getelementptr inbounds %struct.buzzparser_s, ptr %58, i32 0, i32 1
  %60 = load ptr, ptr %59, align 8, !tbaa !14
  call void @perror(ptr noundef %60)
  %61 = load ptr, ptr %6, align 8, !tbaa !9
  %62 = getelementptr inbounds %struct.buzzparser_s, ptr %61, i32 0, i32 1
  %63 = load ptr, ptr %62, align 8, !tbaa !14
  call void @free(ptr noundef %63) #6
  %64 = load ptr, ptr %6, align 8, !tbaa !9
  call void @free(ptr noundef %64) #6
  store ptr null, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %137

65:                                               ; preds = %34
  %66 = load ptr, ptr %6, align 8, !tbaa !9
  %67 = getelementptr inbounds %struct.buzzparser_s, ptr %66, i32 0, i32 10
  store i32 0, ptr %67, align 8, !tbaa !16
  %68 = call ptr @buzzdarray_new(i32 noundef 1, i32 noundef 8, ptr noundef @chunk_destroy)
  %69 = load ptr, ptr %6, align 8, !tbaa !9
  %70 = getelementptr inbounds %struct.buzzparser_s, ptr %69, i32 0, i32 5
  store ptr %68, ptr %70, align 8, !tbaa !17
  %71 = call ptr @buzzdarray_new(i32 noundef 10, i32 noundef 8, ptr noundef @symt_destroy)
  %72 = load ptr, ptr %6, align 8, !tbaa !9
  %73 = getelementptr inbounds %struct.buzzparser_s, ptr %72, i32 0, i32 7
  store ptr %71, ptr %73, align 8, !tbaa !18
  %74 = load ptr, ptr %6, align 8, !tbaa !9
  %75 = getelementptr inbounds %struct.buzzparser_s, ptr %74, i32 0, i32 8
  store ptr null, ptr %75, align 8, !tbaa !19
  %76 = call ptr @buzzdict_new(i32 noundef 100, i32 noundef 8, i32 noundef 2, ptr noundef @buzzdict_strkeyhash, ptr noundef @buzzdict_strkeycmp, ptr noundef null)
  %77 = load ptr, ptr %6, align 8, !tbaa !9
  %78 = getelementptr inbounds %struct.buzzparser_s, ptr %77, i32 0, i32 9
  store ptr %76, ptr %78, align 8, !tbaa !20
  %79 = load i32, ptr %4, align 4, !tbaa !5
  %80 = icmp eq i32 %79, 4
  br i1 %80, label %81, label %135

81:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %82 = load ptr, ptr %5, align 8, !tbaa !9
  %83 = getelementptr inbounds ptr, ptr %82, i64 3
  %84 = load ptr, ptr %83, align 8, !tbaa !9
  %85 = call noalias ptr @fopen(ptr noundef %84, ptr noundef @.str.84)
  store ptr %85, ptr %8, align 8, !tbaa !9
  %86 = load ptr, ptr %8, align 8, !tbaa !9
  %87 = icmp ne ptr %86, null
  br i1 %87, label %92, label %88

88:                                               ; preds = %81
  %89 = load ptr, ptr %5, align 8, !tbaa !9
  %90 = getelementptr inbounds ptr, ptr %89, i64 3
  %91 = load ptr, ptr %90, align 8, !tbaa !9
  call void @perror(ptr noundef %91)
  store ptr null, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %132

92:                                               ; preds = %81
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 1024, ptr %10) #6
  br label %93

93:                                               ; preds = %114, %92
  %94 = getelementptr inbounds [1024 x i8], ptr %10, i64 0, i64 0
  %95 = load ptr, ptr %8, align 8, !tbaa !9
  %96 = call ptr @fgets(ptr noundef %94, i32 noundef 1024, ptr noundef %95)
  %97 = icmp ne ptr %96, null
  br i1 %97, label %98, label %120

98:                                               ; preds = %93
  %99 = getelementptr inbounds [1024 x i8], ptr %10, i64 0, i64 0
  %100 = call i64 @strlen(ptr noundef %99) #8
  store i64 %100, ptr %9, align 8, !tbaa !21
  %101 = load i64, ptr %9, align 8, !tbaa !21
  %102 = icmp ugt i64 %101, 0
  br i1 %102, label %103, label %114

103:                                              ; preds = %98
  %104 = load i64, ptr %9, align 8, !tbaa !21
  %105 = sub i64 %104, 1
  %106 = getelementptr inbounds [1024 x i8], ptr %10, i64 0, i64 %105
  %107 = load i8, ptr %106, align 1, !tbaa !23
  %108 = sext i8 %107 to i32
  %109 = icmp eq i32 %108, 10
  br i1 %109, label %110, label %114

110:                                              ; preds = %103
  %111 = load i64, ptr %9, align 8, !tbaa !21
  %112 = sub i64 %111, 1
  %113 = getelementptr inbounds [1024 x i8], ptr %10, i64 0, i64 %112
  store i8 0, ptr %113, align 1, !tbaa !23
  br label %114

114:                                              ; preds = %110, %103, %98
  %115 = load ptr, ptr %6, align 8, !tbaa !9
  %116 = getelementptr inbounds %struct.buzzparser_s, ptr %115, i32 0, i32 9
  %117 = load ptr, ptr %116, align 8, !tbaa !20
  %118 = getelementptr inbounds [1024 x i8], ptr %10, i64 0, i64 0
  %119 = call i32 @string_add(ptr noundef %117, ptr noundef %118)
  br label %93, !llvm.loop !24

120:                                              ; preds = %93
  %121 = load ptr, ptr %8, align 8, !tbaa !9
  %122 = call i32 @ferror(ptr noundef %121) #6
  %123 = icmp ne i32 %122, 0
  br i1 %123, label %124, label %128

124:                                              ; preds = %120
  %125 = load ptr, ptr %5, align 8, !tbaa !9
  %126 = getelementptr inbounds ptr, ptr %125, i64 3
  %127 = load ptr, ptr %126, align 8, !tbaa !9
  call void @perror(ptr noundef %127)
  store ptr null, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %131

128:                                              ; preds = %120
  %129 = load ptr, ptr %8, align 8, !tbaa !9
  %130 = call i32 @fclose(ptr noundef %129)
  store i32 0, ptr %7, align 4
  br label %131

131:                                              ; preds = %128, %124
  call void @llvm.lifetime.end.p0(i64 1024, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %132

132:                                              ; preds = %131, %88
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  %133 = load i32, ptr %7, align 4
  switch i32 %133, label %137 [
    i32 0, label %134
  ]

134:                                              ; preds = %132
  br label %135

135:                                              ; preds = %134, %65
  %136 = load ptr, ptr %6, align 8, !tbaa !9
  store ptr %136, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %137

137:                                              ; preds = %135, %132, %57, %32
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  br label %138

138:                                              ; preds = %137, %16
  %139 = load ptr, ptr %3, align 8
  ret ptr %139
}

declare ptr @buzzlex_new(ptr noundef) #5

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

declare void @perror(ptr noundef) #5

declare ptr @fgets(ptr noundef, i32 noundef, ptr noundef) #5

; Function Attrs: nounwind
declare i32 @ferror(ptr noundef) #2

declare i32 @fclose(ptr noundef) #5

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }
attributes #8 = { 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 = !{!12, !10, i64 24}
!12 = !{!"buzzparser_s", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !6, i64 80}
!13 = !{!12, !10, i64 0}
!14 = !{!12, !10, i64 8}
!15 = !{!12, !10, i64 16}
!16 = !{!12, !6, i64 80}
!17 = !{!12, !10, i64 40}
!18 = !{!12, !10, i64 56}
!19 = !{!12, !10, i64 64}
!20 = !{!12, !10, i64 72}
!21 = !{!22, !22, i64 0}
!22 = !{!"long", !7, i64 0}
!23 = !{!7, !7, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}


; 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.82 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.83 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.84 = external hidden unnamed_addr constant [2 x i8], align 1

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

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @string_add(ptr noundef, ptr noundef) local_unnamed_addr #3

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @symt_destroy(i32 noundef, ptr noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local void @chunk_destroy(i32 noundef, ptr noundef, ptr noundef) #3

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

declare ptr @buzzdict_new(i32 noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #7

declare i32 @buzzdict_strkeyhash(ptr noundef) #7

declare i32 @buzzdict_strkeycmp(ptr noundef, ptr noundef) #7

declare ptr @buzzdarray_new(i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #7

; Function Attrs: nounwind uwtable
define dso_local noalias noundef ptr @buzzparser_new(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #3 {
  %3 = alloca [1024 x i8], align 16
  %4 = add i32 %0, -5
  %or.cond = icmp ult i32 %4, -2
  br i1 %or.cond, label %5, label %8

5:                                                ; preds = %2
  %6 = load ptr, ptr @stderr, align 8, !tbaa !5
  %7 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %6, ptr noundef nonnull @.str.82, i32 noundef %0) #9
  br label %56

8:                                                ; preds = %2
  %9 = tail call noalias dereferenceable_or_null(88) ptr @malloc(i64 noundef 88) #10
  %10 = getelementptr inbounds i8, ptr %1, i64 8
  %11 = load ptr, ptr %10, align 8, !tbaa !5
  %12 = tail call ptr @buzzlex_new(ptr noundef %11) #11
  %13 = getelementptr inbounds i8, ptr %9, i64 24
  store ptr %12, ptr %13, align 8, !tbaa !9
  %.not = icmp eq ptr %12, null
  br i1 %.not, label %14, label %15

14:                                               ; preds = %8
  tail call void @free(ptr noundef nonnull %9) #11
  br label %56

15:                                               ; preds = %8
  %16 = load ptr, ptr %10, align 8, !tbaa !5
  %17 = tail call noalias ptr @strdup(ptr noundef %16) #11
  store ptr %17, ptr %9, align 8, !tbaa !12
  %18 = getelementptr inbounds i8, ptr %1, i64 16
  %19 = load ptr, ptr %18, align 8, !tbaa !5
  %20 = tail call noalias ptr @strdup(ptr noundef %19) #11
  %21 = getelementptr inbounds i8, ptr %9, i64 8
  store ptr %20, ptr %21, align 8, !tbaa !13
  %22 = tail call noalias ptr @fopen(ptr noundef %20, ptr noundef nonnull @.str.83)
  %23 = getelementptr inbounds i8, ptr %9, i64 16
  store ptr %22, ptr %23, align 8, !tbaa !14
  %.not41 = icmp eq ptr %22, null
  br i1 %.not41, label %24, label %25

24:                                               ; preds = %15
  tail call void @perror(ptr noundef %20) #12
  tail call void @free(ptr noundef %20) #11
  tail call void @free(ptr noundef nonnull %9) #11
  br label %56

25:                                               ; preds = %15
  %26 = getelementptr inbounds i8, ptr %9, i64 80
  store i32 0, ptr %26, align 8, !tbaa !15
  %27 = tail call ptr @buzzdarray_new(i32 noundef 1, i32 noundef 8, ptr noundef nonnull @chunk_destroy) #11
  %28 = getelementptr inbounds i8, ptr %9, i64 40
  store ptr %27, ptr %28, align 8, !tbaa !16
  %29 = tail call ptr @buzzdarray_new(i32 noundef 10, i32 noundef 8, ptr noundef nonnull @symt_destroy) #11
  %30 = getelementptr inbounds i8, ptr %9, i64 56
  store ptr %29, ptr %30, align 8, !tbaa !17
  %31 = getelementptr inbounds i8, ptr %9, i64 64
  store ptr null, ptr %31, align 8, !tbaa !18
  %32 = tail call ptr @buzzdict_new(i32 noundef 100, i32 noundef 8, i32 noundef 2, ptr noundef nonnull @buzzdict_strkeyhash, ptr noundef nonnull @buzzdict_strkeycmp, ptr noundef null) #11
  %33 = getelementptr inbounds i8, ptr %9, i64 72
  store ptr %32, ptr %33, align 8, !tbaa !19
  %34 = icmp eq i32 %0, 4
  br i1 %34, label %35, label %56

35:                                               ; preds = %25
  %36 = getelementptr inbounds i8, ptr %1, i64 24
  %37 = load ptr, ptr %36, align 8, !tbaa !5
  %38 = tail call noalias ptr @fopen(ptr noundef %37, ptr noundef nonnull @.str.84)
  %.not42 = icmp eq ptr %38, null
  br i1 %.not42, label %.critedge, label %40

.critedge:                                        ; preds = %35
  %39 = load ptr, ptr %36, align 8, !tbaa !5
  tail call void @perror(ptr noundef %39) #12
  br label %56

40:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %3) #11
  %41 = call ptr @fgets(ptr noundef nonnull %3, i32 noundef 1024, ptr noundef nonnull %38)
  %.not4346 = icmp eq ptr %41, null
  br i1 %.not4346, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %40, %49
  %42 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %3) #13
  %.not45 = icmp eq i64 %42, 0
  br i1 %.not45, label %49, label %43

43:                                               ; preds = %.lr.ph
  %44 = add i64 %42, -1
  %45 = getelementptr inbounds [1024 x i8], ptr %3, i64 0, i64 %44
  %46 = load i8, ptr %45, align 1, !tbaa !20
  %47 = icmp eq i8 %46, 10
  br i1 %47, label %48, label %49

48:                                               ; preds = %43
  store i8 0, ptr %45, align 1, !tbaa !20
  br label %49

49:                                               ; preds = %48, %43, %.lr.ph
  %50 = call i32 @string_add(ptr noundef %32, ptr noundef nonnull %3)
  %51 = call ptr @fgets(ptr noundef nonnull %3, i32 noundef 1024, ptr noundef nonnull %38)
  %.not43 = icmp eq ptr %51, null
  br i1 %.not43, label %._crit_edge, label %.lr.ph, !llvm.loop !21

._crit_edge:                                      ; preds = %49, %40
  %52 = call i32 @ferror(ptr noundef nonnull %38) #11
  %.not44 = icmp eq i32 %52, 0
  br i1 %.not44, label %.thread, label %54

.thread:                                          ; preds = %._crit_edge
  %53 = call i32 @fclose(ptr noundef nonnull %38)
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %3) #11
  br label %56

54:                                               ; preds = %._crit_edge
  %55 = load ptr, ptr %36, align 8, !tbaa !5
  call void @perror(ptr noundef %55) #12
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %3) #11
  br label %56

56:                                               ; preds = %25, %.thread, %54, %14, %24, %.critedge, %5
  %.3 = phi ptr [ null, %5 ], [ null, %54 ], [ null, %24 ], [ null, %14 ], [ null, %.critedge ], [ %9, %.thread ], [ %9, %25 ]
  ret ptr %.3
}

declare ptr @buzzlex_new(ptr noundef) local_unnamed_addr #7

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

; Function Attrs: nofree nounwind
declare void @perror(ptr nocapture noundef readonly) local_unnamed_addr #5

; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #5

; Function Attrs: nofree nounwind memory(read)
declare noundef i32 @ferror(ptr nocapture noundef) local_unnamed_addr #8

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #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 = { mustprogress nofree nounwind willreturn 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 #5 = { 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 #6 = { 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 #7 = { "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 = { nofree nounwind 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 = { cold nounwind }
attributes #10 = { nounwind allocsize(0) }
attributes #11 = { nounwind }
attributes #12 = { cold }
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, !6, i64 24}
!10 = !{!"buzzparser_s", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !11, i64 80}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !6, i64 0}
!13 = !{!10, !6, i64 8}
!14 = !{!10, !6, i64 16}
!15 = !{!10, !11, i64 80}
!16 = !{!10, !6, i64 40}
!17 = !{!10, !6, i64 56}
!18 = !{!10, !6, i64 64}
!19 = !{!10, !6, i64 72}
!20 = !{!7, !7, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}


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