; LLVM IR from hutusi/rethink-c :: test (test_heap)

; 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 { ptr, ptr, ptr, i32, i32, i32 }

@__const.test_heap.arr = external hidden unnamed_addr constant [20 x i32], align 16
@.str = external hidden unnamed_addr constant [34 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [67 x i8], align 1
@__PRETTY_FUNCTION__.test_heap = external hidden unnamed_addr constant [17 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [28 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @test_heap() #0 {
  %1 = alloca [20 x i32], align 16
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 80, ptr %1) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %1, ptr align 16 @__const.test_heap.arr, i64 80, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #5
  %6 = call ptr @heap_new(i32 noundef 1, ptr noundef @int_compare, ptr noundef null)
  store ptr %6, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 20, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %7

7:                                                ; preds = %22, %0
  %8 = load i32, ptr %4, align 4, !tbaa !9
  %9 = load i32, ptr %3, align 4, !tbaa !9
  %10 = icmp slt i32 %8, %9
  br i1 %10, label %12, label %11

11:                                               ; preds = %7
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %25

12:                                               ; preds = %7
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  %14 = load i32, ptr %4, align 4, !tbaa !9
  %15 = sext i32 %14 to i64
  %16 = getelementptr inbounds [20 x i32], ptr %1, i64 0, i64 %15
  %17 = call i32 @heap_insert(ptr noundef %13, ptr noundef %16)
  %18 = icmp eq i32 %17, 0
  br i1 %18, label %19, label %20

19:                                               ; preds = %12
  br label %21

20:                                               ; preds = %12
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 17, ptr noundef @__PRETTY_FUNCTION__.test_heap) #6
  unreachable

21:                                               ; preds = %19
  br label %22

22:                                               ; preds = %21
  %23 = load i32, ptr %4, align 4, !tbaa !9
  %24 = add nsw i32 %23, 1
  store i32 %24, ptr %4, align 4, !tbaa !9
  br label %7, !llvm.loop !11

25:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 20, ptr %5, align 4, !tbaa !9
  br label %26

26:                                               ; preds = %47, %25
  %27 = load i32, ptr %5, align 4, !tbaa !9
  %28 = icmp sge i32 %27, 1
  br i1 %28, label %30, label %29

29:                                               ; preds = %26
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %50

30:                                               ; preds = %26
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct._Heap, ptr %31, i32 0, i32 4
  %33 = load i32, ptr %32, align 4, !tbaa !13
  %34 = load i32, ptr %5, align 4, !tbaa !9
  %35 = icmp eq i32 %33, %34
  br i1 %35, label %36, label %37

36:                                               ; preds = %30
  br label %38

37:                                               ; preds = %30
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 25, ptr noundef @__PRETTY_FUNCTION__.test_heap) #6
  unreachable

38:                                               ; preds = %36
  %39 = load ptr, ptr %2, align 8, !tbaa !5
  %40 = call ptr @heap_pop(ptr noundef %39)
  %41 = load i32, ptr %40, align 4, !tbaa !9
  %42 = load i32, ptr %5, align 4, !tbaa !9
  %43 = icmp eq i32 %41, %42
  br i1 %43, label %44, label %45

44:                                               ; preds = %38
  br label %46

45:                                               ; preds = %38
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 26, ptr noundef @__PRETTY_FUNCTION__.test_heap) #6
  unreachable

46:                                               ; preds = %44
  br label %47

47:                                               ; preds = %46
  %48 = load i32, ptr %5, align 4, !tbaa !9
  %49 = add nsw i32 %48, -1
  store i32 %49, ptr %5, align 4, !tbaa !9
  br label %26, !llvm.loop !15

50:                                               ; preds = %29
  %51 = load ptr, ptr %2, align 8, !tbaa !5
  call void @heap_free(ptr noundef %51)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr %1) #5
  ret void
}

; 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

declare ptr @heap_new(i32 noundef, ptr noundef, ptr noundef) #3

declare i32 @int_compare(ptr noundef, ptr noundef) #3

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #4

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

declare ptr @heap_pop(ptr noundef) #3

declare void @heap_free(ptr noundef) #3

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
attributes #6 = { noreturn 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !10, i64 28}
!14 = !{!"_Heap", !6, i64 0, !6, i64 8, !6, i64 16, !10, i64 24, !10, i64 28, !10, i64 32}
!15 = distinct !{!15, !12}


; 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"

@__const.test_heap.arr = external hidden unnamed_addr constant [20 x i32], align 16
@.str = external hidden unnamed_addr constant [34 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [67 x i8], align 1
@__PRETTY_FUNCTION__.test_heap = external hidden unnamed_addr constant [17 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [28 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @test_heap() local_unnamed_addr #0 {
  %1 = alloca [20 x i32], align 16
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %1) #5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(80) %1, ptr noundef nonnull align 16 dereferenceable(80) @__const.test_heap.arr, i64 80, i1 false)
  %2 = tail call ptr @heap_new(i32 noundef 1, ptr noundef nonnull @int_compare, ptr noundef null) #5
  %3 = call i32 @heap_insert(ptr noundef %2, ptr noundef nonnull %1) #5
  %4 = icmp eq i32 %3, 0
  br i1 %4, label %5, label %84

5:                                                ; preds = %0
  %6 = getelementptr inbounds i8, ptr %1, i64 4
  %7 = call i32 @heap_insert(ptr noundef %2, ptr noundef nonnull %6) #5
  %8 = icmp eq i32 %7, 0
  br i1 %8, label %9, label %84

9:                                                ; preds = %5
  %10 = getelementptr inbounds i8, ptr %1, i64 8
  %11 = call i32 @heap_insert(ptr noundef %2, ptr noundef nonnull %10) #5
  %12 = icmp eq i32 %11, 0
  br i1 %12, label %13, label %84

13:                                               ; preds = %9
  %14 = getelementptr inbounds i8, ptr %1, i64 12
  %15 = call i32 @heap_insert(ptr noundef %2, ptr noundef nonnull %14) #5
  %16 = icmp eq i32 %15, 0
  br i1 %16, label %17, label %84

17:                                               ; preds = %13
  %18 = getelementptr inbounds i8, ptr %1, i64 16
  %19 = call i32 @heap_insert(ptr noundef %2, ptr noundef nonnull %18) #5
  %20 = icmp eq i32 %19, 0
  br i1 %20, label %21, label %84

21:                                               ; preds = %17
  %22 = getelementptr inbounds i8, ptr %1, i64 20
  %23 = call i32 @heap_insert(ptr noundef %2, ptr noundef nonnull %22) #5
  %24 = icmp eq i32 %23, 0
  br i1 %24, label %25, label %84

25:                                               ; preds = %21
  %26 = getelementptr inbounds i8, ptr %1, i64 24
  %27 = call i32 @heap_insert(ptr noundef %2, ptr noundef nonnull %26) #5
  %28 = icmp eq i32 %27, 0
  br i1 %28, label %29, label %84

29:                                               ; preds = %25
  %30 = getelementptr inbounds i8, ptr %1, i64 28
  %31 = call i32 @heap_insert(ptr noundef %2, ptr noundef nonnull %30) #5
  %32 = icmp eq i32 %31, 0
  br i1 %32, label %33, label %84

33:                                               ; preds = %29
  %34 = getelementptr inbounds i8, ptr %1, i64 32
  %35 = call i32 @heap_insert(ptr noundef %2, ptr noundef nonnull %34) #5
  %36 = icmp eq i32 %35, 0
  br i1 %36, label %37, label %84

37:                                               ; preds = %33
  %38 = getelementptr inbounds i8, ptr %1, i64 36
  %39 = call i32 @heap_insert(ptr noundef %2, ptr noundef nonnull %38) #5
  %40 = icmp eq i32 %39, 0
  br i1 %40, label %41, label %84

41:                                               ; preds = %37
  %42 = getelementptr inbounds i8, ptr %1, i64 40
  %43 = call i32 @heap_insert(ptr noundef %2, ptr noundef nonnull %42) #5
  %44 = icmp eq i32 %43, 0
  br i1 %44, label %45, label %84

45:                                               ; preds = %41
  %46 = getelementptr inbounds i8, ptr %1, i64 44
  %47 = call i32 @heap_insert(ptr noundef %2, ptr noundef nonnull %46) #5
  %48 = icmp eq i32 %47, 0
  br i1 %48, label %49, label %84

49:                                               ; preds = %45
  %50 = getelementptr inbounds i8, ptr %1, i64 48
  %51 = call i32 @heap_insert(ptr noundef %2, ptr noundef nonnull %50) #5
  %52 = icmp eq i32 %51, 0
  br i1 %52, label %53, label %84

53:                                               ; preds = %49
  %54 = getelementptr inbounds i8, ptr %1, i64 52
  %55 = call i32 @heap_insert(ptr noundef %2, ptr noundef nonnull %54) #5
  %56 = icmp eq i32 %55, 0
  br i1 %56, label %57, label %84

57:                                               ; preds = %53
  %58 = getelementptr inbounds i8, ptr %1, i64 56
  %59 = call i32 @heap_insert(ptr noundef %2, ptr noundef nonnull %58) #5
  %60 = icmp eq i32 %59, 0
  br i1 %60, label %61, label %84

61:                                               ; preds = %57
  %62 = getelementptr inbounds i8, ptr %1, i64 60
  %63 = call i32 @heap_insert(ptr noundef %2, ptr noundef nonnull %62) #5
  %64 = icmp eq i32 %63, 0
  br i1 %64, label %65, label %84

65:                                               ; preds = %61
  %66 = getelementptr inbounds i8, ptr %1, i64 64
  %67 = call i32 @heap_insert(ptr noundef %2, ptr noundef nonnull %66) #5
  %68 = icmp eq i32 %67, 0
  br i1 %68, label %69, label %84

69:                                               ; preds = %65
  %70 = getelementptr inbounds i8, ptr %1, i64 68
  %71 = call i32 @heap_insert(ptr noundef %2, ptr noundef nonnull %70) #5
  %72 = icmp eq i32 %71, 0
  br i1 %72, label %73, label %84

73:                                               ; preds = %69
  %74 = getelementptr inbounds i8, ptr %1, i64 72
  %75 = call i32 @heap_insert(ptr noundef %2, ptr noundef nonnull %74) #5
  %76 = icmp eq i32 %75, 0
  br i1 %76, label %77, label %84

77:                                               ; preds = %73
  %78 = getelementptr inbounds i8, ptr %1, i64 76
  %79 = call i32 @heap_insert(ptr noundef %2, ptr noundef nonnull %78) #5
  %80 = icmp eq i32 %79, 0
  br i1 %80, label %.preheader, label %84

.preheader:                                       ; preds = %77
  %81 = getelementptr inbounds i8, ptr %2, i64 28
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %83 = icmp eq i32 %82, 20
  br i1 %83, label %220, label %219

84:                                               ; preds = %77, %73, %69, %65, %61, %57, %53, %49, %45, %41, %37, %33, %29, %25, %21, %17, %13, %9, %5, %0
  call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 17, ptr noundef nonnull @__PRETTY_FUNCTION__.test_heap) #6
  unreachable

85:                                               ; preds = %220
  %86 = load i32, ptr %81, align 4, !tbaa !5
  %87 = icmp eq i32 %86, 19
  br i1 %87, label %88, label %219

88:                                               ; preds = %85
  %89 = call ptr @heap_pop(ptr noundef nonnull %2) #5
  %90 = load i32, ptr %89, align 4, !tbaa !11
  %91 = icmp eq i32 %90, 19
  br i1 %91, label %92, label %224

92:                                               ; preds = %88
  %93 = load i32, ptr %81, align 4, !tbaa !5
  %94 = icmp eq i32 %93, 18
  br i1 %94, label %95, label %219

95:                                               ; preds = %92
  %96 = call ptr @heap_pop(ptr noundef nonnull %2) #5
  %97 = load i32, ptr %96, align 4, !tbaa !11
  %98 = icmp eq i32 %97, 18
  br i1 %98, label %99, label %224

99:                                               ; preds = %95
  %100 = load i32, ptr %81, align 4, !tbaa !5
  %101 = icmp eq i32 %100, 17
  br i1 %101, label %102, label %219

102:                                              ; preds = %99
  %103 = call ptr @heap_pop(ptr noundef nonnull %2) #5
  %104 = load i32, ptr %103, align 4, !tbaa !11
  %105 = icmp eq i32 %104, 17
  br i1 %105, label %106, label %224

106:                                              ; preds = %102
  %107 = load i32, ptr %81, align 4, !tbaa !5
  %108 = icmp eq i32 %107, 16
  br i1 %108, label %109, label %219

109:                                              ; preds = %106
  %110 = call ptr @heap_pop(ptr noundef nonnull %2) #5
  %111 = load i32, ptr %110, align 4, !tbaa !11
  %112 = icmp eq i32 %111, 16
  br i1 %112, label %113, label %224

113:                                              ; preds = %109
  %114 = load i32, ptr %81, align 4, !tbaa !5
  %115 = icmp eq i32 %114, 15
  br i1 %115, label %116, label %219

116:                                              ; preds = %113
  %117 = call ptr @heap_pop(ptr noundef nonnull %2) #5
  %118 = load i32, ptr %117, align 4, !tbaa !11
  %119 = icmp eq i32 %118, 15
  br i1 %119, label %120, label %224

120:                                              ; preds = %116
  %121 = load i32, ptr %81, align 4, !tbaa !5
  %122 = icmp eq i32 %121, 14
  br i1 %122, label %123, label %219

123:                                              ; preds = %120
  %124 = call ptr @heap_pop(ptr noundef nonnull %2) #5
  %125 = load i32, ptr %124, align 4, !tbaa !11
  %126 = icmp eq i32 %125, 14
  br i1 %126, label %127, label %224

127:                                              ; preds = %123
  %128 = load i32, ptr %81, align 4, !tbaa !5
  %129 = icmp eq i32 %128, 13
  br i1 %129, label %130, label %219

130:                                              ; preds = %127
  %131 = call ptr @heap_pop(ptr noundef nonnull %2) #5
  %132 = load i32, ptr %131, align 4, !tbaa !11
  %133 = icmp eq i32 %132, 13
  br i1 %133, label %134, label %224

134:                                              ; preds = %130
  %135 = load i32, ptr %81, align 4, !tbaa !5
  %136 = icmp eq i32 %135, 12
  br i1 %136, label %137, label %219

137:                                              ; preds = %134
  %138 = call ptr @heap_pop(ptr noundef nonnull %2) #5
  %139 = load i32, ptr %138, align 4, !tbaa !11
  %140 = icmp eq i32 %139, 12
  br i1 %140, label %141, label %224

141:                                              ; preds = %137
  %142 = load i32, ptr %81, align 4, !tbaa !5
  %143 = icmp eq i32 %142, 11
  br i1 %143, label %144, label %219

144:                                              ; preds = %141
  %145 = call ptr @heap_pop(ptr noundef nonnull %2) #5
  %146 = load i32, ptr %145, align 4, !tbaa !11
  %147 = icmp eq i32 %146, 11
  br i1 %147, label %148, label %224

148:                                              ; preds = %144
  %149 = load i32, ptr %81, align 4, !tbaa !5
  %150 = icmp eq i32 %149, 10
  br i1 %150, label %151, label %219

151:                                              ; preds = %148
  %152 = call ptr @heap_pop(ptr noundef nonnull %2) #5
  %153 = load i32, ptr %152, align 4, !tbaa !11
  %154 = icmp eq i32 %153, 10
  br i1 %154, label %155, label %224

155:                                              ; preds = %151
  %156 = load i32, ptr %81, align 4, !tbaa !5
  %157 = icmp eq i32 %156, 9
  br i1 %157, label %158, label %219

158:                                              ; preds = %155
  %159 = call ptr @heap_pop(ptr noundef nonnull %2) #5
  %160 = load i32, ptr %159, align 4, !tbaa !11
  %161 = icmp eq i32 %160, 9
  br i1 %161, label %162, label %224

162:                                              ; preds = %158
  %163 = load i32, ptr %81, align 4, !tbaa !5
  %164 = icmp eq i32 %163, 8
  br i1 %164, label %165, label %219

165:                                              ; preds = %162
  %166 = call ptr @heap_pop(ptr noundef nonnull %2) #5
  %167 = load i32, ptr %166, align 4, !tbaa !11
  %168 = icmp eq i32 %167, 8
  br i1 %168, label %169, label %224

169:                                              ; preds = %165
  %170 = load i32, ptr %81, align 4, !tbaa !5
  %171 = icmp eq i32 %170, 7
  br i1 %171, label %172, label %219

172:                                              ; preds = %169
  %173 = call ptr @heap_pop(ptr noundef nonnull %2) #5
  %174 = load i32, ptr %173, align 4, !tbaa !11
  %175 = icmp eq i32 %174, 7
  br i1 %175, label %176, label %224

176:                                              ; preds = %172
  %177 = load i32, ptr %81, align 4, !tbaa !5
  %178 = icmp eq i32 %177, 6
  br i1 %178, label %179, label %219

179:                                              ; preds = %176
  %180 = call ptr @heap_pop(ptr noundef nonnull %2) #5
  %181 = load i32, ptr %180, align 4, !tbaa !11
  %182 = icmp eq i32 %181, 6
  br i1 %182, label %183, label %224

183:                                              ; preds = %179
  %184 = load i32, ptr %81, align 4, !tbaa !5
  %185 = icmp eq i32 %184, 5
  br i1 %185, label %186, label %219

186:                                              ; preds = %183
  %187 = call ptr @heap_pop(ptr noundef nonnull %2) #5
  %188 = load i32, ptr %187, align 4, !tbaa !11
  %189 = icmp eq i32 %188, 5
  br i1 %189, label %190, label %224

190:                                              ; preds = %186
  %191 = load i32, ptr %81, align 4, !tbaa !5
  %192 = icmp eq i32 %191, 4
  br i1 %192, label %193, label %219

193:                                              ; preds = %190
  %194 = call ptr @heap_pop(ptr noundef nonnull %2) #5
  %195 = load i32, ptr %194, align 4, !tbaa !11
  %196 = icmp eq i32 %195, 4
  br i1 %196, label %197, label %224

197:                                              ; preds = %193
  %198 = load i32, ptr %81, align 4, !tbaa !5
  %199 = icmp eq i32 %198, 3
  br i1 %199, label %200, label %219

200:                                              ; preds = %197
  %201 = call ptr @heap_pop(ptr noundef nonnull %2) #5
  %202 = load i32, ptr %201, align 4, !tbaa !11
  %203 = icmp eq i32 %202, 3
  br i1 %203, label %204, label %224

204:                                              ; preds = %200
  %205 = load i32, ptr %81, align 4, !tbaa !5
  %206 = icmp eq i32 %205, 2
  br i1 %206, label %207, label %219

207:                                              ; preds = %204
  %208 = call ptr @heap_pop(ptr noundef nonnull %2) #5
  %209 = load i32, ptr %208, align 4, !tbaa !11
  %210 = icmp eq i32 %209, 2
  br i1 %210, label %211, label %224

211:                                              ; preds = %207
  %212 = load i32, ptr %81, align 4, !tbaa !5
  %213 = icmp eq i32 %212, 1
  br i1 %213, label %214, label %219

214:                                              ; preds = %211
  %215 = call ptr @heap_pop(ptr noundef nonnull %2) #5
  %216 = load i32, ptr %215, align 4, !tbaa !11
  %217 = icmp eq i32 %216, 1
  br i1 %217, label %218, label %224

218:                                              ; preds = %214
  call void @heap_free(ptr noundef nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %1) #5
  ret void

219:                                              ; preds = %211, %204, %197, %190, %183, %176, %169, %162, %155, %148, %141, %134, %127, %120, %113, %106, %99, %92, %85, %.preheader
  call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 25, ptr noundef nonnull @__PRETTY_FUNCTION__.test_heap) #6
  unreachable

220:                                              ; preds = %.preheader
  %221 = call ptr @heap_pop(ptr noundef nonnull %2) #5
  %222 = load i32, ptr %221, align 4, !tbaa !11
  %223 = icmp eq i32 %222, 20
  br i1 %223, label %85, label %224

224:                                              ; preds = %214, %207, %200, %193, %186, %179, %172, %165, %158, %151, %144, %137, %130, %123, %116, %109, %102, %95, %88, %220
  call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 26, ptr noundef nonnull @__PRETTY_FUNCTION__.test_heap) #6
  unreachable
}

; 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

declare ptr @heap_new(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare i32 @int_compare(ptr noundef, ptr noundef) #3

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

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

declare ptr @heap_pop(ptr noundef) local_unnamed_addr #3

declare void @heap_free(ptr noundef) local_unnamed_addr #3

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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
attributes #6 = { noreturn 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, !10, i64 28}
!6 = !{!"_Heap", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24, !10, i64 28, !10, i64 32}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!10, !10, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopRotatePass,LoopSimplifyPass,SROAPass,SimplifyCFGPass,TailCallElimPass