; LLVM IR from alibaba/GCanvas :: core/src/support/Value.ll (ZN8PalValue5clearEv)

; 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.PalValue = type <{ %union.anon, i32, [4 x i8] }>
%union.anon = type { double }

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN8PalValue5clearEv(ptr noundef nonnull align 8 dereferenceable(12) %0) #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.PalValue, ptr %3, i32 0, i32 1
  %5 = load i32, ptr %4, align 8, !tbaa !9
  switch i32 %5, label %52 [
    i32 1, label %6
    i32 2, label %8
    i32 3, label %10
    i32 4, label %12
    i32 5, label %14
    i32 6, label %16
    i32 7, label %25
    i32 8, label %34
    i32 9, label %43
  ]

6:                                                ; preds = %1
  %7 = getelementptr inbounds %class.PalValue, ptr %3, i32 0, i32 0
  store i8 0, ptr %7, align 8, !tbaa !12
  br label %53

8:                                                ; preds = %1
  %9 = getelementptr inbounds %class.PalValue, ptr %3, i32 0, i32 0
  store i32 0, ptr %9, align 8, !tbaa !12
  br label %53

10:                                               ; preds = %1
  %11 = getelementptr inbounds %class.PalValue, ptr %3, i32 0, i32 0
  store float 0.000000e+00, ptr %11, align 8, !tbaa !12
  br label %53

12:                                               ; preds = %1
  %13 = getelementptr inbounds %class.PalValue, ptr %3, i32 0, i32 0
  store double 0.000000e+00, ptr %13, align 8, !tbaa !12
  br label %53

14:                                               ; preds = %1
  %15 = getelementptr inbounds %class.PalValue, ptr %3, i32 0, i32 0
  store i8 0, ptr %15, align 8, !tbaa !12
  br label %53

16:                                               ; preds = %1
  br label %17

17:                                               ; preds = %16
  %18 = getelementptr inbounds %class.PalValue, ptr %3, i32 0, i32 0
  %19 = load ptr, ptr %18, align 8, !tbaa !12
  %20 = icmp eq ptr %19, null
  br i1 %20, label %22, label %21

21:                                               ; preds = %17
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %19) #2
  call void @_ZdlPvm(ptr noundef %19, i64 noundef 32) #3
  br label %22

22:                                               ; preds = %21, %17
  %23 = getelementptr inbounds %class.PalValue, ptr %3, i32 0, i32 0
  store ptr null, ptr %23, align 8, !tbaa !12
  br label %24

24:                                               ; preds = %22
  br label %53

25:                                               ; preds = %1
  br label %26

26:                                               ; preds = %25
  %27 = getelementptr inbounds %class.PalValue, ptr %3, i32 0, i32 0
  %28 = load ptr, ptr %27, align 8, !tbaa !12
  %29 = icmp eq ptr %28, null
  br i1 %29, label %31, label %30

30:                                               ; preds = %26
  call void @_ZNSt6vectorI8PalValueSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %28) #2
  call void @_ZdlPvm(ptr noundef %28, i64 noundef 24) #3
  br label %31

31:                                               ; preds = %30, %26
  %32 = getelementptr inbounds %class.PalValue, ptr %3, i32 0, i32 0
  store ptr null, ptr %32, align 8, !tbaa !12
  br label %33

33:                                               ; preds = %31
  br label %53

34:                                               ; preds = %1
  br label %35

35:                                               ; preds = %34
  %36 = getelementptr inbounds %class.PalValue, ptr %3, i32 0, i32 0
  %37 = load ptr, ptr %36, align 8, !tbaa !12
  %38 = icmp eq ptr %37, null
  br i1 %38, label %40, label %39

39:                                               ; preds = %35
  call void @_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE8PalValueSt4lessIS5_ESaISt4pairIKS5_S6_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %37) #2
  call void @_ZdlPvm(ptr noundef %37, i64 noundef 48) #3
  br label %40

40:                                               ; preds = %39, %35
  %41 = getelementptr inbounds %class.PalValue, ptr %3, i32 0, i32 0
  store ptr null, ptr %41, align 8, !tbaa !12
  br label %42

42:                                               ; preds = %40
  br label %53

43:                                               ; preds = %1
  br label %44

44:                                               ; preds = %43
  %45 = getelementptr inbounds %class.PalValue, ptr %3, i32 0, i32 0
  %46 = load ptr, ptr %45, align 8, !tbaa !12
  %47 = icmp eq ptr %46, null
  br i1 %47, label %49, label %48

48:                                               ; preds = %44
  call void @_ZNSt3mapIi8PalValueSt4lessIiESaISt4pairIKiS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %46) #2
  call void @_ZdlPvm(ptr noundef %46, i64 noundef 48) #3
  br label %49

49:                                               ; preds = %48, %44
  %50 = getelementptr inbounds %class.PalValue, ptr %3, i32 0, i32 0
  store ptr null, ptr %50, align 8, !tbaa !12
  br label %51

51:                                               ; preds = %49
  br label %53

52:                                               ; preds = %1
  br label %53

53:                                               ; preds = %52, %51, %42, %33, %24, %14, %12, %10, %8, %6
  %54 = getelementptr inbounds %class.PalValue, ptr %3, i32 0, i32 1
  store i32 0, ptr %54, align 8, !tbaa !9
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorI8PalValueSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE8PalValueSt4lessIS5_ESaISt4pairIKS5_S6_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3mapIi8PalValueSt4lessIiESaISt4pairIKiS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #0 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 = { 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 #2 = { nounwind }
attributes #3 = { 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, !11, i64 8}
!10 = !{!"_ZTS8PalValue", !7, i64 0, !11, i64 8}
!11 = !{!"_ZTSN8PalValue4TypeE", !7, i64 0}
!12 = !{!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"

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN8PalValue5clearEv(ptr nocapture noundef nonnull align 8 dereferenceable(12) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 8
  %3 = load i32, ptr %2, align 8, !tbaa !5
  switch i32 %3, label %29 [
    i32 1, label %4
    i32 2, label %5
    i32 3, label %6
    i32 4, label %7
    i32 5, label %8
    i32 6, label %9
    i32 7, label %14
    i32 8, label %19
    i32 9, label %24
  ]

4:                                                ; preds = %1
  store i8 0, ptr %0, align 8, !tbaa !10
  br label %29

5:                                                ; preds = %1
  store i32 0, ptr %0, align 8, !tbaa !10
  br label %29

6:                                                ; preds = %1
  store float 0.000000e+00, ptr %0, align 8, !tbaa !10
  br label %29

7:                                                ; preds = %1
  store double 0.000000e+00, ptr %0, align 8, !tbaa !10
  br label %29

8:                                                ; preds = %1
  store i8 0, ptr %0, align 8, !tbaa !10
  br label %29

9:                                                ; preds = %1
  %10 = load ptr, ptr %0, align 8, !tbaa !10
  %11 = icmp eq ptr %10, null
  br i1 %11, label %13, label %12

12:                                               ; preds = %9
  tail call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #2
  tail call void @_ZdlPvm(ptr noundef nonnull %10, i64 noundef 32) #3
  br label %13

13:                                               ; preds = %12, %9
  store ptr null, ptr %0, align 8, !tbaa !10
  br label %29

14:                                               ; preds = %1
  %15 = load ptr, ptr %0, align 8, !tbaa !10
  %16 = icmp eq ptr %15, null
  br i1 %16, label %18, label %17

17:                                               ; preds = %14
  tail call void @_ZNSt6vectorI8PalValueSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %15) #2
  tail call void @_ZdlPvm(ptr noundef nonnull %15, i64 noundef 24) #3
  br label %18

18:                                               ; preds = %17, %14
  store ptr null, ptr %0, align 8, !tbaa !10
  br label %29

19:                                               ; preds = %1
  %20 = load ptr, ptr %0, align 8, !tbaa !10
  %21 = icmp eq ptr %20, null
  br i1 %21, label %23, label %22

22:                                               ; preds = %19
  tail call void @_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE8PalValueSt4lessIS5_ESaISt4pairIKS5_S6_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %20) #2
  tail call void @_ZdlPvm(ptr noundef nonnull %20, i64 noundef 48) #3
  br label %23

23:                                               ; preds = %22, %19
  store ptr null, ptr %0, align 8, !tbaa !10
  br label %29

24:                                               ; preds = %1
  %25 = load ptr, ptr %0, align 8, !tbaa !10
  %26 = icmp eq ptr %25, null
  br i1 %26, label %28, label %27

27:                                               ; preds = %24
  tail call void @_ZNSt3mapIi8PalValueSt4lessIiESaISt4pairIKiS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %25) #2
  tail call void @_ZdlPvm(ptr noundef nonnull %25, i64 noundef 48) #3
  br label %28

28:                                               ; preds = %27, %24
  store ptr null, ptr %0, align 8, !tbaa !10
  br label %29

29:                                               ; preds = %1, %28, %23, %18, %13, %8, %7, %6, %5, %4
  store i32 0, ptr %2, align 8, !tbaa !5
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorI8PalValueSaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE8PalValueSt4lessIS5_ESaISt4pairIKS5_S6_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3mapIi8PalValueSt4lessIiESaISt4pairIKiS0_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #0 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 = { 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 #2 = { nounwind }
attributes #3 = { 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, !9, i64 8}
!6 = !{!"_ZTS8PalValue", !7, i64 0, !9, i64 8}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!"_ZTSN8PalValue4TypeE", !7, i64 0}
!10 = !{!7, !7, i64 0}


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