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

; 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.ImVec2 = type { float, float }
%struct.ImDrawList = type <{ %struct.ImVector.0, %struct.ImVector.1, %struct.ImVector.2, i32, i32, ptr, ptr, ptr, ptr, %struct.ImVector.3, %struct.ImVector.4, %struct.ImVector, %struct.ImDrawCmdHeader, %struct.ImDrawListSplitter, float, [4 x i8] }>
%struct.ImVector.0 = type { i32, i32, ptr }
%struct.ImVector.1 = type { i32, i32, ptr }
%struct.ImVector.2 = type { i32, i32, ptr }
%struct.ImVector.3 = type { i32, i32, ptr }
%struct.ImVector.4 = type { i32, i32, ptr }
%struct.ImVector = type { i32, i32, ptr }
%struct.ImDrawCmdHeader = type <{ %struct.ImVec4, ptr, i32, [4 x i8] }>
%struct.ImVec4 = type { float, float, float, float }
%struct.ImDrawListSplitter = type { i32, i32, %struct.ImVector.5 }
%struct.ImVector.5 = type { i32, i32, ptr }

; 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: nounwind
declare float @cosf(float noundef) #1

; Function Attrs: nounwind
declare float @sinf(float noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) unnamed_addr #2 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #3

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10ImDrawList11_PathArcToNERK6ImVec2fffi(ptr noundef nonnull align 8 dereferenceable(196) %0, ptr noundef nonnull align 4 dereferenceable(8) %1, float noundef %2, float noundef %3, float noundef %4, i32 noundef %5) #5 align 2 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca float, align 4
  %10 = alloca float, align 4
  %11 = alloca float, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca float, align 4
  %15 = alloca %struct.ImVec2, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store float %2, ptr %9, align 4, !tbaa !9
  store float %3, ptr %10, align 4, !tbaa !9
  store float %4, ptr %11, align 4, !tbaa !9
  store i32 %5, ptr %12, align 4, !tbaa !11
  %16 = load ptr, ptr %7, align 8
  %17 = load float, ptr %9, align 4, !tbaa !9
  %18 = fcmp olt float %17, 5.000000e-01
  br i1 %18, label %19, label %22

19:                                               ; preds = %6
  %20 = getelementptr inbounds %struct.ImDrawList, ptr %16, i32 0, i32 11
  %21 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN8ImVectorI6ImVec2E9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(16) %20, ptr noundef nonnull align 4 dereferenceable(8) %21)
  br label %64

22:                                               ; preds = %6
  %23 = getelementptr inbounds %struct.ImDrawList, ptr %16, i32 0, i32 11
  %24 = getelementptr inbounds %struct.ImDrawList, ptr %16, i32 0, i32 11
  %25 = getelementptr inbounds %struct.ImVector, ptr %24, i32 0, i32 0
  %26 = load i32, ptr %25, align 8, !tbaa !13
  %27 = load i32, ptr %12, align 4, !tbaa !11
  %28 = add nsw i32 %27, 1
  %29 = add nsw i32 %26, %28
  call void @_ZN8ImVectorI6ImVec2E7reserveEi(ptr noundef nonnull align 8 dereferenceable(16) %23, i32 noundef %29)
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 0, ptr %13, align 4, !tbaa !11
  br label %30

30:                                               ; preds = %61, %22
  %31 = load i32, ptr %13, align 4, !tbaa !11
  %32 = load i32, ptr %12, align 4, !tbaa !11
  %33 = icmp sle i32 %31, %32
  br i1 %33, label %35, label %34

34:                                               ; preds = %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %64

35:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %36 = load float, ptr %10, align 4, !tbaa !9
  %37 = load i32, ptr %13, align 4, !tbaa !11
  %38 = sitofp i32 %37 to float
  %39 = load i32, ptr %12, align 4, !tbaa !11
  %40 = sitofp i32 %39 to float
  %41 = fdiv float %38, %40
  %42 = load float, ptr %11, align 4, !tbaa !9
  %43 = load float, ptr %10, align 4, !tbaa !9
  %44 = fsub float %42, %43
  %45 = call float @llvm.fmuladd.f32(float %41, float %44, float %36)
  store float %45, ptr %14, align 4, !tbaa !9
  %46 = getelementptr inbounds %struct.ImDrawList, ptr %16, i32 0, i32 11
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %47 = load ptr, ptr %8, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.ImVec2, ptr %47, i32 0, i32 0
  %49 = load float, ptr %48, align 4, !tbaa !25
  %50 = load float, ptr %14, align 4, !tbaa !9
  %51 = call float @cosf(float noundef %50) #6
  %52 = load float, ptr %9, align 4, !tbaa !9
  %53 = call float @llvm.fmuladd.f32(float %51, float %52, float %49)
  %54 = load ptr, ptr %8, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.ImVec2, ptr %54, i32 0, i32 1
  %56 = load float, ptr %55, align 4, !tbaa !27
  %57 = load float, ptr %14, align 4, !tbaa !9
  %58 = call float @sinf(float noundef %57) #6
  %59 = load float, ptr %9, align 4, !tbaa !9
  %60 = call float @llvm.fmuladd.f32(float %58, float %59, float %56)
  call void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8) %15, float noundef %53, float noundef %60)
  call void @_ZN8ImVectorI6ImVec2E9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(16) %46, ptr noundef nonnull align 4 dereferenceable(8) %15)
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %61

61:                                               ; preds = %35
  %62 = load i32, ptr %13, align 4, !tbaa !11
  %63 = add nsw i32 %62, 1
  store i32 %63, ptr %13, align 4, !tbaa !11
  br label %30, !llvm.loop !28

64:                                               ; preds = %34, %19
  ret void
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8ImVectorI6ImVec2E7reserveEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) #4 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 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 #3 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { inlinehint 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 #5 = { 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 #6 = { 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, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !12, i64 120}
!14 = !{!"_ZTS10ImDrawList", !15, i64 0, !16, i64 16, !17, i64 32, !12, i64 48, !12, i64 52, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !18, i64 88, !19, i64 104, !20, i64 120, !21, i64 136, !23, i64 168, !10, i64 192}
!15 = !{!"_ZTS8ImVectorI9ImDrawCmdE", !12, i64 0, !12, i64 4, !6, i64 8}
!16 = !{!"_ZTS8ImVectorItE", !12, i64 0, !12, i64 4, !6, i64 8}
!17 = !{!"_ZTS8ImVectorI10ImDrawVertE", !12, i64 0, !12, i64 4, !6, i64 8}
!18 = !{!"_ZTS8ImVectorI6ImVec4E", !12, i64 0, !12, i64 4, !6, i64 8}
!19 = !{!"_ZTS8ImVectorIPvE", !12, i64 0, !12, i64 4, !6, i64 8}
!20 = !{!"_ZTS8ImVectorI6ImVec2E", !12, i64 0, !12, i64 4, !6, i64 8}
!21 = !{!"_ZTS15ImDrawCmdHeader", !22, i64 0, !6, i64 16, !12, i64 24}
!22 = !{!"_ZTS6ImVec4", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12}
!23 = !{!"_ZTS18ImDrawListSplitter", !12, i64 0, !12, i64 4, !24, i64 8}
!24 = !{!"_ZTS8ImVectorI13ImDrawChannelE", !12, i64 0, !12, i64 4, !6, i64 8}
!25 = !{!26, !10, i64 0}
!26 = !{!"_ZTS6ImVec2", !10, i64 0, !10, i64 4}
!27 = !{!26, !10, i64 4}
!28 = distinct !{!28, !29}
!29 = !{!"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"

%struct.ImVec2 = type { float, float }

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

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare float @cosf(float noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare float @sinf(float noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) unnamed_addr #2 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #3

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10ImDrawList11_PathArcToNERK6ImVec2fffi(ptr noundef nonnull align 8 dereferenceable(196) %0, ptr noundef nonnull align 4 dereferenceable(8) %1, float noundef %2, float noundef %3, float noundef %4, i32 noundef %5) local_unnamed_addr #5 align 2 {
  %7 = alloca %struct.ImVec2, align 4
  %8 = fcmp olt float %2, 5.000000e-01
  %9 = getelementptr inbounds i8, ptr %0, i64 120
  br i1 %8, label %10, label %11

10:                                               ; preds = %6
  tail call void @_ZN8ImVectorI6ImVec2E9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 4 dereferenceable(8) %1)
  br label %.loopexit

11:                                               ; preds = %6
  %12 = load i32, ptr %9, align 8, !tbaa !5
  %13 = add i32 %5, 1
  %14 = add nsw i32 %13, %12
  tail call void @_ZN8ImVectorI6ImVec2E7reserveEi(ptr noundef nonnull align 8 dereferenceable(16) %9, i32 noundef %14)
  %.not19 = icmp slt i32 %5, 0
  br i1 %.not19, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %11
  %15 = uitofp nneg i32 %5 to float
  %16 = fsub float %4, %3
  %17 = getelementptr inbounds i8, ptr %1, i64 4
  br label %18

18:                                               ; preds = %.lr.ph, %18
  %.020 = phi i32 [ 0, %.lr.ph ], [ %28, %18 ]
  %19 = uitofp nneg i32 %.020 to float
  %20 = fdiv float %19, %15
  %21 = call float @llvm.fmuladd.f32(float %20, float %16, float %3)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %22 = load float, ptr %1, align 4, !tbaa !22
  %23 = call float @cosf(float noundef %21) #6
  %24 = call float @llvm.fmuladd.f32(float %23, float %2, float %22)
  %25 = load float, ptr %17, align 4, !tbaa !24
  %26 = call float @sinf(float noundef %21) #6
  %27 = call float @llvm.fmuladd.f32(float %26, float %2, float %25)
  call void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8) %7, float noundef %24, float noundef %27)
  call void @_ZN8ImVectorI6ImVec2E9push_backERKS0_(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 4 dereferenceable(8) %7)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  %28 = add nuw i32 %.020, 1
  %exitcond.not = icmp eq i32 %.020, %5
  br i1 %exitcond.not, label %.loopexit, label %18, !llvm.loop !25

.loopexit:                                        ; preds = %18, %11, %10
  ret void
}

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nofree nounwind willreturn memory(write) "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 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 #3 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { inlinehint 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 #5 = { 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 #6 = { 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, !8, i64 120}
!6 = !{!"_ZTS10ImDrawList", !7, i64 0, !12, i64 16, !13, i64 32, !8, i64 48, !8, i64 52, !11, i64 56, !11, i64 64, !11, i64 72, !11, i64 80, !14, i64 88, !15, i64 104, !16, i64 120, !17, i64 136, !20, i64 168, !19, i64 192}
!7 = !{!"_ZTS8ImVectorI9ImDrawCmdE", !8, i64 0, !8, i64 4, !11, i64 8}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"any pointer", !9, i64 0}
!12 = !{!"_ZTS8ImVectorItE", !8, i64 0, !8, i64 4, !11, i64 8}
!13 = !{!"_ZTS8ImVectorI10ImDrawVertE", !8, i64 0, !8, i64 4, !11, i64 8}
!14 = !{!"_ZTS8ImVectorI6ImVec4E", !8, i64 0, !8, i64 4, !11, i64 8}
!15 = !{!"_ZTS8ImVectorIPvE", !8, i64 0, !8, i64 4, !11, i64 8}
!16 = !{!"_ZTS8ImVectorI6ImVec2E", !8, i64 0, !8, i64 4, !11, i64 8}
!17 = !{!"_ZTS15ImDrawCmdHeader", !18, i64 0, !11, i64 16, !8, i64 24}
!18 = !{!"_ZTS6ImVec4", !19, i64 0, !19, i64 4, !19, i64 8, !19, i64 12}
!19 = !{!"float", !9, i64 0}
!20 = !{!"_ZTS18ImDrawListSplitter", !8, i64 0, !8, i64 4, !21, i64 8}
!21 = !{!"_ZTS8ImVectorI13ImDrawChannelE", !8, i64 0, !8, i64 4, !11, i64 8}
!22 = !{!23, !19, i64 0}
!23 = !{!"_ZTS6ImVec2", !19, i64 0, !19, i64 4}
!24 = !{!23, !19, i64 4}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}


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