; 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 float @nvgTextBounds(ptr noundef %0, float noundef %1, float noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) #1 {
  %7 = alloca float, align 4
  %8 = alloca ptr, align 8
  %9 = alloca float, align 4
  %10 = alloca float, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca float, align 4
  %16 = alloca float, align 4
  %17 = alloca float, align 4
  %18 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store float %1, ptr %9, align 4, !tbaa !9
  store float %2, ptr %10, align 4, !tbaa !9
  store ptr %3, ptr %11, align 8, !tbaa !5
  store ptr %4, ptr %12, align 8, !tbaa !5
  store ptr %5, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  %19 = load ptr, ptr %8, align 8, !tbaa !5
  %20 = call ptr @nvg__getState(ptr noundef %19)
  store ptr %20, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  %21 = load ptr, ptr %14, align 8, !tbaa !5
  %22 = call float @nvg__getFontScale(ptr noundef %21)
  %23 = load ptr, ptr %8, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.NVGcontext, ptr %23, i32 0, i32 12
  %25 = load float, ptr %24, align 4, !tbaa !11
  %26 = fmul float %22, %25
  store float %26, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  %27 = load float, ptr %15, align 4, !tbaa !9
  %28 = fdiv float 1.000000e+00, %27
  store float %28, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  %29 = load ptr, ptr %14, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.NVGstate, ptr %29, i32 0, i32 15
  %31 = load i32, ptr %30, align 4, !tbaa !15
  %32 = icmp eq i32 %31, -1
  br i1 %32, label %33, label %34

33:                                               ; preds = %6
  store float 0.000000e+00, ptr %7, align 4
  store i32 1, ptr %18, align 4
  br label %121

34:                                               ; preds = %6
  %35 = load ptr, ptr %8, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.NVGcontext, ptr %35, i32 0, i32 13
  %37 = load ptr, ptr %36, align 8, !tbaa !21
  %38 = load ptr, ptr %14, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.NVGstate, ptr %38, i32 0, i32 10
  %40 = load float, ptr %39, align 4, !tbaa !22
  %41 = load float, ptr %15, align 4, !tbaa !9
  %42 = fmul float %40, %41
  call void @fonsSetSize(ptr noundef %37, float noundef %42)
  %43 = load ptr, ptr %8, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.NVGcontext, ptr %43, i32 0, i32 13
  %45 = load ptr, ptr %44, align 8, !tbaa !21
  %46 = load ptr, ptr %14, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.NVGstate, ptr %46, i32 0, i32 11
  %48 = load float, ptr %47, align 4, !tbaa !23
  %49 = load float, ptr %15, align 4, !tbaa !9
  %50 = fmul float %48, %49
  call void @fonsSetSpacing(ptr noundef %45, float noundef %50)
  %51 = load ptr, ptr %8, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.NVGcontext, ptr %51, i32 0, i32 13
  %53 = load ptr, ptr %52, align 8, !tbaa !21
  %54 = load ptr, ptr %14, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.NVGstate, ptr %54, i32 0, i32 13
  %56 = load float, ptr %55, align 4, !tbaa !24
  %57 = load float, ptr %15, align 4, !tbaa !9
  %58 = fmul float %56, %57
  call void @fonsSetBlur(ptr noundef %53, float noundef %58)
  %59 = load ptr, ptr %8, 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 %14, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.NVGstate, ptr %62, i32 0, i32 14
  %64 = load i32, ptr %63, align 4, !tbaa !25
  call void @fonsSetAlign(ptr noundef %61, i32 noundef %64)
  %65 = load ptr, ptr %8, 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 %14, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.NVGstate, ptr %68, i32 0, i32 15
  %70 = load i32, ptr %69, align 4, !tbaa !15
  call void @fonsSetFont(ptr noundef %67, i32 noundef %70)
  %71 = load ptr, ptr %8, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.NVGcontext, ptr %71, i32 0, i32 13
  %73 = load ptr, ptr %72, align 8, !tbaa !21
  %74 = load float, ptr %9, align 4, !tbaa !9
  %75 = load float, ptr %15, align 4, !tbaa !9
  %76 = fmul float %74, %75
  %77 = load float, ptr %10, align 4, !tbaa !9
  %78 = load float, ptr %15, align 4, !tbaa !9
  %79 = fmul float %77, %78
  %80 = load ptr, ptr %11, align 8, !tbaa !5
  %81 = load ptr, ptr %12, align 8, !tbaa !5
  %82 = load ptr, ptr %13, align 8, !tbaa !5
  %83 = call float @fonsTextBounds(ptr noundef %73, float noundef %76, float noundef %79, ptr noundef %80, ptr noundef %81, ptr noundef %82)
  store float %83, ptr %17, align 4, !tbaa !9
  %84 = load ptr, ptr %13, align 8, !tbaa !5
  %85 = icmp ne ptr %84, null
  br i1 %85, label %86, label %117

86:                                               ; preds = %34
  %87 = load ptr, ptr %8, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.NVGcontext, ptr %87, i32 0, i32 13
  %89 = load ptr, ptr %88, align 8, !tbaa !21
  %90 = load float, ptr %10, align 4, !tbaa !9
  %91 = load float, ptr %15, align 4, !tbaa !9
  %92 = fmul float %90, %91
  %93 = load ptr, ptr %13, align 8, !tbaa !5
  %94 = getelementptr inbounds float, ptr %93, i64 1
  %95 = load ptr, ptr %13, align 8, !tbaa !5
  %96 = getelementptr inbounds float, ptr %95, i64 3
  call void @fonsLineBounds(ptr noundef %89, float noundef %92, ptr noundef %94, ptr noundef %96)
  %97 = load float, ptr %16, align 4, !tbaa !9
  %98 = load ptr, ptr %13, align 8, !tbaa !5
  %99 = getelementptr inbounds float, ptr %98, i64 0
  %100 = load float, ptr %99, align 4, !tbaa !9
  %101 = fmul float %100, %97
  store float %101, ptr %99, align 4, !tbaa !9
  %102 = load float, ptr %16, align 4, !tbaa !9
  %103 = load ptr, ptr %13, align 8, !tbaa !5
  %104 = getelementptr inbounds float, ptr %103, i64 1
  %105 = load float, ptr %104, align 4, !tbaa !9
  %106 = fmul float %105, %102
  store float %106, ptr %104, align 4, !tbaa !9
  %107 = load float, ptr %16, align 4, !tbaa !9
  %108 = load ptr, ptr %13, align 8, !tbaa !5
  %109 = getelementptr inbounds float, ptr %108, i64 2
  %110 = load float, ptr %109, align 4, !tbaa !9
  %111 = fmul float %110, %107
  store float %111, ptr %109, align 4, !tbaa !9
  %112 = load float, ptr %16, align 4, !tbaa !9
  %113 = load ptr, ptr %13, align 8, !tbaa !5
  %114 = getelementptr inbounds float, ptr %113, i64 3
  %115 = load float, ptr %114, align 4, !tbaa !9
  %116 = fmul float %115, %112
  store float %116, ptr %114, align 4, !tbaa !9
  br label %117

117:                                              ; preds = %86, %34
  %118 = load float, ptr %17, align 4, !tbaa !9
  %119 = load float, ptr %16, align 4, !tbaa !9
  %120 = fmul float %118, %119
  store float %120, ptr %7, align 4
  store i32 1, ptr %18, align 4
  br label %121

121:                                              ; preds = %117, %33
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  %122 = load float, ptr %7, align 4
  ret float %122
}

declare float @fonsTextBounds(ptr noundef, float noundef, float noundef, ptr noundef, ptr noundef, ptr noundef) #2

declare void @fonsLineBounds(ptr noundef, float 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, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !10, i64 8740}
!12 = !{!"NVGcontext", !13, i64 0, !6, i64 112, !14, i64 120, !14, i64 124, !10, i64 128, !10, i64 132, !7, i64 136, !14, i64 8712, !6, i64 8720, !10, i64 8728, !10, i64 8732, !10, i64 8736, !10, i64 8740, !6, i64 8744, !7, i64 8752, !14, i64 8768, !14, i64 8772, !14, i64 8776, !14, i64 8780, !14, i64 8784}
!13 = !{!"NVGparams", !6, i64 0, !14, 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}
!14 = !{!"int", !7, i64 0}
!15 = !{!16, !14, i64 264}
!16 = !{!"NVGstate", !17, i64 0, !18, i64 16, !18, i64 92, !10, i64 168, !10, i64 172, !14, i64 176, !14, i64 180, !10, i64 184, !7, i64 188, !20, i64 212, !10, i64 244, !10, i64 248, !10, i64 252, !10, i64 256, !14, i64 260, !14, i64 264}
!17 = !{!"NVGcompositeOperationState", !14, i64 0, !14, i64 4, !14, i64 8, !14, i64 12}
!18 = !{!"NVGpaint", !7, i64 0, !7, i64 24, !10, i64 32, !10, i64 36, !19, i64 40, !19, i64 56, !14, i64 72}
!19 = !{!"NVGcolor", !7, i64 0}
!20 = !{!"NVGscissor", !7, i64 0, !7, i64 24}
!21 = !{!12, !6, i64 8744}
!22 = !{!16, !10, i64 244}
!23 = !{!16, !10, i64 248}
!24 = !{!16, !10, i64 256}
!25 = !{!16, !14, 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 float @nvgTextBounds(ptr noundef %0, float noundef %1, float noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) local_unnamed_addr #0 {
  %7 = tail call ptr @nvg__getState(ptr noundef %0)
  %8 = tail call float @nvg__getFontScale(ptr noundef %7)
  %9 = getelementptr inbounds i8, ptr %0, i64 8740
  %10 = load float, ptr %9, align 4, !tbaa !5
  %11 = fmul float %8, %10
  %12 = fdiv float 1.000000e+00, %11
  %13 = getelementptr inbounds i8, ptr %7, i64 264
  %14 = load i32, ptr %13, align 4, !tbaa !13
  %15 = icmp eq i32 %14, -1
  br i1 %15, label %49, label %16

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

39:                                               ; preds = %16
  %40 = load ptr, ptr %17, align 8, !tbaa !19
  %41 = getelementptr inbounds i8, ptr %5, i64 4
  %42 = getelementptr inbounds i8, ptr %5, i64 12
  tail call void @fonsLineBounds(ptr noundef %40, float noundef %37, ptr noundef nonnull %41, ptr noundef nonnull %42) #2
  %43 = load <4 x float>, ptr %5, align 4, !tbaa !24
  %44 = insertelement <4 x float> poison, float %12, i64 0
  %45 = shufflevector <4 x float> %44, <4 x float> poison, <4 x i32> zeroinitializer
  %46 = fmul <4 x float> %45, %43
  store <4 x float> %46, ptr %5, align 4, !tbaa !24
  br label %47

47:                                               ; preds = %39, %16
  %48 = fmul float %12, %38
  br label %49

49:                                               ; preds = %6, %47
  %.0 = phi float [ %48, %47 ], [ 0.000000e+00, %6 ]
  ret float %.0
}

declare float @fonsTextBounds(ptr noundef, float noundef, float noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @fonsLineBounds(ptr noundef, float 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,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass