; LLVM IR from microsoft/ntttcp-for-linux :: src (logger)

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

@verbose_log = external dso_local global i8, align 1
@console_log_filename = external dso_local global ptr, align 8
@.str = external hidden unnamed_addr constant [35 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [38 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @prepare_logging(i1 noundef zeroext %0, i1 noundef zeroext %1, ptr noundef %2) #0 {
  %4 = alloca i8, align 1
  %5 = alloca i8, align 1
  %6 = alloca ptr, align 8
  %7 = zext i1 %0 to i8
  store i8 %7, ptr %4, align 1, !tbaa !5
  %8 = zext i1 %1 to i8
  store i8 %8, ptr %5, align 1, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !9
  %9 = load i8, ptr %4, align 1, !tbaa !5, !range !11, !noundef !12
  %10 = trunc i8 %9 to i1
  br i1 %10, label %11, label %12

11:                                               ; preds = %3
  store i8 1, ptr @verbose_log, align 1, !tbaa !5
  br label %12

12:                                               ; preds = %11, %3
  %13 = load i8, ptr %5, align 1, !tbaa !5, !range !11, !noundef !12
  %14 = trunc i8 %13 to i1
  br i1 %14, label %15, label %32

15:                                               ; preds = %12
  %16 = load ptr, ptr %6, align 8, !tbaa !9
  %17 = icmp ne ptr %16, null
  br i1 %17, label %18, label %20

18:                                               ; preds = %15
  %19 = load ptr, ptr %6, align 8, !tbaa !9
  store ptr %19, ptr @console_log_filename, align 8, !tbaa !9
  br label %21

20:                                               ; preds = %15
  call void @PRINT_ERR(ptr noundef @.str)
  br label %21

21:                                               ; preds = %20, %18
  %22 = load ptr, ptr @console_log_filename, align 8, !tbaa !9
  %23 = call i32 @access(ptr noundef %22, i32 noundef 0) #2
  %24 = icmp ne i32 %23, -1
  br i1 %24, label %25, label %31

25:                                               ; preds = %21
  call void @PRINT_INFO(ptr noundef @.str.1)
  %26 = load ptr, ptr @console_log_filename, align 8, !tbaa !9
  %27 = call i32 @remove(ptr noundef %26) #2
  %28 = icmp ne i32 %27, 0
  br i1 %28, label %29, label %30

29:                                               ; preds = %25
  call void @PRINT_ERR(ptr noundef @.str.2)
  br label %30

30:                                               ; preds = %29, %25
  br label %31

31:                                               ; preds = %30, %21
  br label %32

32:                                               ; preds = %31, %12
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @PRINT_ERR(ptr noundef) #0

; Function Attrs: nounwind
declare i32 @access(ptr noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @PRINT_INFO(ptr noundef) #0

; Function Attrs: nounwind
declare i32 @remove(ptr noundef) #1

attributes #0 = { 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 = { 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 = { 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/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"

@verbose_log = external dso_local local_unnamed_addr global i8, align 1
@console_log_filename = external dso_local local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [35 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [38 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @prepare_logging(i1 noundef zeroext %0, i1 noundef zeroext %1, ptr noundef %2) local_unnamed_addr #0 {
  br i1 %0, label %4, label %5

4:                                                ; preds = %3
  store i8 1, ptr @verbose_log, align 1, !tbaa !5
  br label %5

5:                                                ; preds = %4, %3
  br i1 %1, label %6, label %16

6:                                                ; preds = %5
  %.not = icmp eq ptr %2, null
  br i1 %.not, label %8, label %7

7:                                                ; preds = %6
  store ptr %2, ptr @console_log_filename, align 8, !tbaa !9
  br label %9

8:                                                ; preds = %6
  tail call void @PRINT_ERR(ptr noundef nonnull @.str)
  %.pre = load ptr, ptr @console_log_filename, align 8, !tbaa !9
  br label %9

9:                                                ; preds = %8, %7
  %10 = phi ptr [ %.pre, %8 ], [ %2, %7 ]
  %11 = tail call i32 @access(ptr noundef %10, i32 noundef 0) #2
  %.not3 = icmp eq i32 %11, -1
  br i1 %.not3, label %16, label %12

12:                                               ; preds = %9
  tail call void @PRINT_INFO(ptr noundef nonnull @.str.1)
  %13 = load ptr, ptr @console_log_filename, align 8, !tbaa !9
  %14 = tail call i32 @remove(ptr noundef %13) #2
  %.not4 = icmp eq i32 %14, 0
  br i1 %.not4, label %16, label %15

15:                                               ; preds = %12
  tail call void @PRINT_ERR(ptr noundef nonnull @.str.2)
  br label %16

16:                                               ; preds = %9, %15, %12, %5
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @PRINT_ERR(ptr noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare dso_local void @PRINT_INFO(ptr noundef) local_unnamed_addr #0

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

attributes #0 = { 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 = { 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 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}


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