; LLVM IR from artagnon/phoenixfs :: t (test-btree)

; 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.dir_record = type { [4096 x i8], ptr }

@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [2 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 ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i8, align 1
  %11 = alloca i8, align 1
  %12 = alloca ptr, align 8
  %13 = alloca [4096 x i8], align 16
  %14 = 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) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #9
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #9
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #9
  store i8 1, ptr %11, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #9
  call void @llvm.lifetime.start.p0(i64 4096, ptr %13) #9
  store ptr null, ptr %8, align 8, !tbaa !9
  %15 = load i32, ptr %4, align 4, !tbaa !5
  %16 = icmp sgt i32 %15, 2
  br i1 %16, label %17, label %52

17:                                               ; preds = %2
  %18 = load ptr, ptr %5, align 8, !tbaa !9
  %19 = getelementptr inbounds ptr, ptr %18, i64 2
  %20 = load ptr, ptr %19, align 8, !tbaa !9
  store ptr %20, ptr %6, align 8, !tbaa !9
  %21 = load ptr, ptr %6, align 8, !tbaa !9
  %22 = call noalias ptr @fopen(ptr noundef %21, ptr noundef @.str)
  store ptr %22, ptr %7, align 8, !tbaa !9
  %23 = load ptr, ptr %7, align 8, !tbaa !9
  %24 = icmp eq ptr %23, null
  br i1 %24, label %25, label %26

25:                                               ; preds = %17
  call void @perror(ptr noundef @.str.1)
  call void @exit(i32 noundef -1) #10
  unreachable

26:                                               ; preds = %17
  br label %27

27:                                               ; preds = %32, %26
  %28 = load ptr, ptr %7, align 8, !tbaa !9
  %29 = call i32 @feof(ptr noundef %28) #9
  %30 = icmp ne i32 %29, 0
  %31 = xor i1 %30, true
  br i1 %31, label %32, label %48

32:                                               ; preds = %27
  %33 = load ptr, ptr %7, align 8, !tbaa !9
  %34 = getelementptr inbounds [4096 x i8], ptr %13, i64 0, i64 0
  %35 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %33, ptr noundef @.str.2, ptr noundef %9, ptr noundef %34)
  %36 = call noalias ptr @malloc(i64 noundef 4104) #11
  store ptr %36, ptr %12, align 8, !tbaa !9
  %37 = load ptr, ptr %12, align 8, !tbaa !9
  %38 = getelementptr inbounds %struct.dir_record, ptr %37, i32 0, i32 0
  %39 = getelementptr inbounds [4096 x i8], ptr %38, i64 0, i64 0
  %40 = getelementptr inbounds [4096 x i8], ptr %13, i64 0, i64 0
  %41 = getelementptr inbounds [4096 x i8], ptr %13, i64 0, i64 0
  %42 = call i64 @strlen(ptr noundef %41) #12
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %39, ptr align 16 %40, i64 %42, i1 false)
  %43 = load ptr, ptr %8, align 8, !tbaa !9
  %44 = load i32, ptr %9, align 4, !tbaa !5
  %45 = trunc i32 %44 to i16
  %46 = load ptr, ptr %12, align 8, !tbaa !9
  %47 = call ptr @insert(ptr noundef %43, i16 noundef zeroext %45, ptr noundef %46)
  store ptr %47, ptr %8, align 8, !tbaa !9
  br label %27, !llvm.loop !13

48:                                               ; preds = %27
  %49 = load ptr, ptr %7, align 8, !tbaa !9
  %50 = call i32 @fclose(ptr noundef %49)
  %51 = load ptr, ptr %8, align 8, !tbaa !9
  call void @print_tree(ptr noundef %51)
  br label %52

52:                                               ; preds = %48, %2
  %53 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  br label %54

54:                                               ; preds = %129, %52
  %55 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef %10)
  %56 = icmp ne i32 %55, -1
  br i1 %56, label %57, label %131

57:                                               ; preds = %54
  %58 = load i8, ptr %10, align 1, !tbaa !15
  %59 = sext i8 %58 to i32
  switch i32 %59, label %123 [
    i32 100, label %60
    i32 105, label %67
    i32 102, label %83
    i32 112, label %83
    i32 108, label %106
    i32 113, label %108
    i32 116, label %114
    i32 118, label %116
    i32 120, label %121
  ]

60:                                               ; preds = %57
  %61 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.5, ptr noundef %9)
  %62 = load ptr, ptr %8, align 8, !tbaa !9
  %63 = load i32, ptr %9, align 4, !tbaa !5
  %64 = trunc i32 %63 to i16
  %65 = call ptr @delete(ptr noundef %62, i16 noundef zeroext %64)
  store ptr %65, ptr %8, align 8, !tbaa !9
  %66 = load ptr, ptr %8, align 8, !tbaa !9
  call void @print_tree(ptr noundef %66)
  br label %124

67:                                               ; preds = %57
  %68 = getelementptr inbounds [4096 x i8], ptr %13, i64 0, i64 0
  %69 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.6, ptr noundef %9, ptr noundef %68)
  %70 = call noalias ptr @malloc(i64 noundef 4104) #11
  store ptr %70, ptr %12, align 8, !tbaa !9
  %71 = load ptr, ptr %12, align 8, !tbaa !9
  %72 = getelementptr inbounds %struct.dir_record, ptr %71, i32 0, i32 0
  %73 = getelementptr inbounds [4096 x i8], ptr %72, i64 0, i64 0
  %74 = getelementptr inbounds [4096 x i8], ptr %13, i64 0, i64 0
  %75 = getelementptr inbounds [4096 x i8], ptr %13, i64 0, i64 0
  %76 = call i64 @strlen(ptr noundef %75) #12
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %73, ptr align 16 %74, i64 %76, i1 false)
  %77 = load ptr, ptr %8, align 8, !tbaa !9
  %78 = load i32, ptr %9, align 4, !tbaa !5
  %79 = trunc i32 %78 to i16
  %80 = load ptr, ptr %12, align 8, !tbaa !9
  %81 = call ptr @insert(ptr noundef %77, i16 noundef zeroext %79, ptr noundef %80)
  store ptr %81, ptr %8, align 8, !tbaa !9
  %82 = load ptr, ptr %8, align 8, !tbaa !9
  call void @print_tree(ptr noundef %82)
  br label %124

83:                                               ; preds = %57, %57
  %84 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.5, ptr noundef %9)
  %85 = load ptr, ptr %8, align 8, !tbaa !9
  %86 = load i32, ptr %9, align 4, !tbaa !5
  %87 = trunc i32 %86 to i16
  %88 = load i8, ptr %10, align 1, !tbaa !15
  %89 = sext i8 %88 to i32
  %90 = icmp eq i32 %89, 112
  %91 = call ptr @find(ptr noundef %85, i16 noundef zeroext %87, i1 noundef zeroext %90)
  store ptr %91, ptr %12, align 8, !tbaa !9
  %92 = load ptr, ptr %12, align 8, !tbaa !9
  %93 = icmp eq ptr %92, null
  br i1 %93, label %94, label %97

94:                                               ; preds = %83
  %95 = load i32, ptr %9, align 4, !tbaa !5
  %96 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, i32 noundef %95)
  br label %105

97:                                               ; preds = %83
  %98 = load ptr, ptr %12, align 8, !tbaa !9
  %99 = ptrtoint ptr %98 to i64
  %100 = load i32, ptr %9, align 4, !tbaa !5
  %101 = load ptr, ptr %12, align 8, !tbaa !9
  %102 = getelementptr inbounds %struct.dir_record, ptr %101, i32 0, i32 0
  %103 = getelementptr inbounds [4096 x i8], ptr %102, i64 0, i64 0
  %104 = call i32 (ptr, ...) @printf(ptr noundef @.str.8, i64 noundef %99, i32 noundef %100, ptr noundef %103)
  br label %105

105:                                              ; preds = %97, %94
  br label %124

106:                                              ; preds = %57
  %107 = load ptr, ptr %8, align 8, !tbaa !9
  call void @print_leaves(ptr noundef %107)
  br label %124

108:                                              ; preds = %57
  br label %109

109:                                              ; preds = %112, %108
  %110 = call i32 @getchar()
  %111 = icmp ne i32 %110, 10
  br i1 %111, label %112, label %113

112:                                              ; preds = %109
  br label %109, !llvm.loop !16

113:                                              ; preds = %109
  store i32 0, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %133

114:                                              ; preds = %57
  %115 = load ptr, ptr %8, align 8, !tbaa !9
  call void @print_tree(ptr noundef %115)
  br label %124

116:                                              ; preds = %57
  %117 = load i8, ptr %11, align 1, !tbaa !11, !range !17, !noundef !18
  %118 = trunc i8 %117 to i1
  %119 = xor i1 %118, true
  %120 = zext i1 %119 to i8
  store i8 %120, ptr %11, align 1, !tbaa !11
  br label %124

121:                                              ; preds = %57
  %122 = load ptr, ptr %8, align 8, !tbaa !9
  call void @destroy_tree(ptr noundef %122)
  call void @print_tree(ptr noundef null)
  br label %124

123:                                              ; preds = %57
  call void @usage_2()
  br label %124

124:                                              ; preds = %123, %121, %116, %114, %106, %105, %67, %60
  br label %125

125:                                              ; preds = %128, %124
  %126 = call i32 @getchar()
  %127 = icmp ne i32 %126, 10
  br i1 %127, label %128, label %129

128:                                              ; preds = %125
  br label %125, !llvm.loop !19

129:                                              ; preds = %125
  %130 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  br label %54, !llvm.loop !20

131:                                              ; preds = %54
  %132 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %14, align 4
  br label %133

133:                                              ; preds = %131, %113
  call void @llvm.lifetime.end.p0(i64 4096, ptr %13) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #9
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #9
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #9
  %134 = load i32, ptr %3, align 4
  ret i32 %134
}

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

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

declare void @perror(ptr noundef) #2

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

; Function Attrs: nounwind
declare i32 @feof(ptr noundef) #4

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #7

declare ptr @insert(ptr noundef, i16 noundef zeroext, ptr noundef) #2

declare i32 @fclose(ptr noundef) #2

declare void @print_tree(ptr noundef) #2

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

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

declare ptr @delete(ptr noundef, i16 noundef zeroext) #2

declare ptr @find(ptr noundef, i16 noundef zeroext, i1 noundef zeroext) #2

declare void @print_leaves(ptr noundef) #2

; Function Attrs: inlinehint nounwind uwtable
declare i32 @getchar() #8

declare void @destroy_tree(ptr noundef) #2

declare void @usage_2() #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 = { 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 "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(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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #8 = { 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 #9 = { nounwind }
attributes #10 = { noreturn nounwind }
attributes #11 = { nounwind allocsize(0) }
attributes #12 = { 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, !12, i64 0}
!12 = !{!"_Bool", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!7, !7, i64 0}
!16 = distinct !{!16, !14}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !14}


; 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
@.str.1 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = alloca i32, align 4
  %4 = alloca i8, align 1
  %5 = alloca [4096 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #9
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #9
  call void @llvm.lifetime.start.p0(i64 4096, ptr nonnull %5) #9
  %6 = icmp sgt i32 %0, 2
  br i1 %6, label %7, label %22

7:                                                ; preds = %2
  %8 = getelementptr inbounds i8, ptr %1, i64 16
  %9 = load ptr, ptr %8, align 8, !tbaa !5
  %10 = tail call noalias ptr @fopen(ptr noundef %9, ptr noundef nonnull @.str)
  %11 = icmp eq ptr %10, null
  br i1 %11, label %13, label %.preheader32

.preheader32:                                     ; preds = %7
  %12 = tail call i32 @feof(ptr noundef nonnull %10) #9
  %.not33 = icmp eq i32 %12, 0
  br i1 %.not33, label %.lr.ph, label %._crit_edge

13:                                               ; preds = %7
  tail call void @perror(ptr noundef nonnull @.str.1) #10
  tail call void @exit(i32 noundef -1) #11
  unreachable

.lr.ph:                                           ; preds = %.preheader32, %.lr.ph
  %.02534 = phi ptr [ %19, %.lr.ph ], [ null, %.preheader32 ]
  %14 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef nonnull %10, ptr noundef nonnull @.str.2, ptr noundef nonnull %3, ptr noundef nonnull %5) #9
  %15 = call noalias dereferenceable_or_null(4104) ptr @malloc(i64 noundef 4104) #12
  %16 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %5) #13
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %15, ptr nonnull align 16 %5, i64 %16, i1 false)
  %17 = load i32, ptr %3, align 4, !tbaa !9
  %18 = trunc i32 %17 to i16
  %19 = call ptr @insert(ptr noundef %.02534, i16 noundef zeroext %18, ptr noundef %15) #9
  %20 = call i32 @feof(ptr noundef nonnull %10) #9
  %.not = icmp eq i32 %20, 0
  br i1 %.not, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge:                                      ; preds = %.lr.ph, %.preheader32
  %.025.lcssa = phi ptr [ null, %.preheader32 ], [ %19, %.lr.ph ]
  %21 = call i32 @fclose(ptr noundef nonnull %10)
  call void @print_tree(ptr noundef %.025.lcssa) #9
  br label %22

22:                                               ; preds = %._crit_edge, %2
  %.126 = phi ptr [ %.025.lcssa, %._crit_edge ], [ null, %2 ]
  %23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  %24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %4)
  %.not2935 = icmp eq i32 %24, -1
  br i1 %.not2935, label %._crit_edge40, label %.lr.ph39

.lr.ph39:                                         ; preds = %22, %61
  %.236 = phi ptr [ %.3, %61 ], [ %.126, %22 ]
  %25 = load i8, ptr %4, align 1, !tbaa !13
  switch i8 %25, label %57 [
    i8 100, label %26
    i8 105, label %31
    i8 102, label %38
    i8 112, label %38
    i8 108, label %53
    i8 113, label %.preheader
    i8 116, label %55
    i8 118, label %58
    i8 120, label %56
  ]

26:                                               ; preds = %.lr.ph39
  %27 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull %3)
  %28 = load i32, ptr %3, align 4, !tbaa !9
  %29 = trunc i32 %28 to i16
  %30 = call ptr @delete(ptr noundef %.236, i16 noundef zeroext %29) #9
  call void @print_tree(ptr noundef %30) #9
  br label %58

31:                                               ; preds = %.lr.ph39
  %32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.6, ptr noundef nonnull %3, ptr noundef nonnull %5)
  %33 = call noalias dereferenceable_or_null(4104) ptr @malloc(i64 noundef 4104) #12
  %34 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %5) #13
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %33, ptr nonnull align 16 %5, i64 %34, i1 false)
  %35 = load i32, ptr %3, align 4, !tbaa !9
  %36 = trunc i32 %35 to i16
  %37 = call ptr @insert(ptr noundef %.236, i16 noundef zeroext %36, ptr noundef %33) #9
  call void @print_tree(ptr noundef %37) #9
  br label %58

38:                                               ; preds = %.lr.ph39, %.lr.ph39
  %39 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull %3)
  %40 = load i32, ptr %3, align 4, !tbaa !9
  %41 = trunc i32 %40 to i16
  %42 = load i8, ptr %4, align 1, !tbaa !13
  %43 = icmp eq i8 %42, 112
  %44 = call ptr @find(ptr noundef %.236, i16 noundef zeroext %41, i1 noundef zeroext %43) #9
  %45 = icmp eq ptr %44, null
  br i1 %45, label %46, label %49

46:                                               ; preds = %38
  %47 = load i32, ptr %3, align 4, !tbaa !9
  %48 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %47)
  br label %58

49:                                               ; preds = %38
  %50 = ptrtoint ptr %44 to i64
  %51 = load i32, ptr %3, align 4, !tbaa !9
  %52 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, i64 noundef %50, i32 noundef %51, ptr noundef nonnull %44)
  br label %58

53:                                               ; preds = %.lr.ph39
  call void @print_leaves(ptr noundef %.236) #9
  br label %58

.preheader:                                       ; preds = %.lr.ph39, %.preheader
  %54 = call i32 @getchar()
  %.not30 = icmp eq i32 %54, 10
  br i1 %.not30, label %.loopexit, label %.preheader, !llvm.loop !14

55:                                               ; preds = %.lr.ph39
  call void @print_tree(ptr noundef %.236) #9
  br label %58

56:                                               ; preds = %.lr.ph39
  call void @destroy_tree(ptr noundef %.236) #9
  call void @print_tree(ptr noundef null) #9
  br label %58

57:                                               ; preds = %.lr.ph39
  call void @usage_2() #9
  br label %58

58:                                               ; preds = %.lr.ph39, %46, %49, %57, %56, %55, %53, %31, %26
  %.3 = phi ptr [ %.236, %57 ], [ %.236, %56 ], [ %.236, %55 ], [ %.236, %53 ], [ %.236, %46 ], [ %.236, %49 ], [ %37, %31 ], [ %30, %26 ], [ %.236, %.lr.ph39 ]
  br label %59

59:                                               ; preds = %59, %58
  %60 = call i32 @getchar()
  %.not31 = icmp eq i32 %60, 10
  br i1 %.not31, label %61, label %59, !llvm.loop !15

61:                                               ; preds = %59
  %62 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  %63 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %4)
  %.not29 = icmp eq i32 %63, -1
  br i1 %.not29, label %._crit_edge40, label %.lr.ph39, !llvm.loop !16

._crit_edge40:                                    ; preds = %61, %22
  %64 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9)
  br label %.loopexit

.loopexit:                                        ; preds = %.preheader, %._crit_edge40
  call void @llvm.lifetime.end.p0(i64 4096, ptr nonnull %5) #9
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #9
  ret i32 0
}

; 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 noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #2

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

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

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

declare i32 @__isoc99_fscanf(ptr noundef, ptr noundef, ...) 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: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #6

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #7

declare ptr @insert(ptr noundef, i16 noundef zeroext, ptr noundef) local_unnamed_addr #4

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

declare void @print_tree(ptr noundef) local_unnamed_addr #4

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

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

declare ptr @delete(ptr noundef, i16 noundef zeroext) local_unnamed_addr #4

declare ptr @find(ptr noundef, i16 noundef zeroext, i1 noundef zeroext) local_unnamed_addr #4

declare void @print_leaves(ptr noundef) local_unnamed_addr #4

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

declare void @destroy_tree(ptr noundef) local_unnamed_addr #4

declare void @usage_2() local_unnamed_addr #4

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


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