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

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

@func_pardiso = external hidden global ptr, align 8
@__FUNCTION__.pardiso = external hidden unnamed_addr constant [8 x i8], align 1
@func_mkl_set_interface_layer = external hidden global ptr, align 8
@func_mkl_get_max_threads = external hidden global ptr, align 8
@Pardiso_handle = external hidden global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i64 @lh_load_pardiso(ptr noundef %0) #0 {
  %2 = alloca i64, align 8
  %3 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = icmp ne ptr %4, null
  br i1 %5, label %6, label %9

6:                                                ; preds = %1
  %7 = load ptr, ptr %3, align 8, !tbaa !5
  %8 = call ptr @lh_load_lib(ptr noundef %7)
  store ptr %8, ptr @Pardiso_handle, align 8, !tbaa !5
  br label %11

9:                                                ; preds = %1
  %10 = call ptr @lh_load_lib(ptr noundef @.str.3)
  store ptr %10, ptr @Pardiso_handle, align 8, !tbaa !5
  br label %11

11:                                               ; preds = %9, %6
  %12 = load ptr, ptr @Pardiso_handle, align 8, !tbaa !5
  %13 = icmp ne ptr %12, null
  br i1 %13, label %15, label %14

14:                                               ; preds = %11
  store i64 1, ptr %2, align 8
  br label %34

15:                                               ; preds = %11
  %16 = load ptr, ptr @Pardiso_handle, align 8, !tbaa !5
  %17 = call ptr @lh_load_sym(ptr noundef %16, ptr noundef @__FUNCTION__.pardiso)
  store ptr %17, ptr @func_pardiso, align 8, !tbaa !5
  %18 = load ptr, ptr @func_pardiso, align 8, !tbaa !5
  %19 = icmp ne ptr %18, null
  br i1 %19, label %21, label %20

20:                                               ; preds = %15
  store i64 1, ptr %2, align 8
  br label %34

21:                                               ; preds = %15
  %22 = load ptr, ptr @Pardiso_handle, align 8, !tbaa !5
  %23 = call ptr @lh_load_sym(ptr noundef %22, ptr noundef @.str.4)
  store ptr %23, ptr @func_mkl_set_interface_layer, align 8, !tbaa !5
  %24 = load ptr, ptr @func_mkl_set_interface_layer, align 8, !tbaa !5
  %25 = icmp ne ptr %24, null
  br i1 %25, label %27, label %26

26:                                               ; preds = %21
  store i64 1, ptr %2, align 8
  br label %34

27:                                               ; preds = %21
  %28 = load ptr, ptr @Pardiso_handle, align 8, !tbaa !5
  %29 = call ptr @lh_load_sym(ptr noundef %28, ptr noundef @.str.5)
  store ptr %29, ptr @func_mkl_get_max_threads, align 8, !tbaa !5
  %30 = load ptr, ptr @func_mkl_get_max_threads, align 8, !tbaa !5
  %31 = icmp ne ptr %30, null
  br i1 %31, label %33, label %32

32:                                               ; preds = %27
  store i64 1, ptr %2, align 8
  br label %34

33:                                               ; preds = %27
  store i64 0, ptr %2, align 8
  br label %34

34:                                               ; preds = %33, %32, %26, %20, %14
  %35 = load i64, ptr %2, align 8
  ret i64 %35
}

declare ptr @lh_load_lib(ptr noundef) #1

declare ptr @lh_load_sym(ptr noundef, ptr noundef) #1

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

!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"}


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

@func_pardiso = external hidden local_unnamed_addr global ptr, align 8
@__FUNCTION__.pardiso = external hidden unnamed_addr constant [8 x i8], align 1
@func_mkl_set_interface_layer = external hidden local_unnamed_addr global ptr, align 8
@func_mkl_get_max_threads = external hidden local_unnamed_addr global ptr, align 8
@Pardiso_handle = external hidden local_unnamed_addr global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i64 0, 2) i64 @lh_load_pardiso(ptr noundef %0) local_unnamed_addr #0 {
  %.not = icmp eq ptr %0, null
  %.str.3. = select i1 %.not, ptr @.str.3, ptr %0
  %2 = tail call ptr @lh_load_lib(ptr noundef nonnull %.str.3.) #2
  store ptr %2, ptr @Pardiso_handle, align 8, !tbaa !5
  %.not4 = icmp eq ptr %2, null
  br i1 %.not4, label %11, label %3

3:                                                ; preds = %1
  %4 = tail call ptr @lh_load_sym(ptr noundef nonnull %2, ptr noundef nonnull @__FUNCTION__.pardiso) #2
  store ptr %4, ptr @func_pardiso, align 8, !tbaa !5
  %.not5 = icmp eq ptr %4, null
  br i1 %.not5, label %11, label %5

5:                                                ; preds = %3
  %6 = load ptr, ptr @Pardiso_handle, align 8, !tbaa !5
  %7 = tail call ptr @lh_load_sym(ptr noundef %6, ptr noundef nonnull @.str.4) #2
  store ptr %7, ptr @func_mkl_set_interface_layer, align 8, !tbaa !5
  %.not6 = icmp eq ptr %7, null
  br i1 %.not6, label %11, label %8

8:                                                ; preds = %5
  %9 = load ptr, ptr @Pardiso_handle, align 8, !tbaa !5
  %10 = tail call ptr @lh_load_sym(ptr noundef %9, ptr noundef nonnull @.str.5) #2
  store ptr %10, ptr @func_mkl_get_max_threads, align 8, !tbaa !5
  %.not7 = icmp eq ptr %10, null
  %. = zext i1 %.not7 to i64
  br label %11

11:                                               ; preds = %8, %5, %3, %1
  %.0 = phi i64 [ 1, %1 ], [ 1, %3 ], [ 1, %5 ], [ %., %8 ]
  ret i64 %.0
}

declare ptr @lh_load_lib(ptr noundef) local_unnamed_addr #1

declare ptr @lh_load_sym(ptr noundef, ptr noundef) local_unnamed_addr #1

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

!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"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass