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

; 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.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.10 = external hidden unnamed_addr constant [55 x i8], align 1

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN6tflite3ops5micro13concatenation4EvalEP13TfLiteContextP10TfLiteNode(ptr noundef %0, ptr noundef %1) #2 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = 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 4, ptr %6) #4
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  %9 = load ptr, ptr %5, align 8, !tbaa !5
  %10 = call noundef ptr @_ZN6tflite9GetOutputEP13TfLiteContextPK10TfLiteNodei(ptr noundef %8, ptr noundef %9, i32 noundef 0)
  %11 = getelementptr inbounds %struct.TfLiteTensor, ptr %10, i32 0, i32 0
  %12 = load i32, ptr %11, align 8, !tbaa !9
  store i32 %12, ptr %6, align 4, !tbaa !20
  %13 = load i32, ptr %6, align 4, !tbaa !20
  switch i32 %13, label %29 [
    i32 1, label %14
    i32 2, label %17
    i32 3, label %20
    i32 9, label %23
    i32 4, label %26
  ]

14:                                               ; preds = %2
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN6tflite3ops5micro13concatenation15EvalUnquantizedIfEEvP13TfLiteContextP10TfLiteNode(ptr noundef %15, ptr noundef %16)
  br label %39

17:                                               ; preds = %2
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN6tflite3ops5micro13concatenation15EvalUnquantizedIiEEvP13TfLiteContextP10TfLiteNode(ptr noundef %18, ptr noundef %19)
  br label %39

20:                                               ; preds = %2
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN6tflite3ops5micro13concatenation18EvalQuantizedUInt8EP13TfLiteContextP10TfLiteNode(ptr noundef %21, ptr noundef %22)
  br label %39

23:                                               ; preds = %2
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN6tflite3ops5micro13concatenation15EvalUnquantizedIaEEvP13TfLiteContextP10TfLiteNode(ptr noundef %24, ptr noundef %25)
  br label %39

26:                                               ; preds = %2
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN6tflite3ops5micro13concatenation15EvalUnquantizedIlEEvP13TfLiteContextP10TfLiteNode(ptr noundef %27, ptr noundef %28)
  br label %39

29:                                               ; preds = %2
  br label %30

30:                                               ; preds = %29
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.TfLiteContext, ptr %31, i32 0, i32 5
  %33 = load ptr, ptr %32, align 8, !tbaa !21
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = load i32, ptr %6, align 4, !tbaa !20
  %36 = call ptr @TfLiteTypeGetName(i32 noundef %35)
  call void (ptr, ptr, ...) %33(ptr noundef %34, ptr noundef @.str.10, ptr noundef %36)
  br label %37

37:                                               ; preds = %30
  br label %38

38:                                               ; preds = %37
  store i32 1, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %40

39:                                               ; preds = %26, %23, %20, %17, %14
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %40

40:                                               ; preds = %39, %38
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  %41 = load i32, ptr %3, align 4
  ret i32 %41
}

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

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

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

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

declare ptr @TfLiteTypeGetName(i32 noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #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, !11, i64 0}
!10 = !{!"_ZTS12TfLiteTensor", !11, i64 0, !7, i64 8, !6, i64 16, !12, i64 24, !15, i64 32, !16, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !14, i64 72, !17, i64 76, !17, i64 77, !18, i64 80, !6, i64 96, !6, i64 104}
!11 = !{!"_ZTS10TfLiteType", !7, i64 0}
!12 = !{!"_ZTS24TfLiteQuantizationParams", !13, i64 0, !14, i64 4}
!13 = !{!"float", !7, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!"_ZTS20TfLiteAllocationType", !7, i64 0}
!16 = !{!"long", !7, i64 0}
!17 = !{!"bool", !7, i64 0}
!18 = !{!"_ZTS18TfLiteQuantization", !19, i64 0, !6, i64 8}
!19 = !{!"_ZTS22TfLiteQuantizationType", !7, i64 0}
!20 = !{!11, !11, i64 0}
!21 = !{!22, !6, i64 40}
!22 = !{!"_ZTS13TfLiteContext", !16, 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, !14, i64 72, !6, i64 80, !6, i64 88, !17, 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"

@.str.10 = external hidden unnamed_addr constant [55 x i8], align 1

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 0, 2) i32 @_ZN6tflite3ops5micro13concatenation4EvalEP13TfLiteContextP10TfLiteNode(ptr noundef %0, ptr noundef %1) local_unnamed_addr #1 {
  %3 = tail call noundef ptr @_ZN6tflite9GetOutputEP13TfLiteContextPK10TfLiteNodei(ptr noundef %0, ptr noundef %1, i32 noundef 0)
  %4 = load i32, ptr %3, align 8, !tbaa !5
  switch i32 %4, label %10 [
    i32 1, label %5
    i32 2, label %6
    i32 3, label %7
    i32 9, label %8
    i32 4, label %9
  ]

5:                                                ; preds = %2
  tail call void @_ZN6tflite3ops5micro13concatenation15EvalUnquantizedIfEEvP13TfLiteContextP10TfLiteNode(ptr noundef %0, ptr noundef %1)
  br label %14

6:                                                ; preds = %2
  tail call void @_ZN6tflite3ops5micro13concatenation15EvalUnquantizedIiEEvP13TfLiteContextP10TfLiteNode(ptr noundef %0, ptr noundef %1)
  br label %14

7:                                                ; preds = %2
  tail call void @_ZN6tflite3ops5micro13concatenation18EvalQuantizedUInt8EP13TfLiteContextP10TfLiteNode(ptr noundef %0, ptr noundef %1)
  br label %14

8:                                                ; preds = %2
  tail call void @_ZN6tflite3ops5micro13concatenation15EvalUnquantizedIaEEvP13TfLiteContextP10TfLiteNode(ptr noundef %0, ptr noundef %1)
  br label %14

9:                                                ; preds = %2
  tail call void @_ZN6tflite3ops5micro13concatenation15EvalUnquantizedIlEEvP13TfLiteContextP10TfLiteNode(ptr noundef %0, ptr noundef %1)
  br label %14

10:                                               ; preds = %2
  %11 = getelementptr inbounds i8, ptr %0, i64 40
  %12 = load ptr, ptr %11, align 8, !tbaa !19
  %13 = tail call ptr @TfLiteTypeGetName(i32 noundef %4)
  tail call void (ptr, ptr, ...) %12(ptr noundef %0, ptr noundef nonnull @.str.10, ptr noundef %13)
  br label %14

14:                                               ; preds = %5, %6, %7, %8, %9, %10
  %.0 = phi i32 [ 1, %10 ], [ 0, %9 ], [ 0, %8 ], [ 0, %7 ], [ 0, %6 ], [ 0, %5 ]
  ret i32 %.0
}

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

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

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

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

declare ptr @TfLiteTypeGetName(i32 noundef) local_unnamed_addr #2

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


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