; LLVM IR from kmilo17pet/qlibs :: qpid (qPID_Control)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.qPID_controller_t = type { float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, ptr, float, float, %struct._qNumA_state_s, %struct._qNumA_state_s, %struct._qNumA_state_s, ptr, ptr, i32, i32, i32, i8 }
%struct._qNumA_state_s = type { [3 x float] }

; 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: nounwind uwtable
declare hidden float @qPID_Sat(float noundef, float noundef, float noundef) #1

; Function Attrs: nounwind uwtable
define dso_local float @qPID_Control(ptr noundef %0, float noundef %1, float noundef %2) #1 {
  %4 = alloca ptr, align 8
  %5 = alloca float, align 4
  %6 = alloca float, align 4
  %7 = alloca float, align 4
  %8 = alloca float, align 4
  %9 = alloca float, align 4
  %10 = alloca float, align 4
  %11 = alloca float, align 4
  %12 = alloca float, align 4
  %13 = alloca float, align 4
  %14 = alloca float, align 4
  %15 = alloca float, align 4
  %16 = alloca float, align 4
  %17 = alloca float, align 4
  %18 = alloca float, align 4
  %19 = alloca float, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store float %1, ptr %5, align 4, !tbaa !9
  store float %2, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %20 = load float, ptr %5, align 4, !tbaa !9
  store float %20, ptr %7, align 4, !tbaa !9
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = icmp ne ptr null, %21
  br i1 %22, label %23, label %277

23:                                               ; preds = %3
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.qPID_controller_t, ptr %24, i32 0, i32 28
  %26 = load i8, ptr %25, align 4, !tbaa !11
  %27 = zext i8 %26 to i32
  %28 = icmp ne i32 0, %27
  br i1 %28, label %29, label %277

29:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.qPID_controller_t, ptr %30, i32 0, i32 0
  %32 = load float, ptr %31, align 8, !tbaa !15
  store float %32, ptr %14, align 4, !tbaa !9
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.qPID_controller_t, ptr %33, i32 0, i32 1
  %35 = load float, ptr %34, align 4, !tbaa !16
  store float %35, ptr %15, align 4, !tbaa !9
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.qPID_controller_t, ptr %36, i32 0, i32 2
  %38 = load float, ptr %37, align 8, !tbaa !17
  store float %38, ptr %16, align 4, !tbaa !9
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.qPID_controller_t, ptr %39, i32 0, i32 26
  %41 = load i32, ptr %40, align 4, !tbaa !18
  %42 = icmp eq i32 1, %41
  br i1 %42, label %43, label %71

43:                                               ; preds = %29
  %44 = load float, ptr %14, align 4, !tbaa !9
  %45 = fcmp ogt float %44, 0.000000e+00
  br i1 %45, label %46, label %49

46:                                               ; preds = %43
  %47 = load float, ptr %14, align 4, !tbaa !9
  %48 = fneg float %47
  br label %51

49:                                               ; preds = %43
  %50 = load float, ptr %14, align 4, !tbaa !9
  br label %51

51:                                               ; preds = %49, %46
  %52 = phi float [ %48, %46 ], [ %50, %49 ]
  store float %52, ptr %14, align 4, !tbaa !9
  %53 = load float, ptr %15, align 4, !tbaa !9
  %54 = fcmp ogt float %53, 0.000000e+00
  br i1 %54, label %55, label %58

55:                                               ; preds = %51
  %56 = load float, ptr %15, align 4, !tbaa !9
  %57 = fneg float %56
  br label %60

58:                                               ; preds = %51
  %59 = load float, ptr %15, align 4, !tbaa !9
  br label %60

60:                                               ; preds = %58, %55
  %61 = phi float [ %57, %55 ], [ %59, %58 ]
  store float %61, ptr %15, align 4, !tbaa !9
  %62 = load float, ptr %16, align 4, !tbaa !9
  %63 = fcmp ogt float %62, 0.000000e+00
  br i1 %63, label %64, label %67

64:                                               ; preds = %60
  %65 = load float, ptr %16, align 4, !tbaa !9
  %66 = fneg float %65
  br label %69

