; LLVM IR from aap/pdp6 :: fe6 (fe)

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

@tyo.alt = external hidden global ptr, align 8
@tyo.ctrl = external hidden global ptr, align 8

declare i64 @write(i32 noundef, ptr noundef, i64 noundef) #0

; Function Attrs: nounwind uwtable
define dso_local void @tyo(i8 noundef signext %0) #1 {
  %2 = alloca i8, align 1
  store i8 %0, ptr %2, align 1, !tbaa !5
  %3 = load i8, ptr %2, align 1, !tbaa !5
  %4 = sext i8 %3 to i32
  %5 = icmp slt i32 %4, 32
  br i1 %5, label %6, label %29

6:                                                ; preds = %1
  %7 = load i8, ptr %2, align 1, !tbaa !5
  %8 = sext i8 %7 to i32
  switch i32 %8, label %18 [
    i32 27, label %9
    i32 10, label %14
    i32 13, label %16
    i32 8, label %16
    i32 9, label %16
  ]

9:                                                ; preds = %6
  %10 = load ptr, ptr @tyo.alt, align 8, !tbaa !8
  %11 = load ptr, ptr @tyo.alt, align 8, !tbaa !8
  %12 = call i64 @strlen(ptr noundef %11) #3
  %13 = call i64 @write(i32 noundef 1, ptr noundef %10, i64 noundef %12)
  br label %31

14:                                               ; preds = %6
  %15 = call i64 @write(i32 noundef 1, ptr noundef %2, i64 noundef 1)
  store i8 13, ptr %2, align 1, !tbaa !5
  br label %16

16:                                               ; preds = %14, %6, %6, %6
  %17 = call i64 @write(i32 noundef 1, ptr noundef %2, i64 noundef 1)
  br label %28

18:                                               ; preds = %6
  %19 = load ptr, ptr @tyo.ctrl, align 8, !tbaa !8
  %20 = load ptr, ptr @tyo.ctrl, align 8, !tbaa !8
  %21 = call i64 @strlen(ptr noundef %20) #3
  %22 = call i64 @write(i32 noundef 1, ptr noundef %19, i64 noundef %21)
  %23 = load i8, ptr %2, align 1, !tbaa !5
  %24 = sext i8 %23 to i32
  %25 = add nsw i32 %24, 64
  %26 = trunc i32 %25 to i8
  store i8 %26, ptr %2, align 1, !tbaa !5
  %27 = call i64 @write(i32 noundef 1, ptr noundef %2, i64 noundef 1)
  br label %28

28:                                               ; preds = %18, %16
  br label %31

29:                                               ; preds = %1
  %30 = call i64 @write(i32 noundef 1, ptr noundef %2, i64 noundef 1)
  br label %31

31:                                               ; preds = %29, %28, %9
  ret void
}

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #2

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" }
attributes #2 = { nounwind willreturn memory(read) "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 willreturn memory(read) }

!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"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, 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"

@tyo.alt = external hidden local_unnamed_addr global ptr, align 8
@tyo.ctrl = external hidden local_unnamed_addr global ptr, align 8

; Function Attrs: nofree
declare noundef i64 @write(i32 noundef, ptr nocapture noundef readonly, i64 noundef) local_unnamed_addr #0

; Function Attrs: nofree nounwind uwtable
define dso_local void @tyo(i8 noundef signext %0) local_unnamed_addr #1 {
  %2 = alloca i8, align 1
  store i8 %0, ptr %2, align 1, !tbaa !5
  %3 = icmp slt i8 %0, 32
  br i1 %3, label %4, label %19

4:                                                ; preds = %1
  switch i8 %0, label %13 [
    i8 27, label %5
    i8 10, label %9
    i8 13, label %11
    i8 8, label %11
    i8 9, label %11
  ]

5:                                                ; preds = %4
  %6 = load ptr, ptr @tyo.alt, align 8, !tbaa !8
  %7 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %6) #3
  %8 = tail call i64 @write(i32 noundef 1, ptr noundef %6, i64 noundef %7) #4
  br label %21

9:                                                ; preds = %4
  %10 = call i64 @write(i32 noundef 1, ptr noundef nonnull %2, i64 noundef 1) #4
  store i8 13, ptr %2, align 1, !tbaa !5
  br label %11

11:                                               ; preds = %9, %4, %4, %4
  %12 = call i64 @write(i32 noundef 1, ptr noundef nonnull %2, i64 noundef 1) #4
  br label %21

13:                                               ; preds = %4
  %14 = load ptr, ptr @tyo.ctrl, align 8, !tbaa !8
  %15 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %14) #3
  %16 = tail call i64 @write(i32 noundef 1, ptr noundef %14, i64 noundef %15) #4
  %17 = add nsw i8 %0, 64
  store i8 %17, ptr %2, align 1, !tbaa !5
  %18 = call i64 @write(i32 noundef 1, ptr noundef nonnull %2, i64 noundef 1) #4
  br label %21

19:                                               ; preds = %1
  %20 = call i64 @write(i32 noundef 1, ptr noundef nonnull %2, i64 noundef 1) #4
  br label %21

21:                                               ; preds = %11, %13, %19, %5
  ret void
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #2

attributes #0 = { nofree "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" }
attributes #2 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 willreturn memory(read) }
attributes #4 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SimplifyCFGPass,TailCallElimPass