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

; 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::Flipper" = type { i32, i32, %"class.qpOASES::Bounds", %"class.qpOASES::Constraints", ptr, ptr, ptr }
%"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::Constraints" = type { %"class.qpOASES::SubjectTo", %"class.qpOASES::Indexlist", %"class.qpOASES::Indexlist" }

declare noundef nonnull align 8 dereferenceable(120) ptr @_ZN7qpOASES6BoundsaSERKS0_(ptr noundef nonnull align 8 dereferenceable(120), ptr noundef nonnull align 8 dereferenceable(120)) #0

declare noundef nonnull align 8 dereferenceable(120) ptr @_ZN7qpOASES11ConstraintsaSERKS0_(ptr noundef nonnull align 8 dereferenceable(120), ptr noundef nonnull align 8 dereferenceable(120)) #0

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN7qpOASES7Flipper3setEPKNS_6BoundsEPKdPKNS_11ConstraintsES5_S5_(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) #3 align 2 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  store ptr %5, ptr %12, align 8, !tbaa !5
  %13 = load ptr, ptr %7, align 8
  %14 = load ptr, ptr %8, align 8, !tbaa !5
  %15 = icmp ne ptr %14, null
  br i1 %15, label %16, label %20

16:                                               ; preds = %6
  %17 = load ptr, ptr %8, align 8, !tbaa !5
  %18 = getelementptr inbounds %"class.qpOASES::Flipper", ptr %13, i32 0, i32 2
  %19 = call noundef nonnull align 8 dereferenceable(120) ptr @_ZN7qpOASES6BoundsaSERKS0_(ptr noundef nonnull align 8 dereferenceable(120) %18, ptr noundef nonnull align 8 dereferenceable(120) %17)
  br label %20

20:                                               ; preds = %16, %6
  %21 = load ptr, ptr %10, align 8, !tbaa !5
  %22 = icmp ne ptr %21, null
  br i1 %22, label %23, label %27

23:                                               ; preds = %20
  %24 = load ptr, ptr %10, align 8, !tbaa !5
  %25 = getelementptr inbounds %"class.qpOASES::Flipper", ptr %13, i32 0, i32 3
  %26 = call noundef nonnull align 8 dereferenceable(120) ptr @_ZN7qpOASES11ConstraintsaSERKS0_(ptr noundef nonnull align 8 dereferenceable(120) %25, ptr noundef nonnull align 8 dereferenceable(120) %24)
  br label %27

27:                                               ; preds = %23, %20
  %28 = load ptr, ptr %9, align 8, !tbaa !5
  %29 = icmp ne ptr %28, null
  br i1 %29, label %30, label %58

30:                                               ; preds = %27
  %31 = getelementptr inbounds %"class.qpOASES::Flipper", ptr %13, i32 0, i32 4
  %32 = load ptr, ptr %31, align 8, !tbaa !9
  %33 = icmp eq ptr %32, null
  br i1 %33, label %34, label %47

34:                                               ; preds = %30
  %35 = getelementptr inbounds %"class.qpOASES::Flipper", ptr %13, i32 0, i32 0
  %36 = load i32, ptr %35, align 8, !tbaa !17
  %37 = getelementptr inbounds %"class.qpOASES::Flipper", ptr %13, i32 0, i32 0
  %38 = load i32, ptr %37, align 8, !tbaa !17
  %39 = mul i32 %36, %38
  %40 = zext i32 %39 to i64
  %41 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %40, i64 8)
  %42 = extractvalue { i64, i1 } %41, 1
  %43 = extractvalue { i64, i1 } %41, 0
  %44 = select i1 %42, i64 -1, i64 %43
  %45 = call noalias noundef nonnull ptr @_Znam(i64 noundef %44) #6
  %46 = getelementptr inbounds %"class.qpOASES::Flipper", ptr %13, i32 0, i32 4
  store ptr %45, ptr %46, align 8, !tbaa !9
  br label %47

47:                                               ; preds = %34, %30
  %48 = getelementptr inbounds %"class.qpOASES::Flipper", ptr %13, i32 0, i32 4
  %49 = load ptr, ptr %48, align 8, !tbaa !9
  %50 = load ptr, ptr %9, align 8, !tbaa !5
  %51 = getelementptr inbounds %"class.qpOASES::Flipper", ptr %13, i32 0, i32 0
  %52 = load i32, ptr %51, align 8, !tbaa !17
  %53 = getelementptr inbounds %"class.qpOASES::Flipper", ptr %13, i32 0, i32 0
  %54 = load i32, ptr %53, align 8, !tbaa !17
  %55 = mul i32 %52, %54
  %56 = zext i32 %55 to i64
  %57 = mul i64 %56, 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %49, ptr align 8 %50, i64 %57, i1 false)
  br label %58

58:                                               ; preds = %47, %27
  %59 = load ptr, ptr %11, align 8, !tbaa !5
  %60 = icmp ne ptr %59, null
  br i1 %60, label %61, label %89

61:                                               ; preds = %58
  %62 = getelementptr inbounds %"class.qpOASES::Flipper", ptr %13, i32 0, i32 5
  %63 = load ptr, ptr %62, align 8, !tbaa !18
  %64 = icmp eq ptr %63, null
  br i1 %64, label %65, label %78

65:                                               ; preds = %61
  %66 = getelementptr inbounds %"class.qpOASES::Flipper", ptr %13, i32 0, i32 0
  %67 = load i32, ptr %66, align 8, !tbaa !17
  %68 = getelementptr inbounds %"class.qpOASES::Flipper", ptr %13, i32 0, i32 0
  %69 = load i32, ptr %68, align 8, !tbaa !17
  %70 = mul i32 %67, %69
  %71 = zext i32 %70 to i64
  %72 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %71, i64 8)
  %73 = extractvalue { i64, i1 } %72, 1
  %74 = extractvalue { i64, i1 } %72, 0
  %75 = select i1 %73, i64 -1, i64 %74
  %76 = call noalias noundef nonnull ptr @_Znam(i64 noundef %75) #6
  %77 = getelementptr inbounds %"class.qpOASES::Flipper", ptr %13, i32 0, i32 5
  store ptr %76, ptr %77, align 8, !tbaa !18
  br label %78

78:                                               ; preds = %65, %61
  %79 = getelementptr inbounds %"class.qpOASES::Flipper", ptr %13, i32 0, i32 5
  %80 = load ptr, ptr %79, align 8, !tbaa !18
  %81 = load ptr, ptr %11, align 8, !tbaa !5
  %82 = getelementptr inbounds %"class.qpOASES::Flipper", ptr %13, i32 0, i32 0
  %83 = load i32, ptr %82, align 8, !tbaa !17
  %84 = getelementptr inbounds %"class.qpOASES::Flipper", ptr %13, i32 0, i32 0
  %85 = load i32, ptr %84, align 8, !tbaa !17
  %86 = mul i32 %83, %85
  %87 = zext i32 %86 to i64
  %88 = mul i64 %87, 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %80, ptr align 8 %81, i64 %88, i1 false)
  br label %89

89:                                               ; preds = %78, %58
  %90 = load ptr, ptr %12, align 8, !tbaa !5
  %91 = icmp ne ptr %90, null
  br i1 %91, label %92, label %112

92:                                               ; preds = %89
  %93 = getelementptr inbounds %"class.qpOASES::Flipper", ptr %13, i32 0, i32 6
  %94 = load ptr, ptr %93, align 8, !tbaa !19
  %95 = icmp eq ptr %94, null
  br i1 %95, label %96, label %105

96:                                               ; preds = %92
  %97 = call noundef i32 @_ZNK7qpOASES7Flipper7getDimTEv(ptr noundef nonnull align 8 dereferenceable(272) %13)
  %98 = zext i32 %97 to i64
  %99 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %98, i64 8)
  %100 = extractvalue { i64, i1 } %99, 1
  %101 = extractvalue { i64, i1 } %99, 0
  %102 = select i1 %100, i64 -1, i64 %101
  %103 = call noalias noundef nonnull ptr @_Znam(i64 noundef %102) #6
  %104 = getelementptr inbounds %"class.qpOASES::Flipper", ptr %13, i32 0, i32 6
  store ptr %103, ptr %104, align 8, !tbaa !19
  br label %105

