; LLVM IR from Derek-TH-Wang/quadruped_ctrl :: src/osqp/src (auxil)

; 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.OSQPWorkspace = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i64, i64 }
%struct.OSQPData = type { i64, i64, ptr, ptr, ptr, ptr, ptr }
%struct.OSQPSettings = type { double, double, i64, i64, i64, double, double, i64, double, double, double, double, double, i32, double, i64, i64, i64, i64, i64, i64, double }

; Function Attrs: nounwind uwtable
define dso_local double @compute_rho_estimate(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.OSQPWorkspace, ptr %11, i32 0, i32 0
  %13 = load ptr, ptr %12, align 8, !tbaa !9
  %14 = getelementptr inbounds %struct.OSQPData, ptr %13, i32 0, i32 0
  %15 = load i64, ptr %14, align 8, !tbaa !12
  store i64 %15, ptr %3, align 8, !tbaa !14
  %16 = load ptr, ptr %2, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.OSQPWorkspace, ptr %16, i32 0, i32 0
  %18 = load ptr, ptr %17, align 8, !tbaa !9
  %19 = getelementptr inbounds %struct.OSQPData, ptr %18, i32 0, i32 1
  %20 = load i64, ptr %19, align 8, !tbaa !15
  store i64 %20, ptr %4, align 8, !tbaa !14
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.OSQPWorkspace, ptr %21, i32 0, i32 11
  %23 = load ptr, ptr %22, align 8, !tbaa !16
  %24 = load i64, ptr %4, align 8, !tbaa !14
  %25 = call double @vec_norm_inf(ptr noundef %23, i64 noundef %24)
  store double %25, ptr %5, align 8, !tbaa !17
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.OSQPWorkspace, ptr %26, i32 0, i32 10
  %28 = load ptr, ptr %27, align 8, !tbaa !19
  %29 = load i64, ptr %3, align 8, !tbaa !14
  %30 = call double @vec_norm_inf(ptr noundef %28, i64 noundef %29)
  store double %30, ptr %6, align 8, !tbaa !17
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.OSQPWorkspace, ptr %31, i32 0, i32 8
  %33 = load ptr, ptr %32, align 8, !tbaa !20
  %34 = load i64, ptr %4, align 8, !tbaa !14
  %35 = call double @vec_norm_inf(ptr noundef %33, i64 noundef %34)
  store double %35, ptr %7, align 8, !tbaa !17
  %36 = load ptr, ptr %2, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.OSQPWorkspace, ptr %36, i32 0, i32 12
  %38 = load ptr, ptr %37, align 8, !tbaa !21
  %39 = load i64, ptr %4, align 8, !tbaa !14
  %40 = call double @vec_norm_inf(ptr noundef %38, i64 noundef %39)
  store double %40, ptr %9, align 8, !tbaa !17
  %41 = load double, ptr %7, align 8, !tbaa !17
  %42 = load double, ptr %9, align 8, !tbaa !17
  %43 = fcmp ogt double %41, %42
  br i1 %43, label %44, label %46

44:                                               ; preds = %1
  %45 = load double, ptr %7, align 8, !tbaa !17
  br label %48

46:                                               ; preds = %1
  %47 = load double, ptr %9, align 8, !tbaa !17
  br label %48

48:                                               ; preds = %46, %44
  %49 = phi double [ %45, %44 ], [ %47, %46 ]
  store double %49, ptr %7, align 8, !tbaa !17
  %50 = load double, ptr %7, align 8, !tbaa !17
  %51 = fadd double %50, 1.000000e-10
  %52 = load double, ptr %5, align 8, !tbaa !17
  %53 = fdiv double %52, %51
  store double %53, ptr %5, align 8, !tbaa !17
  %54 = load ptr, ptr %2, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.OSQPWorkspace, ptr %54, i32 0, i32 0
  %56 = load ptr, ptr %55, align 8, !tbaa !9
  %57 = getelementptr inbounds %struct.OSQPData, ptr %56, i32 0, i32 4
  %58 = load ptr, ptr %57, align 8, !tbaa !22
  %59 = load i64, ptr %3, align 8, !tbaa !14
  %60 = call double @vec_norm_inf(ptr noundef %58, i64 noundef %59)
  store double %60, ptr %8, align 8, !tbaa !17
  %61 = load ptr, ptr %2, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.OSQPWorkspace, ptr %61, i32 0, i32 14
  %63 = load ptr, ptr %62, align 8, !tbaa !23
  %64 = load i64, ptr %3, align 8, !tbaa !14
  %65 = call double @vec_norm_inf(ptr noundef %63, i64 noundef %64)
  store double %65, ptr %9, align 8, !tbaa !17
  %66 = load double, ptr %8, align 8, !tbaa !17
  %67 = load double, ptr %9, align 8, !tbaa !17
  %68 = fcmp ogt double %66, %67
  br i1 %68, label %69, label %71

69:                                               ; preds = %48
  %70 = load double, ptr %8, align 8, !tbaa !17
  br label %73

71:                                               ; preds = %48
  %72 = load double, ptr %9, align 8, !tbaa !17
  br label %73

73:                                               ; preds = %71, %69
  %74 = phi double [ %70, %69 ], [ %72, %71 ]
  store double %74, ptr %8, align 8, !tbaa !17
  %75 = load ptr, ptr %2, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.OSQPWorkspace, ptr %75, i32 0, i32 13
  %77 = load ptr, ptr %76, align 8, !tbaa !24
  %78 = load i64, ptr %3, align 8, !tbaa !14
  %79 = call double @vec_norm_inf(ptr noundef %77, i64 noundef %78)
  store double %79, ptr %9, align 8, !tbaa !17
  %80 = load double, ptr %8, align 8, !tbaa !17
  %81 = load double, ptr %9, align 8, !tbaa !17
  %82 = fcmp ogt double %80, %81
  br i1 %82, label %83, label %85

83:                                               ; preds = %73
  %84 = load double, ptr %8, align 8, !tbaa !17
  br label %87

85:                                               ; preds = %73
  %86 = load double, ptr %9, align 8, !tbaa !17
  br label %87

87:                                               ; preds = %85, %83
  %88 = phi double [ %84, %83 ], [ %86, %85 ]
  store double %88, ptr %8, align 8, !tbaa !17
  %89 = load double, ptr %8, align 8, !tbaa !17
  %90 = fadd double %89, 1.000000e-10
  %91 = load double, ptr %6, align 8, !tbaa !17
  %92 = fdiv double %91, %90
  store double %92, ptr %6, align 8, !tbaa !17
  %93 = load ptr, ptr %2, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.OSQPWorkspace, ptr %93, i32 0, i32 23
  %95 = load ptr, ptr %94, align 8, !tbaa !25
  %96 = getelementptr inbounds %struct.OSQPSettings, ptr %95, i32 0, i32 0
  %97 = load double, ptr %96, align 8, !tbaa !26
  %98 = load double, ptr %5, align 8, !tbaa !17
  %99 = load double, ptr %6, align 8, !tbaa !17
  %100 = fadd double %99, 1.000000e-10
  %101 = fdiv double %98, %100
  %102 = call double @sqrt(double noundef %101) #4
  %103 = fmul double %97, %102
  store double %103, ptr %10, align 8, !tbaa !17
  %104 = load double, ptr %10, align 8, !tbaa !17
  %105 = fcmp ogt double %104, 0x3EB0C6F7A0B5ED8D
  br i1 %105, label %106, label %108

106:                                              ; preds = %87
  %107 = load double, ptr %10, align 8, !tbaa !17
  br label %109

108:                                              ; preds = %87
  br label %109

109:                                              ; preds = %108, %106
  %110 = phi double [ %107, %106 ], [ 0x3EB0C6F7A0B5ED8D, %108 ]
  %111 = fcmp olt double %110, 1.000000e+06
  br i1 %111, label %112, label %120

112:                                              ; preds = %109
  %113 = load double, ptr %10, align 8, !tbaa !17
  %114 = fcmp ogt double %113, 0x3EB0C6F7A0B5ED8D
  br i1 %114, label %115, label %117

115:                                              ; preds = %112
  %116 = load double, ptr %10, align 8, !tbaa !17
  br label %118

117:                                              ; preds = %112
  br label %118

118:                                              ; preds = %117, %115
  %119 = phi double [ %116, %115 ], [ 0x3EB0C6F7A0B5ED8D, %117 ]
  br label %121

120:                                              ; preds = %109
  br label %121

121:                                              ; preds = %120, %118
  %122 = phi double [ %119, %118 ], [ 1.000000e+06, %120 ]
  store double %122, ptr %10, align 8, !tbaa !17
  %123 = load double, ptr %10, align 8, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  ret double %123
}

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

declare double @vec_norm_inf(ptr noundef, i64 noundef) #2

; Function Attrs: nounwind
declare double @sqrt(double noundef) #3

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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, !6, i64 0}
!10 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !11, i64 224, !11, i64 232}
!11 = !{!"long long", !7, i64 0}
!12 = !{!13, !11, i64 0}
!13 = !{!"", !11, i64 0, !11, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48}
!14 = !{!11, !11, i64 0}
!15 = !{!13, !11, i64 8}
!16 = !{!10, !6, i64 88}
!17 = !{!18, !18, i64 0}
!18 = !{!"double", !7, i64 0}
!19 = !{!10, !6, i64 80}
!20 = !{!10, !6, i64 64}
!21 = !{!10, !6, i64 96}
!22 = !{!13, !6, i64 32}
!23 = !{!10, !6, i64 112}
!24 = !{!10, !6, i64 104}
!25 = !{!10, !6, i64 184}
!26 = !{!27, !18, i64 0}
!27 = !{!"", !18, i64 0, !18, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !18, i64 40, !18, i64 48, !11, i64 56, !18, i64 64, !18, i64 72, !18, i64 80, !18, i64 88, !18, i64 96, !28, i64 104, !18, i64 112, !11, i64 120, !11, i64 128, !11, i64 136, !11, i64 144, !11, i64 152, !11, i64 160, !18, i64 168}
!28 = !{!"int", !7, i64 0}


; 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
define dso_local double @compute_rho_estimate(ptr nocapture noundef readonly %0) local_unnamed_addr #0 {
  %2 = load ptr, ptr %0, align 8, !tbaa !5
  %3 = load i64, ptr %2, align 8, !tbaa !11
  %4 = getelementptr inbounds i8, ptr %2, i64 8
  %5 = load i64, ptr %4, align 8, !tbaa !13
  %6 = getelementptr inbounds i8, ptr %0, i64 88
  %7 = load ptr, ptr %6, align 8, !tbaa !14
  %8 = tail call double @vec_norm_inf(ptr noundef %7, i64 noundef %5) #3
  %9 = getelementptr inbounds i8, ptr %0, i64 80
  %10 = load ptr, ptr %9, align 8, !tbaa !15
  %11 = tail call double @vec_norm_inf(ptr noundef %10, i64 noundef %3) #3
  %12 = getelementptr inbounds i8, ptr %0, i64 64
  %13 = load ptr, ptr %12, align 8, !tbaa !16
  %14 = tail call double @vec_norm_inf(ptr noundef %13, i64 noundef %5) #3
  %15 = getelementptr inbounds i8, ptr %0, i64 96
  %16 = load ptr, ptr %15, align 8, !tbaa !17
  %17 = tail call double @vec_norm_inf(ptr noundef %16, i64 noundef %5) #3
  %18 = load ptr, ptr %0, align 8, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %18, i64 32
  %20 = load ptr, ptr %19, align 8, !tbaa !18
  %21 = tail call double @vec_norm_inf(ptr noundef %20, i64 noundef %3) #3
  %22 = getelementptr inbounds i8, ptr %0, i64 112
  %23 = load ptr, ptr %22, align 8, !tbaa !19
  %24 = tail call double @vec_norm_inf(ptr noundef %23, i64 noundef %3) #3
  %25 = fcmp ogt double %21, %24
  %26 = select i1 %25, double %21, double %24
  %27 = getelementptr inbounds i8, ptr %0, i64 104
  %28 = load ptr, ptr %27, align 8, !tbaa !20
  %29 = tail call double @vec_norm_inf(ptr noundef %28, i64 noundef %3) #3
  %30 = insertelement <2 x double> poison, double %14, i64 0
  %31 = insertelement <2 x double> %30, double %26, i64 1
  %32 = insertelement <2 x double> poison, double %17, i64 0
  %33 = insertelement <2 x double> %32, double %29, i64 1
  %34 = fcmp ogt <2 x double> %31, %33
  %35 = select <2 x i1> %34, <2 x double> %31, <2 x double> %33
  %36 = fadd <2 x double> %35, <double 1.000000e-10, double 1.000000e-10>
  %37 = insertelement <2 x double> poison, double %8, i64 0
  %38 = insertelement <2 x double> %37, double %11, i64 1
  %39 = fdiv <2 x double> %38, %36
  %40 = getelementptr inbounds i8, ptr %0, i64 184
  %41 = load ptr, ptr %40, align 8, !tbaa !21
  %42 = load double, ptr %41, align 8, !tbaa !22
  %43 = extractelement <2 x double> %39, i64 1
  %44 = fadd double %43, 1.000000e-10
  %45 = extractelement <2 x double> %39, i64 0
  %46 = fdiv double %45, %44
  %47 = tail call double @sqrt(double noundef %46) #3
  %48 = fmul double %42, %47
  %49 = fcmp ogt double %48, 0x3EB0C6F7A0B5ED8D
  %50 = select i1 %49, double %48, double 0x3EB0C6F7A0B5ED8D
  %51 = fcmp olt double %50, 1.000000e+06
  %52 = select i1 %51, double %50, double 1.000000e+06
  ret double %52
}

declare double @vec_norm_inf(ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #2

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 nofree nounwind willreturn memory(write) "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 }

!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, !7, i64 0}
!6 = !{!"", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !7, i64 96, !7, i64 104, !7, i64 112, !7, i64 120, !7, i64 128, !7, i64 136, !7, i64 144, !7, i64 152, !7, i64 160, !7, i64 168, !7, i64 176, !7, i64 184, !7, i64 192, !7, i64 200, !7, i64 208, !7, i64 216, !10, i64 224, !10, i64 232}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long long", !8, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"", !10, i64 0, !10, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48}
!13 = !{!12, !10, i64 8}
!14 = !{!6, !7, i64 88}
!15 = !{!6, !7, i64 80}
!16 = !{!6, !7, i64 64}
!17 = !{!6, !7, i64 96}
!18 = !{!12, !7, i64 32}
!19 = !{!6, !7, i64 112}
!20 = !{!6, !7, i64 104}
!21 = !{!6, !7, i64 184}
!22 = !{!23, !24, i64 0}
!23 = !{!"", !24, i64 0, !24, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !24, i64 40, !24, i64 48, !10, i64 56, !24, i64 64, !24, i64 72, !24, i64 80, !24, i64 88, !24, i64 96, !25, i64 104, !24, i64 112, !10, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !24, i64 168}
!24 = !{!"double", !8, i64 0}
!25 = !{!"int", !8, i64 0}


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