; LLVM IR from goldest-star/seawave-animation :: src/vcl/interaction/time_slider/time_slider.ll (ZN3vcl24timer_interval_reversing6updateEv)

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

%"class.vcl::timer_interval_reversing" = type <{ %"class.vcl::timer_basic", float, float, i8, [3 x i8] }>
%"class.vcl::timer_basic" = type { float, float, i8, float }

@.str = external hidden unnamed_addr constant [12 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [112 x i8], align 1
@__PRETTY_FUNCTION__._ZN3vcl24timer_interval_reversing6updateEv = external hidden unnamed_addr constant [46 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [15 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local noundef float @_ZN3vcl24timer_interval_reversing6updateEv(ptr noundef nonnull align 4 dereferenceable(25) %0) #0 align 2 {
  %2 = alloca float, align 4
  %3 = alloca ptr, align 8
  %4 = alloca float, align 4
  %5 = alloca float, align 4
  %6 = alloca float, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %7 = load ptr, ptr %3, align 8
  %8 = getelementptr inbounds %"class.vcl::timer_interval_reversing", ptr %7, i32 0, i32 1
  %9 = load float, ptr %8, align 4, !tbaa !9
  %10 = getelementptr inbounds %"class.vcl::timer_interval_reversing", ptr %7, i32 0, i32 2
  %11 = load float, ptr %10, align 4, !tbaa !14
  %12 = fcmp olt float %9, %11
  br i1 %12, label %13, label %14

13:                                               ; preds = %1
  br label %16

14:                                               ; preds = %1
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 16, ptr noundef @__PRETTY_FUNCTION__._ZN3vcl24timer_interval_reversing6updateEv) #5
  unreachable

15:                                               ; No predecessors!
  br label %16

16:                                               ; preds = %15, %13
  %17 = getelementptr inbounds %"class.vcl::timer_basic", ptr %7, i32 0, i32 2
  %18 = load i8, ptr %17, align 4, !tbaa !15, !range !16, !noundef !17
  %19 = trunc i8 %18 to i1
  br i1 %19, label %21, label %20

20:                                               ; preds = %16
  store float 0.000000e+00, ptr %2, align 4
  br label %89

21:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  %22 = call double @glfwGetTime()
  %23 = fptrunc double %22 to float
  store float %23, ptr %4, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %24 = getelementptr inbounds %"class.vcl::timer_basic", ptr %7, i32 0, i32 1
  %25 = load float, ptr %24, align 4, !tbaa !19
  %26 = load float, ptr %4, align 4, !tbaa !18
  %27 = getelementptr inbounds %"class.vcl::timer_basic", ptr %7, i32 0, i32 3
  %28 = load float, ptr %27, align 4, !tbaa !20
  %29 = fsub float %26, %28
  %30 = fmul float %25, %29
  store float %30, ptr %5, align 4, !tbaa !18
  %31 = load float, ptr %5, align 4, !tbaa !18
  %32 = getelementptr inbounds %"class.vcl::timer_interval_reversing", ptr %7, i32 0, i32 2
  %33 = load float, ptr %32, align 4, !tbaa !14
  %34 = getelementptr inbounds %"class.vcl::timer_interval_reversing", ptr %7, i32 0, i32 1
  %35 = load float, ptr %34, align 4, !tbaa !9
  %36 = fsub float %33, %35
  %37 = fcmp olt float %31, %36
  br i1 %37, label %38, label %39

38:                                               ; preds = %21
  br label %41

39:                                               ; preds = %21
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 23, ptr noundef @__PRETTY_FUNCTION__._ZN3vcl24timer_interval_reversing6updateEv) #5
  unreachable

40:                                               ; No predecessors!
  br label %41

41:                                               ; preds = %40, %38
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %42 = getelementptr inbounds %"class.vcl::timer_interval_reversing", ptr %7, i32 0, i32 3
  %43 = load i8, ptr %42, align 4, !tbaa !21, !range !16, !noundef !17
  %44 = trunc i8 %43 to i1
  %45 = zext i1 %44 to i32
  %46 = icmp eq i32 %45, 1
  %47 = zext i1 %46 to i64
  %48 = select i1 %46, float 1.000000e+00, float -1.000000e+00
  store float %48, ptr %6, align 4, !tbaa !18
  %49 = load float, ptr %4, align 4, !tbaa !18
  %50 = getelementptr inbounds %"class.vcl::timer_basic", ptr %7, i32 0, i32 3
  store float %49, ptr %50, align 4, !tbaa !20
  %51 = getelementptr inbounds %"class.vcl::timer_basic", ptr %7, i32 0, i32 0
  %52 = load float, ptr %51, align 4, !tbaa !22
  %53 = load float, ptr %6, align 4, !tbaa !18
  %54 = load float, ptr %5, align 4, !tbaa !18
  %55 = call float @llvm.fmuladd.f32(float %53, float %54, float %52)
  %56 = getelementptr inbounds %"class.vcl::timer_basic", ptr %7, i32 0, i32 0
  store float %55, ptr %56, align 4, !tbaa !22
  %57 = getelementptr inbounds %"class.vcl::timer_basic", ptr %7, i32 0, i32 0
  %58 = load float, ptr %57, align 4, !tbaa !22
  %59 = getelementptr inbounds %"class.vcl::timer_interval_reversing", ptr %7, i32 0, i32 2
  %60 = load float, ptr %59, align 4, !tbaa !14
  %61 = fcmp oge float %58, %60
  br i1 %61, label %62, label %71

62:                                               ; preds = %41
  %63 = getelementptr inbounds %"class.vcl::timer_interval_reversing", ptr %7, i32 0, i32 2
  %64 = load float, ptr %63, align 4, !tbaa !14
  %65 = getelementptr inbounds %"class.vcl::timer_basic", ptr %7, i32 0, i32 0
  %66 = load float, ptr %65, align 4, !tbaa !22
  %67 = fneg float %66
  %68 = call float @llvm.fmuladd.f32(float 2.000000e+00, float %64, float %67)
  %69 = getelementptr inbounds %"class.vcl::timer_basic", ptr %7, i32 0, i32 0
  store float %68, ptr %69, align 4, !tbaa !22
  %70 = getelementptr inbounds %"class.vcl::timer_interval_reversing", ptr %7, i32 0, i32 3
  store i8 0, ptr %70, align 4, !tbaa !21
  br label %87

71:                                               ; preds = %41
  %72 = getelementptr inbounds %"class.vcl::timer_basic", ptr %7, i32 0, i32 0
  %73 = load float, ptr %72, align 4, !tbaa !22
  %74 = getelementptr inbounds %"class.vcl::timer_interval_reversing", ptr %7, i32 0, i32 1
  %75 = load float, ptr %74, align 4, !tbaa !9
  %76 = fcmp olt float %73, %75
  br i1 %76, label %77, label %86

77:                                               ; preds = %71
  %78 = getelementptr inbounds %"class.vcl::timer_interval_reversing", ptr %7, i32 0, i32 1
  %79 = load float, ptr %78, align 4, !tbaa !9
  %80 = getelementptr inbounds %"class.vcl::timer_basic", ptr %7, i32 0, i32 0
  %81 = load float, ptr %80, align 4, !tbaa !22
  %82 = fneg float %81
  %83 = call float @llvm.fmuladd.f32(float 2.000000e+00, float %79, float %82)
  %84 = getelementptr inbounds %"class.vcl::timer_basic", ptr %7, i32 0, i32 0
  store float %83, ptr %84, align 4, !tbaa !22
  %85 = getelementptr inbounds %"class.vcl::timer_interval_reversing", ptr %7, i32 0, i32 3
  store i8 1, ptr %85, align 4, !tbaa !21
  br label %86

86:                                               ; preds = %77, %71
  br label %87

87:                                               ; preds = %86, %62
  %88 = load float, ptr %5, align 4, !tbaa !18
  store float %88, ptr %2, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %89

89:                                               ; preds = %87, %20
  %90 = load float, ptr %2, align 4
  ret float %90
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

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

declare double @glfwGetTime() #3

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #4

; 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 = { noreturn nounwind "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 = { "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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { noreturn nounwind }
attributes #6 = { 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, !12, i64 16}
!10 = !{!"_ZTSN3vcl24timer_interval_reversingE", !11, i64 0, !12, i64 16, !12, i64 20, !13, i64 24}
!11 = !{!"_ZTSN3vcl11timer_basicE", !12, i64 0, !12, i64 4, !13, i64 8, !12, i64 12}
!12 = !{!"float", !7, i64 0}
!13 = !{!"bool", !7, i64 0}
!14 = !{!10, !12, i64 20}
!15 = !{!11, !13, i64 8}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = !{!12, !12, i64 0}
!19 = !{!11, !12, i64 4}
!20 = !{!11, !12, i64 12}
!21 = !{!10, !13, i64 24}
!22 = !{!11, !12, 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"

@.str = external hidden unnamed_addr constant [12 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [112 x i8], align 1
@__PRETTY_FUNCTION__._ZN3vcl24timer_interval_reversing6updateEv = external hidden unnamed_addr constant [46 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [15 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local noundef float @_ZN3vcl24timer_interval_reversing6updateEv(ptr nocapture noundef nonnull align 4 dereferenceable(25) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 16
  %3 = load float, ptr %2, align 4, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 20
  %5 = load float, ptr %4, align 4, !tbaa !12
  %6 = fcmp olt float %3, %5
  br i1 %6, label %8, label %7

7:                                                ; preds = %1
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 16, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN3vcl24timer_interval_reversing6updateEv) #4
  unreachable

8:                                                ; preds = %1
  %9 = getelementptr inbounds i8, ptr %0, i64 8
  %10 = load i8, ptr %9, align 4, !tbaa !13, !range !14, !noundef !15
  %11 = trunc nuw i8 %10 to i1
  br i1 %11, label %12, label %38

12:                                               ; preds = %8
  %13 = tail call double @glfwGetTime()
  %14 = fptrunc double %13 to float
  %15 = getelementptr inbounds i8, ptr %0, i64 4
  %16 = load float, ptr %15, align 4, !tbaa !16
  %17 = getelementptr inbounds i8, ptr %0, i64 12
  %18 = load float, ptr %17, align 4, !tbaa !17
  %19 = fsub float %14, %18
  %20 = fmul float %16, %19
  %21 = load float, ptr %4, align 4, !tbaa !12
  %22 = load float, ptr %2, align 4, !tbaa !5
  %23 = fsub float %21, %22
  %24 = fcmp olt float %20, %23
  br i1 %24, label %26, label %25

25:                                               ; preds = %12
  tail call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 23, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN3vcl24timer_interval_reversing6updateEv) #4
  unreachable

26:                                               ; preds = %12
  %27 = getelementptr inbounds i8, ptr %0, i64 24
  %28 = load i8, ptr %27, align 4, !tbaa !18, !range !14, !noundef !15
  %29 = trunc nuw i8 %28 to i1
  %30 = select i1 %29, float 1.000000e+00, float -1.000000e+00
  store float %14, ptr %17, align 4, !tbaa !17
  %31 = load float, ptr %0, align 4, !tbaa !19
  %32 = tail call float @llvm.fmuladd.f32(float %30, float %20, float %31)
  store float %32, ptr %0, align 4, !tbaa !19
  %33 = fcmp ult float %32, %21
  br i1 %33, label %34, label %.sink.split

34:                                               ; preds = %26
  %35 = fcmp olt float %32, %22
  br i1 %35, label %.sink.split, label %38

.sink.split:                                      ; preds = %34, %26
  %.sink13 = phi float [ %21, %26 ], [ %22, %34 ]
  %.sink = phi i8 [ 0, %26 ], [ 1, %34 ]
  %36 = fneg float %32
  %37 = tail call float @llvm.fmuladd.f32(float %.sink13, float 2.000000e+00, float %36)
  store float %37, ptr %0, align 4, !tbaa !19
  store i8 %.sink, ptr %27, align 4, !tbaa !18
  br label %38

38:                                               ; preds = %.sink.split, %34, %8
  %.0 = phi float [ 0.000000e+00, %8 ], [ %20, %34 ], [ %20, %.sink.split ]
  ret float %.0
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

declare double @glfwGetTime() local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #3

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 = { noreturn nounwind "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 = { "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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { noreturn 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, !8, i64 16}
!6 = !{!"_ZTSN3vcl24timer_interval_reversingE", !7, i64 0, !8, i64 16, !8, i64 20, !11, i64 24}
!7 = !{!"_ZTSN3vcl11timer_basicE", !8, i64 0, !8, i64 4, !11, i64 8, !8, i64 12}
!8 = !{!"float", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"bool", !9, i64 0}
!12 = !{!6, !8, i64 20}
!13 = !{!7, !11, i64 8}
!14 = !{i8 0, i8 2}
!15 = !{}
!16 = !{!7, !8, i64 4}
!17 = !{!7, !8, i64 12}
!18 = !{!6, !11, i64 24}
!19 = !{!7, !8, i64 0}


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