; LLVM IR from NVIDIA/tensorflow :: tensorflow/lite/experimental/micro/examples/micro_speech/micro_features (main)

; 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.tflite::MicroErrorReporter" = type { %"class.tflite::ErrorReporter" }
%"class.tflite::ErrorReporter" = type { ptr }
%struct.LogScaleState = type { i32, i32 }

@_ZN10micro_test12tests_passedE = external dso_local global i32, align 4
@_ZN10micro_test12tests_failedE = external dso_local global i32, align 4
@_ZN10micro_test16is_test_completeE = external dso_local global i8, align 1
@_ZN10micro_test13did_test_failE = external dso_local global i8, align 1
@_ZN10micro_test8reporterE = external dso_local global ptr, align 8
@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [31 x i8], align 1
@__const.main.fake_signal = external hidden unnamed_addr constant [2 x i32], align 4
@__const.main.expected = external hidden unnamed_addr constant [2 x i16], align 2
@.str.2 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [141 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [36 x i8], align 1
@__const.main.fake_signal.5 = external hidden unnamed_addr constant [2 x i32], align 4
@__const.main.expected.6 = external hidden unnamed_addr constant [2 x i16], align 2
@.str.7 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [25 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr noundef %1) #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca %"class.tflite::MicroErrorReporter", align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca %struct.LogScaleState, align 4
  %10 = alloca [2 x i32], align 4
  %11 = alloca ptr, align 8
  %12 = alloca [2 x i16], align 2
  %13 = alloca i32, align 4
  %14 = alloca %struct.LogScaleState, align 4
  %15 = alloca [2 x i32], align 4
  %16 = alloca ptr, align 8
  %17 = alloca [2 x i16], align 2
  %18 = alloca i32, align 4
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  store i32 0, ptr @_ZN10micro_test12tests_passedE, align 4, !tbaa !5
  store i32 0, ptr @_ZN10micro_test12tests_failedE, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  call void @_ZN6tflite18MicroErrorReporterC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  store ptr %6, ptr @_ZN10micro_test8reporterE, align 8, !tbaa !9
  %19 = load ptr, ptr @_ZN10micro_test8reporterE, align 8, !tbaa !9
  %20 = invoke noundef i32 (ptr, ptr, ...) @_ZN6tflite13ErrorReporter6ReportEPKcz(ptr noundef nonnull align 8 dereferenceable(8) %19, ptr noundef @.str, ptr noundef @.str.1)
          to label %21 unwind label %65

21:                                               ; preds = %2
  store i8 0, ptr @_ZN10micro_test16is_test_completeE, align 1, !tbaa !11
  store i8 0, ptr @_ZN10micro_test13did_test_failE, align 1, !tbaa !11
  br label %22

22:                                               ; preds = %84, %21
  %23 = load i8, ptr @_ZN10micro_test16is_test_completeE, align 1, !tbaa !11, !range !13, !noundef !14
  %24 = trunc i8 %23 to i1
  %25 = xor i1 %24, true
  br i1 %25, label %26, label %98

26:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %27 = getelementptr inbounds %struct.LogScaleState, ptr %9, i32 0, i32 0
  store i32 1, ptr %27, align 4, !tbaa !15
  %28 = getelementptr inbounds %struct.LogScaleState, ptr %9, i32 0, i32 1
  store i32 6, ptr %28, align 4, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %10, ptr align 4 @__const.main.fake_signal, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %29 = getelementptr inbounds [2 x i32], ptr %10, i64 0, i64 0
  %30 = invoke noundef ptr @_Z13LogScaleApplyP13LogScaleStatePjii(ptr noundef %9, ptr noundef %29, i32 noundef 2, i32 noundef -1)
          to label %31 unwind label %69

31:                                               ; preds = %26
  store ptr %30, ptr %11, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %12, ptr align 2 @__const.main.expected, i64 4, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %32

32:                                               ; preds = %80, %31
  %33 = load i32, ptr %13, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = icmp ult i64 %34, 2
  br i1 %35, label %36, label %83

36:                                               ; preds = %32
  br label %37

37:                                               ; preds = %36
  %38 = load ptr, ptr %11, align 8, !tbaa !9
  %39 = load i32, ptr %13, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds i16, ptr %38, i64 %40
  %42 = load i16, ptr %41, align 2, !tbaa !18
  %43 = zext i16 %42 to i32
  %44 = load i32, ptr %13, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [2 x i16], ptr %12, i64 0, i64 %45
  %47 = load i16, ptr %46, align 2, !tbaa !18
  %48 = zext i16 %47 to i32
  %49 = icmp ne i32 %43, %48
  br i1 %49, label %50, label %77

50:                                               ; preds = %37
  %51 = load ptr, ptr @_ZN10micro_test8reporterE, align 8, !tbaa !9
  %52 = load ptr, ptr %11, align 8, !tbaa !9
  %53 = load i32, ptr %13, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds i16, ptr %52, i64 %54
  %56 = load i16, ptr %55, align 2, !tbaa !18
  %57 = zext i16 %56 to i32
  %58 = load i32, ptr %13, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [2 x i16], ptr %12, i64 0, i64 %59
  %61 = load i16, ptr %60, align 2, !tbaa !18
  %62 = zext i16 %61 to i32
  %63 = invoke noundef i32 (ptr, ptr, ...) @_ZN6tflite13ErrorReporter6ReportEPKcz(ptr noundef nonnull align 8 dereferenceable(8) %51, ptr noundef @.str.2, ptr noundef @.str.3, i32 noundef 42, i32 noundef %57, i32 noundef %62)
          to label %64 unwind label %73

64:                                               ; preds = %50
  store i8 1, ptr @_ZN10micro_test13did_test_failE, align 1, !tbaa !11
  br label %77

65:                                               ; preds = %188, %184, %174, %98, %2
  %66 = landingpad { ptr, i32 }
          cleanup
  %67 = extractvalue { ptr, i32 } %66, 0
  store ptr %67, ptr %7, align 8
  %68 = extractvalue { ptr, i32 } %66, 1
  store i32 %68, ptr %8, align 4
  br label %194

69:                                               ; preds = %26
  %70 = landingpad { ptr, i32 }
          cleanup
  %71 = extractvalue { ptr, i32 } %70, 0
  store ptr %71, ptr %7, align 8
  %72 = extractvalue { ptr, i32 } %70, 1
  store i32 %72, ptr %8, align 4
  br label %97

73:                                               ; preds = %50
  %74 = landingpad { ptr, i32 }
          cleanup
  %75 = extractvalue { ptr, i32 } %74, 0
  store ptr %75, ptr %7, align 8
  %76 = extractvalue { ptr, i32 } %74, 1
  store i32 %76, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %97

77:                                               ; preds = %64, %37
  br label %78

78:                                               ; preds = %77
  br label %79

79:                                               ; preds = %78
  br label %80

80:                                               ; preds = %79
  %81 = load i32, ptr %13, align 4, !tbaa !5
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %13, align 4, !tbaa !5
  br label %32, !llvm.loop !20

83:                                               ; preds = %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %84

84:                                               ; preds = %83
  store i8 1, ptr @_ZN10micro_test16is_test_completeE, align 1, !tbaa !11
  %85 = load i8, ptr @_ZN10micro_test13did_test_failE, align 1, !tbaa !11, !range !13, !noundef !14
  %86 = trunc i8 %85 to i1
  %87 = zext i1 %86 to i64
  %88 = select i1 %86, i32 0, i32 1
  %89 = load i32, ptr @_ZN10micro_test12tests_passedE, align 4, !tbaa !5
  %90 = add nsw i32 %89, %88
  store i32 %90, ptr @_ZN10micro_test12tests_passedE, align 4, !tbaa !5
  %91 = load i8, ptr @_ZN10micro_test13did_test_failE, align 1, !tbaa !11, !range !13, !noundef !14
  %92 = trunc i8 %91 to i1
  %93 = zext i1 %92 to i64
  %94 = select i1 %92, i32 1, i32 0
  %95 = load i32, ptr @_ZN10micro_test12tests_failedE, align 4, !tbaa !5
  %96 = add nsw i32 %95, %94
  store i32 %96, ptr @_ZN10micro_test12tests_failedE, align 4, !tbaa !5
  br label %22, !llvm.loop !22

97:                                               ; preds = %73, %69
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %194

98:                                               ; preds = %22
  %99 = load ptr, ptr @_ZN10micro_test8reporterE, align 8, !tbaa !9
  %100 = invoke noundef i32 (ptr, ptr, ...) @_ZN6tflite13ErrorReporter6ReportEPKcz(ptr noundef nonnull align 8 dereferenceable(8) %99, ptr noundef @.str, ptr noundef @.str.4)
          to label %101 unwind label %65

101:                                              ; preds = %98
  store i8 0, ptr @_ZN10micro_test16is_test_completeE, align 1, !tbaa !11
  store i8 0, ptr @_ZN10micro_test13did_test_failE, align 1, !tbaa !11
  br label %102

102:                                              ; preds = %160, %101
  %103 = load i8, ptr @_ZN10micro_test16is_test_completeE, align 1, !tbaa !11, !range !13, !noundef !14
  %104 = trunc i8 %103 to i1
  %105 = xor i1 %104, true
  br i1 %105, label %106, label %174

106:                                              ; preds = %102
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %107 = getelementptr inbounds %struct.LogScaleState, ptr %14, i32 0, i32 0
  store i32 0, ptr %107, align 4, !tbaa !15
  %108 = getelementptr inbounds %struct.LogScaleState, ptr %14, i32 0, i32 1
  store i32 6, ptr %108, align 4, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 @__const.main.fake_signal.5, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %109 = getelementptr inbounds [2 x i32], ptr %15, i64 0, i64 0
  %110 = invoke noundef ptr @_Z13LogScaleApplyP13LogScaleStatePjii(ptr noundef %14, ptr noundef %109, i32 noundef 2, i32 noundef -1)
          to label %111 unwind label %145

111:                                              ; preds = %106
  store ptr %110, ptr %16, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 2 %17, ptr align 2 @__const.main.expected.6, i64 4, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  store i32 0, ptr %18, align 4, !tbaa !5
  br label %112

112:                                              ; preds = %156, %111
  %113 = load i32, ptr %18, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = icmp ult i64 %114, 2
  br i1 %115, label %116, label %159

116:                                              ; preds = %112
  br label %117

117:                                              ; preds = %116
  %118 = load ptr, ptr %16, align 8, !tbaa !9
  %119 = load i32, ptr %18, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds i16, ptr %118, i64 %120
  %122 = load i16, ptr %121, align 2, !tbaa !18
  %123 = zext i16 %122 to i32
  %124 = load i32, ptr %18, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [2 x i16], ptr %17, i64 0, i64 %125
  %127 = load i16, ptr %126, align 2, !tbaa !18
  %128 = zext i16 %127 to i32
  %129 = icmp ne i32 %123, %128
  br i1 %129, label %130, label %153

130:                                              ; preds = %117
  %131 = load ptr, ptr @_ZN10micro_test8reporterE, align 8, !tbaa !9
  %132 = load ptr, ptr %16, align 8, !tbaa !9
  %133 = load i32, ptr %18, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds i16, ptr %132, i64 %134
  %136 = load i16, ptr %135, align 2, !tbaa !18
  %137 = zext i16 %136 to i32
  %138 = load i32, ptr %18, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [2 x i16], ptr %17, i64 0, i64 %139
  %141 = load i16, ptr %140, align 2, !tbaa !18
  %142 = zext i16 %141 to i32
  %143 = invoke noundef i32 (ptr, ptr, ...) @_ZN6tflite13ErrorReporter6ReportEPKcz(ptr noundef nonnull align 8 dereferenceable(8) %131, ptr noundef @.str.2, ptr noundef @.str.3, i32 noundef 59, i32 noundef %137, i32 noundef %142)
          to label %144 unwind label %149

144:                                              ; preds = %130
  store i8 1, ptr @_ZN10micro_test13did_test_failE, align 1, !tbaa !11
  br label %153

145:                                              ; preds = %106
  %146 = landingpad { ptr, i32 }
          cleanup
  %147 = extractvalue { ptr, i32 } %146, 0
  store ptr %147, ptr %7, align 8
  %148 = extractvalue { ptr, i32 } %146, 1
  store i32 %148, ptr %8, align 4
  br label %173

149:                                              ; preds = %130
  %150 = landingpad { ptr, i32 }
          cleanup
  %151 = extractvalue { ptr, i32 } %150, 0
  store ptr %151, ptr %7, align 8
  %152 = extractvalue { ptr, i32 } %150, 1
  store i32 %152, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %173

153:                                              ; preds = %144, %117
  br label %154

154:                                              ; preds = %153
  br label %155

155:                                              ; preds = %154
  br label %156

156:                                              ; preds = %155
  %157 = load i32, ptr %18, align 4, !tbaa !5
  %158 = add nsw i32 %157, 1
  store i32 %158, ptr %18, align 4, !tbaa !5
  br label %112, !llvm.loop !23

159:                                              ; preds = %112
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %160

160:                                              ; preds = %159
  store i8 1, ptr @_ZN10micro_test16is_test_completeE, align 1, !tbaa !11
  %161 = load i8, ptr @_ZN10micro_test13did_test_failE, align 1, !tbaa !11, !range !13, !noundef !14
  %162 = trunc i8 %161 to i1
  %163 = zext i1 %162 to i64
  %164 = select i1 %162, i32 0, i32 1
  %165 = load i32, ptr @_ZN10micro_test12tests_passedE, align 4, !tbaa !5
  %166 = add nsw i32 %165, %164
  store i32 %166, ptr @_ZN10micro_test12tests_passedE, align 4, !tbaa !5
  %167 = load i8, ptr @_ZN10micro_test13did_test_failE, align 1, !tbaa !11, !range !13, !noundef !14
  %168 = trunc i8 %167 to i1
  %169 = zext i1 %168 to i64
  %170 = select i1 %168, i32 1, i32 0
  %171 = load i32, ptr @_ZN10micro_test12tests_failedE, align 4, !tbaa !5
  %172 = add nsw i32 %171, %170
  store i32 %172, ptr @_ZN10micro_test12tests_failedE, align 4, !tbaa !5
  br label %102, !llvm.loop !24

173:                                              ; preds = %149, %145
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %194

174:                                              ; preds = %102
  %175 = load ptr, ptr @_ZN10micro_test8reporterE, align 8, !tbaa !9
  %176 = load i32, ptr @_ZN10micro_test12tests_passedE, align 4, !tbaa !5
  %177 = load i32, ptr @_ZN10micro_test12tests_failedE, align 4, !tbaa !5
  %178 = load i32, ptr @_ZN10micro_test12tests_passedE, align 4, !tbaa !5
  %179 = add nsw i32 %177, %178
  %180 = invoke noundef i32 (ptr, ptr, ...) @_ZN6tflite13ErrorReporter6ReportEPKcz(ptr noundef nonnull align 8 dereferenceable(8) %175, ptr noundef @.str.7, i32 noundef %176, i32 noundef %179)
          to label %181 unwind label %65

181:                                              ; preds = %174
  %182 = load i32, ptr @_ZN10micro_test12tests_failedE, align 4, !tbaa !5
  %183 = icmp eq i32 %182, 0
  br i1 %183, label %184, label %188

184:                                              ; preds = %181
  %185 = load ptr, ptr @_ZN10micro_test8reporterE, align 8, !tbaa !9
  %186 = invoke noundef i32 (ptr, ptr, ...) @_ZN6tflite13ErrorReporter6ReportEPKcz(ptr noundef nonnull align 8 dereferenceable(8) %185, ptr noundef @.str.8)
          to label %187 unwind label %65

187:                                              ; preds = %184
  br label %192

188:                                              ; preds = %181
  %189 = load ptr, ptr @_ZN10micro_test8reporterE, align 8, !tbaa !9
  %190 = invoke noundef i32 (ptr, ptr, ...) @_ZN6tflite13ErrorReporter6ReportEPKcz(ptr noundef nonnull align 8 dereferenceable(8) %189, ptr noundef @.str.9)
          to label %191 unwind label %65

191:                                              ; preds = %188
  br label %192

192:                                              ; preds = %191, %187
  call void @_ZN6tflite13ErrorReporterD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  %193 = load i32, ptr %3, align 4
  ret i32 %193

194:                                              ; preds = %173, %97, %65
  call void @_ZN6tflite13ErrorReporterD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  br label %195

195:                                              ; preds = %194
  %196 = load ptr, ptr %7, align 8
  %197 = load i32, ptr %8, align 4
  %198 = insertvalue { ptr, i32 } poison, ptr %196, 0
  %199 = insertvalue { ptr, i32 } %198, i32 %197, 1
  resume { ptr, i32 } %199
}

; 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 void @_ZN6tflite18MicroErrorReporterC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #2 align 2

declare noundef i32 @_ZN6tflite13ErrorReporter6ReportEPKcz(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, ...) #3

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

declare noundef ptr @_Z13LogScaleApplyP13LogScaleStatePjii(ptr noundef, ptr noundef, i32 noundef, 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 nounwind uwtable
declare dso_local void @_ZN6tflite13ErrorReporterD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #5 align 2

attributes #0 = { mustprogress norecurse 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { 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, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!16, !6, i64 0}
!16 = !{!"_ZTS13LogScaleState", !6, i64 0, !6, i64 4}
!17 = !{!16, !6, i64 4}
!18 = !{!19, !19, i64 0}
!19 = !{!"short", !7, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = distinct !{!22, !21}
!23 = distinct !{!23, !21}
!24 = distinct !{!24, !21}


; 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.tflite::MicroErrorReporter" = type { %"class.tflite::ErrorReporter" }
%"class.tflite::ErrorReporter" = type { ptr }
%struct.LogScaleState = type { i32, i32 }

@_ZN10micro_test12tests_passedE = external dso_local local_unnamed_addr global i32, align 4
@_ZN10micro_test12tests_failedE = external dso_local local_unnamed_addr global i32, align 4
@_ZN10micro_test16is_test_completeE = external dso_local local_unnamed_addr global i8, align 1
@_ZN10micro_test13did_test_failE = external dso_local local_unnamed_addr global i8, align 1
@_ZN10micro_test8reporterE = external dso_local local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [31 x i8], align 1
@__const.main.fake_signal = external hidden unnamed_addr constant [2 x i32], align 4
@__const.main.expected = external hidden unnamed_addr constant [2 x i16], align 2
@.str.2 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [141 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [36 x i8], align 1
@__const.main.fake_signal.5 = external hidden unnamed_addr constant [2 x i32], align 4
@__const.main.expected.6 = external hidden unnamed_addr constant [2 x i16], align 2
@.str.7 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [25 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.tflite::MicroErrorReporter", align 8
  %4 = alloca %struct.LogScaleState, align 4
  %5 = alloca [2 x i32], align 8
  %6 = alloca %struct.LogScaleState, align 4
  %7 = alloca [2 x i32], align 8
  store i32 0, ptr @_ZN10micro_test12tests_passedE, align 4, !tbaa !5
  store i32 0, ptr @_ZN10micro_test12tests_failedE, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  call void @_ZN6tflite18MicroErrorReporterC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  store ptr %3, ptr @_ZN10micro_test8reporterE, align 8, !tbaa !9
  %8 = invoke noundef i32 (ptr, ptr, ...) @_ZN6tflite13ErrorReporter6ReportEPKcz(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1)
          to label %9 unwind label %21

9:                                                ; preds = %2
  store i8 0, ptr @_ZN10micro_test16is_test_completeE, align 1, !tbaa !11
  store i8 0, ptr @_ZN10micro_test13did_test_failE, align 1, !tbaa !11
  %10 = load i64, ptr @__const.main.fake_signal, align 4
  %11 = getelementptr inbounds i8, ptr %4, i64 4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  store i32 1, ptr %4, align 4, !tbaa !13
  store i32 6, ptr %11, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  store i64 %10, ptr %5, align 8
  %12 = invoke noundef ptr @_Z13LogScaleApplyP13LogScaleStatePjii(ptr noundef nonnull %4, ptr noundef nonnull %5, i32 noundef 2, i32 noundef -1)
          to label %.preheader35.preheader unwind label %23

.preheader35.preheader:                           ; preds = %9
  %13 = load i16, ptr %12, align 2, !tbaa !16
  %14 = load i16, ptr @__const.main.expected, align 2, !tbaa !16
  %.not31 = icmp eq i16 %13, %14
  br i1 %.not31, label %.preheader35.1, label %15

15:                                               ; preds = %.preheader35.preheader
  %16 = zext i16 %14 to i32
  %17 = zext i16 %13 to i32
  %18 = load ptr, ptr @_ZN10micro_test8reporterE, align 8, !tbaa !9
  %19 = invoke noundef i32 (ptr, ptr, ...) @_ZN6tflite13ErrorReporter6ReportEPKcz(ptr noundef nonnull align 8 dereferenceable(8) %18, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, i32 noundef 42, i32 noundef %17, i32 noundef %16)
          to label %20 unwind label %25

20:                                               ; preds = %15
  store i8 1, ptr @_ZN10micro_test13did_test_failE, align 1, !tbaa !11
  br label %.preheader35.1

21:                                               ; preds = %.invoke, %._crit_edge40, %._crit_edge, %2
  %22 = landingpad { ptr, i32 }
          cleanup
  br label %87

23:                                               ; preds = %9
  %24 = landingpad { ptr, i32 }
          cleanup
  br label %36

25:                                               ; preds = %30, %15
  %26 = landingpad { ptr, i32 }
          cleanup
  br label %36

.preheader35.1:                                   ; preds = %.preheader35.preheader, %20
  %27 = getelementptr inbounds i8, ptr %12, i64 2
  %28 = load i16, ptr %27, align 2, !tbaa !16
  %29 = load i16, ptr getelementptr inbounds (i8, ptr @__const.main.expected, i64 2), align 2, !tbaa !16
  %.not31.1 = icmp eq i16 %28, %29
  br i1 %.not31.1, label %.preheader35.1._crit_edge, label %30

.preheader35.1._crit_edge:                        ; preds = %.preheader35.1
  %.pre = load i8, ptr @_ZN10micro_test13did_test_failE, align 1, !tbaa !11, !range !18
  br label %._crit_edge

30:                                               ; preds = %.preheader35.1
  %31 = zext i16 %29 to i32
  %32 = zext i16 %28 to i32
  %33 = load ptr, ptr @_ZN10micro_test8reporterE, align 8, !tbaa !9
  %34 = invoke noundef i32 (ptr, ptr, ...) @_ZN6tflite13ErrorReporter6ReportEPKcz(ptr noundef nonnull align 8 dereferenceable(8) %33, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, i32 noundef 42, i32 noundef %32, i32 noundef %31)
          to label %35 unwind label %25

35:                                               ; preds = %30
  store i8 1, ptr @_ZN10micro_test13did_test_failE, align 1, !tbaa !11
  br label %._crit_edge

36:                                               ; preds = %25, %23
  %.pn32 = phi { ptr, i32 } [ %26, %25 ], [ %24, %23 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  br label %87

._crit_edge:                                      ; preds = %.preheader35.1._crit_edge, %35
  %37 = phi i8 [ %.pre, %.preheader35.1._crit_edge ], [ 1, %35 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  store i8 1, ptr @_ZN10micro_test16is_test_completeE, align 1, !tbaa !11
  %38 = xor i8 %37, 1
  %not.30 = zext nneg i8 %38 to i32
  %39 = load i32, ptr @_ZN10micro_test12tests_passedE, align 4, !tbaa !5
  %40 = add nsw i32 %39, %not.30
  store i32 %40, ptr @_ZN10micro_test12tests_passedE, align 4, !tbaa !5
  %41 = zext nneg i8 %37 to i32
  %42 = load i32, ptr @_ZN10micro_test12tests_failedE, align 4, !tbaa !5
  %43 = add nsw i32 %42, %41
  store i32 %43, ptr @_ZN10micro_test12tests_failedE, align 4, !tbaa !5
  %44 = load ptr, ptr @_ZN10micro_test8reporterE, align 8, !tbaa !9
  %45 = invoke noundef i32 (ptr, ptr, ...) @_ZN6tflite13ErrorReporter6ReportEPKcz(ptr noundef nonnull align 8 dereferenceable(8) %44, ptr noundef nonnull @.str, ptr noundef nonnull @.str.4)
          to label %46 unwind label %21

46:                                               ; preds = %._crit_edge
  store i8 0, ptr @_ZN10micro_test16is_test_completeE, align 1, !tbaa !11
  store i8 0, ptr @_ZN10micro_test13did_test_failE, align 1, !tbaa !11
  %47 = load i64, ptr @__const.main.fake_signal.5, align 4
  %48 = getelementptr inbounds i8, ptr %6, i64 4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  store i32 0, ptr %6, align 4, !tbaa !13
  store i32 6, ptr %48, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  store i64 %47, ptr %7, align 8
  %49 = invoke noundef ptr @_Z13LogScaleApplyP13LogScaleStatePjii(ptr noundef nonnull %6, ptr noundef nonnull %7, i32 noundef 2, i32 noundef -1)
          to label %.preheader.preheader unwind label %58

.preheader.preheader:                             ; preds = %46
  %50 = load i16, ptr %49, align 2, !tbaa !16
  %51 = load i16, ptr @__const.main.expected.6, align 2, !tbaa !16
  %.not = icmp eq i16 %50, %51
  br i1 %.not, label %.preheader.1, label %52

52:                                               ; preds = %.preheader.preheader
  %53 = zext i16 %51 to i32
  %54 = zext i16 %50 to i32
  %55 = load ptr, ptr @_ZN10micro_test8reporterE, align 8, !tbaa !9
  %56 = invoke noundef i32 (ptr, ptr, ...) @_ZN6tflite13ErrorReporter6ReportEPKcz(ptr noundef nonnull align 8 dereferenceable(8) %55, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, i32 noundef 59, i32 noundef %54, i32 noundef %53)
          to label %57 unwind label %60

57:                                               ; preds = %52
  store i8 1, ptr @_ZN10micro_test13did_test_failE, align 1, !tbaa !11
  br label %.preheader.1

58:                                               ; preds = %46
  %59 = landingpad { ptr, i32 }
          cleanup
  br label %71

60:                                               ; preds = %65, %52
  %61 = landingpad { ptr, i32 }
          cleanup
  br label %71

.preheader.1:                                     ; preds = %.preheader.preheader, %57
  %62 = getelementptr inbounds i8, ptr %49, i64 2
  %63 = load i16, ptr %62, align 2, !tbaa !16
  %64 = load i16, ptr getelementptr inbounds (i8, ptr @__const.main.expected.6, i64 2), align 2, !tbaa !16
  %.not.1 = icmp eq i16 %63, %64
  br i1 %.not.1, label %.preheader.1._crit_edge, label %65

.preheader.1._crit_edge:                          ; preds = %.preheader.1
  %.pre44 = load i8, ptr @_ZN10micro_test13did_test_failE, align 1, !tbaa !11, !range !18
  br label %._crit_edge40

65:                                               ; preds = %.preheader.1
  %66 = zext i16 %64 to i32
  %67 = zext i16 %63 to i32
  %68 = load ptr, ptr @_ZN10micro_test8reporterE, align 8, !tbaa !9
  %69 = invoke noundef i32 (ptr, ptr, ...) @_ZN6tflite13ErrorReporter6ReportEPKcz(ptr noundef nonnull align 8 dereferenceable(8) %68, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, i32 noundef 59, i32 noundef %67, i32 noundef %66)
          to label %70 unwind label %60

70:                                               ; preds = %65
  store i8 1, ptr @_ZN10micro_test13did_test_failE, align 1, !tbaa !11
  br label %._crit_edge40

71:                                               ; preds = %60, %58
  %.pn = phi { ptr, i32 } [ %61, %60 ], [ %59, %58 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  br label %87

._crit_edge40:                                    ; preds = %.preheader.1._crit_edge, %70
  %72 = phi i8 [ %.pre44, %.preheader.1._crit_edge ], [ 1, %70 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  store i8 1, ptr @_ZN10micro_test16is_test_completeE, align 1, !tbaa !11
  %73 = xor i8 %72, 1
  %not. = zext nneg i8 %73 to i32
  %74 = load i32, ptr @_ZN10micro_test12tests_passedE, align 4, !tbaa !5
  %75 = add nsw i32 %74, %not.
  store i32 %75, ptr @_ZN10micro_test12tests_passedE, align 4, !tbaa !5
  %76 = zext nneg i8 %72 to i32
  %77 = load i32, ptr @_ZN10micro_test12tests_failedE, align 4, !tbaa !5
  %78 = add nsw i32 %77, %76
  store i32 %78, ptr @_ZN10micro_test12tests_failedE, align 4, !tbaa !5
  %79 = load ptr, ptr @_ZN10micro_test8reporterE, align 8, !tbaa !9
  %80 = add nsw i32 %78, %75
  %81 = invoke noundef i32 (ptr, ptr, ...) @_ZN6tflite13ErrorReporter6ReportEPKcz(ptr noundef nonnull align 8 dereferenceable(8) %79, ptr noundef nonnull @.str.7, i32 noundef %75, i32 noundef %80)
          to label %.invoke unwind label %21

.invoke:                                          ; preds = %._crit_edge40
  %82 = load i32, ptr @_ZN10micro_test12tests_failedE, align 4, !tbaa !5
  %83 = icmp eq i32 %82, 0
  %84 = load ptr, ptr @_ZN10micro_test8reporterE, align 8, !tbaa !9
  %.str.8..str.9 = select i1 %83, ptr @.str.8, ptr @.str.9
  %85 = invoke noundef i32 (ptr, ptr, ...) @_ZN6tflite13ErrorReporter6ReportEPKcz(ptr noundef nonnull align 8 dereferenceable(8) %84, ptr noundef nonnull %.str.8..str.9)
          to label %86 unwind label %21

86:                                               ; preds = %.invoke
  call void @_ZN6tflite13ErrorReporterD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  ret i32 0

87:                                               ; preds = %71, %36, %21
  %.pn32.pn = phi { ptr, i32 } [ %.pn32, %36 ], [ %.pn, %71 ], [ %22, %21 ]
  call void @_ZN6tflite13ErrorReporterD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  resume { ptr, i32 } %.pn32.pn
}

; 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 void @_ZN6tflite18MicroErrorReporterC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #2 align 2

declare noundef i32 @_ZN6tflite13ErrorReporter6ReportEPKcz(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, ...) local_unnamed_addr #3

declare i32 @__gxx_personality_v0(...)

declare noundef ptr @_Z13LogScaleApplyP13LogScaleStatePjii(ptr noundef, ptr noundef, i32 noundef, 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 nounwind uwtable
declare dso_local void @_ZN6tflite13ErrorReporterD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #4 align 2

attributes #0 = { mustprogress norecurse 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 = { 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 #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, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!14, !6, i64 0}
!14 = !{!"_ZTS13LogScaleState", !6, i64 0, !6, i64 4}
!15 = !{!14, !6, i64 4}
!16 = !{!17, !17, i64 0}
!17 = !{!"short", !7, i64 0}
!18 = !{i8 0, i8 2}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass