; LLVM IR from awawa-dev/HyperHDR :: sources/effects/Animation_KnightRider.ll (ZN21Animation_KnightRiderC2Ev)

; 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.Point3d = type { i8, i8, i8 }
%class.Animation_KnightRider = type <{ %class.AnimationBase.base, [3 x i8], double, double, %struct.Point3d, i8, i32, i32, i32, [75 x i8], [5 x i8] }>
%class.AnimationBase.base = type <{ ptr, i32, i8 }>

@_ZTV21Animation_KnightRider = external dso_local unnamed_addr constant { [10 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN21Animation_KnightRiderC2Ev(ptr noundef nonnull align 8 dereferenceable(123) %0) unnamed_addr #0 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca %struct.Point3d, align 1
  %4 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %5 = load ptr, ptr %2, align 8
  call void @_ZN13AnimationBaseC2Ev(ptr noundef nonnull align 8 dereferenceable(13) %5)
  store ptr getelementptr inbounds inrange(-16, 64) ({ [10 x ptr] }, ptr @_ZTV21Animation_KnightRider, i32 0, i32 0, i32 2), ptr %5, align 8, !tbaa !9
  %6 = getelementptr inbounds %class.Animation_KnightRider, ptr %5, i32 0, i32 4
  %7 = getelementptr inbounds %class.Animation_KnightRider, ptr %5, i32 0, i32 2
  store double 0.000000e+00, ptr %7, align 8, !tbaa !11
  %8 = getelementptr inbounds %class.Animation_KnightRider, ptr %5, i32 0, i32 3
  store double 0.000000e+00, ptr %8, align 8, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 3, ptr %3) #4
  %9 = getelementptr inbounds %struct.Point3d, ptr %3, i32 0, i32 0
  store i8 0, ptr %9, align 1, !tbaa !19
  %10 = getelementptr inbounds %struct.Point3d, ptr %3, i32 0, i32 1
  store i8 0, ptr %10, align 1, !tbaa !20
  %11 = getelementptr inbounds %struct.Point3d, ptr %3, i32 0, i32 2
  store i8 0, ptr %11, align 1, !tbaa !21
  %12 = getelementptr inbounds %class.Animation_KnightRider, ptr %5, i32 0, i32 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %12, ptr align 1 %3, i64 3, i1 false), !tbaa.struct !22
  call void @llvm.lifetime.end.p0(i64 3, ptr %3) #4
  %13 = getelementptr inbounds %class.Animation_KnightRider, ptr %5, i32 0, i32 6
  store i32 0, ptr %13, align 4, !tbaa !24
  %14 = getelementptr inbounds %class.Animation_KnightRider, ptr %5, i32 0, i32 7
  store i32 0, ptr %14, align 8, !tbaa !25
  %15 = getelementptr inbounds %class.Animation_KnightRider, ptr %5, i32 0, i32 8
  store i32 0, ptr %15, align 4, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 0, ptr %4, align 4, !tbaa !27
  br label %16

16:                                               ; preds = %38, %1
  %17 = load i32, ptr %4, align 4, !tbaa !27
  %18 = icmp slt i32 %17, 25
  br i1 %18, label %20, label %19

19:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %41

20:                                               ; preds = %16
  %21 = getelementptr inbounds %class.Animation_KnightRider, ptr %5, i32 0, i32 9
  %22 = load i32, ptr %4, align 4, !tbaa !27
  %23 = mul nsw i32 3, %22
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [75 x i8], ptr %21, i64 0, i64 %24
  store i8 0, ptr %25, align 1, !tbaa !23
  %26 = getelementptr inbounds %class.Animation_KnightRider, ptr %5, i32 0, i32 9
  %27 = load i32, ptr %4, align 4, !tbaa !27
  %28 = mul nsw i32 3, %27
  %29 = add nsw i32 %28, 1
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [75 x i8], ptr %26, i64 0, i64 %30
  store i8 0, ptr %31, align 1, !tbaa !23
  %32 = getelementptr inbounds %class.Animation_KnightRider, ptr %5, i32 0, i32 9
  %33 = load i32, ptr %4, align 4, !tbaa !27
  %34 = mul nsw i32 3, %33
  %35 = add nsw i32 %34, 2
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [75 x i8], ptr %32, i64 0, i64 %36
  store i8 0, ptr %37, align 1, !tbaa !23
  br label %38

38:                                               ; preds = %20
  %39 = load i32, ptr %4, align 4, !tbaa !27
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %4, align 4, !tbaa !27
  br label %16, !llvm.loop !28

41:                                               ; preds = %19
  ret void
}

declare void @_ZN13AnimationBaseC2Ev(ptr noundef nonnull align 8 dereferenceable(13)) unnamed_addr #1

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

; 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) #3

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

attributes #0 = { 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 #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !16, i64 16}
!12 = !{!"_ZTS21Animation_KnightRider", !13, i64 0, !16, i64 16, !16, i64 24, !17, i64 32, !14, i64 36, !14, i64 40, !14, i64 44, !7, i64 48}
!13 = !{!"_ZTS13AnimationBase", !14, i64 8, !15, i64 12}
!14 = !{!"int", !7, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = !{!"double", !7, i64 0}
!17 = !{!"_ZTS7Point3d", !7, i64 0, !7, i64 1, !7, i64 2}
!18 = !{!12, !16, i64 24}
!19 = !{!17, !7, i64 0}
!20 = !{!17, !7, i64 1}
!21 = !{!17, !7, i64 2}
!22 = !{i64 0, i64 1, !23, i64 1, i64 1, !23, i64 2, i64 1, !23}
!23 = !{!7, !7, i64 0}
!24 = !{!12, !14, i64 36}
!25 = !{!12, !14, i64 40}
!26 = !{!12, !14, i64 44}
!27 = !{!14, !14, i64 0}
!28 = distinct !{!28, !29}
!29 = !{!"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"

@_ZTV21Animation_KnightRider = external dso_local unnamed_addr constant { [10 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN21Animation_KnightRiderC2Ev(ptr noundef nonnull align 8 dereferenceable(123) %0) unnamed_addr #0 align 2 {
  tail call void @_ZN13AnimationBaseC2Ev(ptr noundef nonnull align 8 dereferenceable(13) %0)
  store ptr getelementptr inbounds inrange(-16, 64) (i8, ptr @_ZTV21Animation_KnightRider, i64 16), ptr %0, align 8, !tbaa !5
  %2 = getelementptr inbounds i8, ptr %0, i64 16
  %3 = getelementptr inbounds i8, ptr %0, i64 36
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(19) %2, i8 0, i64 19, i1 false)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(87) %3, i8 0, i64 87, i1 false)
  ret void
}

declare void @_ZN13AnimationBaseC2Ev(ptr noundef nonnull align 8 dereferenceable(13)) unnamed_addr #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

attributes #0 = { 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 #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 = { nocallback nofree nounwind willreturn memory(argmem: write) }

!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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopIdiomRecognizePass,LoopRotatePass,MemCpyOptPass,SROAPass,SimplifyCFGPass,TailCallElimPass