; LLVM IR from PetarV-/Algorithms :: Data Structures (Binomial 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.BinNode = type { i32, i32, ptr, ptr, ptr }

@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN7BinHeap7isEmptyEv(ptr noundef nonnull align 8 dereferenceable(16)) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7BinHeap6insertEP7BinNode(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) #1 align 2

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #3

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN7BinHeap10extractMinEv(ptr noundef nonnull align 8 dereferenceable(16)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7BinHeap11decreaseKeyEP7BinNodei(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, i32 noundef) #0 align 2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #5 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #7
  %7 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 16) #8
  invoke void @_ZN7BinHeapC1Ev(ptr noundef nonnull align 8 dereferenceable(16) %7)
          to label %8 unwind label %38

8:                                                ; preds = %0
  store ptr %7, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  %9 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 32) #8
  invoke void @_ZN7BinNodeC2Ei(ptr noundef nonnull align 8 dereferenceable(32) %9, i32 noundef 11)
          to label %10 unwind label %42

10:                                               ; preds = %8
  store ptr %9, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %11 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 32) #8
  invoke void @_ZN7BinNodeC2Ei(ptr noundef nonnull align 8 dereferenceable(32) %11, i32 noundef 5)
          to label %12 unwind label %46

12:                                               ; preds = %10
  store ptr %11, ptr %6, align 8, !tbaa !5
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN7BinHeap6insertEP7BinNode(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef %14)
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN7BinHeap6insertEP7BinNode(ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef %16)
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  %18 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 32) #8
  invoke void @_ZN7BinNodeC2Ei(ptr noundef nonnull align 8 dereferenceable(32) %18, i32 noundef 3)
          to label %19 unwind label %50

19:                                               ; preds = %12
  call void @_ZN7BinHeap6insertEP7BinNode(ptr noundef nonnull align 8 dereferenceable(16) %17, ptr noundef %18)
  %20 = load ptr, ptr %2, align 8, !tbaa !5
  %21 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 32) #8
  invoke void @_ZN7BinNodeC2Ei(ptr noundef nonnull align 8 dereferenceable(32) %21, i32 noundef 8)
          to label %22 unwind label %54

22:                                               ; preds = %19
  call void @_ZN7BinHeap6insertEP7BinNode(ptr noundef nonnull align 8 dereferenceable(16) %20, ptr noundef %21)
  %23 = load ptr, ptr %2, align 8, !tbaa !5
  %24 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 32) #8
  invoke void @_ZN7BinNodeC2Ei(ptr noundef nonnull align 8 dereferenceable(32) %24, i32 noundef 4)
          to label %25 unwind label %58

25:                                               ; preds = %22
  call void @_ZN7BinHeap6insertEP7BinNode(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef %24)
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN7BinHeap11decreaseKeyEP7BinNodei(ptr noundef nonnull align 8 dereferenceable(16) %26, ptr noundef %27, i32 noundef 2)
  br label %28

28:                                               ; preds = %32, %25
  %29 = load ptr, ptr %2, align 8, !tbaa !5
  %30 = call noundef zeroext i1 @_ZN7BinHeap7isEmptyEv(ptr noundef nonnull align 8 dereferenceable(16) %29)
  %31 = xor i1 %30, true
  br i1 %31, label %32, label %62

32:                                               ; preds = %28
  %33 = load ptr, ptr %2, align 8, !tbaa !5
  %34 = call noundef ptr @_ZN7BinHeap10extractMinEv(ptr noundef nonnull align 8 dereferenceable(16) %33)
  %35 = getelementptr inbounds %struct.BinNode, ptr %34, i32 0, i32 0
  %36 = load i32, ptr %35, align 8, !tbaa !9
  %37 = call i32 (ptr, ...) @printf(ptr noundef @.str, i32 noundef %36)
  br label %28, !llvm.loop !12

38:                                               ; preds = %0
  %39 = landingpad { ptr, i32 }
          cleanup
  %40 = extractvalue { ptr, i32 } %39, 0
  store ptr %40, ptr %3, align 8
  %41 = extractvalue { ptr, i32 } %39, 1
  store i32 %41, ptr %4, align 4
  call void @_ZdlPvm(ptr noundef %7, i64 noundef 16) #9
  br label %66

42:                                               ; preds = %8
  %43 = landingpad { ptr, i32 }
          cleanup
  %44 = extractvalue { ptr, i32 } %43, 0
  store ptr %44, ptr %3, align 8
  %45 = extractvalue { ptr, i32 } %43, 1
  store i32 %45, ptr %4, align 4
  call void @_ZdlPvm(ptr noundef %9, i64 noundef 32) #9
  br label %65

46:                                               ; preds = %10
  %47 = landingpad { ptr, i32 }
          cleanup
  %48 = extractvalue { ptr, i32 } %47, 0
  store ptr %48, ptr %3, align 8
  %49 = extractvalue { ptr, i32 } %47, 1
  store i32 %49, ptr %4, align 4
  call void @_ZdlPvm(ptr noundef %11, i64 noundef 32) #9
  br label %64

50:                                               ; preds = %12
  %51 = landingpad { ptr, i32 }
          cleanup
  %52 = extractvalue { ptr, i32 } %51, 0
  store ptr %52, ptr %3, align 8
  %53 = extractvalue { ptr, i32 } %51, 1
  store i32 %53, ptr %4, align 4
  call void @_ZdlPvm(ptr noundef %18, i64 noundef 32) #9
  br label %64

54:                                               ; preds = %19
  %55 = landingpad { ptr, i32 }
          cleanup
  %56 = extractvalue { ptr, i32 } %55, 0
  store ptr %56, ptr %3, align 8
  %57 = extractvalue { ptr, i32 } %55, 1
  store i32 %57, ptr %4, align 4
  call void @_ZdlPvm(ptr noundef %21, i64 noundef 32) #9
  br label %64

58:                                               ; preds = %22
  %59 = landingpad { ptr, i32 }
          cleanup
  %60 = extractvalue { ptr, i32 } %59, 0
  store ptr %60, ptr %3, align 8
  %61 = extractvalue { ptr, i32 } %59, 1
  store i32 %61, ptr %4, align 4
  call void @_ZdlPvm(ptr noundef %24, i64 noundef 32) #9
  br label %64

62:                                               ; preds = %28
  %63 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #7
  ret i32 0

64:                                               ; preds = %58, %54, %50, %46
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  br label %65

65:                                               ; preds = %64, %42
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  br label %66

66:                                               ; preds = %65, %38
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #7
  br label %67

67:                                               ; preds = %66
  %68 = load ptr, ptr %3, align 8
  %69 = load i32, ptr %4, align 4
  %70 = insertvalue { ptr, i32 } poison, ptr %68, 0
  %71 = insertvalue { ptr, i32 } %70, i32 %69, 1
  resume { ptr, i32 } %71
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7BinNodeC2Ei(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) unnamed_addr #0 align 2

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

declare void @_ZN7BinHeapC1Ev(ptr)

attributes #0 = { mustprogress 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 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 #2 = { nobuiltin 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 #3 = { nobuiltin 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { mustprogress norecurse 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 #6 = { "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 = { builtin allocsize(0) }
attributes #9 = { builtin 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++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"_ZTS7BinNode", !11, i64 0, !11, i64 4, !6, i64 8, !6, i64 16, !6, i64 24}
!11 = !{!"int", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"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"

@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN7BinHeap7isEmptyEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7BinHeap6insertEP7BinNode(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) local_unnamed_addr #1 align 2

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN7BinHeap10extractMinEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7BinHeap11decreaseKeyEP7BinNodei(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #4 personality ptr @__gxx_personality_v0 {
  %1 = tail call noalias noundef nonnull dereferenceable(16) ptr @_Znwm(i64 noundef 16) #6
  invoke void @_ZN7BinHeapC1Ev(ptr noundef nonnull align 8 dereferenceable(16) %1)
          to label %2 unwind label %13

2:                                                ; preds = %0
  %3 = tail call noalias noundef nonnull dereferenceable(32) ptr @_Znwm(i64 noundef 32) #6
  tail call void @_ZN7BinNodeC2Ei(ptr noundef nonnull align 8 dereferenceable(32) %3, i32 noundef 11)
  %4 = tail call noalias noundef nonnull dereferenceable(32) ptr @_Znwm(i64 noundef 32) #6
  tail call void @_ZN7BinNodeC2Ei(ptr noundef nonnull align 8 dereferenceable(32) %4, i32 noundef 5)
  tail call void @_ZN7BinHeap6insertEP7BinNode(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull %3)
  tail call void @_ZN7BinHeap6insertEP7BinNode(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull %4)
  %5 = tail call noalias noundef nonnull dereferenceable(32) ptr @_Znwm(i64 noundef 32) #6
  tail call void @_ZN7BinNodeC2Ei(ptr noundef nonnull align 8 dereferenceable(32) %5, i32 noundef 3)
  tail call void @_ZN7BinHeap6insertEP7BinNode(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull %5)
  %6 = tail call noalias noundef nonnull dereferenceable(32) ptr @_Znwm(i64 noundef 32) #6
  tail call void @_ZN7BinNodeC2Ei(ptr noundef nonnull align 8 dereferenceable(32) %6, i32 noundef 8)
  tail call void @_ZN7BinHeap6insertEP7BinNode(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull %6)
  %7 = tail call noalias noundef nonnull dereferenceable(32) ptr @_Znwm(i64 noundef 32) #6
  tail call void @_ZN7BinNodeC2Ei(ptr noundef nonnull align 8 dereferenceable(32) %7, i32 noundef 4)
  tail call void @_ZN7BinHeap6insertEP7BinNode(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull %7)
  tail call void @_ZN7BinHeap11decreaseKeyEP7BinNodei(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull %3, i32 noundef 2)
  %8 = tail call noundef zeroext i1 @_ZN7BinHeap7isEmptyEv(ptr noundef nonnull align 8 dereferenceable(16) %1)
  br i1 %8, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %2, %.lr.ph
  %9 = tail call noundef ptr @_ZN7BinHeap10extractMinEv(ptr noundef nonnull align 8 dereferenceable(16) %1)
  %10 = load i32, ptr %9, align 8, !tbaa !5
  %11 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %10)
  %12 = tail call noundef zeroext i1 @_ZN7BinHeap7isEmptyEv(ptr noundef nonnull align 8 dereferenceable(16) %1)
  br i1 %12, label %._crit_edge, label %.lr.ph, !llvm.loop !11

13:                                               ; preds = %0
  %14 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZdlPvm(ptr noundef nonnull %1, i64 noundef 16) #7
  resume { ptr, i32 } %14

._crit_edge:                                      ; preds = %.lr.ph, %2
  %15 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  ret i32 0
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7BinNodeC2Ei(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) unnamed_addr #0 align 2

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

declare void @_ZN7BinHeapC1Ev(ptr) local_unnamed_addr

attributes #0 = { mustprogress 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 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 #2 = { nobuiltin 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 #3 = { nobuiltin 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 = { mustprogress norecurse 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 #5 = { 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 #6 = { builtin allocsize(0) }
attributes #7 = { builtin 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, !7, i64 0}
!6 = !{!"_ZTS7BinNode", !7, i64 0, !7, i64 4, !10, i64 8, !10, i64 16, !10, i64 24}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass