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

declare i32 @putc(i32 noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local void @writewbak(i64 noundef %0, ptr noundef %1) #1 {
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  store i64 %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !9
  %5 = load i64, ptr %3, align 8, !tbaa !5
  %6 = lshr i64 %5, 29
  %7 = and i64 %6, 127
  %8 = trunc i64 %7 to i32
  %9 = load ptr, ptr %4, align 8, !tbaa !9
  %10 = call i32 @putc(i32 noundef %8, ptr noundef %9)
  %11 = load i64, ptr %3, align 8, !tbaa !5
  %12 = lshr i64 %11, 22
  %13 = and i64 %12, 127
  %14 = trunc i64 %13 to i32
  %15 = load ptr, ptr %4, align 8, !tbaa !9
  %16 = call i32 @putc(i32 noundef %14, ptr noundef %15)
  %17 = load i64, ptr %3, align 8, !tbaa !5
  %18 = lshr i64 %17, 15
  %19 = and i64 %18, 127
  %20 = trunc i64 %19 to i32
  %21 = load ptr, ptr %4, align 8, !tbaa !9
  %22 = call i32 @putc(i32 noundef %20, ptr noundef %21)
  %23 = load i64, ptr %3, align 8, !tbaa !5
  %24 = lshr i64 %23, 8
  %25 = and i64 %24, 127
  %26 = trunc i64 %25 to i32
  %27 = load ptr, ptr %4, align 8, !tbaa !9
  %28 = call i32 @putc(i32 noundef %26, ptr noundef %27)
  %29 = load i64, ptr %3, align 8, !tbaa !5
  %30 = lshr i64 %29, 1
  %31 = and i64 %30, 127
  %32 = load i64, ptr %3, align 8, !tbaa !5
  %33 = and i64 %32, 1
  %34 = shl i64 %33, 7
  %35 = or i64 %31, %34
  %36 = trunc i64 %35 to i32
  %37 = load ptr, ptr %4, align 8, !tbaa !9
  %38 = call i32 @putc(i32 noundef %36, ptr noundef %37)
  ret void
}

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

!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}


; 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: nofree nounwind
declare noundef i32 @putc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #0

; Function Attrs: nofree nounwind uwtable
define dso_local void @writewbak(i64 noundef %0, ptr nocapture noundef %1) local_unnamed_addr #1 {
  %3 = lshr i64 %0, 29
  %4 = trunc i64 %3 to i32
  %5 = and i32 %4, 127
  %6 = tail call i32 @putc(i32 noundef %5, ptr noundef %1)
  %7 = trunc i64 %0 to i32
  %8 = lshr i32 %7, 22
  %9 = and i32 %8, 127
  %10 = tail call i32 @putc(i32 noundef %9, ptr noundef %1)
  %11 = lshr i32 %7, 15
  %12 = and i32 %11, 127
  %13 = tail call i32 @putc(i32 noundef %12, ptr noundef %1)
  %14 = lshr i32 %7, 8
  %15 = and i32 %14, 127
  %16 = tail call i32 @putc(i32 noundef %15, ptr noundef %1)
  %17 = lshr i64 %0, 1
  %18 = and i64 %17, 127
  %19 = shl i64 %0, 7
  %20 = and i64 %19, 128
  %21 = or disjoint i64 %18, %20
  %22 = trunc nuw nsw i64 %21 to i32
  %23 = tail call i32 @putc(i32 noundef %22, ptr noundef %1)
  ret void
}

attributes #0 = { nofree nounwind "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 #1 = { nofree 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)"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,TailCallElimPass