; LLVM IR from XiaoMi/mace :: micro/framework (micro_engine)

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

%"struct.micro::MaceMicroEngineConfig" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32 }

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN5micro15MaceMicroEngine15GetEngineConfigEv(ptr noundef nonnull align 8 dereferenceable(9)) #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN5micro28DestroyMicroEngineFromBinaryEPNS_15MaceMicroEngineE(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = call noundef ptr @_ZN5micro15MaceMicroEngine15GetEngineConfigEv(ptr noundef nonnull align 8 dereferenceable(9) %3)
  %5 = getelementptr inbounds %"struct.micro::MaceMicroEngineConfig", ptr %4, i32 0, i32 4
  %6 = load ptr, ptr %5, align 8, !tbaa !9
  %7 = icmp eq ptr %6, null
  br i1 %7, label %9, label %8

8:                                                ; preds = %1
  call void @_ZdaPv(ptr noundef %6) #2
  br label %9

9:                                                ; preds = %8, %1
  %10 = load ptr, ptr %2, align 8, !tbaa !5
  %11 = call noundef ptr @_ZN5micro15MaceMicroEngine15GetEngineConfigEv(ptr noundef nonnull align 8 dereferenceable(9) %10)
  %12 = getelementptr inbounds %"struct.micro::MaceMicroEngineConfig", ptr %11, i32 0, i32 7
  %13 = load ptr, ptr %12, align 8, !tbaa !12
  %14 = icmp eq ptr %13, null
  br i1 %14, label %16, label %15

15:                                               ; preds = %9
  call void @_ZdaPv(ptr noundef %13) #2
  br label %16

16:                                               ; preds = %15, %9
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  %18 = call noundef ptr @_ZN5micro15MaceMicroEngine15GetEngineConfigEv(ptr noundef nonnull align 8 dereferenceable(9) %17)
  %19 = getelementptr inbounds %"struct.micro::MaceMicroEngineConfig", ptr %18, i32 0, i32 5
  %20 = load ptr, ptr %19, align 8, !tbaa !13
  %21 = icmp eq ptr %20, null
  br i1 %21, label %23, label %22

22:                                               ; preds = %16
  call void @_ZdaPv(ptr noundef %20) #2
  br label %23

23:                                               ; preds = %22, %16
  %24 = load ptr, ptr %2, align 8, !tbaa !5
  %25 = call noundef ptr @_ZN5micro15MaceMicroEngine15GetEngineConfigEv(ptr noundef nonnull align 8 dereferenceable(9) %24)
  %26 = getelementptr inbounds %"struct.micro::MaceMicroEngineConfig", ptr %25, i32 0, i32 6
  %27 = load ptr, ptr %26, align 8, !tbaa !14
  %28 = icmp eq ptr %27, null
  br i1 %28, label %30, label %29

29:                                               ; preds = %23
  call void @_ZdaPv(ptr noundef %27) #2
  br label %30

30:                                               ; preds = %29, %23
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  %32 = call noundef ptr @_ZN5micro15MaceMicroEngine15GetEngineConfigEv(ptr noundef nonnull align 8 dereferenceable(9) %31)
  %33 = icmp eq ptr %32, null
  br i1 %33, label %35, label %34

34:                                               ; preds = %30
  call void @_ZdlPvm(ptr noundef %32, i64 noundef 72) #2
  br label %35

35:                                               ; preds = %34, %30
  %36 = load ptr, ptr %2, align 8, !tbaa !5
  %37 = icmp eq ptr %36, null
  br i1 %37, label %39, label %38

38:                                               ; preds = %35
  call void @_ZN5micro15MaceMicroEngineD2Ev(ptr noundef nonnull align 8 dereferenceable(9) %36) #3
  call void @_ZdlPvm(ptr noundef %36, i64 noundef 16) #2
  br label %39

39:                                               ; preds = %38, %35
  ret void
}

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5micro15MaceMicroEngineD2Ev(ptr noundef nonnull align 8 dereferenceable(9)) 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 = { builtin nounwind }
attributes #3 = { 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 32}
!10 = !{!"_ZTSN5micro21MaceMicroEngineConfigE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !11, i64 64}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !6, i64 56}
!13 = !{!10, !6, i64 40}
!14 = !{!10, !6, i64 48}


; 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
declare dso_local noundef ptr @_ZN5micro15MaceMicroEngine15GetEngineConfigEv(ptr noundef nonnull align 8 dereferenceable(9)) local_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
define dso_local void @_ZN5micro28DestroyMicroEngineFromBinaryEPNS_15MaceMicroEngineE(ptr noundef nonnull %0) local_unnamed_addr #0 {
  %2 = tail call noundef ptr @_ZN5micro15MaceMicroEngine15GetEngineConfigEv(ptr noundef nonnull align 8 dereferenceable(9) %0)
  %3 = getelementptr inbounds i8, ptr %2, i64 32
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = icmp eq ptr %4, null
  br i1 %5, label %7, label %6

6:                                                ; preds = %1
  tail call void @_ZdaPv(ptr noundef nonnull %4) #2
  br label %7

7:                                                ; preds = %6, %1
  %8 = tail call noundef ptr @_ZN5micro15MaceMicroEngine15GetEngineConfigEv(ptr noundef nonnull align 8 dereferenceable(9) %0)
  %9 = getelementptr inbounds i8, ptr %8, i64 56
  %10 = load ptr, ptr %9, align 8, !tbaa !11
  %11 = icmp eq ptr %10, null
  br i1 %11, label %13, label %12

12:                                               ; preds = %7
  tail call void @_ZdaPv(ptr noundef nonnull %10) #2
  br label %13

13:                                               ; preds = %12, %7
  %14 = tail call noundef ptr @_ZN5micro15MaceMicroEngine15GetEngineConfigEv(ptr noundef nonnull align 8 dereferenceable(9) %0)
  %15 = getelementptr inbounds i8, ptr %14, i64 40
  %16 = load ptr, ptr %15, align 8, !tbaa !12
  %17 = icmp eq ptr %16, null
  br i1 %17, label %19, label %18

18:                                               ; preds = %13
  tail call void @_ZdaPv(ptr noundef nonnull %16) #2
  br label %19

19:                                               ; preds = %18, %13
  %20 = tail call noundef ptr @_ZN5micro15MaceMicroEngine15GetEngineConfigEv(ptr noundef nonnull align 8 dereferenceable(9) %0)
  %21 = getelementptr inbounds i8, ptr %20, i64 48
  %22 = load ptr, ptr %21, align 8, !tbaa !13
  %23 = icmp eq ptr %22, null
  br i1 %23, label %25, label %24

24:                                               ; preds = %19
  tail call void @_ZdaPv(ptr noundef nonnull %22) #2
  br label %25

25:                                               ; preds = %24, %19
  %26 = tail call noundef ptr @_ZN5micro15MaceMicroEngine15GetEngineConfigEv(ptr noundef nonnull align 8 dereferenceable(9) %0)
  %27 = icmp eq ptr %26, null
  br i1 %27, label %29, label %28

28:                                               ; preds = %25
  tail call void @_ZdlPvm(ptr noundef nonnull %26, i64 noundef 72) #2
  br label %29

29:                                               ; preds = %25, %28
  tail call void @_ZN5micro15MaceMicroEngineD2Ev(ptr noundef nonnull align 8 dereferenceable(9) %0) #3
  tail call void @_ZdlPvm(ptr noundef nonnull %0, i64 noundef 16) #2
  ret void
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5micro15MaceMicroEngineD2Ev(ptr noundef nonnull align 8 dereferenceable(9)) 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 = { builtin nounwind }
attributes #3 = { 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, !7, i64 32}
!6 = !{!"_ZTSN5micro21MaceMicroEngineConfigE", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !10, i64 64}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !7, i64 56}
!12 = !{!6, !7, i64 40}
!13 = !{!6, !7, i64 48}


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