; LLVM IR from reworks-org/galaxy :: deps/sfml_deps/freetype-src/src/autofit (afcjk)

; 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.AF_CJKMetricsRec_ = type { %struct.AF_StyleMetricsRec_, i32, [2 x %struct.AF_CJKAxisRec_] }
%struct.AF_StyleMetricsRec_ = type { ptr, %struct.AF_ScalerRec_, i8, ptr }
%struct.AF_ScalerRec_ = type { ptr, i64, i64, i64, i64, i32, i32 }
%struct.AF_CJKAxisRec_ = type { i64, i64, i32, [16 x %struct.AF_WidthRec_], i64, i64, i8, i8, i32, [266 x %struct.AF_CJKBlueRec_], i64, i64 }
%struct.AF_WidthRec_ = type { i64, i64, i64 }
%struct.AF_CJKBlueRec_ = type { %struct.AF_WidthRec_, %struct.AF_WidthRec_, i32 }
%struct.AF_GlyphHintsRec_ = type { ptr, i64, i64, i64, i64, i32, i32, ptr, i32, i32, ptr, [2 x %struct.AF_AxisHintsRec_], i32, i32, ptr, %struct.anon.0 }
%struct.AF_AxisHintsRec_ = type { i32, i32, ptr, i32, i32, ptr, i32, %struct.anon }
%struct.anon = type { [18 x %struct.AF_SegmentRec_], [12 x %struct.AF_EdgeRec_] }
%struct.AF_SegmentRec_ = type { i8, i8, i16, i16, i16, i16, i16, ptr, ptr, ptr, ptr, i64, i64, ptr, ptr }
%struct.AF_EdgeRec_ = type { i16, i64, i64, i8, i8, i64, ptr, ptr, ptr, i32, ptr, ptr }
%struct.anon.0 = type { [8 x ptr], [96 x %struct.AF_PointRec_] }
%struct.AF_PointRec_ = type { i16, i8, i8, i64, i64, i16, i16, i64, i64, i64, i64, ptr, ptr }

; 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

