; LLVM IR from Tencent-RoboticsX/jbdl :: src/jbdl/experimental/qpoases/src (QProblemB)

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

%"class.qpOASES::QProblemB" = type { ptr, i32, ptr, ptr, ptr, ptr, %"class.qpOASES::Bounds", ptr, i32, ptr, ptr, double, i32, i32, i32, i32, double, i32, ptr, double, double, i32, [4 x i8], %"class.qpOASES::Options", %"class.qpOASES::Flipper", %"struct.qpOASES::TabularOutput" }
%"class.qpOASES::Bounds" = type { %"class.qpOASES::SubjectTo", %"class.qpOASES::Indexlist", %"class.qpOASES::Indexlist" }
%"class.qpOASES::SubjectTo" = type { ptr, i32, ptr, ptr, i32, i32 }
%"class.qpOASES::Indexlist" = type <{ ptr, ptr, i32, i32, i32, i32, i32, [4 x i8] }>
%"class.qpOASES::Options" = type <{ i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, double, double, double, double, double, double, double, double, double, double, double, i32, [4 x i8], double, i32, [4 x i8], double, i32, [4 x i8], double, double, double, double, i32, i32, i32, i32, i32, [4 x i8] }>
%"class.qpOASES::Flipper" = type { i32, i32, %"class.qpOASES::Bounds", %"class.qpOASES::Constraints", ptr, ptr, ptr }
%"class.qpOASES::Constraints" = type { %"class.qpOASES::SubjectTo", %"class.qpOASES::Indexlist", %"class.qpOASES::Indexlist" }
%"struct.qpOASES::TabularOutput" = type { i32, i32, i32, i32, i32, i32, i32, i32 }

; 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: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK7qpOASES9QProblemB5getNVEv(ptr noundef nonnull align 8 dereferenceable(800)) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK7qpOASES9SubjectTo9getStatusEi(ptr noundef nonnull align 8 dereferenceable(40), i32 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZNK7qpOASES9QProblemB16shallRefactoriseEPKNS_6BoundsE(ptr noundef nonnull align 8 dereferenceable(800) %0, ptr noundef %1) #3 align 2 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %10 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %11 = call noundef i32 @_ZNK7qpOASES9QProblemB5getNVEv(ptr noundef nonnull align 8 dereferenceable(800) %10)
  store i32 %11, ptr %7, align 4, !tbaa !9
  %12 = getelementptr inbounds %"class.qpOASES::QProblemB", ptr %10, i32 0, i32 15
  %13 = load i32, ptr %12, align 4, !tbaa !11
  %14 = icmp eq i32 %13, 4
  br i1 %14, label %19, label %15

15:                                               ; preds = %2
  %16 = getelementptr inbounds %"class.qpOASES::QProblemB", ptr %10, i32 0, i32 15
  %17 = load i32, ptr %16, align 4, !tbaa !11
  %18 = icmp eq i32 %17, 5
  br i1 %18, label %19, label %20

19:                                               ; preds = %15, %2
  store i32 1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %49

20:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !9
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %21

21:                                               ; preds = %37, %20
  %22 = load i32, ptr %6, align 4, !tbaa !9
  %23 = load i32, ptr %7, align 4, !tbaa !9
  %24 = icmp slt i32 %22, %23
  br i1 %24, label %25, label %40

25:                                               ; preds = %21
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = load i32, ptr %6, align 4, !tbaa !9
  %28 = call noundef i32 @_ZNK7qpOASES9SubjectTo9getStatusEi(ptr noundef nonnull align 8 dereferenceable(40) %26, i32 noundef %27)
  %29 = getelementptr inbounds %"class.qpOASES::QProblemB", ptr %10, i32 0, i32 6
  %30 = load i32, ptr %6, align 4, !tbaa !9
  %31 = call noundef i32 @_ZNK7qpOASES9SubjectTo9getStatusEi(ptr noundef nonnull align 8 dereferenceable(40) %29, i32 noundef %30)
  %32 = icmp ne i32 %28, %31
  br i1 %32, label %33, label %36

33:                                               ; preds = %25
  %34 = load i32, ptr %9, align 4, !tbaa !9
  %35 = add nsw i32 %34, 1
  store i32 %35, ptr %9, align 4, !tbaa !9
  br label %36

36:                                               ; preds = %33, %25
  br label %37

37:                                               ; preds = %36
  %38 = load i32, ptr %6, align 4, !tbaa !9
  %39 = add nsw i32 %38, 1
  store i32 %39, ptr %6, align 4, !tbaa !9
  br label %21, !llvm.loop !26

40:                                               ; preds = %21
  %41 = load i32, ptr %9, align 4, !tbaa !9
  %42 = mul nsw i32 2, %41
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = call noundef i32 @_ZNK7qpOASES6Bounds6getNFXEv(ptr noundef nonnull align 8 dereferenceable(120) %43)
  %45 = icmp sgt i32 %42, %44
  br i1 %45, label %46, label %47

46:                                               ; preds = %40
  store i32 1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %48

47:                                               ; preds = %40
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %48

48:                                               ; preds = %47, %46
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %49

49:                                               ; preds = %48, %19
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  %50 = load i32, ptr %3, align 4
  ret i32 %50
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK7qpOASES6Bounds6getNFXEv(ptr noundef nonnull align 8 dereferenceable(120)) #2 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint mustprogress 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 = { inlinehint mustprogress 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 = { mustprogress 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 #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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !19, i64 220}
!12 = !{!"_ZTSN7qpOASES9QProblemBE", !13, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !14, i64 48, !6, i64 168, !13, i64 176, !6, i64 184, !6, i64 192, !17, i64 200, !18, i64 208, !13, i64 212, !13, i64 216, !19, i64 220, !17, i64 224, !10, i64 232, !6, i64 240, !17, i64 248, !17, i64 256, !10, i64 264, !20, i64 272, !23, i64 496, !25, i64 768}
!13 = !{!"_ZTSN7qpOASES11BooleanTypeE", !7, i64 0}
!14 = !{!"_ZTSN7qpOASES6BoundsE", !15, i64 0, !16, i64 40, !16, i64 80}
!15 = !{!"_ZTSN7qpOASES9SubjectToE", !10, i64 8, !6, i64 16, !6, i64 24, !13, i64 32, !13, i64 36}
!16 = !{!"_ZTSN7qpOASES9IndexlistE", !6, i64 0, !6, i64 8, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32}
!17 = !{!"double", !7, i64 0}
!18 = !{!"_ZTSN7qpOASES14QProblemStatusE", !7, i64 0}
!19 = !{!"_ZTSN7qpOASES11HessianTypeE", !7, i64 0}
!20 = !{!"_ZTSN7qpOASES7OptionsE", !21, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !10, i64 28, !10, i64 32, !13, i64 36, !17, i64 40, !17, i64 48, !17, i64 56, !17, i64 64, !17, i64 72, !17, i64 80, !17, i64 88, !17, i64 96, !17, i64 104, !17, i64 112, !17, i64 120, !22, i64 128, !17, i64 136, !10, i64 144, !17, i64 152, !10, i64 160, !17, i64 168, !17, i64 176, !17, i64 184, !17, i64 192, !13, i64 200, !13, i64 204, !10, i64 208, !10, i64 212, !10, i64 216}
!21 = !{!"_ZTSN7qpOASES10PrintLevelE", !7, i64 0}
!22 = !{!"_ZTSN7qpOASES15SubjectToStatusE", !7, i64 0}
!23 = !{!"_ZTSN7qpOASES7FlipperE", !10, i64 0, !10, i64 4, !14, i64 8, !24, i64 128, !6, i64 248, !6, i64 256, !6, i64 264}
!24 = !{!"_ZTSN7qpOASES11ConstraintsE", !15, i64 0, !16, i64 40, !16, i64 80}
!25 = !{!"_ZTSN7qpOASES13TabularOutputE", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}


; 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: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK7qpOASES9QProblemB5getNVEv(ptr noundef nonnull align 8 dereferenceable(800)) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK7qpOASES9SubjectTo9getStatusEi(ptr noundef nonnull align 8 dereferenceable(40), i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 0, 2) i32 @_ZNK7qpOASES9QProblemB16shallRefactoriseEPKNS_6BoundsE(ptr noundef nonnull align 8 dereferenceable(800) %0, ptr noundef %1) local_unnamed_addr #2 align 2 {
  %3 = tail call noundef i32 @_ZNK7qpOASES9QProblemB5getNVEv(ptr noundef nonnull align 8 dereferenceable(800) %0)
  %4 = getelementptr inbounds i8, ptr %0, i64 220
  %5 = load i32, ptr %4, align 4, !tbaa !5
  %6 = and i32 %5, -2
  %switch = icmp eq i32 %6, 4
  br i1 %switch, label %17, label %.preheader

.preheader:                                       ; preds = %2
  %7 = icmp sgt i32 %3, 0
  br i1 %7, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader
  %8 = getelementptr inbounds i8, ptr %0, i64 48
  br label %9

9:                                                ; preds = %.lr.ph, %9
  %.015 = phi i32 [ 0, %.lr.ph ], [ %spec.select, %9 ]
  %.01214 = phi i32 [ 0, %.lr.ph ], [ %13, %9 ]
  %10 = tail call noundef i32 @_ZNK7qpOASES9SubjectTo9getStatusEi(ptr noundef nonnull align 8 dereferenceable(40) %1, i32 noundef %.01214)
  %11 = tail call noundef i32 @_ZNK7qpOASES9SubjectTo9getStatusEi(ptr noundef nonnull align 8 dereferenceable(40) %8, i32 noundef %.01214)
  %.not = icmp ne i32 %10, %11
  %12 = zext i1 %.not to i32
  %spec.select = add nuw nsw i32 %.015, %12
  %13 = add nuw nsw i32 %.01214, 1
  %exitcond.not = icmp eq i32 %13, %3
  br i1 %exitcond.not, label %._crit_edge.loopexit, label %9, !llvm.loop !24

._crit_edge.loopexit:                             ; preds = %9
  %14 = shl nuw nsw i32 %spec.select, 1
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %.0.lcssa = phi i32 [ 0, %.preheader ], [ %14, %._crit_edge.loopexit ]
  %15 = tail call noundef i32 @_ZNK7qpOASES6Bounds6getNFXEv(ptr noundef nonnull align 8 dereferenceable(120) %1)
  %16 = icmp sgt i32 %.0.lcssa, %15
  %. = zext i1 %16 to i32
  br label %17

17:                                               ; preds = %2, %._crit_edge
  %.111 = phi i32 [ %., %._crit_edge ], [ 1, %2 ]
  ret i32 %.111
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK7qpOASES6Bounds6getNFXEv(ptr noundef nonnull align 8 dereferenceable(120)) local_unnamed_addr #1 align 2

attributes #0 = { inlinehint mustprogress 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 = { inlinehint mustprogress 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 = { mustprogress 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, !17, i64 220}
!6 = !{!"_ZTSN7qpOASES9QProblemBE", !7, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !11, i64 48, !10, i64 168, !7, i64 176, !10, i64 184, !10, i64 192, !15, i64 200, !16, i64 208, !7, i64 212, !7, i64 216, !17, i64 220, !15, i64 224, !13, i64 232, !10, i64 240, !15, i64 248, !15, i64 256, !13, i64 264, !18, i64 272, !21, i64 496, !23, i64 768}
!7 = !{!"_ZTSN7qpOASES11BooleanTypeE", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"_ZTSN7qpOASES6BoundsE", !12, i64 0, !14, i64 40, !14, i64 80}
!12 = !{!"_ZTSN7qpOASES9SubjectToE", !13, i64 8, !10, i64 16, !10, i64 24, !7, i64 32, !7, i64 36}
!13 = !{!"int", !8, i64 0}
!14 = !{!"_ZTSN7qpOASES9IndexlistE", !10, i64 0, !10, i64 8, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !13, i64 32}
!15 = !{!"double", !8, i64 0}
!16 = !{!"_ZTSN7qpOASES14QProblemStatusE", !8, i64 0}
!17 = !{!"_ZTSN7qpOASES11HessianTypeE", !8, i64 0}
!18 = !{!"_ZTSN7qpOASES7OptionsE", !19, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !13, i64 28, !13, i64 32, !7, i64 36, !15, i64 40, !15, i64 48, !15, i64 56, !15, i64 64, !15, i64 72, !15, i64 80, !15, i64 88, !15, i64 96, !15, i64 104, !15, i64 112, !15, i64 120, !20, i64 128, !15, i64 136, !13, i64 144, !15, i64 152, !13, i64 160, !15, i64 168, !15, i64 176, !15, i64 184, !15, i64 192, !7, i64 200, !7, i64 204, !13, i64 208, !13, i64 212, !13, i64 216}
!19 = !{!"_ZTSN7qpOASES10PrintLevelE", !8, i64 0}
!20 = !{!"_ZTSN7qpOASES15SubjectToStatusE", !8, i64 0}
!21 = !{!"_ZTSN7qpOASES7FlipperE", !13, i64 0, !13, i64 4, !11, i64 8, !22, i64 128, !10, i64 248, !10, i64 256, !10, i64 264}
!22 = !{!"_ZTSN7qpOASES11ConstraintsE", !12, i64 0, !14, i64 40, !14, i64 80}
!23 = !{!"_ZTSN7qpOASES13TabularOutputE", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}


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