; 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.NVGcolor = type { %union.anon }
%union.anon = type { [4 x float] }
%struct.NVGcompositeOperationState = type { i32, i32, i32, i32 }
%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.NVGpaint = type { [6 x float], [2 x float], float, float, %struct.NVGcolor, %struct.NVGcolor, i32 }
%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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; 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) #2

; Function Attrs: nounwind uwtable
define dso_local void @nvgReset(ptr noundef %0) #3 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca %struct.NVGcolor, align 4
  %5 = alloca %struct.NVGcolor, align 4
  %6 = alloca %struct.NVGcompositeOperationState, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %7 = load ptr, ptr %2, align 8, !tbaa !5
  %8 = call ptr @nvg__getState(ptr noundef %7)
  store ptr %8, ptr %3, align 8, !tbaa !5
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 4 %9, i8 0, i64 268, i1 false)
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.NVGstate, ptr %10, i32 0, i32 1
  %12 = call { <2 x float>, <2 x float> } @nvgRGBA(i8 noundef zeroext -1, i8 noundef zeroext -1, i8 noundef zeroext -1, i8 noundef zeroext -1)
  %13 = getelementptr inbounds %struct.NVGcolor, ptr %4, i32 0, i32 0
  %14 = getelementptr inbounds %union.anon, ptr %13, i32 0, i32 0
  %15 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %14, i32 0, i32 0
  %16 = extractvalue { <2 x float>, <2 x float> } %12, 0
  store <2 x float> %16, ptr %15, align 4
  %17 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %14, i32 0, i32 1
  %18 = extractvalue { <2 x float>, <2 x float> } %12, 1
  store <2 x float> %18, ptr %17, align 4
  %19 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %4, i32 0, i32 0
  %20 = load <2 x float>, ptr %19, align 4
  %21 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %4, i32 0, i32 1
  %22 = load <2 x float>, ptr %21, align 4
  call void @nvg__setPaintColor(ptr noundef %11, <2 x float> %20, <2 x float> %22)
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.NVGstate, ptr %23, i32 0, i32 2
  %25 = call { <2 x float>, <2 x float> } @nvgRGBA(i8 noundef zeroext 0, i8 noundef zeroext 0, i8 noundef zeroext 0, i8 noundef zeroext -1)
  %26 = getelementptr inbounds %struct.NVGcolor, ptr %5, i32 0, i32 0
  %27 = getelementptr inbounds %union.anon, ptr %26, i32 0, i32 0
  %28 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %27, i32 0, i32 0
  %29 = extractvalue { <2 x float>, <2 x float> } %25, 0
  store <2 x float> %29, ptr %28, align 4
  %30 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %27, i32 0, i32 1
  %31 = extractvalue { <2 x float>, <2 x float> } %25, 1
  store <2 x float> %31, ptr %30, align 4
  %32 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %5, i32 0, i32 0
  %33 = load <2 x float>, ptr %32, align 4
  %34 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %5, i32 0, i32 1
  %35 = load <2 x float>, ptr %34, align 4
  call void @nvg__setPaintColor(ptr noundef %24, <2 x float> %33, <2 x float> %35)
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.NVGstate, ptr %36, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #5
  %38 = call { i64, i64 } @nvg__compositeOperationState(i32 noundef 0)
  %39 = getelementptr inbounds { i64, i64 }, ptr %6, i32 0, i32 0
  %40 = extractvalue { i64, i64 } %38, 0
  store i64 %40, ptr %39, align 4
  %41 = getelementptr inbounds { i64, i64 }, ptr %6, i32 0, i32 1
  %42 = extractvalue { i64, i64 } %38, 1
  store i64 %42, ptr %41, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %37, ptr align 4 %6, i64 16, i1 false), !tbaa.struct !9
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #5
  %43 = load ptr, ptr %3, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.NVGstate, ptr %43, i32 0, i32 3
  store float 1.000000e+00, ptr %44, align 4, !tbaa !12
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.NVGstate, ptr %45, i32 0, i32 4
  store float 1.000000e+01, ptr %46, align 4, !tbaa !19
  %47 = load ptr, ptr %3, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.NVGstate, ptr %47, i32 0, i32 6
  store i32 0, ptr %48, align 4, !tbaa !20
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.NVGstate, ptr %49, i32 0, i32 5
  store i32 4, ptr %50, align 4, !tbaa !21
  %51 = load ptr, ptr %3, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.NVGstate, ptr %51, i32 0, i32 7
  store float 1.000000e+00, ptr %52, align 4, !tbaa !22
  %53 = load ptr, ptr %3, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.NVGstate, ptr %53, i32 0, i32 8
  %55 = getelementptr inbounds [6 x float], ptr %54, i64 0, i64 0
  call void @nvgTransformIdentity(ptr noundef %55)
  %56 = load ptr, ptr %3, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.NVGstate, ptr %56, i32 0, i32 9
  %58 = getelementptr inbounds %struct.NVGscissor, ptr %57, i32 0, i32 1
  %59 = getelementptr inbounds [2 x float], ptr %58, i64 0, i64 0
  store float -1.000000e+00, ptr %59, align 4, !tbaa !23
  %60 = load ptr, ptr %3, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.NVGstate, ptr %60, i32 0, i32 9
  %62 = getelementptr inbounds %struct.NVGscissor, ptr %61, i32 0, i32 1
  %63 = getelementptr inbounds [2 x float], ptr %62, i64 0, i64 1
  store float -1.000000e+00, ptr %63, align 4, !tbaa !23
  %64 = load ptr, ptr %3, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.NVGstate, ptr %64, i32 0, i32 10
  store float 1.600000e+01, ptr %65, align 4, !tbaa !24
  %66 = load ptr, ptr %3, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.NVGstate, ptr %66, i32 0, i32 11
  store float 0.000000e+00, ptr %67, align 4, !tbaa !25
  %68 = load ptr, ptr %3, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.NVGstate, ptr %68, i32 0, i32 12
  store float 1.000000e+00, ptr %69, align 4, !tbaa !26
  %70 = load ptr, ptr %3, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.NVGstate, ptr %70, i32 0, i32 13
  store float 0.000000e+00, ptr %71, align 4, !tbaa !27
  %72 = load ptr, ptr %3, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.NVGstate, ptr %72, i32 0, i32 14
  store i32 65, ptr %73, align 4, !tbaa !28
  %74 = load ptr, ptr %3, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.NVGstate, ptr %74, i32 0, i32 15
  store i32 0, ptr %75, align 4, !tbaa !29
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  ret void
}

; 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) #4

; Function Attrs: nounwind uwtable
declare dso_local { <2 x float>, <2 x float> } @nvgRGBA(i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext) #4

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

; Function Attrs: nounwind uwtable
declare hidden void @nvg__setPaintColor(ptr noundef, <2 x float>, <2 x float>) #3

; Function Attrs: nounwind uwtable
declare hidden { i64, i64 } @nvg__compositeOperationState(i32 noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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/C++ TBAA"}
!9 = !{i64 0, i64 4, !10, i64 4, i64 4, !10, i64 8, i64 4, !10, i64 12, i64 4, !10}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !16, i64 168}
!13 = !{!"NVGstate", !14, i64 0, !15, i64 16, !15, i64 92, !16, i64 168, !16, i64 172, !11, i64 176, !11, i64 180, !16, i64 184, !7, i64 188, !18, i64 212, !16, i64 244, !16, i64 248, !16, i64 252, !16, i64 256, !11, i64 260, !11, i64 264}
!14 = !{!"NVGcompositeOperationState", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12}
!15 = !{!"NVGpaint", !7, i64 0, !7, i64 24, !16, i64 32, !16, i64 36, !17, i64 40, !17, i64 56, !11, i64 72}
!16 = !{!"float", !7, i64 0}
!17 = !{!"NVGcolor", !7, i64 0}
!18 = !{!"NVGscissor", !7, i64 0, !7, i64 24}
!19 = !{!13, !16, i64 172}
!20 = !{!13, !11, i64 180}
!21 = !{!13, !11, i64 176}
!22 = !{!13, !16, i64 184}
!23 = !{!16, !16, i64 0}
!24 = !{!13, !16, i64 244}
!25 = !{!13, !16, i64 248}
!26 = !{!13, !16, i64 252}
!27 = !{!13, !16, i64 256}
!28 = !{!13, !11, i64 260}
!29 = !{!13, !11, i64 264}


; 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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #0

; Function Attrs: nounwind uwtable
define dso_local void @nvgReset(ptr noundef %0) local_unnamed_addr #1 {
  %2 = tail call ptr @nvg__getState(ptr noundef %0)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(268) %2, i8 0, i64 268, i1 false)
  %3 = getelementptr inbounds i8, ptr %2, i64 16
  %4 = tail call { <2 x float>, <2 x float> } @nvgRGBA(i8 noundef zeroext -1, i8 noundef zeroext -1, i8 noundef zeroext -1, i8 noundef zeroext -1)
  %5 = extractvalue { <2 x float>, <2 x float> } %4, 0
  %6 = extractvalue { <2 x float>, <2 x float> } %4, 1
  tail call void @nvg__setPaintColor(ptr noundef nonnull %3, <2 x float> %5, <2 x float> %6)
  %7 = getelementptr inbounds i8, ptr %2, i64 92
  %8 = tail call { <2 x float>, <2 x float> } @nvgRGBA(i8 noundef zeroext 0, i8 noundef zeroext 0, i8 noundef zeroext 0, i8 noundef zeroext -1)
  %9 = extractvalue { <2 x float>, <2 x float> } %8, 0
  %10 = extractvalue { <2 x float>, <2 x float> } %8, 1
  tail call void @nvg__setPaintColor(ptr noundef nonnull %7, <2 x float> %9, <2 x float> %10)
  %11 = tail call { i64, i64 } @nvg__compositeOperationState(i32 noundef 0)
  %12 = extractvalue { i64, i64 } %11, 0
  %13 = extractvalue { i64, i64 } %11, 1
  store i64 %12, ptr %2, align 4
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %2, i64 8
  store i64 %13, ptr %.sroa.4.0..sroa_idx, align 4
  %14 = getelementptr inbounds i8, ptr %2, i64 168
  store <2 x float> <float 1.000000e+00, float 1.000000e+01>, ptr %14, align 4, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %2, i64 180
  store i32 0, ptr %15, align 4, !tbaa !9
  %16 = getelementptr inbounds i8, ptr %2, i64 176
  store i32 4, ptr %16, align 4, !tbaa !16
  %17 = getelementptr inbounds i8, ptr %2, i64 184
  store float 1.000000e+00, ptr %17, align 4, !tbaa !17
  %18 = getelementptr inbounds i8, ptr %2, i64 188
  tail call void @nvgTransformIdentity(ptr noundef nonnull %18)
  %19 = getelementptr inbounds i8, ptr %2, i64 236
  store <4 x float> <float -1.000000e+00, float -1.000000e+00, float 1.600000e+01, float 0.000000e+00>, ptr %19, align 4, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %2, i64 252
  store <2 x float> <float 1.000000e+00, float 0.000000e+00>, ptr %20, align 4, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %2, i64 260
  store i32 65, ptr %21, align 4, !tbaa !18
  %22 = getelementptr inbounds i8, ptr %2, i64 264
  store i32 0, ptr %22, align 4, !tbaa !19
  ret void
}

; Function Attrs: nounwind uwtable
declare hidden ptr @nvg__getState(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local { <2 x float>, <2 x float> } @nvgRGBA(i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext) local_unnamed_addr #2

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

; Function Attrs: nounwind uwtable
declare hidden void @nvg__setPaintColor(ptr noundef, <2 x float>, <2 x float>) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden { i64, i64 } @nvg__compositeOperationState(i32 noundef) local_unnamed_addr #2

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

!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, !12, i64 180}
!10 = !{!"NVGstate", !11, i64 0, !13, i64 16, !13, i64 92, !6, i64 168, !6, i64 172, !12, i64 176, !12, i64 180, !6, i64 184, !7, i64 188, !15, i64 212, !6, i64 244, !6, i64 248, !6, i64 252, !6, i64 256, !12, i64 260, !12, i64 264}
!11 = !{!"NVGcompositeOperationState", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12}
!12 = !{!"int", !7, i64 0}
!13 = !{!"NVGpaint", !7, i64 0, !7, i64 24, !6, i64 32, !6, i64 36, !14, i64 40, !14, i64 56, !12, i64 72}
!14 = !{!"NVGcolor", !7, i64 0}
!15 = !{!"NVGscissor", !7, i64 0, !7, i64 24}
!16 = !{!10, !12, i64 176}
!17 = !{!10, !6, i64 184}
!18 = !{!10, !12, i64 260}
!19 = !{!10, !12, i64 264}


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