; LLVM IR from ClecioJung/digital-control :: digitalControl (ifocProject)

; 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.IFOC = type { %struct.PI, %struct.PI, %struct.PI, %struct.FirstOrderObserver, i8, float, float, float, float, float, float, float }
%struct.PI = type { float, float, i8, %struct.Saturator, float, float, float }
%struct.Saturator = type { float, float }
%struct.FirstOrderObserver = type { float, float, float, float, float }

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @piPoleZeroCancelationProject(ptr noundef, float noundef, float noundef, float noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @observerProject(ptr noundef, float noundef, float noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @ifocProject(ptr noundef %0, i16 noundef zeroext %1, float noundef %2, float noundef %3, float noundef %4, float noundef %5, float noundef %6, float noundef %7) #2 {
  %9 = alloca ptr, align 8
  %10 = alloca i16, align 2
  %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
  %20 = alloca float, align 4
  %21 = alloca float, align 4
  %22 = alloca float, align 4
  %23 = alloca float, align 4
  store ptr %0, ptr %9, align 8, !tbaa !5
  store i16 %1, ptr %10, align 2, !tbaa !9
  store float %2, ptr %11, align 4, !tbaa !11
  store float %3, ptr %12, align 4, !tbaa !11
  store float %4, ptr %13, align 4, !tbaa !11
  store float %5, ptr %14, align 4, !tbaa !11
  store float %6, ptr %15, align 4, !tbaa !11
  store float %7, ptr %16, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  %24 = load float, ptr %11, align 4, !tbaa !11
  %25 = fpext float %24 to double
  %26 = fmul double 0x401921FB54442D18, %25
  %27 = fptrunc double %26 to float
  store float %27, ptr %17, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  %28 = load float, ptr %16, align 4, !tbaa !11
  %29 = load float, ptr %14, align 4, !tbaa !11
  %30 = fadd float %28, %29
  store float %30, ptr %18, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  %31 = load float, ptr %16, align 4, !tbaa !11
  %32 = load float, ptr %15, align 4, !tbaa !11
  %33 = fadd float %31, %32
  store float %33, ptr %19, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #4
  %34 = load float, ptr %16, align 4, !tbaa !11
  %35 = load float, ptr %17, align 4, !tbaa !11
  %36 = fdiv float %34, %35
  store float %36, ptr %20, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #4
  %37 = load float, ptr %18, align 4, !tbaa !11
  %38 = load float, ptr %17, align 4, !tbaa !11
  %39 = fdiv float %37, %38
  store float %39, ptr %21, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #4
  %40 = load float, ptr %19, align 4, !tbaa !11
  %41 = load float, ptr %17, align 4, !tbaa !11
  %42 = fdiv float %40, %41
  store float %42, ptr %22, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #4
  %43 = load float, ptr %20, align 4, !tbaa !11
  %44 = call float @powf(float noundef %43, float noundef 2.000000e+00) #4
  %45 = load float, ptr %21, align 4, !tbaa !11
  %46 = load float, ptr %22, align 4, !tbaa !11
  %47 = fmul float %45, %46
  %48 = fdiv float %44, %47
  %49 = fsub float 1.000000e+00, %48
  store float %49, ptr %23, align 4, !tbaa !11
  %50 = load float, ptr %20, align 4, !tbaa !11
  %51 = call float @powf(float noundef %50, float noundef 2.000000e+00) #4
  %52 = load float, ptr %23, align 4, !tbaa !11
  %53 = load float, ptr %21, align 4, !tbaa !11
  %54 = fmul float %52, %53
  %55 = load float, ptr %22, align 4, !tbaa !11
  %56 = fmul float %54, %55
  %57 = fdiv float %51, %56
  %58 = load ptr, ptr %9, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.IFOC, ptr %58, i32 0, i32 7
  store float %57, ptr %59, align 4, !tbaa !13
  %60 = load float, ptr %23, align 4, !tbaa !11
  %61 = load float, ptr %21, align 4, !tbaa !11
  %62 = fmul float %60, %61
  %63 = load ptr, ptr %9, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.IFOC, ptr %63, i32 0, i32 8
  store float %62, ptr %64, align 4, !tbaa !19
  %65 = load float, ptr %13, align 4, !tbaa !11
  %66 = load float, ptr %22, align 4, !tbaa !11
  %67 = fdiv float %65, %66
  %68 = load ptr, ptr %9, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.IFOC, ptr %68, i32 0, i32 9
  store float %67, ptr %69, align 4, !tbaa !20
  %70 = load float, ptr %12, align 4, !tbaa !11
  %71 = load float, ptr %20, align 4, !tbaa !11
  %72 = load float, ptr %22, align 4, !tbaa !11
  %73 = fdiv float %71, %72
  %74 = call float @powf(float noundef %73, float noundef 2.000000e+00) #4
  %75 = load float, ptr %13, align 4, !tbaa !11
  %76 = call float @llvm.fmuladd.f32(float %74, float %75, float %70)
  %77 = load ptr, ptr %9, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.IFOC, ptr %77, i32 0, i32 8
  %79 = load float, ptr %78, align 4, !tbaa !19
  %80 = fdiv float %76, %79
  %81 = load ptr, ptr %9, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.IFOC, ptr %81, i32 0, i32 10
  store float %80, ptr %82, align 4, !tbaa !21
  %83 = load i16, ptr %10, align 2, !tbaa !9
  %84 = uitofp i16 %83 to float
  %85 = fmul float 3.000000e+00, %84
  %86 = fdiv float %85, 4.000000e+00
  %87 = load float, ptr %20, align 4, !tbaa !11
  %88 = call float @powf(float noundef %87, float noundef 2.000000e+00) #4
  %89 = load float, ptr %22, align 4, !tbaa !11
  %90 = fdiv float %88, %89
  %91 = fmul float %86, %90
  %92 = load ptr, ptr %9, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.IFOC, ptr %92, i32 0, i32 11
  store float %91, ptr %93, align 4, !tbaa !22
  %94 = load ptr, ptr %9, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.IFOC, ptr %94, i32 0, i32 3
  %96 = load ptr, ptr %9, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.IFOC, ptr %96, i32 0, i32 9
  %98 = load float, ptr %97, align 4, !tbaa !20
  call void @observerProject(ptr noundef %95, float noundef 1.000000e+00, float noundef %98)
  %99 = load ptr, ptr %9, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.IFOC, ptr %99, i32 0, i32 0
  %101 = load ptr, ptr %9, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.IFOC, ptr %101, i32 0, i32 10
  %103 = load float, ptr %102, align 4, !tbaa !21
  %104 = fpext float %103 to double
  %105 = fmul double 3.000000e+00, %104
  %106 = fptrunc double %105 to float
  %107 = load ptr, ptr %9, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.IFOC, ptr %107, i32 0, i32 10
  %109 = load float, ptr %108, align 4, !tbaa !21
  %110 = load ptr, ptr %9, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.IFOC, ptr %110, i32 0, i32 8
  %112 = load float, ptr %111, align 4, !tbaa !19
  %113 = fmul float %109, %112
  %114 = fpext float %113 to double
  %115 = fdiv double 1.000000e+00, %114
  %116 = fptrunc double %115 to float
  %117 = load ptr, ptr %9, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.IFOC, ptr %117, i32 0, i32 10
  %119 = load float, ptr %118, align 4, !tbaa !21
  call void @piPoleZeroCancelationProject(ptr noundef %100, float noundef %106, float noundef %116, float noundef %119)
  %120 = load ptr, ptr %9, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.IFOC, ptr %120, i32 0, i32 1
  %122 = load ptr, ptr %9, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.IFOC, ptr %122, i32 0, i32 10
  %124 = load float, ptr %123, align 4, !tbaa !21
  %125 = fpext float %124 to double
  %126 = fmul double 3.000000e+00, %125
  %127 = fptrunc double %126 to float
  %128 = load ptr, ptr %9, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.IFOC, ptr %128, i32 0, i32 10
  %130 = load float, ptr %129, align 4, !tbaa !21
  %131 = load ptr, ptr %9, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.IFOC, ptr %131, i32 0, i32 8
  %133 = load float, ptr %132, align 4, !tbaa !19
  %134 = fmul float %130, %133
  %135 = fpext float %134 to double
  %136 = fdiv double 1.000000e+00, %135
  %137 = fptrunc double %136 to float
  %138 = load ptr, ptr %9, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.IFOC, ptr %138, i32 0, i32 10
  %140 = load float, ptr %139, align 4, !tbaa !21
  call void @piPoleZeroCancelationProject(ptr noundef %121, float noundef %127, float noundef %137, float noundef %140)
  %141 = load ptr, ptr %9, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.IFOC, ptr %141, i32 0, i32 2
  %143 = load ptr, ptr %9, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.IFOC, ptr %143, i32 0, i32 9
  %145 = load float, ptr %144, align 4, !tbaa !20
  %146 = fpext float %145 to double
  %147 = fmul double 3.000000e+00, %146
  %148 = fptrunc double %147 to float
  %149 = load ptr, ptr %9, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.IFOC, ptr %149, i32 0, i32 9
  %151 = load float, ptr %150, align 4, !tbaa !20
  call void @piPoleZeroCancelationProject(ptr noundef %142, float noundef %148, float noundef 1.000000e+00, float noundef %151)
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  ret void
}

; Function Attrs: nounwind
declare float @powf(float noundef, float noundef) #3

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"short", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!14, !12, i64 128}
!14 = !{!"", !15, i64 0, !15, i64 32, !15, i64 64, !18, i64 96, !16, i64 116, !12, i64 120, !12, i64 124, !12, i64 128, !12, i64 132, !12, i64 136, !12, i64 140, !12, i64 144}
!15 = !{!"", !12, i64 0, !12, i64 4, !16, i64 8, !17, i64 12, !12, i64 20, !12, i64 24, !12, i64 28}
!16 = !{!"_Bool", !7, i64 0}
!17 = !{!"", !12, i64 0, !12, i64 4}
!18 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16}
!19 = !{!14, !12, i64 132}
!20 = !{!14, !12, i64 136}
!21 = !{!14, !12, i64 140}
!22 = !{!14, !12, i64 144}


