; LLVM IR from shellphish/how2heap :: glibc_2.23 (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 [121 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [94 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [79 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [90 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [91 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [85 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [32 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  store i32 0, ptr %1, align 4
  %5 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #7
  %6 = call noalias ptr @calloc(i64 noundef 1, i64 noundef 64) #8
  store ptr %6, ptr %2, align 8, !tbaa !5
  %7 = load ptr, ptr %2, align 8, !tbaa !5
  %8 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, ptr noundef %7)
  %9 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  %10 = load ptr, ptr %2, align 8, !tbaa !5
  call void @free(ptr noundef %10) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #7
  %11 = call noalias ptr @malloc(i64 noundef 1024) #9
  store ptr %11, ptr %3, align 8, !tbaa !5
  %12 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  %13 = call i32 (ptr, ...) @printf(ptr noundef @.str.4)
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, ptr noundef %14)
  %16 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  %17 = call i32 (ptr, ...) @printf(ptr noundef @.str.7)
  %18 = load ptr, ptr %2, align 8, !tbaa !5
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = icmp eq ptr %18, %19
  br i1 %20, label %21, label %22

21:                                               ; preds = %0
  br label %23

22:                                               ; preds = %0
  call void @__assert_fail(ptr noundef @.str.8, ptr noundef @.str.9, i32 noundef 47, ptr noundef @__PRETTY_FUNCTION__.main) #10
  unreachable

23:                                               ; preds = %21
  %24 = call i32 (ptr, ...) @printf(ptr noundef @.str.10)
  %25 = load ptr, ptr %2, align 8, !tbaa !5
  call void @free(ptr noundef %25) #7
  %26 = call i32 (ptr, ...) @printf(ptr noundef @.str.11)
  %27 = call i32 (ptr, ...) @printf(ptr noundef @.str.12)
  %28 = call i32 (ptr, ...) @printf(ptr noundef @.str.13)
  %29 = call i32 (ptr, ...) @printf(ptr noundef @.str.14)
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  %30 = call noalias ptr @malloc(i64 noundef 1024) #9
  store ptr %30, ptr %4, align 8, !tbaa !5
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = icmp eq ptr %31, %32
  br i1 %33, label %34, label %35

34:                                               ; preds = %23
  br label %36

35:                                               ; preds = %23
  call void @__assert_fail(ptr noundef @.str.15, ptr noundef @.str.9, i32 noundef 59, ptr noundef @__PRETTY_FUNCTION__.main) #10
  unreachable

36:                                               ; preds = %34
  %37 = call i32 (ptr, ...) @printf(ptr noundef @.str.16)
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = call i32 (ptr, ...) @printf(ptr noundef @.str.17, ptr noundef %38, ptr noundef %39)
  %41 = call i32 (ptr, ...) @printf(ptr noundef @.str.18)
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #7
  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,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #3

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

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

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

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

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,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 #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 = { 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 #6 = { 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 #7 = { nounwind }
attributes #8 = { nounwind allocsize(0,1) }
attributes #9 = { nounwind allocsize(0) }
attributes #10 = { 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"}


; 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 [121 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [94 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [79 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [90 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [91 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [60 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [85 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [32 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 noalias dereferenceable_or_null(64) ptr @calloc(i64 noundef 1, i64 noundef 64) #6
  %3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef %2)
  %4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  tail call void @free(ptr noundef %2) #7
  %5 = tail call noalias dereferenceable_or_null(1024) ptr @malloc(i64 noundef 1024) #8
  %6 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  %7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
  %8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, ptr noundef %5)
  %9 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  %10 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7)
  %11 = icmp eq ptr %2, %5
  br i1 %11, label %13, label %12

12:                                               ; preds = %0
  tail call void @__assert_fail(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.9, i32 noundef 47, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #9
  unreachable

13:                                               ; preds = %0
  %14 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10)
  tail call void @free(ptr noundef %2) #7
  %15 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11)
  %16 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12)
  %17 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13)
  %18 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14)
  %19 = tail call noalias dereferenceable_or_null(1024) ptr @malloc(i64 noundef 1024) #8
  %20 = icmp eq ptr %19, %2
  br i1 %20, label %22, label %21

21:                                               ; preds = %13
  tail call void @__assert_fail(ptr noundef nonnull @.str.15, ptr noundef nonnull @.str.9, i32 noundef 59, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #9
  unreachable

22:                                               ; preds = %13
  %23 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.16)
  %24 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.17, ptr noundef %5, ptr noundef %19)
  %25 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.18)
  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,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, 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: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #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 = { 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,zeroed") allocsize(0,1) 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 = { 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 #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 allocsize(0,1) }
attributes #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }
attributes #9 = { 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,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass