; 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.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: nounwind uwtable
declare hidden ptr @nvg__getState(ptr noundef) #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) #1

; Function Attrs: nounwind uwtable
declare dso_local void @nvgTransformMultiply(ptr noundef, ptr noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local void @nvgScissor(ptr noundef %0, float noundef %1, float noundef %2, float noundef %3, float noundef %4) #1 {
  %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 ptr, align 8
  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 8, ptr %11) #3
  %12 = load ptr, ptr %6, align 8, !tbaa !5
  %13 = call ptr @nvg__getState(ptr noundef %12)
  store ptr %13, ptr %11, align 8, !tbaa !5
  %14 = load float, ptr %9, align 4, !tbaa !9
  %15 = call float @nvg__maxf(float noundef 0.000000e+00, float noundef %14)
  store float %15, ptr %9, align 4, !tbaa !9
  %16 = load float, ptr %10, align 4, !tbaa !9
  %17 = call float @nvg__maxf(float noundef 0.000000e+00, float noundef %16)
  store float %17, ptr %10, align 4, !tbaa !9
  %18 = load ptr, ptr %11, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.NVGstate, ptr %18, i32 0, i32 9
  %20 = getelementptr inbounds %struct.NVGscissor, ptr %19, i32 0, i32 0
  %21 = getelementptr inbounds [6 x float], ptr %20, i64 0, i64 0
  call void @nvgTransformIdentity(ptr noundef %21)
  %22 = load float, ptr %7, align 4, !tbaa !9
  %23 = load float, ptr %9, align 4, !tbaa !9
  %24 = call float @llvm.fmuladd.f32(float %23, float 5.000000e-01, float %22)
  %25 = load ptr, ptr %11, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.NVGstate, ptr %25, i32 0, i32 9
  %27 = getelementptr inbounds %struct.NVGscissor, ptr %26, i32 0, i32 0
  %28 = getelementptr inbounds [6 x float], ptr %27, i64 0, i64 4
  store float %24, ptr %28, align 4, !tbaa !9
  %29 = load float, ptr %8, align 4, !tbaa !9
  %30 = load float, ptr %10, align 4, !tbaa !9
  %31 = call float @llvm.fmuladd.f32(float %30, float 5.000000e-01, float %29)
  %32 = load ptr, ptr %11, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.NVGstate, ptr %32, i32 0, i32 9
  %34 = getelementptr inbounds %struct.NVGscissor, ptr %33, i32 0, i32 0
  %35 = getelementptr inbounds [6 x float], ptr %34, i64 0, i64 5
  store float %31, ptr %35, align 4, !tbaa !9
  %36 = load ptr, ptr %11, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.NVGstate, ptr %36, i32 0, i32 9
  %38 = getelementptr inbounds %struct.NVGscissor, ptr %37, i32 0, i32 0
  %39 = getelementptr inbounds [6 x float], ptr %38, i64 0, i64 0
  %40 = load ptr, ptr %11, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.NVGstate, ptr %40, i32 0, i32 8
  %42 = getelementptr inbounds [6 x float], ptr %41, i64 0, i64 0
  call void @nvgTransformMultiply(ptr noundef %39, ptr noundef %42)
  %43 = load float, ptr %9, align 4, !tbaa !9
  %44 = fmul float %43, 5.000000e-01
  %45 = load ptr, ptr %11, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.NVGstate, ptr %45, i32 0, i32 9
  %47 = getelementptr inbounds %struct.NVGscissor, ptr %46, i32 0, i32 1
  %48 = getelementptr inbounds [2 x float], ptr %47, i64 0, i64 0
  store float %44, ptr %48, align 4, !tbaa !9
  %49 = load float, ptr %10, align 4, !tbaa !9
  %50 = fmul float %49, 5.000000e-01
  %51 = load ptr, ptr %11, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.NVGstate, ptr %51, i32 0, i32 9
  %53 = getelementptr inbounds %struct.NVGscissor, ptr %52, i32 0, i32 1
  %54 = getelementptr inbounds [2 x float], ptr %53, i64 0, i64 1
  store float %50, ptr %54, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  ret void
}

attributes #0 = { 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, !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}


; 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: nounwind uwtable
declare hidden ptr @nvg__getState(ptr noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare dso_local void @nvgTransformMultiply(ptr noundef, ptr noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
define dso_local void @nvgScissor(ptr noundef %0, float noundef %1, float noundef %2, float noundef %3, float noundef %4) local_unnamed_addr #0 {
  %6 = tail call ptr @nvg__getState(ptr noundef %0)
  %7 = tail call float @nvg__maxf(float noundef 0.000000e+00, float noundef %3)
  %8 = tail call float @nvg__maxf(float noundef 0.000000e+00, float noundef %4)
  %9 = getelementptr inbounds i8, ptr %6, i64 212
  tail call void @nvgTransformIdentity(ptr noundef nonnull %9)
  %10 = getelementptr inbounds i8, ptr %6, i64 228
  %11 = insertelement <2 x float> poison, float %7, i64 0
  %12 = insertelement <2 x float> %11, float %8, i64 1
  %13 = insertelement <2 x float> poison, float %1, i64 0
  %14 = insertelement <2 x float> %13, float %2, i64 1
  %15 = tail call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %12, <2 x float> <float 5.000000e-01, float 5.000000e-01>, <2 x float> %14)
  store <2 x float> %15, ptr %10, align 4, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %6, i64 188
  tail call void @nvgTransformMultiply(ptr noundef nonnull %9, ptr noundef nonnull %16)
  %17 = getelementptr inbounds i8, ptr %6, i64 236
  %18 = fmul <2 x float> %12, <float 5.000000e-01, float 5.000000e-01>
  store <2 x float> %18, ptr %17, align 4, !tbaa !5
  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>) #1

attributes #0 = { 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 = { 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"}


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