; LLVM IR from ERGO-Code/HiGHS :: src/lp_data/HighsOptions.ll (Z17resetLocalOptionsRSt6vectorIP12OptionRecordSaIS1_EE)

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

%class.OptionRecord = type <{ ptr, i32, [4 x i8], %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", i8, [7 x i8] }>
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%class.OptionRecordBool = type <{ %class.OptionRecord.base, [7 x i8], ptr, i8, [7 x i8] }>
%class.OptionRecord.base = type <{ ptr, i32, [4 x i8], %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", i8 }>
%class.OptionRecordInt = type <{ %class.OptionRecord.base, [7 x i8], ptr, i32, i32, i32, [4 x i8] }>
%class.OptionRecordDouble = type { %class.OptionRecord.base, ptr, double, double, double }
%class.OptionRecordString = type { %class.OptionRecord.base, ptr, %"class.std::__cxx11::basic_string" }

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP12OptionRecordSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIP12OptionRecordSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSERKS4_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z17resetLocalOptionsRSt6vectorIP12OptionRecordSaIS1_EE(ptr noundef nonnull align 8 dereferenceable(24) %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  %10 = load ptr, ptr %2, align 8, !tbaa !5
  %11 = call noundef i64 @_ZNKSt6vectorIP12OptionRecordSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #3
  %12 = trunc i64 %11 to i32
  store i32 %12, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %13

13:                                               ; preds = %91, %1
  %14 = load i32, ptr %4, align 4, !tbaa !9
  %15 = load i32, ptr %3, align 4, !tbaa !9
  %16 = icmp slt i32 %14, %15
  br i1 %16, label %18, label %17

17:                                               ; preds = %13
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  br label %94

18:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  %20 = load i32, ptr %4, align 4, !tbaa !9
  %21 = sext i32 %20 to i64
  %22 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP12OptionRecordSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %19, i64 noundef %21) #3
  %23 = load ptr, ptr %22, align 8, !tbaa !5
  %24 = getelementptr inbounds %class.OptionRecord, ptr %23, i32 0, i32 1
  %25 = load i32, ptr %24, align 8, !tbaa !11
  store i32 %25, ptr %5, align 4, !tbaa !18
  %26 = load i32, ptr %5, align 4, !tbaa !18
  %27 = icmp eq i32 %26, 0
  br i1 %27, label %28, label %43

28:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %29 = load ptr, ptr %2, align 8, !tbaa !5
  %30 = load i32, ptr %4, align 4, !tbaa !9
  %31 = sext i32 %30 to i64
  %32 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP12OptionRecordSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %29, i64 noundef %31) #3
  %33 = load ptr, ptr %32, align 8, !tbaa !5
  %34 = getelementptr inbounds %class.OptionRecordBool, ptr %33, i64 0
  store ptr %34, ptr %6, align 8, !tbaa !5
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = getelementptr inbounds %class.OptionRecordBool, ptr %35, i32 0, i32 3
  %37 = load i8, ptr %36, align 8, !tbaa !19, !range !21, !noundef !22
  %38 = trunc i8 %37 to i1
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = getelementptr inbounds %class.OptionRecordBool, ptr %39, i32 0, i32 2
  %41 = load ptr, ptr %40, align 8, !tbaa !23
  %42 = zext i1 %38 to i8
  store i8 %42, ptr %41, align 1, !tbaa !24
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  br label %90

43:                                               ; preds = %18
  %44 = load i32, ptr %5, align 4, !tbaa !18
  %45 = icmp eq i32 %44, 1
  br i1 %45, label %46, label %59

46:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %47 = load ptr, ptr %2, align 8, !tbaa !5
  %48 = load i32, ptr %4, align 4, !tbaa !9
  %49 = sext i32 %48 to i64
  %50 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP12OptionRecordSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %47, i64 noundef %49) #3
  %51 = load ptr, ptr %50, align 8, !tbaa !5
  %52 = getelementptr inbounds %class.OptionRecordInt, ptr %51, i64 0
  store ptr %52, ptr %7, align 8, !tbaa !5
  %53 = load ptr, ptr %7, align 8, !tbaa !5
  %54 = getelementptr inbounds %class.OptionRecordInt, ptr %53, i32 0, i32 4
  %55 = load i32, ptr %54, align 4, !tbaa !25
  %56 = load ptr, ptr %7, align 8, !tbaa !5
  %57 = getelementptr inbounds %class.OptionRecordInt, ptr %56, i32 0, i32 2
  %58 = load ptr, ptr %57, align 8, !tbaa !27
  store i32 %55, ptr %58, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  br label %89

59:                                               ; preds = %43
  %60 = load i32, ptr %5, align 4, !tbaa !18
  %61 = icmp eq i32 %60, 2
  br i1 %61, label %62, label %75

62:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %63 = load ptr, ptr %2, align 8, !tbaa !5
  %64 = load i32, ptr %4, align 4, !tbaa !9
  %65 = sext i32 %64 to i64
  %66 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP12OptionRecordSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %63, i64 noundef %65) #3
  %67 = load ptr, ptr %66, align 8, !tbaa !5
  %68 = getelementptr inbounds %class.OptionRecordDouble, ptr %67, i64 0
  store ptr %68, ptr %8, align 8, !tbaa !5
  %69 = load ptr, ptr %8, align 8, !tbaa !5
  %70 = getelementptr inbounds %class.OptionRecordDouble, ptr %69, i32 0, i32 4
  %71 = load double, ptr %70, align 8, !tbaa !28
  %72 = load ptr, ptr %8, align 8, !tbaa !5
  %73 = getelementptr inbounds %class.OptionRecordDouble, ptr %72, i32 0, i32 1
  %74 = load ptr, ptr %73, align 8, !tbaa !31
  store double %71, ptr %74, align 8, !tbaa !32
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %88

75:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %76 = load ptr, ptr %2, align 8, !tbaa !5
  %77 = load i32, ptr %4, align 4, !tbaa !9
  %78 = sext i32 %77 to i64
  %79 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP12OptionRecordSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %76, i64 noundef %78) #3
  %80 = load ptr, ptr %79, align 8, !tbaa !5
  %81 = getelementptr inbounds %class.OptionRecordString, ptr %80, i64 0
  store ptr %81, ptr %9, align 8, !tbaa !5
  %82 = load ptr, ptr %9, align 8, !tbaa !5
  %83 = getelementptr inbounds %class.OptionRecordString, ptr %82, i32 0, i32 2
  %84 = load ptr, ptr %9, align 8, !tbaa !5
  %85 = getelementptr inbounds %class.OptionRecordString, ptr %84, i32 0, i32 1
  %86 = load ptr, ptr %85, align 8, !tbaa !33
  %87 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %86, ptr noundef nonnull align 8 dereferenceable(32) %83)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  br label %88

88:                                               ; preds = %75, %62
  br label %89

89:                                               ; preds = %88, %46
  br label %90

90:                                               ; preds = %89, %28
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  br label %91

91:                                               ; preds = %90
  %92 = load i32, ptr %4, align 4, !tbaa !9
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %4, align 4, !tbaa !9
  br label %13, !llvm.loop !35

94:                                               ; preds = %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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" }
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 = { 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !13, i64 8}
!12 = !{!"_ZTS12OptionRecord", !13, i64 8, !14, i64 16, !14, i64 48, !17, i64 80}
!13 = !{!"_ZTS15HighsOptionType", !7, i64 0}
!14 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !15, i64 0, !16, i64 8, !7, i64 16}
!15 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!16 = !{!"long", !7, i64 0}
!17 = !{!"bool", !7, i64 0}
!18 = !{!13, !13, i64 0}
!19 = !{!20, !17, i64 96}
!20 = !{!"_ZTS16OptionRecordBool", !12, i64 0, !6, i64 88, !17, i64 96}
!21 = !{i8 0, i8 2}
!22 = !{}
!23 = !{!20, !6, i64 88}
!24 = !{!17, !17, i64 0}
!25 = !{!26, !10, i64 100}
!26 = !{!"_ZTS15OptionRecordInt", !12, i64 0, !6, i64 88, !10, i64 96, !10, i64 100, !10, i64 104}
!27 = !{!26, !6, i64 88}
!28 = !{!29, !30, i64 112}
!29 = !{!"_ZTS18OptionRecordDouble", !12, i64 0, !6, i64 88, !30, i64 96, !30, i64 104, !30, i64 112}
!30 = !{!"double", !7, i64 0}
!31 = !{!29, !6, i64 88}
!32 = !{!30, !30, i64 0}
!33 = !{!34, !6, i64 88}
!34 = !{!"_ZTS18OptionRecordString", !12, i64 0, !6, i64 88, !14, i64 96}
!35 = distinct !{!35, !36}
!36 = !{!"llvm.loop.mustprogress"}


; 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 nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP12OptionRecordSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIP12OptionRecordSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSERKS4_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z17resetLocalOptionsRSt6vectorIP12OptionRecordSaIS1_EE(ptr noundef nonnull align 8 dereferenceable(24) %0) local_unnamed_addr #1 {
  %2 = tail call noundef i64 @_ZNKSt6vectorIP12OptionRecordSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %0) #2
  %3 = trunc i64 %2 to i32
  %4 = icmp sgt i32 %3, 0
  br i1 %4, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %1
  %wide.trip.count = and i64 %2, 2147483647
  br label %.lr.ph

._crit_edge:                                      ; preds = %31, %1
  ret void

.lr.ph:                                           ; preds = %.lr.ph.preheader, %31
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %31 ]
  %5 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP12OptionRecordSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %indvars.iv) #2
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %6, i64 8
  %8 = load i32, ptr %7, align 8, !tbaa !9
  %9 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP12OptionRecordSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %indvars.iv) #2
  %10 = load ptr, ptr %9, align 8, !tbaa !5
  switch i32 %8, label %26 [
    i32 0, label %11
    i32 1, label %16
    i32 2, label %21
  ]

11:                                               ; preds = %.lr.ph
  %12 = getelementptr inbounds i8, ptr %10, i64 96
  %13 = load i8, ptr %12, align 8, !tbaa !16, !range !18, !noundef !19
  %14 = getelementptr inbounds i8, ptr %10, i64 88
  %15 = load ptr, ptr %14, align 8, !tbaa !20
  store i8 %13, ptr %15, align 1, !tbaa !21
  br label %31

16:                                               ; preds = %.lr.ph
  %17 = getelementptr inbounds i8, ptr %10, i64 100
  %18 = load i32, ptr %17, align 4, !tbaa !22
  %19 = getelementptr inbounds i8, ptr %10, i64 88
  %20 = load ptr, ptr %19, align 8, !tbaa !25
  store i32 %18, ptr %20, align 4, !tbaa !26
  br label %31

21:                                               ; preds = %.lr.ph
  %22 = getelementptr inbounds i8, ptr %10, i64 112
  %23 = load double, ptr %22, align 8, !tbaa !27
  %24 = getelementptr inbounds i8, ptr %10, i64 88
  %25 = load ptr, ptr %24, align 8, !tbaa !30
  store double %23, ptr %25, align 8, !tbaa !31
  br label %31

26:                                               ; preds = %.lr.ph
  %27 = getelementptr inbounds i8, ptr %10, i64 96
  %28 = getelementptr inbounds i8, ptr %10, i64 88
  %29 = load ptr, ptr %28, align 8, !tbaa !32
  %30 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %29, ptr noundef nonnull align 8 dereferenceable(32) %27)
  br label %31

31:                                               ; preds = %16, %26, %21, %11
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !34
}

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" }
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 = { 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++ TBAA"}
!9 = !{!10, !11, i64 8}
!10 = !{!"_ZTS12OptionRecord", !11, i64 8, !12, i64 16, !12, i64 48, !15, i64 80}
!11 = !{!"_ZTS15HighsOptionType", !7, i64 0}
!12 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !13, i64 0, !14, i64 8, !7, i64 16}
!13 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = !{!17, !15, i64 96}
!17 = !{!"_ZTS16OptionRecordBool", !10, i64 0, !6, i64 88, !15, i64 96}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = !{!17, !6, i64 88}
!21 = !{!15, !15, i64 0}
!22 = !{!23, !24, i64 100}
!23 = !{!"_ZTS15OptionRecordInt", !10, i64 0, !6, i64 88, !24, i64 96, !24, i64 100, !24, i64 104}
!24 = !{!"int", !7, i64 0}
!25 = !{!23, !6, i64 88}
!26 = !{!24, !24, i64 0}
!27 = !{!28, !29, i64 112}
!28 = !{!"_ZTS18OptionRecordDouble", !10, i64 0, !6, i64 88, !29, i64 96, !29, i64 104, !29, i64 112}
!29 = !{!"double", !7, i64 0}
!30 = !{!28, !6, i64 88}
!31 = !{!29, !29, i64 0}
!32 = !{!33, !6, i64 88}
!33 = !{!"_ZTS18OptionRecordString", !10, i64 0, !6, i64 88, !12, i64 96}
!34 = distinct !{!34, !35}
!35 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass