; LLVM IR from ERGO-Code/HiGHS :: src/util/HighsUtils.ll/Z10highsPausebNSt7 (cxx1112basic_stringIcSt11char_traitsIcESaIcEEE)

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

@.str.140 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.141 = external hidden unnamed_addr constant [29 x i8], align 1
@stdout = external global ptr, align 8
@stdin = external global ptr, align 8
@.str.142 = external hidden unnamed_addr constant [19 x i8], align 1

; 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

declare i32 @printf(ptr noundef, ...) #1

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z10highsPausebNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(i1 noundef zeroext %0, ptr noundef %1) #3 {
  %3 = alloca i1, align 1
  %4 = alloca i8, align 1
  %5 = alloca ptr, align 8
  %6 = alloca [100 x i8], align 16
  %7 = zext i1 %0 to i8
  store i8 %7, ptr %4, align 1, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  %8 = load i8, ptr %4, align 1, !tbaa !5, !range !11, !noundef !12
  %9 = trunc i8 %8 to i1
  br i1 %9, label %13, label %10

10:                                               ; preds = %2
  %11 = load i8, ptr %4, align 1, !tbaa !5, !range !11, !noundef !12
  %12 = trunc i8 %11 to i1
  store i1 %12, ptr %3, align 1
  br label %31

13:                                               ; preds = %2
  %14 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %1) #4
  %15 = call i32 (ptr, ...) @printf(ptr noundef @.str.140, ptr noundef %14)
  call void @llvm.lifetime.start.p0(i64 100, ptr %6) #4
  %16 = call i32 (ptr, ...) @printf(ptr noundef @.str.141)
  %17 = load ptr, ptr @stdout, align 8, !tbaa !9
  %18 = call i32 @fflush(ptr noundef %17)
  %19 = getelementptr inbounds [100 x i8], ptr %6, i64 0, i64 0
  %20 = load ptr, ptr @stdin, align 8, !tbaa !9
  %21 = call ptr @fgets(ptr noundef %19, i32 noundef 100, ptr noundef %20)
  %22 = icmp ne ptr %21, null
  br i1 %22, label %23, label %28

23:                                               ; preds = %13
  %24 = getelementptr inbounds [100 x i8], ptr %6, i64 0, i64 0
  %25 = call i32 (ptr, ...) @printf(ptr noundef @.str.142, ptr noundef %24)
  %26 = load ptr, ptr @stdout, align 8, !tbaa !9
  %27 = call i32 @fflush(ptr noundef %26)
  br label %28

28:                                               ; preds = %23, %13
  %29 = load i8, ptr %4, align 1, !tbaa !5, !range !11, !noundef !12
  %30 = trunc i8 %29 to i1
  store i1 %30, ptr %3, align 1
  call void @llvm.lifetime.end.p0(i64 100, ptr %6) #4
  br label %31

31:                                               ; preds = %28, %10
  %32 = load i1, ptr %3, align 1
  ret i1 %32
}

declare i32 @fflush(ptr noundef) #1

declare ptr @fgets(ptr noundef, i32 noundef, ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 = { 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 #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, !6, i64 0}
!6 = !{!"bool", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}


; 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.140 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.141 = external hidden unnamed_addr constant [29 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@stdin = external local_unnamed_addr global ptr, align 8
@.str.142 = external hidden unnamed_addr constant [19 x i8], align 1

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_Z10highsPausebNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(i1 noundef returned zeroext %0, ptr noundef %1) local_unnamed_addr #2 {
  %3 = alloca [100 x i8], align 16
  br i1 %0, label %4, label %17

4:                                                ; preds = %2
  %5 = tail call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %1) #3
  %6 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.140, ptr noundef %5)
  call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %3) #3
  %7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.141)
  %8 = load ptr, ptr @stdout, align 8, !tbaa !5
  %9 = tail call i32 @fflush(ptr noundef %8)
  %10 = load ptr, ptr @stdin, align 8, !tbaa !5
  %11 = call ptr @fgets(ptr noundef nonnull %3, i32 noundef 100, ptr noundef %10)
  %.not = icmp eq ptr %11, null
  br i1 %.not, label %16, label %12

12:                                               ; preds = %4
  %13 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.142, ptr noundef nonnull %3)
  %14 = load ptr, ptr @stdout, align 8, !tbaa !5
  %15 = call i32 @fflush(ptr noundef %14)
  br label %16

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

17:                                               ; preds = %2, %16
  ret i1 %0
}

; Function Attrs: nofree nounwind
declare noundef i32 @fflush(ptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #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"}


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