; LLVM IR from thepowersgang/mrustc :: src/parse/interpolated_fragment.ll (ZN20InterpolatedFragmentD2Ev)

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

%class.InterpolatedFragment = type { i32, ptr }

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN20InterpolatedFragmentD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %0) unnamed_addr #0 align 2 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8
  %4 = getelementptr inbounds %class.InterpolatedFragment, ptr %3, i32 0, i32 1
  %5 = load ptr, ptr %4, align 8, !tbaa !9
  %6 = icmp ne ptr %5, null
  br i1 %6, label %7, label %71

7:                                                ; preds = %1
  %8 = getelementptr inbounds %class.InterpolatedFragment, ptr %3, i32 0, i32 0
  %9 = load i32, ptr %8, align 8, !tbaa !12
  switch i32 %9, label %70 [
    i32 0, label %10
    i32 1, label %19
    i32 2, label %28
    i32 3, label %37
    i32 4, label %43
    i32 5, label %43
    i32 6, label %43
    i32 7, label %52
    i32 8, label %58
    i32 9, label %64
  ]

10:                                               ; preds = %7
  %11 = getelementptr inbounds %class.InterpolatedFragment, ptr %3, i32 0, i32 1
  %12 = load ptr, ptr %11, align 8, !tbaa !9
  %13 = icmp eq ptr %12, null
  br i1 %13, label %18, label %14

14:                                               ; preds = %10
  %15 = load ptr, ptr %12, align 8, !tbaa !13
  %16 = getelementptr inbounds ptr, ptr %15, i64 1
  %17 = load ptr, ptr %16, align 8
  call void %17(ptr noundef nonnull align 8 dereferenceable(136) %12) #4
  br label %18

18:                                               ; preds = %14, %10
  br label %70

19:                                               ; preds = %7
  %20 = getelementptr inbounds %class.InterpolatedFragment, ptr %3, i32 0, i32 1
  %21 = load ptr, ptr %20, align 8, !tbaa !9
  %22 = icmp eq ptr %21, null
  br i1 %22, label %27, label %23

23:                                               ; preds = %19
  %24 = load ptr, ptr %21, align 8, !tbaa !13
  %25 = getelementptr inbounds ptr, ptr %24, i64 1
  %26 = load ptr, ptr %25, align 8
  call void %26(ptr noundef nonnull align 8 dereferenceable(544) %21) #4
  br label %27

27:                                               ; preds = %23, %19
  br label %70

28:                                               ; preds = %7
  %29 = getelementptr inbounds %class.InterpolatedFragment, ptr %3, i32 0, i32 1
  %30 = load ptr, ptr %29, align 8, !tbaa !9
  %31 = icmp eq ptr %30, null
  br i1 %31, label %36, label %32

32:                                               ; preds = %28
  %33 = load ptr, ptr %30, align 8, !tbaa !13
  %34 = getelementptr inbounds ptr, ptr %33, i64 1
  %35 = load ptr, ptr %34, align 8
  call void %35(ptr noundef nonnull align 8 dereferenceable(240) %30) #4
  br label %36

36:                                               ; preds = %32, %28
  br label %70

37:                                               ; preds = %7
  %38 = getelementptr inbounds %class.InterpolatedFragment, ptr %3, i32 0, i32 1
  %39 = load ptr, ptr %38, align 8, !tbaa !9
  %40 = icmp eq ptr %39, null
  br i1 %40, label %42, label %41

41:                                               ; preds = %37
  call void @_ZN7TypeRefD1Ev(ptr noundef nonnull align 8 dereferenceable(120) %39) #4
  call void @_ZdlPvm(ptr noundef %39, i64 noundef 120) #5
  br label %42

42:                                               ; preds = %41, %37
  br label %70

43:                                               ; preds = %7, %7, %7
  %44 = getelementptr inbounds %class.InterpolatedFragment, ptr %3, i32 0, i32 1
  %45 = load ptr, ptr %44, align 8, !tbaa !9
  %46 = icmp eq ptr %45, null
  br i1 %46, label %51, label %47

47:                                               ; preds = %43
  %48 = load ptr, ptr %45, align 8, !tbaa !13
  %49 = getelementptr inbounds ptr, ptr %48, i64 1
  %50 = load ptr, ptr %49, align 8
  call void %50(ptr noundef nonnull align 8 dereferenceable(40) %45) #4
  br label %51

51:                                               ; preds = %47, %43
  br label %70

52:                                               ; preds = %7
  %53 = getelementptr inbounds %class.InterpolatedFragment, ptr %3, i32 0, i32 1
  %54 = load ptr, ptr %53, align 8, !tbaa !9
  %55 = icmp eq ptr %54, null
  br i1 %55, label %57, label %56

56:                                               ; preds = %52
  call void @_ZN3AST9AttributeD2Ev(ptr noundef nonnull align 8 dereferenceable(169) %54) #4
  call void @_ZdlPvm(ptr noundef %54, i64 noundef 176) #5
  br label %57

57:                                               ; preds = %56, %52
  br label %70

58:                                               ; preds = %7
  %59 = getelementptr inbounds %class.InterpolatedFragment, ptr %3, i32 0, i32 1
  %60 = load ptr, ptr %59, align 8, !tbaa !9
  %61 = icmp eq ptr %60, null
  br i1 %61, label %63, label %62

62:                                               ; preds = %58
  call void @_ZN3AST5NamedINS_4ItemEED2Ev(ptr noundef nonnull align 8 dereferenceable(568) %60) #4
  call void @_ZdlPvm(ptr noundef %60, i64 noundef 568) #5
  br label %63

63:                                               ; preds = %62, %58
  br label %70

64:                                               ; preds = %7
  %65 = getelementptr inbounds %class.InterpolatedFragment, ptr %3, i32 0, i32 1
  %66 = load ptr, ptr %65, align 8, !tbaa !9
  %67 = icmp eq ptr %66, null
  br i1 %67, label %69, label %68

68:                                               ; preds = %64
  call void @_ZN3AST10VisibilityD2Ev(ptr noundef nonnull align 8 dereferenceable(36) %66) #4
  call void @_ZdlPvm(ptr noundef %66, i64 noundef 40) #5
  br label %69

69:                                               ; preds = %68, %64
  br label %70

70:                                               ; preds = %69, %63, %57, %51, %42, %36, %27, %18, %7
  br label %71

71:                                               ; preds = %70, %1
  ret void
}

; Function Attrs: nounwind
declare void @_ZN7TypeRefD1Ev(ptr noundef nonnull align 8 dereferenceable(120)) unnamed_addr #1

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3AST9AttributeD2Ev(ptr noundef nonnull align 8 dereferenceable(169)) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3AST5NamedINS_4ItemEED2Ev(ptr noundef nonnull align 8 dereferenceable(568)) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3AST10VisibilityD2Ev(ptr noundef nonnull align 8 dereferenceable(36)) unnamed_addr #3 align 2

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 = { 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 = { nobuiltin 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 #3 = { inlinehint 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 #4 = { nounwind }
attributes #5 = { builtin 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 = !{!10, !6, i64 8}
!10 = !{!"_ZTS20InterpolatedFragment", !11, i64 0, !6, i64 8}
!11 = !{!"_ZTSN20InterpolatedFragment4TypeE", !7, i64 0}
!12 = !{!10, !11, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"vtable pointer", !8, 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"

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN20InterpolatedFragmentD2Ev(ptr nocapture noundef nonnull readonly align 8 dereferenceable(16) %0) unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 8
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %.not = icmp eq ptr %3, null
  br i1 %.not, label %26, label %4

4:                                                ; preds = %1
  %5 = load i32, ptr %0, align 8, !tbaa !11
  switch i32 %5, label %26 [
    i32 0, label %6
    i32 1, label %10
    i32 2, label %14
    i32 3, label %18
    i32 4, label %19
    i32 5, label %19
    i32 6, label %19
    i32 7, label %23
    i32 8, label %24
    i32 9, label %25
  ]

6:                                                ; preds = %4
  %7 = load ptr, ptr %3, align 8, !tbaa !12
  %8 = getelementptr inbounds i8, ptr %7, i64 8
  %9 = load ptr, ptr %8, align 8
  tail call void %9(ptr noundef nonnull align 8 dereferenceable(136) %3) #4
  br label %26

10:                                               ; preds = %4
  %11 = load ptr, ptr %3, align 8, !tbaa !12
  %12 = getelementptr inbounds i8, ptr %11, i64 8
  %13 = load ptr, ptr %12, align 8
  tail call void %13(ptr noundef nonnull align 8 dereferenceable(544) %3) #4
  br label %26

14:                                               ; preds = %4
  %15 = load ptr, ptr %3, align 8, !tbaa !12
  %16 = getelementptr inbounds i8, ptr %15, i64 8
  %17 = load ptr, ptr %16, align 8
  tail call void %17(ptr noundef nonnull align 8 dereferenceable(240) %3) #4
  br label %26

18:                                               ; preds = %4
  tail call void @_ZN7TypeRefD1Ev(ptr noundef nonnull align 8 dereferenceable(120) %3) #4
  tail call void @_ZdlPvm(ptr noundef nonnull %3, i64 noundef 120) #5
  br label %26

19:                                               ; preds = %4, %4, %4
  %20 = load ptr, ptr %3, align 8, !tbaa !12
  %21 = getelementptr inbounds i8, ptr %20, i64 8
  %22 = load ptr, ptr %21, align 8
  tail call void %22(ptr noundef nonnull align 8 dereferenceable(40) %3) #4
  br label %26

23:                                               ; preds = %4
  tail call void @_ZN3AST9AttributeD2Ev(ptr noundef nonnull align 8 dereferenceable(169) %3) #4
  tail call void @_ZdlPvm(ptr noundef nonnull %3, i64 noundef 176) #5
  br label %26

24:                                               ; preds = %4
  tail call void @_ZN3AST5NamedINS_4ItemEED2Ev(ptr noundef nonnull align 8 dereferenceable(568) %3) #4
  tail call void @_ZdlPvm(ptr noundef nonnull %3, i64 noundef 568) #5
  br label %26

25:                                               ; preds = %4
  tail call void @_ZN3AST10VisibilityD2Ev(ptr noundef nonnull align 8 dereferenceable(36) %3) #4
  tail call void @_ZdlPvm(ptr noundef nonnull %3, i64 noundef 40) #5
  br label %26

26:                                               ; preds = %4, %6, %10, %14, %18, %19, %23, %24, %25, %1
  ret void
}

; Function Attrs: nounwind
declare void @_ZN7TypeRefD1Ev(ptr noundef nonnull align 8 dereferenceable(120)) unnamed_addr #1

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3AST9AttributeD2Ev(ptr noundef nonnull align 8 dereferenceable(169)) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3AST5NamedINS_4ItemEED2Ev(ptr noundef nonnull align 8 dereferenceable(568)) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3AST10VisibilityD2Ev(ptr noundef nonnull align 8 dereferenceable(36)) unnamed_addr #3 align 2

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 = { 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 = { nobuiltin 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 #3 = { inlinehint 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 #4 = { nounwind }
attributes #5 = { builtin 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, !10, i64 8}
!6 = !{!"_ZTS20InterpolatedFragment", !7, i64 0, !10, i64 8}
!7 = !{!"_ZTSN20InterpolatedFragment4TypeE", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"vtable pointer", !9, i64 0}


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