; LLVM IR from tensorflow/tflite-micro :: tensorflow/lite/experimental/microfrontend/lib (pcan_gain_control_test)

; 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.(anonymous namespace)::PcanGainControlTestConfig" = type { %struct.PcanGainControlConfig }
%struct.PcanGainControlConfig = type { i32, float, float, i32 }
%struct.PcanGainControlState = type { i32, ptr, i32, ptr, 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
@.str = external hidden unnamed_addr constant [48 x i8], align 1
@__const.main.estimate = external hidden unnamed_addr constant [2 x i32], align 4
@.str.1 = external hidden unnamed_addr constant [128 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [130 x i8], align 1
@__const.main.signal = external hidden unnamed_addr constant [2 x i32], align 4
@__const.main.expected = external hidden unnamed_addr constant [2 x i32], align 4
@.str.3 = external hidden unnamed_addr constant [106 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [106 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.11 = 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 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca [2 x i32], align 4
  %7 = alloca %"class.(anonymous namespace)::PcanGainControlTestConfig", align 4
  %8 = alloca %struct.PcanGainControlState, align 8
  %9 = alloca [2 x i32], align 4
  %10 = alloca [2 x i32], align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i8, align 1
  %14 = alloca i8, align 1
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i8, align 1
  %20 = alloca i8, align 1
  %21 = 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 @_ZN6tflite14InitializeTestEv()
  call void (ptr, ...) @_Z11MicroPrintfPKcz(ptr noundef @.str)
  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 = %151, %2
  %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 %164

26:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %6, ptr align 4 @__const.main.estimate, i64 8, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #6
  call void @_ZN12_GLOBAL__N_125PcanGainControlTestConfigC2Ev(ptr noundef nonnull align 4 dereferenceable(16) %7)
  call void @llvm.lifetime.start.p0(i64 40, ptr %8) #6
  br label %27

27:                                               ; preds = %26
  %28 = getelementptr inbounds %"class.(anonymous namespace)::PcanGainControlTestConfig", ptr %7, i32 0, i32 0
  %29 = getelementptr inbounds [2 x i32], ptr %6, i64 0, i64 0
  %30 = call i32 @PcanGainControlPopulateState(ptr noundef %28, ptr noundef %8, ptr noundef %29, i32 noundef 2, i16 noundef zeroext 10, i32 noundef -1)
  %31 = icmp ne i32 %30, 0
  br i1 %31, label %33, label %32

32:                                               ; preds = %27
  call void (ptr, ...) @_Z11MicroPrintfPKcz(ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 49)
  store i8 1, ptr @_ZN10micro_test13did_test_failE, align 1, !tbaa !11
  br label %33

33:                                               ; preds = %32, %27
  br label %34

34:                                               ; preds = %33
  br label %35

35:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %9, ptr align 4 @__const.main.signal, i64 8, i1 false)
  %36 = getelementptr inbounds [2 x i32], ptr %9, i64 0, i64 0
  call void @PcanGainControlApply(ptr noundef %8, ptr noundef %36)
  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.expected, i64 8, i1 false)
  br label %37

37:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %38 = getelementptr inbounds %struct.PcanGainControlState, ptr %8, i32 0, i32 2
  %39 = load i32, ptr %38, align 8, !tbaa !15
  store i32 %39, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 2, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #6
  store i8 0, ptr %13, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %14) #6
  store i8 0, ptr %14, align 1, !tbaa !11
  %40 = load i8, ptr %13, align 1, !tbaa !11, !range !13, !noundef !14
  %41 = trunc i8 %40 to i1
  br i1 %41, label %42, label %68

42:                                               ; preds = %37
  %43 = load i8, ptr %14, align 1, !tbaa !11, !range !13, !noundef !14
  %44 = trunc i8 %43 to i1
  br i1 %44, label %45, label %68

45:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  %46 = load i32, ptr %11, align 4, !tbaa !5
  %47 = load i32, ptr %12, align 4, !tbaa !5
  %48 = icmp sgt i32 %46, %47
  br i1 %48, label %49, label %53

49:                                               ; preds = %45
  %50 = load i32, ptr %11, align 4, !tbaa !5
  %51 = load i32, ptr %12, align 4, !tbaa !5
  %52 = sub nsw i32 %50, %51
  br label %57

53:                                               ; preds = %45
  %54 = load i32, ptr %12, align 4, !tbaa !5
  %55 = load i32, ptr %11, align 4, !tbaa !5
  %56 = sub nsw i32 %54, %55
  br label %57

57:                                               ; preds = %53, %49
  %58 = phi i32 [ %52, %49 ], [ %56, %53 ]
  store i32 %58, ptr %15, align 4, !tbaa !5
  %59 = load i32, ptr %15, align 4, !tbaa !5
  %60 = call noundef i32 @_ZNSt14numeric_limitsIiE7epsilonEv() #6
  %61 = icmp sgt i32 %59, %60
  br i1 %61, label %62, label %67

62:                                               ; preds = %57
  %63 = load i32, ptr %11, align 4, !tbaa !5
  %64 = sitofp i32 %63 to double
  %65 = load i32, ptr %12, align 4, !tbaa !5
  %66 = sitofp i32 %65 to double
  call void (ptr, ...) @_Z11MicroPrintfPKcz(ptr noundef @.str.3, ptr noundef @.str.2, i32 noundef 56, double noundef %64, double noundef %66)
  store i8 1, ptr @_ZN10micro_test13did_test_failE, align 1, !tbaa !11
  br label %67

67:                                               ; preds = %62, %57
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  br label %83

68:                                               ; preds = %42, %37
  %69 = load i32, ptr %11, align 4, !tbaa !5
  %70 = load i32, ptr %12, align 4, !tbaa !5
  %71 = icmp ne i32 %69, %70
  br i1 %71, label %72, label %82

72:                                               ; preds = %68
  %73 = load i32, ptr %11, align 4, !tbaa !5
  %74 = load i32, ptr %12, align 4, !tbaa !5
  call void (ptr, ...) @_Z11MicroPrintfPKcz(ptr noundef @.str.4, ptr noundef @.str.2, i32 noundef 56, i32 noundef %73, i32 noundef %74)
  %75 = load i8, ptr %13, align 1, !tbaa !11, !range !13, !noundef !14
  %76 = trunc i8 %75 to i1
  br i1 %76, label %80, label %77

77:                                               ; preds = %72
  %78 = load i8, ptr %14, align 1, !tbaa !11, !range !13, !noundef !14
  %79 = trunc i8 %78 to i1
  br i1 %79, label %80, label %81

80:                                               ; preds = %77, %72
  call void (ptr, ...) @_Z11MicroPrintfPKcz(ptr noundef @.str.5)
  call void (ptr, ...) @_Z11MicroPrintfPKcz(ptr noundef @.str.6)
  br label %81

81:                                               ; preds = %80, %77
  store i8 1, ptr @_ZN10micro_test13did_test_failE, align 1, !tbaa !11
  br label %82

82:                                               ; preds = %81, %68
  br label %83

83:                                               ; preds = %82, %67
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %84

84:                                               ; preds = %83
  br label %85

85:                                               ; preds = %84
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  store i32 0, ptr %16, align 4, !tbaa !5
  br label %86

86:                                               ; preds = %147, %85
  %87 = load i32, ptr %16, align 4, !tbaa !5
  %88 = getelementptr inbounds %struct.PcanGainControlState, ptr %8, i32 0, i32 2
  %89 = load i32, ptr %88, align 8, !tbaa !15
  %90 = icmp slt i32 %87, %89
  br i1 %90, label %91, label %150

91:                                               ; preds = %86
  br label %92

92:                                               ; preds = %91
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  %93 = load i32, ptr %16, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [2 x i32], ptr %9, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !5
  store i32 %96, ptr %17, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  %97 = load i32, ptr %16, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [2 x i32], ptr %10, i64 0, i64 %98
  %100 = load i32, ptr %99, align 4, !tbaa !5
  store i32 %100, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %19) #6
  store i8 0, ptr %19, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %20) #6
  store i8 0, ptr %20, align 1, !tbaa !11
  %101 = load i8, ptr %19, align 1, !tbaa !11, !range !13, !noundef !14
  %102 = trunc i8 %101 to i1
  br i1 %102, label %103, label %129

103:                                              ; preds = %92
  %104 = load i8, ptr %20, align 1, !tbaa !11, !range !13, !noundef !14
  %105 = trunc i8 %104 to i1
  br i1 %105, label %106, label %129

106:                                              ; preds = %103
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  %107 = load i32, ptr %17, align 4, !tbaa !5
  %108 = load i32, ptr %18, align 4, !tbaa !5
  %109 = icmp ugt i32 %107, %108
  br i1 %109, label %110, label %114

110:                                              ; preds = %106
  %111 = load i32, ptr %17, align 4, !tbaa !5
  %112 = load i32, ptr %18, align 4, !tbaa !5
  %113 = sub i32 %111, %112
  br label %118

114:                                              ; preds = %106
  %115 = load i32, ptr %18, align 4, !tbaa !5
  %116 = load i32, ptr %17, align 4, !tbaa !5
  %117 = sub i32 %115, %116
  br label %118

118:                                              ; preds = %114, %110
  %119 = phi i32 [ %113, %110 ], [ %117, %114 ]
  store i32 %119, ptr %21, align 4, !tbaa !5
  %120 = load i32, ptr %21, align 4, !tbaa !5
  %121 = call noundef i32 @_ZNSt14numeric_limitsIjE7epsilonEv() #6
  %122 = icmp ugt i32 %120, %121
  br i1 %122, label %123, label %128

123:                                              ; preds = %118
  %124 = load i32, ptr %17, align 4, !tbaa !5
  %125 = uitofp i32 %124 to double
  %126 = load i32, ptr %18, align 4, !tbaa !5
  %127 = uitofp i32 %126 to double
  call void (ptr, ...) @_Z11MicroPrintfPKcz(ptr noundef @.str.7, ptr noundef @.str.2, i32 noundef 59, double noundef %125, double noundef %127)
  store i8 1, ptr @_ZN10micro_test13did_test_failE, align 1, !tbaa !11
  br label %128

128:                                              ; preds = %123, %118
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  br label %144

129:                                              ; preds = %103, %92
  %130 = load i32, ptr %17, align 4, !tbaa !5
  %131 = load i32, ptr %18, align 4, !tbaa !5
  %132 = icmp ne i32 %130, %131
  br i1 %132, label %133, label %143

133:                                              ; preds = %129
  %134 = load i32, ptr %17, align 4, !tbaa !5
  %135 = load i32, ptr %18, align 4, !tbaa !5
  call void (ptr, ...) @_Z11MicroPrintfPKcz(ptr noundef @.str.8, ptr noundef @.str.2, i32 noundef 59, i32 noundef %134, i32 noundef %135)
  %136 = load i8, ptr %19, align 1, !tbaa !11, !range !13, !noundef !14
  %137 = trunc i8 %136 to i1
  br i1 %137, label %141, label %138

138:                                              ; preds = %133
  %139 = load i8, ptr %20, align 1, !tbaa !11, !range !13, !noundef !14
  %140 = trunc i8 %139 to i1
  br i1 %140, label %141, label %142

141:                                              ; preds = %138, %133
  call void (ptr, ...) @_Z11MicroPrintfPKcz(ptr noundef @.str.5)
  call void (ptr, ...) @_Z11MicroPrintfPKcz(ptr noundef @.str.6)
  br label %142

142:                                              ; preds = %141, %138
  store i8 1, ptr @_ZN10micro_test13did_test_failE, align 1, !tbaa !11
  br label %143

143:                                              ; preds = %142, %129
  br label %144

144:                                              ; preds = %143, %128
  call void @llvm.lifetime.end.p0(i64 1, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %145

145:                                              ; preds = %144
  br label %146

146:                                              ; preds = %145
  br label %147

147:                                              ; preds = %146
  %148 = load i32, ptr %16, align 4, !tbaa !5
  %149 = add nsw i32 %148, 1
  store i32 %149, ptr %16, align 4, !tbaa !5
  br label %86, !llvm.loop !17

150:                                              ; preds = %86
  call void @PcanGainControlFreeStateContents(ptr noundef %8)
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 40, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  br label %151

151:                                              ; preds = %150
  store i8 1, ptr @_ZN10micro_test16is_test_completeE, align 1, !tbaa !11
  %152 = load i8, ptr @_ZN10micro_test13did_test_failE, align 1, !tbaa !11, !range !13, !noundef !14
  %153 = trunc i8 %152 to i1
  %154 = zext i1 %153 to i64
  %155 = select i1 %153, i32 0, i32 1
  %156 = load i32, ptr @_ZN10micro_test12tests_passedE, align 4, !tbaa !5
  %157 = add nsw i32 %156, %155
  store i32 %157, ptr @_ZN10micro_test12tests_passedE, align 4, !tbaa !5
  %158 = load i8, ptr @_ZN10micro_test13did_test_failE, align 1, !tbaa !11, !range !13, !noundef !14
  %159 = trunc i8 %158 to i1
  %160 = zext i1 %159 to i64
  %161 = select i1 %159, i32 1, i32 0
  %162 = load i32, ptr @_ZN10micro_test12tests_failedE, align 4, !tbaa !5
  %163 = add nsw i32 %162, %161
  store i32 %163, ptr @_ZN10micro_test12tests_failedE, align 4, !tbaa !5
  br label %22, !llvm.loop !19

164:                                              ; preds = %22
  %165 = load i32, ptr @_ZN10micro_test12tests_passedE, align 4, !tbaa !5
  %166 = load i32, ptr @_ZN10micro_test12tests_failedE, align 4, !tbaa !5
  %167 = load i32, ptr @_ZN10micro_test12tests_passedE, align 4, !tbaa !5
  %168 = add nsw i32 %166, %167
  call void (ptr, ...) @_Z11MicroPrintfPKcz(ptr noundef @.str.9, i32 noundef %165, i32 noundef %168)
  %169 = load i32, ptr @_ZN10micro_test12tests_failedE, align 4, !tbaa !5
  %170 = icmp eq i32 %169, 0
  br i1 %170, label %171, label %172

171:                                              ; preds = %164
  call void (ptr, ...) @_Z11MicroPrintfPKcz(ptr noundef @.str.10)
  store i32 0, ptr %3, align 4
  br label %173

172:                                              ; preds = %164
  call void (ptr, ...) @_Z11MicroPrintfPKcz(ptr noundef @.str.11)
  store i32 1, ptr %3, align 4
  br label %173

173:                                              ; preds = %172, %171
  %174 = load i32, ptr %3, align 4
  ret i32 %174
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6tflite14InitializeTestEv() #1

declare void @_Z11MicroPrintfPKcz(ptr noundef, ...) #2

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

; 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

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZN12_GLOBAL__N_125PcanGainControlTestConfigC2Ev(ptr noundef nonnull align 4 dereferenceable(16)) unnamed_addr #5 align 2

declare i32 @PcanGainControlPopulateState(ptr noundef, ptr noundef, ptr noundef, i32 noundef, i16 noundef zeroext, i32 noundef) #2

declare void @PcanGainControlApply(ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNSt14numeric_limitsIiE7epsilonEv() #5 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNSt14numeric_limitsIjE7epsilonEv() #5 align 2

declare void @PcanGainControlFreeStateContents(ptr noundef) #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 = { inlinehint 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" }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 16}
!16 = !{!"_ZTS20PcanGainControlState", !6, i64 0, !10, i64 8, !6, i64 16, !10, i64 24, !6, i64 32}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}


; 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.(anonymous namespace)::PcanGainControlTestConfig" = type { %struct.PcanGainControlConfig }
%struct.PcanGainControlConfig = type { i32, float, float, i32 }
%struct.PcanGainControlState = type { i32, ptr, i32, ptr, 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
@.str = external hidden unnamed_addr constant [48 x i8], align 1
@__const.main.estimate = external hidden unnamed_addr constant [2 x i32], align 4
@.str.1 = external hidden unnamed_addr constant [128 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [130 x i8], align 1
@__const.main.signal = external hidden unnamed_addr constant [2 x i32], align 4
@__const.main.expected = external hidden unnamed_addr constant [2 x i32], align 4
@.str.4 = external hidden unnamed_addr constant [106 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [25 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef range(i32 0, 2) i32 @main(i32 noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #0 {
  %3 = alloca [2 x i32], align 8
  %4 = alloca %"class.(anonymous namespace)::PcanGainControlTestConfig", align 4
  %5 = alloca %struct.PcanGainControlState, align 8
  %6 = 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
  tail call void @_ZN6tflite14InitializeTestEv()
  tail call void (ptr, ...) @_Z11MicroPrintfPKcz(ptr noundef nonnull @.str)
  store i8 0, ptr @_ZN10micro_test16is_test_completeE, align 1, !tbaa !9
  store i8 0, ptr @_ZN10micro_test13did_test_failE, align 1, !tbaa !9
  %7 = load i64, ptr @__const.main.signal, align 4
  %8 = getelementptr inbounds i8, ptr %5, i64 16
  %9 = load i64, ptr @__const.main.estimate, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  store i64 %9, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #5
  call void @_ZN12_GLOBAL__N_125PcanGainControlTestConfigC2Ev(ptr noundef nonnull align 4 dereferenceable(16) %4)
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %5) #5
  %10 = call i32 @PcanGainControlPopulateState(ptr noundef nonnull %4, ptr noundef nonnull %5, ptr noundef nonnull %3, i32 noundef 2, i16 noundef zeroext 10, i32 noundef -1)
  %.not = icmp eq i32 %10, 0
  br i1 %.not, label %11, label %12

11:                                               ; preds = %2
  call void (ptr, ...) @_Z11MicroPrintfPKcz(ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 49)
  store i8 1, ptr @_ZN10micro_test13did_test_failE, align 1, !tbaa !9
  br label %12

12:                                               ; preds = %11, %2
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  store i64 %7, ptr %6, align 8
  call void @PcanGainControlApply(ptr noundef nonnull %5, ptr noundef nonnull %6)
  %13 = load i32, ptr %8, align 8, !tbaa !11
  %.not47 = icmp eq i32 %13, 2
  br i1 %.not47, label %.lr.ph.preheader, label %14

14:                                               ; preds = %12
  call void (ptr, ...) @_Z11MicroPrintfPKcz(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.2, i32 noundef 56, i32 noundef %13, i32 noundef 2)
  store i8 1, ptr @_ZN10micro_test13did_test_failE, align 1, !tbaa !9
  %.pre = load i32, ptr %8, align 8, !tbaa !11
  %15 = icmp sgt i32 %.pre, 0
  br i1 %15, label %.lr.ph.preheader, label %._crit_edge52

.lr.ph.preheader:                                 ; preds = %12, %14
  %.ph = phi i32 [ 2, %12 ], [ %.pre, %14 ]
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %22
  %16 = phi i32 [ %23, %22 ], [ %.ph, %.lr.ph.preheader ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %22 ], [ 0, %.lr.ph.preheader ]
  %17 = getelementptr inbounds [2 x i32], ptr %6, i64 0, i64 %indvars.iv
  %18 = load i32, ptr %17, align 4, !tbaa !5
  %19 = getelementptr inbounds [2 x i32], ptr @__const.main.expected, i64 0, i64 %indvars.iv
  %20 = load i32, ptr %19, align 4, !tbaa !5
  %.not48 = icmp eq i32 %18, %20
  br i1 %.not48, label %22, label %21

21:                                               ; preds = %.lr.ph
  call void (ptr, ...) @_Z11MicroPrintfPKcz(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.2, i32 noundef 59, i32 noundef %18, i32 noundef %20)
  store i8 1, ptr @_ZN10micro_test13did_test_failE, align 1, !tbaa !9
  %.pre54 = load i32, ptr %8, align 8, !tbaa !11
  br label %22

22:                                               ; preds = %.lr.ph, %21
  %23 = phi i32 [ %16, %.lr.ph ], [ %.pre54, %21 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %24 = sext i32 %23 to i64
  %25 = icmp slt i64 %indvars.iv.next, %24
  br i1 %25, label %.lr.ph, label %._crit_edge52, !llvm.loop !14

._crit_edge52:                                    ; preds = %22, %14
  call void @PcanGainControlFreeStateContents(ptr noundef nonnull %5)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  store i8 1, ptr @_ZN10micro_test16is_test_completeE, align 1, !tbaa !9
  %26 = load i8, ptr @_ZN10micro_test13did_test_failE, align 1, !tbaa !9, !range !16, !noundef !17
  %27 = xor i8 %26, 1
  %not. = zext nneg i8 %27 to i32
  %28 = load i32, ptr @_ZN10micro_test12tests_passedE, align 4, !tbaa !5
  %29 = add nsw i32 %28, %not.
  store i32 %29, ptr @_ZN10micro_test12tests_passedE, align 4, !tbaa !5
  %30 = zext nneg i8 %26 to i32
  %31 = load i32, ptr @_ZN10micro_test12tests_failedE, align 4, !tbaa !5
  %32 = add nsw i32 %31, %30
  store i32 %32, ptr @_ZN10micro_test12tests_failedE, align 4, !tbaa !5
  %33 = add nsw i32 %32, %29
  call void (ptr, ...) @_Z11MicroPrintfPKcz(ptr noundef nonnull @.str.9, i32 noundef %29, i32 noundef %33)
  %34 = load i32, ptr @_ZN10micro_test12tests_failedE, align 4, !tbaa !5
  %35 = icmp ne i32 %34, 0
  %.str.10..str.11 = select i1 %35, ptr @.str.11, ptr @.str.10
  %. = zext i1 %35 to i32
  call void (ptr, ...) @_Z11MicroPrintfPKcz(ptr noundef nonnull %.str.10..str.11)
  ret i32 %.
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN6tflite14InitializeTestEv() local_unnamed_addr #1

declare void @_Z11MicroPrintfPKcz(ptr noundef, ...) local_unnamed_addr #2

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZN12_GLOBAL__N_125PcanGainControlTestConfigC2Ev(ptr noundef nonnull align 4 dereferenceable(16)) unnamed_addr #4 align 2

declare i32 @PcanGainControlPopulateState(ptr noundef, ptr noundef, ptr noundef, i32 noundef, i16 noundef zeroext, i32 noundef) local_unnamed_addr #2

declare void @PcanGainControlApply(ptr noundef, ptr noundef) local_unnamed_addr #2

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

declare void @PcanGainControlFreeStateContents(ptr noundef) local_unnamed_addr #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 = { inlinehint 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" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"bool", !7, i64 0}
!11 = !{!12, !6, i64 16}
!12 = !{!"_ZTS20PcanGainControlState", !6, i64 0, !13, i64 8, !6, i64 16, !13, i64 24, !6, i64 32}
!13 = !{!"any pointer", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{i8 0, i8 2}
!17 = !{}


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