; LLVM IR from Derek-TH-Wang/quadruped_ctrl :: src/osqp/lin_sys/direct/pardiso (pardiso_interface)

; 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.pardiso = type { i32, ptr, ptr, ptr, ptr, i64, ptr, ptr, ptr, ptr, [64 x ptr], [64 x i64], i64, i64, i64, i64, i64, i64, i64, i64, i64, double, ptr, i64, ptr, ptr, ptr }
%struct.csc = type { i64, i64, i64, ptr, ptr, ptr, i64 }

declare void @pardiso(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #0

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

; Function Attrs: nounwind uwtable
define dso_local i64 @update_linsys_solver_rho_vec_pardiso(ptr noundef %0, ptr noundef %1, i64 noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i64 %2, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  store i64 0, ptr %7, align 8, !tbaa !9
  br label %8

8:                                                ; preds = %23, %3
  %9 = load i64, ptr %7, align 8, !tbaa !9
  %10 = load i64, ptr %6, align 8, !tbaa !9
  %11 = icmp slt i64 %9, %10
  br i1 %11, label %12, label %26

12:                                               ; preds = %8
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = load i64, ptr %7, align 8, !tbaa !9
  %15 = getelementptr inbounds double, ptr %13, i64 %14
  %16 = load double, ptr %15, align 8, !tbaa !11
  %17 = fdiv double 1.000000e+00, %16
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.pardiso, ptr %18, i32 0, i32 9
  %20 = load ptr, ptr %19, align 8, !tbaa !13
  %21 = load i64, ptr %7, align 8, !tbaa !9
  %22 = getelementptr inbounds double, ptr %20, i64 %21
  store double %17, ptr %22, align 8, !tbaa !11
  br label %23

23:                                               ; preds = %12
  %24 = load i64, ptr %7, align 8, !tbaa !9
  %25 = add nsw i64 %24, 1
  store i64 %25, ptr %7, align 8, !tbaa !9
  br label %8, !llvm.loop !16

26:                                               ; preds = %8
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.pardiso, ptr %27, i32 0, i32 6
  %29 = load ptr, ptr %28, align 8, !tbaa !18
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.pardiso, ptr %30, i32 0, i32 9
  %32 = load ptr, ptr %31, align 8, !tbaa !13
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.pardiso, ptr %33, i32 0, i32 26
  %35 = load ptr, ptr %34, align 8, !tbaa !19
  %36 = load i64, ptr %6, align 8, !tbaa !9
  call void @update_KKT_param2(ptr noundef %29, ptr noundef %32, ptr noundef %35, i64 noundef %36)
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.pardiso, ptr %37, i32 0, i32 17
  store i64 22, ptr %38, align 8, !tbaa !20
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.pardiso, ptr %39, i32 0, i32 10
  %41 = getelementptr inbounds [64 x ptr], ptr %40, i64 0, i64 0
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.pardiso, ptr %42, i32 0, i32 15
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.pardiso, ptr %44, i32 0, i32 16
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.pardiso, ptr %46, i32 0, i32 13
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.pardiso, ptr %48, i32 0, i32 17
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.pardiso, ptr %50, i32 0, i32 12
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.pardiso, ptr %52, i32 0, i32 6
  %54 = load ptr, ptr %53, align 8, !tbaa !18
  %55 = getelementptr inbounds %struct.csc, ptr %54, i32 0, i32 5
  %56 = load ptr, ptr %55, align 8, !tbaa !21
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.pardiso, ptr %57, i32 0, i32 8
  %59 = load ptr, ptr %58, align 8, !tbaa !23
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.pardiso, ptr %60, i32 0, i32 7
  %62 = load ptr, ptr %61, align 8, !tbaa !24
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.pardiso, ptr %63, i32 0, i32 20
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.pardiso, ptr %65, i32 0, i32 14
  %67 = load ptr, ptr %4, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.pardiso, ptr %67, i32 0, i32 11
  %69 = getelementptr inbounds [64 x i64], ptr %68, i64 0, i64 0
  %70 = load ptr, ptr %4, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.pardiso, ptr %70, i32 0, i32 19
  %72 = load ptr, ptr %4, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.pardiso, ptr %72, i32 0, i32 21
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.pardiso, ptr %74, i32 0, i32 21
  %76 = load ptr, ptr %4, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.pardiso, ptr %76, i32 0, i32 18
  call void @pardiso(ptr noundef %41, ptr noundef %43, ptr noundef %45, ptr noundef %47, ptr noundef %49, ptr noundef %51, ptr noundef %56, ptr noundef %59, ptr noundef %62, ptr noundef %64, ptr noundef %66, ptr noundef %69, ptr noundef %71, ptr noundef %73, ptr noundef %75, ptr noundef %77)
  %78 = load ptr, ptr %4, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.pardiso, ptr %78, i32 0, i32 18
  %80 = load i64, ptr %79, align 8, !tbaa !25
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  ret i64 %80
}

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

declare void @update_KKT_param2(ptr noundef, ptr noundef, ptr noundef, i64 noundef) #0

attributes #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 = { 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 }

!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 = !{!"long long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !6, i64 72}
!14 = !{!"pardiso", !15, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !10, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !7, i64 80, !7, i64 592, !10, i64 1104, !10, i64 1112, !10, i64 1120, !10, i64 1128, !10, i64 1136, !10, i64 1144, !10, i64 1152, !10, i64 1160, !10, i64 1168, !12, i64 1176, !6, i64 1184, !10, i64 1192, !6, i64 1200, !6, i64 1208, !6, i64 1216}
!15 = !{!"int", !7, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!14, !6, i64 48}
!19 = !{!14, !6, i64 1216}
!20 = !{!14, !10, i64 1144}
!21 = !{!22, !6, i64 40}
!22 = !{!"", !10, i64 0, !10, i64 8, !10, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !10, i64 48}
!23 = !{!14, !6, i64 64}
!24 = !{!14, !6, i64 56}
!25 = !{!14, !10, i64 1152}


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

declare void @pardiso(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local i64 @update_linsys_solver_rho_vec_pardiso(ptr noundef %0, ptr nocapture noundef readonly %1, i64 noundef %2) local_unnamed_addr #1 {
  %4 = icmp sgt i64 %2, 0
  %5 = getelementptr inbounds i8, ptr %0, i64 72
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  br i1 %4, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %3
  %7 = ptrtoint ptr %6 to i64
  %8 = ptrtoint ptr %1 to i64
  %min.iters.check = icmp eq i64 %2, 1
  %9 = sub i64 %7, %8
  %diff.check = icmp ult i64 %9, 16
  %or.cond = select i1 %min.iters.check, i1 true, i1 %diff.check
  br i1 %or.cond, label %.lr.ph.preheader30, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %2, 9223372036854775806
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %10 = getelementptr inbounds double, ptr %1, i64 %index
  %wide.load = load <2 x double>, ptr %10, align 8, !tbaa !13
  %11 = fdiv <2 x double> <double 1.000000e+00, double 1.000000e+00>, %wide.load
  %12 = getelementptr inbounds double, ptr %6, i64 %index
  store <2 x double> %11, ptr %12, align 8, !tbaa !13
  %index.next = add nuw i64 %index, 2
  %13 = icmp eq i64 %index.next, %n.vec
  br i1 %13, label %middle.block, label %vector.body, !llvm.loop !14

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %2
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader30

.lr.ph.preheader30:                               ; preds = %middle.block, %.lr.ph.preheader
  %.029.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  %14 = sub nsw i64 %2, %.029.ph
  %xtraiter = and i64 %14, 3
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph.prol.loopexit, label %.lr.ph.prol

.lr.ph.prol:                                      ; preds = %.lr.ph.preheader30, %.lr.ph.prol
  %.029.prol = phi i64 [ %19, %.lr.ph.prol ], [ %.029.ph, %.lr.ph.preheader30 ]
  %prol.iter = phi i64 [ %prol.iter.next, %.lr.ph.prol ], [ 0, %.lr.ph.preheader30 ]
  %15 = getelementptr inbounds double, ptr %1, i64 %.029.prol
  %16 = load double, ptr %15, align 8, !tbaa !13
  %17 = fdiv double 1.000000e+00, %16
  %18 = getelementptr inbounds double, ptr %6, i64 %.029.prol
  store double %17, ptr %18, align 8, !tbaa !13
  %19 = add nuw nsw i64 %.029.prol, 1
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %.lr.ph.prol.loopexit, label %.lr.ph.prol, !llvm.loop !18

.lr.ph.prol.loopexit:                             ; preds = %.lr.ph.prol, %.lr.ph.preheader30
  %.029.unr = phi i64 [ %.029.ph, %.lr.ph.preheader30 ], [ %19, %.lr.ph.prol ]
  %20 = sub nsw i64 %.029.ph, %2
  %21 = icmp ugt i64 %20, -4
  br i1 %21, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.prol.loopexit, %.lr.ph
  %.029 = phi i64 [ %41, %.lr.ph ], [ %.029.unr, %.lr.ph.prol.loopexit ]
  %22 = getelementptr inbounds double, ptr %1, i64 %.029
  %23 = load double, ptr %22, align 8, !tbaa !13
  %24 = fdiv double 1.000000e+00, %23
  %25 = getelementptr inbounds double, ptr %6, i64 %.029
  store double %24, ptr %25, align 8, !tbaa !13
  %26 = add nuw nsw i64 %.029, 1
  %27 = getelementptr inbounds double, ptr %1, i64 %26
  %28 = load double, ptr %27, align 8, !tbaa !13
  %29 = fdiv double 1.000000e+00, %28
  %30 = getelementptr inbounds double, ptr %6, i64 %26
  store double %29, ptr %30, align 8, !tbaa !13
  %31 = add nuw nsw i64 %.029, 2
  %32 = getelementptr inbounds double, ptr %1, i64 %31
  %33 = load double, ptr %32, align 8, !tbaa !13
  %34 = fdiv double 1.000000e+00, %33
  %35 = getelementptr inbounds double, ptr %6, i64 %31
  store double %34, ptr %35, align 8, !tbaa !13
  %36 = add nuw nsw i64 %.029, 3
  %37 = getelementptr inbounds double, ptr %1, i64 %36
  %38 = load double, ptr %37, align 8, !tbaa !13
  %39 = fdiv double 1.000000e+00, %38
  %40 = getelementptr inbounds double, ptr %6, i64 %36
  store double %39, ptr %40, align 8, !tbaa !13
  %41 = add nuw nsw i64 %.029, 4
  %exitcond.not.3 = icmp eq i64 %41, %2
  br i1 %exitcond.not.3, label %._crit_edge, label %.lr.ph, !llvm.loop !20

._crit_edge:                                      ; preds = %.lr.ph.prol.loopexit, %.lr.ph, %middle.block, %3
  %42 = getelementptr inbounds i8, ptr %0, i64 48
  %43 = load ptr, ptr %42, align 8, !tbaa !21
  %44 = getelementptr inbounds i8, ptr %0, i64 1216
  %45 = load ptr, ptr %44, align 8, !tbaa !22
  tail call void @update_KKT_param2(ptr noundef %43, ptr noundef %6, ptr noundef %45, i64 noundef %2) #2
  %46 = getelementptr inbounds i8, ptr %0, i64 1144
  store i64 22, ptr %46, align 8, !tbaa !23
  %47 = getelementptr inbounds i8, ptr %0, i64 80
  %48 = getelementptr inbounds i8, ptr %0, i64 1128
  %49 = getelementptr inbounds i8, ptr %0, i64 1136
  %50 = getelementptr inbounds i8, ptr %0, i64 1112
  %51 = getelementptr inbounds i8, ptr %0, i64 1104
  %52 = load ptr, ptr %42, align 8, !tbaa !21
  %53 = getelementptr inbounds i8, ptr %52, i64 40
  %54 = load ptr, ptr %53, align 8, !tbaa !24
  %55 = getelementptr inbounds i8, ptr %0, i64 64
  %56 = load ptr, ptr %55, align 8, !tbaa !26
  %57 = getelementptr inbounds i8, ptr %0, i64 56
  %58 = load ptr, ptr %57, align 8, !tbaa !27
  %59 = getelementptr inbounds i8, ptr %0, i64 1168
  %60 = getelementptr inbounds i8, ptr %0, i64 1120
  %61 = getelementptr inbounds i8, ptr %0, i64 592
  %62 = getelementptr inbounds i8, ptr %0, i64 1160
  %63 = getelementptr inbounds i8, ptr %0, i64 1176
  %64 = getelementptr inbounds i8, ptr %0, i64 1152
  tail call void @pardiso(ptr noundef nonnull %47, ptr noundef nonnull %48, ptr noundef nonnull %49, ptr noundef nonnull %50, ptr noundef nonnull %46, ptr noundef nonnull %51, ptr noundef %54, ptr noundef %56, ptr noundef %58, ptr noundef nonnull %59, ptr noundef nonnull %60, ptr noundef nonnull %61, ptr noundef nonnull %62, ptr noundef nonnull %63, ptr noundef nonnull %63, ptr noundef nonnull %64) #2
  %65 = load i64, ptr %64, align 8, !tbaa !28
  ret i64 %65
}

declare void @update_KKT_param2(ptr noundef, ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #0

attributes #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 = { 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 = { 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, !10, i64 72}
!6 = !{!"pardiso", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !11, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !8, i64 80, !8, i64 592, !11, i64 1104, !11, i64 1112, !11, i64 1120, !11, i64 1128, !11, i64 1136, !11, i64 1144, !11, i64 1152, !11, i64 1160, !11, i64 1168, !12, i64 1176, !10, i64 1184, !11, i64 1192, !10, i64 1200, !10, i64 1208, !10, i64 1216}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"long long", !8, i64 0}
!12 = !{!"double", !8, i64 0}
!13 = !{!12, !12, i64 0}
!14 = distinct !{!14, !15, !16, !17}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!"llvm.loop.isvectorized", i32 1}
!17 = !{!"llvm.loop.unroll.runtime.disable"}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.unroll.disable"}
!20 = distinct !{!20, !15, !16}
!21 = !{!6, !10, i64 48}
!22 = !{!6, !10, i64 1216}
!23 = !{!6, !11, i64 1144}
!24 = !{!25, !10, i64 40}
!25 = !{!"", !11, i64 0, !11, i64 8, !11, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !11, i64 48}
!26 = !{!6, !10, i64 64}
!27 = !{!6, !10, i64 56}
!28 = !{!6, !11, i64 1152}


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass