; LLVM IR from yangfengzzz/DigitalVox4 :: editor (imgui_node_editor)

; 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 i32 @_ZN3vox10NodeEditor6Detail10SizeAction12ChooseCursorENS1_10NodeRegionE(ptr noundef nonnull align 8 dereferenceable(96) %0, i8 noundef zeroext %1) #0 align 2 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i8, align 1
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i8 %1, ptr %5, align 1, !tbaa !9
  %6 = load ptr, ptr %4, align 8
  %7 = load i8, ptr %5, align 1, !tbaa !9
  switch i8 %7, label %8 [
    i8 16, label %9
    i8 1, label %10
    i8 2, label %10
    i8 4, label %11
    i8 8, label %11
    i8 5, label %12
    i8 10, label %12
    i8 9, label %13
    i8 6, label %13
  ]

8:                                                ; preds = %2
  br label %9

9:                                                ; preds = %8, %2
  store i32 0, ptr %3, align 4
  br label %14

10:                                               ; preds = %2, %2
  store i32 3, ptr %3, align 4
  br label %14

11:                                               ; preds = %2, %2
  store i32 4, ptr %3, align 4
  br label %14

12:                                               ; preds = %2, %2
  store i32 6, ptr %3, align 4
  br label %14

13:                                               ; preds = %2, %2
  store i32 5, ptr %3, align 4
  br label %14

14:                                               ; preds = %13, %12, %11, %10, %9
  %15 = load i32, ptr %3, align 4
  ret i32 %15
}

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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"_ZTSN3vox10NodeEditor6Detail10NodeRegionE", !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"

@switch.table._ZN3vox10NodeEditor6Detail10SizeAction12ChooseCursorENS1_10NodeRegionE = private unnamed_addr constant [10 x i32] [i32 3, i32 3, i32 0, i32 4, i32 6, i32 5, i32 0, i32 4, i32 5, i32 6], align 4

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(none) uwtable
define dso_local noundef range(i32 0, 7) i32 @_ZN3vox10NodeEditor6Detail10SizeAction12ChooseCursorENS1_10NodeRegionE(ptr nocapture noundef nonnull readnone align 8 dereferenceable(96) %0, i8 noundef zeroext %1) local_unnamed_addr #0 align 2 {
  %switch.tableidx = add i8 %1, -1
  %3 = icmp ult i8 %switch.tableidx, 10
  br i1 %3, label %switch.lookup, label %5

switch.lookup:                                    ; preds = %2
  %4 = zext nneg i8 %switch.tableidx to i64
  %switch.gep = getelementptr inbounds [10 x i32], ptr @switch.table._ZN3vox10NodeEditor6Detail10SizeAction12ChooseCursorENS1_10NodeRegionE, i64 0, i64 %4
  %switch.load = load i32, ptr %switch.gep, align 4
  br label %5

5:                                                ; preds = %switch.lookup, %2
  %.0 = phi i32 [ 0, %2 ], [ %switch.load, %switch.lookup ]
  ret i32 %.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: GlobalOptPass,IPSCCPPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass