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

; 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.OSQPInfo = type { i64, [32 x i8], i64, i64, double, double, double, double, double, double, double, double, i64, double }
%struct.OSQPData = type { i64, i64, ptr, ptr, ptr, ptr, ptr }
%struct.csc = type { i64, i64, i64, ptr, ptr, ptr, i64 }
%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 }
%struct.linsys_solver = type { i32, ptr, ptr, ptr, ptr, i64 }

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

declare void @osqp_tic(ptr noundef) #1

declare i64 @scale_data(ptr noundef) #1

declare double @osqp_toc(ptr noundef) #1

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

declare void @reset_info(ptr noundef) #1

declare i64 @unscale_data(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i64 @osqp_update_A(ptr noundef %0, ptr noundef %1, ptr noundef %2, i64 noundef %3) #2 {
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store i64 %3, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %14 = load ptr, ptr %6, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.OSQPWorkspace, ptr %14, i32 0, i32 29
  %16 = load i64, ptr %15, align 8, !tbaa !11
  %17 = icmp eq i64 %16, 1
  br i1 %17, label %18, label %25

18:                                               ; preds = %4
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.OSQPWorkspace, ptr %19, i32 0, i32 29
  store i64 0, ptr %20, align 8, !tbaa !11
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.OSQPWorkspace, ptr %21, i32 0, i32 26
  %23 = load ptr, ptr %22, align 8, !tbaa !13
  %24 = getelementptr inbounds %struct.OSQPInfo, ptr %23, i32 0, i32 9
  store double 0.000000e+00, ptr %24, align 8, !tbaa !14
  br label %25

25:                                               ; preds = %18, %4
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.OSQPWorkspace, ptr %26, i32 0, i32 27
  %28 = load ptr, ptr %27, align 8, !tbaa !17
  call void @osqp_tic(ptr noundef %28)
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.OSQPWorkspace, ptr %29, i32 0, i32 0
  %31 = load ptr, ptr %30, align 8, !tbaa !18
  %32 = getelementptr inbounds %struct.OSQPData, ptr %31, i32 0, i32 3
  %33 = load ptr, ptr %32, align 8, !tbaa !19
  %34 = getelementptr inbounds %struct.csc, ptr %33, i32 0, i32 3
  %35 = load ptr, ptr %34, align 8, !tbaa !21
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.OSQPWorkspace, ptr %36, i32 0, i32 0
  %38 = load ptr, ptr %37, align 8, !tbaa !18
  %39 = getelementptr inbounds %struct.OSQPData, ptr %38, i32 0, i32 3
  %40 = load ptr, ptr %39, align 8, !tbaa !19
  %41 = getelementptr inbounds %struct.csc, ptr %40, i32 0, i32 2
  %42 = load i64, ptr %41, align 8, !tbaa !23
  %43 = getelementptr inbounds i64, ptr %35, i64 %42
  %44 = load i64, ptr %43, align 8, !tbaa !9
  store i64 %44, ptr %12, align 8, !tbaa !9
  %45 = load ptr, ptr %8, align 8, !tbaa !5
  %46 = icmp ne ptr %45, null
  br i1 %46, label %47, label %53

47:                                               ; preds = %25
  %48 = load i64, ptr %9, align 8, !tbaa !9
  %49 = load i64, ptr %12, align 8, !tbaa !9
  %50 = icmp sgt i64 %48, %49
  br i1 %50, label %51, label %52

51:                                               ; preds = %47
  store i64 1, ptr %5, align 8
  store i32 1, ptr %13, align 4
  br label %162

52:                                               ; preds = %47
  br label %53

53:                                               ; preds = %52, %25
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.OSQPWorkspace, ptr %54, i32 0, i32 23
  %56 = load ptr, ptr %55, align 8, !tbaa !24
  %57 = getelementptr inbounds %struct.OSQPSettings, ptr %56, i32 0, i32 2
  %58 = load i64, ptr %57, align 8, !tbaa !25
  %59 = icmp ne i64 %58, 0
  br i1 %59, label %60, label %63

60:                                               ; preds = %53
  %61 = load ptr, ptr %6, align 8, !tbaa !5
  %62 = call i64 @unscale_data(ptr noundef %61)
  br label %63

63:                                               ; preds = %60, %53
  %64 = load ptr, ptr %8, align 8, !tbaa !5
  %65 = icmp ne ptr %64, null
  br i1 %65, label %66, label %92

66:                                               ; preds = %63
  store i64 0, ptr %10, align 8, !tbaa !9
  br label %67

67:                                               ; preds = %88, %66
  %68 = load i64, ptr %10, align 8, !tbaa !9
  %69 = load i64, ptr %9, align 8, !tbaa !9
  %70 = icmp slt i64 %68, %69
  br i1 %70, label %71, label %91

71:                                               ; preds = %67
  %72 = load ptr, ptr %7, align 8, !tbaa !5
  %73 = load i64, ptr %10, align 8, !tbaa !9
  %74 = getelementptr inbounds double, ptr %72, i64 %73
  %75 = load double, ptr %74, align 8, !tbaa !28
  %76 = load ptr, ptr %6, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.OSQPWorkspace, ptr %76, i32 0, i32 0
  %78 = load ptr, ptr %77, align 8, !tbaa !18
  %79 = getelementptr inbounds %struct.OSQPData, ptr %78, i32 0, i32 3
  %80 = load ptr, ptr %79, align 8, !tbaa !19
  %81 = getelementptr inbounds %struct.csc, ptr %80, i32 0, i32 5
  %82 = load ptr, ptr %81, align 8, !tbaa !29
  %83 = load ptr, ptr %8, align 8, !tbaa !5
  %84 = load i64, ptr %10, align 8, !tbaa !9
  %85 = getelementptr inbounds i64, ptr %83, i64 %84
  %86 = load i64, ptr %85, align 8, !tbaa !9
  %87 = getelementptr inbounds double, ptr %82, i64 %86
  store double %75, ptr %87, align 8, !tbaa !28
  br label %88

88:                                               ; preds = %71
  %89 = load i64, ptr %10, align 8, !tbaa !9
  %90 = add nsw i64 %89, 1
  store i64 %90, ptr %10, align 8, !tbaa !9
  br label %67, !llvm.loop !30

91:                                               ; preds = %67
  br label %115

92:                                               ; preds = %63
  store i64 0, ptr %10, align 8, !tbaa !9
  br label %93

93:                                               ; preds = %111, %92
  %94 = load i64, ptr %10, align 8, !tbaa !9
  %95 = load i64, ptr %12, align 8, !tbaa !9
  %96 = icmp slt i64 %94, %95
  br i1 %96, label %97, label %114

97:                                               ; preds = %93
  %98 = load ptr, ptr %7, align 8, !tbaa !5
  %99 = load i64, ptr %10, align 8, !tbaa !9
  %100 = getelementptr inbounds double, ptr %98, i64 %99
  %101 = load double, ptr %100, align 8, !tbaa !28
  %102 = load ptr, ptr %6, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.OSQPWorkspace, ptr %102, i32 0, i32 0
  %104 = load ptr, ptr %103, align 8, !tbaa !18
  %105 = getelementptr inbounds %struct.OSQPData, ptr %104, i32 0, i32 3
  %106 = load ptr, ptr %105, align 8, !tbaa !19
  %107 = getelementptr inbounds %struct.csc, ptr %106, i32 0, i32 5
  %108 = load ptr, ptr %107, align 8, !tbaa !29
  %109 = load i64, ptr %10, align 8, !tbaa !9
  %110 = getelementptr inbounds double, ptr %108, i64 %109
  store double %101, ptr %110, align 8, !tbaa !28
  br label %111

111:                                              ; preds = %97
  %112 = load i64, ptr %10, align 8, !tbaa !9
  %113 = add nsw i64 %112, 1
  store i64 %113, ptr %10, align 8, !tbaa !9
  br label %93, !llvm.loop !32

114:                                              ; preds = %93
  br label %115

115:                                              ; preds = %114, %91
  %116 = load ptr, ptr %6, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.OSQPWorkspace, ptr %116, i32 0, i32 23
  %118 = load ptr, ptr %117, align 8, !tbaa !24
  %119 = getelementptr inbounds %struct.OSQPSettings, ptr %118, i32 0, i32 2
  %120 = load i64, ptr %119, align 8, !tbaa !25
  %121 = icmp ne i64 %120, 0
  br i1 %121, label %122, label %125

122:                                              ; preds = %115
  %123 = load ptr, ptr %6, align 8, !tbaa !5
  %124 = call i64 @scale_data(ptr noundef %123)
  br label %125

125:                                              ; preds = %122, %115
  %126 = load ptr, ptr %6, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.OSQPWorkspace, ptr %126, i32 0, i32 1
  %128 = load ptr, ptr %127, align 8, !tbaa !33
  %129 = getelementptr inbounds %struct.linsys_solver, ptr %128, i32 0, i32 3
  %130 = load ptr, ptr %129, align 8, !tbaa !34
  %131 = load ptr, ptr %6, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.OSQPWorkspace, ptr %131, i32 0, i32 1
  %133 = load ptr, ptr %132, align 8, !tbaa !33
  %134 = load ptr, ptr %6, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.OSQPWorkspace, ptr %134, i32 0, i32 0
  %136 = load ptr, ptr %135, align 8, !tbaa !18
  %137 = getelementptr inbounds %struct.OSQPData, ptr %136, i32 0, i32 2
  %138 = load ptr, ptr %137, align 8, !tbaa !36
  %139 = load ptr, ptr %6, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.OSQPWorkspace, ptr %139, i32 0, i32 0
  %141 = load ptr, ptr %140, align 8, !tbaa !18
  %142 = getelementptr inbounds %struct.OSQPData, ptr %141, i32 0, i32 3
  %143 = load ptr, ptr %142, align 8, !tbaa !19
  %144 = load ptr, ptr %6, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.OSQPWorkspace, ptr %144, i32 0, i32 23
  %146 = load ptr, ptr %145, align 8, !tbaa !24
  %147 = call i64 %130(ptr noundef %133, ptr noundef %138, ptr noundef %143, ptr noundef %146)
  store i64 %147, ptr %11, align 8, !tbaa !9
  %148 = load ptr, ptr %6, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct.OSQPWorkspace, ptr %148, i32 0, i32 26
  %150 = load ptr, ptr %149, align 8, !tbaa !13
  call void @reset_info(ptr noundef %150)
  %151 = load ptr, ptr %6, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.OSQPWorkspace, ptr %151, i32 0, i32 27
  %153 = load ptr, ptr %152, align 8, !tbaa !17
  %154 = call double @osqp_toc(ptr noundef %153)
  %155 = load ptr, ptr %6, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.OSQPWorkspace, ptr %155, i32 0, i32 26
  %157 = load ptr, ptr %156, align 8, !tbaa !13
  %158 = getelementptr inbounds %struct.OSQPInfo, ptr %157, i32 0, i32 9
  %159 = load double, ptr %158, align 8, !tbaa !14
  %160 = fadd double %159, %154
  store double %160, ptr %158, align 8, !tbaa !14
  %161 = load i64, ptr %11, align 8, !tbaa !9
  store i64 %161, ptr %5, align 8
  store i32 1, ptr %13, align 4
  br label %162

162:                                              ; preds = %125, %51
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  %163 = load i64, ptr %5, align 8
  ret i64 %163
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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, !10, i64 232}
!12 = !{!"", !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, !10, i64 224, !10, i64 232}
!13 = !{!12, !6, i64 208}
!14 = !{!15, !16, i64 96}
!15 = !{!"", !10, i64 0, !7, i64 8, !10, i64 40, !10, i64 48, !16, i64 56, !16, i64 64, !16, i64 72, !16, i64 80, !16, i64 88, !16, i64 96, !16, i64 104, !16, i64 112, !10, i64 120, !16, i64 128}
!16 = !{!"double", !7, i64 0}
!17 = !{!12, !6, i64 216}
!18 = !{!12, !6, i64 0}
!19 = !{!20, !6, i64 24}
!20 = !{!"", !10, i64 0, !10, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48}
!21 = !{!22, !6, i64 24}
!22 = !{!"", !10, i64 0, !10, i64 8, !10, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !10, i64 48}
!23 = !{!22, !10, i64 16}
!24 = !{!12, !6, i64 184}
!25 = !{!26, !10, i64 16}
!26 = !{!"", !16, i64 0, !16, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !16, i64 40, !16, i64 48, !10, i64 56, !16, i64 64, !16, i64 72, !16, i64 80, !16, i64 88, !16, i64 96, !27, i64 104, !16, i64 112, !10, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !16, i64 168}
!27 = !{!"int", !7, i64 0}
!28 = !{!16, !16, i64 0}
!29 = !{!22, !6, i64 40}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}
!32 = distinct !{!32, !31}
!33 = !{!12, !6, i64 8}
!34 = !{!35, !6, i64 24}
!35 = !{!"linsys_solver", !27, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !10, i64 40}
!36 = !{!20, !6, i64 16}


; 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 @osqp_tic(ptr noundef) local_unnamed_addr #0

declare i64 @scale_data(ptr noundef) local_unnamed_addr #0

declare double @osqp_toc(ptr noundef) local_unnamed_addr #0

declare void @reset_info(ptr noundef) local_unnamed_addr #0

declare i64 @unscale_data(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local i64 @osqp_update_A(ptr noundef %0, ptr nocapture noundef readonly %1, ptr noundef readonly %2, i64 noundef %3) local_unnamed_addr #1 {
  %5 = ptrtoint ptr %1 to i64
  %6 = getelementptr inbounds i8, ptr %0, i64 232
  %7 = load i64, ptr %6, align 8, !tbaa !5
  %8 = icmp eq i64 %7, 1
  br i1 %8, label %9, label %13

9:                                                ; preds = %4
  store i64 0, ptr %6, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %0, i64 208
  %11 = load ptr, ptr %10, align 8, !tbaa !11
  %12 = getelementptr inbounds i8, ptr %11, i64 96
  store double 0.000000e+00, ptr %12, align 8, !tbaa !12
  br label %13

13:                                               ; preds = %9, %4
  %14 = getelementptr inbounds i8, ptr %0, i64 216
  %15 = load ptr, ptr %14, align 8, !tbaa !15
  tail call void @osqp_tic(ptr noundef %15) #2
  %16 = load ptr, ptr %0, align 8, !tbaa !16
  %17 = getelementptr inbounds i8, ptr %16, i64 24
  %18 = load ptr, ptr %17, align 8, !tbaa !17
  %19 = getelementptr inbounds i8, ptr %18, i64 24
  %20 = load ptr, ptr %19, align 8, !tbaa !19
  %21 = getelementptr inbounds i8, ptr %18, i64 16
  %22 = load i64, ptr %21, align 8, !tbaa !21
  %23 = getelementptr inbounds i64, ptr %20, i64 %22
  %24 = load i64, ptr %23, align 8, !tbaa !22
  %.not = icmp ne ptr %2, null
  %25 = icmp slt i64 %24, %3
  %or.cond = select i1 %.not, i1 %25, i1 false
  br i1 %or.cond, label %132, label %26

26:                                               ; preds = %13
  %27 = getelementptr inbounds i8, ptr %0, i64 184
  %28 = load ptr, ptr %27, align 8, !tbaa !23
  %29 = getelementptr inbounds i8, ptr %28, i64 16
  %30 = load i64, ptr %29, align 8, !tbaa !24
  %.not40 = icmp eq i64 %30, 0
  br i1 %.not40, label %33, label %31

31:                                               ; preds = %26
  %32 = tail call i64 @unscale_data(ptr noundef nonnull %0) #2
  br label %33

33:                                               ; preds = %31, %26
  br i1 %.not, label %.preheader, label %.preheader42

.preheader42:                                     ; preds = %33
  %34 = icmp sgt i64 %24, 0
  br i1 %34, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %.preheader42
  %35 = load ptr, ptr %0, align 8, !tbaa !16
  %36 = getelementptr inbounds i8, ptr %35, i64 24
  %37 = load ptr, ptr %36, align 8, !tbaa !17
  %38 = getelementptr inbounds i8, ptr %37, i64 40
  %39 = load ptr, ptr %38, align 8, !tbaa !27
  %min.iters.check = icmp ult i64 %24, 6
  %40 = ptrtoint ptr %39 to i64
  %41 = sub i64 %40, %5
  %diff.check = icmp ult i64 %41, 32
  %or.cond53 = select i1 %min.iters.check, i1 true, i1 %diff.check
  br i1 %or.cond53, label %scalar.ph.preheader, label %vector.ph

scalar.ph.preheader:                              ; preds = %middle.block, %.lr.ph
  %.144.ph = phi i64 [ 0, %.lr.ph ], [ %n.vec, %middle.block ]
  %xtraiter = and i64 %24, 3
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %scalar.ph.prol.loopexit, label %scalar.ph.prol

scalar.ph.prol:                                   ; preds = %scalar.ph.preheader, %scalar.ph.prol
  %.144.prol = phi i64 [ %45, %scalar.ph.prol ], [ %.144.ph, %scalar.ph.preheader ]
  %prol.iter = phi i64 [ %prol.iter.next, %scalar.ph.prol ], [ 0, %scalar.ph.preheader ]
  %42 = getelementptr inbounds double, ptr %1, i64 %.144.prol
  %43 = load double, ptr %42, align 8, !tbaa !28
  %44 = getelementptr inbounds double, ptr %39, i64 %.144.prol
  store double %43, ptr %44, align 8, !tbaa !28
  %45 = add nuw nsw i64 %.144.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 %scalar.ph.prol.loopexit, label %scalar.ph.prol, !llvm.loop !29

scalar.ph.prol.loopexit:                          ; preds = %scalar.ph.prol, %scalar.ph.preheader
  %.144.unr = phi i64 [ %.144.ph, %scalar.ph.preheader ], [ %45, %scalar.ph.prol ]
  %46 = sub nsw i64 %.144.ph, %24
  %47 = icmp ugt i64 %46, -4
  br i1 %47, label %.loopexit, label %scalar.ph

vector.ph:                                        ; preds = %.lr.ph
  %n.vec = and i64 %24, 9223372036854775804
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %48 = getelementptr inbounds double, ptr %1, i64 %index
  %49 = getelementptr inbounds i8, ptr %48, i64 16
  %wide.load = load <2 x double>, ptr %48, align 8, !tbaa !28
  %wide.load51 = load <2 x double>, ptr %49, align 8, !tbaa !28
  %50 = getelementptr inbounds double, ptr %39, i64 %index
  %51 = getelementptr inbounds i8, ptr %50, i64 16
  store <2 x double> %wide.load, ptr %50, align 8, !tbaa !28
  store <2 x double> %wide.load51, ptr %51, align 8, !tbaa !28
  %index.next = add nuw i64 %index, 4
  %52 = icmp eq i64 %index.next, %n.vec
  br i1 %52, label %middle.block, label %vector.body, !llvm.loop !31

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %24, %n.vec
  br i1 %cmp.n, label %.loopexit, label %scalar.ph.preheader

.preheader:                                       ; preds = %33
  %53 = icmp sgt i64 %3, 0
  br i1 %53, label %.lr.ph46, label %.loopexit

.lr.ph46:                                         ; preds = %.preheader
  %54 = load ptr, ptr %0, align 8, !tbaa !16
  %55 = getelementptr inbounds i8, ptr %54, i64 24
  %56 = load ptr, ptr %55, align 8, !tbaa !17
  %57 = getelementptr inbounds i8, ptr %56, i64 40
  %58 = load ptr, ptr %57, align 8, !tbaa !27
  %xtraiter55 = and i64 %3, 3
  %59 = icmp ult i64 %3, 4
  br i1 %59, label %.loopexit.loopexit.unr-lcssa, label %.lr.ph46.new

.lr.ph46.new:                                     ; preds = %.lr.ph46
  %unroll_iter = and i64 %3, 9223372036854775804
  br label %60

60:                                               ; preds = %60, %.lr.ph46.new
  %.03845 = phi i64 [ 0, %.lr.ph46.new ], [ %84, %60 ]
  %niter = phi i64 [ 0, %.lr.ph46.new ], [ %niter.next.3, %60 ]
  %61 = getelementptr inbounds double, ptr %1, i64 %.03845
  %62 = load double, ptr %61, align 8, !tbaa !28
  %63 = getelementptr inbounds i64, ptr %2, i64 %.03845
  %64 = load i64, ptr %63, align 8, !tbaa !22
  %65 = getelementptr inbounds double, ptr %58, i64 %64
  store double %62, ptr %65, align 8, !tbaa !28
  %66 = or disjoint i64 %.03845, 1
  %67 = getelementptr inbounds double, ptr %1, i64 %66
  %68 = load double, ptr %67, align 8, !tbaa !28
  %69 = getelementptr inbounds i64, ptr %2, i64 %66
  %70 = load i64, ptr %69, align 8, !tbaa !22
  %71 = getelementptr inbounds double, ptr %58, i64 %70
  store double %68, ptr %71, align 8, !tbaa !28
  %72 = or disjoint i64 %.03845, 2
  %73 = getelementptr inbounds double, ptr %1, i64 %72
  %74 = load double, ptr %73, align 8, !tbaa !28
  %75 = getelementptr inbounds i64, ptr %2, i64 %72
  %76 = load i64, ptr %75, align 8, !tbaa !22
  %77 = getelementptr inbounds double, ptr %58, i64 %76
  store double %74, ptr %77, align 8, !tbaa !28
  %78 = or disjoint i64 %.03845, 3
  %79 = getelementptr inbounds double, ptr %1, i64 %78
  %80 = load double, ptr %79, align 8, !tbaa !28
  %81 = getelementptr inbounds i64, ptr %2, i64 %78
  %82 = load i64, ptr %81, align 8, !tbaa !22
  %83 = getelementptr inbounds double, ptr %58, i64 %82
  store double %80, ptr %83, align 8, !tbaa !28
  %84 = add nuw nsw i64 %.03845, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %.loopexit.loopexit.unr-lcssa, label %60, !llvm.loop !35

scalar.ph:                                        ; preds = %scalar.ph.prol.loopexit, %scalar.ph
  %.144 = phi i64 [ %100, %scalar.ph ], [ %.144.unr, %scalar.ph.prol.loopexit ]
  %85 = getelementptr inbounds double, ptr %1, i64 %.144
  %86 = load double, ptr %85, align 8, !tbaa !28
  %87 = getelementptr inbounds double, ptr %39, i64 %.144
  store double %86, ptr %87, align 8, !tbaa !28
  %88 = add nuw nsw i64 %.144, 1
  %89 = getelementptr inbounds double, ptr %1, i64 %88
  %90 = load double, ptr %89, align 8, !tbaa !28
  %91 = getelementptr inbounds double, ptr %39, i64 %88
  store double %90, ptr %91, align 8, !tbaa !28
  %92 = add nuw nsw i64 %.144, 2
  %93 = getelementptr inbounds double, ptr %1, i64 %92
  %94 = load double, ptr %93, align 8, !tbaa !28
  %95 = getelementptr inbounds double, ptr %39, i64 %92
  store double %94, ptr %95, align 8, !tbaa !28
  %96 = add nuw nsw i64 %.144, 3
  %97 = getelementptr inbounds double, ptr %1, i64 %96
  %98 = load double, ptr %97, align 8, !tbaa !28
  %99 = getelementptr inbounds double, ptr %39, i64 %96
  store double %98, ptr %99, align 8, !tbaa !28
  %100 = add nuw nsw i64 %.144, 4
  %exitcond.not.3 = icmp eq i64 %100, %24
  br i1 %exitcond.not.3, label %.loopexit, label %scalar.ph, !llvm.loop !36

.loopexit.loopexit.unr-lcssa:                     ; preds = %60, %.lr.ph46
  %.03845.unr = phi i64 [ 0, %.lr.ph46 ], [ %84, %60 ]
  %lcmp.mod56.not = icmp eq i64 %xtraiter55, 0
  br i1 %lcmp.mod56.not, label %.loopexit, label %.epil.preheader

.epil.preheader:                                  ; preds = %.loopexit.loopexit.unr-lcssa, %.epil.preheader
  %.03845.epil = phi i64 [ %106, %.epil.preheader ], [ %.03845.unr, %.loopexit.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader ], [ 0, %.loopexit.loopexit.unr-lcssa ]
  %101 = getelementptr inbounds double, ptr %1, i64 %.03845.epil
  %102 = load double, ptr %101, align 8, !tbaa !28
  %103 = getelementptr inbounds i64, ptr %2, i64 %.03845.epil
  %104 = load i64, ptr %103, align 8, !tbaa !22
  %105 = getelementptr inbounds double, ptr %58, i64 %104
  store double %102, ptr %105, align 8, !tbaa !28
  %106 = add nuw nsw i64 %.03845.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter55
  br i1 %epil.iter.cmp.not, label %.loopexit, label %.epil.preheader, !llvm.loop !37

.loopexit:                                        ; preds = %scalar.ph.prol.loopexit, %scalar.ph, %.loopexit.loopexit.unr-lcssa, %.epil.preheader, %middle.block, %.preheader42, %.preheader
  %107 = load ptr, ptr %27, align 8, !tbaa !23
  %108 = getelementptr inbounds i8, ptr %107, i64 16
  %109 = load i64, ptr %108, align 8, !tbaa !24
  %.not41 = icmp eq i64 %109, 0
  br i1 %.not41, label %112, label %110

110:                                              ; preds = %.loopexit
  %111 = tail call i64 @scale_data(ptr noundef nonnull %0) #2
  %.pre = load ptr, ptr %27, align 8, !tbaa !23
  br label %112

112:                                              ; preds = %110, %.loopexit
  %113 = phi ptr [ %.pre, %110 ], [ %107, %.loopexit ]
  %114 = getelementptr inbounds i8, ptr %0, i64 8
  %115 = load ptr, ptr %114, align 8, !tbaa !38
  %116 = getelementptr inbounds i8, ptr %115, i64 24
  %117 = load ptr, ptr %116, align 8, !tbaa !39
  %118 = load ptr, ptr %0, align 8, !tbaa !16
  %119 = getelementptr inbounds i8, ptr %118, i64 16
  %120 = load ptr, ptr %119, align 8, !tbaa !41
  %121 = getelementptr inbounds i8, ptr %118, i64 24
  %122 = load ptr, ptr %121, align 8, !tbaa !17
  %123 = tail call i64 %117(ptr noundef %115, ptr noundef %120, ptr noundef %122, ptr noundef %113) #2
  %124 = getelementptr inbounds i8, ptr %0, i64 208
  %125 = load ptr, ptr %124, align 8, !tbaa !11
  tail call void @reset_info(ptr noundef %125) #2
  %126 = load ptr, ptr %14, align 8, !tbaa !15
  %127 = tail call double @osqp_toc(ptr noundef %126) #2
  %128 = load ptr, ptr %124, align 8, !tbaa !11
  %129 = getelementptr inbounds i8, ptr %128, i64 96
  %130 = load double, ptr %129, align 8, !tbaa !12
  %131 = fadd double %127, %130
  store double %131, ptr %129, align 8, !tbaa !12
  br label %132

132:                                              ; preds = %13, %112
  %.0 = phi i64 [ %123, %112 ], [ 1, %13 ]
  ret i64 %.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 232}
!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 = !{!6, !7, i64 208}
!12 = !{!13, !14, i64 96}
!13 = !{!"", !10, i64 0, !8, i64 8, !10, i64 40, !10, i64 48, !14, i64 56, !14, i64 64, !14, i64 72, !14, i64 80, !14, i64 88, !14, i64 96, !14, i64 104, !14, i64 112, !10, i64 120, !14, i64 128}
!14 = !{!"double", !8, i64 0}
!15 = !{!6, !7, i64 216}
!16 = !{!6, !7, i64 0}
!17 = !{!18, !7, i64 24}
!18 = !{!"", !10, i64 0, !10, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48}
!19 = !{!20, !7, i64 24}
!20 = !{!"", !10, i64 0, !10, i64 8, !10, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !10, i64 48}
!21 = !{!20, !10, i64 16}
!22 = !{!10, !10, i64 0}
!23 = !{!6, !7, i64 184}
!24 = !{!25, !10, i64 16}
!25 = !{!"", !14, i64 0, !14, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !14, i64 40, !14, i64 48, !10, i64 56, !14, i64 64, !14, i64 72, !14, i64 80, !14, i64 88, !14, i64 96, !26, i64 104, !14, i64 112, !10, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !14, i64 168}
!26 = !{!"int", !8, i64 0}
!27 = !{!20, !7, i64 40}
!28 = !{!14, !14, i64 0}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.unroll.disable"}
!31 = distinct !{!31, !32, !33, !34}
!32 = !{!"llvm.loop.mustprogress"}
!33 = !{!"llvm.loop.isvectorized", i32 1}
!34 = !{!"llvm.loop.unroll.runtime.disable"}
!35 = distinct !{!35, !32}
!36 = distinct !{!36, !32, !33}
!37 = distinct !{!37, !30}
!38 = !{!6, !7, i64 8}
!39 = !{!40, !7, i64 24}
!40 = !{!"linsys_solver", !26, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !10, i64 40}
!41 = !{!18, !7, i64 16}


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