; LLVM IR from cvxgrp/scs :: linsys/mkl/direct (private)

; 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.SCS_LIN_SYS_WORK = type { ptr, ptr, i32, i32, [64 x ptr], [64 x i32], i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr }
%struct.ScsMatrix = type { ptr, ptr, ptr, i32, i32 }

@.str.1 = external hidden unnamed_addr constant [37 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @scs_free_lin_sys_work(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 %88

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

44:                                               ; preds = %5
  %45 = load ptr, ptr %2, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.SCS_LIN_SYS_WORK, ptr %45, i32 0, i32 12
  %47 = load i32, ptr %46, align 8, !tbaa !16
  %48 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %47)
  br label %49

49:                                               ; preds = %44, %5
  %50 = load ptr, ptr %2, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.SCS_LIN_SYS_WORK, ptr %50, i32 0, i32 0
  %52 = load ptr, ptr %51, align 8, !tbaa !12
  %53 = icmp ne ptr %52, null
  br i1 %53, label %54, label %59

54:                                               ; preds = %49
  %55 = load ptr, ptr %2, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.SCS_LIN_SYS_WORK, ptr %55, i32 0, i32 0
  %57 = load ptr, ptr %56, align 8, !tbaa !12
  %58 = call ptr @_scs_cs_spfree(ptr noundef %57)
  br label %59

59:                                               ; preds = %54, %49
  %60 = load ptr, ptr %2, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.SCS_LIN_SYS_WORK, ptr %60, i32 0, i32 1
  %62 = load ptr, ptr %61, align 8, !tbaa !17
  %63 = icmp ne ptr %62, null
  br i1 %63, label %64, label %68

64:                                               ; preds = %59
  %65 = load ptr, ptr %2, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.SCS_LIN_SYS_WORK, ptr %65, i32 0, i32 1
  %67 = load ptr, ptr %66, align 8, !tbaa !17
  call void @free(ptr noundef %67) #3
  br label %68

68:                                               ; preds = %64, %59
  %69 = load ptr, ptr %2, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.SCS_LIN_SYS_WORK, ptr %69, i32 0, i32 14
  %71 = load ptr, ptr %70, align 8, !tbaa !18
  %72 = icmp ne ptr %71, null
  br i1 %72, label %73, label %77

73:                                               ; preds = %68
  %74 = load ptr, ptr %2, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.SCS_LIN_SYS_WORK, ptr %74, i32 0, i32 14
  %76 = load ptr, ptr %75, align 8, !tbaa !18
  call void @free(ptr noundef %76) #3
  br label %77

77:                                               ; preds = %73, %68
  %78 = load ptr, ptr %2, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.SCS_LIN_SYS_WORK, ptr %78, i32 0, i32 15
  %80 = load ptr, ptr %79, align 8, !tbaa !19
  %81 = icmp ne ptr %80, null
  br i1 %81, label %82, label %86

82:                                               ; preds = %77
  %83 = load ptr, ptr %2, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.SCS_LIN_SYS_WORK, ptr %83, i32 0, i32 15
  %85 = load ptr, ptr %84, align 8, !tbaa !19
  call void @free(ptr noundef %85) #3
  br label %86

86:                                               ; preds = %82, %77
  %87 = load ptr, ptr %2, align 8, !tbaa !5
  call void @free(ptr noundef %87) #3
  br label %88

88:                                               ; preds = %86, %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 i32 @printf(ptr noundef, ...) #1

declare ptr @_scs_cs_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, !11, i64 812}
!10 = !{!"SCS_LIN_SYS_WORK", !6, i64 0, !6, i64 8, !11, i64 16, !11, i64 20, !7, i64 24, !7, i64 536, !11, i64 792, !11, i64 796, !11, i64 800, !11, i64 804, !11, i64 808, !11, i64 812, !11, i64 816, !11, i64 820, !6, i64 824, !6, i64 832}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !6, i64 0}
!13 = !{!14, !6, i64 16}
!14 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !11, i64 24, !11, i64 28}
!15 = !{!14, !6, i64 8}
!16 = !{!10, !11, i64 816}
!17 = !{!10, !6, i64 8}
!18 = !{!10, !6, i64 824}
!19 = !{!10, !6, i64 832}


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

@.str.1 = external hidden unnamed_addr constant [37 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @scs_free_lin_sys_work(ptr noundef %0) local_unnamed_addr #0 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %38, label %2

2:                                                ; preds = %1
  %3 = getelementptr inbounds i8, ptr %0, i64 812
  store i32 -1, ptr %3, align 4, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 24
  %5 = getelementptr inbounds i8, ptr %0, i64 804
  %6 = getelementptr inbounds i8, ptr %0, i64 808
  %7 = getelementptr inbounds i8, ptr %0, i64 796
  %8 = getelementptr inbounds i8, ptr %0, i64 792
  %9 = load ptr, ptr %0, align 8, !tbaa !11
  %10 = getelementptr inbounds i8, ptr %9, i64 16
  %11 = load ptr, ptr %10, align 8, !tbaa !12
  %12 = getelementptr inbounds i8, ptr %9, i64 8
  %13 = load ptr, ptr %12, align 8, !tbaa !14
  %14 = getelementptr inbounds i8, ptr %0, i64 800
  %15 = getelementptr inbounds i8, ptr %0, i64 536
  %16 = getelementptr inbounds i8, ptr %0, i64 820
  %17 = getelementptr inbounds i8, ptr %0, i64 816
  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 null, ptr noundef %11, ptr noundef %13, ptr noundef null, ptr noundef nonnull %14, ptr noundef nonnull %15, ptr noundef nonnull %16, ptr noundef null, ptr noundef null, ptr noundef nonnull %17) #4
  %18 = load i32, ptr %17, align 8, !tbaa !15
  %.not30 = icmp eq i32 %18, 0
  br i1 %.not30, label %21, label %19

19:                                               ; preds = %2
  %20 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %18)
  br label %21

21:                                               ; preds = %19, %2
  %22 = load ptr, ptr %0, align 8, !tbaa !11
  %.not31 = icmp eq ptr %22, null
  br i1 %.not31, label %25, label %23

23:                                               ; preds = %21
  %24 = tail call ptr @_scs_cs_spfree(ptr noundef nonnull %22) #4
  br label %25

25:                                               ; preds = %23, %21
  %26 = getelementptr inbounds i8, ptr %0, i64 8
  %27 = load ptr, ptr %26, align 8, !tbaa !16
  %.not32 = icmp eq ptr %27, null
  br i1 %.not32, label %29, label %28

28:                                               ; preds = %25
  tail call void @free(ptr noundef nonnull %27) #4
  br label %29

29:                                               ; preds = %28, %25
  %30 = getelementptr inbounds i8, ptr %0, i64 824
  %31 = load ptr, ptr %30, align 8, !tbaa !17
  %.not33 = icmp eq ptr %31, null
  br i1 %.not33, label %33, label %32

32:                                               ; preds = %29
  tail call void @free(ptr noundef nonnull %31) #4
  br label %33

33:                                               ; preds = %32, %29
  %34 = getelementptr inbounds i8, ptr %0, i64 832
  %35 = load ptr, ptr %34, align 8, !tbaa !18
  %.not34 = icmp eq ptr %35, null
  br i1 %.not34, label %37, label %36

36:                                               ; preds = %33
  tail call void @free(ptr noundef nonnull %35) #4
  br label %37

37:                                               ; preds = %36, %33
  tail call void @free(ptr noundef nonnull %0) #4
  br label %38

38:                                               ; preds = %37, %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

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

declare ptr @_scs_cs_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 #3

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 = { nofree 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 = { 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 #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, !10, i64 812}
!6 = !{!"SCS_LIN_SYS_WORK", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 20, !8, i64 24, !8, i64 536, !10, i64 792, !10, i64 796, !10, i64 800, !10, i64 804, !10, i64 808, !10, i64 812, !10, i64 816, !10, i64 820, !7, i64 824, !7, i64 832}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !7, i64 0}
!12 = !{!13, !7, i64 16}
!13 = !{!"", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24, !10, i64 28}
!14 = !{!13, !7, i64 8}
!15 = !{!6, !10, i64 816}
!16 = !{!6, !7, i64 8}
!17 = !{!6, !7, i64 824}
!18 = !{!6, !7, i64 832}


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