; LLVM IR from yourtion/LearningMasteringAlgorithms-C :: Example/bitree (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.BiTree_ = type { i32, ptr, ptr, ptr }
%struct.BiTreeNode_ = type { ptr, ptr, ptr }

@stdout = external global ptr, align 8
@.str = external hidden unnamed_addr constant [22 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [21 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 %struct.BiTree_, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = 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 32, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  call void @bitree_init(ptr noundef %6, ptr noundef @free)
  %10 = load ptr, ptr @stdout, align 8, !tbaa !9
  %11 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %10, ptr noundef @.str) #4
  %12 = call i32 @insert_int(ptr noundef %6, i32 noundef 20)
  %13 = icmp ne i32 %12, 0
  br i1 %13, label %14, label %15

14:                                               ; preds = %2
  store i32 1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %247

15:                                               ; preds = %2
  %16 = call i32 @insert_int(ptr noundef %6, i32 noundef 10)
  %17 = icmp ne i32 %16, 0
  br i1 %17, label %18, label %19

18:                                               ; preds = %15
  store i32 1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %247

19:                                               ; preds = %15
  %20 = call i32 @insert_int(ptr noundef %6, i32 noundef 30)
  %21 = icmp ne i32 %20, 0
  br i1 %21, label %22, label %23

22:                                               ; preds = %19
  store i32 1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %247

23:                                               ; preds = %19
  %24 = call i32 @insert_int(ptr noundef %6, i32 noundef 15)
  %25 = icmp ne i32 %24, 0
  br i1 %25, label %26, label %27

26:                                               ; preds = %23
  store i32 1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %247

27:                                               ; preds = %23
  %28 = call i32 @insert_int(ptr noundef %6, i32 noundef 25)
  %29 = icmp ne i32 %28, 0
  br i1 %29, label %30, label %31

30:                                               ; preds = %27
  store i32 1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %247

31:                                               ; preds = %27
  %32 = call i32 @insert_int(ptr noundef %6, i32 noundef 70)
  %33 = icmp ne i32 %32, 0
  br i1 %33, label %34, label %35

34:                                               ; preds = %31
  store i32 1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %247

35:                                               ; preds = %31
  %36 = call i32 @insert_int(ptr noundef %6, i32 noundef 80)
  %37 = icmp ne i32 %36, 0
  br i1 %37, label %38, label %39

38:                                               ; preds = %35
  store i32 1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %247

39:                                               ; preds = %35
  %40 = call i32 @insert_int(ptr noundef %6, i32 noundef 23)
  %41 = icmp ne i32 %40, 0
  br i1 %41, label %42, label %43

42:                                               ; preds = %39
  store i32 1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %247

43:                                               ; preds = %39
  %44 = call i32 @insert_int(ptr noundef %6, i32 noundef 26)
  %45 = icmp ne i32 %44, 0
  br i1 %45, label %46, label %47

46:                                               ; preds = %43
  store i32 1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %247

47:                                               ; preds = %43
  %48 = call i32 @insert_int(ptr noundef %6, i32 noundef 5)
  %49 = icmp ne i32 %48, 0
  br i1 %49, label %50, label %51

50:                                               ; preds = %47
  store i32 1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %247

51:                                               ; preds = %47
  %52 = load ptr, ptr @stdout, align 8, !tbaa !9
  %53 = getelementptr inbounds %struct.BiTree_, ptr %6, i32 0, i32 0
  %54 = load i32, ptr %53, align 8, !tbaa !11
  %55 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %52, ptr noundef @.str.1, i32 noundef %54) #4
  %56 = load ptr, ptr @stdout, align 8, !tbaa !9
  %57 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %56, ptr noundef @.str.2) #4
  %58 = getelementptr inbounds %struct.BiTree_, ptr %6, i32 0, i32 3
  %59 = load ptr, ptr %58, align 8, !tbaa !13
  call void @print_preorder(ptr noundef %59)
  store i32 30, ptr %8, align 4, !tbaa !5
  %60 = load i32, ptr %8, align 4, !tbaa !5
  %61 = call ptr @search_int(ptr noundef %6, i32 noundef %60)
  store ptr %61, ptr %7, align 8, !tbaa !9
  %62 = icmp eq ptr %61, null
  br i1 %62, label %63, label %67

63:                                               ; preds = %51
  %64 = load ptr, ptr @stdout, align 8, !tbaa !9
  %65 = load i32, ptr %8, align 4, !tbaa !5
  %66 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %64, ptr noundef @.str.3, i32 noundef %65) #4
  br label %80

67:                                               ; preds = %51
  %68 = load ptr, ptr @stdout, align 8, !tbaa !9
  %69 = load i32, ptr %8, align 4, !tbaa !5
  %70 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %68, ptr noundef @.str.4, i32 noundef %69) #4
  %71 = load ptr, ptr %7, align 8, !tbaa !9
  call void @bitree_rem_left(ptr noundef %6, ptr noundef %71)
  %72 = load ptr, ptr @stdout, align 8, !tbaa !9
  %73 = getelementptr inbounds %struct.BiTree_, ptr %6, i32 0, i32 0
  %74 = load i32, ptr %73, align 8, !tbaa !11
  %75 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %72, ptr noundef @.str.1, i32 noundef %74) #4
  %76 = load ptr, ptr @stdout, align 8, !tbaa !9
  %77 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %76, ptr noundef @.str.2) #4
  %78 = getelementptr inbounds %struct.BiTree_, ptr %6, i32 0, i32 3
  %79 = load ptr, ptr %78, align 8, !tbaa !13
  call void @print_preorder(ptr noundef %79)
  br label %80

80:                                               ; preds = %67, %63
  store i32 99, ptr %8, align 4, !tbaa !5
  %81 = load i32, ptr %8, align 4, !tbaa !5
  %82 = call ptr @search_int(ptr noundef %6, i32 noundef %81)
  store ptr %82, ptr %7, align 8, !tbaa !9
  %83 = icmp eq ptr %82, null
  br i1 %83, label %84, label %88

84:                                               ; preds = %80
  %85 = load ptr, ptr @stdout, align 8, !tbaa !9
  %86 = load i32, ptr %8, align 4, !tbaa !5
  %87 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %85, ptr noundef @.str.3, i32 noundef %86) #4
  br label %101

88:                                               ; preds = %80
  %89 = load ptr, ptr @stdout, align 8, !tbaa !9
  %90 = load i32, ptr %8, align 4, !tbaa !5
  %91 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %89, ptr noundef @.str.5, i32 noundef %90) #4
  %92 = load ptr, ptr %7, align 8, !tbaa !9
  call void @bitree_rem_right(ptr noundef %6, ptr noundef %92)
  %93 = load ptr, ptr @stdout, align 8, !tbaa !9
  %94 = getelementptr inbounds %struct.BiTree_, ptr %6, i32 0, i32 0
  %95 = load i32, ptr %94, align 8, !tbaa !11
  %96 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %93, ptr noundef @.str.1, i32 noundef %95) #4
  %97 = load ptr, ptr @stdout, align 8, !tbaa !9
  %98 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %97, ptr noundef @.str.2) #4
  %99 = getelementptr inbounds %struct.BiTree_, ptr %6, i32 0, i32 3
  %100 = load ptr, ptr %99, align 8, !tbaa !13
  call void @print_preorder(ptr noundef %100)
  br label %101

101:                                              ; preds = %88, %84
  store i32 20, ptr %8, align 4, !tbaa !5
  %102 = load i32, ptr %8, align 4, !tbaa !5
  %103 = call ptr @search_int(ptr noundef %6, i32 noundef %102)
  store ptr %103, ptr %7, align 8, !tbaa !9
  %104 = icmp eq ptr %103, null
  br i1 %104, label %105, label %109

105:                                              ; preds = %101
  %106 = load ptr, ptr @stdout, align 8, !tbaa !9
  %107 = load i32, ptr %8, align 4, !tbaa !5
  %108 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %106, ptr noundef @.str.3, i32 noundef %107) #4
  br label %122

109:                                              ; preds = %101
  %110 = load ptr, ptr @stdout, align 8, !tbaa !9
  %111 = load i32, ptr %8, align 4, !tbaa !5
  %112 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %110, ptr noundef @.str.5, i32 noundef %111) #4
  %113 = load ptr, ptr %7, align 8, !tbaa !9
  call void @bitree_rem_right(ptr noundef %6, ptr noundef %113)
  %114 = load ptr, ptr @stdout, align 8, !tbaa !9
  %115 = getelementptr inbounds %struct.BiTree_, ptr %6, i32 0, i32 0
  %116 = load i32, ptr %115, align 8, !tbaa !11
  %117 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %114, ptr noundef @.str.1, i32 noundef %116) #4
  %118 = load ptr, ptr @stdout, align 8, !tbaa !9
  %119 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %118, ptr noundef @.str.2) #4
  %120 = getelementptr inbounds %struct.BiTree_, ptr %6, i32 0, i32 3
  %121 = load ptr, ptr %120, align 8, !tbaa !13
  call void @print_preorder(ptr noundef %121)
  br label %122

122:                                              ; preds = %109, %105
  %123 = getelementptr inbounds %struct.BiTree_, ptr %6, i32 0, i32 3
  %124 = load ptr, ptr %123, align 8, !tbaa !13
  %125 = getelementptr inbounds %struct.BiTreeNode_, ptr %124, i32 0, i32 1
  %126 = load ptr, ptr %125, align 8, !tbaa !14
  %127 = icmp eq ptr %126, null
  br i1 %127, label %128, label %134

128:                                              ; preds = %122
  %129 = getelementptr inbounds %struct.BiTree_, ptr %6, i32 0, i32 3
  %130 = load ptr, ptr %129, align 8, !tbaa !13
  %131 = getelementptr inbounds %struct.BiTreeNode_, ptr %130, i32 0, i32 2
  %132 = load ptr, ptr %131, align 8, !tbaa !16
  %133 = icmp eq ptr %132, null
  br label %134

134:                                              ; preds = %128, %122
  %135 = phi i1 [ false, %122 ], [ %133, %128 ]
  %136 = zext i1 %135 to i32
  store i32 %136, ptr %8, align 4, !tbaa !5
  %137 = load ptr, ptr @stdout, align 8, !tbaa !9
  %138 = load i32, ptr %8, align 4, !tbaa !5
  %139 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %137, ptr noundef @.str.6, i32 noundef %138) #4
  %140 = getelementptr inbounds %struct.BiTree_, ptr %6, i32 0, i32 3
  %141 = load ptr, ptr %140, align 8, !tbaa !13
  %142 = getelementptr inbounds %struct.BiTreeNode_, ptr %141, i32 0, i32 1
  %143 = load ptr, ptr %142, align 8, !tbaa !14
  %144 = getelementptr inbounds %struct.BiTreeNode_, ptr %143, i32 0, i32 1
  %145 = load ptr, ptr %144, align 8, !tbaa !14
  %146 = icmp eq ptr %145, null
  br i1 %146, label %147, label %155

147:                                              ; preds = %134
  %148 = getelementptr inbounds %struct.BiTree_, ptr %6, i32 0, i32 3
  %149 = load ptr, ptr %148, align 8, !tbaa !13
  %150 = getelementptr inbounds %struct.BiTreeNode_, ptr %149, i32 0, i32 1
  %151 = load ptr, ptr %150, align 8, !tbaa !14
  %152 = getelementptr inbounds %struct.BiTreeNode_, ptr %151, i32 0, i32 2
  %153 = load ptr, ptr %152, align 8, !tbaa !16
  %154 = icmp eq ptr %153, null
  br label %155

155:                                              ; preds = %147, %134
  %156 = phi i1 [ false, %134 ], [ %154, %147 ]
  %157 = zext i1 %156 to i32
  store i32 %157, ptr %8, align 4, !tbaa !5
  %158 = load ptr, ptr @stdout, align 8, !tbaa !9
  %159 = load i32, ptr %8, align 4, !tbaa !5
  %160 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %158, ptr noundef @.str.6, i32 noundef %159) #4
  %161 = getelementptr inbounds %struct.BiTree_, ptr %6, i32 0, i32 3
  %162 = load ptr, ptr %161, align 8, !tbaa !13
  %163 = getelementptr inbounds %struct.BiTreeNode_, ptr %162, i32 0, i32 1
  %164 = load ptr, ptr %163, align 8, !tbaa !14
  %165 = getelementptr inbounds %struct.BiTreeNode_, ptr %164, i32 0, i32 1
  %166 = load ptr, ptr %165, align 8, !tbaa !14
  %167 = getelementptr inbounds %struct.BiTreeNode_, ptr %166, i32 0, i32 1
  %168 = load ptr, ptr %167, align 8, !tbaa !14
  %169 = icmp eq ptr %168, null
  br i1 %169, label %170, label %180

170:                                              ; preds = %155
  %171 = getelementptr inbounds %struct.BiTree_, ptr %6, i32 0, i32 3
  %172 = load ptr, ptr %171, align 8, !tbaa !13
  %173 = getelementptr inbounds %struct.BiTreeNode_, ptr %172, i32 0, i32 1
  %174 = load ptr, ptr %173, align 8, !tbaa !14
  %175 = getelementptr inbounds %struct.BiTreeNode_, ptr %174, i32 0, i32 1
  %176 = load ptr, ptr %175, align 8, !tbaa !14
  %177 = getelementptr inbounds %struct.BiTreeNode_, ptr %176, i32 0, i32 2
  %178 = load ptr, ptr %177, align 8, !tbaa !16
  %179 = icmp eq ptr %178, null
  br label %180

180:                                              ; preds = %170, %155
  %181 = phi i1 [ false, %155 ], [ %179, %170 ]
  %182 = zext i1 %181 to i32
  store i32 %182, ptr %8, align 4, !tbaa !5
  %183 = load ptr, ptr @stdout, align 8, !tbaa !9
  %184 = load i32, ptr %8, align 4, !tbaa !5
  %185 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %183, ptr noundef @.str.7, i32 noundef %184) #4
  %186 = getelementptr inbounds %struct.BiTree_, ptr %6, i32 0, i32 3
  %187 = load ptr, ptr %186, align 8, !tbaa !13
  %188 = getelementptr inbounds %struct.BiTreeNode_, ptr %187, i32 0, i32 1
  %189 = load ptr, ptr %188, align 8, !tbaa !14
  %190 = getelementptr inbounds %struct.BiTreeNode_, ptr %189, i32 0, i32 2
  %191 = load ptr, ptr %190, align 8, !tbaa !16
  %192 = getelementptr inbounds %struct.BiTreeNode_, ptr %191, i32 0, i32 1
  %193 = load ptr, ptr %192, align 8, !tbaa !14
  %194 = icmp eq ptr %193, null
  br i1 %194, label %195, label %205

195:                                              ; preds = %180
  %196 = getelementptr inbounds %struct.BiTree_, ptr %6, i32 0, i32 3
  %197 = load ptr, ptr %196, align 8, !tbaa !13
  %198 = getelementptr inbounds %struct.BiTreeNode_, ptr %197, i32 0, i32 1
  %199 = load ptr, ptr %198, align 8, !tbaa !14
  %200 = getelementptr inbounds %struct.BiTreeNode_, ptr %199, i32 0, i32 2
  %201 = load ptr, ptr %200, align 8, !tbaa !16
  %202 = getelementptr inbounds %struct.BiTreeNode_, ptr %201, i32 0, i32 2
  %203 = load ptr, ptr %202, align 8, !tbaa !16
  %204 = icmp eq ptr %203, null
  br label %205

205:                                              ; preds = %195, %180
  %206 = phi i1 [ false, %180 ], [ %204, %195 ]
  %207 = zext i1 %206 to i32
  store i32 %207, ptr %8, align 4, !tbaa !5
  %208 = load ptr, ptr @stdout, align 8, !tbaa !9
  %209 = load i32, ptr %8, align 4, !tbaa !5
  %210 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %208, ptr noundef @.str.7, i32 noundef %209) #4
  %211 = load ptr, ptr @stdout, align 8, !tbaa !9
  %212 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %211, ptr noundef @.str) #4
  %213 = call i32 @insert_int(ptr noundef %6, i32 noundef 55)
  %214 = icmp ne i32 %213, 0
  br i1 %214, label %215, label %216

215:                                              ; preds = %205
  store i32 1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %247

216:                                              ; preds = %205
  %217 = call i32 @insert_int(ptr noundef %6, i32 noundef 44)
  %218 = icmp ne i32 %217, 0
  br i1 %218, label %219, label %220

219:                                              ; preds = %216
  store i32 1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %247

220:                                              ; preds = %216
  %221 = call i32 @insert_int(ptr noundef %6, i32 noundef 77)
  %222 = icmp ne i32 %221, 0
  br i1 %222, label %223, label %224

223:                                              ; preds = %220
  store i32 1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %247

224:                                              ; preds = %220
  %225 = call i32 @insert_int(ptr noundef %6, i32 noundef 11)
  %226 = icmp ne i32 %225, 0
  br i1 %226, label %227, label %228

227:                                              ; preds = %224
  store i32 1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %247

228:                                              ; preds = %224
  %229 = load ptr, ptr @stdout, align 8, !tbaa !9
  %230 = getelementptr inbounds %struct.BiTree_, ptr %6, i32 0, i32 0
  %231 = load i32, ptr %230, align 8, !tbaa !11
  %232 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %229, ptr noundef @.str.1, i32 noundef %231) #4
  %233 = load ptr, ptr @stdout, align 8, !tbaa !9
  %234 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %233, ptr noundef @.str.2) #4
  %235 = getelementptr inbounds %struct.BiTree_, ptr %6, i32 0, i32 3
  %236 = load ptr, ptr %235, align 8, !tbaa !13
  call void @print_preorder(ptr noundef %236)
  %237 = load ptr, ptr @stdout, align 8, !tbaa !9
  %238 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %237, ptr noundef @.str.8) #4
  %239 = getelementptr inbounds %struct.BiTree_, ptr %6, i32 0, i32 3
  %240 = load ptr, ptr %239, align 8, !tbaa !13
  call void @print_inorder(ptr noundef %240)
  %241 = load ptr, ptr @stdout, align 8, !tbaa !9
  %242 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %241, ptr noundef @.str.9) #4
  %243 = getelementptr inbounds %struct.BiTree_, ptr %6, i32 0, i32 3
  %244 = load ptr, ptr %243, align 8, !tbaa !13
  call void @print_postorder(ptr noundef %244)
  %245 = load ptr, ptr @stdout, align 8, !tbaa !9
  %246 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %245, ptr noundef @.str.10) #4
  call void @bitree_destroy(ptr noundef %6)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %247

247:                                              ; preds = %228, %227, %223, %219, %215, %50, %46, %42, %38, %34, %30, %26, %22, %18, %14
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #4
  %248 = load i32, ptr %3, align 4
  ret i32 %248
}

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

declare void @bitree_init(ptr noundef, ptr noundef) #2

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

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

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

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

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

declare void @bitree_rem_left(ptr noundef, ptr noundef) #2

declare void @bitree_rem_right(ptr noundef, ptr noundef) #2

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

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

declare void @bitree_destroy(ptr noundef) #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 = { 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 }

!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, !6, i64 0}
!12 = !{!"BiTree_", !6, i64 0, !10, i64 8, !10, i64 16, !10, i64 24}
!13 = !{!12, !10, i64 24}
!14 = !{!15, !10, i64 8}
!15 = !{!"BiTreeNode_", !10, i64 0, !10, i64 8, !10, i64 16}
!16 = !{!15, !10, i64 16}


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

@stdout = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [22 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [21 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @main(i32 noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #0 {
  %3 = alloca %struct.BiTree_, align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #5
  call void @bitree_init(ptr noundef nonnull %3, ptr noundef nonnull @free) #5
  %4 = load ptr, ptr @stdout, align 8, !tbaa !5
  %5 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %4, ptr noundef nonnull @.str) #5
  %6 = call i32 @insert_int(ptr noundef nonnull %3, i32 noundef 20)
  %.not = icmp eq i32 %6, 0
  br i1 %.not, label %7, label %161

7:                                                ; preds = %2
  %8 = call i32 @insert_int(ptr noundef nonnull %3, i32 noundef 10)
  %.not19 = icmp eq i32 %8, 0
  br i1 %.not19, label %9, label %161

9:                                                ; preds = %7
  %10 = call i32 @insert_int(ptr noundef nonnull %3, i32 noundef 30)
  %.not20 = icmp eq i32 %10, 0
  br i1 %.not20, label %11, label %161

11:                                               ; preds = %9
  %12 = call i32 @insert_int(ptr noundef nonnull %3, i32 noundef 15)
  %.not21 = icmp eq i32 %12, 0
  br i1 %.not21, label %13, label %161

13:                                               ; preds = %11
  %14 = call i32 @insert_int(ptr noundef nonnull %3, i32 noundef 25)
  %.not22 = icmp eq i32 %14, 0
  br i1 %.not22, label %15, label %161

15:                                               ; preds = %13
  %16 = call i32 @insert_int(ptr noundef nonnull %3, i32 noundef 70)
  %.not23 = icmp eq i32 %16, 0
  br i1 %.not23, label %17, label %161

17:                                               ; preds = %15
  %18 = call i32 @insert_int(ptr noundef nonnull %3, i32 noundef 80)
  %.not24 = icmp eq i32 %18, 0
  br i1 %.not24, label %19, label %161

19:                                               ; preds = %17
  %20 = call i32 @insert_int(ptr noundef nonnull %3, i32 noundef 23)
  %.not25 = icmp eq i32 %20, 0
  br i1 %.not25, label %21, label %161

21:                                               ; preds = %19
  %22 = call i32 @insert_int(ptr noundef nonnull %3, i32 noundef 26)
  %.not26 = icmp eq i32 %22, 0
  br i1 %.not26, label %23, label %161

23:                                               ; preds = %21
  %24 = call i32 @insert_int(ptr noundef nonnull %3, i32 noundef 5)
  %.not27 = icmp eq i32 %24, 0
  br i1 %.not27, label %25, label %161

25:                                               ; preds = %23
  %26 = load ptr, ptr @stdout, align 8, !tbaa !5
  %27 = load i32, ptr %3, align 8, !tbaa !9
  %28 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %26, ptr noundef nonnull @.str.1, i32 noundef %27) #5
  %29 = load ptr, ptr @stdout, align 8, !tbaa !5
  %30 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %29, ptr noundef nonnull @.str.2) #5
  %31 = getelementptr inbounds i8, ptr %3, i64 24
  %32 = load ptr, ptr %31, align 8, !tbaa !12
  call void @print_preorder(ptr noundef %32)
  %33 = call ptr @search_int(ptr noundef nonnull %3, i32 noundef 30)
  %34 = icmp eq ptr %33, null
  %35 = load ptr, ptr @stdout, align 8, !tbaa !5
  br i1 %34, label %36, label %38

36:                                               ; preds = %25
  %37 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %35, ptr noundef nonnull @.str.3, i32 noundef 30) #5
  br label %46

38:                                               ; preds = %25
  %39 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %35, ptr noundef nonnull @.str.4, i32 noundef 30) #5
  call void @bitree_rem_left(ptr noundef nonnull %3, ptr noundef nonnull %33) #5
  %40 = load ptr, ptr @stdout, align 8, !tbaa !5
  %41 = load i32, ptr %3, align 8, !tbaa !9
  %42 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %40, ptr noundef nonnull @.str.1, i32 noundef %41) #5
  %43 = load ptr, ptr @stdout, align 8, !tbaa !5
  %44 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %43, ptr noundef nonnull @.str.2) #5
  %45 = load ptr, ptr %31, align 8, !tbaa !12
  call void @print_preorder(ptr noundef %45)
  br label %46

46:                                               ; preds = %38, %36
  %47 = call ptr @search_int(ptr noundef nonnull %3, i32 noundef 99)
  %48 = icmp eq ptr %47, null
  %49 = load ptr, ptr @stdout, align 8, !tbaa !5
  br i1 %48, label %50, label %52

50:                                               ; preds = %46
  %51 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %49, ptr noundef nonnull @.str.3, i32 noundef 99) #5
  br label %60

52:                                               ; preds = %46
  %53 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %49, ptr noundef nonnull @.str.5, i32 noundef 99) #5
  call void @bitree_rem_right(ptr noundef nonnull %3, ptr noundef nonnull %47) #5
  %54 = load ptr, ptr @stdout, align 8, !tbaa !5
  %55 = load i32, ptr %3, align 8, !tbaa !9
  %56 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %54, ptr noundef nonnull @.str.1, i32 noundef %55) #5
  %57 = load ptr, ptr @stdout, align 8, !tbaa !5
  %58 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %57, ptr noundef nonnull @.str.2) #5
  %59 = load ptr, ptr %31, align 8, !tbaa !12
  call void @print_preorder(ptr noundef %59)
  br label %60

60:                                               ; preds = %52, %50
  %61 = call ptr @search_int(ptr noundef nonnull %3, i32 noundef 20)
  %62 = icmp eq ptr %61, null
  %63 = load ptr, ptr @stdout, align 8, !tbaa !5
  br i1 %62, label %64, label %66

64:                                               ; preds = %60
  %65 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %63, ptr noundef nonnull @.str.3, i32 noundef 20) #5
  br label %74

66:                                               ; preds = %60
  %67 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %63, ptr noundef nonnull @.str.5, i32 noundef 20) #5
  call void @bitree_rem_right(ptr noundef nonnull %3, ptr noundef nonnull %61) #5
  %68 = load ptr, ptr @stdout, align 8, !tbaa !5
  %69 = load i32, ptr %3, align 8, !tbaa !9
  %70 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %68, ptr noundef nonnull @.str.1, i32 noundef %69) #5
  %71 = load ptr, ptr @stdout, align 8, !tbaa !5
  %72 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %71, ptr noundef nonnull @.str.2) #5
  %73 = load ptr, ptr %31, align 8, !tbaa !12
  call void @print_preorder(ptr noundef %73)
  br label %74

74:                                               ; preds = %66, %64
  %75 = load ptr, ptr %31, align 8, !tbaa !12
  %76 = getelementptr inbounds i8, ptr %75, i64 8
  %77 = load ptr, ptr %76, align 8, !tbaa !13
  %78 = icmp eq ptr %77, null
  br i1 %78, label %79, label %84

79:                                               ; preds = %74
  %80 = getelementptr inbounds i8, ptr %75, i64 16
  %81 = load ptr, ptr %80, align 8, !tbaa !15
  %82 = icmp eq ptr %81, null
  %83 = zext i1 %82 to i32
  br label %84

84:                                               ; preds = %79, %74
  %85 = phi i32 [ 0, %74 ], [ %83, %79 ]
  %86 = load ptr, ptr @stdout, align 8, !tbaa !5
  %87 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %86, ptr noundef nonnull @.str.6, i32 noundef %85) #5
  %88 = load ptr, ptr %31, align 8, !tbaa !12
  %89 = getelementptr inbounds i8, ptr %88, i64 8
  %90 = load ptr, ptr %89, align 8, !tbaa !13
  %91 = getelementptr inbounds i8, ptr %90, i64 8
  %92 = load ptr, ptr %91, align 8, !tbaa !13
  %93 = icmp eq ptr %92, null
  br i1 %93, label %94, label %99

94:                                               ; preds = %84
  %95 = getelementptr inbounds i8, ptr %90, i64 16
  %96 = load ptr, ptr %95, align 8, !tbaa !15
  %97 = icmp eq ptr %96, null
  %98 = zext i1 %97 to i32
  br label %99

99:                                               ; preds = %94, %84
  %100 = phi i32 [ 0, %84 ], [ %98, %94 ]
  %101 = load ptr, ptr @stdout, align 8, !tbaa !5
  %102 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %101, ptr noundef nonnull @.str.6, i32 noundef %100) #5
  %103 = load ptr, ptr %31, align 8, !tbaa !12
  %104 = getelementptr inbounds i8, ptr %103, i64 8
  %105 = load ptr, ptr %104, align 8, !tbaa !13
  %106 = getelementptr inbounds i8, ptr %105, i64 8
  %107 = load ptr, ptr %106, align 8, !tbaa !13
  %108 = getelementptr inbounds i8, ptr %107, i64 8
  %109 = load ptr, ptr %108, align 8, !tbaa !13
  %110 = icmp eq ptr %109, null
  br i1 %110, label %111, label %116

111:                                              ; preds = %99
  %112 = getelementptr inbounds i8, ptr %107, i64 16
  %113 = load ptr, ptr %112, align 8, !tbaa !15
  %114 = icmp eq ptr %113, null
  %115 = zext i1 %114 to i32
  br label %116

116:                                              ; preds = %111, %99
  %117 = phi i32 [ 0, %99 ], [ %115, %111 ]
  %118 = load ptr, ptr @stdout, align 8, !tbaa !5
  %119 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %118, ptr noundef nonnull @.str.7, i32 noundef %117) #5
  %120 = load ptr, ptr %31, align 8, !tbaa !12
  %121 = getelementptr inbounds i8, ptr %120, i64 8
  %122 = load ptr, ptr %121, align 8, !tbaa !13
  %123 = getelementptr inbounds i8, ptr %122, i64 16
  %124 = load ptr, ptr %123, align 8, !tbaa !15
  %125 = getelementptr inbounds i8, ptr %124, i64 8
  %126 = load ptr, ptr %125, align 8, !tbaa !13
  %127 = icmp eq ptr %126, null
  br i1 %127, label %128, label %133

128:                                              ; preds = %116
  %129 = getelementptr inbounds i8, ptr %124, i64 16
  %130 = load ptr, ptr %129, align 8, !tbaa !15
  %131 = icmp eq ptr %130, null
  %132 = zext i1 %131 to i32
  br label %133

133:                                              ; preds = %128, %116
  %134 = phi i32 [ 0, %116 ], [ %132, %128 ]
  %135 = load ptr, ptr @stdout, align 8, !tbaa !5
  %136 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %135, ptr noundef nonnull @.str.7, i32 noundef %134) #5
  %137 = load ptr, ptr @stdout, align 8, !tbaa !5
  %138 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %137, ptr noundef nonnull @.str) #5
  %139 = call i32 @insert_int(ptr noundef nonnull %3, i32 noundef 55)
  %.not28 = icmp eq i32 %139, 0
  br i1 %.not28, label %140, label %161

140:                                              ; preds = %133
  %141 = call i32 @insert_int(ptr noundef nonnull %3, i32 noundef 44)
  %.not29 = icmp eq i32 %141, 0
  br i1 %.not29, label %142, label %161

142:                                              ; preds = %140
  %143 = call i32 @insert_int(ptr noundef nonnull %3, i32 noundef 77)
  %.not30 = icmp eq i32 %143, 0
  br i1 %.not30, label %144, label %161

144:                                              ; preds = %142
  %145 = call i32 @insert_int(ptr noundef nonnull %3, i32 noundef 11)
  %.not31 = icmp eq i32 %145, 0
  br i1 %.not31, label %146, label %161

146:                                              ; preds = %144
  %147 = load ptr, ptr @stdout, align 8, !tbaa !5
  %148 = load i32, ptr %3, align 8, !tbaa !9
  %149 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %147, ptr noundef nonnull @.str.1, i32 noundef %148) #5
  %150 = load ptr, ptr @stdout, align 8, !tbaa !5
  %151 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %150, ptr noundef nonnull @.str.2) #5
  %152 = load ptr, ptr %31, align 8, !tbaa !12
  call void @print_preorder(ptr noundef %152)
  %153 = load ptr, ptr @stdout, align 8, !tbaa !5
  %154 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %153, ptr noundef nonnull @.str.8) #5
  %155 = load ptr, ptr %31, align 8, !tbaa !12
  call void @print_inorder(ptr noundef %155)
  %156 = load ptr, ptr @stdout, align 8, !tbaa !5
  %157 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %156, ptr noundef nonnull @.str.9) #5
  %158 = load ptr, ptr %31, align 8, !tbaa !12
  call void @print_postorder(ptr noundef %158)
  %159 = load ptr, ptr @stdout, align 8, !tbaa !5
  %160 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %159, ptr noundef nonnull @.str.10) #5
  call void @bitree_destroy(ptr noundef nonnull %3) #5
  br label %161

161:                                              ; preds = %144, %142, %140, %133, %23, %21, %19, %17, %15, %13, %11, %9, %7, %2, %146
  %.0 = phi i32 [ 0, %146 ], [ 1, %2 ], [ 1, %7 ], [ 1, %9 ], [ 1, %11 ], [ 1, %13 ], [ 1, %15 ], [ 1, %17 ], [ 1, %19 ], [ 1, %21 ], [ 1, %23 ], [ 1, %133 ], [ 1, %140 ], [ 1, %142 ], [ 1, %144 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #5
  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

declare void @bitree_init(ptr noundef, ptr noundef) local_unnamed_addr #2

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

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

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

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

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

declare void @bitree_rem_left(ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @bitree_rem_right(ptr noundef, ptr noundef) local_unnamed_addr #2

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

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

declare void @bitree_destroy(ptr noundef) 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

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 = { "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 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 #4 = { 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 #5 = { 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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"BiTree_", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !6, i64 24}
!13 = !{!14, !6, i64 8}
!14 = !{!"BiTreeNode_", !6, i64 0, !6, i64 8, !6, i64 16}
!15 = !{!14, !6, i64 16}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass