; LLVM IR from ashishzero/karma :: src/modules/core (stb)

; 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt5floorf(float noundef) #1

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 = { mustprogress 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 #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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt5floorf(float noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind 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 #1 {
  %.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 %16, align 4, !tbaa !9
  %18 = fadd float %15, %17
  %19 = fadd float %18, 5.000000e-01
  %20 = tail call noundef float @_ZSt5floorf(float noundef %19)
  %21 = load float, ptr %5, align 4, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %14, i64 12
  %23 = load float, ptr %22, align 4, !tbaa !12
  %24 = fadd float %21, %23
  %25 = fadd float %24, 5.000000e-01
  %26 = tail call noundef float @_ZSt5floorf(float noundef %25)
  %27 = insertelement <2 x float> poison, float %20, i64 0
  %28 = insertelement <2 x float> %27, float %26, i64 1
  %29 = fptosi <2 x float> %28 to <2 x i32>
  %30 = sitofp <2 x i32> %29 to <2 x float>
  %31 = insertelement <2 x float> poison, float %9, i64 0
  %32 = shufflevector <2 x float> %31, <2 x float> poison, <2 x i32> zeroinitializer
  %33 = fadd <2 x float> %32, %30
  store <2 x float> %33, ptr %6, align 4, !tbaa !5
  %34 = getelementptr inbounds i8, ptr %14, i64 4
  %35 = getelementptr inbounds i8, ptr %6, i64 16
  %36 = getelementptr inbounds i8, ptr %6, i64 8
  %37 = fdiv <2 x float> <float 1.000000e+00, float 1.000000e+00>, %12
  %38 = load <2 x i16>, ptr %14, align 4, !tbaa !13
  %39 = load <2 x i16>, ptr %34, align 4, !tbaa !13
  %40 = zext <2 x i16> %39 to <2 x i32>
  %41 = add nsw <2 x i32> %40, %29
  %42 = zext <2 x i16> %38 to <2 x i32>
  %43 = sub <2 x i32> %41, %42
  %44 = sitofp <2 x i32> %43 to <2 x float>
  %45 = fadd <2 x float> %32, %44
  store <2 x float> %45, ptr %35, align 4, !tbaa !5
  %46 = uitofp <2 x i16> %38 to <2 x float>
  %47 = fmul <2 x float> %37, %46
  store <2 x float> %47, ptr %36, align 4, !tbaa !5
  %48 = getelementptr inbounds i8, ptr %6, i64 24
  %49 = uitofp <2 x i16> %39 to <2 x float>
  %50 = fmul <2 x float> %37, %49
  store <2 x float> %50, ptr %48, align 4, !tbaa !5
  %51 = getelementptr inbounds i8, ptr %14, i64 16
  %52 = load float, ptr %51, align 4, !tbaa !14
  %53 = load float, ptr %4, align 4, !tbaa !5
  %54 = fadd float %52, %53
  store float %54, ptr %4, align 4, !tbaa !5
  ret void
}

attributes #0 = { inlinehint 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 #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" }

!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, !6, i64 8}
!10 = !{!"_ZTS15stbtt_bakedchar", !11, i64 0, !11, i64 2, !11, i64 4, !11, i64 6, !6, i64 8, !6, i64 12, !6, i64 16}
!11 = !{!"short", !7, i64 0}
!12 = !{!10, !6, i64 12}
!13 = !{!11, !11, i64 0}
!14 = !{!10, !6, i64 16}


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