; LLVM IR from facebookresearch/habitat-sim :: src/deps/basis-universal/encoder (basisu_enc)

; 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.basisu::interval_timer" = type <{ i64, i64, i8, i8, [6 x i8] }>

@_ZN6basisu14interval_timer12g_timer_freqE = external dso_local global double, align 8
@.str.3 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [110 x i8], align 1
@__PRETTY_FUNCTION__._ZNK6basisu14interval_timer16get_elapsed_secsEv = external hidden unnamed_addr constant [56 x i8], align 1

; 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: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN6basisu13query_counterEPm(ptr noundef) #1

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

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_ZNK6basisu14interval_timer16get_elapsed_secsEv(ptr noundef nonnull align 8 dereferenceable(18) %0) #3 align 2 {
  %2 = alloca double, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %6 = load ptr, ptr %3, align 8
  %7 = getelementptr inbounds %"class.basisu::interval_timer", ptr %6, i32 0, i32 2
  %8 = load i8, ptr %7, align 8, !tbaa !9, !range !13, !noundef !14
  %9 = trunc i8 %8 to i1
  br i1 %9, label %10, label %11

10:                                               ; preds = %1
  br label %13

11:                                               ; preds = %1
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.4, i32 noundef 248, ptr noundef @__PRETTY_FUNCTION__._ZNK6basisu14interval_timer16get_elapsed_secsEv) #4
  unreachable

12:                                               ; No predecessors!
  br label %13

13:                                               ; preds = %12, %10
  %14 = getelementptr inbounds %"class.basisu::interval_timer", ptr %6, i32 0, i32 2
  %15 = load i8, ptr %14, align 8, !tbaa !9, !range !13, !noundef !14
  %16 = trunc i8 %15 to i1
  br i1 %16, label %18, label %17

17:                                               ; preds = %13
  store double 0.000000e+00, ptr %2, align 8
  br label %34

18:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  %19 = getelementptr inbounds %"class.basisu::interval_timer", ptr %6, i32 0, i32 1
  %20 = load i64, ptr %19, align 8, !tbaa !15
  store i64 %20, ptr %4, align 8, !tbaa !16
  %21 = getelementptr inbounds %"class.basisu::interval_timer", ptr %6, i32 0, i32 3
  %22 = load i8, ptr %21, align 1, !tbaa !17, !range !13, !noundef !14
  %23 = trunc i8 %22 to i1
  br i1 %23, label %25, label %24

24:                                               ; preds = %18
  call void @_ZN6basisu13query_counterEPm(ptr noundef %4)
  br label %25

25:                                               ; preds = %24, %18
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  %26 = load i64, ptr %4, align 8, !tbaa !16
  %27 = getelementptr inbounds %"class.basisu::interval_timer", ptr %6, i32 0, i32 0
  %28 = load i64, ptr %27, align 8, !tbaa !18
  %29 = sub i64 %26, %28
  store i64 %29, ptr %5, align 8, !tbaa !16
  %30 = load i64, ptr %5, align 8, !tbaa !16
  %31 = uitofp i64 %30 to double
  %32 = load double, ptr @_ZN6basisu14interval_timer12g_timer_freqE, align 8, !tbaa !19
  %33 = fmul double %31, %32
  store double %33, ptr %2, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  br label %34

34:                                               ; preds = %25, %17
  %35 = load double, ptr %2, align 8
  ret double %35
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint mustprogress 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 = { 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 #3 = { 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 #4 = { noreturn nounwind }
attributes #5 = { 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 = !{!"_ZTSN6basisu14interval_timerE", !11, i64 0, !11, i64 8, !12, i64 16, !12, i64 17}
!11 = !{!"long", !7, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!10, !11, i64 8}
!16 = !{!11, !11, i64 0}
!17 = !{!10, !12, i64 17}
!18 = !{!10, !11, i64 0}
!19 = !{!20, !20, i64 0}
!20 = !{!"double", !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"

@_ZN6basisu14interval_timer12g_timer_freqE = external dso_local local_unnamed_addr global double, align 8
@.str.3 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [110 x i8], align 1
@__PRETTY_FUNCTION__._ZNK6basisu14interval_timer16get_elapsed_secsEv = external hidden unnamed_addr constant [56 x i8], align 1

; 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: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN6basisu13query_counterEPm(ptr noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef double @_ZNK6basisu14interval_timer16get_elapsed_secsEv(ptr nocapture noundef nonnull readonly align 8 dereferenceable(18) %0) local_unnamed_addr #3 align 2 {
  %2 = alloca i64, align 8
  %3 = getelementptr inbounds i8, ptr %0, i64 16
  %4 = load i8, ptr %3, align 8, !tbaa !5, !range !11, !noundef !12
  %5 = trunc nuw i8 %4 to i1
  br i1 %5, label %7, label %6

6:                                                ; preds = %1
  tail call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.4, i32 noundef 248, ptr noundef nonnull @__PRETTY_FUNCTION__._ZNK6basisu14interval_timer16get_elapsed_secsEv) #4
  unreachable

7:                                                ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #5
  %8 = getelementptr inbounds i8, ptr %0, i64 8
  %9 = load i64, ptr %8, align 8, !tbaa !13
  store i64 %9, ptr %2, align 8, !tbaa !14
  %10 = getelementptr inbounds i8, ptr %0, i64 17
  %11 = load i8, ptr %10, align 1, !tbaa !15, !range !11, !noundef !12
  %12 = trunc nuw i8 %11 to i1
  br i1 %12, label %14, label %13

13:                                               ; preds = %7
  call void @_ZN6basisu13query_counterEPm(ptr noundef nonnull %2)
  %.pre = load i64, ptr %2, align 8, !tbaa !14
  br label %14

14:                                               ; preds = %13, %7
  %15 = phi i64 [ %.pre, %13 ], [ %9, %7 ]
  %16 = load i64, ptr %0, align 8, !tbaa !16
  %17 = load double, ptr @_ZN6basisu14interval_timer12g_timer_freqE, align 8, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  %18 = sub i64 %15, %16
  %19 = uitofp i64 %18 to double
  %20 = fmul double %17, %19
  ret double %20
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint mustprogress 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 = { 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 #3 = { mustprogress 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 #4 = { noreturn nounwind }
attributes #5 = { 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, !10, i64 16}
!6 = !{!"_ZTSN6basisu14interval_timerE", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 17}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"bool", !8, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = !{!6, !7, i64 8}
!14 = !{!7, !7, i64 0}
!15 = !{!6, !10, i64 17}
!16 = !{!6, !7, i64 0}
!17 = !{!18, !18, i64 0}
!18 = !{!"double", !8, i64 0}


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