; 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: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #0

; Function Attrs: nounwind uwtable
declare dso_local void @piPoleZeroCancelationProject(ptr noundef, float noundef, float noundef, float noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @observerProject(ptr noundef, float noundef, float noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @ifocProject(ptr noundef %0, i16 noundef zeroext %1, float noundef %2, float noundef %3, float noundef %4, float noundef %5, float noundef %6, float noundef %7) local_unnamed_addr #1 {
  %9 = fpext float %2 to double
  %10 = fmul double %9, 0x401921FB54442D18
  %11 = fptrunc double %10 to float
  %12 = fadd float %5, %7
  %13 = fadd float %6, %7
  %14 = fdiv float %13, %11
  %15 = insertelement <2 x float> poison, float %7, i64 0
  %16 = insertelement <2 x float> %15, float %12, i64 1
  %17 = insertelement <2 x float> poison, float %11, i64 0
  %18 = shufflevector <2 x float> %17, <2 x float> poison, <2 x i32> zeroinitializer
  %19 = fdiv <2 x float> %16, %18
  %20 = insertelement <2 x float> %19, float %14, i64 1
  %21 = fmul <2 x float> %19, %20
  %22 = extractelement <2 x float> %21, i64 0
  %23 = extractelement <2 x float> %21, i64 1
  %24 = fdiv float %22, %23
  %25 = fsub float 1.000000e+00, %24
  %26 = extractelement <2 x float> %19, i64 1
  %27 = fmul float %26, %25
  %28 = fmul float %14, %27
  %29 = fdiv float %22, %28
  %30 = getelementptr inbounds i8, ptr %0, i64 128
  store float %29, ptr %30, align 4, !tbaa !5
  %31 = getelementptr inbounds i8, ptr %0, i64 132
  store float %27, ptr %31, align 4, !tbaa !14
  %32 = getelementptr inbounds i8, ptr %0, i64 136
  %33 = extractelement <2 x float> %19, i64 0
  %34 = fdiv float %33, %14
  %square50 = fmul float %34, %34
  %35 = tail call float @llvm.fmuladd.f32(float %square50, float %4, float %3)
  %36 = getelementptr inbounds i8, ptr %0, i64 140
  %37 = insertelement <2 x float> poison, float %4, i64 0
  %38 = insertelement <2 x float> %37, float %35, i64 1
  %39 = insertelement <2 x float> poison, float %14, i64 0
  %40 = insertelement <2 x float> %39, float %27, i64 1
  %41 = fdiv <2 x float> %38, %40
  store <2 x float> %41, ptr %32, align 4, !tbaa !15
  %42 = uitofp i16 %1 to float
  %43 = fmul float %42, 3.000000e+00
  %44 = fmul float %43, 2.500000e-01
  %45 = fdiv float %22, %14
  %46 = fmul float %44, %45
  %47 = getelementptr inbounds i8, ptr %0, i64 144
  store float %46, ptr %47, align 4, !tbaa !16
  %48 = getelementptr inbounds i8, ptr %0, i64 96
  %49 = extractelement <2 x float> %41, i64 0
  tail call void @observerProject(ptr noundef nonnull %48, float noundef 1.000000e+00, float noundef %49)
  %50 = load float, ptr %36, align 4, !tbaa !17
  %51 = fmul float %50, 3.000000e+00
  %52 = load float, ptr %31, align 4, !tbaa !14
  %53 = fmul float %50, %52
  %54 = fdiv float 1.000000e+00, %53
  tail call void @piPoleZeroCancelationProject(ptr noundef %0, float noundef %51, float noundef %54, float noundef %50)
  %55 = getelementptr inbounds i8, ptr %0, i64 32
  %56 = load float, ptr %36, align 4, !tbaa !17
  %57 = fmul float %56, 3.000000e+00
  %58 = load float, ptr %31, align 4, !tbaa !14
  %59 = fmul float %56, %58
  %60 = fdiv float 1.000000e+00, %59
  tail call void @piPoleZeroCancelationProject(ptr noundef nonnull %55, float noundef %57, float noundef %60, float noundef %56)
  %61 = getelementptr inbounds i8, ptr %0, i64 64
  %62 = load float, ptr %32, align 4, !tbaa !18
  %63 = fmul float %62, 3.000000e+00
  tail call void @piPoleZeroCancelationProject(ptr noundef nonnull %61, float noundef %63, float noundef 1.000000e+00, float noundef %62)
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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" }

!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 128}
!6 = !{!"", !7, i64 0, !7, i64 32, !7, i64 64, !13, i64 96, !11, i64 116, !8, i64 120, !8, i64 124, !8, i64 128, !8, i64 132, !8, i64 136, !8, i64 140, !8, i64 144}
!7 = !{!"", !8, i64 0, !8, i64 4, !11, i64 8, !12, i64 12, !8, i64 20, !8, i64 24, !8, i64 28}
!8 = !{!"float", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"_Bool", !9, i64 0}
!12 = !{!"", !8, i64 0, !8, i64 4}
!13 = !{!"", !8, i64 0, !8, i64 4, !8, i64 8, !8, i64 12, !8, i64 16}
!14 = !{!6, !8, i64 132}
!15 = !{!8, !8, i64 0}
!16 = !{!6, !8, i64 144}
!17 = !{!6, !8, i64 140}
!18 = !{!6, !8, i64 136}


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