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

; 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 signext i8 @rad2ascii(i8 noundef signext) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @unrad50(i64 noundef %0, ptr noundef %1) #1 {
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store i64 %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #2
  %7 = load i64, ptr %3, align 8, !tbaa !5
  %8 = lshr i64 %7, 30
  %9 = and i64 %8, 60
  %10 = trunc i64 %9 to i32
  store i32 %10, ptr %6, align 4, !tbaa !11
  %11 = load i64, ptr %3, align 8, !tbaa !5
  %12 = and i64 %11, -64424509441
  store i64 %12, ptr %3, align 8, !tbaa !5
  %13 = load ptr, ptr %4, align 8, !tbaa !9
  %14 = getelementptr inbounds i8, ptr %13, i64 6
  store ptr %14, ptr %4, align 8, !tbaa !9
  %15 = load ptr, ptr %4, align 8, !tbaa !9
  %16 = getelementptr inbounds i8, ptr %15, i32 -1
  store ptr %16, ptr %4, align 8, !tbaa !9
  store i8 0, ptr %15, align 1, !tbaa !13
  store i32 0, ptr %5, align 4, !tbaa !11
  br label %17

17:                                               ; preds = %29, %2
  %18 = load i32, ptr %5, align 4, !tbaa !11
  %19 = icmp slt i32 %18, 6
  br i1 %19, label %20, label %32

20:                                               ; preds = %17
  %21 = load i64, ptr %3, align 8, !tbaa !5
  %22 = urem i64 %21, 40
  %23 = trunc i64 %22 to i8
  %24 = call signext i8 @rad2ascii(i8 noundef signext %23)
  %25 = load ptr, ptr %4, align 8, !tbaa !9
  %26 = getelementptr inbounds i8, ptr %25, i32 -1
  store ptr %26, ptr %4, align 8, !tbaa !9
  store i8 %24, ptr %25, align 1, !tbaa !13
  %27 = load i64, ptr %3, align 8, !tbaa !5
  %28 = udiv i64 %27, 40
  store i64 %28, ptr %3, align 8, !tbaa !5
  br label %29

29:                                               ; preds = %20
  %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 %17, !llvm.loop !14

32:                                               ; preds = %17
  %33 = load i32, ptr %6, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #2
  ret i32 %33
}

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 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


; 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: nounwind uwtable
declare dso_local signext i8 @rad2ascii(i8 noundef signext) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local noundef range(i32 0, 61) i32 @unrad50(i64 noundef %0, ptr nocapture noundef writeonly %1) local_unnamed_addr #0 {
  %3 = and i64 %0, -64424509441
  %4 = getelementptr inbounds i8, ptr %1, i64 6
  %5 = getelementptr inbounds i8, ptr %1, i64 5
  store i8 0, ptr %4, align 1, !tbaa !5
  %6 = urem i64 %3, 40
  %7 = trunc nuw nsw i64 %6 to i8
  %8 = tail call signext i8 @rad2ascii(i8 noundef signext %7)
  %9 = getelementptr inbounds i8, ptr %1, i64 4
  store i8 %8, ptr %5, align 1, !tbaa !5
  %10 = udiv i64 %3, 40
  %11 = urem i64 %10, 40
  %12 = trunc nuw nsw i64 %11 to i8
  %13 = tail call signext i8 @rad2ascii(i8 noundef signext %12)
  %14 = getelementptr inbounds i8, ptr %1, i64 3
  store i8 %13, ptr %9, align 1, !tbaa !5
  %15 = udiv i64 %3, 1600
  %16 = urem i64 %15, 40
  %17 = trunc nuw nsw i64 %16 to i8
  %18 = tail call signext i8 @rad2ascii(i8 noundef signext %17)
  %19 = getelementptr inbounds i8, ptr %1, i64 2
  store i8 %18, ptr %14, align 1, !tbaa !5
  %20 = udiv i64 %3, 64000
  %21 = urem i64 %20, 40
  %22 = trunc nuw nsw i64 %21 to i8
  %23 = tail call signext i8 @rad2ascii(i8 noundef signext %22)
  %24 = getelementptr inbounds i8, ptr %1, i64 1
  store i8 %23, ptr %19, align 1, !tbaa !5
  %25 = udiv i64 %3, 2560000
  %26 = urem i64 %25, 40
  %27 = trunc nuw nsw i64 %26 to i8
  %28 = tail call signext i8 @rad2ascii(i8 noundef signext %27)
  store i8 %28, ptr %24, align 1, !tbaa !5
  %29 = udiv i64 %3, 102400000
  %30 = urem i64 %29, 40
  %31 = trunc nuw nsw i64 %30 to i8
  %32 = tail call signext i8 @rad2ascii(i8 noundef signext %31)
  store i8 %32, ptr %1, align 1, !tbaa !5
  %33 = lshr i64 %0, 30
  %34 = trunc i64 %33 to i32
  %35 = and i32 %34, 60
  ret i32 %35
}

attributes #0 = { 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" }

!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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}


; Effective O3 passes: GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass