; LLVM IR from sfu-dis/mosaicdb :: benchmarks/egen/MEETickerTape.ll (ZN4TPCE14CMEETickerTape24ConvertTradeTypeIdToEnumEPc)

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

@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [84 x i8], align 1
@__PRETTY_FUNCTION__._ZN4TPCE14CMEETickerTape24ConvertTradeTypeIdToEnumEPc = external hidden unnamed_addr constant [68 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i32 @_ZN4TPCE14CMEETickerTape24ConvertTradeTypeIdToEnumEPc(ptr noundef nonnull align 8 dereferenceable(22504) %0, ptr noundef %1) #0 align 2 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %6 = load ptr, ptr %4, align 8
  %7 = load ptr, ptr %5, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %7, i64 0
  %9 = load i8, ptr %8, align 1, !tbaa !9
  %10 = sext i8 %9 to i32
  switch i32 %10, label %44 [
    i32 84, label %11
  ]

11:                                               ; preds = %2
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %12, i64 1
  %14 = load i8, ptr %13, align 1, !tbaa !9
  %15 = sext i8 %14 to i32
  switch i32 %15, label %42 [
    i32 76, label %16
    i32 77, label %25
    i32 83, label %34
  ]

16:                                               ; preds = %11
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %17, i64 2
  %19 = load i8, ptr %18, align 1, !tbaa !9
  %20 = sext i8 %19 to i32
  switch i32 %20, label %23 [
    i32 66, label %21
    i32 83, label %22
  ]

21:                                               ; preds = %16
  store i32 4, ptr %3, align 4
  br label %46

22:                                               ; preds = %16
  store i32 3, ptr %3, align 4
  br label %46

23:                                               ; preds = %16
  br label %24

24:                                               ; preds = %23
  br label %43

25:                                               ; preds = %11
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = getelementptr inbounds i8, ptr %26, i64 2
  %28 = load i8, ptr %27, align 1, !tbaa !9
  %29 = sext i8 %28 to i32
  switch i32 %29, label %32 [
    i32 66, label %30
    i32 83, label %31
  ]

30:                                               ; preds = %25
  store i32 0, ptr %3, align 4
  br label %46

31:                                               ; preds = %25
  store i32 1, ptr %3, align 4
  br label %46

32:                                               ; preds = %25
  br label %33

33:                                               ; preds = %32
  br label %43

34:                                               ; preds = %11
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = getelementptr inbounds i8, ptr %35, i64 2
  %37 = load i8, ptr %36, align 1, !tbaa !9
  %38 = sext i8 %37 to i32
  switch i32 %38, label %40 [
    i32 76, label %39
  ]

39:                                               ; preds = %34
  store i32 2, ptr %3, align 4
  br label %46

40:                                               ; preds = %34
  br label %41

41:                                               ; preds = %40
  br label %43

42:                                               ; preds = %11
  br label %43

43:                                               ; preds = %42, %41, %33, %24
  br label %45

44:                                               ; preds = %2
  br label %45

45:                                               ; preds = %44, %43
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 295, ptr noundef @__PRETTY_FUNCTION__._ZN4TPCE14CMEETickerTape24ConvertTradeTypeIdToEnumEPc) #2
  unreachable

46:                                               ; preds = %39, %31, %30, %22, %21
  %47 = load i32, ptr %3, align 4
  ret i32 %47
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

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" }
attributes #1 = { noreturn 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 #2 = { noreturn 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++ TBAA"}
!9 = !{!7, !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"

@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [84 x i8], align 1
@__PRETTY_FUNCTION__._ZN4TPCE14CMEETickerTape24ConvertTradeTypeIdToEnumEPc = external hidden unnamed_addr constant [68 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef range(i32 0, 5) i32 @_ZN4TPCE14CMEETickerTape24ConvertTradeTypeIdToEnumEPc(ptr nocapture noundef nonnull readnone align 8 dereferenceable(22504) %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 align 2 {
  %3 = load i8, ptr %1, align 1, !tbaa !5
  %cond = icmp eq i8 %3, 84
  br i1 %cond, label %4, label %18

4:                                                ; preds = %2
  %5 = getelementptr inbounds i8, ptr %1, i64 1
  %6 = load i8, ptr %5, align 1, !tbaa !5
  switch i8 %6, label %18 [
    i8 76, label %7
    i8 77, label %11
    i8 83, label %15
  ]

7:                                                ; preds = %4
  %8 = getelementptr inbounds i8, ptr %1, i64 2
  %9 = load i8, ptr %8, align 1, !tbaa !5
  switch i8 %9, label %18 [
    i8 66, label %19
    i8 83, label %10
  ]

10:                                               ; preds = %7
  br label %19

11:                                               ; preds = %4
  %12 = getelementptr inbounds i8, ptr %1, i64 2
  %13 = load i8, ptr %12, align 1, !tbaa !5
  switch i8 %13, label %18 [
    i8 66, label %19
    i8 83, label %14
  ]

14:                                               ; preds = %11
  br label %19

15:                                               ; preds = %4
  %16 = getelementptr inbounds i8, ptr %1, i64 2
  %17 = load i8, ptr %16, align 1, !tbaa !5
  %cond1 = icmp eq i8 %17, 76
  br i1 %cond1, label %19, label %18

18:                                               ; preds = %2, %7, %11, %15, %4
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 295, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN4TPCE14CMEETickerTape24ConvertTradeTypeIdToEnumEPc) #2
  unreachable

19:                                               ; preds = %15, %11, %7, %14, %10
  %.0 = phi i32 [ 1, %14 ], [ 3, %10 ], [ 4, %7 ], [ 0, %11 ], [ 2, %15 ]
  ret i32 %.0
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

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" }
attributes #1 = { noreturn 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 #2 = { noreturn 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++ TBAA"}


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