; LLVM IR from yourtion/LearningMasteringAlgorithms-C :: Example/heap (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.Heap_ = type { i32, ptr, ptr, ptr }

@stdout = external global ptr, align 8
@.str = external hidden unnamed_addr constant [16 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.2 = 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.Heap_, align 8
  %7 = alloca ptr, align 8
  %8 = alloca [30 x i32], align 16
  %9 = alloca i32, align 4
  %10 = 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 120, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  call void @heap_init(ptr noundef %6, ptr noundef @compare_int, ptr noundef null)
  store i32 0, ptr %9, align 4, !tbaa !5
  %11 = load i32, ptr %9, align 4, !tbaa !5
  %12 = sext i32 %11 to i64
  %13 = getelementptr inbounds [30 x i32], ptr %8, i64 0, i64 %12
  store i32 5, ptr %13, align 4, !tbaa !5
  %14 = load ptr, ptr @stdout, align 8, !tbaa !9
  %15 = load i32, ptr %9, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [30 x i32], ptr %8, i64 0, i64 %16
  %18 = load i32, ptr %17, align 4, !tbaa !5
  %19 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %14, ptr noundef @.str, i32 noundef %18) #4
  %20 = load i32, ptr %9, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [30 x i32], ptr %8, i64 0, i64 %21
  %23 = call i32 @heap_insert(ptr noundef %6, ptr noundef %22)
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %25, label %26

25:                                               ; preds = %2
  store i32 1, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %153

26:                                               ; preds = %2
  call void @print_heap(ptr noundef %6)
  %27 = load i32, ptr %9, align 4, !tbaa !5
  %28 = add nsw i32 %27, 1
  store i32 %28, ptr %9, align 4, !tbaa !5
  %29 = load i32, ptr %9, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [30 x i32], ptr %8, i64 0, i64 %30
  store i32 10, ptr %31, align 4, !tbaa !5
  %32 = load ptr, ptr @stdout, align 8, !tbaa !9
  %33 = load i32, ptr %9, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [30 x i32], ptr %8, i64 0, i64 %34
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %37 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %32, ptr noundef @.str, i32 noundef %36) #4
  %38 = load i32, ptr %9, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [30 x i32], ptr %8, i64 0, i64 %39
  %41 = call i32 @heap_insert(ptr noundef %6, ptr noundef %40)
  %42 = icmp ne i32 %41, 0
  br i1 %42, label %43, label %44

43:                                               ; preds = %26
  store i32 1, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %153

44:                                               ; preds = %26
  call void @print_heap(ptr noundef %6)
  %45 = load i32, ptr %9, align 4, !tbaa !5
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %9, align 4, !tbaa !5
  %47 = load i32, ptr %9, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [30 x i32], ptr %8, i64 0, i64 %48
  store i32 20, ptr %49, align 4, !tbaa !5
  %50 = load ptr, ptr @stdout, align 8, !tbaa !9
  %51 = load i32, ptr %9, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [30 x i32], ptr %8, i64 0, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %50, ptr noundef @.str, i32 noundef %54) #4
  %56 = load i32, ptr %9, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [30 x i32], ptr %8, i64 0, i64 %57
  %59 = call i32 @heap_insert(ptr noundef %6, ptr noundef %58)
  %60 = icmp ne i32 %59, 0
  br i1 %60, label %61, label %62

61:                                               ; preds = %44
  store i32 1, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %153

62:                                               ; preds = %44
  call void @print_heap(ptr noundef %6)
  %63 = load i32, ptr %9, align 4, !tbaa !5
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %9, align 4, !tbaa !5
  %65 = load i32, ptr %9, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [30 x i32], ptr %8, i64 0, i64 %66
  store i32 1, ptr %67, align 4, !tbaa !5
  %68 = load ptr, ptr @stdout, align 8, !tbaa !9
  %69 = load i32, ptr %9, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [30 x i32], ptr %8, i64 0, i64 %70
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %68, ptr noundef @.str, i32 noundef %72) #4
  %74 = load i32, ptr %9, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [30 x i32], ptr %8, i64 0, i64 %75
  %77 = call i32 @heap_insert(ptr noundef %6, ptr noundef %76)
  %78 = icmp ne i32 %77, 0
  br i1 %78, label %79, label %80

79:                                               ; preds = %62
  store i32 1, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %153

80:                                               ; preds = %62
  call void @print_heap(ptr noundef %6)
  %81 = load i32, ptr %9, align 4, !tbaa !5
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %9, align 4, !tbaa !5
  %83 = load i32, ptr %9, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [30 x i32], ptr %8, i64 0, i64 %84
  store i32 25, ptr %85, align 4, !tbaa !5
  %86 = load ptr, ptr @stdout, align 8, !tbaa !9
  %87 = load i32, ptr %9, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [30 x i32], ptr %8, i64 0, i64 %88
  %90 = load i32, ptr %89, align 4, !tbaa !5
  %91 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %86, ptr noundef @.str, i32 noundef %90) #4
  %92 = load i32, ptr %9, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [30 x i32], ptr %8, i64 0, i64 %93
  %95 = call i32 @heap_insert(ptr noundef %6, ptr noundef %94)
  %96 = icmp ne i32 %95, 0
  br i1 %96, label %97, label %98

97:                                               ; preds = %80
  store i32 1, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %153

98:                                               ; preds = %80
  call void @print_heap(ptr noundef %6)
  %99 = load i32, ptr %9, align 4, !tbaa !5
  %100 = add nsw i32 %99, 1
  store i32 %100, ptr %9, align 4, !tbaa !5
  %101 = load i32, ptr %9, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [30 x i32], ptr %8, i64 0, i64 %102
  store i32 22, ptr %103, align 4, !tbaa !5
  %104 = load ptr, ptr @stdout, align 8, !tbaa !9
  %105 = load i32, ptr %9, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [30 x i32], ptr %8, i64 0, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %104, ptr noundef @.str, i32 noundef %108) #4
  %110 = load i32, ptr %9, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [30 x i32], ptr %8, i64 0, i64 %111
  %113 = call i32 @heap_insert(ptr noundef %6, ptr noundef %112)
  %114 = icmp ne i32 %113, 0
  br i1 %114, label %115, label %116

115:                                              ; preds = %98
  store i32 1, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %153

116:                                              ; preds = %98
  call void @print_heap(ptr noundef %6)
  %117 = load i32, ptr %9, align 4, !tbaa !5
  %118 = add nsw i32 %117, 1
  store i32 %118, ptr %9, align 4, !tbaa !5
  %119 = load i32, ptr %9, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [30 x i32], ptr %8, i64 0, i64 %120
  store i32 9, ptr %121, align 4, !tbaa !5
  %122 = load ptr, ptr @stdout, align 8, !tbaa !9
  %123 = load i32, ptr %9, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [30 x i32], ptr %8, i64 0, i64 %124
  %126 = load i32, ptr %125, align 4, !tbaa !5
  %127 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %122, ptr noundef @.str, i32 noundef %126) #4
  %128 = load i32, ptr %9, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [30 x i32], ptr %8, i64 0, i64 %129
  %131 = call i32 @heap_insert(ptr noundef %6, ptr noundef %130)
  %132 = icmp ne i32 %131, 0
  br i1 %132, label %133, label %134

133:                                              ; preds = %116
  store i32 1, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %153

134:                                              ; preds = %116
  call void @print_heap(ptr noundef %6)
  %135 = load i32, ptr %9, align 4, !tbaa !5
  %136 = add nsw i32 %135, 1
  store i32 %136, ptr %9, align 4, !tbaa !5
  br label %137

137:                                              ; preds = %145, %134
  %138 = getelementptr inbounds %struct.Heap_, ptr %6, i32 0, i32 0
  %139 = load i32, ptr %138, align 8, !tbaa !11
  %140 = icmp sgt i32 %139, 0
  br i1 %140, label %141, label %150

141:                                              ; preds = %137
  %142 = call i32 @heap_extract(ptr noundef %6, ptr noundef %7)
  %143 = icmp ne i32 %142, 0
  br i1 %143, label %144, label %145

144:                                              ; preds = %141
  store i32 1, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %153

145:                                              ; preds = %141
  %146 = load ptr, ptr @stdout, align 8, !tbaa !9
  %147 = load ptr, ptr %7, align 8, !tbaa !9
  %148 = load i32, ptr %147, align 4, !tbaa !5
  %149 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %146, ptr noundef @.str.1, i32 noundef %148) #4
  call void @print_heap(ptr noundef %6)
  br label %137, !llvm.loop !13

150:                                              ; preds = %137
  %151 = load ptr, ptr @stdout, align 8, !tbaa !9
  %152 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %151, ptr noundef @.str.2) #4
  call void @heap_destroy(ptr noundef %6)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %153

153:                                              ; preds = %150, %144, %133, %115, %97, %79, %61, %43, %25
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 120, 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
  %154 = load i32, ptr %3, align 4
  ret i32 %154
}

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

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

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

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

declare i32 @heap_insert(ptr noundef, ptr noundef) #2

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

declare i32 @heap_extract(ptr noundef, ptr noundef) #2

declare void @heap_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 = !{!"Heap_", !6, i64 0, !10, i64 8, !10, i64 16, !10, i64 24}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

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

@stdout = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [16 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.2 = 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.Heap_, align 8
  %4 = alloca ptr, align 8
  %5 = alloca [30 x i32], align 16
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %5) #4
  call void @heap_init(ptr noundef nonnull %3, ptr noundef nonnull @compare_int, ptr noundef null) #4
  store i32 5, ptr %5, align 16, !tbaa !5
  %6 = load ptr, ptr @stdout, align 8, !tbaa !9
  %7 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %6, ptr noundef nonnull @.str, i32 noundef 5) #4
  %8 = call i32 @heap_insert(ptr noundef nonnull %3, ptr noundef nonnull %5) #4
  %.not = icmp eq i32 %8, 0
  br i1 %.not, label %9, label %.loopexit

9:                                                ; preds = %2
  call void @print_heap(ptr noundef nonnull %3)
  %10 = getelementptr inbounds i8, ptr %5, i64 4
  store i32 10, ptr %10, align 4, !tbaa !5
  %11 = load ptr, ptr @stdout, align 8, !tbaa !9
  %12 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %11, ptr noundef nonnull @.str, i32 noundef 10) #4
  %13 = call i32 @heap_insert(ptr noundef nonnull %3, ptr noundef nonnull %10) #4
  %.not29 = icmp eq i32 %13, 0
  br i1 %.not29, label %14, label %.loopexit

14:                                               ; preds = %9
  call void @print_heap(ptr noundef nonnull %3)
  %15 = getelementptr inbounds i8, ptr %5, i64 8
  store i32 20, ptr %15, align 8, !tbaa !5
  %16 = load ptr, ptr @stdout, align 8, !tbaa !9
  %17 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %16, ptr noundef nonnull @.str, i32 noundef 20) #4
  %18 = call i32 @heap_insert(ptr noundef nonnull %3, ptr noundef nonnull %15) #4
  %.not30 = icmp eq i32 %18, 0
  br i1 %.not30, label %19, label %.loopexit

19:                                               ; preds = %14
  call void @print_heap(ptr noundef nonnull %3)
  %20 = getelementptr inbounds i8, ptr %5, i64 12
  store i32 1, ptr %20, align 4, !tbaa !5
  %21 = load ptr, ptr @stdout, align 8, !tbaa !9
  %22 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %21, ptr noundef nonnull @.str, i32 noundef 1) #4
  %23 = call i32 @heap_insert(ptr noundef nonnull %3, ptr noundef nonnull %20) #4
  %.not31 = icmp eq i32 %23, 0
  br i1 %.not31, label %24, label %.loopexit

24:                                               ; preds = %19
  call void @print_heap(ptr noundef nonnull %3)
  %25 = getelementptr inbounds i8, ptr %5, i64 16
  store i32 25, ptr %25, align 16, !tbaa !5
  %26 = load ptr, ptr @stdout, align 8, !tbaa !9
  %27 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %26, ptr noundef nonnull @.str, i32 noundef 25) #4
  %28 = call i32 @heap_insert(ptr noundef nonnull %3, ptr noundef nonnull %25) #4
  %.not32 = icmp eq i32 %28, 0
  br i1 %.not32, label %29, label %.loopexit

29:                                               ; preds = %24
  call void @print_heap(ptr noundef nonnull %3)
  %30 = getelementptr inbounds i8, ptr %5, i64 20
  store i32 22, ptr %30, align 4, !tbaa !5
  %31 = load ptr, ptr @stdout, align 8, !tbaa !9
  %32 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %31, ptr noundef nonnull @.str, i32 noundef 22) #4
  %33 = call i32 @heap_insert(ptr noundef nonnull %3, ptr noundef nonnull %30) #4
  %.not33 = icmp eq i32 %33, 0
  br i1 %.not33, label %34, label %.loopexit

34:                                               ; preds = %29
  call void @print_heap(ptr noundef nonnull %3)
  %35 = getelementptr inbounds i8, ptr %5, i64 24
  store i32 9, ptr %35, align 8, !tbaa !5
  %36 = load ptr, ptr @stdout, align 8, !tbaa !9
  %37 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %36, ptr noundef nonnull @.str, i32 noundef 9) #4
  %38 = call i32 @heap_insert(ptr noundef nonnull %3, ptr noundef nonnull %35) #4
  %.not34 = icmp eq i32 %38, 0
  br i1 %.not34, label %39, label %.loopexit

39:                                               ; preds = %34
  call void @print_heap(ptr noundef nonnull %3)
  %40 = load i32, ptr %3, align 8, !tbaa !11
  %41 = icmp sgt i32 %40, 0
  br i1 %41, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %39, %43
  %42 = call i32 @heap_extract(ptr noundef nonnull %3, ptr noundef nonnull %4) #4
  %.not35 = icmp eq i32 %42, 0
  br i1 %.not35, label %43, label %.loopexit

43:                                               ; preds = %.lr.ph
  %44 = load ptr, ptr @stdout, align 8, !tbaa !9
  %45 = load ptr, ptr %4, align 8, !tbaa !9
  %46 = load i32, ptr %45, align 4, !tbaa !5
  %47 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %44, ptr noundef nonnull @.str.1, i32 noundef %46) #4
  call void @print_heap(ptr noundef nonnull %3)
  %48 = load i32, ptr %3, align 8, !tbaa !11
  %49 = icmp sgt i32 %48, 0
  br i1 %49, label %.lr.ph, label %._crit_edge, !llvm.loop !13

._crit_edge:                                      ; preds = %43, %39
  %50 = load ptr, ptr @stdout, align 8, !tbaa !9
  %51 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %50, ptr noundef nonnull @.str.2) #4
  call void @heap_destroy(ptr noundef nonnull %3) #4
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph, %34, %29, %24, %19, %14, %9, %2, %._crit_edge
  %.0 = phi i32 [ 0, %._crit_edge ], [ 1, %2 ], [ 1, %9 ], [ 1, %14 ], [ 1, %19 ], [ 1, %24 ], [ 1, %29 ], [ 1, %34 ], [ 1, %.lr.ph ]
  call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #4
  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 @heap_init(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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

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

declare i32 @heap_insert(ptr noundef, ptr noundef) local_unnamed_addr #2

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

declare i32 @heap_extract(ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @heap_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 = { 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 #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 = !{!"Heap_", !6, i64 0, !10, i64 8, !10, i64 16, !10, i64 24}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


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