; 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.1 = 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 double @pdptod(i64 noundef %0) #1 {
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca %union.anon.1, align 8
  store i64 %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 8, ptr %6) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #2
  store i64 0, ptr %4, align 8, !tbaa !5
  %8 = load i64, ptr %2, align 8, !tbaa !5
  %9 = and i64 %8, 34359738368
  %10 = icmp ne i64 %9, 0
  br i1 %10, label %11, label %15

11:                                               ; preds = %1
  %12 = load i64, ptr %2, align 8, !tbaa !5
  %13 = sub i64 0, %12
  %14 = and i64 %13, 68719476735
  store i64 %14, ptr %2, align 8, !tbaa !5
  store i64 1, ptr %4, align 8, !tbaa !5
  br label %15

15:                                               ; preds = %11, %1
  %16 = load i64, ptr %2, align 8, !tbaa !5
  %17 = lshr i64 %16, 27
  %18 = and i64 %17, 255
  store i64 %18, ptr %5, align 8, !tbaa !5
  %19 = load i64, ptr %2, align 8, !tbaa !5
  %20 = and i64 %19, 134217727
  store i64 %20, ptr %6, align 8, !tbaa !5
  %21 = load i64, ptr %5, align 8, !tbaa !5
  %22 = add i64 %21, 895
  store i64 %22, ptr %5, align 8, !tbaa !5
  %23 = load i64, ptr %6, align 8, !tbaa !5
  %24 = icmp ne i64 %23, 0
  br i1 %24, label %25, label %32

25:                                               ; preds = %15
  %26 = load i64, ptr %6, align 8, !tbaa !5
  %27 = and i64 %26, -67108865
  store i64 %27, ptr %6, align 8, !tbaa !5
  %28 = load i64, ptr %6, align 8, !tbaa !5
  %29 = shl i64 %28, 1
  store i64 %29, ptr %6, align 8, !tbaa !5
  %30 = load i64, ptr %5, align 8, !tbaa !5
  %31 = sub i64 %30, 1
  store i64 %31, ptr %5, align 8, !tbaa !5
  br label %33

32:                                               ; preds = %15
  store i64 0, ptr %5, align 8, !tbaa !5
  br label %33

33:                                               ; preds = %32, %25
  %34 = load i64, ptr %6, align 8, !tbaa !5
  %35 = shl i64 %34, 25
  store i64 %35, ptr %6, align 8, !tbaa !5
  %36 = load i64, ptr %6, align 8, !tbaa !5
  store i64 %36, ptr %3, align 8, !tbaa !5
  %37 = load i64, ptr %5, align 8, !tbaa !5
  %38 = and i64 %37, 2047
  %39 = shl i64 %38, 52
  %40 = load i64, ptr %3, align 8, !tbaa !5
  %41 = or i64 %40, %39
  store i64 %41, ptr %3, align 8, !tbaa !5
  %42 = load i64, ptr %4, align 8, !tbaa !5
  %43 = shl i64 %42, 63
  %44 = load i64, ptr %3, align 8, !tbaa !5
  %45 = or i64 %44, %43
  store i64 %45, ptr %3, align 8, !tbaa !5
  %46 = load i64, ptr %3, align 8, !tbaa !5
  store i64 %46, ptr %7, align 8, !tbaa !9
  %47 = load double, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 8, 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 double %47
}

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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !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 double @pdptod(i64 noundef %0) local_unnamed_addr #0 {
  %2 = and i64 %0, 34359738368
  %.not = icmp eq i64 %2, 0
  %3 = sub nsw i64 0, %0
  %.0 = select i1 %.not, i64 %0, i64 %3
  %4 = and i64 %.0, 134217727
  %.not20 = icmp eq i64 %4, 0
  br i1 %.not20, label %12, label %5

5:                                                ; preds = %1
  %6 = shl i64 %.0, 26
  %7 = and i64 %6, 4503599560261632
  %8 = shl i64 %.0, 25
  %9 = and i64 %8, 1148417904979476480
  %10 = add nuw nsw i64 %9, 4026218066869223424
  %11 = or disjoint i64 %10, %7
  br label %12

12:                                               ; preds = %1, %5
  %13 = phi i64 [ %11, %5 ], [ 0, %1 ]
  %.018 = shl nuw i64 %2, 28
  %14 = or i64 %13, %.018
  %15 = bitcast i64 %14 to double
  ret double %15
}

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: BDCEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass