; LLVM IR from aap/pdp6 :: test (dtconv)

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

@datbuf = external dso_local global [73984 x i64], align 16

; 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
declare dso_local void @writef(ptr noundef, i32 noundef, ptr noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @prerecord(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  call void @writef(ptr noundef %2, i32 noundef 45, ptr noundef null, i32 noundef 0)
  call void @writef(ptr noundef %2, i32 noundef 45, ptr noundef null, i32 noundef 0)
  store ptr @datbuf, ptr %7, align 8, !tbaa !5
  store i64 0, ptr %3, align 8, !tbaa !9
  br label %8

8:                                                ; preds = %85, %1
  %9 = load i64, ptr %3, align 8, !tbaa !9
  %10 = icmp ult i64 %9, 578
  br i1 %10, label %11, label %88

11:                                               ; preds = %8
  store i64 0, ptr %4, align 8, !tbaa !9
  store i32 0, ptr %5, align 4, !tbaa !11
  br label %12

12:                                               ; preds = %29, %11
  %13 = load i32, ptr %5, align 4, !tbaa !11
  %14 = icmp slt i32 %13, 12
  br i1 %14, label %15, label %32

15:                                               ; preds = %12
  %16 = load i64, ptr %3, align 8, !tbaa !9
  %17 = load i32, ptr %5, align 4, !tbaa !11
  %18 = mul nsw i32 %17, 3
  %19 = zext i32 %18 to i64
  %20 = lshr i64 %16, %19
  %21 = and i64 %20, 7
  %22 = load i32, ptr %5, align 4, !tbaa !11
  %23 = sub nsw i32 11, %22
  %24 = mul nsw i32 %23, 3
  %25 = zext i32 %24 to i64
  %26 = shl i64 %21, %25
  %27 = load i64, ptr %4, align 8, !tbaa !9
  %28 = or i64 %27, %26
  store i64 %28, ptr %4, align 8, !tbaa !9
  br label %29

29:                                               ; preds = %15
  %30 = load i32, ptr %5, align 4, !tbaa !11
  %31 = add nsw i32 %30, 1
  store i32 %31, ptr %5, align 4, !tbaa !11
  br label %12, !llvm.loop !13

32:                                               ; preds = %12
  %33 = load i64, ptr %4, align 8, !tbaa !9
  %34 = xor i64 %33, 68719476735
  store i64 %34, ptr %4, align 8, !tbaa !9
  %35 = load i64, ptr %3, align 8, !tbaa !9
  %36 = lshr i64 %35, 18
  %37 = and i64 %36, 262143
  %38 = trunc i64 %37 to i32
  call void @writef(ptr noundef %2, i32 noundef 21, ptr noundef null, i32 noundef %38)
  %39 = load i64, ptr %3, align 8, !tbaa !9
  %40 = and i64 %39, 262143
  %41 = trunc i64 %40 to i32
  call void @writef(ptr noundef %2, i32 noundef 22, ptr noundef null, i32 noundef %41)
  call void @writef(ptr noundef %2, i32 noundef 26, ptr noundef null, i32 noundef 0)
  call void @writef(ptr noundef %2, i32 noundef 8, ptr noundef null, i32 noundef 0)
  store i32 0, ptr %6, align 4, !tbaa !11
  call void @writef(ptr noundef %2, i32 noundef 8, ptr noundef %6, i32 noundef 4095)
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  %43 = load i64, ptr %42, align 8, !tbaa !9
  %44 = call i32 @left(i64 noundef %43)
  call void @writef(ptr noundef %2, i32 noundef 8, ptr noundef %6, i32 noundef %44)
  %45 = load ptr, ptr %7, align 8, !tbaa !5
  %46 = load i64, ptr %45, align 8, !tbaa !9
  %47 = call i32 @right(i64 noundef %46)
  call void @writef(ptr noundef %2, i32 noundef 8, ptr noundef %6, i32 noundef %47)
  %48 = load ptr, ptr %7, align 8, !tbaa !5
  %49 = getelementptr inbounds i64, ptr %48, i32 1
  store ptr %49, ptr %7, align 8, !tbaa !5
  store i32 1, ptr %5, align 4, !tbaa !11
  br label %50

50:                                               ; preds = %62, %32
  %51 = load i32, ptr %5, align 4, !tbaa !11
  %52 = icmp slt i32 %51, 127
  br i1 %52, label %53, label %65

53:                                               ; preds = %50
  %54 = load ptr, ptr %7, align 8, !tbaa !5
  %55 = load i64, ptr %54, align 8, !tbaa !9
  %56 = call i32 @left(i64 noundef %55)
  call void @writef(ptr noundef %2, i32 noundef 56, ptr noundef %6, i32 noundef %56)
  %57 = load ptr, ptr %7, align 8, !tbaa !5
  %58 = load i64, ptr %57, align 8, !tbaa !9
  %59 = call i32 @right(i64 noundef %58)
  call void @writef(ptr noundef %2, i32 noundef 56, ptr noundef %6, i32 noundef %59)
  %60 = load ptr, ptr %7, align 8, !tbaa !5
  %61 = getelementptr inbounds i64, ptr %60, i32 1
  store ptr %61, ptr %7, align 8, !tbaa !5
  br label %62

62:                                               ; preds = %53
  %63 = load i32, ptr %5, align 4, !tbaa !11
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %5, align 4, !tbaa !11
  br label %50, !llvm.loop !15

65:                                               ; preds = %50
  %66 = load ptr, ptr %7, align 8, !tbaa !5
  %67 = load i64, ptr %66, align 8, !tbaa !9
  %68 = call i32 @left(i64 noundef %67)
  call void @writef(ptr noundef %2, i32 noundef 59, ptr noundef %6, i32 noundef %68)
  %69 = load ptr, ptr %7, align 8, !tbaa !5
  %70 = load i64, ptr %69, align 8, !tbaa !9
  %71 = call i32 @right(i64 noundef %70)
  call void @writef(ptr noundef %2, i32 noundef 59, ptr noundef %6, i32 noundef %71)
  %72 = load ptr, ptr %7, align 8, !tbaa !5
  %73 = getelementptr inbounds i64, ptr %72, i32 1
  store ptr %73, ptr %7, align 8, !tbaa !5
  %74 = load i32, ptr %6, align 4, !tbaa !11
  %75 = and i32 %74, 63
  %76 = shl i32 %75, 12
  %77 = or i32 %76, 4095
  call void @writef(ptr noundef %2, i32 noundef 59, ptr noundef null, i32 noundef %77)
  call void @writef(ptr noundef %2, i32 noundef 59, ptr noundef null, i32 noundef 0)
  call void @writef(ptr noundef %2, i32 noundef 41, ptr noundef null, i32 noundef 0)
  %78 = load i64, ptr %4, align 8, !tbaa !9
  %79 = lshr i64 %78, 18
  %80 = and i64 %79, 262143
  %81 = trunc i64 %80 to i32
  call void @writef(ptr noundef %2, i32 noundef 37, ptr noundef null, i32 noundef %81)
  %82 = load i64, ptr %4, align 8, !tbaa !9
  %83 = and i64 %82, 262143
  %84 = trunc i64 %83 to i32
  call void @writef(ptr noundef %2, i32 noundef 21, ptr noundef null, i32 noundef %84)
  br label %85

85:                                               ; preds = %65
  %86 = load i64, ptr %3, align 8, !tbaa !9
  %87 = add i64 %86, 1
  store i64 %87, ptr %3, align 8, !tbaa !9
  br label %8, !llvm.loop !16

88:                                               ; preds = %8
  call void @writef(ptr noundef %2, i32 noundef 18, ptr noundef null, i32 noundef 0)
  call void @writef(ptr noundef %2, i32 noundef 18, ptr noundef null, i32 noundef 0)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  ret void
}

declare i32 @left(i64 noundef) #2

declare i32 @right(i64 noundef) #2

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 = { "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 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}


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

@datbuf = external dso_local local_unnamed_addr global [73984 x i64], align 16

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @writef(ptr noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @prerecord(ptr noundef %0) local_unnamed_addr #1 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #3
  call void @writef(ptr noundef nonnull %2, i32 noundef 45, ptr noundef null, i32 noundef 0)
  call void @writef(ptr noundef nonnull %2, i32 noundef 45, ptr noundef null, i32 noundef 0)
  br label %.preheader

.preheader:                                       ; preds = %1, %50
  %.033 = phi ptr [ @datbuf, %1 ], [ %56, %50 ]
  %.02632 = phi i64 [ 0, %1 ], [ %66, %50 ]
  %4 = shl i64 %.02632, 33
  %5 = and i64 %4, 60129542144
  %6 = shl i64 %.02632, 27
  %7 = and i64 %6, 7516192768
  %8 = or disjoint i64 %7, %5
  %9 = shl i64 %.02632, 21
  %10 = and i64 %9, 939524096
  %11 = or disjoint i64 %10, %8
  %12 = shl i64 %.02632, 15
  %13 = and i64 %12, 117440512
  %14 = or disjoint i64 %13, %11
  %15 = shl i64 %.02632, 9
  %16 = and i64 %15, 14680064
  %17 = or disjoint i64 %16, %14
  %18 = shl i64 %.02632, 3
  %19 = and i64 %18, 1835008
  %20 = or disjoint i64 %19, %17
  %21 = lshr i64 %.02632, 3
  %22 = and i64 %21, 229376
  %23 = or i64 %22, %20
  %24 = lshr i64 %.02632, 9
  %25 = and i64 %24, 28672
  %26 = or i64 %25, %23
  %27 = lshr i64 %.02632, 15
  %28 = and i64 %27, 3584
  %29 = or i64 %28, %26
  %30 = lshr i64 %.02632, 21
  %31 = and i64 %30, 448
  %32 = or i64 %31, %29
  %33 = lshr i64 %.02632, 27
  %34 = and i64 %33, 56
  %35 = or i64 %34, %32
  %36 = lshr i64 %.02632, 33
  %37 = and i64 %36, 7
  %38 = or i64 %37, %35
  call void @writef(ptr noundef nonnull %2, i32 noundef 21, ptr noundef null, i32 noundef 0)
  %39 = trunc nuw nsw i64 %.02632 to i32
  call void @writef(ptr noundef nonnull %2, i32 noundef 22, ptr noundef null, i32 noundef %39)
  call void @writef(ptr noundef nonnull %2, i32 noundef 26, ptr noundef null, i32 noundef 0)
  call void @writef(ptr noundef nonnull %2, i32 noundef 8, ptr noundef null, i32 noundef 0)
  store i32 0, ptr %3, align 4, !tbaa !9
  call void @writef(ptr noundef nonnull %2, i32 noundef 8, ptr noundef nonnull %3, i32 noundef 4095)
  %40 = load i64, ptr %.033, align 8, !tbaa !11
  %41 = call i32 @left(i64 noundef %40) #3
  call void @writef(ptr noundef nonnull %2, i32 noundef 8, ptr noundef nonnull %3, i32 noundef %41)
  %42 = load i64, ptr %.033, align 8, !tbaa !11
  %43 = call i32 @right(i64 noundef %42) #3
  call void @writef(ptr noundef nonnull %2, i32 noundef 8, ptr noundef nonnull %3, i32 noundef %43)
  %.129 = getelementptr inbounds i8, ptr %.033, i64 8
  br label %44

44:                                               ; preds = %.preheader, %44
  %.131 = phi ptr [ %.129, %.preheader ], [ %.1, %44 ]
  %.12430 = phi i32 [ 1, %.preheader ], [ %49, %44 ]
  %45 = load i64, ptr %.131, align 8, !tbaa !11
  %46 = call i32 @left(i64 noundef %45) #3
  call void @writef(ptr noundef nonnull %2, i32 noundef 56, ptr noundef nonnull %3, i32 noundef %46)
  %47 = load i64, ptr %.131, align 8, !tbaa !11
  %48 = call i32 @right(i64 noundef %47) #3
  call void @writef(ptr noundef nonnull %2, i32 noundef 56, ptr noundef nonnull %3, i32 noundef %48)
  %49 = add nuw nsw i32 %.12430, 1
  %.1 = getelementptr inbounds i8, ptr %.131, i64 8
  %exitcond.not = icmp eq i32 %49, 127
  br i1 %exitcond.not, label %50, label %44, !llvm.loop !13

50:                                               ; preds = %44
  %51 = xor i64 %38, 68719476735
  %52 = load i64, ptr %.1, align 8, !tbaa !11
  %53 = call i32 @left(i64 noundef %52) #3
  call void @writef(ptr noundef nonnull %2, i32 noundef 59, ptr noundef nonnull %3, i32 noundef %53)
  %54 = load i64, ptr %.1, align 8, !tbaa !11
  %55 = call i32 @right(i64 noundef %54) #3
  call void @writef(ptr noundef nonnull %2, i32 noundef 59, ptr noundef nonnull %3, i32 noundef %55)
  %56 = getelementptr inbounds i8, ptr %.131, i64 16
  %57 = load i32, ptr %3, align 4, !tbaa !9
  %58 = shl i32 %57, 12
  %59 = and i32 %58, 258048
  %60 = or disjoint i32 %59, 4095
  call void @writef(ptr noundef nonnull %2, i32 noundef 59, ptr noundef null, i32 noundef %60)
  call void @writef(ptr noundef nonnull %2, i32 noundef 59, ptr noundef null, i32 noundef 0)
  call void @writef(ptr noundef nonnull %2, i32 noundef 41, ptr noundef null, i32 noundef 0)
  %61 = lshr i64 %51, 18
  %62 = trunc nuw nsw i64 %61 to i32
  %63 = and i32 %62, 262143
  call void @writef(ptr noundef nonnull %2, i32 noundef 37, ptr noundef null, i32 noundef %63)
  %64 = trunc i64 %51 to i32
  %65 = and i32 %64, 262143
  call void @writef(ptr noundef nonnull %2, i32 noundef 21, ptr noundef null, i32 noundef %65)
  %66 = add nuw nsw i64 %.02632, 1
  %exitcond35.not = icmp eq i64 %66, 578
  br i1 %exitcond35.not, label %67, label %.preheader, !llvm.loop !15

67:                                               ; preds = %50
  call void @writef(ptr noundef nonnull %2, i32 noundef 18, ptr noundef null, i32 noundef 0)
  call void @writef(ptr noundef nonnull %2, i32 noundef 18, ptr noundef null, i32 noundef 0)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #3
  ret void
}

declare i32 @left(i64 noundef) local_unnamed_addr #2

declare i32 @right(i64 noundef) local_unnamed_addr #2

attributes #0 = { mustprogress 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 = { "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 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


; Effective O3 passes: CorrelatedValuePropagationPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass