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

; Function Attrs: nounwind uwtable
define dso_local void @unsixbit(i64 noundef %0, ptr noundef %1) #1 {
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = 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
  %6 = load ptr, ptr %4, align 8, !tbaa !9
  %7 = getelementptr inbounds i8, ptr %6, i64 6
  store ptr %7, ptr %4, align 8, !tbaa !9
  %8 = load ptr, ptr %4, align 8, !tbaa !9
  %9 = getelementptr inbounds i8, ptr %8, i32 -1
  store ptr %9, ptr %4, align 8, !tbaa !9
  store i8 0, ptr %8, align 1, !tbaa !11
  store i32 0, ptr %5, align 4, !tbaa !12
  br label %10

10:                                               ; preds = %22, %2
  %11 = load i32, ptr %5, align 4, !tbaa !12
  %12 = icmp slt i32 %11, 6
  br i1 %12, label %13, label %25

13:                                               ; preds = %10
  %14 = load i64, ptr %3, align 8, !tbaa !5
  %15 = and i64 %14, 63
  %16 = trunc i64 %15 to i8
  %17 = call signext i8 @sixbit2ascii(i8 noundef signext %16)
  %18 = load ptr, ptr %4, align 8, !tbaa !9
  %19 = getelementptr inbounds i8, ptr %18, i32 -1
  store ptr %19, ptr %4, align 8, !tbaa !9
  store i8 %17, ptr %18, align 1, !tbaa !11
  %20 = load i64, ptr %3, align 8, !tbaa !5
  %21 = lshr i64 %20, 6
  store i64 %21, ptr %3, align 8, !tbaa !5
  br label %22

22:                                               ; preds = %13
  %23 = load i32, ptr %5, align 4, !tbaa !12
  %24 = add nsw i32 %23, 1
  store i32 %24, ptr %5, align 4, !tbaa !12
  br label %10, !llvm.loop !14

25:                                               ; preds = %10
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #2
  ret void
}

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 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !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 @sixbit2ascii(i8 noundef signext) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @unsixbit(i64 noundef %0, ptr nocapture noundef writeonly %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %1, i64 6
  %4 = getelementptr inbounds i8, ptr %1, i64 5
  store i8 0, ptr %3, align 1, !tbaa !5
  %5 = trunc i64 %0 to i8
  %6 = and i8 %5, 63
  %7 = tail call signext i8 @sixbit2ascii(i8 noundef signext %6)
  %8 = getelementptr inbounds i8, ptr %1, i64 4
  store i8 %7, ptr %4, align 1, !tbaa !5
  %9 = lshr i64 %0, 6
  %10 = trunc i64 %9 to i8
  %11 = and i8 %10, 63
  %12 = tail call signext i8 @sixbit2ascii(i8 noundef signext %11)
  %13 = getelementptr inbounds i8, ptr %1, i64 3
  store i8 %12, ptr %8, align 1, !tbaa !5
  %14 = lshr i64 %0, 12
  %15 = trunc i64 %14 to i8
  %16 = and i8 %15, 63
  %17 = tail call signext i8 @sixbit2ascii(i8 noundef signext %16)
  %18 = getelementptr inbounds i8, ptr %1, i64 2
  store i8 %17, ptr %13, align 1, !tbaa !5
  %19 = lshr i64 %0, 18
  %20 = trunc i64 %19 to i8
  %21 = and i8 %20, 63
  %22 = tail call signext i8 @sixbit2ascii(i8 noundef signext %21)
  %23 = getelementptr inbounds i8, ptr %1, i64 1
  store i8 %22, ptr %18, align 1, !tbaa !5
  %24 = lshr i64 %0, 24
  %25 = trunc i64 %24 to i8
  %26 = and i8 %25, 63
  %27 = tail call signext i8 @sixbit2ascii(i8 noundef signext %26)
  store i8 %27, ptr %23, align 1, !tbaa !5
  %28 = lshr i64 %0, 30
  %29 = trunc i64 %28 to i8
  %30 = and i8 %29, 63
  %31 = tail call signext i8 @sixbit2ascii(i8 noundef signext %30)
  store i8 %31, ptr %1, align 1, !tbaa !5
  ret void
}

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