; LLVM IR from mackorone/mms :: old/v2/src/lib/stb (stb_truetype)

; 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.stbtt_bakedchar = type { i16, i16, i16, i16, float, float, float }
%struct.stbtt_aligned_quad = type { float, float, float, float, float, float, float, 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: mustprogress nounwind uwtable
define dso_local void @stbtt_GetBakedQuad(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6, i32 noundef %7) #1 {
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca float, align 4
  %18 = alloca float, align 4
  %19 = alloca float, align 4
  %20 = alloca ptr, align 8
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  store ptr %0, ptr %9, align 8, !tbaa !5
  store i32 %1, ptr %10, align 4, !tbaa !9
  store i32 %2, ptr %11, align 4, !tbaa !9
  store i32 %3, ptr %12, align 4, !tbaa !9
  store ptr %4, ptr %13, align 8, !tbaa !5
  store ptr %5, ptr %14, align 8, !tbaa !5
  store ptr %6, ptr %15, align 8, !tbaa !5
  store i32 %7, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  %23 = load i32, ptr %16, align 4, !tbaa !9
  %24 = icmp ne i32 %23, 0
  %25 = zext i1 %24 to i64
  %26 = select i1 %24, float 0.000000e+00, float -5.000000e-01
  store float %26, ptr %17, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #3
  %27 = load i32, ptr %10, align 4, !tbaa !9
  %28 = sitofp i32 %27 to float
  %29 = fdiv float 1.000000e+00, %28
  store float %29, ptr %18, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #3
  %30 = load i32, ptr %11, align 4, !tbaa !9
  %31 = sitofp i32 %30 to float
  %32 = fdiv float 1.000000e+00, %31
  store float %32, ptr %19, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #3
  %33 = load ptr, ptr %9, align 8, !tbaa !5
  %34 = load i32, ptr %12, align 4, !tbaa !9
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds %struct.stbtt_bakedchar, ptr %33, i64 %35
  store ptr %36, ptr %20, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #3
  %37 = load ptr, ptr %13, align 8, !tbaa !5
  %38 = load float, ptr %37, align 4, !tbaa !11
  %39 = load ptr, ptr %20, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.stbtt_bakedchar, ptr %39, i32 0, i32 4
  %41 = load float, ptr %40, align 4, !tbaa !13
  %42 = fadd float %38, %41
  %43 = fpext float %42 to double
  %44 = fadd double %43, 5.000000e-01
  %45 = call double @llvm.floor.f64(double %44)
  %46 = fptosi double %45 to i32
  store i32 %46, ptr %21, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #3
  %47 = load ptr, ptr %14, align 8, !tbaa !5
  %48 = load float, ptr %47, align 4, !tbaa !11
  %49 = load ptr, ptr %20, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.stbtt_bakedchar, ptr %49, i32 0, i32 5
  %51 = load float, ptr %50, align 4, !tbaa !16
  %52 = fadd float %48, %51
  %53 = fpext float %52 to double
  %54 = fadd double %53, 5.000000e-01
  %55 = call double @llvm.floor.f64(double %54)
  %56 = fptosi double %55 to i32
  store i32 %56, ptr %22, align 4, !tbaa !9
  %57 = load i32, ptr %21, align 4, !tbaa !9
  %58 = sitofp i32 %57 to float
  %59 = load float, ptr %17, align 4, !tbaa !11
  %60 = fadd float %58, %59
  %61 = load ptr, ptr %15, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.stbtt_aligned_quad, ptr %61, i32 0, i32 0
  store float %60, ptr %62, align 4, !tbaa !17
  %63 = load i32, ptr %22, align 4, !tbaa !9
  %64 = sitofp i32 %63 to float
  %65 = load float, ptr %17, align 4, !tbaa !11
  %66 = fadd float %64, %65
  %67 = load ptr, ptr %15, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.stbtt_aligned_quad, ptr %67, i32 0, i32 1
  store float %66, ptr %68, align 4, !tbaa !19
  %69 = load i32, ptr %21, align 4, !tbaa !9
  %70 = load ptr, ptr %20, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.stbtt_bakedchar, ptr %70, i32 0, i32 2
  %72 = load i16, ptr %71, align 4, !tbaa !20
  %73 = zext i16 %72 to i32
  %74 = add nsw i32 %69, %73
  %75 = load ptr, ptr %20, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.stbtt_bakedchar, ptr %75, i32 0, i32 0
  %77 = load i16, ptr %76, align 4, !tbaa !21
  %78 = zext i16 %77 to i32
  %79 = sub nsw i32 %74, %78
  %80 = sitofp i32 %79 to float
  %81 = load float, ptr %17, align 4, !tbaa !11
  %82 = fadd float %80, %81
  %83 = load ptr, ptr %15, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.stbtt_aligned_quad, ptr %83, i32 0, i32 4
  store float %82, ptr %84, align 4, !tbaa !22
  %85 = load i32, ptr %22, align 4, !tbaa !9
  %86 = load ptr, ptr %20, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.stbtt_bakedchar, ptr %86, i32 0, i32 3
  %88 = load i16, ptr %87, align 2, !tbaa !23
  %89 = zext i16 %88 to i32
  %90 = add nsw i32 %85, %89
  %91 = load ptr, ptr %20, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.stbtt_bakedchar, ptr %91, i32 0, i32 1
  %93 = load i16, ptr %92, align 2, !tbaa !24
  %94 = zext i16 %93 to i32
  %95 = sub nsw i32 %90, %94
  %96 = sitofp i32 %95 to float
  %97 = load float, ptr %17, align 4, !tbaa !11
  %98 = fadd float %96, %97
  %99 = load ptr, ptr %15, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.stbtt_aligned_quad, ptr %99, i32 0, i32 5
  store float %98, ptr %100, align 4, !tbaa !25
  %101 = load ptr, ptr %20, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.stbtt_bakedchar, ptr %101, i32 0, i32 0
  %103 = load i16, ptr %102, align 4, !tbaa !21
  %104 = zext i16 %103 to i32
  %105 = sitofp i32 %104 to float
  %106 = load float, ptr %18, align 4, !tbaa !11
  %107 = fmul float %105, %106
  %108 = load ptr, ptr %15, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.stbtt_aligned_quad, ptr %108, i32 0, i32 2
  store float %107, ptr %109, align 4, !tbaa !26
  %110 = load ptr, ptr %20, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.stbtt_bakedchar, ptr %110, i32 0, i32 1
  %112 = load i16, ptr %111, align 2, !tbaa !24
  %113 = zext i16 %112 to i32
  %114 = sitofp i32 %113 to float
  %115 = load float, ptr %19, align 4, !tbaa !11
  %116 = fmul float %114, %115
  %117 = load ptr, ptr %15, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.stbtt_aligned_quad, ptr %117, i32 0, i32 3
  store float %116, ptr %118, align 4, !tbaa !27
  %119 = load ptr, ptr %20, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.stbtt_bakedchar, ptr %119, i32 0, i32 2
  %121 = load i16, ptr %120, align 4, !tbaa !20
  %122 = zext i16 %121 to i32
  %123 = sitofp i32 %122 to float
  %124 = load float, ptr %18, align 4, !tbaa !11
  %125 = fmul float %123, %124
  %126 = load ptr, ptr %15, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.stbtt_aligned_quad, ptr %126, i32 0, i32 6
  store float %125, ptr %127, align 4, !tbaa !28
  %128 = load ptr, ptr %20, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.stbtt_bakedchar, ptr %128, i32 0, i32 3
  %130 = load i16, ptr %129, align 2, !tbaa !23
  %131 = zext i16 %130 to i32
  %132 = sitofp i32 %131 to float
  %133 = load float, ptr %19, align 4, !tbaa !11
  %134 = fmul float %132, %133
  %135 = load ptr, ptr %15, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.stbtt_aligned_quad, ptr %135, i32 0, i32 7
  store float %134, ptr %136, align 4, !tbaa !29
  %137 = load ptr, ptr %20, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.stbtt_bakedchar, ptr %137, i32 0, i32 6
  %139 = load float, ptr %138, align 4, !tbaa !30
  %140 = load ptr, ptr %13, align 8, !tbaa !5
  %141 = load float, ptr %140, align 4, !tbaa !11
  %142 = fadd float %141, %139
  store float %142, ptr %140, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.floor.f64(double) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!14, !12, i64 8}
!14 = !{!"_ZTS15stbtt_bakedchar", !15, i64 0, !15, i64 2, !15, i64 4, !15, i64 6, !12, i64 8, !12, i64 12, !12, i64 16}
!15 = !{!"short", !7, i64 0}
!16 = !{!14, !12, i64 12}
!17 = !{!18, !12, i64 0}
!18 = !{!"_ZTS18stbtt_aligned_quad", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28}
!19 = !{!18, !12, i64 4}
!20 = !{!14, !15, i64 4}
!21 = !{!14, !15, i64 0}
!22 = !{!18, !12, i64 16}
!23 = !{!14, !15, i64 6}
!24 = !{!14, !15, i64 2}
!25 = !{!18, !12, i64 20}
!26 = !{!18, !12, i64 8}
!27 = !{!18, !12, i64 12}
!28 = !{!18, !12, i64 24}
!29 = !{!18, !12, i64 28}
!30 = !{!14, !12, i64 16}


; 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"

%struct.stbtt_bakedchar = type { i16, i16, i16, i16, float, float, float }

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @stbtt_GetBakedQuad(ptr nocapture noundef readonly %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, ptr nocapture noundef %4, ptr nocapture noundef readonly %5, ptr nocapture noundef writeonly %6, i32 noundef %7) local_unnamed_addr #0 {
  %.not = icmp eq i32 %7, 0
  %9 = select i1 %.not, float -5.000000e-01, float 0.000000e+00
  %10 = insertelement <2 x i32> poison, i32 %1, i64 0
  %11 = insertelement <2 x i32> %10, i32 %2, i64 1
  %12 = sitofp <2 x i32> %11 to <2 x float>
  %13 = sext i32 %3 to i64
  %14 = getelementptr inbounds %struct.stbtt_bakedchar, ptr %0, i64 %13
  %15 = load float, ptr %4, align 4, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %14, i64 8
  %17 = load float, ptr %5, align 4, !tbaa !5
  %18 = load <2 x float>, ptr %16, align 4, !tbaa !5
  %19 = insertelement <2 x float> poison, float %15, i64 0
  %20 = insertelement <2 x float> %19, float %17, i64 1
  %21 = fadd <2 x float> %20, %18
  %22 = fpext <2 x float> %21 to <2 x double>
  %23 = fadd <2 x double> %22, <double 5.000000e-01, double 5.000000e-01>
  %24 = tail call <2 x double> @llvm.floor.v2f64(<2 x double> %23)
  %25 = fptosi <2 x double> %24 to <2 x i32>
  %26 = sitofp <2 x i32> %25 to <2 x float>
  %27 = insertelement <2 x float> poison, float %9, i64 0
  %28 = shufflevector <2 x float> %27, <2 x float> poison, <2 x i32> zeroinitializer
  %29 = fadd <2 x float> %28, %26
  store <2 x float> %29, ptr %6, align 4, !tbaa !5
  %30 = getelementptr inbounds i8, ptr %14, i64 4
  %31 = getelementptr inbounds i8, ptr %6, i64 16
  %32 = getelementptr inbounds i8, ptr %6, i64 8
  %33 = fdiv <2 x float> <float 1.000000e+00, float 1.000000e+00>, %12
  %34 = load <2 x i16>, ptr %14, align 4, !tbaa !9
  %35 = load <2 x i16>, ptr %30, align 4, !tbaa !9
  %36 = zext <2 x i16> %35 to <2 x i32>
  %37 = add nsw <2 x i32> %36, %25
  %38 = zext <2 x i16> %34 to <2 x i32>
  %39 = sub <2 x i32> %37, %38
  %40 = sitofp <2 x i32> %39 to <2 x float>
  %41 = fadd <2 x float> %28, %40
  store <2 x float> %41, ptr %31, align 4, !tbaa !5
  %42 = uitofp <2 x i16> %34 to <2 x float>
  %43 = fmul <2 x float> %33, %42
  store <2 x float> %43, ptr %32, align 4, !tbaa !5
  %44 = getelementptr inbounds i8, ptr %6, i64 24
  %45 = uitofp <2 x i16> %35 to <2 x float>
  %46 = fmul <2 x float> %33, %45
  store <2 x float> %46, ptr %44, align 4, !tbaa !5
  %47 = getelementptr inbounds i8, ptr %14, i64 16
  %48 = load float, ptr %47, align 4, !tbaa !11
  %49 = load float, ptr %4, align 4, !tbaa !5
  %50 = fadd float %48, %49
  store float %50, ptr %4, align 4, !tbaa !5
  ret void
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.floor.v2f64(<2 x double>) #1

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"short", !7, i64 0}
!11 = !{!12, !6, i64 16}
!12 = !{!"_ZTS15stbtt_bakedchar", !10, i64 0, !10, i64 2, !10, i64 4, !10, i64 6, !6, i64 8, !6, i64 12, !6, i64 16}


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