; LLVM IR from QMUL-EECS-Networks-Systems/ebpf-sketches :: tests/micro-benchmarks/prandom_u32/main_sip.ll (Z13print_resultsP8timespecS0_mj)

; 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.timespec = type { i64, i64 }

@.str = external hidden unnamed_addr constant [51 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [38 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z13print_resultsP8timespecS0_mj(ptr noundef %0, ptr noundef %1, i64 noundef %2, i32 noundef %3) #0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i64 %2, ptr %7, align 8, !tbaa !9
  store volatile i32 %3, ptr %8, align 4, !tbaa !11
  %12 = load ptr, ptr %6, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.timespec, ptr %12, i32 0, i32 0
  %14 = load i64, ptr %13, align 8, !tbaa !13
  %15 = sitofp i64 %14 to double
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.timespec, ptr %16, i32 0, i32 1
  %18 = load i64, ptr %17, align 8, !tbaa !15
  %19 = sitofp i64 %18 to double
  %20 = call double @llvm.fmuladd.f64(double 1.000000e-09, double %19, double %15)
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.timespec, ptr %21, i32 0, i32 0
  %23 = load i64, ptr %22, align 8, !tbaa !13
  %24 = sitofp i64 %23 to double
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.timespec, ptr %25, i32 0, i32 1
  %27 = load i64, ptr %26, align 8, !tbaa !15
  %28 = sitofp i64 %27 to double
  %29 = call double @llvm.fmuladd.f64(double 1.000000e-09, double %28, double %24)
  %30 = fsub double %20, %29
  %31 = load volatile i32, ptr %8, align 4, !tbaa !11
  %32 = call i32 (ptr, ...) @printf(ptr noundef @.str, double noundef %30, i32 noundef %31)
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.timespec, ptr %33, i32 0, i32 0
  %35 = load i64, ptr %34, align 8, !tbaa !13
  %36 = sitofp i64 %35 to double
  %37 = load ptr, ptr %6, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.timespec, ptr %37, i32 0, i32 1
  %39 = load i64, ptr %38, align 8, !tbaa !15
  %40 = sitofp i64 %39 to double
  %41 = call double @llvm.fmuladd.f64(double 1.000000e-09, double %40, double %36)
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.timespec, ptr %42, i32 0, i32 0
  %44 = load i64, ptr %43, align 8, !tbaa !13
  %45 = sitofp i64 %44 to double
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.timespec, ptr %46, i32 0, i32 1
  %48 = load i64, ptr %47, align 8, !tbaa !15
  %49 = sitofp i64 %48 to double
  %50 = call double @llvm.fmuladd.f64(double 1.000000e-09, double %49, double %45)
  %51 = fsub double %41, %50
  store double %51, ptr %9, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %52 = load i64, ptr %7, align 8, !tbaa !9
  %53 = uitofp i64 %52 to double
  %54 = load double, ptr %9, align 8, !tbaa !16
  %55 = fdiv double %53, %54
  store double %55, ptr %10, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %56 = load double, ptr %10, align 8, !tbaa !16
  %57 = fdiv double %56, 1.000000e+06
  store double %57, ptr %11, align 8, !tbaa !16
  %58 = load double, ptr %11, align 8, !tbaa !16
  %59 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, double noundef %58)
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  ret void
}

declare i32 @printf(ptr noundef, ...) #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #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 willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { "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 speculatable willreturn memory(none) }
attributes #3 = { nocallback nofree nosync 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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !10, i64 0}
!14 = !{!"_ZTS8timespec", !10, i64 0, !10, i64 8}
!15 = !{!14, !10, i64 8}
!16 = !{!17, !17, i64 0}
!17 = !{!"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"

@.str = external hidden unnamed_addr constant [51 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [38 x i8], align 1

; Function Attrs: mustprogress nofree nounwind uwtable
define dso_local void @_Z13print_resultsP8timespecS0_mj(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, i64 noundef %2, i32 noundef %3) local_unnamed_addr #0 {
  %5 = alloca i32, align 4
  store volatile i32 %3, ptr %5, align 4, !tbaa !5
  %6 = load i64, ptr %1, align 8, !tbaa !9
  %7 = sitofp i64 %6 to double
  %8 = getelementptr inbounds i8, ptr %1, i64 8
  %9 = load i64, ptr %8, align 8, !tbaa !12
  %10 = sitofp i64 %9 to double
  %11 = tail call double @llvm.fmuladd.f64(double %10, double 1.000000e-09, double %7)
  %12 = load i64, ptr %0, align 8, !tbaa !9
  %13 = sitofp i64 %12 to double
  %14 = getelementptr inbounds i8, ptr %0, i64 8
  %15 = load i64, ptr %14, align 8, !tbaa !12
  %16 = sitofp i64 %15 to double
  %17 = tail call double @llvm.fmuladd.f64(double %16, double 1.000000e-09, double %13)
  %18 = fsub double %11, %17
  %.0..0..0..0.3 = load volatile i32, ptr %5, align 4, !tbaa !5
  %19 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, double noundef %18, i32 noundef %.0..0..0..0.3)
  %20 = load i64, ptr %1, align 8, !tbaa !9
  %21 = sitofp i64 %20 to double
  %22 = load i64, ptr %8, align 8, !tbaa !12
  %23 = sitofp i64 %22 to double
  %24 = tail call double @llvm.fmuladd.f64(double %23, double 1.000000e-09, double %21)
  %25 = load i64, ptr %0, align 8, !tbaa !9
  %26 = sitofp i64 %25 to double
  %27 = load i64, ptr %14, align 8, !tbaa !12
  %28 = sitofp i64 %27 to double
  %29 = tail call double @llvm.fmuladd.f64(double %28, double 1.000000e-09, double %26)
  %30 = fsub double %24, %29
  %31 = uitofp i64 %2 to double
  %32 = fdiv double %31, %30
  %33 = fdiv double %32, 1.000000e+06
  %34 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %33)
  ret void
}

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1

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

attributes #0 = { mustprogress nofree 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 = { nofree 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) }

!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, !11, i64 0}
!10 = !{!"_ZTS8timespec", !11, i64 0, !11, i64 8}
!11 = !{!"long", !7, i64 0}
!12 = !{!10, !11, i64 8}


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