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

; Function Attrs: nounwind uwtable
declare hidden float @nvg__getFontScale(ptr noundef) #1

declare void @fonsSetSize(ptr noundef, float noundef) #2

declare void @fonsSetSpacing(ptr noundef, float noundef) #2

declare void @fonsSetBlur(ptr noundef, float noundef) #2

declare void @fonsSetAlign(ptr noundef, i32 noundef) #2

declare void @fonsSetFont(ptr noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @nvgTextMetrics(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #1 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca float, align 4
  %11 = alloca float, align 4
  %12 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = call ptr @nvg__getState(ptr noundef %13)
  store ptr %14, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  %15 = load ptr, ptr %9, align 8, !tbaa !5
  %16 = call float @nvg__getFontScale(ptr noundef %15)
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.NVGcontext, ptr %17, i32 0, i32 12
  %19 = load float, ptr %18, align 4, !tbaa !9
  %20 = fmul float %16, %19
  store float %20, ptr %10, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  %21 = load float, ptr %10, align 4, !tbaa !14
  %22 = fdiv float 1.000000e+00, %21
  store float %22, ptr %11, align 4, !tbaa !14
  %23 = load ptr, ptr %9, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.NVGstate, ptr %23, i32 0, i32 15
  %25 = load i32, ptr %24, align 4, !tbaa !15
  %26 = icmp eq i32 %25, -1
  br i1 %26, label %27, label %28

27:                                               ; preds = %4
  store i32 1, ptr %12, align 4
  br label %95

28:                                               ; preds = %4
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.NVGcontext, ptr %29, i32 0, i32 13
  %31 = load ptr, ptr %30, align 8, !tbaa !21
  %32 = load ptr, ptr %9, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.NVGstate, ptr %32, i32 0, i32 10
  %34 = load float, ptr %33, align 4, !tbaa !22
  %35 = load float, ptr %10, align 4, !tbaa !14
  %36 = fmul float %34, %35
  call void @fonsSetSize(ptr noundef %31, float noundef %36)
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.NVGcontext, ptr %37, i32 0, i32 13
  %39 = load ptr, ptr %38, align 8, !tbaa !21
  %40 = load ptr, ptr %9, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.NVGstate, ptr %40, i32 0, i32 11
  %42 = load float, ptr %41, align 4, !tbaa !23
  %43 = load float, ptr %10, align 4, !tbaa !14
  %44 = fmul float %42, %43
  call void @fonsSetSpacing(ptr noundef %39, float noundef %44)
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.NVGcontext, ptr %45, i32 0, i32 13
  %47 = load ptr, ptr %46, align 8, !tbaa !21
  %48 = load ptr, ptr %9, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.NVGstate, ptr %48, i32 0, i32 13
  %50 = load float, ptr %49, align 4, !tbaa !24
  %51 = load float, ptr %10, align 4, !tbaa !14
  %52 = fmul float %50, %51
  call void @fonsSetBlur(ptr noundef %47, float noundef %52)
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.NVGcontext, ptr %53, i32 0, i32 13
  %55 = load ptr, ptr %54, align 8, !tbaa !21
  %56 = load ptr, ptr %9, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.NVGstate, ptr %56, i32 0, i32 14
  %58 = load i32, ptr %57, align 4, !tbaa !25
  call void @fonsSetAlign(ptr noundef %55, i32 noundef %58)
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.NVGcontext, ptr %59, i32 0, i32 13
  %61 = load ptr, ptr %60, align 8, !tbaa !21
  %62 = load ptr, ptr %9, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.NVGstate, ptr %62, i32 0, i32 15
  %64 = load i32, ptr %63, align 4, !tbaa !15
  call void @fonsSetFont(ptr noundef %61, i32 noundef %64)
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.NVGcontext, ptr %65, i32 0, i32 13
  %67 = load ptr, ptr %66, align 8, !tbaa !21
  %68 = load ptr, ptr %6, align 8, !tbaa !5
  %69 = load ptr, ptr %7, align 8, !tbaa !5
  %70 = load ptr, ptr %8, align 8, !tbaa !5
  call void @fonsVertMetrics(ptr noundef %67, ptr noundef %68, ptr noundef %69, ptr noundef %70)
  %71 = load ptr, ptr %6, align 8, !tbaa !5
  %72 = icmp ne ptr %71, null
  br i1 %72, label %73, label %78

73:                                               ; preds = %28
  %74 = load float, ptr %11, align 4, !tbaa !14
  %75 = load ptr, ptr %6, align 8, !tbaa !5
  %76 = load float, ptr %75, align 4, !tbaa !14
  %77 = fmul float %76, %74
  store float %77, ptr %75, align 4, !tbaa !14
  br label %78

78:                                               ; preds = %73, %28
  %79 = load ptr, ptr %7, align 8, !tbaa !5
  %80 = icmp ne ptr %79, null
  br i1 %80, label %81, label %86

81:                                               ; preds = %78
  %82 = load float, ptr %11, align 4, !tbaa !14
  %83 = load ptr, ptr %7, align 8, !tbaa !5
  %84 = load float, ptr %83, align 4, !tbaa !14
  %85 = fmul float %84, %82
  store float %85, ptr %83, align 4, !tbaa !14
  br label %86

86:                                               ; preds = %81, %78
  %87 = load ptr, ptr %8, align 8, !tbaa !5
  %88 = icmp ne ptr %87, null
  br i1 %88, label %89, label %94

89:                                               ; preds = %86
  %90 = load float, ptr %11, align 4, !tbaa !14
  %91 = load ptr, ptr %8, align 8, !tbaa !5
  %92 = load float, ptr %91, align 4, !tbaa !14
  %93 = fmul float %92, %90
  store float %93, ptr %91, align 4, !tbaa !14
  br label %94

94:                                               ; preds = %89, %86
  store i32 0, ptr %12, align 4
  br label %95

95:                                               ; preds = %94, %27
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  %96 = load i32, ptr %12, align 4
  switch i32 %96, label %98 [
    i32 0, label %97
    i32 1, label %97
  ]

97:                                               ; preds = %95, %95
  ret void

98:                                               ; preds = %95
  unreachable
}

declare void @fonsVertMetrics(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

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 = { "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, !13, i64 8740}
!10 = !{!"NVGcontext", !11, i64 0, !6, i64 112, !12, i64 120, !12, i64 124, !13, i64 128, !13, i64 132, !7, i64 136, !12, i64 8712, !6, i64 8720, !13, i64 8728, !13, i64 8732, !13, i64 8736, !13, i64 8740, !6, i64 8744, !7, i64 8752, !12, i64 8768, !12, i64 8772, !12, i64 8776, !12, i64 8780, !12, i64 8784}
!11 = !{!"NVGparams", !6, i64 0, !12, 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}
!12 = !{!"int", !7, i64 0}
!13 = !{!"float", !7, i64 0}
!14 = !{!13, !13, i64 0}
!15 = !{!16, !12, i64 264}
!16 = !{!"NVGstate", !17, i64 0, !18, i64 16, !18, i64 92, !13, i64 168, !13, i64 172, !12, i64 176, !12, i64 180, !13, i64 184, !7, i64 188, !20, i64 212, !13, i64 244, !13, i64 248, !13, i64 252, !13, i64 256, !12, i64 260, !12, i64 264}
!17 = !{!"NVGcompositeOperationState", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12}
!18 = !{!"NVGpaint", !7, i64 0, !7, i64 24, !13, i64 32, !13, i64 36, !19, i64 40, !19, i64 56, !12, i64 72}
!19 = !{!"NVGcolor", !7, i64 0}
!20 = !{!"NVGscissor", !7, i64 0, !7, i64 24}
!21 = !{!10, !6, i64 8744}
!22 = !{!16, !13, i64 244}
!23 = !{!16, !13, i64 248}
!24 = !{!16, !13, i64 256}
!25 = !{!16, !12, i64 260}


; 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 hidden float @nvg__getFontScale(ptr noundef) local_unnamed_addr #0

declare void @fonsSetSize(ptr noundef, float noundef) local_unnamed_addr #1

declare void @fonsSetSpacing(ptr noundef, float noundef) local_unnamed_addr #1

declare void @fonsSetBlur(ptr noundef, float noundef) local_unnamed_addr #1

declare void @fonsSetAlign(ptr noundef, i32 noundef) local_unnamed_addr #1

declare void @fonsSetFont(ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @nvgTextMetrics(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) local_unnamed_addr #0 {
  %5 = tail call ptr @nvg__getState(ptr noundef %0)
  %6 = tail call float @nvg__getFontScale(ptr noundef %5)
  %7 = getelementptr inbounds i8, ptr %0, i64 8740
  %8 = load float, ptr %7, align 4, !tbaa !5
  %9 = fmul float %6, %8
  %10 = fdiv float 1.000000e+00, %9
  %11 = getelementptr inbounds i8, ptr %5, i64 264
  %12 = load i32, ptr %11, align 4, !tbaa !13
  %13 = icmp eq i32 %12, -1
  br i1 %13, label %45, label %14

14:                                               ; preds = %4
  %15 = getelementptr inbounds i8, ptr %0, i64 8744
  %16 = load ptr, ptr %15, align 8, !tbaa !19
  %17 = getelementptr inbounds i8, ptr %5, i64 244
  %18 = load float, ptr %17, align 4, !tbaa !20
  %19 = fmul float %9, %18
  tail call void @fonsSetSize(ptr noundef %16, float noundef %19) #2
  %20 = load ptr, ptr %15, align 8, !tbaa !19
  %21 = getelementptr inbounds i8, ptr %5, i64 248
  %22 = load float, ptr %21, align 4, !tbaa !21
  %23 = fmul float %9, %22
  tail call void @fonsSetSpacing(ptr noundef %20, float noundef %23) #2
  %24 = load ptr, ptr %15, align 8, !tbaa !19
  %25 = getelementptr inbounds i8, ptr %5, i64 256
  %26 = load float, ptr %25, align 4, !tbaa !22
  %27 = fmul float %9, %26
  tail call void @fonsSetBlur(ptr noundef %24, float noundef %27) #2
  %28 = load ptr, ptr %15, align 8, !tbaa !19
  %29 = getelementptr inbounds i8, ptr %5, i64 260
  %30 = load i32, ptr %29, align 4, !tbaa !23
  tail call void @fonsSetAlign(ptr noundef %28, i32 noundef %30) #2
  %31 = load ptr, ptr %15, align 8, !tbaa !19
  %32 = load i32, ptr %11, align 4, !tbaa !13
  tail call void @fonsSetFont(ptr noundef %31, i32 noundef %32) #2
  %33 = load ptr, ptr %15, align 8, !tbaa !19
  tail call void @fonsVertMetrics(ptr noundef %33, ptr noundef %1, ptr noundef %2, ptr noundef %3) #2
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %37, label %34

34:                                               ; preds = %14
  %35 = load float, ptr %1, align 4, !tbaa !24
  %36 = fmul float %10, %35
  store float %36, ptr %1, align 4, !tbaa !24
  br label %37

37:                                               ; preds = %34, %14
  %.not33 = icmp eq ptr %2, null
  br i1 %.not33, label %41, label %38

38:                                               ; preds = %37
  %39 = load float, ptr %2, align 4, !tbaa !24
  %40 = fmul float %10, %39
  store float %40, ptr %2, align 4, !tbaa !24
  br label %41

41:                                               ; preds = %38, %37
  %.not34 = icmp eq ptr %3, null
  br i1 %.not34, label %45, label %42

42:                                               ; preds = %41
  %43 = load float, ptr %3, align 4, !tbaa !24
  %44 = fmul float %10, %43
  store float %44, ptr %3, align 4, !tbaa !24
  br label %45

45:                                               ; preds = %41, %42, %4
  ret void
}

declare void @fonsVertMetrics(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #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 = { "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 }

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


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