; LLVM IR from ekoontz/graphlab :: src/graphlab/util/timer.ll (ZN8graphlab12alarm_wakeupEi)

; 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.graphlab::hundredms_timer" = type <{ i64, %"class.graphlab::timer", %struct.itimerval, i8, [7 x i8] }>
%"class.graphlab::timer" = type { %struct.timeval }
%struct.timeval = type { i64, i64 }
%struct.itimerval = type { %struct.timeval, %struct.timeval }

@_ZN8graphlab8hmstimerE = external dso_local global %"class.graphlab::hundredms_timer", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK8graphlab5timer12current_timeEv(ptr noundef nonnull align 8 dereferenceable(16)) #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8graphlab12alarm_wakeupEi(i32 noundef %0) #1 {
  %2 = alloca i32, align 4
  %3 = alloca double, align 8
  store i32 %0, ptr %2, align 4, !tbaa !5
  %4 = load i8, ptr getelementptr inbounds (%"class.graphlab::hundredms_timer", ptr @_ZN8graphlab8hmstimerE, i32 0, i32 3), align 8, !tbaa !9, !range !16, !noundef !17
  %5 = trunc i8 %4 to i1
  br i1 %5, label %6, label %7

6:                                                ; preds = %1
  br label %22

7:                                                ; preds = %1
  %8 = call ptr @signal(i32 noundef 14, ptr noundef @_ZN8graphlab12alarm_wakeupEi) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %9 = call noundef double @_ZNK8graphlab5timer12current_timeEv(ptr noundef nonnull align 8 dereferenceable(16) getelementptr inbounds (%"class.graphlab::hundredms_timer", ptr @_ZN8graphlab8hmstimerE, i32 0, i32 1))
  store double %9, ptr %3, align 8, !tbaa !18
  %10 = load double, ptr %3, align 8, !tbaa !18
  %11 = fmul double %10, 1.000000e+01
  %12 = fptoui double %11 to i64
  store i64 %12, ptr @_ZN8graphlab8hmstimerE, align 8, !tbaa !20
  %13 = load i64, ptr @_ZN8graphlab8hmstimerE, align 8, !tbaa !20
  %14 = add i64 %13, 1
  %15 = mul i64 %14, 100000
  %16 = uitofp i64 %15 to double
  %17 = load double, ptr %3, align 8, !tbaa !18
  %18 = fneg double %17
  %19 = call double @llvm.fmuladd.f64(double %18, double 1.000000e+06, double %16)
  %20 = fptosi double %19 to i64
  store i64 %20, ptr getelementptr inbounds (%struct.timeval, ptr getelementptr inbounds (%struct.itimerval, ptr getelementptr inbounds (%"class.graphlab::hundredms_timer", ptr @_ZN8graphlab8hmstimerE, i32 0, i32 2), i32 0, i32 1), i32 0, i32 1), align 8, !tbaa !21
  %21 = call i32 @setitimer(i32 noundef 0, ptr noundef getelementptr inbounds (%"class.graphlab::hundredms_timer", ptr @_ZN8graphlab8hmstimerE, i32 0, i32 2), ptr noundef null) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  br label %22

22:                                               ; preds = %7, %6
  ret void
}

; Function Attrs: nounwind
declare ptr @signal(i32 noundef, ptr noundef) #2

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

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

; Function Attrs: nounwind
declare i32 @setitimer(i32 noundef, ptr noundef, ptr noundef) #2

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

attributes #0 = { 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 #1 = { 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 #2 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !15, i64 56}
!10 = !{!"_ZTSN8graphlab15hundredms_timerE", !11, i64 0, !12, i64 8, !14, i64 24, !15, i64 56}
!11 = !{!"long", !7, i64 0}
!12 = !{!"_ZTSN8graphlab5timerE", !13, i64 0}
!13 = !{!"_ZTS7timeval", !11, i64 0, !11, i64 8}
!14 = !{!"_ZTS9itimerval", !13, i64 0, !13, i64 16}
!15 = !{!"bool", !7, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = !{!19, !19, i64 0}
!19 = !{!"double", !7, i64 0}
!20 = !{!10, !11, i64 0}
!21 = !{!10, !11, i64 48}


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

%"class.graphlab::hundredms_timer" = type <{ i64, %"class.graphlab::timer", %struct.itimerval, i8, [7 x i8] }>
%"class.graphlab::timer" = type { %struct.timeval }
%struct.timeval = type { i64, i64 }
%struct.itimerval = type { %struct.timeval, %struct.timeval }

@_ZN8graphlab8hmstimerE = external dso_local global %"class.graphlab::hundredms_timer", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK8graphlab5timer12current_timeEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN8graphlab12alarm_wakeupEi(i32 %0) #0 {
  %2 = load i8, ptr getelementptr inbounds (i8, ptr @_ZN8graphlab8hmstimerE, i64 56), align 8, !tbaa !5, !range !14, !noundef !15
  %3 = trunc nuw i8 %2 to i1
  br i1 %3, label %16, label %4

4:                                                ; preds = %1
  %5 = tail call ptr @signal(i32 noundef 14, ptr noundef nonnull @_ZN8graphlab12alarm_wakeupEi) #4
  %6 = tail call noundef double @_ZNK8graphlab5timer12current_timeEv(ptr noundef nonnull align 8 dereferenceable(16) getelementptr inbounds (i8, ptr @_ZN8graphlab8hmstimerE, i64 8))
  %7 = fmul double %6, 1.000000e+01
  %8 = fptoui double %7 to i64
  store i64 %8, ptr @_ZN8graphlab8hmstimerE, align 8, !tbaa !16
  %9 = mul i64 %8, 100000
  %10 = add i64 %9, 100000
  %11 = uitofp i64 %10 to double
  %12 = fneg double %6
  %13 = tail call double @llvm.fmuladd.f64(double %12, double 1.000000e+06, double %11)
  %14 = fptosi double %13 to i64
  store i64 %14, ptr getelementptr inbounds (i8, ptr @_ZN8graphlab8hmstimerE, i64 48), align 8, !tbaa !17
  %15 = tail call i32 @setitimer(i32 noundef 0, ptr noundef nonnull getelementptr inbounds (i8, ptr @_ZN8graphlab8hmstimerE, i64 24), ptr noundef null) #4
  br label %16

16:                                               ; preds = %1, %4
  ret void
}

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

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

; Function Attrs: mustprogress nofree nounwind willreturn
declare noundef i32 @setitimer(i32 noundef, ptr nocapture noundef readonly, ptr nocapture noundef) local_unnamed_addr #3

attributes #0 = { 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 #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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { mustprogress nofree nounwind willreturn "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 = { 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, !13, i64 56}
!6 = !{!"_ZTSN8graphlab15hundredms_timerE", !7, i64 0, !10, i64 8, !12, i64 24, !13, i64 56}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN8graphlab5timerE", !11, i64 0}
!11 = !{!"_ZTS7timeval", !7, i64 0, !7, i64 8}
!12 = !{!"_ZTS9itimerval", !11, i64 0, !11, i64 16}
!13 = !{!"bool", !8, i64 0}
!14 = !{i8 0, i8 2}
!15 = !{}
!16 = !{!6, !7, i64 0}
!17 = !{!6, !7, i64 48}


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