; LLVM IR from Devaniti/BoolkaEngine :: ThirdParty/imgui/imgui_draw.ll (ZN10ImDrawList15AddCircleFilledERK6ImVec2fji)

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

; 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 hidden noundef i32 @_ZL7ImClampIiET_S0_S0_S0_(i32 noundef, i32 noundef, i32 noundef) #1

; Function Attrs: nounwind
declare float @acosf(float noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10ImDrawList13PathArcToFastERK6ImVec2fii(ptr noundef nonnull align 8 dereferenceable(196), ptr noundef nonnull align 4 dereferenceable(8), float noundef, i32 noundef, i32 noundef) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10ImDrawList9PathArcToERK6ImVec2fffi(ptr noundef nonnull align 8 dereferenceable(196), ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef, float noundef, i32 noundef) #3 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10ImDrawList15AddCircleFilledERK6ImVec2fji(ptr noundef nonnull align 8 dereferenceable(196) %0, ptr noundef nonnull align 4 dereferenceable(8) %1, float noundef %2, i32 noundef %3, i32 noundef %4) #3 align 2 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca float, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca float, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store float %2, ptr %8, align 4, !tbaa !9
  store i32 %3, ptr %9, align 4, !tbaa !11
  store i32 %4, ptr %10, align 4, !tbaa !11
  %13 = load ptr, ptr %6, align 8
  %14 = load i32, ptr %9, align 4, !tbaa !11
  %15 = and i32 %14, -16777216
  %16 = icmp eq i32 %15, 0
  br i1 %16, label %20, label %17

17:                                               ; preds = %5
  %18 = load float, ptr %8, align 4, !tbaa !9
  %19 = fcmp ole float %18, 0.000000e+00
  br i1 %19, label %20, label %21

20:                                               ; preds = %17, %5
  br label %77

21:                                               ; preds = %17
  %22 = load i32, ptr %10, align 4, !tbaa !11
  %23 = icmp sle i32 %22, 0
  br i1 %23, label %24, label %53

24:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %25 = load float, ptr %8, align 4, !tbaa !9
  %26 = fptosi float %25 to i32
  %27 = sub nsw i32 %26, 1
  store i32 %27, ptr %11, align 4, !tbaa !11
  %28 = load i32, ptr %11, align 4, !tbaa !11
  %29 = icmp slt i32 %28, 64
  br i1 %29, label %30, label %39

30:                                               ; preds = %24
  %31 = getelementptr inbounds %struct.ImDrawList, ptr %13, i32 0, i32 5
  %32 = load ptr, ptr %31, align 8, !tbaa !13
  %33 = getelementptr inbounds %struct.ImDrawListSharedData, ptr %32, i32 0, i32 8
  %34 = load i32, ptr %11, align 4, !tbaa !11
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [64 x i8], ptr %33, i64 0, i64 %35
  %37 = load i8, ptr %36, align 1, !tbaa !25
  %38 = zext i8 %37 to i32
  store i32 %38, ptr %10, align 4, !tbaa !11
  br label %52

39:                                               ; preds = %24
  %40 = load float, ptr %8, align 4, !tbaa !9
  %41 = getelementptr inbounds %struct.ImDrawList, ptr %13, i32 0, i32 5
  %42 = load ptr, ptr %41, align 8, !tbaa !13
  %43 = getelementptr inbounds %struct.ImDrawListSharedData, ptr %42, i32 0, i32 4
  %44 = load float, ptr %43, align 8, !tbaa !26
  %45 = fsub float %40, %44
  %46 = load float, ptr %8, align 4, !tbaa !9
  %47 = fdiv float %45, %46
  %48 = call float @acosf(float noundef %47) #5
  %49 = fdiv float 0x401921FB60000000, %48
  %50 = fptosi float %49 to i32
  %51 = call noundef i32 @_ZL7ImClampIiET_S0_S0_S0_(i32 noundef %50, i32 noundef 12, i32 noundef 512)
  store i32 %51, ptr %10, align 4, !tbaa !11
  br label %52

52:                                               ; preds = %39, %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %56

53:                                               ; preds = %21
  %54 = load i32, ptr %10, align 4, !tbaa !11
  %55 = call noundef i32 @_ZL7ImClampIiET_S0_S0_S0_(i32 noundef %54, i32 noundef 3, i32 noundef 512)
  store i32 %55, ptr %10, align 4, !tbaa !11
  br label %56

56:                                               ; preds = %53, %52
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %57 = load i32, ptr %10, align 4, !tbaa !11
  %58 = sitofp i32 %57 to float
  %59 = fsub float %58, 1.000000e+00
  %60 = fmul float 0x401921FB60000000, %59
  %61 = load i32, ptr %10, align 4, !tbaa !11
  %62 = sitofp i32 %61 to float
  %63 = fdiv float %60, %62
  store float %63, ptr %12, align 4, !tbaa !9
  %64 = load i32, ptr %10, align 4, !tbaa !11
  %65 = icmp eq i32 %64, 12
  br i1 %65, label %66, label %69

66:                                               ; preds = %56
  %67 = load ptr, ptr %7, align 8, !tbaa !5
  %68 = load float, ptr %8, align 4, !tbaa !9
  call void @_ZN10ImDrawList13PathArcToFastERK6ImVec2fii(ptr noundef nonnull align 8 dereferenceable(196) %13, ptr noundef nonnull align 4 dereferenceable(8) %67, float noundef %68, i32 noundef 0, i32 noundef 11)
  br label %75

69:                                               ; preds = %56
  %70 = load ptr, ptr %7, align 8, !tbaa !5
  %71 = load float, ptr %8, align 4, !tbaa !9
  %72 = load float, ptr %12, align 4, !tbaa !9
  %73 = load i32, ptr %10, align 4, !tbaa !11
  %74 = sub nsw i32 %73, 1
  call void @_ZN10ImDrawList9PathArcToERK6ImVec2fffi(ptr noundef nonnull align 8 dereferenceable(196) %13, ptr noundef nonnull align 4 dereferenceable(8) %70, float noundef %71, float noundef 0.000000e+00, float noundef %72, i32 noundef %74)
  br label %75

75:                                               ; preds = %69, %66
  %76 = load i32, ptr %9, align 4, !tbaa !11
  call void @_ZN10ImDrawList14PathFillConvexEj(ptr noundef nonnull align 8 dereferenceable(196) %13, i32 noundef %76)
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %77

77:                                               ; preds = %75, %20
  ret void
}

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 = { 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 #3 = { 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 #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 = { 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, !6, i64 56}
!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 = !{!7, !7, i64 0}
!26 = !{!27, !10, i64 24}
!27 = !{!"_ZTS20ImDrawListSharedData", !28, i64 0, !6, i64 8, !10, i64 16, !10, i64 20, !10, i64 24, !22, i64 28, !12, i64 44, !7, i64 48, !7, i64 144, !6, i64 208}
!28 = !{!"_ZTS6ImVec2", !10, i64 0, !10, i64 4}


; 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: inlinehint mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL7ImClampIiET_S0_S0_S0_(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10ImDrawList15AddCircleFilledERK6ImVec2fji(ptr noundef nonnull align 8 dereferenceable(196) %0, ptr noundef nonnull align 4 dereferenceable(8) %1, float noundef %2, i32 noundef %3, i32 noundef %4) local_unnamed_addr #2 align 2 {
  %6 = icmp ult i32 %3, 16777216
  %7 = fcmp ole float %2, 0.000000e+00
  %or.cond = or i1 %7, %6
  br i1 %or.cond, label %45, label %8

8:                                                ; preds = %5
  %9 = icmp slt i32 %4, 1
  br i1 %9, label %10, label %33

10:                                               ; preds = %8
  %11 = fptosi float %2 to i32
  %12 = icmp slt i32 %11, 65
  br i1 %12, label %13, label %22

13:                                               ; preds = %10
  %14 = add nsw i32 %11, -1
  %15 = getelementptr inbounds i8, ptr %0, i64 56
  %16 = load ptr, ptr %15, align 8, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %16, i64 144
  %18 = sext i32 %14 to i64
  %19 = getelementptr inbounds [64 x i8], ptr %17, i64 0, i64 %18
  %20 = load i8, ptr %19, align 1, !tbaa !22
  %21 = zext i8 %20 to i32
  br label %35

22:                                               ; preds = %10
  %23 = getelementptr inbounds i8, ptr %0, i64 56
  %24 = load ptr, ptr %23, align 8, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %24, i64 24
  %26 = load float, ptr %25, align 8, !tbaa !23
  %27 = fsub float %2, %26
  %28 = fdiv float %27, %2
  %29 = tail call float @acosf(float noundef %28) #4
  %30 = fdiv float 0x401921FB60000000, %29
  %31 = fptosi float %30 to i32
  %32 = tail call noundef i32 @_ZL7ImClampIiET_S0_S0_S0_(i32 noundef %31, i32 noundef 12, i32 noundef 512)
  br label %35

33:                                               ; preds = %8
  %34 = tail call noundef i32 @_ZL7ImClampIiET_S0_S0_S0_(i32 noundef %4, i32 noundef 3, i32 noundef 512)
  br label %35

35:                                               ; preds = %13, %22, %33
  %.1 = phi i32 [ %34, %33 ], [ %21, %13 ], [ %32, %22 ]
  %36 = icmp eq i32 %.1, 12
  br i1 %36, label %37, label %38

37:                                               ; preds = %35
  tail call void @_ZN10ImDrawList13PathArcToFastERK6ImVec2fii(ptr noundef nonnull align 8 dereferenceable(196) %0, ptr noundef nonnull align 4 dereferenceable(8) %1, float noundef %2, i32 noundef 0, i32 noundef 11)
  br label %44

38:                                               ; preds = %35
  %39 = sitofp i32 %.1 to float
  %40 = fadd float %39, -1.000000e+00
  %41 = fmul float %40, 0x401921FB60000000
  %42 = fdiv float %41, %39
  %43 = add nsw i32 %.1, -1
  tail call void @_ZN10ImDrawList9PathArcToERK6ImVec2fffi(ptr noundef nonnull align 8 dereferenceable(196) %0, ptr noundef nonnull align 4 dereferenceable(8) %1, float noundef %2, float noundef 0.000000e+00, float noundef %42, i32 noundef %43)
  br label %44

44:                                               ; preds = %38, %37
  tail call void @_ZN10ImDrawList14PathFillConvexEj(ptr noundef nonnull align 8 dereferenceable(196) %0, i32 noundef %3)
  br label %45

45:                                               ; preds = %5, %44
  ret void
}

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 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 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 = { 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 #4 = { 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, !11, i64 56}
!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 = !{!9, !9, i64 0}
!23 = !{!24, !19, i64 24}
!24 = !{!"_ZTS20ImDrawListSharedData", !25, i64 0, !11, i64 8, !19, i64 16, !19, i64 20, !19, i64 24, !18, i64 28, !8, i64 44, !9, i64 48, !9, i64 144, !11, i64 208}
!25 = !{!"_ZTS6ImVec2", !19, i64 0, !19, i64 4}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass