; 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_packedchar = type { i16, i16, i16, i16, float, float, 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_GetPackedQuad(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 ptr, align 8
  %20 = alloca float, align 4
  %21 = alloca float, 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
  %22 = load i32, ptr %10, align 4, !tbaa !9
  %23 = sitofp i32 %22 to float
  %24 = fdiv float 1.000000e+00, %23
  store float %24, ptr %17, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #3
  %25 = load i32, ptr %11, align 4, !tbaa !9
  %26 = sitofp i32 %25 to float
  %27 = fdiv float 1.000000e+00, %26
  store float %27, ptr %18, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #3
  %28 = load ptr, ptr %9, align 8, !tbaa !5
  %29 = load i32, ptr %12, align 4, !tbaa !9
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds %struct.stbtt_packedchar, ptr %28, i64 %30
  store ptr %31, ptr %19, align 8, !tbaa !5
  %32 = load i32, ptr %16, align 4, !tbaa !9
  %33 = icmp ne i32 %32, 0
  br i1 %33, label %34, label %83

34:                                               ; preds = %8
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #3
  %35 = load ptr, ptr %13, align 8, !tbaa !5
  %36 = load float, ptr %35, align 4, !tbaa !11
  %37 = load ptr, ptr %19, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.stbtt_packedchar, ptr %37, i32 0, i32 4
  %39 = load float, ptr %38, align 4, !tbaa !13
  %40 = fadd float %36, %39
  %41 = fadd float %40, 5.000000e-01
  %42 = call noundef float @_ZSt5floorf(float noundef %41)
  %43 = fptosi float %42 to i32
  %44 = sitofp i32 %43 to float
  store float %44, ptr %20, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #3
  %45 = load ptr, ptr %14, align 8, !tbaa !5
  %46 = load float, ptr %45, align 4, !tbaa !11
  %47 = load ptr, ptr %19, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.stbtt_packedchar, ptr %47, i32 0, i32 5
  %49 = load float, ptr %48, align 4, !tbaa !16
  %50 = fadd float %46, %49
  %51 = fadd float %50, 5.000000e-01
  %52 = call noundef float @_ZSt5floorf(float noundef %51)
  %53 = fptosi float %52 to i32
  %54 = sitofp i32 %53 to float
  store float %54, ptr %21, align 4, !tbaa !11
  %55 = load float, ptr %20, align 4, !tbaa !11
  %56 = load ptr, ptr %15, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.stbtt_aligned_quad, ptr %56, i32 0, i32 0
  store float %55, ptr %57, align 4, !tbaa !17
  %58 = load float, ptr %21, align 4, !tbaa !11
  %59 = load ptr, ptr %15, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.stbtt_aligned_quad, ptr %59, i32 0, i32 1
  store float %58, ptr %60, align 4, !tbaa !19
  %61 = load float, ptr %20, align 4, !tbaa !11
  %62 = load ptr, ptr %19, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.stbtt_packedchar, ptr %62, i32 0, i32 7
  %64 = load float, ptr %63, align 4, !tbaa !20
  %65 = fadd float %61, %64
  %66 = load ptr, ptr %19, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.stbtt_packedchar, ptr %66, i32 0, i32 4
  %68 = load float, ptr %67, align 4, !tbaa !13
  %69 = fsub float %65, %68
  %70 = load ptr, ptr %15, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.stbtt_aligned_quad, ptr %70, i32 0, i32 4
  store float %69, ptr %71, align 4, !tbaa !21
  %72 = load float, ptr %21, align 4, !tbaa !11
  %73 = load ptr, ptr %19, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.stbtt_packedchar, ptr %73, i32 0, i32 8
  %75 = load float, ptr %74, align 4, !tbaa !22
  %76 = fadd float %72, %75
  %77 = load ptr, ptr %19, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.stbtt_packedchar, ptr %77, i32 0, i32 5
  %79 = load float, ptr %78, align 4, !tbaa !16
  %80 = fsub float %76, %79
  %81 = load ptr, ptr %15, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.stbtt_aligned_quad, ptr %81, i32 0, i32 5
  store float %80, ptr %82, align 4, !tbaa !23
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #3
  br label %116

83:                                               ; preds = %8
  %84 = load ptr, ptr %13, align 8, !tbaa !5
  %85 = load float, ptr %84, align 4, !tbaa !11
  %86 = load ptr, ptr %19, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.stbtt_packedchar, ptr %86, i32 0, i32 4
  %88 = load float, ptr %87, align 4, !tbaa !13
  %89 = fadd float %85, %88
  %90 = load ptr, ptr %15, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.stbtt_aligned_quad, ptr %90, i32 0, i32 0
  store float %89, ptr %91, align 4, !tbaa !17
  %92 = load ptr, ptr %14, align 8, !tbaa !5
  %93 = load float, ptr %92, align 4, !tbaa !11
  %94 = load ptr, ptr %19, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.stbtt_packedchar, ptr %94, i32 0, i32 5
  %96 = load float, ptr %95, align 4, !tbaa !16
  %97 = fadd float %93, %96
  %98 = load ptr, ptr %15, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.stbtt_aligned_quad, ptr %98, i32 0, i32 1
  store float %97, ptr %99, align 4, !tbaa !19
  %100 = load ptr, ptr %13, align 8, !tbaa !5
  %101 = load float, ptr %100, align 4, !tbaa !11
  %102 = load ptr, ptr %19, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.stbtt_packedchar, ptr %102, i32 0, i32 7
  %104 = load float, ptr %103, align 4, !tbaa !20
  %105 = fadd float %101, %104
  %106 = load ptr, ptr %15, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.stbtt_aligned_quad, ptr %106, i32 0, i32 4
  store float %105, ptr %107, align 4, !tbaa !21
  %108 = load ptr, ptr %14, align 8, !tbaa !5
  %109 = load float, ptr %108, align 4, !tbaa !11
  %110 = load ptr, ptr %19, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.stbtt_packedchar, ptr %110, i32 0, i32 8
  %112 = load float, ptr %111, align 4, !tbaa !22
  %113 = fadd float %109, %112
  %114 = load ptr, ptr %15, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.stbtt_aligned_quad, ptr %114, i32 0, i32 5
  store float %113, ptr %115, align 4, !tbaa !23
  br label %116

116:                                              ; preds = %83, %34
  %117 = load ptr, ptr %19, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.stbtt_packedchar, ptr %117, i32 0, i32 0
  %119 = load i16, ptr %118, align 4, !tbaa !24
  %120 = zext i16 %119 to i32
  %121 = sitofp i32 %120 to float
  %122 = load float, ptr %17, 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 2
  store float %123, ptr %125, align 4, !tbaa !25
  %126 = load ptr, ptr %19, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.stbtt_packedchar, ptr %126, i32 0, i32 1
  %128 = load i16, ptr %127, align 2, !tbaa !26
  %129 = zext i16 %128 to i32
  %130 = sitofp i32 %129 to float
  %131 = load float, ptr %18, 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 3
  store float %132, ptr %134, align 4, !tbaa !27
  %135 = load ptr, ptr %19, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.stbtt_packedchar, ptr %135, i32 0, i32 2
  %137 = load i16, ptr %136, align 4, !tbaa !28
  %138 = zext i16 %137 to i32
  %139 = sitofp i32 %138 to float
  %140 = load float, ptr %17, align 4, !tbaa !11
  %141 = fmul float %139, %140
  %142 = load ptr, ptr %15, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.stbtt_aligned_quad, ptr %142, i32 0, i32 6
  store float %141, ptr %143, align 4, !tbaa !29
  %144 = load ptr, ptr %19, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.stbtt_packedchar, ptr %144, i32 0, i32 3
  %146 = load i16, ptr %145, align 2, !tbaa !30
  %147 = zext i16 %146 to i32
  %148 = sitofp i32 %147 to float
  %149 = load float, ptr %18, align 4, !tbaa !11
  %150 = fmul float %148, %149
  %151 = load ptr, ptr %15, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.stbtt_aligned_quad, ptr %151, i32 0, i32 7
  store float %150, ptr %152, align 4, !tbaa !31
  %153 = load ptr, ptr %19, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.stbtt_packedchar, ptr %153, i32 0, i32 6
  %155 = load float, ptr %154, align 4, !tbaa !32
  %156 = load ptr, ptr %13, align 8, !tbaa !5
  %157 = load float, ptr %156, align 4, !tbaa !11
  %158 = fadd float %157, %155
  store float %158, ptr %156, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, 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 = !{!"_ZTS16stbtt_packedchar", !15, i64 0, !15, i64 2, !15, i64 4, !15, i64 6, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24}
!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, !12, i64 20}
!21 = !{!18, !12, i64 16}
!22 = !{!14, !12, i64 24}
!23 = !{!18, !12, i64 20}
!24 = !{!14, !15, i64 0}
!25 = !{!18, !12, i64 8}
!26 = !{!14, !15, i64 2}
!27 = !{!18, !12, i64 12}
!28 = !{!14, !15, i64 4}
!29 = !{!18, !12, i64 24}
!30 = !{!14, !15, i64 6}
!31 = !{!18, !12, i64 28}
!32 = !{!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_packedchar = type { i16, i16, i16, i16, float, float, 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_GetPackedQuad(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 {
  %9 = sext i32 %3 to i64
  %10 = getelementptr inbounds %struct.stbtt_packedchar, ptr %0, i64 %9
  %.not = icmp eq i32 %7, 0
  %11 = load float, ptr %4, align 4, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %10, i64 8
  %13 = load float, ptr %12, align 4, !tbaa !9
  %14 = fadd float %11, %13
  br i1 %.not, label %41, label %15

15:                                               ; preds = %8
  %16 = fadd float %14, 5.000000e-01
  %17 = tail call noundef float @_ZSt5floorf(float noundef %16)
  %18 = load float, ptr %5, align 4, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %10, i64 12
  %20 = load float, ptr %19, align 4, !tbaa !12
  %21 = fadd float %18, %20
  %22 = fadd float %21, 5.000000e-01
  %23 = tail call noundef float @_ZSt5floorf(float noundef %22)
  %24 = insertelement <2 x float> poison, float %17, i64 0
  %25 = insertelement <2 x float> %24, float %23, i64 1
  %26 = fptosi <2 x float> %25 to <2 x i32>
  %27 = sitofp <2 x i32> %26 to <2 x float>
  store <2 x float> %27, ptr %6, align 4, !tbaa !5
  %28 = getelementptr inbounds i8, ptr %10, i64 20
  %29 = load float, ptr %28, align 4, !tbaa !13
  %30 = extractelement <2 x float> %27, i64 0
  %31 = fadd float %29, %30
  %32 = load float, ptr %12, align 4, !tbaa !9
  %33 = fsub float %31, %32
  %34 = getelementptr inbounds i8, ptr %6, i64 16
  store float %33, ptr %34, align 4, !tbaa !14
  %35 = getelementptr inbounds i8, ptr %10, i64 24
  %36 = load float, ptr %35, align 4, !tbaa !16
  %37 = extractelement <2 x float> %27, i64 1
  %38 = fadd float %36, %37
  %39 = load float, ptr %19, align 4, !tbaa !12
  %40 = fsub float %38, %39
  br label %56

41:                                               ; preds = %8
  store float %14, ptr %6, align 4, !tbaa !17
  %42 = load float, ptr %5, align 4, !tbaa !5
  %43 = getelementptr inbounds i8, ptr %10, i64 12
  %44 = load float, ptr %43, align 4, !tbaa !12
  %45 = fadd float %42, %44
  %46 = getelementptr inbounds i8, ptr %6, i64 4
  store float %45, ptr %46, align 4, !tbaa !18
  %47 = load float, ptr %4, align 4, !tbaa !5
  %48 = getelementptr inbounds i8, ptr %10, i64 20
  %49 = load float, ptr %48, align 4, !tbaa !13
  %50 = fadd float %47, %49
  %51 = getelementptr inbounds i8, ptr %6, i64 16
  store float %50, ptr %51, align 4, !tbaa !14
  %52 = load float, ptr %5, align 4, !tbaa !5
  %53 = getelementptr inbounds i8, ptr %10, i64 24
  %54 = load float, ptr %53, align 4, !tbaa !16
  %55 = fadd float %52, %54
  br label %56

56:                                               ; preds = %41, %15
  %.sink = phi float [ %55, %41 ], [ %40, %15 ]
  %57 = getelementptr inbounds i8, ptr %6, i64 20
  store float %.sink, ptr %57, align 4
  %58 = insertelement <2 x i32> poison, i32 %1, i64 0
  %59 = insertelement <2 x i32> %58, i32 %2, i64 1
  %60 = sitofp <2 x i32> %59 to <2 x float>
  %61 = getelementptr inbounds i8, ptr %6, i64 8
  %62 = fdiv <2 x float> <float 1.000000e+00, float 1.000000e+00>, %60
  %63 = load <2 x i16>, ptr %10, align 4, !tbaa !19
  %64 = uitofp <2 x i16> %63 to <2 x float>
  %65 = fmul <2 x float> %62, %64
  store <2 x float> %65, ptr %61, align 4, !tbaa !5
  %66 = getelementptr inbounds i8, ptr %10, i64 4
  %67 = getelementptr inbounds i8, ptr %6, i64 24
  %68 = load <2 x i16>, ptr %66, align 4, !tbaa !19
  %69 = uitofp <2 x i16> %68 to <2 x float>
  %70 = fmul <2 x float> %62, %69
  store <2 x float> %70, ptr %67, align 4, !tbaa !5
  %71 = getelementptr inbounds i8, ptr %10, i64 16
  %72 = load float, ptr %71, align 4, !tbaa !20
  %73 = load float, ptr %4, align 4, !tbaa !5
  %74 = fadd float %72, %73
  store float %74, 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 = !{!"_ZTS16stbtt_packedchar", !11, i64 0, !11, i64 2, !11, i64 4, !11, i64 6, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !6, i64 24}
!11 = !{!"short", !7, i64 0}
!12 = !{!10, !6, i64 12}
!13 = !{!10, !6, i64 20}
!14 = !{!15, !6, i64 16}
!15 = !{!"_ZTS18stbtt_aligned_quad", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !6, i64 24, !6, i64 28}
!16 = !{!10, !6, i64 24}
!17 = !{!15, !6, i64 0}
!18 = !{!15, !6, i64 4}
!19 = !{!11, !11, i64 0}
!20 = !{!10, !6, i64 16}


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