declare hidden void @af_glyph_hints_rescale(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
define hidden i32 @af_cjk_hints_init(ptr noundef %0, ptr noundef %1) #2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %9, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  call void @af_glyph_hints_rescale(ptr noundef %10, ptr noundef %11)
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.AF_CJKMetricsRec_, ptr %12, i32 0, i32 2
  %14 = getelementptr inbounds [2 x %struct.AF_CJKAxisRec_], ptr %13, i64 0, i64 0
  %15 = getelementptr inbounds %struct.AF_CJKAxisRec_, ptr %14, i32 0, i32 0
  %16 = load i64, ptr %15, align 8, !tbaa !9
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.AF_GlyphHintsRec_, ptr %17, i32 0, i32 1
  store i64 %16, ptr %18, align 8, !tbaa !13
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.AF_CJKMetricsRec_, ptr %19, i32 0, i32 2
  %21 = getelementptr inbounds [2 x %struct.AF_CJKAxisRec_], ptr %20, i64 0, i64 0
  %22 = getelementptr inbounds %struct.AF_CJKAxisRec_, ptr %21, i32 0, i32 1
  %23 = load i64, ptr %22, align 8, !tbaa !16
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.AF_GlyphHintsRec_, ptr %24, i32 0, i32 2
  store i64 %23, ptr %25, align 8, !tbaa !17
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.AF_CJKMetricsRec_, ptr %26, i32 0, i32 2
  %28 = getelementptr inbounds [2 x %struct.AF_CJKAxisRec_], ptr %27, i64 0, i64 1
  %29 = getelementptr inbounds %struct.AF_CJKAxisRec_, ptr %28, i32 0, i32 0
  %30 = load i64, ptr %29, align 8, !tbaa !9
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.AF_GlyphHintsRec_, ptr %31, i32 0, i32 3
  store i64 %30, ptr %32, align 8, !tbaa !18
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.AF_CJKMetricsRec_, ptr %33, i32 0, i32 2
  %35 = getelementptr inbounds [2 x %struct.AF_CJKAxisRec_], ptr %34, i64 0, i64 1
  %36 = getelementptr inbounds %struct.AF_CJKAxisRec_, ptr %35, i32 0, i32 1
  %37 = load i64, ptr %36, align 8, !tbaa !16
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.AF_GlyphHintsRec_, ptr %38, i32 0, i32 4
  store i64 %37, ptr %39, align 8, !tbaa !19
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.AF_CJKMetricsRec_, ptr %40, i32 0, i32 0
  %42 = getelementptr inbounds %struct.AF_StyleMetricsRec_, ptr %41, i32 0, i32 1
  %43 = getelementptr inbounds %struct.AF_ScalerRec_, ptr %42, i32 0, i32 5
  %44 = load i32, ptr %43, align 8, !tbaa !20
  store i32 %44, ptr %6, align 4, !tbaa !24
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.AF_GlyphHintsRec_, ptr %45, i32 0, i32 12
  %47 = load i32, ptr %46, align 8, !tbaa !25
  store i32 %47, ptr %7, align 4, !tbaa !24
  store i32 0, ptr %8, align 4, !tbaa !24
  %48 = load i32, ptr %6, align 4, !tbaa !24
  %49 = icmp eq i32 %48, 2
  br i1 %49, label %53, label %50

50:                                               ; preds = %2
  %51 = load i32, ptr %6, align 4, !tbaa !24
  %52 = icmp eq i32 %51, 3
  br i1 %52, label %53, label %56

53:                                               ; preds = %50, %2
  %54 = load i32, ptr %8, align 4, !tbaa !24
  %55 = or i32 %54, 1
  store i32 %55, ptr %8, align 4, !tbaa !24
  br label %56

56:                                               ; preds = %53, %50
  %57 = load i32, ptr %6, align 4, !tbaa !24
  %58 = icmp eq i32 %57, 2
  br i1 %58, label %62, label %59

59:                                               ; preds = %56
  %60 = load i32, ptr %6, align 4, !tbaa !24
  %61 = icmp eq i32 %60, 4
  br i1 %61, label %62, label %65

62:                                               ; preds = %59, %56
  %63 = load i32, ptr %8, align 4, !tbaa !24
  %64 = or i32 %63, 2
  store i32 %64, ptr %8, align 4, !tbaa !24
  br label %65

65:                                               ; preds = %62, %59
  %66 = load i32, ptr %6, align 4, !tbaa !24
  %67 = icmp ne i32 %66, 1
  br i1 %67, label %68, label %74

68:                                               ; preds = %65
  %69 = load i32, ptr %6, align 4, !tbaa !24
  %70 = icmp ne i32 %69, 3
  br i1 %70, label %71, label %74

71:                                               ; preds = %68
  %72 = load i32, ptr %8, align 4, !tbaa !24
  %73 = or i32 %72, 4
  store i32 %73, ptr %8, align 4, !tbaa !24
  br label %74

74:                                               ; preds = %71, %68, %65
  %75 = load i32, ptr %6, align 4, !tbaa !24
  %76 = icmp eq i32 %75, 2
  br i1 %76, label %77, label %80

77:                                               ; preds = %74
  %78 = load i32, ptr %8, align 4, !tbaa !24
  %79 = or i32 %78, 8
  store i32 %79, ptr %8, align 4, !tbaa !24
  br label %80

80:                                               ; preds = %77, %74
  %81 = load i32, ptr %7, align 4, !tbaa !24
  %82 = or i32 %81, 4
  store i32 %82, ptr %7, align 4, !tbaa !24
  %83 = load i32, ptr %7, align 4, !tbaa !24
  %84 = load ptr, ptr %3, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.AF_GlyphHintsRec_, ptr %84, i32 0, i32 12
  store i32 %83, ptr %85, align 8, !tbaa !25
  %86 = load i32, ptr %8, align 4, !tbaa !24
  %87 = load ptr, ptr %3, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.AF_GlyphHintsRec_, ptr %87, i32 0, i32 13
  store i32 %86, ptr %88, align 4, !tbaa !26
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  ret i32 0
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"AF_CJKAxisRec_", !11, i64 0, !11, i64 8, !12, i64 16, !7, i64 24, !11, i64 408, !11, i64 416, !7, i64 424, !7, i64 425, !12, i64 428, !7, i64 432, !11, i64 15328, !11, i64 15336}
!11 = !{!"long", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !11, i64 8}
!14 = !{!"AF_GlyphHintsRec_", !6, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !12, i64 40, !12, i64 44, !6, i64 48, !12, i64 56, !12, i64 60, !6, i64 64, !7, i64 72, !12, i64 5144, !12, i64 5148, !6, i64 5152, !15, i64 5160}
!15 = !{!"", !7, i64 0, !7, i64 64}
!16 = !{!10, !11, i64 8}
!17 = !{!14, !11, i64 16}
!18 = !{!14, !11, i64 24}
!19 = !{!14, !11, i64 32}
!20 = !{!21, !12, i64 48}
!21 = !{!"AF_CJKMetricsRec_", !22, i64 0, !12, i64 72, !7, i64 80}
!22 = !{!"AF_StyleMetricsRec_", !6, i64 0, !23, i64 8, !7, i64 56, !6, i64 64}
!23 = !{!"AF_ScalerRec_", !6, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !12, i64 40, !12, i64 44}
!24 = !{!12, !12, i64 0}
!25 = !{!14, !12, i64 5144}
!26 = !{!14, !12, i64 5148}


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

declare hidden void @af_glyph_hints_rescale(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define hidden noundef i32 @af_cjk_hints_init(ptr noundef %0, ptr noundef %1) local_unnamed_addr #1 {
  tail call void @af_glyph_hints_rescale(ptr noundef %0, ptr noundef %1) #2
  %3 = getelementptr inbounds i8, ptr %1, i64 80
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  %5 = load <2 x i64>, ptr %3, align 8, !tbaa !5
  store <2 x i64> %5, ptr %4, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %1, i64 15424
  %7 = getelementptr inbounds i8, ptr %0, i64 24
  %8 = load <2 x i64>, ptr %6, align 8, !tbaa !5
  store <2 x i64> %8, ptr %7, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %1, i64 48
  %10 = load i32, ptr %9, align 8, !tbaa !9
  %11 = getelementptr inbounds i8, ptr %0, i64 5144
  %12 = load i32, ptr %11, align 8, !tbaa !15
  %13 = icmp eq i32 %10, 2
  %14 = and i32 %10, -2
  %or.cond = icmp eq i32 %14, 2
  %spec.select = zext i1 %or.cond to i32
  %15 = icmp eq i32 %10, 4
  %or.cond3 = or i1 %13, %15
  %16 = or disjoint i32 %spec.select, 2
  %.1 = select i1 %or.cond3, i32 %16, i32 %spec.select
  %17 = and i32 %10, -3
  %or.cond5.not = icmp eq i32 %17, 1
  %18 = or disjoint i32 %.1, 4
  %.2 = select i1 %or.cond5.not, i32 %.1, i32 %18
  %19 = or disjoint i32 %.2, 8
  %.3 = select i1 %13, i32 %19, i32 %.2
  %20 = or i32 %12, 4
  store i32 %20, ptr %11, align 8, !tbaa !15
  %21 = getelementptr inbounds i8, ptr %0, i64 5148
  store i32 %.3, ptr %21, align 4, !tbaa !18
  ret i32 0
}

attributes #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 = { 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 = { 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !14, i64 48}
!10 = !{!"AF_CJKMetricsRec_", !11, i64 0, !14, i64 72, !7, i64 80}
!11 = !{!"AF_StyleMetricsRec_", !12, i64 0, !13, i64 8, !7, i64 56, !12, i64 64}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!"AF_ScalerRec_", !12, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !14, i64 40, !14, i64 44}
!14 = !{!"int", !7, i64 0}
!15 = !{!16, !14, i64 5144}
!16 = !{!"AF_GlyphHintsRec_", !12, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !14, i64 40, !14, i64 44, !12, i64 48, !14, i64 56, !14, i64 60, !12, i64 64, !7, i64 72, !14, i64 5144, !14, i64 5148, !12, i64 5152, !17, i64 5160}
!17 = !{!"", !7, i64 0, !7, i64 64}
!18 = !{!16, !14, i64 5148}


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