; LLVM IR from Izaron/ACM-ICPC :: Timus Online Judge/Volume 11/2029. Towers of Hanoi Strike Back.ll (Z6getOthcc)

; 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: mustprogress nounwind uwtable
define dso_local noundef signext i8 @_Z6getOthcc(i8 noundef signext %0, i8 noundef signext %1) #0 {
  %3 = alloca i8, align 1
  %4 = alloca i8, align 1
  %5 = alloca i8, align 1
  store i8 %0, ptr %4, align 1, !tbaa !5
  store i8 %1, ptr %5, align 1, !tbaa !5
  %6 = load i8, ptr %4, align 1, !tbaa !5
  %7 = sext i8 %6 to i32
  %8 = icmp ne i32 65, %7
  br i1 %8, label %9, label %14

9:                                                ; preds = %2
  %10 = load i8, ptr %5, align 1, !tbaa !5
  %11 = sext i8 %10 to i32
  %12 = icmp ne i32 65, %11
  br i1 %12, label %13, label %14

13:                                               ; preds = %9
  store i8 65, ptr %3, align 1
  br label %33

14:                                               ; preds = %9, %2
  %15 = load i8, ptr %4, align 1, !tbaa !5
  %16 = sext i8 %15 to i32
  %17 = icmp ne i32 66, %16
  br i1 %17, label %18, label %23

18:                                               ; preds = %14
  %19 = load i8, ptr %5, align 1, !tbaa !5
  %20 = sext i8 %19 to i32
  %21 = icmp ne i32 66, %20
  br i1 %21, label %22, label %23

22:                                               ; preds = %18
  store i8 66, ptr %3, align 1
  br label %33

23:                                               ; preds = %18, %14
  %24 = load i8, ptr %4, align 1, !tbaa !5
  %25 = sext i8 %24 to i32
  %26 = icmp ne i32 67, %25
  br i1 %26, label %27, label %32

27:                                               ; preds = %23
  %28 = load i8, ptr %5, align 1, !tbaa !5
  %29 = sext i8 %28 to i32
  %30 = icmp ne i32 67, %29
  br i1 %30, label %31, label %32

31:                                               ; preds = %27
  store i8 67, ptr %3, align 1
  br label %33

32:                                               ; preds = %27, %23
  unreachable

33:                                               ; preds = %31, %22, %13
  %34 = load i8, ptr %3, align 1
  ret i8 %34
}

attributes #0 = { mustprogress 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++ TBAA"}


; 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: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local noundef signext range(i8 65, 68) i8 @_Z6getOthcc(i8 noundef signext %0, i8 noundef signext %1) local_unnamed_addr #0 {
  %3 = icmp ne i8 %0, 65
  %4 = icmp ne i8 %1, 65
  %or.cond = and i1 %3, %4
  %5 = icmp ne i8 %0, 66
  %6 = icmp ne i8 %1, 66
  %or.cond5 = and i1 %5, %6
  %spec.select = select i1 %or.cond5, i8 66, i8 67
  %.0 = select i1 %or.cond, i8 65, i8 %spec.select
  ret i8 %.0
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(none) 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,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass