; LLVM IR from turi-code/SFrame :: oss_src/process/process_unix.ll (ZN8graphlab7process6existsEv)

; 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.anon.11 = type { i8 }
%"class.graphlab::process" = type <{ i32, i32, i8, i8, [2 x i8] }>

@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [83 x i8], align 1
@__func__._ZN8graphlab7process6existsEv = external hidden unnamed_addr constant [7 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [48 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 noundef nonnull align 8 dereferenceable(896) ptr @_Z13global_loggerv() #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN11file_logger13get_log_levelEv(ptr noundef nonnull align 8 dereferenceable(896)) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(896) ptr @_ZN19log_stream_dispatchILb1EE4execEiPKcS2_ib(i32 noundef, ptr noundef, ptr noundef, i32 noundef, i1 noundef zeroext) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(896) ptr @_ZN11file_loggerlsEPKc(ptr noundef nonnull align 8 dereferenceable(896), ptr noundef) #3 align 2

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__errno_location() #4

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(896) ptr @_ZN11file_loggerlsIPcEERS_T_(ptr noundef nonnull align 8 dereferenceable(896), ptr noundef) #5 align 2

; Function Attrs: nounwind
declare ptr @strerror(i32 noundef) #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(896) ptr @_ZN11file_loggerlsEPFRSoS0_E(ptr noundef nonnull align 8 dereferenceable(896), ptr noundef) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(896) ptr @_ZN11file_loggerlsIiEERS_T_(ptr noundef nonnull align 8 dereferenceable(896), i32 noundef) #5 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN8graphlab7process6existsEv(ptr noundef nonnull align 4 dereferenceable(10) %0) #5 align 2 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  %4 = alloca %class.anon.11, align 1
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %8 = load ptr, ptr %3, align 8
  %9 = getelementptr inbounds %"class.graphlab::process", ptr %8, i32 0, i32 2
  %10 = load i8, ptr %9, align 4, !tbaa !9, !range !13, !noundef !14
  %11 = trunc i8 %10 to i1
  br i1 %11, label %15, label %12

12:                                               ; preds = %1
  br label %13

13:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 1, ptr %4) #7
  call void @"_ZZN8graphlab7process6existsEvENK3$_0clEv"(ptr noundef nonnull align 1 dereferenceable(1) %4)
  call void @llvm.lifetime.end.p0(i64 1, ptr %4) #7
  br label %14

14:                                               ; preds = %13
  br label %15

15:                                               ; preds = %14, %1
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  %16 = getelementptr inbounds %"class.graphlab::process", ptr %8, i32 0, i32 1
  %17 = load i32, ptr %16, align 4, !tbaa !15
  %18 = call i32 @waitpid(i32 noundef %17, ptr noundef %5, i32 noundef 1)
  store i32 %18, ptr %6, align 4, !tbaa !16
  %19 = load i32, ptr %6, align 4, !tbaa !16
  %20 = icmp eq i32 %19, -1
  br i1 %20, label %21, label %38

21:                                               ; preds = %15
  %22 = call noundef nonnull align 8 dereferenceable(896) ptr @_Z13global_loggerv()
  %23 = call noundef i32 @_ZN11file_logger13get_log_levelEv(ptr noundef nonnull align 8 dereferenceable(896) %22)
  %24 = icmp sge i32 5, %23
  br i1 %24, label %25, label %37

25:                                               ; preds = %21
  %26 = call noundef nonnull align 8 dereferenceable(896) ptr @_ZN19log_stream_dispatchILb1EE4execEiPKcS2_ib(i32 noundef 5, ptr noundef @.str.5, ptr noundef @__func__._ZN8graphlab7process6existsEv, i32 noundef 233, i1 noundef zeroext true)
  %27 = call noundef nonnull align 8 dereferenceable(896) ptr @_ZN11file_loggerlsEPKc(ptr noundef nonnull align 8 dereferenceable(896) %26, ptr noundef @.str.11)
  %28 = getelementptr inbounds %"class.graphlab::process", ptr %8, i32 0, i32 1
  %29 = load i32, ptr %28, align 4, !tbaa !15
  %30 = call noundef nonnull align 8 dereferenceable(896) ptr @_ZN11file_loggerlsIiEERS_T_(ptr noundef nonnull align 8 dereferenceable(896) %27, i32 noundef %29)
  %31 = call noundef nonnull align 8 dereferenceable(896) ptr @_ZN11file_loggerlsEPKc(ptr noundef nonnull align 8 dereferenceable(896) %30, ptr noundef @.str)
  %32 = call ptr @__errno_location() #8
  %33 = load i32, ptr %32, align 4, !tbaa !16
  %34 = call ptr @strerror(i32 noundef %33) #7
  %35 = call noundef nonnull align 8 dereferenceable(896) ptr @_ZN11file_loggerlsIPcEERS_T_(ptr noundef nonnull align 8 dereferenceable(896) %31, ptr noundef %34)
  %36 = call noundef nonnull align 8 dereferenceable(896) ptr @_ZN11file_loggerlsEPFRSoS0_E(ptr noundef nonnull align 8 dereferenceable(896) %35, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %37

37:                                               ; preds = %25, %21
  br label %43

38:                                               ; preds = %15
  %39 = load i32, ptr %6, align 4, !tbaa !16
  %40 = icmp eq i32 %39, 0
  br i1 %40, label %41, label %42

41:                                               ; preds = %38
  store i1 true, ptr %2, align 1
  store i32 1, ptr %7, align 4
  br label %44

42:                                               ; preds = %38
  br label %43

43:                                               ; preds = %42, %37
  store i1 false, ptr %2, align 1
  store i32 1, ptr %7, align 4
  br label %44

44:                                               ; preds = %43, %41
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  %45 = load i1, ptr %2, align 1
  ret i1 %45
}

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZZN8graphlab7process6existsEvENK3$_0clEv"(ptr noundef nonnull align 1 dereferenceable(1)) #3 align 2

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 = { 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 #4 = { nounwind willreturn memory(none) "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 = { 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 #6 = { 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 #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(none) }

!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, !12, i64 8}
!10 = !{!"_ZTSN8graphlab7processE", !11, i64 0, !11, i64 4, !12, i64 8, !12, i64 9}
!11 = !{!"int", !7, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!10, !11, i64 4}
!16 = !{!11, !11, i64 0}


; 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.anon.11 = type { i8 }

@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [83 x i8], align 1
@__func__._ZN8graphlab7process6existsEv = external hidden unnamed_addr constant [7 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [48 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

declare noundef nonnull align 8 dereferenceable(896) ptr @_Z13global_loggerv() local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN11file_logger13get_log_levelEv(ptr noundef nonnull align 8 dereferenceable(896)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(896) ptr @_ZN19log_stream_dispatchILb1EE4execEiPKcS2_ib(i32 noundef, ptr noundef, ptr noundef, i32 noundef, i1 noundef zeroext) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(896) ptr @_ZN11file_loggerlsEPKc(ptr noundef nonnull align 8 dereferenceable(896), ptr noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__errno_location() local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(896) ptr @_ZN11file_loggerlsIPcEERS_T_(ptr noundef nonnull align 8 dereferenceable(896), ptr noundef) local_unnamed_addr #5 align 2

; Function Attrs: nounwind
declare ptr @strerror(i32 noundef) local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(896) ptr @_ZN11file_loggerlsEPFRSoS0_E(ptr noundef nonnull align 8 dereferenceable(896), ptr noundef) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(896) ptr @_ZN11file_loggerlsIiEERS_T_(ptr noundef nonnull align 8 dereferenceable(896), i32 noundef) local_unnamed_addr #5 align 2

declare i32 @waitpid(i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN8graphlab7process6existsEv(ptr nocapture noundef nonnull readonly align 4 dereferenceable(10) %0) local_unnamed_addr #5 align 2 {
  %2 = alloca %class.anon.11, align 1
  %3 = alloca i32, align 4
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  %5 = load i8, ptr %4, align 4, !tbaa !5, !range !11, !noundef !12
  %6 = trunc nuw i8 %5 to i1
  br i1 %6, label %8, label %7

7:                                                ; preds = %1
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %2) #7
  call void @"_ZZN8graphlab7process6existsEvENK3$_0clEv"(ptr noundef nonnull align 1 dereferenceable(1) %2)
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #7
  br label %8

8:                                                ; preds = %7, %1
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  %9 = getelementptr inbounds i8, ptr %0, i64 4
  %10 = load i32, ptr %9, align 4, !tbaa !13
  %11 = call i32 @waitpid(i32 noundef %10, ptr noundef nonnull %3, i32 noundef 1)
  switch i32 %11, label %27 [
    i32 -1, label %12
    i32 0, label %28
  ]

12:                                               ; preds = %8
  %13 = call noundef nonnull align 8 dereferenceable(896) ptr @_Z13global_loggerv()
  %14 = call noundef i32 @_ZN11file_logger13get_log_levelEv(ptr noundef nonnull align 8 dereferenceable(896) %13)
  %15 = icmp slt i32 %14, 6
  br i1 %15, label %16, label %27

16:                                               ; preds = %12
  %17 = call noundef nonnull align 8 dereferenceable(896) ptr @_ZN19log_stream_dispatchILb1EE4execEiPKcS2_ib(i32 noundef 5, ptr noundef nonnull @.str.5, ptr noundef nonnull @__func__._ZN8graphlab7process6existsEv, i32 noundef 233, i1 noundef zeroext true)
  %18 = call noundef nonnull align 8 dereferenceable(896) ptr @_ZN11file_loggerlsEPKc(ptr noundef nonnull align 8 dereferenceable(896) %17, ptr noundef nonnull @.str.11)
  %19 = load i32, ptr %9, align 4, !tbaa !13
  %20 = call noundef nonnull align 8 dereferenceable(896) ptr @_ZN11file_loggerlsIiEERS_T_(ptr noundef nonnull align 8 dereferenceable(896) %18, i32 noundef %19)
  %21 = call noundef nonnull align 8 dereferenceable(896) ptr @_ZN11file_loggerlsEPKc(ptr noundef nonnull align 8 dereferenceable(896) %20, ptr noundef nonnull @.str)
  %22 = tail call ptr @__errno_location() #8
  %23 = load i32, ptr %22, align 4, !tbaa !14
  %24 = call ptr @strerror(i32 noundef %23) #7
  %25 = call noundef nonnull align 8 dereferenceable(896) ptr @_ZN11file_loggerlsIPcEERS_T_(ptr noundef nonnull align 8 dereferenceable(896) %21, ptr noundef %24)
  %26 = call noundef nonnull align 8 dereferenceable(896) ptr @_ZN11file_loggerlsEPFRSoS0_E(ptr noundef nonnull align 8 dereferenceable(896) %25, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %27

27:                                               ; preds = %8, %12, %16
  br label %28

28:                                               ; preds = %8, %27
  %.0 = phi i1 [ false, %27 ], [ true, %8 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  ret i1 %.0
}

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZZN8graphlab7process6existsEvENK3$_0clEv"(ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #3 align 2

attributes #0 = { mustprogress 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 = { 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 #4 = { mustprogress nofree nosync nounwind willreturn memory(none) "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 = { 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 #6 = { 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 #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(none) }

!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 8}
!6 = !{!"_ZTSN8graphlab7processE", !7, i64 0, !7, i64 4, !10, i64 8, !10, i64 9}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"bool", !8, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = !{!6, !7, i64 4}
!14 = !{!7, !7, i64 0}


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