; LLVM IR from softmin/ReHLine-SVM :: liblinear/linear.ll (ZN15Solver_MCSVM_CSC2EPK7problemiPddi)

; 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.problem = type { i32, i32, ptr, ptr, double }
%class.Solver_MCSVM_CS = type { ptr, ptr, ptr, i32, i32, i32, i32, double, ptr }

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN15Solver_MCSVM_CSC2EPK7problemiPddi(ptr noundef nonnull align 8 dereferenceable(56) %0, ptr noundef %1, i32 noundef %2, ptr noundef %3, double noundef %4, i32 noundef %5) unnamed_addr #2 align 2 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca double, align 8
  %12 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store i32 %2, ptr %9, align 4, !tbaa !9
  store ptr %3, ptr %10, align 8, !tbaa !5
  store double %4, ptr %11, align 8, !tbaa !11
  store i32 %5, ptr %12, align 4, !tbaa !9
  %13 = load ptr, ptr %7, align 8
  %14 = load ptr, ptr %8, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.problem, ptr %14, i32 0, i32 1
  %16 = load i32, ptr %15, align 4, !tbaa !13
  %17 = getelementptr inbounds %class.Solver_MCSVM_CS, ptr %13, i32 0, i32 3
  store i32 %16, ptr %17, align 8, !tbaa !15
  %18 = load ptr, ptr %8, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.problem, ptr %18, i32 0, i32 0
  %20 = load i32, ptr %19, align 8, !tbaa !17
  %21 = getelementptr inbounds %class.Solver_MCSVM_CS, ptr %13, i32 0, i32 4
  store i32 %20, ptr %21, align 4, !tbaa !18
  %22 = load i32, ptr %9, align 4, !tbaa !9
  %23 = getelementptr inbounds %class.Solver_MCSVM_CS, ptr %13, i32 0, i32 5
  store i32 %22, ptr %23, align 8, !tbaa !19
  %24 = load double, ptr %11, align 8, !tbaa !11
  %25 = getelementptr inbounds %class.Solver_MCSVM_CS, ptr %13, i32 0, i32 7
  store double %24, ptr %25, align 8, !tbaa !20
  %26 = load i32, ptr %12, align 4, !tbaa !9
  %27 = getelementptr inbounds %class.Solver_MCSVM_CS, ptr %13, i32 0, i32 6
  store i32 %26, ptr %27, align 4, !tbaa !21
  %28 = load ptr, ptr %8, align 8, !tbaa !5
  %29 = getelementptr inbounds %class.Solver_MCSVM_CS, ptr %13, i32 0, i32 8
  store ptr %28, ptr %29, align 8, !tbaa !22
  %30 = load i32, ptr %9, align 4, !tbaa !9
  %31 = sext i32 %30 to i64
  %32 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %31, i64 8)
  %33 = extractvalue { i64, i1 } %32, 1
  %34 = extractvalue { i64, i1 } %32, 0
  %35 = select i1 %33, i64 -1, i64 %34
  %36 = call noalias noundef nonnull ptr @_Znam(i64 noundef %35) #3
  %37 = getelementptr inbounds %class.Solver_MCSVM_CS, ptr %13, i32 0, i32 0
  store ptr %36, ptr %37, align 8, !tbaa !23
  %38 = load i32, ptr %9, align 4, !tbaa !9
  %39 = sext i32 %38 to i64
  %40 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %39, i64 8)
  %41 = extractvalue { i64, i1 } %40, 1
  %42 = extractvalue { i64, i1 } %40, 0
  %43 = select i1 %41, i64 -1, i64 %42
  %44 = call noalias noundef nonnull ptr @_Znam(i64 noundef %43) #3
  %45 = getelementptr inbounds %class.Solver_MCSVM_CS, ptr %13, i32 0, i32 2
  store ptr %44, ptr %45, align 8, !tbaa !24
  %46 = load ptr, ptr %10, align 8, !tbaa !5
  %47 = getelementptr inbounds %class.Solver_MCSVM_CS, ptr %13, i32 0, i32 1
  store ptr %46, ptr %47, align 8, !tbaa !25
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { 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 #2 = { 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 #3 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !10, i64 4}
!14 = !{!"_ZTS7problem", !10, i64 0, !10, i64 4, !6, i64 8, !6, i64 16, !12, i64 24}
!15 = !{!16, !10, i64 24}
!16 = !{!"_ZTS15Solver_MCSVM_CS", !6, i64 0, !6, i64 8, !6, i64 16, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !12, i64 40, !6, i64 48}
!17 = !{!14, !10, i64 0}
!18 = !{!16, !10, i64 28}
!19 = !{!16, !10, i64 32}
!20 = !{!16, !12, i64 40}
!21 = !{!16, !10, i64 36}
!22 = !{!16, !6, i64 48}
!23 = !{!16, !6, i64 0}
!24 = !{!16, !6, i64 16}
!25 = !{!16, !6, i64 8}


; 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: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN15Solver_MCSVM_CSC2EPK7problemiPddi(ptr nocapture noundef nonnull writeonly align 8 dereferenceable(56) %0, ptr noundef %1, i32 noundef %2, ptr noundef %3, double noundef %4, i32 noundef %5) unnamed_addr #1 align 2 {
  %7 = getelementptr inbounds i8, ptr %0, i64 24
  %8 = load <2 x i32>, ptr %1, align 8, !tbaa !5
  %9 = shufflevector <2 x i32> %8, <2 x i32> poison, <2 x i32> <i32 1, i32 0>
  store <2 x i32> %9, ptr %7, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 %2, ptr %10, align 8, !tbaa !9
  %11 = getelementptr inbounds i8, ptr %0, i64 40
  store double %4, ptr %11, align 8, !tbaa !13
  %12 = getelementptr inbounds i8, ptr %0, i64 36
  store i32 %5, ptr %12, align 4, !tbaa !14
  %13 = getelementptr inbounds i8, ptr %0, i64 48
  store ptr %1, ptr %13, align 8, !tbaa !15
  %14 = zext nneg i32 %2 to i64
  %15 = icmp slt i32 %2, 0
  %16 = shl nuw nsw i64 %14, 3
  %17 = select i1 %15, i64 -1, i64 %16
  %18 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %17) #2
  store ptr %18, ptr %0, align 8, !tbaa !16
  %19 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %17) #2
  %20 = getelementptr inbounds i8, ptr %0, i64 16
  store ptr %19, ptr %20, align 8, !tbaa !17
  %21 = getelementptr inbounds i8, ptr %0, i64 8
  store ptr %3, ptr %21, align 8, !tbaa !18
  ret void
}

attributes #0 = { 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 #1 = { 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 #2 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 32}
!10 = !{!"_ZTS15Solver_MCSVM_CS", !11, i64 0, !11, i64 8, !11, i64 16, !6, i64 24, !6, i64 28, !6, i64 32, !6, i64 36, !12, i64 40, !11, i64 48}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!10, !12, i64 40}
!14 = !{!10, !6, i64 36}
!15 = !{!10, !11, i64 48}
!16 = !{!10, !11, i64 0}
!17 = !{!10, !11, i64 16}
!18 = !{!10, !11, i64 8}


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