67:                                               ; preds = %60
  %68 = load float, ptr %16, align 4, !tbaa !9
  br label %69

69:                                               ; preds = %67, %64
  %70 = phi float [ %66, %64 ], [ %68, %67 ]
  store float %70, ptr %16, align 4, !tbaa !9
  br label %71

71:                                               ; preds = %69, %29
  %72 = load ptr, ptr %4, align 8, !tbaa !5
  %73 = load float, ptr %5, align 4, !tbaa !9
  %74 = load float, ptr %6, align 4, !tbaa !9
  %75 = call float @qPID_Error(ptr noundef %72, float noundef %73, float noundef %74, float noundef 1.000000e+00)
  store float %75, ptr %8, align 4, !tbaa !9
  %76 = load float, ptr %8, align 4, !tbaa !9
  %77 = call float @qFFMath_Abs(float noundef %76)
  %78 = load ptr, ptr %4, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.qPID_controller_t, ptr %78, i32 0, i32 8
  %80 = load float, ptr %79, align 8, !tbaa !19
  %81 = fcmp ole float %77, %80
  br i1 %81, label %82, label %83

82:                                               ; preds = %71
  store float 0.000000e+00, ptr %8, align 4, !tbaa !9
  br label %83

83:                                               ; preds = %82, %71
  %84 = load ptr, ptr %4, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.qPID_controller_t, ptr %84, i32 0, i32 20
  %86 = load ptr, ptr %4, align 8, !tbaa !5
  %87 = load float, ptr %5, align 4, !tbaa !9
  %88 = load float, ptr %6, align 4, !tbaa !9
  %89 = load ptr, ptr %4, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.qPID_controller_t, ptr %89, i32 0, i32 4
  %91 = load float, ptr %90, align 8, !tbaa !20
  %92 = call float @qPID_Error(ptr noundef %86, float noundef %87, float noundef %88, float noundef %91)
  %93 = load ptr, ptr %4, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.qPID_controller_t, ptr %93, i32 0, i32 5
  %95 = load float, ptr %94, align 4, !tbaa !21
  %96 = call float @qNumA_Derivative2p(ptr noundef %85, float noundef %92, float noundef %95, i1 noundef zeroext false)
  store float %96, ptr %10, align 4, !tbaa !9
  %97 = load ptr, ptr %4, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.qPID_controller_t, ptr %97, i32 0, i32 24
  %99 = load ptr, ptr %98, align 8, !tbaa !22
  %100 = load ptr, ptr %4, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.qPID_controller_t, ptr %100, i32 0, i32 20
  %102 = load float, ptr %8, align 4, !tbaa !9
  %103 = load ptr, ptr %4, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.qPID_controller_t, ptr %103, i32 0, i32 12
  %105 = load float, ptr %104, align 8, !tbaa !23
  %106 = fadd float %102, %105
  %107 = load ptr, ptr %4, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.qPID_controller_t, ptr %107, i32 0, i32 5
  %109 = load float, ptr %108, align 4, !tbaa !21
  %110 = call float %99(ptr noundef %101, float noundef %106, float noundef %109, i1 noundef zeroext true)
  store float %110, ptr %11, align 4, !tbaa !9
  %111 = load float, ptr %10, align 4, !tbaa !9
  %112 = load ptr, ptr %4, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.qPID_controller_t, ptr %112, i32 0, i32 13
  %114 = load float, ptr %113, align 4, !tbaa !24
  %115 = load ptr, ptr %4, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.qPID_controller_t, ptr %115, i32 0, i32 11
  %117 = load float, ptr %116, align 4, !tbaa !25
  %118 = load float, ptr %10, align 4, !tbaa !9
  %119 = fsub float %117, %118
  %120 = call float @llvm.fmuladd.f32(float %114, float %119, float %111)
  %121 = load ptr, ptr %4, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.qPID_controller_t, ptr %121, i32 0, i32 11
  store float %120, ptr %122, align 4, !tbaa !25
  %123 = load float, ptr %14, align 4, !tbaa !9
  %124 = load ptr, ptr %4, align 8, !tbaa !5
  %125 = load float, ptr %5, align 4, !tbaa !9
  %126 = load float, ptr %6, align 4, !tbaa !9
  %127 = load ptr, ptr %4, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.qPID_controller_t, ptr %127, i32 0, i32 3
  %129 = load float, ptr %128, align 4, !tbaa !26
  %130 = call float @qPID_Error(ptr noundef %124, float noundef %125, float noundef %126, float noundef %129)
  %131 = load float, ptr %15, align 4, !tbaa !9
  %132 = load float, ptr %11, align 4, !tbaa !9
  %133 = fmul float %131, %132
  %134 = call float @llvm.fmuladd.f32(float %123, float %130, float %133)
  %135 = load float, ptr %16, align 4, !tbaa !9
  %136 = load ptr, ptr %4, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.qPID_controller_t, ptr %136, i32 0, i32 11
  %138 = load float, ptr %137, align 4, !tbaa !25
  %139 = call float @llvm.fmuladd.f32(float %135, float %138, float %134)
  store float %139, ptr %9, align 4, !tbaa !9
  %140 = load ptr, ptr %4, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.qPID_controller_t, ptr %140, i32 0, i32 17
  %142 = load ptr, ptr %141, align 8, !tbaa !27
  %143 = icmp ne ptr null, %142
  br i1 %143, label %144, label %203

144:                                              ; preds = %83
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  store float 0.000000e+00, ptr %17, align 4, !tbaa !9
  %145 = load ptr, ptr %4, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.qPID_controller_t, ptr %145, i32 0, i32 12
  %147 = load float, ptr %146, align 8, !tbaa !23
  %148 = call float @qFFMath_Abs(float noundef %147)
  %149 = load ptr, ptr %4, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.qPID_controller_t, ptr %149, i32 0, i32 8
  %151 = load float, ptr %150, align 8, !tbaa !19
  %152 = fcmp ole float %148, %151
  br i1 %152, label %153, label %198

153:                                              ; preds = %144
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  %154 = load float, ptr %6, align 4, !tbaa !9
  %155 = load ptr, ptr %4, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.qPID_controller_t, ptr %155, i32 0, i32 17
  %157 = load ptr, ptr %156, align 8, !tbaa !27
  %158 = getelementptr inbounds float, ptr %157, i64 0
  %159 = load float, ptr %158, align 4, !tbaa !9
  %160 = fsub float %154, %159
  store float %160, ptr %18, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  %161 = load ptr, ptr %4, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.qPID_controller_t, ptr %161, i32 0, i32 19
  %163 = load float, ptr %162, align 4, !tbaa !28
  %164 = fneg float %163
  %165 = load float, ptr %18, align 4, !tbaa !9
  %166 = fmul float %164, %165
  %167 = load ptr, ptr %4, align 8, !tbaa !5
  %168 = getelementptr inbounds %struct.qPID_controller_t, ptr %167, i32 0, i32 17
  %169 = load ptr, ptr %168, align 8, !tbaa !27
  %170 = getelementptr inbounds float, ptr %169, i64 0
  %171 = load float, ptr %170, align 4, !tbaa !9
  %172 = fmul float %166, %171
  %173 = load ptr, ptr %4, align 8, !tbaa !5
  %174 = getelementptr inbounds %struct.qPID_controller_t, ptr %173, i32 0, i32 18
  %175 = load float, ptr %174, align 8, !tbaa !29
  %176 = load ptr, ptr %4, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct.qPID_controller_t, ptr %176, i32 0, i32 17
  %178 = load ptr, ptr %177, align 8, !tbaa !27
  %179 = getelementptr inbounds float, ptr %178, i64 0
  %180 = load float, ptr %179, align 4, !tbaa !9
  %181 = load ptr, ptr %4, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.qPID_controller_t, ptr %181, i32 0, i32 17
  %183 = load ptr, ptr %182, align 8, !tbaa !27
  %184 = getelementptr inbounds float, ptr %183, i64 0
  %185 = load float, ptr %184, align 4, !tbaa !9
  %186 = call float @llvm.fmuladd.f32(float %180, float %185, float %175)
  %187 = fdiv float %172, %186
  store float %187, ptr %19, align 4, !tbaa !9
  %188 = load ptr, ptr %4, align 8, !tbaa !5
  %189 = getelementptr inbounds %struct.qPID_controller_t, ptr %188, i32 0, i32 24
  %190 = load ptr, ptr %189, align 8, !tbaa !22
  %191 = load ptr, ptr %4, align 8, !tbaa !5
  %192 = getelementptr inbounds %struct.qPID_controller_t, ptr %191, i32 0, i32 21
  %193 = load float, ptr %19, align 4, !tbaa !9
  %194 = load ptr, ptr %4, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct.qPID_controller_t, ptr %194, i32 0, i32 5
  %196 = load float, ptr %195, align 4, !tbaa !21
  %197 = call float %190(ptr noundef %192, float noundef %193, float noundef %196, i1 noundef zeroext true)
  store float %197, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  br label %198

198:                                              ; preds = %153, %144
  %199 = load float, ptr %5, align 4, !tbaa !9
  %200 = load float, ptr %17, align 4, !tbaa !9
  %201 = load float, ptr %9, align 4, !tbaa !9
  %202 = call float @llvm.fmuladd.f32(float %199, float %200, float %201)
  store float %202, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %203

203:                                              ; preds = %198, %83
  %204 = load ptr, ptr %4, align 8, !tbaa !5
  %205 = getelementptr inbounds %struct.qPID_controller_t, ptr %204, i32 0, i32 10
  %206 = load float, ptr %205, align 8, !tbaa !30
  %207 = load ptr, ptr %4, align 8, !tbaa !5
  %208 = getelementptr inbounds %struct.qPID_controller_t, ptr %207, i32 0, i32 16
  %209 = load float, ptr %208, align 8, !tbaa !31
  %210 = load ptr, ptr %4, align 8, !tbaa !5
  %211 = getelementptr inbounds %struct.qPID_controller_t, ptr %210, i32 0, i32 9
  %212 = load float, ptr %211, align 4, !tbaa !32
  %213 = load ptr, ptr %4, align 8, !tbaa !5
  %214 = getelementptr inbounds %struct.qPID_controller_t, ptr %213, i32 0, i32 14
  %215 = load float, ptr %214, align 8, !tbaa !33
  %216 = load ptr, ptr %4, align 8, !tbaa !5
  %217 = getelementptr inbounds %struct.qPID_controller_t, ptr %216, i32 0, i32 15
  %218 = load float, ptr %217, align 4, !tbaa !34
  %219 = fsub float %215, %218
  %220 = fmul float %212, %219
  %221 = call float @llvm.fmuladd.f32(float %206, float %209, float %220)
  store float %221, ptr %12, align 4, !tbaa !9
  %222 = load ptr, ptr %4, align 8, !tbaa !5
  %223 = getelementptr inbounds %struct.qPID_controller_t, ptr %222, i32 0, i32 24
  %224 = load ptr, ptr %223, align 8, !tbaa !22
  %225 = load ptr, ptr %4, align 8, !tbaa !5
  %226 = getelementptr inbounds %struct.qPID_controller_t, ptr %225, i32 0, i32 22
  %227 = load float, ptr %12, align 4, !tbaa !9
  %228 = load ptr, ptr %4, align 8, !tbaa !5
  %229 = getelementptr inbounds %struct.qPID_controller_t, ptr %228, i32 0, i32 5
  %230 = load float, ptr %229, align 4, !tbaa !21
  %231 = call float %224(ptr noundef %226, float noundef %227, float noundef %230, i1 noundef zeroext true)
  %232 = load ptr, ptr %4, align 8, !tbaa !5
  %233 = getelementptr inbounds %struct.qPID_controller_t, ptr %232, i32 0, i32 15
  store float %231, ptr %233, align 4, !tbaa !34
  %234 = load ptr, ptr %4, align 8, !tbaa !5
  %235 = getelementptr inbounds %struct.qPID_controller_t, ptr %234, i32 0, i32 25
  %236 = load i32, ptr %235, align 8, !tbaa !35
  %237 = icmp eq i32 0, %236
  br i1 %237, label %238, label %240

238:                                              ; preds = %203
  %239 = load float, ptr %9, align 4, !tbaa !9
  br label %244

240:                                              ; preds = %203
  %241 = load ptr, ptr %4, align 8, !tbaa !5
  %242 = getelementptr inbounds %struct.qPID_controller_t, ptr %241, i32 0, i32 15
  %243 = load float, ptr %242, align 4, !tbaa !34
  br label %244

244:                                              ; preds = %240, %238
  %245 = phi float [ %239, %238 ], [ %243, %240 ]
  store float %245, ptr %13, align 4, !tbaa !9
  %246 = load float, ptr %13, align 4, !tbaa !9
  %247 = load ptr, ptr %4, align 8, !tbaa !5
  %248 = getelementptr inbounds %struct.qPID_controller_t, ptr %247, i32 0, i32 6
  %249 = load float, ptr %248, align 8, !tbaa !36
  %250 = load ptr, ptr %4, align 8, !tbaa !5
  %251 = getelementptr inbounds %struct.qPID_controller_t, ptr %250, i32 0, i32 7
  %252 = load float, ptr %251, align 4, !tbaa !37
  %253 = call float @qPID_Sat(float noundef %246, float noundef %249, float noundef %252)
  %254 = load ptr, ptr %4, align 8, !tbaa !5
  %255 = getelementptr inbounds %struct.qPID_controller_t, ptr %254, i32 0, i32 14
  store float %253, ptr %255, align 8, !tbaa !33
  %256 = load ptr, ptr %4, align 8, !tbaa !5
  %257 = getelementptr inbounds %struct.qPID_controller_t, ptr %256, i32 0, i32 14
  %258 = load float, ptr %257, align 8, !tbaa !33
  store float %258, ptr %7, align 4, !tbaa !9
  %259 = load ptr, ptr %4, align 8, !tbaa !5
  %260 = getelementptr inbounds %struct.qPID_controller_t, ptr %259, i32 0, i32 9
  %261 = load float, ptr %260, align 4, !tbaa !32
  %262 = load float, ptr %7, align 4, !tbaa !9
  %263 = load float, ptr %9, align 4, !tbaa !9
  %264 = fsub float %262, %263
  %265 = fmul float %261, %264
  %266 = load ptr, ptr %4, align 8, !tbaa !5
  %267 = getelementptr inbounds %struct.qPID_controller_t, ptr %266, i32 0, i32 12
  store float %265, ptr %267, align 8, !tbaa !23
  %268 = load ptr, ptr %4, align 8, !tbaa !5
  %269 = getelementptr inbounds %struct.qPID_controller_t, ptr %268, i32 0, i32 23
  %270 = load ptr, ptr %269, align 8, !tbaa !38
  %271 = icmp ne ptr null, %270
  br i1 %271, label %272, label %276

272:                                              ; preds = %244
  %273 = load ptr, ptr %4, align 8, !tbaa !5
  %274 = load float, ptr %7, align 4, !tbaa !9
  %275 = load float, ptr %6, align 4, !tbaa !9
  call void @qPID_AutoTunningAdaptGains(ptr noundef %273, float noundef %274, float noundef %275)
  br label %276

276:                                              ; preds = %272, %244
  call void @llvm.lifetime.end.p0(i64 4, 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
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %277

277:                                              ; preds = %276, %23, %3
  %278 = load float, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  ret float %278
}

; Function Attrs: nounwind uwtable
declare hidden float @qPID_Error(ptr noundef, float noundef, float noundef, float noundef) #1

declare float @qFFMath_Abs(float noundef) #2

declare float @qNumA_Derivative2p(ptr noundef, float noundef, float noundef, i1 noundef zeroext) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #3

; Function Attrs: nounwind uwtable
declare hidden void @qPID_AutoTunningAdaptGains(ptr noundef, float noundef, float noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind uwtable "min-legal-vector-width"="64" "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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !7, i64 156}
!12 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !6, i64 72, !10, i64 80, !10, i64 84, !13, i64 88, !13, i64 100, !13, i64 112, !6, i64 128, !6, i64 136, !14, i64 144, !14, i64 148, !14, i64 152, !7, i64 156}
!13 = !{!"_qNumA_state_s", !7, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!12, !10, i64 0}
!16 = !{!12, !10, i64 4}
!17 = !{!12, !10, i64 8}
!18 = !{!12, !14, i64 148}
!19 = !{!12, !10, i64 32}
!20 = !{!12, !10, i64 16}
!21 = !{!12, !10, i64 20}
!22 = !{!12, !6, i64 136}
!23 = !{!12, !10, i64 48}
!24 = !{!12, !10, i64 52}
!25 = !{!12, !10, i64 44}
!26 = !{!12, !10, i64 12}
!27 = !{!12, !6, i64 72}
!28 = !{!12, !10, i64 84}
!29 = !{!12, !10, i64 80}
!30 = !{!12, !10, i64 40}
!31 = !{!12, !10, i64 64}
!32 = !{!12, !10, i64 36}
!33 = !{!12, !10, i64 56}
!34 = !{!12, !10, i64 60}
!35 = !{!12, !14, i64 144}
!36 = !{!12, !10, i64 24}
!37 = !{!12, !10, i64 28}
!38 = !{!12, !6, i64 128}


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

; Function Attrs: nounwind uwtable
declare hidden float @qPID_Sat(float noundef, float noundef, float noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local float @qPID_Control(ptr noundef %0, float noundef %1, float noundef %2) local_unnamed_addr #0 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %115, label %4

4:                                                ; preds = %3
  %5 = getelementptr inbounds i8, ptr %0, i64 156
  %6 = load i8, ptr %5, align 4, !tbaa !5
  %.not98 = icmp eq i8 %6, 0
  br i1 %.not98, label %115, label %7

7:                                                ; preds = %4
  %8 = load float, ptr %0, align 8, !tbaa !13
  %9 = getelementptr inbounds i8, ptr %0, i64 4
  %10 = load <2 x float>, ptr %9, align 4, !tbaa !14
  %11 = getelementptr inbounds i8, ptr %0, i64 148
  %12 = load i32, ptr %11, align 4, !tbaa !15
  %13 = icmp eq i32 %12, 1
  br i1 %13, label %14, label %21

14:                                               ; preds = %7
  %15 = fcmp ogt float %8, 0.000000e+00
  %16 = fneg float %8
  %17 = select i1 %15, float %16, float %8
  %18 = fcmp ogt <2 x float> %10, zeroinitializer
  %19 = fneg <2 x float> %10
  %20 = select <2 x i1> %18, <2 x float> %19, <2 x float> %10
  br label %21

21:                                               ; preds = %14, %7
  %.095 = phi float [ %17, %14 ], [ %8, %7 ]
  %22 = phi <2 x float> [ %20, %14 ], [ %10, %7 ]
  %23 = tail call float @qPID_Error(ptr noundef nonnull %0, float noundef %1, float noundef %2, float noundef 1.000000e+00)
  %24 = tail call float @qFFMath_Abs(float noundef %23) #4
  %25 = getelementptr inbounds i8, ptr %0, i64 32
  %26 = load float, ptr %25, align 8, !tbaa !16
  %27 = fcmp ugt float %24, %26
  %.091 = select i1 %27, float %23, float 0.000000e+00
  %28 = getelementptr inbounds i8, ptr %0, i64 88
  %29 = getelementptr inbounds i8, ptr %0, i64 16
  %30 = load float, ptr %29, align 8, !tbaa !17
  %31 = tail call float @qPID_Error(ptr noundef nonnull %0, float noundef %1, float noundef %2, float noundef %30)
  %32 = getelementptr inbounds i8, ptr %0, i64 20
  %33 = load float, ptr %32, align 4, !tbaa !18
  %34 = tail call float @qNumA_Derivative2p(ptr noundef nonnull %28, float noundef %31, float noundef %33, i1 noundef zeroext false) #4
  %35 = getelementptr inbounds i8, ptr %0, i64 136
  %36 = load ptr, ptr %35, align 8, !tbaa !19
  %37 = getelementptr inbounds i8, ptr %0, i64 48
  %38 = load float, ptr %37, align 8, !tbaa !20
  %39 = fadd float %.091, %38
  %40 = load float, ptr %32, align 4, !tbaa !18
  %41 = tail call float %36(ptr noundef nonnull %28, float noundef %39, float noundef %40, i1 noundef zeroext true) #4
  %42 = getelementptr inbounds i8, ptr %0, i64 52
  %43 = load float, ptr %42, align 4, !tbaa !21
  %44 = getelementptr inbounds i8, ptr %0, i64 44
  %45 = load float, ptr %44, align 4, !tbaa !22
  %46 = fsub float %45, %34
  %47 = tail call float @llvm.fmuladd.f32(float %43, float %46, float %34)
  store float %47, ptr %44, align 4, !tbaa !22
  %48 = getelementptr inbounds i8, ptr %0, i64 12
  %49 = load float, ptr %48, align 4, !tbaa !23
  %50 = tail call float @qPID_Error(ptr noundef nonnull %0, float noundef %1, float noundef %2, float noundef %49)
  %51 = extractelement <2 x float> %22, i64 0
  %52 = fmul float %51, %41
  %53 = tail call float @llvm.fmuladd.f32(float %.095, float %50, float %52)
  %54 = load float, ptr %44, align 4, !tbaa !22
  %55 = extractelement <2 x float> %22, i64 1
  %56 = tail call float @llvm.fmuladd.f32(float %55, float %54, float %53)
  %57 = getelementptr inbounds i8, ptr %0, i64 72
  %58 = load ptr, ptr %57, align 8, !tbaa !24
  %.not99 = icmp eq ptr %58, null
  br i1 %.not99, label %83, label %59

59:                                               ; preds = %21
  %60 = load float, ptr %37, align 8, !tbaa !20
  %61 = tail call float @qFFMath_Abs(float noundef %60) #4
  %62 = load float, ptr %25, align 8, !tbaa !16
  %63 = fcmp ugt float %61, %62
  br i1 %63, label %81, label %64

64:                                               ; preds = %59
  %65 = load ptr, ptr %57, align 8, !tbaa !24
  %66 = load float, ptr %65, align 4, !tbaa !14
  %67 = fsub float %2, %66
  %68 = getelementptr inbounds i8, ptr %0, i64 84
  %69 = load float, ptr %68, align 4, !tbaa !25
  %70 = fneg float %69
  %71 = fmul float %67, %70
  %72 = fmul float %66, %71
  %73 = getelementptr inbounds i8, ptr %0, i64 80
  %74 = load float, ptr %73, align 8, !tbaa !26
  %75 = tail call float @llvm.fmuladd.f32(float %66, float %66, float %74)
  %76 = fdiv float %72, %75
  %77 = load ptr, ptr %35, align 8, !tbaa !19
  %78 = getelementptr inbounds i8, ptr %0, i64 100
  %79 = load float, ptr %32, align 4, !tbaa !18
  %80 = tail call float %77(ptr noundef nonnull %78, float noundef %76, float noundef %79, i1 noundef zeroext true) #4
  br label %81

81:                                               ; preds = %64, %59
  %.092 = phi float [ %80, %64 ], [ 0.000000e+00, %59 ]
  %82 = tail call float @llvm.fmuladd.f32(float %1, float %.092, float %56)
  br label %83

83:                                               ; preds = %81, %21
  %.096 = phi float [ %82, %81 ], [ %56, %21 ]
  %84 = getelementptr inbounds i8, ptr %0, i64 40
  %85 = load float, ptr %84, align 8, !tbaa !27
  %86 = getelementptr inbounds i8, ptr %0, i64 64
  %87 = load float, ptr %86, align 8, !tbaa !28
  %88 = getelementptr inbounds i8, ptr %0, i64 36
  %89 = load float, ptr %88, align 4, !tbaa !29
  %90 = getelementptr inbounds i8, ptr %0, i64 56
  %91 = load float, ptr %90, align 8, !tbaa !30
  %92 = getelementptr inbounds i8, ptr %0, i64 60
  %93 = load float, ptr %92, align 4, !tbaa !31
  %94 = fsub float %91, %93
  %95 = fmul float %89, %94
  %96 = tail call float @llvm.fmuladd.f32(float %85, float %87, float %95)
  %97 = load ptr, ptr %35, align 8, !tbaa !19
  %98 = getelementptr inbounds i8, ptr %0, i64 112
  %99 = load float, ptr %32, align 4, !tbaa !18
  %100 = tail call float %97(ptr noundef nonnull %98, float noundef %96, float noundef %99, i1 noundef zeroext true) #4
  store float %100, ptr %92, align 4, !tbaa !31
  %101 = getelementptr inbounds i8, ptr %0, i64 144
  %102 = load i32, ptr %101, align 8, !tbaa !32
  %103 = icmp eq i32 %102, 0
  %.096. = select i1 %103, float %.096, float %100
  %104 = getelementptr inbounds i8, ptr %0, i64 24
  %105 = load float, ptr %104, align 8, !tbaa !33
  %106 = getelementptr inbounds i8, ptr %0, i64 28
  %107 = load float, ptr %106, align 4, !tbaa !34
  %108 = tail call float @qPID_Sat(float noundef %.096., float noundef %105, float noundef %107)
  store float %108, ptr %90, align 8, !tbaa !30
  %109 = load float, ptr %88, align 4, !tbaa !29
  %110 = fsub float %108, %.096
  %111 = fmul float %110, %109
  store float %111, ptr %37, align 8, !tbaa !20
  %112 = getelementptr inbounds i8, ptr %0, i64 128
  %113 = load ptr, ptr %112, align 8, !tbaa !35
  %.not100 = icmp eq ptr %113, null
  br i1 %.not100, label %115, label %114

114:                                              ; preds = %83
  tail call void @qPID_AutoTunningAdaptGains(ptr noundef nonnull %0, float noundef %108, float noundef %2)
  br label %115

115:                                              ; preds = %83, %114, %4, %3
  %.0 = phi float [ %1, %4 ], [ %1, %3 ], [ %108, %114 ], [ %108, %83 ]
  ret float %.0
}

; Function Attrs: nounwind uwtable
declare hidden float @qPID_Error(ptr noundef, float noundef, float noundef, float noundef) local_unnamed_addr #0

declare float @qFFMath_Abs(float noundef) local_unnamed_addr #1

declare float @qNumA_Derivative2p(ptr noundef, float noundef, float noundef, i1 noundef zeroext) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #2

; Function Attrs: nounwind uwtable
declare hidden void @qPID_AutoTunningAdaptGains(ptr noundef, float noundef, float noundef) local_unnamed_addr #3

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { nounwind uwtable "min-legal-vector-width"="64" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !8, i64 156}
!6 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !7, i64 32, !7, i64 36, !7, i64 40, !7, i64 44, !7, i64 48, !7, i64 52, !7, i64 56, !7, i64 60, !7, i64 64, !10, i64 72, !7, i64 80, !7, i64 84, !11, i64 88, !11, i64 100, !11, i64 112, !10, i64 128, !10, i64 136, !12, i64 144, !12, i64 148, !12, i64 152, !8, i64 156}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"_qNumA_state_s", !8, i64 0}
!12 = !{!"int", !8, i64 0}
!13 = !{!6, !7, i64 0}
!14 = !{!7, !7, i64 0}
!15 = !{!6, !12, i64 148}
!16 = !{!6, !7, i64 32}
!17 = !{!6, !7, i64 16}
!18 = !{!6, !7, i64 20}
!19 = !{!6, !10, i64 136}
!20 = !{!6, !7, i64 48}
!21 = !{!6, !7, i64 52}
!22 = !{!6, !7, i64 44}
!23 = !{!6, !7, i64 12}
!24 = !{!6, !10, i64 72}
!25 = !{!6, !7, i64 84}
!26 = !{!6, !7, i64 80}
!27 = !{!6, !7, i64 40}
!28 = !{!6, !7, i64 64}
!29 = !{!6, !7, i64 36}
!30 = !{!6, !7, i64 56}
!31 = !{!6, !7, i64 60}
!32 = !{!6, !12, i64 144}
!33 = !{!6, !7, i64 24}
!34 = !{!6, !7, i64 28}
!35 = !{!6, !10, i64 128}


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