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

; 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.ImDrawListSharedData = type { %struct.ImVec2, ptr, float, float, float, %struct.ImVec4, i32, [12 x %struct.ImVec2], [64 x i8], ptr }
%struct.ImVec4 = type { float, float, 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN20ImDrawListSharedDataC2Ev(ptr noundef nonnull align 8 dereferenceable(216) %0) unnamed_addr #2 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca float, align 4
  %5 = alloca %struct.ImVec2, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %6 = load ptr, ptr %2, align 8
  %7 = getelementptr inbounds %struct.ImDrawListSharedData, ptr %6, i32 0, i32 0
  call void @_ZN6ImVec2C2Ev(ptr noundef nonnull align 4 dereferenceable(8) %7)
  %8 = getelementptr inbounds %struct.ImDrawListSharedData, ptr %6, i32 0, i32 5
  call void @_ZN6ImVec4C2Ev(ptr noundef nonnull align 4 dereferenceable(16) %8)
  %9 = getelementptr inbounds %struct.ImDrawListSharedData, ptr %6, i32 0, i32 7
  %10 = getelementptr inbounds [12 x %struct.ImVec2], ptr %9, i32 0, i32 0
  %11 = getelementptr inbounds %struct.ImVec2, ptr %10, i64 12
  br label %12

12:                                               ; preds = %12, %1
  %13 = phi ptr [ %10, %1 ], [ %14, %12 ]
  call void @_ZN6ImVec2C2Ev(ptr noundef nonnull align 4 dereferenceable(8) %13)
  %14 = getelementptr inbounds %struct.ImVec2, ptr %13, i64 1
  %15 = icmp eq ptr %14, %11
  br i1 %15, label %16, label %12

16:                                               ; preds = %12
  call void @llvm.memset.p0.i64(ptr align 8 %6, i8 0, i64 216, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %17

17:                                               ; preds = %35, %16
  %18 = load i32, ptr %3, align 4, !tbaa !9
  %19 = icmp slt i32 %18, 12
  br i1 %19, label %21, label %20

20:                                               ; preds = %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %38

21:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  %22 = load i32, ptr %3, align 4, !tbaa !9
  %23 = sitofp i32 %22 to float
  %24 = fmul float %23, 2.000000e+00
  %25 = fmul float %24, 0x400921FB60000000
  %26 = fdiv float %25, 1.200000e+01
  store float %26, ptr %4, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  %27 = load float, ptr %4, align 4, !tbaa !11
  %28 = call float @cosf(float noundef %27) #6
  %29 = load float, ptr %4, align 4, !tbaa !11
  %30 = call float @sinf(float noundef %29) #6
  call void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8) %5, float noundef %28, float noundef %30)
  %31 = getelementptr inbounds %struct.ImDrawListSharedData, ptr %6, i32 0, i32 7
  %32 = load i32, ptr %3, align 4, !tbaa !9
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [12 x %struct.ImVec2], ptr %31, i64 0, i64 %33
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %34, ptr align 4 %5, i64 8, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %35

35:                                               ; preds = %21
  %36 = load i32, ptr %3, align 4, !tbaa !9
  %37 = add nsw i32 %36, 1
  store i32 %37, ptr %3, align 4, !tbaa !9
  br label %17, !llvm.loop !14

38:                                               ; preds = %20
  ret void
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6ImVec4C2Ev(ptr noundef nonnull align 4 dereferenceable(16)) unnamed_addr #3 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

; Function Attrs: nounwind
declare float @cosf(float noundef) #5

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 #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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{i64 0, i64 4, !11, i64 4, i64 4, !11}
!14 = distinct !{!14, !15}
!15 = !{!"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 nounwind uwtable
define dso_local void @_ZN20ImDrawListSharedDataC2Ev(ptr noundef nonnull align 8 dereferenceable(216) %0) unnamed_addr #1 align 2 {
  %2 = alloca %struct.ImVec2, align 8
  tail call void @_ZN6ImVec2C2Ev(ptr noundef nonnull align 4 dereferenceable(8) %0)
  %3 = getelementptr inbounds i8, ptr %0, i64 28
  tail call void @_ZN6ImVec4C2Ev(ptr noundef nonnull align 4 dereferenceable(16) %3)
  %.ptr = getelementptr inbounds i8, ptr %0, i64 48
  tail call void @_ZN6ImVec2C2Ev(ptr noundef nonnull align 4 dereferenceable(8) %.ptr)
  %.ptr.1 = getelementptr inbounds i8, ptr %0, i64 56
  tail call void @_ZN6ImVec2C2Ev(ptr noundef nonnull align 4 dereferenceable(8) %.ptr.1)
  %.ptr.2 = getelementptr inbounds i8, ptr %0, i64 64
  tail call void @_ZN6ImVec2C2Ev(ptr noundef nonnull align 4 dereferenceable(8) %.ptr.2)
  %.ptr.3 = getelementptr inbounds i8, ptr %0, i64 72
  tail call void @_ZN6ImVec2C2Ev(ptr noundef nonnull align 4 dereferenceable(8) %.ptr.3)
  %.ptr.4 = getelementptr inbounds i8, ptr %0, i64 80
  tail call void @_ZN6ImVec2C2Ev(ptr noundef nonnull align 4 dereferenceable(8) %.ptr.4)
  %.ptr.5 = getelementptr inbounds i8, ptr %0, i64 88
  tail call void @_ZN6ImVec2C2Ev(ptr noundef nonnull align 4 dereferenceable(8) %.ptr.5)
  %.ptr.6 = getelementptr inbounds i8, ptr %0, i64 96
  tail call void @_ZN6ImVec2C2Ev(ptr noundef nonnull align 4 dereferenceable(8) %.ptr.6)
  %.ptr.7 = getelementptr inbounds i8, ptr %0, i64 104
  tail call void @_ZN6ImVec2C2Ev(ptr noundef nonnull align 4 dereferenceable(8) %.ptr.7)
  %.ptr.8 = getelementptr inbounds i8, ptr %0, i64 112
  tail call void @_ZN6ImVec2C2Ev(ptr noundef nonnull align 4 dereferenceable(8) %.ptr.8)
  %.ptr.9 = getelementptr inbounds i8, ptr %0, i64 120
  tail call void @_ZN6ImVec2C2Ev(ptr noundef nonnull align 4 dereferenceable(8) %.ptr.9)
  %.ptr.10 = getelementptr inbounds i8, ptr %0, i64 128
  tail call void @_ZN6ImVec2C2Ev(ptr noundef nonnull align 4 dereferenceable(8) %.ptr.10)
  %.ptr.11 = getelementptr inbounds i8, ptr %0, i64 136
  tail call void @_ZN6ImVec2C2Ev(ptr noundef nonnull align 4 dereferenceable(8) %.ptr.11)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(216) %0, i8 0, i64 216, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  call void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8) %2, float noundef 1.000000e+00, float noundef 0.000000e+00)
  %4 = load i64, ptr %2, align 8
  store i64 %4, ptr %.ptr, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  call void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8) %2, float noundef 0x3FEBB67AE0000000, float noundef 5.000000e-01)
  %5 = getelementptr inbounds i8, ptr %0, i64 56
  %6 = load i64, ptr %2, align 8
  store i64 %6, ptr %5, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  call void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8) %2, float noundef 0x3FDFFFFFE0000000, float noundef 0x3FEBB67B00000000)
  %7 = getelementptr inbounds i8, ptr %0, i64 64
  %8 = load i64, ptr %2, align 8
  store i64 %8, ptr %7, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  call void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8) %2, float noundef 0xBE6777A5C0000000, float noundef 1.000000e+00)
  %9 = getelementptr inbounds i8, ptr %0, i64 72
  %10 = load i64, ptr %2, align 8
  store i64 %10, ptr %9, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  call void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8) %2, float noundef 0xBFE0000020000000, float noundef 0x3FEBB67AE0000000)
  %11 = getelementptr inbounds i8, ptr %0, i64 80
  %12 = load i64, ptr %2, align 8
  store i64 %12, ptr %11, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  call void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8) %2, float noundef 0xBFEBB67B20000000, float noundef 0x3FDFFFFF40000000)
  %13 = getelementptr inbounds i8, ptr %0, i64 88
  %14 = load i64, ptr %2, align 8
  store i64 %14, ptr %13, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  call void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8) %2, float noundef -1.000000e+00, float noundef 0xBE7777A5C0000000)
  %15 = getelementptr inbounds i8, ptr %0, i64 96
  %16 = load i64, ptr %2, align 8
  store i64 %16, ptr %15, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  call void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8) %2, float noundef 0xBFEBB67AA0000000, float noundef 0xBFE0000060000000)
  %17 = getelementptr inbounds i8, ptr %0, i64 104
  %18 = load i64, ptr %2, align 8
  store i64 %18, ptr %17, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  call void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8) %2, float noundef 0xBFDFFFFFA0000000, float noundef 0xBFEBB67B00000000)
  %19 = getelementptr inbounds i8, ptr %0, i64 112
  %20 = load i64, ptr %2, align 8
  store i64 %20, ptr %19, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  call void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8) %2, float noundef 0x3E499BC5C0000000, float noundef -1.000000e+00)
  %21 = getelementptr inbounds i8, ptr %0, i64 120
  %22 = load i64, ptr %2, align 8
  store i64 %22, ptr %21, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  call void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8) %2, float noundef 0x3FE00000C0000000, float noundef 0xBFEBB67A80000000)
  %23 = getelementptr inbounds i8, ptr %0, i64 128
  %24 = load i64, ptr %2, align 8
  store i64 %24, ptr %23, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  call void @_ZN6ImVec2C2Eff(ptr noundef nonnull align 4 dereferenceable(8) %2, float noundef 0x3FEBB67B40000000, float noundef 0xBFDFFFFF00000000)
  %25 = getelementptr inbounds i8, ptr %0, i64 136
  %26 = load i64, ptr %2, align 8
  store i64 %26, ptr %25, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  ret void
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN6ImVec4C2Ev(ptr noundef nonnull align 4 dereferenceable(16)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

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

attributes #0 = { mustprogress 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 nocallback nofree nounwind willreturn memory(argmem: write) }
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)"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass