; LLVM IR from PetarV-/Algorithms :: Data Structures (Fibonacci 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.FibNode = type { i32, i8, i32, ptr, 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 @_ZN7FibHeap7isEmptyEv(ptr noundef nonnull align 8 dereferenceable(12)) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7FibHeap6insertEP7FibNode(ptr noundef nonnull align 8 dereferenceable(12), 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 @_ZN7FibHeap10extractMinEv(ptr noundef nonnull align 8 dereferenceable(12)) #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7FibHeap6DeleteEP7FibNode(ptr noundef nonnull align 8 dereferenceable(12), ptr noundef) #1 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 @_ZN7FibHeapC1Ev(ptr noundef nonnull align 8 dereferenceable(12) %7)
          to label %8 unwind label %40

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 48) #8
  invoke void @_ZN7FibNodeC2Ei(ptr noundef nonnull align 8 dereferenceable(48) %9, i32 noundef 11)
          to label %10 unwind label %44

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 48) #8
  invoke void @_ZN7FibNodeC2Ei(ptr noundef nonnull align 8 dereferenceable(48) %11, i32 noundef 5)
          to label %12 unwind label %48

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 @_ZN7FibHeap6insertEP7FibNode(ptr noundef nonnull align 8 dereferenceable(12) %13, ptr noundef %14)
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN7FibHeap6insertEP7FibNode(ptr noundef nonnull align 8 dereferenceable(12) %15, ptr noundef %16)
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  %18 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 48) #8
  invoke void @_ZN7FibNodeC2Ei(ptr noundef nonnull align 8 dereferenceable(48) %18, i32 noundef 3)
          to label %19 unwind label %52

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

22:                                               ; preds = %19
  call void @_ZN7FibHeap6insertEP7FibNode(ptr noundef nonnull align 8 dereferenceable(12) %20, ptr noundef %21)
  %23 = load ptr, ptr %2, align 8, !tbaa !5
  %24 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 48) #8
  invoke void @_ZN7FibNodeC2Ei(ptr noundef nonnull align 8 dereferenceable(48) %24, i32 noundef 4)
          to label %25 unwind label %60

25:                                               ; preds = %22
  call void @_ZN7FibHeap6insertEP7FibNode(ptr noundef nonnull align 8 dereferenceable(12) %23, ptr noundef %24)
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN7FibHeap11decreaseKeyEP7FibNodei(ptr noundef nonnull align 8 dereferenceable(12) %26, ptr noundef %27, i32 noundef 2)
  %28 = load ptr, ptr %2, align 8, !tbaa !5
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN7FibHeap6DeleteEP7FibNode(ptr noundef nonnull align 8 dereferenceable(12) %28, ptr noundef %29)
  br label %30

30:                                               ; preds = %34, %25
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  %32 = call noundef zeroext i1 @_ZN7FibHeap7isEmptyEv(ptr noundef nonnull align 8 dereferenceable(12) %31)
  %33 = xor i1 %32, true
  br i1 %33, label %34, label %64

34:                                               ; preds = %30
  %35 = load ptr, ptr %2, align 8, !tbaa !5
  %36 = call noundef ptr @_ZN7FibHeap10extractMinEv(ptr noundef nonnull align 8 dereferenceable(12) %35)
  %37 = getelementptr inbounds %struct.FibNode, ptr %36, i32 0, i32 0
  %38 = load i32, ptr %37, align 8, !tbaa !9
  %39 = call i32 (ptr, ...) @printf(ptr noundef @.str, i32 noundef %38)
  br label %30, !llvm.loop !13

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

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

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

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

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

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

64:                                               ; preds = %30
  %65 = 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

66:                                               ; preds = %60, %56, %52, %48
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  br label %67

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

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

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

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

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

declare void @_ZN7FibHeapC1Ev(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 = !{!"_ZTS7FibNode", !11, i64 0, !12, i64 4, !11, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!11 = !{!"int", !7, i64 0}
!12 = !{!"bool", !7, i64 0}
!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"

@.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 @_ZN7FibHeap7isEmptyEv(ptr noundef nonnull align 8 dereferenceable(12)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7FibHeap6insertEP7FibNode(ptr noundef nonnull align 8 dereferenceable(12), 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 @_ZN7FibHeap10extractMinEv(ptr noundef nonnull align 8 dereferenceable(12)) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7FibHeap6DeleteEP7FibNode(ptr noundef nonnull align 8 dereferenceable(12), ptr noundef) local_unnamed_addr #1 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 @_ZN7FibHeapC1Ev(ptr noundef nonnull align 8 dereferenceable(12) %1)
          to label %2 unwind label %13

2:                                                ; preds = %0
  %3 = tail call noalias noundef nonnull dereferenceable(48) ptr @_Znwm(i64 noundef 48) #6
  tail call void @_ZN7FibNodeC2Ei(ptr noundef nonnull align 8 dereferenceable(48) %3, i32 noundef 11)
  %4 = tail call noalias noundef nonnull dereferenceable(48) ptr @_Znwm(i64 noundef 48) #6
  tail call void @_ZN7FibNodeC2Ei(ptr noundef nonnull align 8 dereferenceable(48) %4, i32 noundef 5)
  tail call void @_ZN7FibHeap6insertEP7FibNode(ptr noundef nonnull align 8 dereferenceable(12) %1, ptr noundef nonnull %3)
  tail call void @_ZN7FibHeap6insertEP7FibNode(ptr noundef nonnull align 8 dereferenceable(12) %1, ptr noundef nonnull %4)
  %5 = tail call noalias noundef nonnull dereferenceable(48) ptr @_Znwm(i64 noundef 48) #6
  tail call void @_ZN7FibNodeC2Ei(ptr noundef nonnull align 8 dereferenceable(48) %5, i32 noundef 3)
  tail call void @_ZN7FibHeap6insertEP7FibNode(ptr noundef nonnull align 8 dereferenceable(12) %1, ptr noundef nonnull %5)
  %6 = tail call noalias noundef nonnull dereferenceable(48) ptr @_Znwm(i64 noundef 48) #6
  tail call void @_ZN7FibNodeC2Ei(ptr noundef nonnull align 8 dereferenceable(48) %6, i32 noundef 8)
  tail call void @_ZN7FibHeap6insertEP7FibNode(ptr noundef nonnull align 8 dereferenceable(12) %1, ptr noundef nonnull %6)
  %7 = tail call noalias noundef nonnull dereferenceable(48) ptr @_Znwm(i64 noundef 48) #6
  tail call void @_ZN7FibNodeC2Ei(ptr noundef nonnull align 8 dereferenceable(48) %7, i32 noundef 4)
  tail call void @_ZN7FibHeap6insertEP7FibNode(ptr noundef nonnull align 8 dereferenceable(12) %1, ptr noundef nonnull %7)
  tail call void @_ZN7FibHeap11decreaseKeyEP7FibNodei(ptr noundef nonnull align 8 dereferenceable(12) %1, ptr noundef nonnull %3, i32 noundef 2)
  tail call void @_ZN7FibHeap6DeleteEP7FibNode(ptr noundef nonnull align 8 dereferenceable(12) %1, ptr noundef nonnull %4)
  %8 = tail call noundef zeroext i1 @_ZN7FibHeap7isEmptyEv(ptr noundef nonnull align 8 dereferenceable(12) %1)
  br i1 %8, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %2, %.lr.ph
  %9 = tail call noundef ptr @_ZN7FibHeap10extractMinEv(ptr noundef nonnull align 8 dereferenceable(12) %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 @_ZN7FibHeap7isEmptyEv(ptr noundef nonnull align 8 dereferenceable(12) %1)
  br i1 %12, label %._crit_edge, label %.lr.ph, !llvm.loop !12

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 @_ZN7FibNodeC2Ei(ptr noundef nonnull align 8 dereferenceable(48), 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 @_ZN7FibHeapC1Ev(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 = !{!"_ZTS7FibNode", !7, i64 0, !10, i64 4, !7, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"bool", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}


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