; LLVM IR from aap/pdp6 :: fe6 (pdp6common)

; 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.anon.0 = type { i64 }

; 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: nounwind uwtable
define dso_local i64 @dtopdp(double noundef %0) #1 {
  %2 = alloca double, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca %union.anon.0, align 8
  store double %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #2
  store i32 0, ptr %6, align 4, !tbaa !9
  %9 = load double, ptr %2, align 8, !tbaa !5
  %10 = fcmp olt double %9, 0.000000e+00
  br i1 %10, label %11, label %14

11:                                               ; preds = %1
  store i32 1, ptr %6, align 4, !tbaa !9
  %12 = load double, ptr %2, align 8, !tbaa !5
  %13 = fmul double %12, -1.000000e+00
  store double %13, ptr %2, align 8, !tbaa !5
  br label %14

14:                                               ; preds = %11, %1
  %15 = load double, ptr %2, align 8, !tbaa !5
  store double %15, ptr %8, align 8, !tbaa !11
  %16 = load i64, ptr %8, align 8, !tbaa !11
  store i64 %16, ptr %3, align 8, !tbaa !12
  %17 = load i64, ptr %3, align 8, !tbaa !12
  %18 = lshr i64 %17, 52
  %19 = and i64 %18, 2047
  store i64 %19, ptr %4, align 8, !tbaa !12
  %20 = load i64, ptr %3, align 8, !tbaa !12
  %21 = and i64 %20, 4503599627370495
  store i64 %21, ptr %5, align 8, !tbaa !12
  %22 = load i64, ptr %4, align 8, !tbaa !12
  %23 = add i64 %22, -895
  store i64 %23, ptr %4, align 8, !tbaa !12
  %24 = load i64, ptr %5, align 8, !tbaa !12
  %25 = lshr i64 %24, 25
  store i64 %25, ptr %5, align 8, !tbaa !12
  %26 = load i64, ptr %3, align 8, !tbaa !12
  %27 = icmp ne i64 %26, 0
  br i1 %27, label %28, label %35

28:                                               ; preds = %14
  %29 = load i64, ptr %5, align 8, !tbaa !12
  %30 = lshr i64 %29, 1
  store i64 %30, ptr %5, align 8, !tbaa !12
  %31 = load i64, ptr %5, align 8, !tbaa !12
  %32 = or i64 %31, 67108864
  store i64 %32, ptr %5, align 8, !tbaa !12
  %33 = load i64, ptr %4, align 8, !tbaa !12
  %34 = add i64 %33, 1
  store i64 %34, ptr %4, align 8, !tbaa !12
  br label %36

35:                                               ; preds = %14
  store i64 0, ptr %4, align 8, !tbaa !12
  br label %36

36:                                               ; preds = %35, %28
  %37 = load i64, ptr %4, align 8, !tbaa !12
  %38 = shl i64 %37, 27
  store i64 %38, ptr %7, align 8, !tbaa !12
  %39 = load i64, ptr %5, align 8, !tbaa !12
  %40 = load i64, ptr %7, align 8, !tbaa !12
  %41 = or i64 %40, %39
  store i64 %41, ptr %7, align 8, !tbaa !12
  %42 = load i32, ptr %6, align 4, !tbaa !9
  %43 = icmp ne i32 %42, 0
  br i1 %43, label %44, label %48

44:                                               ; preds = %36
  %45 = load i64, ptr %7, align 8, !tbaa !12
  %46 = sub i64 0, %45
  %47 = and i64 %46, 68719476735
  store i64 %47, ptr %7, align 8, !tbaa !12
  br label %48

48:                                               ; preds = %44, %36
  %49 = load i64, ptr %7, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #2
  ret i64 %49
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"long", !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"

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local i64 @dtopdp(double noundef %0) local_unnamed_addr #0 {
  %2 = fcmp uge double %0, 0.000000e+00
  %3 = fneg double %0
  %.0 = select i1 %2, double %0, double %3
  %4 = bitcast double %.0 to i64
  %5 = lshr i64 %4, 25
  %.not = icmp eq i64 %4, 0
  %6 = lshr i64 %4, 26
  %7 = and i64 %6, 67108863
  %8 = or disjoint i64 %7, 67108864
  %9 = and i64 %5, 274743689216
  %10 = add nsw i64 %9, -119990648832
  %11 = or disjoint i64 %10, %8
  %12 = select i1 %.not, i64 0, i64 %11
  %13 = sub nsw i64 0, %12
  %14 = and i64 %13, 68719476735
  %.016 = select i1 %2, i64 %12, i64 %14
  ret i64 %.016
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) 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" }

!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)"}


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