; LLVM IR from NTHU-LSALAB/Gemini :: src/hook.ll (Z17wait_cuda_kernelsPv)

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

%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%union.pthread_cond_t = type { %struct.__pthread_cond_s }
%struct.__pthread_cond_s = type { %union.__atomic_wide_counter, %union.__atomic_wide_counter, [2 x i32], [2 x i32], i32, i32, [2 x i32] }
%union.__atomic_wide_counter = type { i64 }
%struct.timespec = type { i64, i64 }

@quota_time = external dso_local global [8 x double], align 16
@overuse = external dso_local global [8 x double], align 16
@cuevent_start = external dso_local global [8 x ptr], align 16
@overuse_trk_mutex = external dso_local global %union.pthread_mutex_t, align 8
@overuse_trk_strt_cond = external dso_local global %union.pthread_cond_t, align 8
@overuse_trk_cmpl_cond = external dso_local global %union.pthread_cond_t, align 8
@overuse_trk_intr_cond = external dso_local global %union.pthread_cond_t, align 8
@overuse_trk_cmpl = external dso_local global i8, align 1
@.str.48 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.49 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.50 = external hidden unnamed_addr constant [17 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: nounwind
declare i32 @clock_gettime(i32 noundef, ptr noundef) #1

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z21get_current_device_idv() #2

declare void @_Z5DEBUGPKcz(ptr noundef, ...) #3

; Function Attrs: nounwind
declare i32 @pthread_mutex_lock(ptr noundef) #1

; Function Attrs: nounwind
declare i32 @pthread_mutex_unlock(ptr noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z14host_sync_callPKc(ptr noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_Z17wait_cuda_kernelsPv(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca %struct.timespec, align 8
  %4 = alloca double, align 8
  %5 = alloca i32, align 4
  %6 = alloca double, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca float, align 4
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  br label %12

12:                                               ; preds = %58, %1
  br label %13

13:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %14 = call noundef i32 @_Z21get_current_device_idv()
  store i32 %14, ptr %5, align 4, !tbaa !9
  %15 = call i32 @pthread_mutex_lock(ptr noundef @overuse_trk_mutex) #6
  %16 = call i32 @pthread_cond_wait(ptr noundef @overuse_trk_strt_cond, ptr noundef @overuse_trk_mutex)
  %17 = call i32 @pthread_mutex_unlock(ptr noundef @overuse_trk_mutex) #6
  %18 = load i32, ptr %5, align 4, !tbaa !9
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [8 x double], ptr @quota_time, i64 0, i64 %19
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  store double 0.000000e+00, ptr %6, align 8, !tbaa !11
  %21 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %20, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %22 = load double, ptr %21, align 8, !tbaa !11
  %23 = fmul double %22, 1.000000e+06
  store double %23, ptr %4, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  %24 = call i32 @clock_gettime(i32 noundef 1, ptr noundef %3) #6
  %25 = load double, ptr %4, align 8, !tbaa !11
  %26 = fdiv double %25, 1.000000e+09
  %27 = call double @llvm.floor.f64(double %26)
  %28 = getelementptr inbounds %struct.timespec, ptr %3, i32 0, i32 0
  %29 = load i64, ptr %28, align 8, !tbaa !13
  %30 = sitofp i64 %29 to double
  %31 = fadd double %30, %27
  %32 = fptosi double %31 to i64
  store i64 %32, ptr %28, align 8, !tbaa !13
  %33 = load double, ptr %4, align 8, !tbaa !11
  %34 = load double, ptr %4, align 8, !tbaa !11
  %35 = fdiv double %34, 1.000000e+09
  %36 = call double @llvm.floor.f64(double %35)
  %37 = fneg double %36
  %38 = call double @llvm.fmuladd.f64(double %37, double 1.000000e+09, double %33)
  %39 = getelementptr inbounds %struct.timespec, ptr %3, i32 0, i32 1
  %40 = load i64, ptr %39, align 8, !tbaa !16
  %41 = sitofp i64 %40 to double
  %42 = fadd double %41, %38
  %43 = fptosi double %42 to i64
  store i64 %43, ptr %39, align 8, !tbaa !16
  %44 = getelementptr inbounds %struct.timespec, ptr %3, i32 0, i32 1
  %45 = load i64, ptr %44, align 8, !tbaa !16
  %46 = sdiv i64 %45, 1000000000
  %47 = getelementptr inbounds %struct.timespec, ptr %3, i32 0, i32 0
  %48 = load i64, ptr %47, align 8, !tbaa !13
  %49 = add nsw i64 %48, %46
  store i64 %49, ptr %47, align 8, !tbaa !13
  %50 = getelementptr inbounds %struct.timespec, ptr %3, i32 0, i32 1
  %51 = load i64, ptr %50, align 8, !tbaa !16
  %52 = srem i64 %51, 1000000000
  store i64 %52, ptr %50, align 8, !tbaa !16
  %53 = call i32 @pthread_mutex_lock(ptr noundef @overuse_trk_mutex) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %54 = call i32 @pthread_cond_timedwait(ptr noundef @overuse_trk_intr_cond, ptr noundef @overuse_trk_mutex, ptr noundef %3)
  store i32 %54, ptr %7, align 4, !tbaa !9
  %55 = load i32, ptr %7, align 4, !tbaa !9
  %56 = icmp ne i32 %55, 110
  br i1 %56, label %57, label %58

57:                                               ; preds = %13
  call void (ptr, ...) @_Z5DEBUGPKcz(ptr noundef @.str.48)
  br label %58

58:                                               ; preds = %57, %13
  %59 = call i32 @pthread_mutex_unlock(ptr noundef @overuse_trk_mutex) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %60 = call i32 @cudaEventCreate(ptr noundef %8)
  %61 = load ptr, ptr %8, align 8, !tbaa !5
  %62 = call i32 @cudaEventRecord(ptr noundef %61, ptr noundef null)
  %63 = load ptr, ptr %8, align 8, !tbaa !5
  %64 = call i32 @cudaEventSynchronize(ptr noundef %63)
  call void @_Z14host_sync_callPKc(ptr noundef @.str.49)
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %65 = load i32, ptr %5, align 4, !tbaa !9
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [8 x ptr], ptr @cuevent_start, i64 0, i64 %66
  %68 = load ptr, ptr %67, align 8, !tbaa !5
  %69 = load ptr, ptr %8, align 8, !tbaa !5
  %70 = call i32 @cudaEventElapsedTime(ptr noundef %9, ptr noundef %68, ptr noundef %69)
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  store double 0.000000e+00, ptr %10, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %71 = load float, ptr %9, align 4, !tbaa !17
  %72 = fpext float %71 to double
  %73 = load i32, ptr %5, align 4, !tbaa !9
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [8 x double], ptr @quota_time, i64 0, i64 %74
  %76 = load double, ptr %75, align 8, !tbaa !11
  %77 = fsub double %72, %76
  store double %77, ptr %11, align 8, !tbaa !11
  %78 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %11)
  %79 = load double, ptr %78, align 8, !tbaa !11
  %80 = load i32, ptr %5, align 4, !tbaa !9
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [8 x double], ptr @overuse, i64 0, i64 %81
  store double %79, ptr %82, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  %83 = load i32, ptr %5, align 4, !tbaa !9
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [8 x double], ptr @overuse, i64 0, i64 %84
  %86 = load double, ptr %85, align 8, !tbaa !11
  call void (ptr, ...) @_Z5DEBUGPKcz(ptr noundef @.str.50, double noundef %86)
  %87 = call i32 @pthread_mutex_lock(ptr noundef @overuse_trk_mutex) #6
  store i8 1, ptr @overuse_trk_cmpl, align 1, !tbaa !19
  %88 = call i32 @pthread_cond_broadcast(ptr noundef @overuse_trk_cmpl_cond) #6
  %89 = call i32 @pthread_mutex_unlock(ptr noundef @overuse_trk_mutex) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %12, !llvm.loop !21
}

declare i32 @pthread_cond_wait(ptr noundef, ptr noundef) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.floor.f64(double) #5

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #5

declare i32 @pthread_cond_timedwait(ptr noundef, ptr noundef, ptr noundef) #3

declare i32 @cudaEventCreate(ptr noundef) #3

declare i32 @cudaEventRecord(ptr noundef, ptr noundef) #3

declare i32 @cudaEventSynchronize(ptr noundef) #3

declare i32 @cudaEventElapsedTime(ptr noundef, ptr noundef, ptr noundef) #3

; Function Attrs: nounwind
declare i32 @pthread_cond_broadcast(ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { 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 #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 = { 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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !15, i64 0}
!14 = !{!"_ZTS8timespec", !15, i64 0, !15, i64 8}
!15 = !{!"long", !7, i64 0}
!16 = !{!14, !15, i64 8}
!17 = !{!18, !18, i64 0}
!18 = !{!"float", !7, i64 0}
!19 = !{!20, !20, i64 0}
!20 = !{!"bool", !7, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"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"

%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%union.pthread_cond_t = type { %struct.__pthread_cond_s }
%struct.__pthread_cond_s = type { %union.__atomic_wide_counter, %union.__atomic_wide_counter, [2 x i32], [2 x i32], i32, i32, [2 x i32] }
%union.__atomic_wide_counter = type { i64 }
%struct.timespec = type { i64, i64 }

@quota_time = external dso_local global [8 x double], align 16
@overuse = external dso_local local_unnamed_addr global [8 x double], align 16
@cuevent_start = external dso_local local_unnamed_addr global [8 x ptr], align 16
@overuse_trk_mutex = external dso_local global %union.pthread_mutex_t, align 8
@overuse_trk_strt_cond = external dso_local global %union.pthread_cond_t, align 8
@overuse_trk_cmpl_cond = external dso_local global %union.pthread_cond_t, align 8
@overuse_trk_intr_cond = external dso_local global %union.pthread_cond_t, align 8
@overuse_trk_cmpl = external dso_local local_unnamed_addr global i8, align 1
@.str.48 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.49 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.50 = external hidden unnamed_addr constant [17 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: nounwind
declare i32 @clock_gettime(i32 noundef, ptr noundef) local_unnamed_addr #1

; 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 uwtable
declare dso_local noundef i32 @_Z21get_current_device_idv() local_unnamed_addr #2

declare void @_Z5DEBUGPKcz(ptr noundef, ...) local_unnamed_addr #3

; Function Attrs: nounwind
declare i32 @pthread_mutex_lock(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind
declare i32 @pthread_mutex_unlock(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z14host_sync_callPKc(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress noreturn uwtable
define dso_local noalias noundef nonnull ptr @_Z17wait_cuda_kernelsPv(ptr nocapture noundef readnone %0) local_unnamed_addr #4 {
  %2 = alloca %struct.timespec, align 8
  %3 = alloca double, align 8
  %4 = alloca ptr, align 8
  %5 = alloca float, align 4
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #7
  %8 = getelementptr inbounds i8, ptr %2, i64 8
  br label %9

9:                                                ; preds = %38, %1
  %10 = call noundef i32 @_Z21get_current_device_idv()
  %11 = call i32 @pthread_mutex_lock(ptr noundef nonnull @overuse_trk_mutex) #7
  %12 = call i32 @pthread_cond_wait(ptr noundef nonnull @overuse_trk_strt_cond, ptr noundef nonnull @overuse_trk_mutex)
  %13 = call i32 @pthread_mutex_unlock(ptr noundef nonnull @overuse_trk_mutex) #7
  %14 = sext i32 %10 to i64
  %15 = getelementptr inbounds [8 x double], ptr @quota_time, i64 0, i64 %14
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  store double 0.000000e+00, ptr %3, align 8, !tbaa !5
  %16 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %15, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %17 = load double, ptr %16, align 8, !tbaa !5
  %18 = fmul double %17, 1.000000e+06
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  %19 = call i32 @clock_gettime(i32 noundef 1, ptr noundef nonnull %2) #7
  %20 = fdiv double %18, 1.000000e+09
  %21 = call double @llvm.floor.f64(double %20)
  %22 = load i64, ptr %2, align 8, !tbaa !9
  %23 = sitofp i64 %22 to double
  %24 = fadd double %21, %23
  %25 = fptosi double %24 to i64
  %26 = fneg double %21
  %27 = call double @llvm.fmuladd.f64(double %26, double 1.000000e+09, double %18)
  %28 = load i64, ptr %8, align 8, !tbaa !12
  %29 = sitofp i64 %28 to double
  %30 = fadd double %27, %29
  %31 = fptosi double %30 to i64
  %32 = sdiv i64 %31, 1000000000
  %33 = add nsw i64 %32, %25
  store i64 %33, ptr %2, align 8, !tbaa !9
  %34 = srem i64 %31, 1000000000
  store i64 %34, ptr %8, align 8, !tbaa !12
  %35 = call i32 @pthread_mutex_lock(ptr noundef nonnull @overuse_trk_mutex) #7
  %36 = call i32 @pthread_cond_timedwait(ptr noundef nonnull @overuse_trk_intr_cond, ptr noundef nonnull @overuse_trk_mutex, ptr noundef nonnull %2)
  %.not = icmp eq i32 %36, 110
  br i1 %.not, label %38, label %37

37:                                               ; preds = %9
  call void (ptr, ...) @_Z5DEBUGPKcz(ptr noundef nonnull @.str.48)
  br label %38

38:                                               ; preds = %37, %9
  %39 = call i32 @pthread_mutex_unlock(ptr noundef nonnull @overuse_trk_mutex) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %40 = call i32 @cudaEventCreate(ptr noundef nonnull %4)
  %41 = load ptr, ptr %4, align 8, !tbaa !13
  %42 = call i32 @cudaEventRecord(ptr noundef %41, ptr noundef null)
  %43 = load ptr, ptr %4, align 8, !tbaa !13
  %44 = call i32 @cudaEventSynchronize(ptr noundef %43)
  call void @_Z14host_sync_callPKc(ptr noundef nonnull @.str.49)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #7
  %45 = getelementptr inbounds [8 x ptr], ptr @cuevent_start, i64 0, i64 %14
  %46 = load ptr, ptr %45, align 8, !tbaa !13
  %47 = load ptr, ptr %4, align 8, !tbaa !13
  %48 = call i32 @cudaEventElapsedTime(ptr noundef nonnull %5, ptr noundef %46, ptr noundef %47)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #7
  store double 0.000000e+00, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #7
  %49 = load float, ptr %5, align 4, !tbaa !15
  %50 = fpext float %49 to double
  %51 = load double, ptr %15, align 8, !tbaa !5
  %52 = fsub double %50, %51
  store double %52, ptr %7, align 8, !tbaa !5
  %53 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %54 = load double, ptr %53, align 8, !tbaa !5
  %55 = getelementptr inbounds [8 x double], ptr @overuse, i64 0, i64 %14
  store double %54, ptr %55, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  call void (ptr, ...) @_Z5DEBUGPKcz(ptr noundef nonnull @.str.50, double noundef %54)
  %56 = call i32 @pthread_mutex_lock(ptr noundef nonnull @overuse_trk_mutex) #7
  store i8 1, ptr @overuse_trk_cmpl, align 1, !tbaa !17
  %57 = call i32 @pthread_cond_broadcast(ptr noundef nonnull @overuse_trk_cmpl_cond) #7
  %58 = call i32 @pthread_mutex_unlock(ptr noundef nonnull @overuse_trk_mutex) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  br label %9, !llvm.loop !19
}

declare i32 @pthread_cond_wait(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.floor.f64(double) #6

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #6

declare i32 @pthread_cond_timedwait(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare i32 @cudaEventCreate(ptr noundef) local_unnamed_addr #3

declare i32 @cudaEventRecord(ptr noundef, ptr noundef) local_unnamed_addr #3

declare i32 @cudaEventSynchronize(ptr noundef) local_unnamed_addr #3

declare i32 @cudaEventElapsedTime(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind
declare i32 @pthread_cond_broadcast(ptr noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { 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 #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 = { mustprogress noreturn 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 #5 = { 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 #6 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"_ZTS8timespec", !11, i64 0, !11, i64 8}
!11 = !{!"long", !7, i64 0}
!12 = !{!10, !11, i64 8}
!13 = !{!14, !14, i64 0}
!14 = !{!"any pointer", !7, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"float", !7, i64 0}
!17 = !{!18, !18, i64 0}
!18 = !{!"bool", !7, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: DSEPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass