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

; 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.std::unique_ptr" = type { %"struct.std::__uniq_ptr_data" }
%"struct.std::__uniq_ptr_data" = type { %"class.std::__uniq_ptr_impl" }
%"class.std::__uniq_ptr_impl" = type { %"class.std::tuple" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Tuple_impl.0", %"struct.std::_Head_base.1" }
%"struct.std::_Tuple_impl.0" = type { %"struct.std::_Head_base" }
%"struct.std::_Head_base" = type { ptr }
%"struct.std::_Head_base.1" = type { ptr }
%struct.TfLiteContext = type { i64, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, ptr, ptr, i8, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.TfLiteIntArray = type { i32, [0 x i32] }

@.str.1 = external hidden unnamed_addr constant [133 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [27 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #1

declare ptr @TfLiteIntArrayCreate(i32 noundef) #2

declare void @TfLiteIntArrayFree(ptr noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt10unique_ptrI14TfLiteIntArrayPFvPS0_EEC2IS3_vEES1_NSt9enable_ifIXntsr19is_lvalue_referenceIT_EE5valueEOS7_E4typeE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3 align 2

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNKSt10unique_ptrI14TfLiteIntArrayPFvPS0_EEptEv(ptr noundef nonnull align 8 dereferenceable(16)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNSt10unique_ptrI14TfLiteIntArrayPFvPS0_EE7releaseEv(ptr noundef nonnull align 8 dereferenceable(16)) #3 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN6tflite26CalculateShapeForBroadcastEP13TfLiteContextPK12TfLiteTensorS4_S4_PP14TfLiteIntArray(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #4 personality ptr @__gxx_personality_v0 {
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca %"class.std::unique_ptr", align 8
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca ptr, align 8
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %26 = load ptr, ptr %8, align 8, !tbaa !5
  %27 = call noundef i32 @_ZN6tflite13NumDimensionsEPK12TfLiteTensor(ptr noundef %26)
  store i32 %27, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %28 = load ptr, ptr %9, align 8, !tbaa !5
  %29 = call noundef i32 @_ZN6tflite13NumDimensionsEPK12TfLiteTensor(ptr noundef %28)
  store i32 %29, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %30 = load ptr, ptr %10, align 8, !tbaa !5
  %31 = call noundef i32 @_ZN6tflite13NumDimensionsEPK12TfLiteTensor(ptr noundef %30)
  store i32 %31, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %32 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(4) %13)
  %33 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %32, ptr noundef nonnull align 4 dereferenceable(4) %14)
  %34 = load i32, ptr %33, align 4, !tbaa !9
  store i32 %34, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %16) #5
  %35 = load i32, ptr %15, align 4, !tbaa !9
  %36 = call ptr @TfLiteIntArrayCreate(i32 noundef %35)
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  store ptr @TfLiteIntArrayFree, ptr %17, align 8, !tbaa !5
  call void @_ZNSt10unique_ptrI14TfLiteIntArrayPFvPS0_EEC2IS3_vEES1_NSt9enable_ifIXntsr19is_lvalue_referenceIT_EE5valueEOS7_E4typeE(ptr noundef nonnull align 8 dereferenceable(16) %16, ptr noundef %36, ptr noundef nonnull align 8 dereferenceable(8) %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  store i32 0, ptr %18, align 4, !tbaa !9
  br label %37

37:                                               ; preds = %175, %5
  %38 = load i32, ptr %18, align 4, !tbaa !9
  %39 = load i32, ptr %15, align 4, !tbaa !9
  %40 = icmp slt i32 %38, %39
  br i1 %40, label %42, label %41

41:                                               ; preds = %37
  store i32 2, ptr %19, align 4
  br label %181

42:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #5
  %43 = load i32, ptr %18, align 4, !tbaa !9
  %44 = load i32, ptr %12, align 4, !tbaa !9
  %45 = icmp sge i32 %43, %44
  br i1 %45, label %46, label %47

46:                                               ; preds = %42
  br label %55

47:                                               ; preds = %42
  %48 = load ptr, ptr %8, align 8, !tbaa !5
  %49 = load i32, ptr %12, align 4, !tbaa !9
  %50 = load i32, ptr %18, align 4, !tbaa !9
  %51 = sub nsw i32 %49, %50
  %52 = sub nsw i32 %51, 1
  %53 = invoke noundef i32 @_ZN6tflite15SizeOfDimensionEPK12TfLiteTensori(ptr noundef %48, i32 noundef %52)
          to label %54 unwind label %106

54:                                               ; preds = %47
  br label %55

55:                                               ; preds = %54, %46
  %56 = phi i32 [ 1, %46 ], [ %53, %54 ]
  store i32 %56, ptr %20, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #5
  %57 = load i32, ptr %18, align 4, !tbaa !9
  %58 = load i32, ptr %13, align 4, !tbaa !9
  %59 = icmp sge i32 %57, %58
  br i1 %59, label %60, label %61

60:                                               ; preds = %55
  br label %69

61:                                               ; preds = %55
  %62 = load ptr, ptr %9, align 8, !tbaa !5
  %63 = load i32, ptr %13, align 4, !tbaa !9
  %64 = load i32, ptr %18, align 4, !tbaa !9
  %65 = sub nsw i32 %63, %64
  %66 = sub nsw i32 %65, 1
  %67 = invoke noundef i32 @_ZN6tflite15SizeOfDimensionEPK12TfLiteTensori(ptr noundef %62, i32 noundef %66)
          to label %68 unwind label %110

68:                                               ; preds = %61
  br label %69

69:                                               ; preds = %68, %60
  %70 = phi i32 [ 1, %60 ], [ %67, %68 ]
  store i32 %70, ptr %23, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #5
  %71 = load i32, ptr %18, align 4, !tbaa !9
  %72 = load i32, ptr %14, align 4, !tbaa !9
  %73 = icmp sge i32 %71, %72
  br i1 %73, label %74, label %75

74:                                               ; preds = %69
  br label %83

75:                                               ; preds = %69
  %76 = load ptr, ptr %10, align 8, !tbaa !5
  %77 = load i32, ptr %14, align 4, !tbaa !9
  %78 = load i32, ptr %18, align 4, !tbaa !9
  %79 = sub nsw i32 %77, %78
  %80 = sub nsw i32 %79, 1
  %81 = invoke noundef i32 @_ZN6tflite15SizeOfDimensionEPK12TfLiteTensori(ptr noundef %76, i32 noundef %80)
          to label %82 unwind label %114

82:                                               ; preds = %75
  br label %83

83:                                               ; preds = %82, %74
  %84 = phi i32 [ 1, %74 ], [ %81, %82 ]
  store i32 %84, ptr %24, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #5
  %85 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %20, ptr noundef nonnull align 4 dereferenceable(4) %23)
          to label %86 unwind label %118

86:                                               ; preds = %83
  %87 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %85, ptr noundef nonnull align 4 dereferenceable(4) %24)
          to label %88 unwind label %118

88:                                               ; preds = %86
  %89 = load i32, ptr %87, align 4, !tbaa !9
  store i32 %89, ptr %25, align 4, !tbaa !9
  br label %90

90:                                               ; preds = %88
  %91 = load i32, ptr %20, align 4, !tbaa !9
  %92 = icmp eq i32 %91, 1
  br i1 %92, label %122, label %93

93:                                               ; preds = %90
  %94 = load i32, ptr %20, align 4, !tbaa !9
  %95 = load i32, ptr %25, align 4, !tbaa !9
  %96 = icmp eq i32 %94, %95
  br i1 %96, label %122, label %97

97:                                               ; preds = %93
  br label %98

98:                                               ; preds = %97
  %99 = load ptr, ptr %7, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.TfLiteContext, ptr %99, i32 0, i32 5
  %101 = load ptr, ptr %100, align 8, !tbaa !11
  %102 = load ptr, ptr %7, align 8, !tbaa !5
  invoke void (ptr, ptr, ...) %101(ptr noundef %102, ptr noundef @.str.5, ptr noundef @.str.1, i32 noundef 272, ptr noundef @.str.18)
          to label %103 unwind label %118

103:                                              ; preds = %98
  br label %104

104:                                              ; preds = %103
  br label %105

105:                                              ; preds = %104
  store i32 1, ptr %6, align 4
  store i32 1, ptr %19, align 4
  br label %172

106:                                              ; preds = %47
  %107 = landingpad { ptr, i32 }
          cleanup
  %108 = extractvalue { ptr, i32 } %107, 0
  store ptr %108, ptr %21, align 8
  %109 = extractvalue { ptr, i32 } %107, 1
  store i32 %109, ptr %22, align 4
  br label %180

110:                                              ; preds = %61
  %111 = landingpad { ptr, i32 }
          cleanup
  %112 = extractvalue { ptr, i32 } %111, 0
  store ptr %112, ptr %21, align 8
  %113 = extractvalue { ptr, i32 } %111, 1
  store i32 %113, ptr %22, align 4
  br label %179

114:                                              ; preds = %75
  %115 = landingpad { ptr, i32 }
          cleanup
  %116 = extractvalue { ptr, i32 } %115, 0
  store ptr %116, ptr %21, align 8
  %117 = extractvalue { ptr, i32 } %115, 1
  store i32 %117, ptr %22, align 4
  br label %178

118:                                              ; preds = %152, %133, %98, %86, %83
  %119 = landingpad { ptr, i32 }
          cleanup
  %120 = extractvalue { ptr, i32 } %119, 0
  store ptr %120, ptr %21, align 8
  %121 = extractvalue { ptr, i32 } %119, 1
  store i32 %121, ptr %22, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #5
  br label %178

122:                                              ; preds = %93, %90
  br label %123

123:                                              ; preds = %122
  br label %124

124:                                              ; preds = %123
  br label %125

125:                                              ; preds = %124
  %126 = load i32, ptr %23, align 4, !tbaa !9
  %127 = icmp eq i32 %126, 1
  br i1 %127, label %141, label %128

128:                                              ; preds = %125
  %129 = load i32, ptr %23, align 4, !tbaa !9
  %130 = load i32, ptr %25, align 4, !tbaa !9
  %131 = icmp eq i32 %129, %130
  br i1 %131, label %141, label %132

132:                                              ; preds = %128
  br label %133

133:                                              ; preds = %132
  %134 = load ptr, ptr %7, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.TfLiteContext, ptr %134, i32 0, i32 5
  %136 = load ptr, ptr %135, align 8, !tbaa !11
  %137 = load ptr, ptr %7, align 8, !tbaa !5
  invoke void (ptr, ptr, ...) %136(ptr noundef %137, ptr noundef @.str.5, ptr noundef @.str.1, i32 noundef 273, ptr noundef @.str.19)
          to label %138 unwind label %118

138:                                              ; preds = %133
  br label %139

139:                                              ; preds = %138
  br label %140

140:                                              ; preds = %139
  store i32 1, ptr %6, align 4
  store i32 1, ptr %19, align 4
  br label %172

141:                                              ; preds = %128, %125
  br label %142

142:                                              ; preds = %141
  br label %143

143:                                              ; preds = %142
  br label %144

144:                                              ; preds = %143
  %145 = load i32, ptr %24, align 4, !tbaa !9
  %146 = icmp eq i32 %145, 1
  br i1 %146, label %160, label %147

147:                                              ; preds = %144
  %148 = load i32, ptr %24, align 4, !tbaa !9
  %149 = load i32, ptr %25, align 4, !tbaa !9
  %150 = icmp eq i32 %148, %149
  br i1 %150, label %160, label %151

151:                                              ; preds = %147
  br label %152

152:                                              ; preds = %151
  %153 = load ptr, ptr %7, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.TfLiteContext, ptr %153, i32 0, i32 5
  %155 = load ptr, ptr %154, align 8, !tbaa !11
  %156 = load ptr, ptr %7, align 8, !tbaa !5
  invoke void (ptr, ptr, ...) %155(ptr noundef %156, ptr noundef @.str.5, ptr noundef @.str.1, i32 noundef 274, ptr noundef @.str.20)
          to label %157 unwind label %118

157:                                              ; preds = %152
  br label %158

158:                                              ; preds = %157
  br label %159

159:                                              ; preds = %158
  store i32 1, ptr %6, align 4
  store i32 1, ptr %19, align 4
  br label %172

160:                                              ; preds = %147, %144
  br label %161

161:                                              ; preds = %160
  br label %162

162:                                              ; preds = %161
  %163 = load i32, ptr %25, align 4, !tbaa !9
  %164 = call noundef ptr @_ZNKSt10unique_ptrI14TfLiteIntArrayPFvPS0_EEptEv(ptr noundef nonnull align 8 dereferenceable(16) %16) #5
  %165 = getelementptr inbounds %struct.TfLiteIntArray, ptr %164, i32 0, i32 1
  %166 = load i32, ptr %15, align 4, !tbaa !9
  %167 = load i32, ptr %18, align 4, !tbaa !9
  %168 = sub nsw i32 %166, %167
  %169 = sub nsw i32 %168, 1
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds [0 x i32], ptr %165, i64 0, i64 %170
  store i32 %163, ptr %171, align 4, !tbaa !9
  store i32 0, ptr %19, align 4
  br label %172

172:                                              ; preds = %162, %159, %140, %105
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  %173 = load i32, ptr %19, align 4
  switch i32 %173, label %181 [
    i32 0, label %174
  ]

174:                                              ; preds = %172
  br label %175

175:                                              ; preds = %174
  %176 = load i32, ptr %18, align 4, !tbaa !9
  %177 = add nsw i32 %176, 1
  store i32 %177, ptr %18, align 4, !tbaa !9
  br label %37, !llvm.loop !15

178:                                              ; preds = %118, %114
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #5
  br label %179

179:                                              ; preds = %178, %110
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #5
  br label %180

180:                                              ; preds = %179, %106
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  call void @_ZNSt10unique_ptrI14TfLiteIntArrayPFvPS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %16) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %188

181:                                              ; preds = %172, %41
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  %182 = load i32, ptr %19, align 4
  switch i32 %182, label %186 [
    i32 2, label %183
  ]

183:                                              ; preds = %181
  %184 = call noundef ptr @_ZNSt10unique_ptrI14TfLiteIntArrayPFvPS0_EE7releaseEv(ptr noundef nonnull align 8 dereferenceable(16) %16) #5
  %185 = load ptr, ptr %11, align 8, !tbaa !5
  store ptr %184, ptr %185, align 8, !tbaa !5
  store i32 0, ptr %6, align 4
  store i32 1, ptr %19, align 4
  br label %186

186:                                              ; preds = %183, %181
  call void @_ZNSt10unique_ptrI14TfLiteIntArrayPFvPS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %16) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  %187 = load i32, ptr %6, align 4
  ret i32 %187

188:                                              ; preds = %180
  %189 = load ptr, ptr %21, align 8
  %190 = load i32, ptr %22, align 4
  %191 = insertvalue { ptr, i32 } poison, ptr %189, 0
  %192 = insertvalue { ptr, i32 } %191, i32 %190, 1
  resume { ptr, i32 } %192
}

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 = { "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 = { 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 = { 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 #5 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 40}
!12 = !{!"_ZTS13TfLiteContext", !13, 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, !10, i64 72, !6, i64 80, !6, i64 88, !14, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152}
!13 = !{!"long", !7, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}


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

%"class.std::unique_ptr" = type { %"struct.std::__uniq_ptr_data" }
%"struct.std::__uniq_ptr_data" = type { %"class.std::__uniq_ptr_impl" }
%"class.std::__uniq_ptr_impl" = type { %"class.std::tuple" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Tuple_impl.0", %"struct.std::_Head_base.1" }
%"struct.std::_Tuple_impl.0" = type { %"struct.std::_Head_base" }
%"struct.std::_Head_base" = type { ptr }
%"struct.std::_Head_base.1" = type { ptr }

@.str.1 = external hidden unnamed_addr constant [133 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [27 x i8], align 1

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

declare ptr @TfLiteIntArrayCreate(i32 noundef) local_unnamed_addr #2

declare void @TfLiteIntArrayFree(ptr noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt10unique_ptrI14TfLiteIntArrayPFvPS0_EEC2IS3_vEES1_NSt9enable_ifIXntsr19is_lvalue_referenceIT_EE5valueEOS7_E4typeE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3 align 2

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNKSt10unique_ptrI14TfLiteIntArrayPFvPS0_EEptEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNSt10unique_ptrI14TfLiteIntArrayPFvPS0_EE7releaseEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN6tflite26CalculateShapeForBroadcastEP13TfLiteContextPK12TfLiteTensorS4_S4_PP14TfLiteIntArray(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr nocapture noundef writeonly %4) local_unnamed_addr #4 personality ptr @__gxx_personality_v0 {
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca %"class.std::unique_ptr", align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #5
  %14 = tail call noundef i32 @_ZN6tflite13NumDimensionsEPK12TfLiteTensor(ptr noundef %1)
  store i32 %14, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #5
  %15 = tail call noundef i32 @_ZN6tflite13NumDimensionsEPK12TfLiteTensor(ptr noundef %2)
  store i32 %15, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #5
  %16 = tail call noundef i32 @_ZN6tflite13NumDimensionsEPK12TfLiteTensor(ptr noundef %3)
  store i32 %16, ptr %8, align 4, !tbaa !5
  %17 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %18 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %17, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %19 = load i32, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #5
  %20 = call ptr @TfLiteIntArrayCreate(i32 noundef %19)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #5
  store ptr @TfLiteIntArrayFree, ptr %10, align 8, !tbaa !9
  call void @_ZNSt10unique_ptrI14TfLiteIntArrayPFvPS0_EEC2IS3_vEES1_NSt9enable_ifIXntsr19is_lvalue_referenceIT_EE5valueEOS7_E4typeE(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef %20, ptr noundef nonnull align 8 dereferenceable(8) %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #5
  %.not4651 = icmp sgt i32 %19, 0
  br i1 %.not4651, label %.lr.ph.preheader, label %.critedge50

.lr.ph.preheader:                                 ; preds = %5
  %21 = zext nneg i32 %19 to i64
  %wide.trip.count = zext nneg i32 %19 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.critedge
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.critedge ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #5
  %22 = load i32, ptr %6, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %.not = icmp slt i64 %indvars.iv, %23
  br i1 %.not, label %24, label %29

24:                                               ; preds = %.lr.ph
  %25 = trunc i64 %indvars.iv to i32
  %26 = xor i32 %25, -1
  %27 = add i32 %22, %26
  %28 = call noundef i32 @_ZN6tflite15SizeOfDimensionEPK12TfLiteTensori(ptr noundef %1, i32 noundef %27)
  br label %29

29:                                               ; preds = %.lr.ph, %24
  %30 = phi i32 [ %28, %24 ], [ 1, %.lr.ph ]
  store i32 %30, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %12) #5
  %31 = load i32, ptr %7, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %.not44 = icmp slt i64 %indvars.iv, %32
  br i1 %.not44, label %33, label %38

33:                                               ; preds = %29
  %34 = trunc i64 %indvars.iv to i32
  %35 = xor i32 %34, -1
  %36 = add i32 %31, %35
  %37 = call noundef i32 @_ZN6tflite15SizeOfDimensionEPK12TfLiteTensori(ptr noundef %2, i32 noundef %36)
  br label %38

38:                                               ; preds = %29, %33
  %39 = phi i32 [ %37, %33 ], [ 1, %29 ]
  store i32 %39, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %13) #5
  %40 = load i32, ptr %8, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %.not45 = icmp slt i64 %indvars.iv, %41
  br i1 %.not45, label %42, label %47

42:                                               ; preds = %38
  %43 = trunc i64 %indvars.iv to i32
  %44 = xor i32 %43, -1
  %45 = add i32 %40, %44
  %46 = call noundef i32 @_ZN6tflite15SizeOfDimensionEPK12TfLiteTensori(ptr noundef %3, i32 noundef %45)
  br label %47

47:                                               ; preds = %38, %42
  %48 = phi i32 [ %46, %42 ], [ 1, %38 ]
  store i32 %48, ptr %13, align 4, !tbaa !5
  %49 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %12)
  %50 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %49, ptr noundef nonnull align 4 dereferenceable(4) %13)
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = load i32, ptr %11, align 4, !tbaa !5
  %53 = icmp eq i32 %52, 1
  %54 = icmp eq i32 %52, %51
  %or.cond = select i1 %53, i1 true, i1 %54
  br i1 %or.cond, label %57, label %.invoke

55:                                               ; preds = %.invoke
  %56 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #5
  call void @_ZNSt10unique_ptrI14TfLiteIntArrayPFvPS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %9) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  resume { ptr, i32 } %56

57:                                               ; preds = %47
  %58 = load i32, ptr %12, align 4, !tbaa !5
  %59 = icmp eq i32 %58, 1
  %60 = icmp eq i32 %58, %51
  %or.cond47 = select i1 %59, i1 true, i1 %60
  br i1 %or.cond47, label %61, label %.invoke

61:                                               ; preds = %57
  %62 = load i32, ptr %13, align 4, !tbaa !5
  %63 = icmp eq i32 %62, 1
  %64 = icmp eq i32 %62, %51
  %or.cond48 = select i1 %63, i1 true, i1 %64
  br i1 %or.cond48, label %.critedge, label %.invoke

.invoke:                                          ; preds = %61, %57, %47
  %65 = phi i32 [ 272, %47 ], [ 273, %57 ], [ 274, %61 ]
  %66 = phi ptr [ @.str.18, %47 ], [ @.str.19, %57 ], [ @.str.20, %61 ]
  %67 = getelementptr inbounds i8, ptr %0, i64 40
  %68 = load ptr, ptr %67, align 8, !tbaa !11
  invoke void (ptr, ptr, ...) %68(ptr noundef nonnull %0, ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.1, i32 noundef %65, ptr noundef nonnull %66)
          to label %74 unwind label %55

.critedge:                                        ; preds = %61
  %69 = call noundef ptr @_ZNKSt10unique_ptrI14TfLiteIntArrayPFvPS0_EEptEv(ptr noundef nonnull align 8 dereferenceable(16) %9) #5
  %70 = getelementptr inbounds i8, ptr %69, i64 4
  %71 = xor i64 %indvars.iv, -1
  %72 = add nsw i64 %21, %71
  %73 = getelementptr inbounds [0 x i32], ptr %70, i64 0, i64 %72
  store i32 %51, ptr %73, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.critedge50, label %.lr.ph, !llvm.loop !15

74:                                               ; preds = %.invoke
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #5
  br label %76

.critedge50:                                      ; preds = %.critedge, %5
  %75 = call noundef ptr @_ZNSt10unique_ptrI14TfLiteIntArrayPFvPS0_EE7releaseEv(ptr noundef nonnull align 8 dereferenceable(16) %9) #5
  store ptr %75, ptr %4, align 8, !tbaa !9
  br label %76

76:                                               ; preds = %74, %.critedge50
  %.3 = phi i32 [ 0, %.critedge50 ], [ 1, %74 ]
  call void @_ZNSt10unique_ptrI14TfLiteIntArrayPFvPS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %9) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  ret i32 %.3
}

attributes #0 = { mustprogress 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 = { "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 = { 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 = { 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 #5 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !10, i64 40}
!12 = !{!"_ZTS13TfLiteContext", !13, 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, !6, i64 72, !10, i64 80, !10, i64 88, !14, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !10, i64 152}
!13 = !{!"long", !7, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass