; LLVM IR from shellphish/how2heap :: glibc_2.27 (fastbin_dup_consolidate)

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

@.str = external hidden unnamed_addr constant [107 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [72 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [94 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [67 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [103 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [90 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [95 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [89 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [90 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [85 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [83 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca [7 x ptr], align 16
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  store i32 0, ptr %1, align 4
  %8 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  %9 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  call void @llvm.lifetime.start.p0(i64 56, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %10

10:                                               ; preds = %19, %0
  %11 = load i32, ptr %3, align 4, !tbaa !5
  %12 = icmp slt i32 %11, 7
  br i1 %12, label %14, label %13

13:                                               ; preds = %10
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %22

14:                                               ; preds = %10
  %15 = call noalias ptr @malloc(i64 noundef 64) #7
  %16 = load i32, ptr %3, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds [7 x ptr], ptr %2, i64 0, i64 %17
  store ptr %15, ptr %18, align 8, !tbaa !9
  br label %19

19:                                               ; preds = %14
  %20 = load i32, ptr %3, align 4, !tbaa !5
  %21 = add nsw i32 %20, 1
  store i32 %21, ptr %3, align 4, !tbaa !5
  br label %10, !llvm.loop !11

22:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  %23 = call noalias ptr @malloc(i64 noundef 64) #7
  store ptr %23, ptr %4, align 8, !tbaa !9
  %24 = load ptr, ptr %4, align 8, !tbaa !9
  %25 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, ptr noundef %24)
  %26 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %27

27:                                               ; preds = %36, %22
  %28 = load i32, ptr %5, align 4, !tbaa !5
  %29 = icmp slt i32 %28, 7
  br i1 %29, label %31, label %30

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

31:                                               ; preds = %27
  %32 = load i32, ptr %5, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [7 x ptr], ptr %2, i64 0, i64 %33
  %35 = load ptr, ptr %34, align 8, !tbaa !9
  call void @free(ptr noundef %35) #6
  br label %36

36:                                               ; preds = %31
  %37 = load i32, ptr %5, align 4, !tbaa !5
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr %5, align 4, !tbaa !5
  br label %27, !llvm.loop !13

39:                                               ; preds = %30
  %40 = call i32 (ptr, ...) @printf(ptr noundef @.str.4)
  %41 = load ptr, ptr %4, align 8, !tbaa !9
  call void @free(ptr noundef %41) #6
  %42 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  %43 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  %44 = call i32 (ptr, ...) @printf(ptr noundef @.str.7)
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %45 = call noalias ptr @malloc(i64 noundef 1024) #7
  store ptr %45, ptr %6, align 8, !tbaa !9
  %46 = load ptr, ptr %6, align 8, !tbaa !9
  %47 = call i32 (ptr, ...) @printf(ptr noundef @.str.8, ptr noundef %46)
  %48 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  %49 = call i32 (ptr, ...) @printf(ptr noundef @.str.10)
  %50 = load ptr, ptr %4, align 8, !tbaa !9
  %51 = load ptr, ptr %6, align 8, !tbaa !9
  %52 = icmp eq ptr %50, %51
  br i1 %52, label %53, label %54

53:                                               ; preds = %39
  br label %55

54:                                               ; preds = %39
  call void @__assert_fail(ptr noundef @.str.11, ptr noundef @.str.12, i32 noundef 61, ptr noundef @__PRETTY_FUNCTION__.main) #8
  unreachable

55:                                               ; preds = %53
  %56 = call i32 (ptr, ...) @printf(ptr noundef @.str.13)
  %57 = load ptr, ptr %4, align 8, !tbaa !9
  call void @free(ptr noundef %57) #6
  %58 = call i32 (ptr, ...) @printf(ptr noundef @.str.14)
  %59 = call i32 (ptr, ...) @printf(ptr noundef @.str.15)
  %60 = call i32 (ptr, ...) @printf(ptr noundef @.str.16)
  %61 = call i32 (ptr, ...) @printf(ptr noundef @.str.17)
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %62 = call noalias ptr @malloc(i64 noundef 1024) #7
  store ptr %62, ptr %7, align 8, !tbaa !9
  %63 = load ptr, ptr %7, align 8, !tbaa !9
  %64 = load ptr, ptr %6, align 8, !tbaa !9
  %65 = icmp eq ptr %63, %64
  br i1 %65, label %66, label %67

66:                                               ; preds = %55
  br label %68

67:                                               ; preds = %55
  call void @__assert_fail(ptr noundef @.str.18, ptr noundef @.str.12, i32 noundef 73, ptr noundef @__PRETTY_FUNCTION__.main) #8
  unreachable

68:                                               ; preds = %66
  %69 = call i32 (ptr, ...) @printf(ptr noundef @.str.19)
  %70 = load ptr, ptr %6, align 8, !tbaa !9
  %71 = load ptr, ptr %7, align 8, !tbaa !9
  %72 = call i32 (ptr, ...) @printf(ptr noundef @.str.20, ptr noundef %70, ptr noundef %71)
  %73 = call i32 (ptr, ...) @printf(ptr noundef @.str.21)
  %74 = call i32 (ptr, ...) @printf(ptr noundef @.str.22)
  %75 = call i32 (ptr, ...) @printf(ptr noundef @.str.23)
  %76 = call i32 (ptr, ...) @printf(ptr noundef @.str.24)
  %77 = call i32 (ptr, ...) @printf(ptr noundef @.str.25)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr %2) #6
  ret i32 0
}

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

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

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

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

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

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

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

@.str = external hidden unnamed_addr constant [107 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [72 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [94 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [67 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [103 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [90 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [95 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [89 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [90 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [85 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [83 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  %3 = tail call noalias dereferenceable_or_null(64) ptr @malloc(i64 noundef 64) #5
  %4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef %3)
  %5 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  %6 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
  tail call void @free(ptr noundef %3) #6
  %7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5)
  %8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  %9 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7)
  %10 = tail call noalias dereferenceable_or_null(1024) ptr @malloc(i64 noundef 1024) #5
  %11 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, ptr noundef %10)
  %12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9)
  %13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10)
  %14 = icmp eq ptr %3, %10
  br i1 %14, label %16, label %15

15:                                               ; preds = %0
  tail call void @__assert_fail(ptr noundef nonnull @.str.11, ptr noundef nonnull @.str.12, i32 noundef 61, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #7
  unreachable

16:                                               ; preds = %0
  %17 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13)
  tail call void @free(ptr noundef %3) #6
  %18 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14)
  %19 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15)
  %20 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.16)
  %21 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.17)
  %22 = tail call noalias dereferenceable_or_null(1024) ptr @malloc(i64 noundef 1024) #5
  %23 = icmp eq ptr %22, %3
  br i1 %23, label %25, label %24

24:                                               ; preds = %16
  tail call void @__assert_fail(ptr noundef nonnull @.str.18, ptr noundef nonnull @.str.12, i32 noundef 73, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #7
  unreachable

25:                                               ; preds = %16
  %26 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.19)
  %27 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.20, ptr noundef %10, ptr noundef %22)
  %28 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.21)
  %29 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.22)
  %30 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.23)
  %31 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.24)
  %32 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.25)
  ret i32 0
}

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

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture 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

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 = { 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 #2 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { 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 allocsize(0) }
attributes #6 = { nounwind }
attributes #7 = { 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)"}


; Effective O3 passes: GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass