; LLVM IR from LeoVen/C-Macro-Collections :: examples (dfs)

; 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.BinaryTreeFVal = type { ptr, ptr, ptr, ptr, ptr, ptr }
%struct.StackFVal = type { ptr, ptr, ptr, ptr, ptr, ptr }
%struct.BinaryTree = type { ptr, i64, i32, ptr, ptr }
%struct.BinaryTreeNode = type { i32, i8, ptr, ptr, ptr }

@stdout = external global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@cmc_assert_total = external hidden global i64, align 8
@.str.5 = external hidden unnamed_addr constant [24 x i8], align 1
@cmc_assert_state = external hidden global i8, align 1
@cmc_assert_failed = external hidden global i64, align 8
@stderr = external global ptr, align 8
@.str.6 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [75 x i8], align 1
@__func__.main = external hidden unnamed_addr constant [5 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [66 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [28 x i8], align 1
@cmc_flags_to_str = external hidden global [12 x ptr], align 16
@.str.19 = external hidden unnamed_addr constant [33 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local ptr @tree_new(ptr noundef) #0

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @tree_free(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @tree_insert(ptr noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @tree_max(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @tree_min(ptr noundef, ptr noundef) #0

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

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @tree_print(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @stk_new(i64 noundef, ptr noundef) #0

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

; Function Attrs: nounwind uwtable
declare dso_local void @stk_free(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @stk_push(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @stk_pop(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @stk_empty(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @stk_top(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @stk_flag(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @DFS(ptr noundef) #0

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

24:                                               ; preds = %32, %0
  %25 = load i32, ptr %4, align 4, !tbaa !16
  %26 = icmp sle i32 %25, 10
  br i1 %26, label %28, label %27

27:                                               ; preds = %24
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %35

28:                                               ; preds = %24
  %29 = load ptr, ptr %2, align 8, !tbaa !15
  %30 = load i32, ptr %4, align 4, !tbaa !16
  %31 = call zeroext i1 @tree_insert(ptr noundef %29, i32 noundef %30)
  br label %32

32:                                               ; preds = %28
  %33 = load i32, ptr %4, align 4, !tbaa !16
  %34 = add nsw i32 %33, 1
  store i32 %34, ptr %4, align 4, !tbaa !16
  br label %24, !llvm.loop !18

35:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 1, ptr %5, align 4, !tbaa !16
  br label %36

36:                                               ; preds = %35
  %37 = load i64, ptr @cmc_assert_total, align 8, !tbaa !20
  %38 = add i64 %37, 1
  store i64 %38, ptr @cmc_assert_total, align 8, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  store ptr @.str.5, ptr %6, align 8, !tbaa !15
  %39 = load ptr, ptr %2, align 8, !tbaa !15
  %40 = call zeroext i1 @tree_min(ptr noundef %39, ptr noundef %5)
  br i1 %40, label %47, label %41

41:                                               ; preds = %36
  store i8 0, ptr @cmc_assert_state, align 1, !tbaa !22
  %42 = load i64, ptr @cmc_assert_failed, align 8, !tbaa !20
  %43 = add i64 %42, 1
  store i64 %43, ptr @cmc_assert_failed, align 8, !tbaa !20
  %44 = load ptr, ptr @stderr, align 8, !tbaa !15
  %45 = load ptr, ptr %6, align 8, !tbaa !15
  %46 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %44, ptr noundef @.str.6, ptr noundef @.str.7, ptr noundef @__func__.main, i32 noundef 48, ptr noundef %45) #6
  br label %47

47:                                               ; preds = %41, %36
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  br label %48

48:                                               ; preds = %47
  br label %49

49:                                               ; preds = %48
  br label %50

50:                                               ; preds = %49
  %51 = load i64, ptr @cmc_assert_total, align 8, !tbaa !20
  %52 = add i64 %51, 1
  store i64 %52, ptr @cmc_assert_total, align 8, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  store ptr @.str.8, ptr %7, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 1, ptr %8, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %53 = load i32, ptr %5, align 4, !tbaa !16
  store i32 %53, ptr %9, align 4, !tbaa !16
  %54 = load i32, ptr %8, align 4, !tbaa !16
  %55 = load i32, ptr %9, align 4, !tbaa !16
  %56 = icmp ne i32 %54, %55
  br i1 %56, label %57, label %65

57:                                               ; preds = %50
  store i8 0, ptr @cmc_assert_state, align 1, !tbaa !22
  %58 = load i64, ptr @cmc_assert_failed, align 8, !tbaa !20
  %59 = add i64 %58, 1
  store i64 %59, ptr @cmc_assert_failed, align 8, !tbaa !20
  %60 = load ptr, ptr @stderr, align 8, !tbaa !15
  %61 = load ptr, ptr %7, align 8, !tbaa !15
  %62 = load i32, ptr %8, align 4, !tbaa !16
  %63 = load i32, ptr %9, align 4, !tbaa !16
  %64 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %60, ptr noundef @.str.9, ptr noundef @.str.7, ptr noundef @__func__.main, i32 noundef 49, ptr noundef %61, i32 noundef %62, i32 noundef %63) #6
  br label %65

65:                                               ; preds = %57, %50
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  br label %66

66:                                               ; preds = %65
  br label %67

67:                                               ; preds = %66
  br label %68

68:                                               ; preds = %67
  %69 = load i64, ptr @cmc_assert_total, align 8, !tbaa !20
  %70 = add i64 %69, 1
  store i64 %70, ptr @cmc_assert_total, align 8, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  store ptr @.str.10, ptr %10, align 8, !tbaa !15
  %71 = load ptr, ptr %2, align 8, !tbaa !15
  %72 = call zeroext i1 @tree_max(ptr noundef %71, ptr noundef %5)
  br i1 %72, label %79, label %73

73:                                               ; preds = %68
  store i8 0, ptr @cmc_assert_state, align 1, !tbaa !22
  %74 = load i64, ptr @cmc_assert_failed, align 8, !tbaa !20
  %75 = add i64 %74, 1
  store i64 %75, ptr @cmc_assert_failed, align 8, !tbaa !20
  %76 = load ptr, ptr @stderr, align 8, !tbaa !15
  %77 = load ptr, ptr %10, align 8, !tbaa !15
  %78 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %76, ptr noundef @.str.6, ptr noundef @.str.7, ptr noundef @__func__.main, i32 noundef 51, ptr noundef %77) #6
  br label %79

79:                                               ; preds = %73, %68
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %80

80:                                               ; preds = %79
  br label %81

81:                                               ; preds = %80
  br label %82

82:                                               ; preds = %81
  %83 = load i64, ptr @cmc_assert_total, align 8, !tbaa !20
  %84 = add i64 %83, 1
  store i64 %84, ptr @cmc_assert_total, align 8, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  store ptr @.str.8, ptr %11, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 10, ptr %12, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %85 = load i32, ptr %5, align 4, !tbaa !16
  store i32 %85, ptr %13, align 4, !tbaa !16
  %86 = load i32, ptr %12, align 4, !tbaa !16
  %87 = load i32, ptr %13, align 4, !tbaa !16
  %88 = icmp ne i32 %86, %87
  br i1 %88, label %89, label %97

89:                                               ; preds = %82
  store i8 0, ptr @cmc_assert_state, align 1, !tbaa !22
  %90 = load i64, ptr @cmc_assert_failed, align 8, !tbaa !20
  %91 = add i64 %90, 1
  store i64 %91, ptr @cmc_assert_failed, align 8, !tbaa !20
  %92 = load ptr, ptr @stderr, align 8, !tbaa !15
  %93 = load ptr, ptr %11, align 8, !tbaa !15
  %94 = load i32, ptr %12, align 4, !tbaa !16
  %95 = load i32, ptr %13, align 4, !tbaa !16
  %96 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %92, ptr noundef @.str.9, ptr noundef @.str.7, ptr noundef @__func__.main, i32 noundef 52, ptr noundef %93, i32 noundef %94, i32 noundef %95) #6
  br label %97

97:                                               ; preds = %89, %82
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br label %98

98:                                               ; preds = %97
  br label %99

99:                                               ; preds = %98
  %100 = call i32 (ptr, ...) @printf(ptr noundef @.str.11)
  %101 = load ptr, ptr %2, align 8, !tbaa !15
  %102 = load ptr, ptr @stdout, align 8, !tbaa !15
  %103 = call zeroext i1 @tree_print(ptr noundef %101, ptr noundef %102, ptr noundef @.str.12, ptr noundef @.str.13, ptr noundef @.str.14)
  %104 = call i32 (ptr, ...) @printf(ptr noundef @.str.15)
  %105 = load ptr, ptr @stdout, align 8, !tbaa !15
  %106 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %105, ptr noundef @.str.12) #6
  %107 = load ptr, ptr %2, align 8, !tbaa !15
  %108 = getelementptr inbounds %struct.BinaryTree, ptr %107, i32 0, i32 0
  %109 = load ptr, ptr %108, align 8, !tbaa !24
  call void @DFS(ptr noundef %109)
  %110 = load ptr, ptr @stdout, align 8, !tbaa !15
  %111 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %110, ptr noundef @.str.16) #6
  %112 = call i32 (ptr, ...) @printf(ptr noundef @.str.17)
  %113 = load ptr, ptr @stdout, align 8, !tbaa !15
  %114 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %113, ptr noundef @.str.12) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  call void @llvm.memset.p0.i64(ptr align 8 %15, i8 0, i64 48, i1 false)
  %115 = getelementptr inbounds %struct.StackFVal, ptr %15, i32 0, i32 0
  %116 = getelementptr inbounds %struct.StackFVal, ptr %15, i32 0, i32 1
  %117 = getelementptr inbounds %struct.StackFVal, ptr %15, i32 0, i32 2
  %118 = getelementptr inbounds %struct.StackFVal, ptr %15, i32 0, i32 3
  %119 = getelementptr inbounds %struct.StackFVal, ptr %15, i32 0, i32 4
  %120 = getelementptr inbounds %struct.StackFVal, ptr %15, i32 0, i32 5
  %121 = call ptr @stk_new(i64 noundef 100, ptr noundef %15)
  store ptr %121, ptr %14, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %122 = load ptr, ptr %2, align 8, !tbaa !15
  %123 = getelementptr inbounds %struct.BinaryTree, ptr %122, i32 0, i32 0
  %124 = load ptr, ptr %123, align 8, !tbaa !24
  store ptr %124, ptr %16, align 8, !tbaa !15
  br label %125

125:                                              ; preds = %171, %99
  %126 = load ptr, ptr %16, align 8, !tbaa !15
  %127 = icmp ne ptr %126, null
  br i1 %127, label %132, label %128

128:                                              ; preds = %125
  %129 = load ptr, ptr %14, align 8, !tbaa !15
  %130 = call zeroext i1 @stk_empty(ptr noundef %129)
  %131 = xor i1 %130, true
  br label %132

132:                                              ; preds = %128, %125
  %133 = phi i1 [ true, %125 ], [ %131, %128 ]
  br i1 %133, label %134, label %172

134:                                              ; preds = %132
  %135 = load ptr, ptr %16, align 8, !tbaa !15
  %136 = icmp ne ptr %135, null
  br i1 %136, label %137, label %151

137:                                              ; preds = %134
  %138 = load ptr, ptr %14, align 8, !tbaa !15
  %139 = load ptr, ptr %16, align 8, !tbaa !15
  %140 = call zeroext i1 @stk_push(ptr noundef %138, ptr noundef %139)
  br i1 %140, label %147, label %141

141:                                              ; preds = %137
  %142 = load ptr, ptr %14, align 8, !tbaa !15
  %143 = call i32 @stk_flag(ptr noundef %142)
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [12 x ptr], ptr @cmc_flags_to_str, i64 0, i64 %144
  %146 = load ptr, ptr %145, align 8, !tbaa !15
  call void (i32, ptr, ptr, i32, ptr, ...) @cmc_log(i32 noundef 5, ptr noundef @.str.7, ptr noundef @__func__.main, i32 noundef 73, ptr noundef @.str.18, ptr noundef %146)
  br label %147

147:                                              ; preds = %141, %137
  %148 = load ptr, ptr %16, align 8, !tbaa !15
  %149 = getelementptr inbounds %struct.BinaryTreeNode, ptr %148, i32 0, i32 3
  %150 = load ptr, ptr %149, align 8, !tbaa !26
  store ptr %150, ptr %16, align 8, !tbaa !15
  br label %171

151:                                              ; preds = %134
  %152 = load ptr, ptr %14, align 8, !tbaa !15
  %153 = call ptr @stk_top(ptr noundef %152)
  store ptr %153, ptr %16, align 8, !tbaa !15
  %154 = load ptr, ptr %14, align 8, !tbaa !15
  %155 = call zeroext i1 @stk_pop(ptr noundef %154)
  br i1 %155, label %162, label %156

156:                                              ; preds = %151
  %157 = load ptr, ptr %14, align 8, !tbaa !15
  %158 = call i32 @stk_flag(ptr noundef %157)
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [12 x ptr], ptr @cmc_flags_to_str, i64 0, i64 %159
  %161 = load ptr, ptr %160, align 8, !tbaa !15
  call void (i32, ptr, ptr, i32, ptr, ...) @cmc_log(i32 noundef 5, ptr noundef @.str.7, ptr noundef @__func__.main, i32 noundef 82, ptr noundef @.str.19, ptr noundef %161)
  br label %162

162:                                              ; preds = %156, %151
  %163 = load ptr, ptr @stdout, align 8, !tbaa !15
  %164 = load ptr, ptr %16, align 8, !tbaa !15
  %165 = getelementptr inbounds %struct.BinaryTreeNode, ptr %164, i32 0, i32 0
  %166 = load i32, ptr %165, align 8, !tbaa !28
  %167 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %163, ptr noundef @.str.4, i32 noundef %166) #6
  %168 = load ptr, ptr %16, align 8, !tbaa !15
  %169 = getelementptr inbounds %struct.BinaryTreeNode, ptr %168, i32 0, i32 2
  %170 = load ptr, ptr %169, align 8, !tbaa !29
  store ptr %170, ptr %16, align 8, !tbaa !15
  br label %171

171:                                              ; preds = %162, %147
  br label %125, !llvm.loop !30

172:                                              ; preds = %132
  %173 = load ptr, ptr %14, align 8, !tbaa !15
  call void @stk_free(ptr noundef %173)
  %174 = load ptr, ptr @stdout, align 8, !tbaa !15
  %175 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %174, ptr noundef @.str.16) #6
  %176 = load ptr, ptr %2, align 8, !tbaa !15
  call void @tree_free(ptr noundef %176)
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  %177 = load i32, ptr %1, align 4
  ret i32 %177
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @cmc_i32_cmp(i32 noundef, i32 noundef) #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @cmc_i32_str(ptr noundef, i32 noundef) #4

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

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

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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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 #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 }

!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, !7, i64 0}
!6 = !{!"BinaryTreeFVal", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!6, !7, i64 16}
!12 = !{!6, !7, i64 24}
!13 = !{!6, !7, i64 32}
!14 = !{!6, !7, i64 40}
!15 = !{!7, !7, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"int", !8, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!21, !21, i64 0}
!21 = !{!"long", !8, i64 0}
!22 = !{!23, !23, i64 0}
!23 = !{!"_Bool", !8, i64 0}
!24 = !{!25, !7, i64 0}
!25 = !{!"BinaryTree", !7, i64 0, !21, i64 8, !17, i64 16, !7, i64 24, !7, i64 32}
!26 = !{!27, !7, i64 16}
!27 = !{!"BinaryTreeNode", !17, i64 0, !8, i64 4, !7, i64 8, !7, i64 16, !7, i64 24}
!28 = !{!27, !17, i64 0}
!29 = !{!27, !7, i64 8}
!30 = distinct !{!30, !19}


; 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.BinaryTreeFVal = type { ptr, ptr, ptr, ptr, ptr, ptr }
%struct.StackFVal = type { ptr, ptr, ptr, ptr, ptr, ptr }

@stdout = external local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@cmc_assert_total = external hidden local_unnamed_addr global i64, align 8
@.str.5 = external hidden unnamed_addr constant [24 x i8], align 1
@cmc_assert_state = external hidden local_unnamed_addr global i8, align 1
@cmc_assert_failed = external hidden local_unnamed_addr global i64, align 8
@stderr = external local_unnamed_addr global ptr, align 8
@.str.6 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [75 x i8], align 1
@__func__.main = external hidden unnamed_addr constant [5 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [66 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [28 x i8], align 1
@cmc_flags_to_str = external hidden local_unnamed_addr global [12 x ptr], align 16
@.str.19 = external hidden unnamed_addr constant [33 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local ptr @tree_new(ptr noundef) local_unnamed_addr #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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nounwind uwtable
declare dso_local void @tree_free(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @tree_insert(ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @tree_max(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @tree_min(ptr noundef, ptr noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @tree_print(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @stk_new(i64 noundef, ptr noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare dso_local void @stk_free(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @stk_push(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @stk_pop(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @stk_empty(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @stk_top(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @stk_flag(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @DFS(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca %struct.BinaryTreeFVal, align 8
  %2 = alloca i32, align 4
  %3 = alloca %struct.StackFVal, align 8
  store ptr @cmc_i32_cmp, ptr %1, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %1, i64 8
  store ptr null, ptr %4, align 8, !tbaa !10
  %5 = getelementptr inbounds i8, ptr %1, i64 16
  store ptr @cmc_i32_str, ptr %5, align 8, !tbaa !11
  %6 = getelementptr inbounds i8, ptr %1, i64 24
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %6, i8 0, i64 24, i1 false)
  %7 = call ptr @tree_new(ptr noundef nonnull %1)
  %8 = call zeroext i1 @tree_insert(ptr noundef %7, i32 noundef 1)
  %9 = call zeroext i1 @tree_insert(ptr noundef %7, i32 noundef 2)
  %10 = call zeroext i1 @tree_insert(ptr noundef %7, i32 noundef 3)
  %11 = call zeroext i1 @tree_insert(ptr noundef %7, i32 noundef 4)
  %12 = call zeroext i1 @tree_insert(ptr noundef %7, i32 noundef 5)
  %13 = call zeroext i1 @tree_insert(ptr noundef %7, i32 noundef 6)
  %14 = call zeroext i1 @tree_insert(ptr noundef %7, i32 noundef 7)
  %15 = call zeroext i1 @tree_insert(ptr noundef %7, i32 noundef 8)
  %16 = call zeroext i1 @tree_insert(ptr noundef %7, i32 noundef 9)
  %17 = call zeroext i1 @tree_insert(ptr noundef %7, i32 noundef 10)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  store i32 1, ptr %2, align 4, !tbaa !12
  %18 = load i64, ptr @cmc_assert_total, align 8, !tbaa !14
  %19 = add i64 %18, 1
  store i64 %19, ptr @cmc_assert_total, align 8, !tbaa !14
  %20 = call zeroext i1 @tree_min(ptr noundef %7, ptr noundef nonnull %2)
  br i1 %20, label %26, label %21

21:                                               ; preds = %0
  store i8 0, ptr @cmc_assert_state, align 1, !tbaa !16
  %22 = load i64, ptr @cmc_assert_failed, align 8, !tbaa !14
  %23 = add i64 %22, 1
  store i64 %23, ptr @cmc_assert_failed, align 8, !tbaa !14
  %24 = load ptr, ptr @stderr, align 8, !tbaa !18
  %25 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %24, ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.7, ptr noundef nonnull @__func__.main, i32 noundef 48, ptr noundef nonnull @.str.5) #6
  br label %26

26:                                               ; preds = %21, %0
  %27 = load i64, ptr @cmc_assert_total, align 8, !tbaa !14
  %28 = add i64 %27, 1
  store i64 %28, ptr @cmc_assert_total, align 8, !tbaa !14
  %29 = load i32, ptr %2, align 4, !tbaa !12
  %.not = icmp eq i32 %29, 1
  br i1 %.not, label %35, label %30

30:                                               ; preds = %26
  store i8 0, ptr @cmc_assert_state, align 1, !tbaa !16
  %31 = load i64, ptr @cmc_assert_failed, align 8, !tbaa !14
  %32 = add i64 %31, 1
  store i64 %32, ptr @cmc_assert_failed, align 8, !tbaa !14
  %33 = load ptr, ptr @stderr, align 8, !tbaa !18
  %34 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %33, ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.7, ptr noundef nonnull @__func__.main, i32 noundef 49, ptr noundef nonnull @.str.8, i32 noundef 1, i32 noundef %29) #6
  %.pre = load i64, ptr @cmc_assert_total, align 8, !tbaa !14
  br label %35

35:                                               ; preds = %30, %26
  %36 = phi i64 [ %.pre, %30 ], [ %28, %26 ]
  %37 = add i64 %36, 1
  store i64 %37, ptr @cmc_assert_total, align 8, !tbaa !14
  %38 = call zeroext i1 @tree_max(ptr noundef %7, ptr noundef nonnull %2)
  br i1 %38, label %44, label %39

39:                                               ; preds = %35
  store i8 0, ptr @cmc_assert_state, align 1, !tbaa !16
  %40 = load i64, ptr @cmc_assert_failed, align 8, !tbaa !14
  %41 = add i64 %40, 1
  store i64 %41, ptr @cmc_assert_failed, align 8, !tbaa !14
  %42 = load ptr, ptr @stderr, align 8, !tbaa !18
  %43 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %42, ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.7, ptr noundef nonnull @__func__.main, i32 noundef 51, ptr noundef nonnull @.str.10) #6
  br label %44

44:                                               ; preds = %39, %35
  %45 = load i64, ptr @cmc_assert_total, align 8, !tbaa !14
  %46 = add i64 %45, 1
  store i64 %46, ptr @cmc_assert_total, align 8, !tbaa !14
  %47 = load i32, ptr %2, align 4, !tbaa !12
  %.not38 = icmp eq i32 %47, 10
  br i1 %.not38, label %53, label %48

48:                                               ; preds = %44
  store i8 0, ptr @cmc_assert_state, align 1, !tbaa !16
  %49 = load i64, ptr @cmc_assert_failed, align 8, !tbaa !14
  %50 = add i64 %49, 1
  store i64 %50, ptr @cmc_assert_failed, align 8, !tbaa !14
  %51 = load ptr, ptr @stderr, align 8, !tbaa !18
  %52 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %51, ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.7, ptr noundef nonnull @__func__.main, i32 noundef 52, ptr noundef nonnull @.str.8, i32 noundef 10, i32 noundef %47) #6
  br label %53

53:                                               ; preds = %48, %44
  %54 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11)
  %55 = load ptr, ptr @stdout, align 8, !tbaa !18
  %56 = call zeroext i1 @tree_print(ptr noundef %7, ptr noundef %55, ptr noundef nonnull @.str.12, ptr noundef nonnull @.str.13, ptr noundef nonnull @.str.14)
  %57 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15)
  %58 = load ptr, ptr @stdout, align 8, !tbaa !18
  %59 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %58, ptr noundef nonnull @.str.12) #5
  %60 = load ptr, ptr %7, align 8, !tbaa !19
  call void @DFS(ptr noundef %60)
  %61 = load ptr, ptr @stdout, align 8, !tbaa !18
  %62 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %61, ptr noundef nonnull @.str.16) #5
  %63 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.17)
  %64 = load ptr, ptr @stdout, align 8, !tbaa !18
  %65 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %64, ptr noundef nonnull @.str.12) #5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(48) %3, i8 0, i64 48, i1 false)
  %66 = call ptr @stk_new(i64 noundef 100, ptr noundef nonnull %3)
  br label %67

67:                                               ; preds = %.backedge, %53
  %.0.in = phi ptr [ %7, %53 ], [ %.0.in.be, %.backedge ]
  %.0 = load ptr, ptr %.0.in, align 8, !tbaa !18
  %.not39 = icmp eq ptr %.0, null
  br i1 %.not39, label %68, label %.critedge40

68:                                               ; preds = %67
  %69 = call zeroext i1 @stk_empty(ptr noundef %66)
  br i1 %69, label %90, label %.critedge

.critedge40:                                      ; preds = %67
  %70 = call zeroext i1 @stk_push(ptr noundef %66, ptr noundef nonnull %.0)
  br i1 %70, label %76, label %71

71:                                               ; preds = %.critedge40
  %72 = call i32 @stk_flag(ptr noundef %66)
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [12 x ptr], ptr @cmc_flags_to_str, i64 0, i64 %73
  %75 = load ptr, ptr %74, align 8, !tbaa !18
  call void (i32, ptr, ptr, i32, ptr, ...) @cmc_log(i32 noundef 5, ptr noundef nonnull @.str.7, ptr noundef nonnull @__func__.main, i32 noundef 73, ptr noundef nonnull @.str.18, ptr noundef %75)
  br label %76

76:                                               ; preds = %71, %.critedge40
  %77 = getelementptr inbounds i8, ptr %.0, i64 16
  br label %.backedge

.critedge:                                        ; preds = %68
  %78 = call ptr @stk_top(ptr noundef %66)
  %79 = call zeroext i1 @stk_pop(ptr noundef %66)
  br i1 %79, label %85, label %80

80:                                               ; preds = %.critedge
  %81 = call i32 @stk_flag(ptr noundef %66)
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [12 x ptr], ptr @cmc_flags_to_str, i64 0, i64 %82
  %84 = load ptr, ptr %83, align 8, !tbaa !18
  call void (i32, ptr, ptr, i32, ptr, ...) @cmc_log(i32 noundef 5, ptr noundef nonnull @.str.7, ptr noundef nonnull @__func__.main, i32 noundef 82, ptr noundef nonnull @.str.19, ptr noundef %84)
  br label %85

85:                                               ; preds = %80, %.critedge
  %86 = load ptr, ptr @stdout, align 8, !tbaa !18
  %87 = load i32, ptr %78, align 8, !tbaa !21
  %88 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %86, ptr noundef nonnull @.str.4, i32 noundef %87) #5
  %89 = getelementptr inbounds i8, ptr %78, i64 8
  br label %.backedge

.backedge:                                        ; preds = %85, %76
  %.0.in.be = phi ptr [ %77, %76 ], [ %89, %85 ]
  br label %67, !llvm.loop !23

90:                                               ; preds = %68
  call void @stk_free(ptr noundef %66)
  %91 = load ptr, ptr @stdout, align 8, !tbaa !18
  %92 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %91, ptr noundef nonnull @.str.16) #5
  call void @tree_free(ptr noundef nonnull %7)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  ret i32 0
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @cmc_i32_cmp(i32 noundef, i32 noundef) #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @cmc_i32_str(ptr noundef, i32 noundef) #4

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

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

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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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 #5 = { nounwind }
attributes #6 = { cold nounwind }

!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, !7, i64 0}
!6 = !{!"BinaryTreeFVal", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!6, !7, i64 16}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !8, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"long", !8, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"_Bool", !8, i64 0}
!18 = !{!7, !7, i64 0}
!19 = !{!20, !7, i64 0}
!20 = !{!"BinaryTree", !7, i64 0, !15, i64 8, !13, i64 16, !7, i64 24, !7, i64 32}
!21 = !{!22, !13, i64 0}
!22 = !{!"BinaryTreeNode", !13, i64 0, !8, i64 4, !7, i64 8, !7, i64 16, !7, i64 24}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopUnrollPass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass