; LLVM IR from Dragons-Lake/REI :: sources/REI_Integration/3rdParty/nanovg (nanovg)

; 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.NVGcontext = type { %struct.NVGparams, ptr, i32, i32, float, float, [32 x %struct.NVGstate], i32, ptr, float, float, float, float, ptr, [4 x i32], i32, i32, i32, i32, i32 }
%struct.NVGparams = type { ptr, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.NVGstate = type { %struct.NVGcompositeOperationState, %struct.NVGpaint, %struct.NVGpaint, float, float, i32, i32, float, [6 x float], %struct.NVGscissor, float, float, float, float, i32, i32 }
%struct.NVGcompositeOperationState = type { i32, i32, i32, i32 }
%struct.NVGpaint = type { [6 x float], [2 x float], float, float, %struct.NVGcolor, %struct.NVGcolor, i32 }
%struct.NVGcolor = type { %union.anon }
%union.anon = type { [4 x float] }
%struct.NVGscissor = type { [6 x float], [2 x 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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #1

; Function Attrs: nounwind uwtable
declare hidden void @nvg__appendCommands(ptr noundef, ptr noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @nvgQuadTo(ptr noundef %0, float noundef %1, float noundef %2, float noundef %3, float noundef %4) #2 {
  %6 = alloca ptr, align 8
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca float, align 4
  %11 = alloca float, align 4
  %12 = alloca float, align 4
  %13 = alloca [7 x float], align 16
  store ptr %0, ptr %6, align 8, !tbaa !5
  store float %1, ptr %7, align 4, !tbaa !9
  store float %2, ptr %8, align 4, !tbaa !9
  store float %3, ptr %9, align 4, !tbaa !9
  store float %4, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  %14 = load ptr, ptr %6, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.NVGcontext, ptr %14, i32 0, i32 4
  %16 = load float, ptr %15, align 8, !tbaa !11
  store float %16, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.NVGcontext, ptr %17, i32 0, i32 5
  %19 = load float, ptr %18, align 4, !tbaa !15
  store float %19, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 28, ptr %13) #3
  store float 2.000000e+00, ptr %13, align 4, !tbaa !9
  %20 = getelementptr inbounds float, ptr %13, i64 1
  %21 = load float, ptr %11, align 4, !tbaa !9
  %22 = load float, ptr %7, align 4, !tbaa !9
  %23 = load float, ptr %11, align 4, !tbaa !9
  %24 = fsub float %22, %23
  %25 = call float @llvm.fmuladd.f32(float 0x3FE5555560000000, float %24, float %21)
  store float %25, ptr %20, align 4, !tbaa !9
  %26 = getelementptr inbounds float, ptr %13, i64 2
  %27 = load float, ptr %12, align 4, !tbaa !9
  %28 = load float, ptr %8, align 4, !tbaa !9
  %29 = load float, ptr %12, align 4, !tbaa !9
  %30 = fsub float %28, %29
  %31 = call float @llvm.fmuladd.f32(float 0x3FE5555560000000, float %30, float %27)
  store float %31, ptr %26, align 4, !tbaa !9
  %32 = getelementptr inbounds float, ptr %13, i64 3
  %33 = load float, ptr %9, align 4, !tbaa !9
  %34 = load float, ptr %7, align 4, !tbaa !9
  %35 = load float, ptr %9, align 4, !tbaa !9
  %36 = fsub float %34, %35
  %37 = call float @llvm.fmuladd.f32(float 0x3FE5555560000000, float %36, float %33)
  store float %37, ptr %32, align 4, !tbaa !9
  %38 = getelementptr inbounds float, ptr %13, i64 4
  %39 = load float, ptr %10, align 4, !tbaa !9
  %40 = load float, ptr %8, align 4, !tbaa !9
  %41 = load float, ptr %10, align 4, !tbaa !9
  %42 = fsub float %40, %41
  %43 = call float @llvm.fmuladd.f32(float 0x3FE5555560000000, float %42, float %39)
  store float %43, ptr %38, align 4, !tbaa !9
  %44 = getelementptr inbounds float, ptr %13, i64 5
  %45 = load float, ptr %9, align 4, !tbaa !9
  store float %45, ptr %44, align 4, !tbaa !9
  %46 = getelementptr inbounds float, ptr %13, i64 6
  %47 = load float, ptr %10, align 4, !tbaa !9
  store float %47, ptr %46, align 4, !tbaa !9
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  %49 = getelementptr inbounds [7 x float], ptr %13, i64 0, i64 0
  call void @nvg__appendCommands(ptr noundef %48, ptr noundef %49, i32 noundef 7)
  call void @llvm.lifetime.end.p0(i64 28, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !10, i64 128}
!12 = !{!"NVGcontext", !13, i64 0, !6, i64 112, !14, i64 120, !14, i64 124, !10, i64 128, !10, i64 132, !7, i64 136, !14, i64 8712, !6, i64 8720, !10, i64 8728, !10, i64 8732, !10, i64 8736, !10, i64 8740, !6, i64 8744, !7, i64 8752, !14, i64 8768, !14, i64 8772, !14, i64 8776, !14, i64 8780, !14, i64 8784}
!13 = !{!"NVGparams", !6, i64 0, !14, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104}
!14 = !{!"int", !7, i64 0}
!15 = !{!12, !10, i64 132}


; 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: 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: nounwind uwtable
declare hidden void @nvg__appendCommands(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @nvgQuadTo(ptr noundef %0, float noundef %1, float noundef %2, float noundef %3, float noundef %4) local_unnamed_addr #1 {
  %6 = alloca [7 x float], align 16
  %7 = getelementptr inbounds i8, ptr %0, i64 128
  %8 = load float, ptr %7, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %0, i64 132
  %10 = load float, ptr %9, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 28, ptr nonnull %6) #3
  store float 2.000000e+00, ptr %6, align 16, !tbaa !14
  %11 = getelementptr inbounds i8, ptr %6, i64 4
  %12 = insertelement <4 x float> poison, float %1, i64 0
  %13 = insertelement <4 x float> %12, float %2, i64 1
  %14 = shufflevector <4 x float> %13, <4 x float> poison, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
  %15 = insertelement <4 x float> poison, float %8, i64 0
  %16 = insertelement <4 x float> %15, float %10, i64 1
  %17 = insertelement <4 x float> %16, float %3, i64 2
  %18 = insertelement <4 x float> %17, float %4, i64 3
  %19 = fsub <4 x float> %14, %18
  %20 = tail call <4 x float> @llvm.fmuladd.v4f32(<4 x float> %19, <4 x float> <float 0x3FE5555560000000, float 0x3FE5555560000000, float 0x3FE5555560000000, float 0x3FE5555560000000>, <4 x float> %18)
  store <4 x float> %20, ptr %11, align 4, !tbaa !14
  %21 = getelementptr inbounds i8, ptr %6, i64 20
  store float %3, ptr %21, align 4, !tbaa !14
  %22 = getelementptr inbounds i8, ptr %6, i64 24
  store float %4, ptr %22, align 8, !tbaa !14
  call void @nvg__appendCommands(ptr noundef %0, ptr noundef nonnull %6, i32 noundef 7)
  call void @llvm.lifetime.end.p0(i64 28, ptr nonnull %6) #3
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x float> @llvm.fmuladd.v4f32(<4 x float>, <4 x float>, <4 x float>) #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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)"}
!5 = !{!6, !12, i64 128}
!6 = !{!"NVGcontext", !7, i64 0, !8, i64 112, !11, i64 120, !11, i64 124, !12, i64 128, !12, i64 132, !9, i64 136, !11, i64 8712, !8, i64 8720, !12, i64 8728, !12, i64 8732, !12, i64 8736, !12, i64 8740, !8, i64 8744, !9, i64 8752, !11, i64 8768, !11, i64 8772, !11, i64 8776, !11, i64 8780, !11, i64 8784}
!7 = !{!"NVGparams", !8, i64 0, !11, i64 8, !8, i64 16, !8, i64 24, !8, i64 32, !8, i64 40, !8, i64 48, !8, i64 56, !8, i64 64, !8, i64 72, !8, i64 80, !8, i64 88, !8, i64 96, !8, i64 104}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = !{!"float", !9, i64 0}
!13 = !{!6, !12, i64 132}
!14 = !{!12, !12, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalDCEPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,SLPVectorizerPass,SROAPass,TailCallElimPass