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

; 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.pardiso = type { i32, ptr, ptr, ptr, ptr, i64, ptr, ptr, ptr, ptr, [64 x ptr], [64 x i64], i64, i64, i64, i64, i64, i64, i64, i64, i64, double, ptr, i64, ptr, ptr, ptr }
%struct.csc = type { i64, i64, i64, ptr, ptr, ptr, i64 }

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

5:                                                ; preds = %1
  %6 = load ptr, ptr %2, align 8, !tbaa !5
  %7 = getelementptr inbounds %struct.pardiso, ptr %6, i32 0, i32 17
  store i64 -1, ptr %7, align 8, !tbaa !9
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.pardiso, ptr %8, i32 0, i32 10
  %10 = getelementptr inbounds [64 x ptr], ptr %9, i64 0, i64 0
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.pardiso, ptr %11, i32 0, i32 15
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.pardiso, ptr %13, i32 0, i32 16
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.pardiso, ptr %15, i32 0, i32 13
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.pardiso, ptr %17, i32 0, i32 17
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.pardiso, ptr %19, i32 0, i32 12
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.pardiso, ptr %21, i32 0, i32 21
  %23 = load ptr, ptr %2, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.pardiso, ptr %23, i32 0, i32 6
  %25 = load ptr, ptr %24, align 8, !tbaa !14
  %26 = getelementptr inbounds %struct.csc, ptr %25, i32 0, i32 3
  %27 = load ptr, ptr %26, align 8, !tbaa !15
  %28 = load ptr, ptr %2, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.pardiso, ptr %28, i32 0, i32 6
  %30 = load ptr, ptr %29, align 8, !tbaa !14
  %31 = getelementptr inbounds %struct.csc, ptr %30, i32 0, i32 4
  %32 = load ptr, ptr %31, align 8, !tbaa !17
  %33 = load ptr, ptr %2, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.pardiso, ptr %33, i32 0, i32 20
  %35 = load ptr, ptr %2, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.pardiso, ptr %35, i32 0, i32 14
  %37 = load ptr, ptr %2, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.pardiso, ptr %37, i32 0, i32 11
  %39 = getelementptr inbounds [64 x i64], ptr %38, i64 0, i64 0
  %40 = load ptr, ptr %2, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.pardiso, ptr %40, i32 0, i32 19
  %42 = load ptr, ptr %2, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.pardiso, ptr %42, i32 0, i32 21
  %44 = load ptr, ptr %2, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.pardiso, ptr %44, i32 0, i32 21
  %46 = load ptr, ptr %2, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.pardiso, ptr %46, i32 0, i32 18
  call void @pardiso(ptr noundef %10, ptr noundef %12, ptr noundef %14, ptr noundef %16, ptr noundef %18, ptr noundef %20, ptr noundef %22, ptr noundef %27, ptr noundef %32, ptr noundef %34, ptr noundef %36, ptr noundef %39, ptr noundef %41, ptr noundef %43, ptr noundef %45, ptr noundef %47)
  %48 = load ptr, ptr %2, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.pardiso, ptr %48, i32 0, i32 6
  %50 = load ptr, ptr %49, align 8, !tbaa !14
  %51 = icmp ne ptr %50, null
  br i1 %51, label %52, label %56

52:                                               ; preds = %5
  %53 = load ptr, ptr %2, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.pardiso, ptr %53, i32 0, i32 6
  %55 = load ptr, ptr %54, align 8, !tbaa !14
  call void @csc_spfree(ptr noundef %55)
  br label %56

56:                                               ; preds = %52, %5
  %57 = load ptr, ptr %2, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.pardiso, ptr %57, i32 0, i32 7
  %59 = load ptr, ptr %58, align 8, !tbaa !18
  %60 = icmp ne ptr %59, null
  br i1 %60, label %61, label %65

61:                                               ; preds = %56
  %62 = load ptr, ptr %2, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.pardiso, ptr %62, i32 0, i32 7
  %64 = load ptr, ptr %63, align 8, !tbaa !18
  call void @free(ptr noundef %64) #3
  br label %65

65:                                               ; preds = %61, %56
  %66 = load ptr, ptr %2, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.pardiso, ptr %66, i32 0, i32 8
  %68 = load ptr, ptr %67, align 8, !tbaa !19
  %69 = icmp ne ptr %68, null
  br i1 %69, label %70, label %74

70:                                               ; preds = %65
  %71 = load ptr, ptr %2, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.pardiso, ptr %71, i32 0, i32 8
  %73 = load ptr, ptr %72, align 8, !tbaa !19
  call void @free(ptr noundef %73) #3
  br label %74

74:                                               ; preds = %70, %65
  %75 = load ptr, ptr %2, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.pardiso, ptr %75, i32 0, i32 9
  %77 = load ptr, ptr %76, align 8, !tbaa !20
  %78 = icmp ne ptr %77, null
  br i1 %78, label %79, label %83

79:                                               ; preds = %74
  %80 = load ptr, ptr %2, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.pardiso, ptr %80, i32 0, i32 9
  %82 = load ptr, ptr %81, align 8, !tbaa !20
  call void @free(ptr noundef %82) #3
  br label %83

83:                                               ; preds = %79, %74
  %84 = load ptr, ptr %2, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.pardiso, ptr %84, i32 0, i32 22
  %86 = load ptr, ptr %85, align 8, !tbaa !21
  %87 = icmp ne ptr %86, null
  br i1 %87, label %88, label %92

88:                                               ; preds = %83
  %89 = load ptr, ptr %2, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.pardiso, ptr %89, i32 0, i32 22
  %91 = load ptr, ptr %90, align 8, !tbaa !21
  call void @free(ptr noundef %91) #3
  br label %92

92:                                               ; preds = %88, %83
  %93 = load ptr, ptr %2, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.pardiso, ptr %93, i32 0, i32 24
  %95 = load ptr, ptr %94, align 8, !tbaa !22
  %96 = icmp ne ptr %95, null
  br i1 %96, label %97, label %101

97:                                               ; preds = %92
  %98 = load ptr, ptr %2, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.pardiso, ptr %98, i32 0, i32 24
  %100 = load ptr, ptr %99, align 8, !tbaa !22
  call void @free(ptr noundef %100) #3
  br label %101

101:                                              ; preds = %97, %92
  %102 = load ptr, ptr %2, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.pardiso, ptr %102, i32 0, i32 25
  %104 = load ptr, ptr %103, align 8, !tbaa !23
  %105 = icmp ne ptr %104, null
  br i1 %105, label %106, label %110

106:                                              ; preds = %101
  %107 = load ptr, ptr %2, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.pardiso, ptr %107, i32 0, i32 25
  %109 = load ptr, ptr %108, align 8, !tbaa !23
  call void @free(ptr noundef %109) #3
  br label %110

110:                                              ; preds = %106, %101
  %111 = load ptr, ptr %2, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.pardiso, ptr %111, i32 0, i32 26
  %113 = load ptr, ptr %112, align 8, !tbaa !24
  %114 = icmp ne ptr %113, null
  br i1 %114, label %115, label %119

115:                                              ; preds = %110
  %116 = load ptr, ptr %2, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.pardiso, ptr %116, i32 0, i32 26
  %118 = load ptr, ptr %117, align 8, !tbaa !24
  call void @free(ptr noundef %118) #3
  br label %119

119:                                              ; preds = %115, %110
  %120 = load ptr, ptr %2, align 8, !tbaa !5
  call void @free(ptr noundef %120) #3
  br label %121

121:                                              ; preds = %119, %1
  ret void
}

declare void @pardiso(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #1

declare void @csc_spfree(ptr noundef) #1

; Function Attrs: nounwind
declare void @free(ptr noundef) #2

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 "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, !12, i64 1144}
!10 = !{!"pardiso", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !12, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !7, i64 80, !7, i64 592, !12, i64 1104, !12, i64 1112, !12, i64 1120, !12, i64 1128, !12, i64 1136, !12, i64 1144, !12, i64 1152, !12, i64 1160, !12, i64 1168, !13, i64 1176, !6, i64 1184, !12, i64 1192, !6, i64 1200, !6, i64 1208, !6, i64 1216}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = !{!"double", !7, i64 0}
!14 = !{!10, !6, i64 48}
!15 = !{!16, !6, i64 24}
!16 = !{!"", !12, i64 0, !12, i64 8, !12, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !12, i64 48}
!17 = !{!16, !6, i64 32}
!18 = !{!10, !6, i64 56}
!19 = !{!10, !6, i64 64}
!20 = !{!10, !6, i64 72}
!21 = !{!10, !6, i64 1184}
!22 = !{!10, !6, i64 1200}
!23 = !{!10, !6, i64 1208}
!24 = !{!10, !6, i64 1216}


; 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: nounwind uwtable
define dso_local void @free_linsys_solver_pardiso(ptr noundef %0) local_unnamed_addr #0 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %52, label %2

2:                                                ; preds = %1
  %3 = getelementptr inbounds i8, ptr %0, i64 1144
  store i64 -1, ptr %3, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 80
  %5 = getelementptr inbounds i8, ptr %0, i64 1128
  %6 = getelementptr inbounds i8, ptr %0, i64 1136
  %7 = getelementptr inbounds i8, ptr %0, i64 1112
  %8 = getelementptr inbounds i8, ptr %0, i64 1104
  %9 = getelementptr inbounds i8, ptr %0, i64 1176
  %10 = getelementptr inbounds i8, ptr %0, i64 48
  %11 = load ptr, ptr %10, align 8, !tbaa !13
  %12 = getelementptr inbounds i8, ptr %11, i64 24
  %13 = load ptr, ptr %12, align 8, !tbaa !14
  %14 = getelementptr inbounds i8, ptr %11, i64 32
  %15 = load ptr, ptr %14, align 8, !tbaa !16
  %16 = getelementptr inbounds i8, ptr %0, i64 1168
  %17 = getelementptr inbounds i8, ptr %0, i64 1120
  %18 = getelementptr inbounds i8, ptr %0, i64 592
  %19 = getelementptr inbounds i8, ptr %0, i64 1160
  %20 = getelementptr inbounds i8, ptr %0, i64 1152
  tail call void @pardiso(ptr noundef nonnull %4, ptr noundef nonnull %5, ptr noundef nonnull %6, ptr noundef nonnull %7, ptr noundef nonnull %3, ptr noundef nonnull %8, ptr noundef nonnull %9, ptr noundef %13, ptr noundef %15, ptr noundef nonnull %16, ptr noundef nonnull %17, ptr noundef nonnull %18, ptr noundef nonnull %19, ptr noundef nonnull %9, ptr noundef nonnull %9, ptr noundef nonnull %20) #3
  %21 = load ptr, ptr %10, align 8, !tbaa !13
  %.not43 = icmp eq ptr %21, null
  br i1 %.not43, label %23, label %22

22:                                               ; preds = %2
  tail call void @csc_spfree(ptr noundef nonnull %21) #3
  br label %23

23:                                               ; preds = %22, %2
  %24 = getelementptr inbounds i8, ptr %0, i64 56
  %25 = load ptr, ptr %24, align 8, !tbaa !17
  %.not44 = icmp eq ptr %25, null
  br i1 %.not44, label %27, label %26

26:                                               ; preds = %23
  tail call void @free(ptr noundef nonnull %25) #3
  br label %27

27:                                               ; preds = %26, %23
  %28 = getelementptr inbounds i8, ptr %0, i64 64
  %29 = load ptr, ptr %28, align 8, !tbaa !18
  %.not45 = icmp eq ptr %29, null
  br i1 %.not45, label %31, label %30

30:                                               ; preds = %27
  tail call void @free(ptr noundef nonnull %29) #3
  br label %31

31:                                               ; preds = %30, %27
  %32 = getelementptr inbounds i8, ptr %0, i64 72
  %33 = load ptr, ptr %32, align 8, !tbaa !19
  %.not46 = icmp eq ptr %33, null
  br i1 %.not46, label %35, label %34

34:                                               ; preds = %31
  tail call void @free(ptr noundef nonnull %33) #3
  br label %35

35:                                               ; preds = %34, %31
  %36 = getelementptr inbounds i8, ptr %0, i64 1184
  %37 = load ptr, ptr %36, align 8, !tbaa !20
  %.not47 = icmp eq ptr %37, null
  br i1 %.not47, label %39, label %38

38:                                               ; preds = %35
  tail call void @free(ptr noundef nonnull %37) #3
  br label %39

39:                                               ; preds = %38, %35
  %40 = getelementptr inbounds i8, ptr %0, i64 1200
  %41 = load ptr, ptr %40, align 8, !tbaa !21
  %.not48 = icmp eq ptr %41, null
  br i1 %.not48, label %43, label %42

42:                                               ; preds = %39
  tail call void @free(ptr noundef nonnull %41) #3
  br label %43

43:                                               ; preds = %42, %39
  %44 = getelementptr inbounds i8, ptr %0, i64 1208
  %45 = load ptr, ptr %44, align 8, !tbaa !22
  %.not49 = icmp eq ptr %45, null
  br i1 %.not49, label %47, label %46

46:                                               ; preds = %43
  tail call void @free(ptr noundef nonnull %45) #3
  br label %47

47:                                               ; preds = %46, %43
  %48 = getelementptr inbounds i8, ptr %0, i64 1216
  %49 = load ptr, ptr %48, align 8, !tbaa !23
  %.not50 = icmp eq ptr %49, null
  br i1 %.not50, label %51, label %50

50:                                               ; preds = %47
  tail call void @free(ptr noundef nonnull %49) #3
  br label %51

51:                                               ; preds = %50, %47
  tail call void @free(ptr noundef nonnull %0) #3
  br label %52

52:                                               ; preds = %51, %1
  ret void
}

declare void @pardiso(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @csc_spfree(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #2

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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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, !11, i64 1144}
!6 = !{!"pardiso", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !11, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !8, i64 80, !8, i64 592, !11, i64 1104, !11, i64 1112, !11, i64 1120, !11, i64 1128, !11, i64 1136, !11, i64 1144, !11, i64 1152, !11, i64 1160, !11, i64 1168, !12, i64 1176, !10, i64 1184, !11, i64 1192, !10, i64 1200, !10, i64 1208, !10, i64 1216}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"long long", !8, i64 0}
!12 = !{!"double", !8, i64 0}
!13 = !{!6, !10, i64 48}
!14 = !{!15, !10, i64 24}
!15 = !{!"", !11, i64 0, !11, i64 8, !11, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !11, i64 48}
!16 = !{!15, !10, i64 32}
!17 = !{!6, !10, i64 56}
!18 = !{!6, !10, i64 64}
!19 = !{!6, !10, i64 72}
!20 = !{!6, !10, i64 1184}
!21 = !{!6, !10, i64 1200}
!22 = !{!6, !10, i64 1208}
!23 = !{!6, !10, i64 1216}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,TailCallElimPass