105:                                              ; preds = %96, %92
  %106 = getelementptr inbounds %"class.qpOASES::Flipper", ptr %13, i32 0, i32 6
  %107 = load ptr, ptr %106, align 8, !tbaa !19
  %108 = load ptr, ptr %12, align 8, !tbaa !5
  %109 = call noundef i32 @_ZNK7qpOASES7Flipper7getDimTEv(ptr noundef nonnull align 8 dereferenceable(272) %13)
  %110 = zext i32 %109 to i64
  %111 = mul i64 %110, 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %107, ptr align 8 %108, i64 %111, i1 false)
  br label %112

112:                                              ; preds = %105, %89
  ret i32 0
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64) #4

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) #5

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 nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nobuiltin allocsize(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 #6 = { builtin allocsize(0) }

!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, !6, i64 248}
!10 = !{!"_ZTSN7qpOASES7FlipperE", !11, i64 0, !11, i64 4, !12, i64 8, !16, i64 128, !6, i64 248, !6, i64 256, !6, i64 264}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_ZTSN7qpOASES6BoundsE", !13, i64 0, !15, i64 40, !15, i64 80}
!13 = !{!"_ZTSN7qpOASES9SubjectToE", !11, i64 8, !6, i64 16, !6, i64 24, !14, i64 32, !14, i64 36}
!14 = !{!"_ZTSN7qpOASES11BooleanTypeE", !7, i64 0}
!15 = !{!"_ZTSN7qpOASES9IndexlistE", !6, i64 0, !6, i64 8, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32}
!16 = !{!"_ZTSN7qpOASES11ConstraintsE", !13, i64 0, !15, i64 40, !15, i64 80}
!17 = !{!10, !11, i64 0}
!18 = !{!10, !6, i64 256}
!19 = !{!10, !6, i64 264}


; 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 noundef nonnull align 8 dereferenceable(120) ptr @_ZN7qpOASES6BoundsaSERKS0_(ptr noundef nonnull align 8 dereferenceable(120), ptr noundef nonnull align 8 dereferenceable(120)) local_unnamed_addr #0

declare noundef nonnull align 8 dereferenceable(120) ptr @_ZN7qpOASES11ConstraintsaSERKS0_(ptr noundef nonnull align 8 dereferenceable(120), ptr noundef nonnull align 8 dereferenceable(120)) local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK7qpOASES7Flipper7getDimTEv(ptr noundef nonnull align 8 dereferenceable(272)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN7qpOASES7Flipper3setEPKNS_6BoundsEPKdPKNS_11ConstraintsES5_S5_(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %1, ptr noundef readonly %2, ptr noundef %3, ptr noundef readonly %4, ptr noundef readonly %5) local_unnamed_addr #3 align 2 {
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %10, label %7

7:                                                ; preds = %6
  %8 = getelementptr inbounds i8, ptr %0, i64 8
  %9 = tail call noundef nonnull align 8 dereferenceable(120) ptr @_ZN7qpOASES6BoundsaSERKS0_(ptr noundef nonnull align 8 dereferenceable(120) %8, ptr noundef nonnull align 8 dereferenceable(120) %1)
  br label %10

10:                                               ; preds = %7, %6
  %.not15 = icmp eq ptr %3, null
  br i1 %.not15, label %14, label %11

11:                                               ; preds = %10
  %12 = getelementptr inbounds i8, ptr %0, i64 128
  %13 = tail call noundef nonnull align 8 dereferenceable(120) ptr @_ZN7qpOASES11ConstraintsaSERKS0_(ptr noundef nonnull align 8 dereferenceable(120) %12, ptr noundef nonnull align 8 dereferenceable(120) %3)
  br label %14

14:                                               ; preds = %11, %10
  %.not16 = icmp eq ptr %2, null
  br i1 %.not16, label %25, label %15

15:                                               ; preds = %14
  %16 = getelementptr inbounds i8, ptr %0, i64 248
  %17 = load ptr, ptr %16, align 8, !tbaa !5
  %18 = icmp eq ptr %17, null
  %.pre = load i32, ptr %0, align 8, !tbaa !16
  %19 = mul i32 %.pre, %.pre
  %20 = zext i32 %19 to i64
  %21 = shl nuw nsw i64 %20, 3
  br i1 %18, label %22, label %._crit_edge

22:                                               ; preds = %15
  %23 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %21) #5
  store ptr %23, ptr %16, align 8, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %15, %22
  %24 = phi ptr [ %23, %22 ], [ %17, %15 ]
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 8 %24, ptr nonnull align 8 %2, i64 %21, i1 false)
  br label %25

25:                                               ; preds = %._crit_edge, %14
  %.not17 = icmp eq ptr %4, null
  br i1 %.not17, label %36, label %26

26:                                               ; preds = %25
  %27 = getelementptr inbounds i8, ptr %0, i64 256
  %28 = load ptr, ptr %27, align 8, !tbaa !17
  %29 = icmp eq ptr %28, null
  %.pre19 = load i32, ptr %0, align 8, !tbaa !16
  %30 = mul i32 %.pre19, %.pre19
  %31 = zext i32 %30 to i64
  %32 = shl nuw nsw i64 %31, 3
  br i1 %29, label %33, label %._crit_edge20

33:                                               ; preds = %26
  %34 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %32) #5
  store ptr %34, ptr %27, align 8, !tbaa !17
  br label %._crit_edge20

._crit_edge20:                                    ; preds = %26, %33
  %35 = phi ptr [ %34, %33 ], [ %28, %26 ]
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 8 %35, ptr nonnull align 8 %4, i64 %32, i1 false)
  br label %36

36:                                               ; preds = %._crit_edge20, %25
  %.not18 = icmp eq ptr %5, null
  br i1 %.not18, label %51, label %37

37:                                               ; preds = %36
  %38 = getelementptr inbounds i8, ptr %0, i64 264
  %39 = load ptr, ptr %38, align 8, !tbaa !18
  %40 = icmp eq ptr %39, null
  br i1 %40, label %41, label %46

41:                                               ; preds = %37
  %42 = tail call noundef i32 @_ZNK7qpOASES7Flipper7getDimTEv(ptr noundef nonnull align 8 dereferenceable(272) %0)
  %43 = zext i32 %42 to i64
  %44 = shl nuw nsw i64 %43, 3
  %45 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %44) #5
  store ptr %45, ptr %38, align 8, !tbaa !18
  br label %46

46:                                               ; preds = %41, %37
  %47 = phi ptr [ %45, %41 ], [ %39, %37 ]
  %48 = tail call noundef i32 @_ZNK7qpOASES7Flipper7getDimTEv(ptr noundef nonnull align 8 dereferenceable(272) %0)
  %49 = zext i32 %48 to i64
  %50 = shl nuw nsw i64 %49, 3
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 8 %47, ptr nonnull align 8 %5, i64 %50, i1 false)
  br label %51

51:                                               ; preds = %46, %36
  ret i32 0
}

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) local_unnamed_addr #4

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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { nobuiltin allocsize(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 #5 = { builtin allocsize(0) }

!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, !12, i64 248}
!6 = !{!"_ZTSN7qpOASES7FlipperE", !7, i64 0, !7, i64 4, !10, i64 8, !15, i64 128, !12, i64 248, !12, i64 256, !12, i64 264}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN7qpOASES6BoundsE", !11, i64 0, !14, i64 40, !14, i64 80}
!11 = !{!"_ZTSN7qpOASES9SubjectToE", !7, i64 8, !12, i64 16, !12, i64 24, !13, i64 32, !13, i64 36}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!"_ZTSN7qpOASES11BooleanTypeE", !8, i64 0}
!14 = !{!"_ZTSN7qpOASES9IndexlistE", !12, i64 0, !12, i64 8, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !7, i64 32}
!15 = !{!"_ZTSN7qpOASES11ConstraintsE", !11, i64 0, !14, i64 40, !14, i64 80}
!16 = !{!6, !7, i64 0}
!17 = !{!6, !12, i64 256}
!18 = !{!6, !12, i64 264}


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass