; LLVM IR from Seeed-Studio/Seeed_Arduino_edgeimpulse :: src/edge-impulse-sdk/tensorflow/lite/micro/kernels (mul)

; 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.tflite::ops::micro::mul::OpData" = type { i32, i32, i32, i32 }
%struct.TfLiteNode = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, ptr }
%struct.TfLiteTensor = type { i32, %union.TfLitePtrUnion, ptr, %struct.TfLiteQuantizationParams, i32, i64, ptr, ptr, ptr, i32, i8, i8, %struct.TfLiteQuantization, ptr, ptr }
%union.TfLitePtrUnion = type { ptr }
%struct.TfLiteQuantizationParams = type { float, i32 }
%struct.TfLiteQuantization = type { i32, ptr }
%struct.TfLiteContext = type { i64, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, ptr, ptr, i8, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

@.str.9 = external hidden unnamed_addr constant [28 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN6tflite3ops5micro3mul15CalculateOpDataEP13TfLiteContextP10TfLiteNodeP15TfLiteMulParamsPNS2_6OpDataE(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN6tflite8GetInputEPK13TfLiteContextPK10TfLiteNodei(ptr noundef, ptr noundef, i32 noundef) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN6tflite9GetOutputEP13TfLiteContextPK10TfLiteNodei(ptr noundef, ptr noundef, i32 noundef) #2

declare ptr @TfLiteTypeGetName(i32 noundef) #3

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6tflite3ops5micro3mul13EvalQuantizedEP13TfLiteContextP10TfLiteNodeP15TfLiteMulParamsPNS2_6OpDataEPK12TfLiteTensorSD_PSB_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6tflite3ops5micro3mul9EvalFloatEP13TfLiteContextP10TfLiteNodeP15TfLiteMulParamsPNS2_6OpDataEPK12TfLiteTensorSD_PSB_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #0

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN6tflite3ops5micro3mul4EvalEP13TfLiteContextP10TfLiteNode(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %"struct.tflite::ops::micro::mul::OpData", align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.TfLiteNode, ptr %13, i32 0, i32 5
  %15 = load ptr, ptr %14, align 8, !tbaa !9
  store ptr %15, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = call noundef ptr @_ZN6tflite8GetInputEPK13TfLiteContextPK10TfLiteNodei(ptr noundef %16, ptr noundef %17, i32 noundef 0)
  store ptr %18, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = call noundef ptr @_ZN6tflite8GetInputEPK13TfLiteContextPK10TfLiteNodei(ptr noundef %19, ptr noundef %20, i32 noundef 1)
  store ptr %21, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = call noundef ptr @_ZN6tflite9GetOutputEP13TfLiteContextPK10TfLiteNodei(ptr noundef %22, ptr noundef %23, i32 noundef 0)
  store ptr %24, ptr %10, align 8, !tbaa !5
  br label %25

25:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = call noundef i32 @_ZN6tflite3ops5micro3mul15CalculateOpDataEP13TfLiteContextP10TfLiteNodeP15TfLiteMulParamsPNS2_6OpDataE(ptr noundef %26, ptr noundef %27, ptr noundef %28, ptr noundef %7)
  store i32 %29, ptr %11, align 4, !tbaa !12
  %30 = load i32, ptr %11, align 4, !tbaa !12
  %31 = icmp ne i32 %30, 0
  br i1 %31, label %32, label %34

32:                                               ; preds = %25
  %33 = load i32, ptr %11, align 4, !tbaa !12
  store i32 %33, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %35

34:                                               ; preds = %25
  store i32 0, ptr %12, align 4
  br label %35

35:                                               ; preds = %34, %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  %36 = load i32, ptr %12, align 4
  switch i32 %36, label %73 [
    i32 0, label %37
  ]

37:                                               ; preds = %35
  br label %38

38:                                               ; preds = %37
  br label %39

39:                                               ; preds = %38
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.TfLiteTensor, ptr %40, i32 0, i32 0
  %42 = load i32, ptr %41, align 8, !tbaa !14
  switch i32 %42, label %57 [
    i32 3, label %43
    i32 9, label %43
    i32 1, label %50
  ]

43:                                               ; preds = %39, %39
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = load ptr, ptr %6, align 8, !tbaa !5
  %47 = load ptr, ptr %8, align 8, !tbaa !5
  %48 = load ptr, ptr %9, align 8, !tbaa !5
  %49 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN6tflite3ops5micro3mul13EvalQuantizedEP13TfLiteContextP10TfLiteNodeP15TfLiteMulParamsPNS2_6OpDataEPK12TfLiteTensorSD_PSB_(ptr noundef %44, ptr noundef %45, ptr noundef %46, ptr noundef %7, ptr noundef %47, ptr noundef %48, ptr noundef %49)
  br label %72

50:                                               ; preds = %39
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = load ptr, ptr %5, align 8, !tbaa !5
  %53 = load ptr, ptr %6, align 8, !tbaa !5
  %54 = load ptr, ptr %8, align 8, !tbaa !5
  %55 = load ptr, ptr %9, align 8, !tbaa !5
  %56 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN6tflite3ops5micro3mul9EvalFloatEP13TfLiteContextP10TfLiteNodeP15TfLiteMulParamsPNS2_6OpDataEPK12TfLiteTensorSD_PSB_(ptr noundef %51, ptr noundef %52, ptr noundef %53, ptr noundef %7, ptr noundef %54, ptr noundef %55, ptr noundef %56)
  br label %72

57:                                               ; preds = %39
  br label %58

58:                                               ; preds = %57
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.TfLiteContext, ptr %59, i32 0, i32 5
  %61 = load ptr, ptr %60, align 8, !tbaa !24
  %62 = load ptr, ptr %4, align 8, !tbaa !5
  %63 = load ptr, ptr %8, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.TfLiteTensor, ptr %63, i32 0, i32 0
  %65 = load i32, ptr %64, align 8, !tbaa !14
  %66 = call ptr @TfLiteTypeGetName(i32 noundef %65)
  %67 = load ptr, ptr %8, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.TfLiteTensor, ptr %67, i32 0, i32 0
  %69 = load i32, ptr %68, align 8, !tbaa !14
  call void (ptr, ptr, ...) %61(ptr noundef %62, ptr noundef @.str.9, ptr noundef %66, i32 noundef %69)
  br label %70

70:                                               ; preds = %58
  br label %71

71:                                               ; preds = %70
  store i32 1, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %73

72:                                               ; preds = %50, %43
  store i32 0, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %73

73:                                               ; preds = %72, %71, %35
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  %74 = load i32, ptr %3, align 4
  ret i32 %74
}

attributes #0 = { mustprogress 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "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 }

!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 40}
!10 = !{!"_ZTS10TfLiteNode", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !11, i64 56, !6, i64 64}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"_ZTS12TfLiteStatus", !7, i64 0}
!14 = !{!15, !16, i64 0}
!15 = !{!"_ZTS12TfLiteTensor", !16, i64 0, !7, i64 8, !6, i64 16, !17, i64 24, !19, i64 32, !20, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !11, i64 72, !21, i64 76, !21, i64 77, !22, i64 80, !6, i64 96, !6, i64 104}
!16 = !{!"_ZTS10TfLiteType", !7, i64 0}
!17 = !{!"_ZTS24TfLiteQuantizationParams", !18, i64 0, !11, i64 4}
!18 = !{!"float", !7, i64 0}
!19 = !{!"_ZTS20TfLiteAllocationType", !7, i64 0}
!20 = !{!"long", !7, i64 0}
!21 = !{!"bool", !7, i64 0}
!22 = !{!"_ZTS18TfLiteQuantization", !23, i64 0, !6, i64 8}
!23 = !{!"_ZTS22TfLiteQuantizationType", !7, i64 0}
!24 = !{!25, !6, i64 40}
!25 = !{!"_ZTS13TfLiteContext", !20, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !11, i64 72, !6, i64 80, !6, i64 88, !21, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152}


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

%"struct.tflite::ops::micro::mul::OpData" = type { i32, i32, i32, i32 }

@.str.9 = external hidden unnamed_addr constant [28 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN6tflite3ops5micro3mul15CalculateOpDataEP13TfLiteContextP10TfLiteNodeP15TfLiteMulParamsPNS2_6OpDataE(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN6tflite8GetInputEPK13TfLiteContextPK10TfLiteNodei(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN6tflite9GetOutputEP13TfLiteContextPK10TfLiteNodei(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

declare ptr @TfLiteTypeGetName(i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6tflite3ops5micro3mul13EvalQuantizedEP13TfLiteContextP10TfLiteNodeP15TfLiteMulParamsPNS2_6OpDataEPK12TfLiteTensorSD_PSB_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6tflite3ops5micro3mul9EvalFloatEP13TfLiteContextP10TfLiteNodeP15TfLiteMulParamsPNS2_6OpDataEPK12TfLiteTensorSD_PSB_(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN6tflite3ops5micro3mul4EvalEP13TfLiteContextP10TfLiteNode(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca %"struct.tflite::ops::micro::mul::OpData", align 4
  %4 = getelementptr inbounds i8, ptr %1, i64 40
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #4
  %6 = tail call noundef ptr @_ZN6tflite8GetInputEPK13TfLiteContextPK10TfLiteNodei(ptr noundef %0, ptr noundef %1, i32 noundef 0)
  %7 = tail call noundef ptr @_ZN6tflite8GetInputEPK13TfLiteContextPK10TfLiteNodei(ptr noundef %0, ptr noundef %1, i32 noundef 1)
  %8 = tail call noundef ptr @_ZN6tflite9GetOutputEP13TfLiteContextPK10TfLiteNodei(ptr noundef %0, ptr noundef %1, i32 noundef 0)
  %9 = call noundef i32 @_ZN6tflite3ops5micro3mul15CalculateOpDataEP13TfLiteContextP10TfLiteNodeP15TfLiteMulParamsPNS2_6OpDataE(ptr noundef %0, ptr noundef %1, ptr noundef %5, ptr noundef nonnull %3)
  %.not = icmp eq i32 %9, 0
  br i1 %.not, label %10, label %19

10:                                               ; preds = %2
  %11 = load i32, ptr %6, align 8, !tbaa !11
  switch i32 %11, label %14 [
    i32 3, label %12
    i32 9, label %12
    i32 1, label %13
  ]

12:                                               ; preds = %10, %10
  call void @_ZN6tflite3ops5micro3mul13EvalQuantizedEP13TfLiteContextP10TfLiteNodeP15TfLiteMulParamsPNS2_6OpDataEPK12TfLiteTensorSD_PSB_(ptr noundef %0, ptr noundef nonnull %1, ptr noundef %5, ptr noundef nonnull %3, ptr noundef nonnull %6, ptr noundef %7, ptr noundef %8)
  br label %19

13:                                               ; preds = %10
  call void @_ZN6tflite3ops5micro3mul9EvalFloatEP13TfLiteContextP10TfLiteNodeP15TfLiteMulParamsPNS2_6OpDataEPK12TfLiteTensorSD_PSB_(ptr noundef %0, ptr noundef nonnull %1, ptr noundef %5, ptr noundef nonnull %3, ptr noundef nonnull %6, ptr noundef %7, ptr noundef %8)
  br label %19

14:                                               ; preds = %10
  %15 = getelementptr inbounds i8, ptr %0, i64 40
  %16 = load ptr, ptr %15, align 8, !tbaa !21
  %17 = call ptr @TfLiteTypeGetName(i32 noundef %11)
  %18 = load i32, ptr %6, align 8, !tbaa !11
  call void (ptr, ptr, ...) %16(ptr noundef %0, ptr noundef nonnull @.str.9, ptr noundef %17, i32 noundef %18)
  br label %19

19:                                               ; preds = %12, %13, %2, %14
  %.1 = phi i32 [ 1, %14 ], [ %9, %2 ], [ 0, %13 ], [ 0, %12 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #4
  ret i32 %.1
}

attributes #0 = { mustprogress 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "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 }

!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 40}
!6 = !{!"_ZTS10TfLiteNode", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !10, i64 56, !7, i64 64}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"_ZTS12TfLiteTensor", !13, i64 0, !8, i64 8, !7, i64 16, !14, i64 24, !16, i64 32, !17, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !10, i64 72, !18, i64 76, !18, i64 77, !19, i64 80, !7, i64 96, !7, i64 104}
!13 = !{!"_ZTS10TfLiteType", !8, i64 0}
!14 = !{!"_ZTS24TfLiteQuantizationParams", !15, i64 0, !10, i64 4}
!15 = !{!"float", !8, i64 0}
!16 = !{!"_ZTS20TfLiteAllocationType", !8, i64 0}
!17 = !{!"long", !8, i64 0}
!18 = !{!"bool", !8, i64 0}
!19 = !{!"_ZTS18TfLiteQuantization", !20, i64 0, !7, i64 8}
!20 = !{!"_ZTS22TfLiteQuantizationType", !8, i64 0}
!21 = !{!22, !7, i64 40}
!22 = !{!"_ZTS13TfLiteContext", !17, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !10, i64 72, !7, i64 80, !7, i64 88, !18, i64 96, !7, i64 104, !7, i64 112, !7, i64 120, !7, i64 128, !7, i64 136, !7, i64 144, !7, i64 152}


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