; 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_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 i32 @af_glyph_hints_reload(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
define hidden i32 @af_cjk_hints_apply(i32 noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #2 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store i32 %0, ptr %5, align 4, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !9
  store ptr %3, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %12 = load ptr, ptr %8, align 8, !tbaa !9
  store ptr %12, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  %13 = load ptr, ptr %9, align 8, !tbaa !9
  store ptr %13, ptr %9, align 8, !tbaa !9
  %14 = load i32, ptr %5, align 4, !tbaa !5
  store i32 %14, ptr %5, align 4, !tbaa !5
  %15 = load ptr, ptr %6, align 8, !tbaa !9
  %16 = load ptr, ptr %7, align 8, !tbaa !9
  %17 = call i32 @af_glyph_hints_reload(ptr noundef %15, ptr noundef %16)
  store i32 %17, ptr %10, align 4, !tbaa !5
  %18 = load i32, ptr %10, align 4, !tbaa !5
  %19 = icmp ne i32 %18, 0
  br i1 %19, label %20, label %21

20:                                               ; preds = %4
  br label %89

21:                                               ; preds = %4
  %22 = load ptr, ptr %6, align 8, !tbaa !9
  %23 = getelementptr inbounds %struct.AF_GlyphHintsRec_, ptr %22, i32 0, i32 12
  %24 = load i32, ptr %23, align 8, !tbaa !11
  %25 = and i32 %24, 1
  %26 = icmp ne i32 %25, 0
  br i1 %26, label %36, label %27

27:                                               ; preds = %21
  %28 = load ptr, ptr %6, align 8, !tbaa !9
  %29 = call i32 @af_cjk_hints_detect_features(ptr noundef %28, i32 noundef 0)
  store i32 %29, ptr %10, align 4, !tbaa !5
  %30 = load i32, ptr %10, align 4, !tbaa !5
  %31 = icmp ne i32 %30, 0
  br i1 %31, label %32, label %33

32:                                               ; preds = %27
  br label %89

33:                                               ; preds = %27
  %34 = load ptr, ptr %6, align 8, !tbaa !9
  %35 = load ptr, ptr %9, align 8, !tbaa !9
  call void @af_cjk_hints_compute_blue_edges(ptr noundef %34, ptr noundef %35, i32 noundef 0)
  br label %36

36:                                               ; preds = %33, %21
  %37 = load ptr, ptr %6, align 8, !tbaa !9
  %38 = getelementptr inbounds %struct.AF_GlyphHintsRec_, ptr %37, i32 0, i32 12
  %39 = load i32, ptr %38, align 8, !tbaa !11
  %40 = and i32 %39, 2
  %41 = icmp ne i32 %40, 0
  br i1 %41, label %51, label %42

42:                                               ; preds = %36
  %43 = load ptr, ptr %6, align 8, !tbaa !9
  %44 = call i32 @af_cjk_hints_detect_features(ptr noundef %43, i32 noundef 1)
  store i32 %44, ptr %10, align 4, !tbaa !5
  %45 = load i32, ptr %10, align 4, !tbaa !5
  %46 = icmp ne i32 %45, 0
  br i1 %46, label %47, label %48

47:                                               ; preds = %42
  br label %89

48:                                               ; preds = %42
  %49 = load ptr, ptr %6, align 8, !tbaa !9
  %50 = load ptr, ptr %9, align 8, !tbaa !9
  call void @af_cjk_hints_compute_blue_edges(ptr noundef %49, ptr noundef %50, i32 noundef 1)
  br label %51

51:                                               ; preds = %48, %36
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %52

52:                                               ; preds = %83, %51
  %53 = load i32, ptr %11, align 4, !tbaa !5
  %54 = icmp slt i32 %53, 2
  br i1 %54, label %55, label %86

55:                                               ; preds = %52
  %56 = load i32, ptr %11, align 4, !tbaa !5
  %57 = icmp eq i32 %56, 0
  br i1 %57, label %58, label %64

58:                                               ; preds = %55
  %59 = load ptr, ptr %6, align 8, !tbaa !9
  %60 = getelementptr inbounds %struct.AF_GlyphHintsRec_, ptr %59, i32 0, i32 12
  %61 = load i32, ptr %60, align 8, !tbaa !11
  %62 = and i32 %61, 1
  %63 = icmp ne i32 %62, 0
  br i1 %63, label %64, label %73

64:                                               ; preds = %58, %55
  %65 = load i32, ptr %11, align 4, !tbaa !5
  %66 = icmp eq i32 %65, 1
  br i1 %66, label %67, label %82

67:                                               ; preds = %64
  %68 = load ptr, ptr %6, align 8, !tbaa !9
  %69 = getelementptr inbounds %struct.AF_GlyphHintsRec_, ptr %68, i32 0, i32 12
  %70 = load i32, ptr %69, align 8, !tbaa !11
  %71 = and i32 %70, 2
  %72 = icmp ne i32 %71, 0
  br i1 %72, label %82, label %73

73:                                               ; preds = %67, %58
  %74 = load ptr, ptr %6, align 8, !tbaa !9
  %75 = load i32, ptr %11, align 4, !tbaa !5
  call void @af_cjk_hint_edges(ptr noundef %74, i32 noundef %75)
  %76 = load ptr, ptr %6, align 8, !tbaa !9
  %77 = load i32, ptr %11, align 4, !tbaa !5
  call void @af_cjk_align_edge_points(ptr noundef %76, i32 noundef %77)
  %78 = load ptr, ptr %6, align 8, !tbaa !9
  %79 = load i32, ptr %11, align 4, !tbaa !5
  call void @af_glyph_hints_align_strong_points(ptr noundef %78, i32 noundef %79)
  %80 = load ptr, ptr %6, align 8, !tbaa !9
  %81 = load i32, ptr %11, align 4, !tbaa !5
  call void @af_glyph_hints_align_weak_points(ptr noundef %80, i32 noundef %81)
  br label %82

82:                                               ; preds = %73, %67, %64
  br label %83

83:                                               ; preds = %82
  %84 = load i32, ptr %11, align 4, !tbaa !5
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %11, align 4, !tbaa !5
  br label %52, !llvm.loop !15

86:                                               ; preds = %52
  %87 = load ptr, ptr %6, align 8, !tbaa !9
  %88 = load ptr, ptr %7, align 8, !tbaa !9
  call void @af_glyph_hints_save(ptr noundef %87, ptr noundef %88)
  br label %89

89:                                               ; preds = %86, %47, %32, %20
  %90 = load i32, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  ret i32 %90
}

; Function Attrs: nounwind uwtable
declare hidden i32 @af_cjk_hints_detect_features(ptr noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @af_cjk_hints_compute_blue_edges(ptr noundef, ptr noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @af_cjk_hint_edges(ptr noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @af_cjk_align_edge_points(ptr noundef, i32 noundef) #2

declare hidden void @af_glyph_hints_align_strong_points(ptr noundef, i32 noundef) #1

declare hidden void @af_glyph_hints_align_weak_points(ptr noundef, i32 noundef) #1

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

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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !6, i64 5144}
!12 = !{!"AF_GlyphHintsRec_", !10, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !13, i64 32, !6, i64 40, !6, i64 44, !10, i64 48, !6, i64 56, !6, i64 60, !10, i64 64, !7, i64 72, !6, i64 5144, !6, i64 5148, !10, i64 5152, !14, i64 5160}
!13 = !{!"long", !7, i64 0}
!14 = !{!"", !7, i64 0, !7, i64 64}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}


; 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 i32 @af_glyph_hints_reload(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define hidden i32 @af_cjk_hints_apply(i32 noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) local_unnamed_addr #1 {
  %5 = tail call i32 @af_glyph_hints_reload(ptr noundef %1, ptr noundef %2) #2
  %.not = icmp eq i32 %5, 0
  br i1 %.not, label %6, label %28

6:                                                ; preds = %4
  %7 = getelementptr inbounds i8, ptr %1, i64 5144
  %8 = load i32, ptr %7, align 8, !tbaa !5
  %9 = and i32 %8, 1
  %.not39 = icmp eq i32 %9, 0
  br i1 %.not39, label %10, label %13

10:                                               ; preds = %6
  %11 = tail call i32 @af_cjk_hints_detect_features(ptr noundef nonnull %1, i32 noundef 0)
  %.not40 = icmp eq i32 %11, 0
  br i1 %.not40, label %12, label %28

12:                                               ; preds = %10
  tail call void @af_cjk_hints_compute_blue_edges(ptr noundef nonnull %1, ptr noundef %3, i32 noundef 0)
  %.pre = load i32, ptr %7, align 8, !tbaa !5
  br label %13

13:                                               ; preds = %12, %6
  %14 = phi i32 [ %.pre, %12 ], [ %8, %6 ]
  %15 = and i32 %14, 2
  %.not41 = icmp eq i32 %15, 0
  br i1 %.not41, label %16, label %19

16:                                               ; preds = %13
  %17 = tail call i32 @af_cjk_hints_detect_features(ptr noundef nonnull %1, i32 noundef 1)
  %.not42 = icmp eq i32 %17, 0
  br i1 %.not42, label %18, label %28

18:                                               ; preds = %16
  tail call void @af_cjk_hints_compute_blue_edges(ptr noundef nonnull %1, ptr noundef %3, i32 noundef 1)
  br label %19

19:                                               ; preds = %13, %18
  %20 = load i32, ptr %7, align 8, !tbaa !5
  %21 = and i32 %20, 1
  %.not43 = icmp eq i32 %21, 0
  br i1 %.not43, label %22, label %23

22:                                               ; preds = %19
  tail call void @af_cjk_hint_edges(ptr noundef nonnull %1, i32 noundef 0)
  tail call void @af_cjk_align_edge_points(ptr noundef nonnull %1, i32 noundef 0)
  tail call void @af_glyph_hints_align_strong_points(ptr noundef nonnull %1, i32 noundef 0) #2
  tail call void @af_glyph_hints_align_weak_points(ptr noundef nonnull %1, i32 noundef 0) #2
  br label %23

23:                                               ; preds = %22, %19
  %24 = load i32, ptr %7, align 8, !tbaa !5
  %25 = and i32 %24, 2
  %.not44.1 = icmp eq i32 %25, 0
  br i1 %.not44.1, label %26, label %27

26:                                               ; preds = %23
  tail call void @af_cjk_hint_edges(ptr noundef nonnull %1, i32 noundef 1)
  tail call void @af_cjk_align_edge_points(ptr noundef nonnull %1, i32 noundef 1)
  tail call void @af_glyph_hints_align_strong_points(ptr noundef nonnull %1, i32 noundef 1) #2
  tail call void @af_glyph_hints_align_weak_points(ptr noundef nonnull %1, i32 noundef 1) #2
  br label %27

27:                                               ; preds = %26, %23
  tail call void @af_glyph_hints_save(ptr noundef nonnull %1, ptr noundef %2) #2
  br label %28

28:                                               ; preds = %16, %10, %4, %27
  %.2 = phi i32 [ %5, %4 ], [ 0, %27 ], [ %17, %16 ], [ %11, %10 ]
  ret i32 %.2
}

; Function Attrs: nounwind uwtable
declare hidden i32 @af_cjk_hints_detect_features(ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @af_cjk_hints_compute_blue_edges(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @af_cjk_hint_edges(ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @af_cjk_align_edge_points(ptr noundef, i32 noundef) local_unnamed_addr #1

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

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

declare hidden void @af_glyph_hints_save(ptr noundef, ptr noundef) local_unnamed_addr #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, !11, i64 5144}
!6 = !{!"AF_GlyphHintsRec_", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !11, i64 40, !11, i64 44, !7, i64 48, !11, i64 56, !11, i64 60, !7, i64 64, !8, i64 72, !11, i64 5144, !11, i64 5148, !7, i64 5152, !12, i64 5160}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!"", !8, i64 0, !8, i64 64}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass