; 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.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] }

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #2

; Function Attrs: nounwind uwtable
declare dso_local void @nvgTransformIdentity(ptr noundef) #3

; Function Attrs: nounwind uwtable
declare hidden float @nvg__maxf(float noundef, float noundef) #3

; Function Attrs: nounwind uwtable
define dso_local void @nvgBoxGradient(ptr dead_on_unwind noalias writable sret(%struct.NVGpaint) align 4 %0, ptr noundef %1, float noundef %2, float noundef %3, float noundef %4, float noundef %5, float noundef %6, float noundef %7, <2 x float> %8, <2 x float> %9, ptr noundef byval(%struct.NVGcolor) align 8 %10) #4 {
  %12 = alloca %struct.NVGcolor, align 4
  %13 = alloca ptr, align 8
  %14 = alloca float, align 4
  %15 = alloca float, align 4
  %16 = alloca float, align 4
  %17 = alloca float, align 4
  %18 = alloca float, align 4
  %19 = alloca float, align 4
  %20 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %12, i32 0, i32 0
  store <2 x float> %8, ptr %20, align 4
  %21 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %12, i32 0, i32 1
  store <2 x float> %9, ptr %21, align 4
  store ptr %1, ptr %13, align 8, !tbaa !5
  store float %2, ptr %14, align 4, !tbaa !9
  store float %3, ptr %15, align 4, !tbaa !9
  store float %4, ptr %16, align 4, !tbaa !9
  store float %5, ptr %17, align 4, !tbaa !9
  store float %6, ptr %18, align 4, !tbaa !9
  store float %7, ptr %19, align 4, !tbaa !9
  br label %22

22:                                               ; preds = %11
  br label %23

23:                                               ; preds = %22
  call void @llvm.memset.p0.i64(ptr align 4 %0, i8 0, i64 76, i1 false)
  %24 = getelementptr inbounds %struct.NVGpaint, ptr %0, i32 0, i32 0
  %25 = getelementptr inbounds [6 x float], ptr %24, i64 0, i64 0
  call void @nvgTransformIdentity(ptr noundef %25)
  %26 = load float, ptr %14, align 4, !tbaa !9
  %27 = load float, ptr %16, align 4, !tbaa !9
  %28 = call float @llvm.fmuladd.f32(float %27, float 5.000000e-01, float %26)
  %29 = getelementptr inbounds %struct.NVGpaint, ptr %0, i32 0, i32 0
  %30 = getelementptr inbounds [6 x float], ptr %29, i64 0, i64 4
  store float %28, ptr %30, align 4, !tbaa !9
  %31 = load float, ptr %15, align 4, !tbaa !9
  %32 = load float, ptr %17, align 4, !tbaa !9
  %33 = call float @llvm.fmuladd.f32(float %32, float 5.000000e-01, float %31)
  %34 = getelementptr inbounds %struct.NVGpaint, ptr %0, i32 0, i32 0
  %35 = getelementptr inbounds [6 x float], ptr %34, i64 0, i64 5
  store float %33, ptr %35, align 4, !tbaa !9
  %36 = load float, ptr %16, align 4, !tbaa !9
  %37 = fmul float %36, 5.000000e-01
  %38 = getelementptr inbounds %struct.NVGpaint, ptr %0, i32 0, i32 1
  %39 = getelementptr inbounds [2 x float], ptr %38, i64 0, i64 0
  store float %37, ptr %39, align 4, !tbaa !9
  %40 = load float, ptr %17, align 4, !tbaa !9
  %41 = fmul float %40, 5.000000e-01
  %42 = getelementptr inbounds %struct.NVGpaint, ptr %0, i32 0, i32 1
  %43 = getelementptr inbounds [2 x float], ptr %42, i64 0, i64 1
  store float %41, ptr %43, align 4, !tbaa !9
  %44 = load float, ptr %18, align 4, !tbaa !9
  %45 = getelementptr inbounds %struct.NVGpaint, ptr %0, i32 0, i32 2
  store float %44, ptr %45, align 4, !tbaa !11
  %46 = load float, ptr %19, align 4, !tbaa !9
  %47 = call float @nvg__maxf(float noundef 1.000000e+00, float noundef %46)
  %48 = getelementptr inbounds %struct.NVGpaint, ptr %0, i32 0, i32 3
  store float %47, ptr %48, align 4, !tbaa !15
  %49 = getelementptr inbounds %struct.NVGpaint, ptr %0, i32 0, i32 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %49, ptr align 4 %12, i64 16, i1 false), !tbaa.struct !16
  %50 = getelementptr inbounds %struct.NVGpaint, ptr %0, i32 0, i32 5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %50, ptr align 8 %10, i64 16, i1 false), !tbaa.struct !16
  ret void
}

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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 = { nounwind uwtable "min-legal-vector-width"="64" "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" }

!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 32}
!12 = !{!"NVGpaint", !7, i64 0, !7, i64 24, !10, i64 32, !10, i64 36, !13, i64 40, !13, i64 56, !14, i64 72}
!13 = !{!"NVGcolor", !7, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!12, !10, i64 36}
!16 = !{i64 0, i64 16, !17}
!17 = !{!7, !7, i64 0}


; 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.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] }

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

; Function Attrs: mustprogress 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: nounwind uwtable
declare dso_local void @nvgTransformIdentity(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden float @nvg__maxf(float noundef, float noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local void @nvgBoxGradient(ptr dead_on_unwind noalias writable sret(%struct.NVGpaint) align 4 %0, ptr nocapture noundef readnone %1, float noundef %2, float noundef %3, float noundef %4, float noundef %5, float noundef %6, float noundef %7, <2 x float> %8, <2 x float> %9, ptr nocapture noundef readonly byval(%struct.NVGcolor) align 8 %10) local_unnamed_addr #3 {
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(76) %0, i8 0, i64 76, i1 false)
  tail call void @nvgTransformIdentity(ptr noundef %0)
  %12 = insertelement <2 x float> poison, float %4, i64 0
  %13 = insertelement <2 x float> %12, float %5, i64 1
  %14 = insertelement <2 x float> poison, float %2, i64 0
  %15 = insertelement <2 x float> %14, float %3, i64 1
  %16 = tail call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %13, <2 x float> <float 5.000000e-01, float 5.000000e-01>, <2 x float> %15)
  %17 = getelementptr inbounds i8, ptr %0, i64 16
  store <2 x float> %16, ptr %17, align 4, !tbaa !5
  %18 = fmul <2 x float> %13, <float 5.000000e-01, float 5.000000e-01>
  %19 = getelementptr inbounds i8, ptr %0, i64 24
  store <2 x float> %18, ptr %19, align 4, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %0, i64 32
  store float %6, ptr %20, align 4, !tbaa !9
  %21 = tail call float @nvg__maxf(float noundef 1.000000e+00, float noundef %7)
  %22 = getelementptr inbounds i8, ptr %0, i64 36
  store float %21, ptr %22, align 4, !tbaa !13
  %23 = getelementptr inbounds i8, ptr %0, i64 40
  store <2 x float> %8, ptr %23, align 4
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 48
  store <2 x float> %9, ptr %.sroa.2.0..sroa_idx, align 4, !tbaa !14
  %24 = getelementptr inbounds i8, ptr %0, i64 56
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(16) %24, ptr noundef nonnull align 8 dereferenceable(16) %10, i64 16, i1 false), !tbaa.struct !15
  ret void
}

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

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 uwtable "min-legal-vector-width"="64" "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 nosync nounwind speculatable willreturn memory(none) }

!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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 32}
!10 = !{!"NVGpaint", !7, i64 0, !7, i64 24, !6, i64 32, !6, i64 36, !11, i64 40, !11, i64 56, !12, i64 72}
!11 = !{!"NVGcolor", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!10, !6, i64 36}
!14 = !{!7, !7, i64 0}
!15 = !{i64 0, i64 16, !14}


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