; LLVM IR from Samson-Mano/EM_Propogation_simulation :: EM_Propogation_simulation/src/ImGui (imgui)

; 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.ImVector.2 = type { i32, i32, ptr }

@.str.91 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.554 = external hidden unnamed_addr constant [8 x i8], align 1

; 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN8ImVectorIP11ImGuiWindowEixEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5ImGui6PushIDEPKv(ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5ImGui5PopIDEv() #2

declare void @_ZN5ImGui7TreePopEv() #3

declare noundef zeroext i1 @_ZN5ImGui8TreeNodeEPKcS1_z(ptr noundef, ptr noundef, ...) #3

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5ImGui20DebugNodeWindowsListEP8ImVectorIP11ImGuiWindowEPKc(ptr noundef %0, ptr noundef %1) #2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %6 = load ptr, ptr %4, align 8, !tbaa !5
  %7 = load ptr, ptr %4, align 8, !tbaa !5
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.ImVector.2, ptr %8, i32 0, i32 0
  %10 = load i32, ptr %9, align 8, !tbaa !9
  %11 = call noundef zeroext i1 (ptr, ptr, ...) @_ZN5ImGui8TreeNodeEPKcS1_z(ptr noundef %6, ptr noundef @.str.554, ptr noundef %7, i32 noundef %10)
  br i1 %11, label %13, label %12

12:                                               ; preds = %2
  br label %35

13:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.ImVector.2, ptr %14, i32 0, i32 0
  %16 = load i32, ptr %15, align 8, !tbaa !9
  %17 = sub nsw i32 %16, 1
  store i32 %17, ptr %5, align 4, !tbaa !12
  br label %18

18:                                               ; preds = %31, %13
  %19 = load i32, ptr %5, align 4, !tbaa !12
  %20 = icmp sge i32 %19, 0
  br i1 %20, label %22, label %21

21:                                               ; preds = %18
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %34

22:                                               ; preds = %18
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = load i32, ptr %5, align 4, !tbaa !12
  %25 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN8ImVectorIP11ImGuiWindowEixEi(ptr noundef nonnull align 8 dereferenceable(16) %23, i32 noundef %24)
  %26 = load ptr, ptr %25, align 8, !tbaa !5
  call void @_ZN5ImGui6PushIDEPKv(ptr noundef %26)
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = load i32, ptr %5, align 4, !tbaa !12
  %29 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN8ImVectorIP11ImGuiWindowEixEi(ptr noundef nonnull align 8 dereferenceable(16) %27, i32 noundef %28)
  %30 = load ptr, ptr %29, align 8, !tbaa !5
  call void @_ZN5ImGui15DebugNodeWindowEP11ImGuiWindowPKc(ptr noundef %30, ptr noundef @.str.91)
  call void @_ZN5ImGui5PopIDEv()
  br label %31

31:                                               ; preds = %22
  %32 = load i32, ptr %5, align 4, !tbaa !12
  %33 = add nsw i32 %32, -1
  store i32 %33, ptr %5, align 4, !tbaa !12
  br label %18, !llvm.loop !13

34:                                               ; preds = %21
  call void @_ZN5ImGui7TreePopEv()
  br label %35

35:                                               ; preds = %34, %12
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5ImGui15DebugNodeWindowEP11ImGuiWindowPKc(ptr noundef, ptr noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 = { "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 uwtable "min-legal-vector-width"="64" "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 }

!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 = !{!"_ZTS8ImVectorIP11ImGuiWindowE", !11, i64 0, !11, i64 4, !6, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = !{!11, !11, 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.91 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.554 = external hidden unnamed_addr constant [8 x i8], align 1

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5ImGui6PushIDEPKv(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5ImGui5PopIDEv() local_unnamed_addr #1

declare void @_ZN5ImGui7TreePopEv() local_unnamed_addr #2

declare noundef zeroext i1 @_ZN5ImGui8TreeNodeEPKcS1_z(ptr noundef, ptr noundef, ...) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5ImGui20DebugNodeWindowsListEP8ImVectorIP11ImGuiWindowEPKc(ptr noundef %0, ptr noundef %1) local_unnamed_addr #1 {
  %3 = load i32, ptr %0, align 8, !tbaa !5
  %4 = tail call noundef zeroext i1 (ptr, ptr, ...) @_ZN5ImGui8TreeNodeEPKcS1_z(ptr noundef %1, ptr noundef nonnull @.str.554, ptr noundef %1, i32 noundef %3)
  br i1 %4, label %5, label %13

5:                                                ; preds = %2
  %6 = load i32, ptr %0, align 8, !tbaa !5
  %7 = icmp sgt i32 %6, 0
  br i1 %7, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %5
  tail call void @_ZN5ImGui7TreePopEv()
  br label %13

.lr.ph:                                           ; preds = %5, %.lr.ph
  %.0.in9 = phi i32 [ %.0, %.lr.ph ], [ %6, %5 ]
  %.0 = add nsw i32 %.0.in9, -1
  %8 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN8ImVectorIP11ImGuiWindowEixEi(ptr noundef nonnull align 8 dereferenceable(16) %0, i32 noundef %.0)
  %9 = load ptr, ptr %8, align 8, !tbaa !11
  tail call void @_ZN5ImGui6PushIDEPKv(ptr noundef %9)
  %10 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN8ImVectorIP11ImGuiWindowEixEi(ptr noundef nonnull align 8 dereferenceable(16) %0, i32 noundef %.0)
  %11 = load ptr, ptr %10, align 8, !tbaa !11
  tail call void @_ZN5ImGui15DebugNodeWindowEP11ImGuiWindowPKc(ptr noundef %11, ptr noundef nonnull @.str.91)
  tail call void @_ZN5ImGui5PopIDEv()
  %12 = icmp ugt i32 %.0.in9, 1
  br i1 %12, label %.lr.ph, label %._crit_edge, !llvm.loop !12

13:                                               ; preds = %2, %._crit_edge
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5ImGui15DebugNodeWindowEP11ImGuiWindowPKc(ptr noundef, ptr noundef) local_unnamed_addr #3

attributes #0 = { inlinehint 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 = { "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 uwtable "min-legal-vector-width"="64" "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, !7, i64 0}
!6 = !{!"_ZTS8ImVectorIP11ImGuiWindowE", !7, i64 0, !7, i64 4, !10, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!10, !10, 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