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

; 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.FT_Vector_ = type { i64, i64 }

; 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: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

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

; Function Attrs: nounwind uwtable
define dso_local void @FT_Vector_Rotate(ptr noundef %0, i64 noundef %1) #2 {
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca %struct.FT_Vector_, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i64 %1, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #3
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = icmp ne ptr %9, null
  br i1 %10, label %11, label %14

11:                                               ; preds = %2
  %12 = load i64, ptr %4, align 8, !tbaa !9
  %13 = icmp ne i64 %12, 0
  br i1 %13, label %15, label %14

14:                                               ; preds = %11, %2
  store i32 1, ptr %7, align 4
  br label %92

15:                                               ; preds = %11
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %6, ptr align 8 %16, i64 16, i1 false), !tbaa.struct !11
  %17 = getelementptr inbounds %struct.FT_Vector_, ptr %6, i32 0, i32 0
  %18 = load i64, ptr %17, align 8, !tbaa !12
  %19 = icmp eq i64 %18, 0
  br i1 %19, label %20, label %25

20:                                               ; preds = %15
  %21 = getelementptr inbounds %struct.FT_Vector_, ptr %6, i32 0, i32 1
  %22 = load i64, ptr %21, align 8, !tbaa !14
  %23 = icmp eq i64 %22, 0
  br i1 %23, label %24, label %25

24:                                               ; preds = %20
  store i32 1, ptr %7, align 4
  br label %92

25:                                               ; preds = %20, %15
  %26 = call i32 @ft_trig_prenorm(ptr noundef %6)
  store i32 %26, ptr %5, align 4, !tbaa !15
  %27 = load i64, ptr %4, align 8, !tbaa !9
  call void @ft_trig_pseudo_rotate(ptr noundef %6, i64 noundef %27)
  %28 = getelementptr inbounds %struct.FT_Vector_, ptr %6, i32 0, i32 0
  %29 = load i64, ptr %28, align 8, !tbaa !12
  %30 = call i64 @ft_trig_downscale(i64 noundef %29)
  %31 = getelementptr inbounds %struct.FT_Vector_, ptr %6, i32 0, i32 0
  store i64 %30, ptr %31, align 8, !tbaa !12
  %32 = getelementptr inbounds %struct.FT_Vector_, ptr %6, i32 0, i32 1
  %33 = load i64, ptr %32, align 8, !tbaa !14
  %34 = call i64 @ft_trig_downscale(i64 noundef %33)
  %35 = getelementptr inbounds %struct.FT_Vector_, ptr %6, i32 0, i32 1
  store i64 %34, ptr %35, align 8, !tbaa !14
  %36 = load i32, ptr %5, align 4, !tbaa !15
  %37 = icmp sgt i32 %36, 0
  br i1 %37, label %38, label %74

38:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  %39 = load i32, ptr %5, align 4, !tbaa !15
  %40 = sub nsw i32 %39, 1
  %41 = shl i32 1, %40
  store i32 %41, ptr %8, align 4, !tbaa !15
  %42 = getelementptr inbounds %struct.FT_Vector_, ptr %6, i32 0, i32 0
  %43 = load i64, ptr %42, align 8, !tbaa !12
  %44 = load i32, ptr %8, align 4, !tbaa !15
  %45 = sext i32 %44 to i64
  %46 = add nsw i64 %43, %45
  %47 = getelementptr inbounds %struct.FT_Vector_, ptr %6, i32 0, i32 0
  %48 = load i64, ptr %47, align 8, !tbaa !12
  %49 = icmp slt i64 %48, 0
  %50 = zext i1 %49 to i32
  %51 = sext i32 %50 to i64
  %52 = sub nsw i64 %46, %51
  %53 = load i32, ptr %5, align 4, !tbaa !15
  %54 = zext i32 %53 to i64
  %55 = ashr i64 %52, %54
  %56 = load ptr, ptr %3, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.FT_Vector_, ptr %56, i32 0, i32 0
  store i64 %55, ptr %57, align 8, !tbaa !12
  %58 = getelementptr inbounds %struct.FT_Vector_, ptr %6, i32 0, i32 1
  %59 = load i64, ptr %58, align 8, !tbaa !14
  %60 = load i32, ptr %8, align 4, !tbaa !15
  %61 = sext i32 %60 to i64
  %62 = add nsw i64 %59, %61
  %63 = getelementptr inbounds %struct.FT_Vector_, ptr %6, i32 0, i32 1
  %64 = load i64, ptr %63, align 8, !tbaa !14
  %65 = icmp slt i64 %64, 0
  %66 = zext i1 %65 to i32
  %67 = sext i32 %66 to i64
  %68 = sub nsw i64 %62, %67
  %69 = load i32, ptr %5, align 4, !tbaa !15
  %70 = zext i32 %69 to i64
  %71 = ashr i64 %68, %70
  %72 = load ptr, ptr %3, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.FT_Vector_, ptr %72, i32 0, i32 1
  store i64 %71, ptr %73, align 8, !tbaa !14
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  br label %91

74:                                               ; preds = %25
  %75 = load i32, ptr %5, align 4, !tbaa !15
  %76 = sub nsw i32 0, %75
  store i32 %76, ptr %5, align 4, !tbaa !15
  %77 = getelementptr inbounds %struct.FT_Vector_, ptr %6, i32 0, i32 0
  %78 = load i64, ptr %77, align 8, !tbaa !12
  %79 = load i32, ptr %5, align 4, !tbaa !15
  %80 = zext i32 %79 to i64
  %81 = shl i64 %78, %80
  %82 = load ptr, ptr %3, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.FT_Vector_, ptr %82, i32 0, i32 0
  store i64 %81, ptr %83, align 8, !tbaa !12
  %84 = getelementptr inbounds %struct.FT_Vector_, ptr %6, i32 0, i32 1
  %85 = load i64, ptr %84, align 8, !tbaa !14
  %86 = load i32, ptr %5, align 4, !tbaa !15
  %87 = zext i32 %86 to i64
  %88 = shl i64 %85, %87
  %89 = load ptr, ptr %3, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.FT_Vector_, ptr %89, i32 0, i32 1
  store i64 %88, ptr %90, align 8, !tbaa !14
  br label %91

91:                                               ; preds = %74, %38
  store i32 0, ptr %7, align 4
  br label %92

92:                                               ; preds = %91, %24, %14
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  %93 = load i32, ptr %7, align 4
  switch i32 %93, label %95 [
    i32 0, label %94
    i32 1, label %94
  ]

94:                                               ; preds = %92, %92
  ret void

95:                                               ; preds = %92
  unreachable
}

; Function Attrs: nounwind uwtable
declare hidden i64 @ft_trig_downscale(i64 noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{i64 0, i64 8, !9, i64 8, i64 8, !9}
!12 = !{!13, !10, i64 0}
!13 = !{!"FT_Vector_", !10, i64 0, !10, i64 8}
!14 = !{!13, !10, i64 8}
!15 = !{!16, !16, i64 0}
!16 = !{!"int", !7, i64 0}


; 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.FT_Vector_ = type { i64, i64 }

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; Function Attrs: nounwind uwtable
declare hidden void @ft_trig_pseudo_rotate(ptr noundef, i64 noundef) local_unnamed_addr #2

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

; Function Attrs: nounwind uwtable
define dso_local void @FT_Vector_Rotate(ptr noundef %0, i64 noundef %1) local_unnamed_addr #2 {
  %3 = alloca %struct.FT_Vector_, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #3
  %4 = icmp ne ptr %0, null
  %5 = icmp ne i64 %1, 0
  %or.cond = and i1 %4, %5
  br i1 %or.cond, label %6, label %38

6:                                                ; preds = %2
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(16) %0, i64 16, i1 false), !tbaa.struct !5
  %7 = load i64, ptr %3, align 8, !tbaa !10
  %8 = icmp eq i64 %7, 0
  %9 = getelementptr inbounds i8, ptr %3, i64 8
  %10 = load i64, ptr %9, align 8
  %11 = icmp eq i64 %10, 0
  %or.cond4 = select i1 %8, i1 %11, i1 false
  br i1 %or.cond4, label %38, label %12

12:                                               ; preds = %6
  %13 = call i32 @ft_trig_prenorm(ptr noundef nonnull %3)
  call void @ft_trig_pseudo_rotate(ptr noundef nonnull %3, i64 noundef %1)
  %14 = load i64, ptr %3, align 8, !tbaa !10
  %15 = call i64 @ft_trig_downscale(i64 noundef %14)
  store i64 %15, ptr %3, align 8, !tbaa !10
  %16 = load i64, ptr %9, align 8, !tbaa !12
  %17 = call i64 @ft_trig_downscale(i64 noundef %16)
  %18 = icmp sgt i32 %13, 0
  br i1 %18, label %19, label %31

19:                                               ; preds = %12
  %20 = add nsw i32 %13, -1
  %21 = shl nuw i32 1, %20
  %22 = load i64, ptr %3, align 8, !tbaa !10
  %23 = sext i32 %21 to i64
  %24 = add nsw i64 %22, %23
  %.lobit.neg = ashr i64 %22, 63
  %25 = add i64 %24, %.lobit.neg
  %26 = zext nneg i32 %13 to i64
  %27 = ashr i64 %25, %26
  store i64 %27, ptr %0, align 8, !tbaa !10
  %28 = add nsw i64 %17, %23
  %.lobit.neg22 = ashr i64 %17, 63
  %29 = add i64 %28, %.lobit.neg22
  %30 = ashr i64 %29, %26
  br label %.sink.split

31:                                               ; preds = %12
  %32 = sub nsw i32 0, %13
  %33 = load i64, ptr %3, align 8, !tbaa !10
  %34 = zext nneg i32 %32 to i64
  %35 = shl i64 %33, %34
  store i64 %35, ptr %0, align 8, !tbaa !10
  %36 = shl i64 %17, %34
  br label %.sink.split

.sink.split:                                      ; preds = %31, %19
  %.sink = phi i64 [ %30, %19 ], [ %36, %31 ]
  %37 = getelementptr inbounds i8, ptr %0, i64 8
  store i64 %.sink, ptr %37, align 8, !tbaa !12
  br label %38

38:                                               ; preds = %.sink.split, %6, %2
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #3
  ret void
}

; Function Attrs: nounwind uwtable
declare hidden i64 @ft_trig_downscale(i64 noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{i64 0, i64 8, !6, i64 8, i64 8, !6}
!6 = !{!7, !7, i64 0}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!11, !7, i64 0}
!11 = !{!"FT_Vector_", !7, i64 0, !7, i64 8}
!12 = !{!11, !7, i64 8}


; Effective O3 passes: DSEPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass