; 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: nounwind uwtable
declare dso_local void @nvgSave(ptr noundef) #0

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

; Function Attrs: nounwind uwtable
declare hidden void @nvg__setDevicePixelRatio(ptr noundef, float noundef) #0

; Function Attrs: nounwind uwtable
define dso_local void @nvgBeginFrame(ptr noundef %0, i32 noundef %1, i32 noundef %2, float noundef %3) #0 {
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca float, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store i32 %2, ptr %7, align 4, !tbaa !9
  store float %3, ptr %8, align 4, !tbaa !11
  %9 = load ptr, ptr %5, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.NVGcontext, ptr %9, i32 0, i32 7
  store i32 0, ptr %10, align 8, !tbaa !13
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  call void @nvgSave(ptr noundef %11)
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  call void @nvgReset(ptr noundef %12)
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = load float, ptr %8, align 4, !tbaa !11
  call void @nvg__setDevicePixelRatio(ptr noundef %13, float noundef %14)
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.NVGcontext, ptr %15, i32 0, i32 0
  %17 = getelementptr inbounds %struct.NVGparams, ptr %16, i32 0, i32 7
  %18 = load ptr, ptr %17, align 8, !tbaa !16
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.NVGcontext, ptr %19, i32 0, i32 0
  %21 = getelementptr inbounds %struct.NVGparams, ptr %20, i32 0, i32 0
  %22 = load ptr, ptr %21, align 8, !tbaa !17
  %23 = load i32, ptr %6, align 4, !tbaa !9
  %24 = load i32, ptr %7, align 4, !tbaa !9
  %25 = load float, ptr %8, align 4, !tbaa !11
  call void %18(ptr noundef %22, i32 noundef %23, i32 noundef %24, float noundef %25)
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.NVGcontext, ptr %26, i32 0, i32 16
  store i32 0, ptr %27, align 4, !tbaa !18
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.NVGcontext, ptr %28, i32 0, i32 17
  store i32 0, ptr %29, align 8, !tbaa !19
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.NVGcontext, ptr %30, i32 0, i32 18
  store i32 0, ptr %31, align 4, !tbaa !20
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.NVGcontext, ptr %32, i32 0, i32 19
  store i32 0, ptr %33, align 8, !tbaa !21
  ret void
}

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 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!14, !10, i64 8712}
!14 = !{!"NVGcontext", !15, i64 0, !6, i64 112, !10, i64 120, !10, i64 124, !12, i64 128, !12, i64 132, !7, i64 136, !10, i64 8712, !6, i64 8720, !12, i64 8728, !12, i64 8732, !12, i64 8736, !12, i64 8740, !6, i64 8744, !7, i64 8752, !10, i64 8768, !10, i64 8772, !10, i64 8776, !10, i64 8780, !10, i64 8784}
!15 = !{!"NVGparams", !6, i64 0, !10, 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}
!16 = !{!14, !6, i64 56}
!17 = !{!14, !6, i64 0}
!18 = !{!14, !10, i64 8772}
!19 = !{!14, !10, i64 8776}
!20 = !{!14, !10, i64 8780}
!21 = !{!14, !10, i64 8784}


; 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 dso_local void @nvgSave(ptr noundef) local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
define dso_local void @nvgBeginFrame(ptr noundef %0, i32 noundef %1, i32 noundef %2, float noundef %3) local_unnamed_addr #0 {
  %5 = getelementptr inbounds i8, ptr %0, i64 8712
  store i32 0, ptr %5, align 8, !tbaa !5
  tail call void @nvgSave(ptr noundef %0)
  tail call void @nvgReset(ptr noundef %0)
  tail call void @nvg__setDevicePixelRatio(ptr noundef %0, float noundef %3)
  %6 = getelementptr inbounds i8, ptr %0, i64 56
  %7 = load ptr, ptr %6, align 8, !tbaa !13
  %8 = load ptr, ptr %0, align 8, !tbaa !14
  tail call void %7(ptr noundef %8, i32 noundef %1, i32 noundef %2, float noundef %3) #3
  %9 = getelementptr inbounds i8, ptr %0, i64 8772
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(16) %9, i8 0, i64 16, i1 false)
  ret void
}

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

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 = { 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 = { 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)"}
!5 = !{!6, !11, i64 8712}
!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, !8, i64 56}
!14 = !{!6, !8, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InstCombinePass,MemCpyOptPass,SROAPass,TailCallElimPass