; LLVM IR from aap/pdp6 :: tools (as6)

; 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 i64 @shift(i64 noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @shiftc(ptr noundef %0, ptr noundef %1, i32 noundef %2) #1 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #2
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = load i64, ptr %9, align 8, !tbaa !11
  %11 = load i32, ptr %6, align 4, !tbaa !9
  %12 = call i64 @shift(i64 noundef %10, i32 noundef %11)
  %13 = and i64 %12, 68719476735
  store i64 %13, ptr %7, align 8, !tbaa !11
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = load i64, ptr %14, align 8, !tbaa !11
  %16 = load i32, ptr %6, align 4, !tbaa !9
  %17 = call i64 @shift(i64 noundef %15, i32 noundef %16)
  %18 = and i64 %17, 68719476735
  store i64 %18, ptr %8, align 8, !tbaa !11
  %19 = load i32, ptr %6, align 4, !tbaa !9
  %20 = icmp slt i32 %19, 0
  br i1 %20, label %21, label %33

21:                                               ; preds = %3
  %22 = load i64, ptr %7, align 8, !tbaa !11
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = load i64, ptr %23, align 8, !tbaa !11
  %25 = load i32, ptr %6, align 4, !tbaa !9
  %26 = add nsw i32 %25, 36
  %27 = call i64 @shift(i64 noundef %24, i32 noundef %26)
  %28 = and i64 %27, 68719476735
  %29 = or i64 %22, %28
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  store i64 %29, ptr %30, align 8, !tbaa !11
  %31 = load i64, ptr %8, align 8, !tbaa !11
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  store i64 %31, ptr %32, align 8, !tbaa !11
  br label %45

33:                                               ; preds = %3
  %34 = load i64, ptr %8, align 8, !tbaa !11
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = load i64, ptr %35, align 8, !tbaa !11
  %37 = load i32, ptr %6, align 4, !tbaa !9
  %38 = sub nsw i32 %37, 36
  %39 = call i64 @shift(i64 noundef %36, i32 noundef %38)
  %40 = and i64 %39, 68719476735
  %41 = or i64 %34, %40
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  store i64 %41, ptr %42, align 8, !tbaa !11
  %43 = load i64, ptr %7, align 8, !tbaa !11
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  store i64 %43, ptr %44, align 8, !tbaa !11
  br label %45

45:                                               ; preds = %33, %21
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #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 = !{!"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}


; 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 i64 @shift(i64 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @shiftc(ptr nocapture noundef %0, ptr nocapture noundef %1, i32 noundef %2) local_unnamed_addr #0 {
  %4 = load i64, ptr %0, align 8, !tbaa !5
  %5 = tail call i64 @shift(i64 noundef %4, i32 noundef %2)
  %6 = load i64, ptr %1, align 8, !tbaa !5
  %7 = tail call i64 @shift(i64 noundef %6, i32 noundef %2)
  %8 = icmp slt i32 %2, 0
  %. = select i1 %8, i64 %7, i64 %5
  %.27 = select i1 %8, ptr %1, ptr %0
  %.28 = select i1 %8, i32 36, i32 -36
  %.29 = select i1 %8, i64 %5, i64 %7
  %.30 = select i1 %8, ptr %0, ptr %1
  %9 = and i64 %., 68719476735
  %10 = load i64, ptr %.27, align 8, !tbaa !5
  %11 = add nsw i32 %.28, %2
  %12 = tail call i64 @shift(i64 noundef %10, i32 noundef %11)
  %13 = or i64 %12, %.29
  %14 = and i64 %13, 68719476735
  store i64 %14, ptr %.30, align 8, !tbaa !5
  store i64 %9, ptr %.27, align 8, !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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


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