; LLVM IR from erwincoumans/tiny-differentiable-simulator :: third_party/dear_imgui/imnodes.ll (ZN7imnodes23EditorContextMoveToNodeEi)

; 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.imnodes::EditorContext" = type { %"struct.imnodes::(anonymous namespace)::ObjectPool", %"struct.imnodes::(anonymous namespace)::ObjectPool.6", %"struct.imnodes::(anonymous namespace)::ObjectPool.8", %struct.ImVector.0, %struct.ImVec2, %struct.ImVector.0, %struct.ImVector.0, i32, %"struct.imnodes::(anonymous namespace)::ClickInteractionState" }
%"struct.imnodes::(anonymous namespace)::ObjectPool" = type { %struct.ImVector.4, %struct.ImVector.5, %struct.ImVector.0, %struct.ImGuiStorage }
%struct.ImVector.4 = type { i32, i32, ptr }
%struct.ImVector.5 = type { i32, i32, ptr }
%struct.ImGuiStorage = type { %struct.ImVector }
%struct.ImVector = type { i32, i32, ptr }
%"struct.imnodes::(anonymous namespace)::ObjectPool.6" = type { %struct.ImVector.7, %struct.ImVector.5, %struct.ImVector.0, %struct.ImGuiStorage }
%struct.ImVector.7 = type { i32, i32, ptr }
%"struct.imnodes::(anonymous namespace)::ObjectPool.8" = type { %struct.ImVector.9, %struct.ImVector.5, %struct.ImVector.0, %struct.ImGuiStorage }
%struct.ImVector.9 = type { i32, i32, ptr }
%struct.ImVec2 = type { float, float }
%struct.ImVector.0 = type { i32, i32, ptr }
%"struct.imnodes::(anonymous namespace)::ClickInteractionState" = type { %struct.anon.10, %struct.anon.11 }
%struct.anon.10 = type { i32, %"struct.imnodes::(anonymous namespace)::OptionalIndex", i32 }
%"struct.imnodes::(anonymous namespace)::OptionalIndex" = type { i32 }
%struct.anon.11 = type { %struct.ImRect }
%struct.ImRect = type { %struct.ImVec2, %struct.ImVec2 }
%"struct.imnodes::(anonymous namespace)::NodeData" = type <{ i32, %struct.ImVec2, %struct.ImRect, %struct.ImRect, %struct.anon.12, %struct.anon.13, [4 x i8], %struct.ImVector.0, i8, [7 x i8] }>
%struct.anon.12 = type { i32, i32, i32, i32, i32, i32, i32 }
%struct.anon.13 = type { float, %struct.ImVec2 }

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

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef nonnull align 8 dereferenceable(280) ptr @_ZN7imnodes12_GLOBAL__N_118editor_context_getEv() #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7imnodes23EditorContextMoveToNodeEi(i32 noundef %0) #2 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  store i32 %0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  %5 = call noundef nonnull align 8 dereferenceable(280) ptr @_ZN7imnodes12_GLOBAL__N_118editor_context_getEv()
  store ptr %5, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  %6 = load ptr, ptr %3, align 8, !tbaa !9
  %7 = getelementptr inbounds %"struct.imnodes::EditorContext", ptr %6, i32 0, i32 0
  %8 = load i32, ptr %2, align 4, !tbaa !5
  %9 = call noundef nonnull align 8 dereferenceable(105) ptr @_ZN7imnodes12_GLOBAL__N_133object_pool_find_or_create_objectINS0_8NodeDataEEERT_RNS0_10ObjectPoolIS3_EEi(ptr noundef nonnull align 8 dereferenceable(64) %7, i32 noundef %8)
  store ptr %9, ptr %4, align 8, !tbaa !9
  %10 = load ptr, ptr %4, align 8, !tbaa !9
  %11 = getelementptr inbounds %"struct.imnodes::(anonymous namespace)::NodeData", ptr %10, i32 0, i32 1
  %12 = getelementptr inbounds %struct.ImVec2, ptr %11, i32 0, i32 0
  %13 = load float, ptr %12, align 4, !tbaa !11
  %14 = fneg float %13
  %15 = load ptr, ptr %3, align 8, !tbaa !9
  %16 = getelementptr inbounds %"struct.imnodes::EditorContext", ptr %15, i32 0, i32 4
  %17 = getelementptr inbounds %struct.ImVec2, ptr %16, i32 0, i32 0
  store float %14, ptr %17, align 8, !tbaa !20
  %18 = load ptr, ptr %4, align 8, !tbaa !9
  %19 = getelementptr inbounds %"struct.imnodes::(anonymous namespace)::NodeData", ptr %18, i32 0, i32 1
  %20 = getelementptr inbounds %struct.ImVec2, ptr %19, i32 0, i32 1
  %21 = load float, ptr %20, align 4, !tbaa !35
  %22 = fneg float %21
  %23 = load ptr, ptr %3, align 8, !tbaa !9
  %24 = getelementptr inbounds %"struct.imnodes::EditorContext", ptr %23, i32 0, i32 4
  %25 = getelementptr inbounds %struct.ImVec2, ptr %24, i32 0, i32 1
  store float %22, ptr %25, align 4, !tbaa !36
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  ret void
}

; Function Attrs: mustprogress uwtable
declare hidden noundef nonnull align 8 dereferenceable(105) ptr @_ZN7imnodes12_GLOBAL__N_133object_pool_find_or_create_objectINS0_8NodeDataEEERT_RNS0_10ObjectPoolIS3_EEi(ptr noundef nonnull align 8 dereferenceable(64), i32 noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !14, i64 4}
!12 = !{!"_ZTSN7imnodes12_GLOBAL__N_18NodeDataE", !6, i64 0, !13, i64 4, !15, i64 12, !15, i64 28, !16, i64 44, !17, i64 72, !18, i64 88, !19, i64 104}
!13 = !{!"_ZTS6ImVec2", !14, i64 0, !14, i64 4}
!14 = !{!"float", !7, i64 0}
!15 = !{!"_ZTS6ImRect", !13, i64 0, !13, i64 8}
!16 = !{!"_ZTSN7imnodes12_GLOBAL__N_18NodeData3$_3E", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !6, i64 24}
!17 = !{!"_ZTSN7imnodes12_GLOBAL__N_18NodeData3$_4E", !14, i64 0, !13, i64 4}
!18 = !{!"_ZTS8ImVectorIiE", !6, i64 0, !6, i64 4, !10, i64 8}
!19 = !{!"bool", !7, i64 0}
!20 = !{!21, !14, i64 208}
!21 = !{!"_ZTSN7imnodes13EditorContextE", !22, i64 0, !27, i64 64, !29, i64 128, !18, i64 192, !13, i64 208, !18, i64 216, !18, i64 232, !7, i64 248, !31, i64 252}
!22 = !{!"_ZTSN7imnodes12_GLOBAL__N_110ObjectPoolINS0_8NodeDataEEE", !23, i64 0, !24, i64 16, !18, i64 32, !25, i64 48}
!23 = !{!"_ZTS8ImVectorIN7imnodes12_GLOBAL__N_18NodeDataEE", !6, i64 0, !6, i64 4, !10, i64 8}
!24 = !{!"_ZTS8ImVectorIbE", !6, i64 0, !6, i64 4, !10, i64 8}
!25 = !{!"_ZTS12ImGuiStorage", !26, i64 0}
!26 = !{!"_ZTS8ImVectorIN12ImGuiStorage16ImGuiStoragePairEE", !6, i64 0, !6, i64 4, !10, i64 8}
!27 = !{!"_ZTSN7imnodes12_GLOBAL__N_110ObjectPoolINS0_7PinDataEEE", !28, i64 0, !24, i64 16, !18, i64 32, !25, i64 48}
!28 = !{!"_ZTS8ImVectorIN7imnodes12_GLOBAL__N_17PinDataEE", !6, i64 0, !6, i64 4, !10, i64 8}
!29 = !{!"_ZTSN7imnodes12_GLOBAL__N_110ObjectPoolINS0_8LinkDataEEE", !30, i64 0, !24, i64 16, !18, i64 32, !25, i64 48}
!30 = !{!"_ZTS8ImVectorIN7imnodes12_GLOBAL__N_18LinkDataEE", !6, i64 0, !6, i64 4, !10, i64 8}
!31 = !{!"_ZTSN7imnodes12_GLOBAL__N_121ClickInteractionStateE", !32, i64 0, !34, i64 12}
!32 = !{!"_ZTSN7imnodes12_GLOBAL__N_121ClickInteractionState3$_1E", !6, i64 0, !33, i64 4, !7, i64 8}
!33 = !{!"_ZTSN7imnodes12_GLOBAL__N_113OptionalIndexE", !6, i64 0}
!34 = !{!"_ZTSN7imnodes12_GLOBAL__N_121ClickInteractionState3$_2E", !15, i64 0}
!35 = !{!12, !14, i64 8}
!36 = !{!21, !14, i64 212}


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

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef nonnull align 8 dereferenceable(280) ptr @_ZN7imnodes12_GLOBAL__N_118editor_context_getEv() local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7imnodes23EditorContextMoveToNodeEi(i32 noundef %0) local_unnamed_addr #1 {
  %2 = tail call noundef nonnull align 8 dereferenceable(280) ptr @_ZN7imnodes12_GLOBAL__N_118editor_context_getEv()
  %3 = tail call noundef nonnull align 8 dereferenceable(105) ptr @_ZN7imnodes12_GLOBAL__N_133object_pool_find_or_create_objectINS0_8NodeDataEEERT_RNS0_10ObjectPoolIS3_EEi(ptr noundef nonnull align 8 dereferenceable(64) %2, i32 noundef %0)
  %4 = getelementptr inbounds i8, ptr %3, i64 4
  %5 = getelementptr inbounds i8, ptr %2, i64 208
  %6 = load <2 x float>, ptr %4, align 4, !tbaa !5
  %7 = fneg <2 x float> %6
  store <2 x float> %7, ptr %5, align 8, !tbaa !5
  ret void
}

; Function Attrs: mustprogress uwtable
declare hidden noundef nonnull align 8 dereferenceable(105) ptr @_ZN7imnodes12_GLOBAL__N_133object_pool_find_or_create_objectINS0_8NodeDataEEERT_RNS0_10ObjectPoolIS3_EEi(ptr noundef nonnull align 8 dereferenceable(64), i32 noundef) local_unnamed_addr #1

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

!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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,SLPVectorizerPass,SROAPass,TailCallElimPass