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

; 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 @_ZN10ImDrawList10PathStrokeEjbf(ptr noundef nonnull align 8 dereferenceable(196), i32 noundef, i1 noundef zeroext, float noundef) #4 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10ImDrawList9AddCircleERK6ImVec2fjif(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, float noundef %5) #3 align 2 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca float, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca float, align 4
  %13 = alloca i32, align 4
  %14 = alloca float, 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 i32 %3, ptr %10, align 4, !tbaa !11
  store i32 %4, ptr %11, align 4, !tbaa !11
  store float %5, ptr %12, align 4, !tbaa !9
  %15 = load ptr, ptr %7, align 8
  %16 = load i32, ptr %10, align 4, !tbaa !11
  %17 = and i32 %16, -16777216
  %18 = icmp eq i32 %17, 0
  br i1 %18, label %22, label %19

19:                                               ; preds = %6
  %20 = load float, ptr %9, align 4, !tbaa !9
  %21 = fcmp ole float %20, 0.000000e+00
  br i1 %21, label %22, label %23

22:                                               ; preds = %19, %6
  br label %82

23:                                               ; preds = %19
  %24 = load i32, ptr %11, align 4, !tbaa !11
  %25 = icmp sle i32 %24, 0
  br i1 %25, label %26, label %55

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

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

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

54:                                               ; preds = %41, %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %58

55:                                               ; preds = %23
  %56 = load i32, ptr %11, align 4, !tbaa !11
  %57 = call noundef i32 @_ZL7ImClampIiET_S0_S0_S0_(i32 noundef %56, i32 noundef 3, i32 noundef 512)
  store i32 %57, ptr %11, align 4, !tbaa !11
  br label %58

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

68:                                               ; preds = %58
  %69 = load ptr, ptr %8, align 8, !tbaa !5
  %70 = load float, ptr %9, align 4, !tbaa !9
  %71 = fsub float %70, 5.000000e-01
  call void @_ZN10ImDrawList13PathArcToFastERK6ImVec2fii(ptr noundef nonnull align 8 dereferenceable(196) %15, ptr noundef nonnull align 4 dereferenceable(8) %69, float noundef %71, i32 noundef 0, i32 noundef 11)
  br label %79

72:                                               ; preds = %58
  %73 = load ptr, ptr %8, align 8, !tbaa !5
  %74 = load float, ptr %9, align 4, !tbaa !9
  %75 = fsub float %74, 5.000000e-01
  %76 = load float, ptr %14, align 4, !tbaa !9
  %77 = load i32, ptr %11, align 4, !tbaa !11
  %78 = sub nsw i32 %77, 1
  call void @_ZN10ImDrawList9PathArcToERK6ImVec2fffi(ptr noundef nonnull align 8 dereferenceable(196) %15, ptr noundef nonnull align 4 dereferenceable(8) %73, float noundef %75, float noundef 0.000000e+00, float noundef %76, i32 noundef %78)
  br label %79

79:                                               ; preds = %72, %68
  %80 = load i32, ptr %10, align 4, !tbaa !11
  %81 = load float, ptr %12, align 4, !tbaa !9
  call void @_ZN10ImDrawList10PathStrokeEjbf(ptr noundef nonnull align 8 dereferenceable(196) %15, i32 noundef %80, i1 noundef zeroext true, float noundef %81)
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %82

82:                                               ; preds = %79, %22
  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 @_ZN10ImDrawList10PathStrokeEjbf(ptr noundef nonnull align 8 dereferenceable(196), i32 noundef, i1 noundef zeroext, float noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN10ImDrawList9AddCircleERK6ImVec2fjif(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, float noundef %5) local_unnamed_addr #2 align 2 {
  %7 = icmp ult i32 %3, 16777216
  %8 = fcmp ole float %2, 0.000000e+00
  %or.cond = or i1 %8, %7
  br i1 %or.cond, label %48, label %9

9:                                                ; preds = %6
  %10 = icmp slt i32 %4, 1
  br i1 %10, label %11, label %34

11:                                               ; preds = %9
  %12 = fptosi float %2 to i32
  %13 = icmp slt i32 %12, 65
  br i1 %13, label %14, label %23

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

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

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

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

38:                                               ; preds = %36
  %39 = fadd float %2, -5.000000e-01
  tail call void @_ZN10ImDrawList13PathArcToFastERK6ImVec2fii(ptr noundef nonnull align 8 dereferenceable(196) %0, ptr noundef nonnull align 4 dereferenceable(8) %1, float noundef %39, i32 noundef 0, i32 noundef 11)
  br label %47

40:                                               ; preds = %36
  %41 = sitofp i32 %.1 to float
  %42 = fadd float %41, -1.000000e+00
  %43 = fmul float %42, 0x401921FB60000000
  %44 = fdiv float %43, %41
  %45 = fadd float %2, -5.000000e-01
  %46 = 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 %45, float noundef 0.000000e+00, float noundef %44, i32 noundef %46)
  br label %47

47:                                               ; preds = %40, %38
  tail call void @_ZN10ImDrawList10PathStrokeEjbf(ptr noundef nonnull align 8 dereferenceable(196) %0, i32 noundef %3, i1 noundef zeroext true, float noundef %5)
  br label %48

48:                                               ; preds = %6, %47
  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