; LLVM IR from kulho/STM32PendulumMPC :: STM32F407/qpOASES/src (qpOASES_wrapper)

; 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.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, double, i32, double, i32, double, double, double, double, i32, i32, i32, i32, i32, i32 }

; Function Attrs: mustprogress nounwind uwtable
define dso_local i32 @qpOASES_Options_init(ptr noundef %0, i32 noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  %6 = load i32, ptr %5, align 4, !tbaa !9
  %7 = icmp slt i32 %6, 0
  br i1 %7, label %11, label %8

8:                                                ; preds = %2
  %9 = load i32, ptr %5, align 4, !tbaa !9
  %10 = icmp sgt i32 %9, 2
  br i1 %10, label %11, label %12

11:                                               ; preds = %8, %2
  store i32 -1, ptr %3, align 4
  br label %115

12:                                               ; preds = %8
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = icmp eq ptr %13, null
  br i1 %14, label %15, label %16

15:                                               ; preds = %12
  store i32 -1, ptr %3, align 4
  br label %115

16:                                               ; preds = %12
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.qpOASES_Options, ptr %17, i32 0, i32 0
  store i32 2, ptr %18, align 8, !tbaa !11
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.qpOASES_Options, ptr %19, i32 0, i32 1
  store i32 1, ptr %20, align 4, !tbaa !14
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.qpOASES_Options, ptr %21, i32 0, i32 2
  store i32 1, ptr %22, align 8, !tbaa !15
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.qpOASES_Options, ptr %23, i32 0, i32 3
  store i32 1, ptr %24, align 4, !tbaa !16
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.qpOASES_Options, ptr %25, i32 0, i32 4
  store i32 0, ptr %26, align 8, !tbaa !17
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.qpOASES_Options, ptr %27, i32 0, i32 5
  store i32 0, ptr %28, align 4, !tbaa !18
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.qpOASES_Options, ptr %29, i32 0, i32 6
  store i32 1, ptr %30, align 8, !tbaa !19
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.qpOASES_Options, ptr %31, i32 0, i32 7
  store i32 1, ptr %32, align 4, !tbaa !20
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.qpOASES_Options, ptr %33, i32 0, i32 8
  store i32 0, ptr %34, align 8, !tbaa !21
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.qpOASES_Options, ptr %35, i32 0, i32 9
  store i32 0, ptr %36, align 4, !tbaa !22
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.qpOASES_Options, ptr %37, i32 0, i32 10
  store double 1.110500e-09, ptr %38, align 8, !tbaa !23
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.qpOASES_Options, ptr %39, i32 0, i32 11
  store double 2.221000e-10, ptr %40, align 8, !tbaa !24
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.qpOASES_Options, ptr %41, i32 0, i32 12
  store double 1.000000e+04, ptr %42, align 8, !tbaa !25
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.qpOASES_Options, ptr %43, i32 0, i32 13
  store double -2.221000e-13, ptr %44, align 8, !tbaa !26
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.qpOASES_Options, ptr %45, i32 0, i32 14
  store double 2.221000e-13, ptr %46, align 8, !tbaa !27
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.qpOASES_Options, ptr %47, i32 0, i32 15
  store double 1.000000e+08, ptr %48, align 8, !tbaa !28
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.qpOASES_Options, ptr %49, i32 0, i32 16
  store double 1.000000e+08, ptr %50, align 8, !tbaa !29
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.qpOASES_Options, ptr %51, i32 0, i32 17
  store double 5.000000e-01, ptr %52, align 8, !tbaa !30
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.qpOASES_Options, ptr %53, i32 0, i32 18
  store double 1.000000e+00, ptr %54, align 8, !tbaa !31
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.qpOASES_Options, ptr %55, i32 0, i32 19
  store double 1.000000e+06, ptr %56, align 8, !tbaa !32
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.qpOASES_Options, ptr %57, i32 0, i32 20
  store double 1.000000e+03, ptr %58, align 8, !tbaa !33
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.qpOASES_Options, ptr %59, i32 0, i32 21
  store i32 -1, ptr %60, align 8, !tbaa !34
  %61 = load ptr, ptr %4, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.qpOASES_Options, ptr %61, i32 0, i32 22
  store double 2.221000e-13, ptr %62, align 8, !tbaa !35
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.qpOASES_Options, ptr %63, i32 0, i32 23
  store i32 0, ptr %64, align 8, !tbaa !36
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.qpOASES_Options, ptr %65, i32 0, i32 24
  store double 2.221000e-13, ptr %66, align 8, !tbaa !37
  %67 = load ptr, ptr %4, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.qpOASES_Options, ptr %67, i32 0, i32 25
  store i32 1, ptr %68, align 8, !tbaa !38
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.qpOASES_Options, ptr %69, i32 0, i32 26
  store double 2.221000e-14, ptr %70, align 8, !tbaa !39
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.qpOASES_Options, ptr %71, i32 0, i32 27
  store double 2.221000e-11, ptr %72, align 8, !tbaa !40
  %73 = load ptr, ptr %4, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.qpOASES_Options, ptr %73, i32 0, i32 28
  store double 6.663000e-13, ptr %74, align 8, !tbaa !41
  %75 = load ptr, ptr %4, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.qpOASES_Options, ptr %75, i32 0, i32 31
  store i32 0, ptr %76, align 4, !tbaa !42
  %77 = load ptr, ptr %4, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.qpOASES_Options, ptr %77, i32 0, i32 32
  store i32 1, ptr %78, align 8, !tbaa !43
  %79 = load ptr, ptr %4, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.qpOASES_Options, ptr %79, i32 0, i32 33
  store i32 1, ptr %80, align 4, !tbaa !44
  %81 = load ptr, ptr %4, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.qpOASES_Options, ptr %81, i32 0, i32 34
  store i32 1, ptr %82, align 8, !tbaa !45
  %83 = load i32, ptr %5, align 4, !tbaa !9
  switch i32 %83, label %114 [
    i32 0, label %114
    i32 1, label %84
    i32 2, label %91
  ]

84:                                               ; preds = %16
  %85 = load ptr, ptr %4, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.qpOASES_Options, ptr %85, i32 0, i32 5
  store i32 1, ptr %86, align 4, !tbaa !18
  %87 = load ptr, ptr %4, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.qpOASES_Options, ptr %87, i32 0, i32 8
  store i32 1, ptr %88, align 8, !tbaa !21
  %89 = load ptr, ptr %4, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.qpOASES_Options, ptr %89, i32 0, i32 25
  store i32 2, ptr %90, align 8, !tbaa !38
  br label %91

91:                                               ; preds = %84, %16
  %92 = load ptr, ptr %4, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.qpOASES_Options, ptr %92, i32 0, i32 1
  store i32 0, ptr %93, align 4, !tbaa !14
  %94 = load ptr, ptr %4, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.qpOASES_Options, ptr %94, i32 0, i32 2
  store i32 1, ptr %95, align 8, !tbaa !15
  %96 = load ptr, ptr %4, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.qpOASES_Options, ptr %96, i32 0, i32 3
  store i32 0, ptr %97, align 4, !tbaa !16
  %98 = load ptr, ptr %4, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.qpOASES_Options, ptr %98, i32 0, i32 4
  store i32 1, ptr %99, align 8, !tbaa !17
  %100 = load ptr, ptr %4, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.qpOASES_Options, ptr %100, i32 0, i32 6
  store i32 0, ptr %101, align 8, !tbaa !19
  %102 = load ptr, ptr %4, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.qpOASES_Options, ptr %102, i32 0, i32 7
  store i32 0, ptr %103, align 4, !tbaa !20
  %104 = load ptr, ptr %4, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.qpOASES_Options, ptr %104, i32 0, i32 9
  store i32 1, ptr %105, align 4, !tbaa !22
  %106 = load ptr, ptr %4, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.qpOASES_Options, ptr %106, i32 0, i32 10
  store double 2.221000e-07, ptr %107, align 8, !tbaa !23
  %108 = load ptr, ptr %4, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.qpOASES_Options, ptr %108, i32 0, i32 21
  store i32 0, ptr %109, align 8, !tbaa !34
  %110 = load ptr, ptr %4, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.qpOASES_Options, ptr %110, i32 0, i32 23
  store i32 1, ptr %111, align 8, !tbaa !36
  %112 = load ptr, ptr %4, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.qpOASES_Options, ptr %112, i32 0, i32 25
  store i32 0, ptr %113, align 8, !tbaa !38
  br label %114

114:                                              ; preds = %91, %16, %16
  store i32 0, ptr %3, align 4
  br label %115

115:                                              ; preds = %114, %15, %11
  %116 = load i32, ptr %3, align 4
  ret i32 %116
}

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

!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, !10, i64 0}
!12 = !{!"_ZTS15qpOASES_Options", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !13, i64 40, !13, i64 48, !13, i64 56, !13, i64 64, !13, i64 72, !13, i64 80, !13, i64 88, !13, i64 96, !13, i64 104, !13, i64 112, !13, i64 120, !10, i64 128, !13, i64 136, !10, i64 144, !13, i64 152, !10, i64 160, !13, i64 168, !13, i64 176, !13, i64 184, !13, i64 192, !10, i64 200, !10, i64 204, !10, i64 208, !10, i64 212, !10, i64 216, !10, i64 220}
!13 = !{!"double", !7, i64 0}
!14 = !{!12, !10, i64 4}
!15 = !{!12, !10, i64 8}
!16 = !{!12, !10, i64 12}
!17 = !{!12, !10, i64 16}
!18 = !{!12, !10, i64 20}
!19 = !{!12, !10, i64 24}
!20 = !{!12, !10, i64 28}
!21 = !{!12, !10, i64 32}
!22 = !{!12, !10, i64 36}
!23 = !{!12, !13, i64 40}
!24 = !{!12, !13, i64 48}
!25 = !{!12, !13, i64 56}
!26 = !{!12, !13, i64 64}
!27 = !{!12, !13, i64 72}
!28 = !{!12, !13, i64 80}
!29 = !{!12, !13, i64 88}
!30 = !{!12, !13, i64 96}
!31 = !{!12, !13, i64 104}
!32 = !{!12, !13, i64 112}
!33 = !{!12, !13, i64 120}
!34 = !{!12, !10, i64 128}
!35 = !{!12, !13, i64 136}
!36 = !{!12, !10, i64 144}
!37 = !{!12, !13, i64 152}
!38 = !{!12, !10, i64 160}
!39 = !{!12, !13, i64 168}
!40 = !{!12, !13, i64 176}
!41 = !{!12, !13, i64 184}
!42 = !{!12, !10, i64 204}
!43 = !{!12, !10, i64 208}
!44 = !{!12, !10, i64 212}
!45 = !{!12, !10, i64 216}


; 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: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable
define dso_local range(i32 -1, 1) i32 @qpOASES_Options_init(ptr noundef writeonly %0, i32 noundef %1) local_unnamed_addr #0 {
  %or.cond = icmp ugt i32 %1, 2
  %3 = icmp eq ptr %0, null
  %or.cond54 = or i1 %3, %or.cond
  br i1 %or.cond54, label %28, label %4

4:                                                ; preds = %2
  %5 = getelementptr inbounds i8, ptr %0, i64 4
  store <4 x i32> <i32 2, i32 1, i32 1, i32 1>, ptr %0, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 16
  %7 = getelementptr inbounds i8, ptr %0, i64 24
  %8 = getelementptr inbounds i8, ptr %0, i64 28
  store <4 x i32> <i32 0, i32 0, i32 1, i32 1>, ptr %6, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 0, ptr %9, align 8, !tbaa !9
  %10 = getelementptr inbounds i8, ptr %0, i64 36
  store i32 0, ptr %10, align 4, !tbaa !12
  %11 = getelementptr inbounds i8, ptr %0, i64 40
  store <2 x double> <double 1.110500e-09, double 2.221000e-10>, ptr %11, align 8, !tbaa !13
  %12 = getelementptr inbounds i8, ptr %0, i64 56
  store <2 x double> <double 1.000000e+04, double -2.221000e-13>, ptr %12, align 8, !tbaa !13
  %13 = getelementptr inbounds i8, ptr %0, i64 72
  store <2 x double> <double 2.221000e-13, double 1.000000e+08>, ptr %13, align 8, !tbaa !13
  %14 = getelementptr inbounds i8, ptr %0, i64 88
  store <2 x double> <double 1.000000e+08, double 5.000000e-01>, ptr %14, align 8, !tbaa !13
  %15 = getelementptr inbounds i8, ptr %0, i64 104
  store <2 x double> <double 1.000000e+00, double 1.000000e+06>, ptr %15, align 8, !tbaa !13
  %16 = getelementptr inbounds i8, ptr %0, i64 120
  store double 1.000000e+03, ptr %16, align 8, !tbaa !14
  %17 = getelementptr inbounds i8, ptr %0, i64 128
  store i32 -1, ptr %17, align 8, !tbaa !15
  %18 = getelementptr inbounds i8, ptr %0, i64 136
  store double 2.221000e-13, ptr %18, align 8, !tbaa !16
  %19 = getelementptr inbounds i8, ptr %0, i64 144
  store i32 0, ptr %19, align 8, !tbaa !17
  %20 = getelementptr inbounds i8, ptr %0, i64 152
  store double 2.221000e-13, ptr %20, align 8, !tbaa !18
  %21 = getelementptr inbounds i8, ptr %0, i64 160
  store i32 1, ptr %21, align 8, !tbaa !19
  %22 = getelementptr inbounds i8, ptr %0, i64 168
  store <2 x double> <double 2.221000e-14, double 2.221000e-11>, ptr %22, align 8, !tbaa !13
  %23 = getelementptr inbounds i8, ptr %0, i64 184
  store double 6.663000e-13, ptr %23, align 8, !tbaa !20
  %24 = getelementptr inbounds i8, ptr %0, i64 204
  store <4 x i32> <i32 0, i32 1, i32 1, i32 1>, ptr %24, align 4, !tbaa !5
  switch i32 %1, label %28 [
    i32 2, label %27
    i32 1, label %25
  ]

25:                                               ; preds = %4
  %26 = getelementptr inbounds i8, ptr %0, i64 20
  store i32 1, ptr %26, align 4, !tbaa !21
  store i32 1, ptr %9, align 8, !tbaa !9
  br label %27

27:                                               ; preds = %4, %25
  store <4 x i32> <i32 0, i32 1, i32 0, i32 1>, ptr %5, align 4, !tbaa !5
  store i32 0, ptr %7, align 8, !tbaa !22
  store i32 0, ptr %8, align 4, !tbaa !23
  store i32 1, ptr %10, align 4, !tbaa !12
  store double 2.221000e-07, ptr %11, align 8, !tbaa !24
  store i32 0, ptr %17, align 8, !tbaa !15
  store i32 1, ptr %19, align 8, !tbaa !17
  store i32 0, ptr %21, align 8, !tbaa !19
  br label %28

28:                                               ; preds = %4, %27, %2
  %.0 = phi i32 [ -1, %2 ], [ 0, %27 ], [ 0, %4 ]
  ret i32 %.0
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) 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, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 32}
!10 = !{!"_ZTS15qpOASES_Options", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !6, i64 24, !6, i64 28, !6, i64 32, !6, i64 36, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64, !11, i64 72, !11, i64 80, !11, i64 88, !11, i64 96, !11, i64 104, !11, i64 112, !11, i64 120, !6, i64 128, !11, i64 136, !6, i64 144, !11, i64 152, !6, i64 160, !11, i64 168, !11, i64 176, !11, i64 184, !11, i64 192, !6, i64 200, !6, i64 204, !6, i64 208, !6, i64 212, !6, i64 216, !6, i64 220}
!11 = !{!"double", !7, i64 0}
!12 = !{!10, !6, i64 36}
!13 = !{!11, !11, i64 0}
!14 = !{!10, !11, i64 120}
!15 = !{!10, !6, i64 128}
!16 = !{!10, !11, i64 136}
!17 = !{!10, !6, i64 144}
!18 = !{!10, !11, i64 152}
!19 = !{!10, !6, i64 160}
!20 = !{!10, !11, i64 184}
!21 = !{!10, !6, i64 20}
!22 = !{!10, !6, i64 24}
!23 = !{!10, !6, i64 28}
!24 = !{!10, !11, i64 40}


; Effective O3 passes: DSEPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass