; LLVM IR from AdaptiveCpp/AdaptiveCpp :: tests/pcuda/pcuda_test_suite.ll (ZN5boost5debug14under_debuggerEv)

; 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.boost::unit_test::basic_cstring" = type { ptr, ptr }
%"struct.boost::debug::(anonymous namespace)::process_info" = type <{ i32, [4 x i8], %"class.boost::unit_test::basic_cstring", %"class.boost::unit_test::basic_cstring", [501 x i8], [501 x i8], [6 x i8] }>

@.str.94 = external hidden unnamed_addr constant [9 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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN5boost5debug14under_debuggerEv() #1 {
  %1 = alloca i1, align 1
  %2 = alloca %"class.boost::unit_test::basic_cstring", align 8
  %3 = alloca i32, align 4
  %4 = alloca %"struct.boost::debug::(anonymous namespace)::process_info", align 8
  %5 = alloca %"class.boost::unit_test::basic_cstring", align 8
  %6 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 16, ptr %2) #5
  call void @_ZN5boost9unit_test13basic_cstringIKcEC2ImEEPS2_T_(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef @.str.94, i64 noundef 8)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  %7 = call i32 @getpid() #5
  store i32 %7, ptr %3, align 4, !tbaa !5
  br label %8

8:                                                ; preds = %27, %0
  %9 = load i32, ptr %3, align 4, !tbaa !5
  %10 = icmp ne i32 %9, 0
  br i1 %10, label %11, label %28

11:                                               ; preds = %8
  call void @llvm.lifetime.start.p0(i64 1048, ptr %4) #5
  %12 = load i32, ptr %3, align 4, !tbaa !5
  call void @_ZN5boost5debug12_GLOBAL__N_112process_infoC2Ei(ptr noundef nonnull align 8 dereferenceable(1042) %4, i32 noundef %12)
  call void @_ZNK5boost5debug12_GLOBAL__N_112process_info11binary_nameEv(ptr dead_on_unwind writable sret(%"class.boost::unit_test::basic_cstring") align 8 %5, ptr noundef nonnull align 8 dereferenceable(1042) %4)
  %13 = call noundef i64 @_ZNK5boost9unit_test13basic_cstringIKcE4findES3_(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef %5)
  %14 = icmp ne i64 %13, -1
  br i1 %14, label %15, label %16

15:                                               ; preds = %11
  store i1 true, ptr %1, align 1
  store i32 1, ptr %6, align 4
  br label %25

16:                                               ; preds = %11
  %17 = call noundef i32 @_ZNK5boost5debug12_GLOBAL__N_112process_info10parent_pidEv(ptr noundef nonnull align 8 dereferenceable(1042) %4)
  %18 = load i32, ptr %3, align 4, !tbaa !5
  %19 = icmp eq i32 %17, %18
  br i1 %19, label %20, label %21

20:                                               ; preds = %16
  br label %23

21:                                               ; preds = %16
  %22 = call noundef i32 @_ZNK5boost5debug12_GLOBAL__N_112process_info10parent_pidEv(ptr noundef nonnull align 8 dereferenceable(1042) %4)
  br label %23

23:                                               ; preds = %21, %20
  %24 = phi i32 [ 0, %20 ], [ %22, %21 ]
  store i32 %24, ptr %3, align 4, !tbaa !5
  store i32 0, ptr %6, align 4
  br label %25

25:                                               ; preds = %23, %15
  call void @llvm.lifetime.end.p0(i64 1048, ptr %4) #5
  %26 = load i32, ptr %6, align 4
  switch i32 %26, label %29 [
    i32 0, label %27
  ]

27:                                               ; preds = %25
  br label %8, !llvm.loop !9

28:                                               ; preds = %8
  store i1 false, ptr %1, align 1
  store i32 1, ptr %6, align 4
  br label %29

29:                                               ; preds = %28, %25
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %2) #5
  %30 = load i1, ptr %1, align 1
  ret i1 %30
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5boost9unit_test13basic_cstringIKcEC2ImEEPS2_T_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, i64 noundef) unnamed_addr #2 align 2

; Function Attrs: nounwind
declare i32 @getpid() #3

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN5boost5debug12_GLOBAL__N_112process_infoC2Ei(ptr noundef nonnull align 8 dereferenceable(1042), i32 noundef) unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_ZNK5boost9unit_test13basic_cstringIKcE4findES3_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) #4 align 2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZNK5boost5debug12_GLOBAL__N_112process_info11binary_nameEv(ptr dead_on_unwind noalias writable sret(%"class.boost::unit_test::basic_cstring") align 8, ptr noundef nonnull align 8 dereferenceable(1042)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZNK5boost5debug12_GLOBAL__N_112process_info10parent_pidEv(ptr noundef nonnull align 8 dereferenceable(1042)) #2 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 "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 = { inlinehint 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 #5 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"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"

%"class.boost::unit_test::basic_cstring" = type { ptr, ptr }
%"struct.boost::debug::(anonymous namespace)::process_info" = type <{ i32, [4 x i8], %"class.boost::unit_test::basic_cstring", %"class.boost::unit_test::basic_cstring", [501 x i8], [501 x i8], [6 x i8] }>

@.str.94 = external hidden unnamed_addr constant [9 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: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN5boost5debug14under_debuggerEv() local_unnamed_addr #1 {
  %1 = alloca %"class.boost::unit_test::basic_cstring", align 8
  %2 = alloca %"struct.boost::debug::(anonymous namespace)::process_info", align 8
  %3 = alloca %"class.boost::unit_test::basic_cstring", align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %1) #5
  call void @_ZN5boost9unit_test13basic_cstringIKcEC2ImEEPS2_T_(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull @.str.94, i64 noundef 8)
  %4 = call i32 @getpid() #5
  %.not11.not = icmp eq i32 %4, 0
  br i1 %.not11.not, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %0, %9
  %.0412 = phi i32 [ %10, %9 ], [ %4, %0 ]
  call void @llvm.lifetime.start.p0(i64 1048, ptr nonnull %2) #5
  call void @_ZN5boost5debug12_GLOBAL__N_112process_infoC2Ei(ptr noundef nonnull align 8 dereferenceable(1042) %2, i32 noundef %.0412)
  call void @_ZNK5boost5debug12_GLOBAL__N_112process_info11binary_nameEv(ptr dead_on_unwind nonnull writable sret(%"class.boost::unit_test::basic_cstring") align 8 %3, ptr noundef nonnull align 8 dereferenceable(1042) %2)
  %5 = call noundef i64 @_ZNK5boost9unit_test13basic_cstringIKcE4findES3_(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull %3)
  %.not7 = icmp eq i64 %5, -1
  br i1 %.not7, label %6, label %.thread

.thread:                                          ; preds = %.lr.ph
  call void @llvm.lifetime.end.p0(i64 1048, ptr nonnull %2) #5
  br label %.loopexit

6:                                                ; preds = %.lr.ph
  %7 = call noundef i32 @_ZNK5boost5debug12_GLOBAL__N_112process_info10parent_pidEv(ptr noundef nonnull align 8 dereferenceable(1042) %2)
  %8 = icmp eq i32 %7, %.0412
  br i1 %8, label %.thread15, label %9

.thread15:                                        ; preds = %6
  call void @llvm.lifetime.end.p0(i64 1048, ptr nonnull %2) #5
  br label %.loopexit

9:                                                ; preds = %6
  %10 = call noundef i32 @_ZNK5boost5debug12_GLOBAL__N_112process_info10parent_pidEv(ptr noundef nonnull align 8 dereferenceable(1042) %2)
  call void @llvm.lifetime.end.p0(i64 1048, ptr nonnull %2) #5
  %.not.not = icmp eq i32 %10, 0
  br i1 %.not.not, label %.loopexit, label %.lr.ph, !llvm.loop !5

.loopexit:                                        ; preds = %9, %.thread15, %0, %.thread
  %.not10 = phi i1 [ true, %.thread ], [ false, %0 ], [ false, %.thread15 ], [ false, %9 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %1) #5
  ret i1 %.not10
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5boost9unit_test13basic_cstringIKcEC2ImEEPS2_T_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef, i64 noundef) unnamed_addr #2 align 2

; Function Attrs: nounwind
declare i32 @getpid() local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN5boost5debug12_GLOBAL__N_112process_infoC2Ei(ptr noundef nonnull align 8 dereferenceable(1042), i32 noundef) unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_ZNK5boost9unit_test13basic_cstringIKcE4findES3_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZNK5boost5debug12_GLOBAL__N_112process_info11binary_nameEv(ptr dead_on_unwind noalias writable sret(%"class.boost::unit_test::basic_cstring") align 8, ptr noundef nonnull align 8 dereferenceable(1042)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZNK5boost5debug12_GLOBAL__N_112process_info10parent_pidEv(ptr noundef nonnull align 8 dereferenceable(1042)) local_unnamed_addr #2 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 "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 = { inlinehint 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 #5 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass