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

@lp = external dso_local global ptr, align 8
@.str.49 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.50 = external hidden unnamed_addr constant [21 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @err(i32 noundef, ptr noundef, ...) #0

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @putv(i64 noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @skipwhite() #0

declare signext i8 @ascii2sixbit(i8 noundef signext) #2

; Function Attrs: nounwind uwtable
define dso_local void @sixbitOp() #0 {
  %1 = alloca i8, align 1
  %2 = alloca i8, align 1
  %3 = alloca i64, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 1, ptr %1) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr %2) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  call void @skipwhite()
  %6 = load ptr, ptr @lp, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %6, i32 1
  store ptr %7, ptr @lp, align 8, !tbaa !5
  %8 = load i8, ptr %6, align 1, !tbaa !9
  store i8 %8, ptr %1, align 1, !tbaa !9
  %9 = load i8, ptr %1, align 1, !tbaa !9
  %10 = sext i8 %9 to i32
  %11 = icmp eq i32 %10, 59
  br i1 %11, label %16, label %12

12:                                               ; preds = %0
  %13 = load i8, ptr %1, align 1, !tbaa !9
  %14 = sext i8 %13 to i32
  %15 = icmp eq i32 %14, 0
  br i1 %15, label %16, label %17

16:                                               ; preds = %12, %0
  call void @putv(i64 noundef 0, i32 noundef 0)
  store i32 1, ptr %5, align 4
  br label %80

17:                                               ; preds = %12
  store i64 0, ptr %3, align 8, !tbaa !10
  store i32 0, ptr %4, align 4, !tbaa !12
  br label %18

18:                                               ; preds = %55, %17
  %19 = load ptr, ptr @lp, align 8, !tbaa !5
  %20 = load i8, ptr %19, align 1, !tbaa !9
  %21 = sext i8 %20 to i32
  %22 = icmp ne i32 %21, 0
  br i1 %22, label %23, label %30

23:                                               ; preds = %18
  %24 = load ptr, ptr @lp, align 8, !tbaa !5
  %25 = load i8, ptr %24, align 1, !tbaa !9
  %26 = sext i8 %25 to i32
  %27 = load i8, ptr %1, align 1, !tbaa !9
  %28 = sext i8 %27 to i32
  %29 = icmp ne i32 %26, %28
  br label %30

30:                                               ; preds = %23, %18
  %31 = phi i1 [ false, %18 ], [ %29, %23 ]
  br i1 %31, label %32, label %58

32:                                               ; preds = %30
  %33 = load ptr, ptr @lp, align 8, !tbaa !5
  %34 = load i8, ptr %33, align 1, !tbaa !9
  %35 = call signext i8 @ascii2sixbit(i8 noundef signext %34)
  store i8 %35, ptr %2, align 1, !tbaa !9
  %36 = load i8, ptr %2, align 1, !tbaa !9
  %37 = sext i8 %36 to i32
  %38 = icmp slt i32 %37, 0
  br i1 %38, label %39, label %43

39:                                               ; preds = %32
  %40 = load ptr, ptr @lp, align 8, !tbaa !5
  %41 = load i8, ptr %40, align 1, !tbaa !9
  %42 = sext i8 %41 to i32
  call void (i32, ptr, ...) @err(i32 noundef 0, ptr noundef @.str.49, i32 noundef %42)
  br label %55

43:                                               ; preds = %32
  %44 = load i64, ptr %3, align 8, !tbaa !10
  %45 = shl i64 %44, 6
  %46 = load i8, ptr %2, align 1, !tbaa !9
  %47 = sext i8 %46 to i64
  %48 = or i64 %45, %47
  store i64 %48, ptr %3, align 8, !tbaa !10
  %49 = load i32, ptr %4, align 4, !tbaa !12
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr %4, align 4, !tbaa !12
  %51 = icmp eq i32 %50, 6
  br i1 %51, label %52, label %54

52:                                               ; preds = %43
  %53 = load i64, ptr %3, align 8, !tbaa !10
  call void @putv(i64 noundef %53, i32 noundef 0)
  store i32 0, ptr %4, align 4, !tbaa !12
  store i64 0, ptr %3, align 8, !tbaa !10
  br label %54

54:                                               ; preds = %52, %43
  br label %55

55:                                               ; preds = %54, %39
  %56 = load ptr, ptr @lp, align 8, !tbaa !5
  %57 = getelementptr inbounds i8, ptr %56, i32 1
  store ptr %57, ptr @lp, align 8, !tbaa !5
  br label %18, !llvm.loop !14

58:                                               ; preds = %30
  %59 = load ptr, ptr @lp, align 8, !tbaa !5
  %60 = load i8, ptr %59, align 1, !tbaa !9
  %61 = sext i8 %60 to i32
  %62 = load i8, ptr %1, align 1, !tbaa !9
  %63 = sext i8 %62 to i32
  %64 = icmp ne i32 %61, %63
  br i1 %64, label %65, label %68

65:                                               ; preds = %58
  %66 = load i8, ptr %1, align 1, !tbaa !9
  %67 = sext i8 %66 to i32
  call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef @.str.50, i32 noundef %67)
  br label %68

68:                                               ; preds = %65, %58
  %69 = load i32, ptr %4, align 4, !tbaa !12
  %70 = mul nsw i32 %69, 6
  %71 = sub nsw i32 36, %70
  %72 = load i64, ptr %3, align 8, !tbaa !10
  %73 = zext i32 %71 to i64
  %74 = shl i64 %72, %73
  store i64 %74, ptr %3, align 8, !tbaa !10
  %75 = load i64, ptr %3, align 8, !tbaa !10
  %76 = icmp ne i64 %75, 0
  br i1 %76, label %77, label %79

77:                                               ; preds = %68
  %78 = load i64, ptr %3, align 8, !tbaa !10
  call void @putv(i64 noundef %78, i32 noundef 0)
  br label %79

79:                                               ; preds = %77, %68
  store i32 0, ptr %5, align 4
  br label %80

80:                                               ; preds = %79, %16
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %2) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %1) #3
  %81 = load i32, ptr %5, align 4
  switch i32 %81, label %83 [
    i32 0, label %82
    i32 1, label %82
  ]

82:                                               ; preds = %80, %80
  ret void

83:                                               ; preds = %80
  unreachable
}

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" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"long", !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"

@lp = external dso_local local_unnamed_addr global ptr, align 8
@.str.49 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.50 = external hidden unnamed_addr constant [21 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @err(i32 noundef, ptr noundef, ...) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @putv(i64 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @skipwhite() local_unnamed_addr #0

declare signext i8 @ascii2sixbit(i8 noundef signext) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @sixbitOp() local_unnamed_addr #0 {
  tail call void @skipwhite()
  %1 = load ptr, ptr @lp, align 8, !tbaa !5
  %2 = getelementptr inbounds i8, ptr %1, i64 1
  store ptr %2, ptr @lp, align 8, !tbaa !5
  %3 = load i8, ptr %1, align 1, !tbaa !9
  %4 = sext i8 %3 to i32
  switch i8 %3, label %.preheader [
    i8 59, label %.sink.split
    i8 0, label %.sink.split
  ]

.preheader:                                       ; preds = %0
  %5 = load i8, ptr %2, align 1, !tbaa !9
  %.not25 = icmp eq i8 %5, 0
  %.not2226 = icmp eq i8 %5, %3
  %or.cond27 = or i1 %.not25, %.not2226
  br i1 %or.cond27, label %.critedge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader, %20
  %6 = phi i8 [ %23, %20 ], [ %5, %.preheader ]
  %.029 = phi i32 [ %.1, %20 ], [ 0, %.preheader ]
  %.01628 = phi i64 [ %.117, %20 ], [ 0, %.preheader ]
  %7 = tail call signext i8 @ascii2sixbit(i8 noundef signext %6) #2
  %8 = icmp slt i8 %7, 0
  br i1 %8, label %9, label %13

9:                                                ; preds = %.lr.ph
  %10 = load ptr, ptr @lp, align 8, !tbaa !5
  %11 = load i8, ptr %10, align 1, !tbaa !9
  %12 = sext i8 %11 to i32
  tail call void (i32, ptr, ...) @err(i32 noundef 0, ptr noundef nonnull @.str.49, i32 noundef %12)
  br label %20

13:                                               ; preds = %.lr.ph
  %14 = shl i64 %.01628, 6
  %15 = zext nneg i8 %7 to i64
  %16 = or i64 %14, %15
  %17 = add nsw i32 %.029, 1
  %18 = icmp eq i32 %17, 6
  br i1 %18, label %19, label %20

19:                                               ; preds = %13
  tail call void @putv(i64 noundef %16, i32 noundef 0)
  br label %20

20:                                               ; preds = %13, %19, %9
  %.117 = phi i64 [ %.01628, %9 ], [ 0, %19 ], [ %16, %13 ]
  %.1 = phi i32 [ %.029, %9 ], [ 0, %19 ], [ %17, %13 ]
  %21 = load ptr, ptr @lp, align 8, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %21, i64 1
  store ptr %22, ptr @lp, align 8, !tbaa !5
  %23 = load i8, ptr %22, align 1, !tbaa !9
  %.not = icmp eq i8 %23, 0
  %.not22 = icmp eq i8 %23, %3
  %or.cond = or i1 %.not, %.not22
  br i1 %or.cond, label %.critedge.loopexit, label %.lr.ph, !llvm.loop !10

.critedge.loopexit:                               ; preds = %20
  %24 = mul i32 %.1, -6
  %25 = add i32 %24, 36
  %26 = zext nneg i32 %25 to i64
  br i1 %.not22, label %28, label %27

.critedge:                                        ; preds = %.preheader
  br i1 %.not2226, label %28, label %27

27:                                               ; preds = %.critedge.loopexit, %.critedge
  %.0.lcssa35 = phi i64 [ %26, %.critedge.loopexit ], [ 36, %.critedge ]
  %.016.lcssa33 = phi i64 [ %.117, %.critedge.loopexit ], [ 0, %.critedge ]
  tail call void (i32, ptr, ...) @err(i32 noundef 1, ptr noundef nonnull @.str.50, i32 noundef %4)
  br label %28

28:                                               ; preds = %.critedge.loopexit, %27, %.critedge
  %.0.lcssa36 = phi i64 [ %26, %.critedge.loopexit ], [ %.0.lcssa35, %27 ], [ 36, %.critedge ]
  %.016.lcssa34 = phi i64 [ %.117, %.critedge.loopexit ], [ %.016.lcssa33, %27 ], [ 0, %.critedge ]
  %29 = shl i64 %.016.lcssa34, %.0.lcssa36
  %.not24 = icmp eq i64 %29, 0
  br i1 %.not24, label %30, label %.sink.split

.sink.split:                                      ; preds = %28, %0, %0
  %.sink = phi i64 [ 0, %0 ], [ 0, %0 ], [ %29, %28 ]
  tail call void @putv(i64 noundef %.sink, i32 noundef 0)
  br label %30

30:                                               ; preds = %.sink.split, %28
  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" }
attributes #1 = { "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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass