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

; 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.1 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [1 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [2 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 noalias ptr @fopen(ptr noundef, ptr noundef) #1

declare void @PRINT_ERR(ptr noundef) #1

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

declare i32 @fclose(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @is_str_number(ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i64 @get_interrupts_from_proc_by_dev(ptr noundef %0) #2 {
  %2 = alloca i64, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca [12480 x i8], align 16
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  %11 = call noalias ptr @fopen(ptr noundef @.str.5, ptr noundef @.str.1)
  store ptr %11, ptr %4, align 8, !tbaa !5
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = icmp eq ptr %12, null
  br i1 %13, label %14, label %15

14:                                               ; preds = %1
  call void @PRINT_ERR(ptr noundef @.str.6)
  store i64 0, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %63

15:                                               ; preds = %1
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = call i32 @strcmp(ptr noundef %16, ptr noundef @.str.7) #7
  %18 = icmp ne i32 %17, 0
  br i1 %18, label %20, label %19

19:                                               ; preds = %15
  store i64 0, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %63

20:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 12480, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  store i64 0, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  store i64 0, ptr %10, align 8, !tbaa !9
  br label %21

21:                                               ; preds = %58, %31, %20
  %22 = getelementptr inbounds [12480 x i8], ptr %6, i64 0, i64 0
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = call ptr @fgets(ptr noundef %22, i32 noundef 12480, ptr noundef %23)
  store ptr %24, ptr %7, align 8, !tbaa !5
  %25 = icmp ne ptr %24, null
  br i1 %25, label %26, label %59

26:                                               ; preds = %21
  %27 = load ptr, ptr %7, align 8, !tbaa !5
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = call ptr @strstr(ptr noundef %27, ptr noundef %28) #7
  %30 = icmp eq ptr %29, null
  br i1 %30, label %31, label %32

31:                                               ; preds = %26
  br label %21, !llvm.loop !11

32:                                               ; preds = %26
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = call ptr @strtok(ptr noundef %33, ptr noundef @.str.8) #6
  store ptr %34, ptr %8, align 8, !tbaa !5
  br label %35

35:                                               ; preds = %53, %41, %32
  %36 = load ptr, ptr %8, align 8, !tbaa !5
  %37 = icmp ne ptr %36, null
  br i1 %37, label %38, label %58

38:                                               ; preds = %35
  %39 = load ptr, ptr %8, align 8, !tbaa !5
  %40 = call zeroext i1 @is_str_number(ptr noundef %39)
  br i1 %40, label %43, label %41

41:                                               ; preds = %38
  %42 = call ptr @strtok(ptr noundef null, ptr noundef @.str.8) #6
  store ptr %42, ptr %8, align 8, !tbaa !5
  br label %35, !llvm.loop !13

43:                                               ; preds = %38
  %44 = call ptr @__errno_location() #8
  store i32 0, ptr %44, align 4, !tbaa !14
  %45 = load ptr, ptr %8, align 8, !tbaa !5
  %46 = call i64 @strtoull(ptr noundef %45, ptr noundef null, i32 noundef 10) #6
  store i64 %46, ptr %9, align 8, !tbaa !9
  %47 = call ptr @__errno_location() #8
  %48 = load i32, ptr %47, align 4, !tbaa !14
  %49 = icmp eq i32 %48, 0
  br i1 %49, label %50, label %52

50:                                               ; preds = %43
  %51 = load i64, ptr %9, align 8, !tbaa !9
  br label %53

52:                                               ; preds = %43
  br label %53

53:                                               ; preds = %52, %50
  %54 = phi i64 [ %51, %50 ], [ 0, %52 ]
  %55 = load i64, ptr %10, align 8, !tbaa !9
  %56 = add i64 %55, %54
  store i64 %56, ptr %10, align 8, !tbaa !9
  %57 = call ptr @strtok(ptr noundef null, ptr noundef @.str.8) #6
  store ptr %57, ptr %8, align 8, !tbaa !5
  br label %35, !llvm.loop !13

58:                                               ; preds = %35
  br label %21, !llvm.loop !11

59:                                               ; preds = %21
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = call i32 @fclose(ptr noundef %60)
  %62 = load i64, ptr %10, align 8, !tbaa !9
  store i64 %62, ptr %2, align 8
  store i32 1, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 12480, ptr %6) #6
  br label %63

63:                                               ; preds = %59, %19, %14
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  %64 = load i64, ptr %2, align 8
  ret i64 %64
}

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #3

; Function Attrs: nounwind willreturn memory(read)
declare ptr @strstr(ptr noundef, ptr noundef) #3

; Function Attrs: nounwind
declare ptr @strtok(ptr noundef, ptr noundef) #4

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

; Function Attrs: nounwind
declare i64 @strtoull(ptr noundef, ptr noundef, i32 noundef) #4

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 = { 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 willreturn memory(read) "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 "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 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 #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{!15, !15, i64 0}
!15 = !{!"int", !7, 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"

@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [1 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [2 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 noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #1

declare void @PRINT_ERR(ptr noundef) local_unnamed_addr #2

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

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

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @is_str_number(ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local i64 @get_interrupts_from_proc_by_dev(ptr nocapture noundef readonly %0) local_unnamed_addr #3 {
  %2 = alloca [12480 x i8], align 16
  %3 = tail call noalias ptr @fopen(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.1)
  %4 = icmp eq ptr %3, null
  br i1 %4, label %5, label %6

5:                                                ; preds = %1
  tail call void @PRINT_ERR(ptr noundef nonnull @.str.6) #7
  br label %29

6:                                                ; preds = %1
  %7 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) @.str.7) #8
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %29, label %8

8:                                                ; preds = %6
  call void @llvm.lifetime.start.p0(i64 12480, ptr nonnull %2) #7
  br label %.outer19.outer

.outer19.outer.backedge:                          ; preds = %.outer, %18
  %.0.ph.ph.be = phi i64 [ %.1.ph27, %18 ], [ %25, %.outer ]
  br label %.outer19.outer

.outer19.outer:                                   ; preds = %.outer19.outer.backedge, %8
  %.0.ph.ph = phi i64 [ 0, %8 ], [ %.0.ph.ph.be, %.outer19.outer.backedge ]
  br label %.outer19

.outer19:                                         ; preds = %.outer19.outer, %14
  br label %9

9:                                                ; preds = %.outer19, %11
  %10 = call ptr @fgets(ptr noundef nonnull %2, i32 noundef 12480, ptr noundef nonnull %3)
  %.not17 = icmp eq ptr %10, null
  br i1 %.not17, label %27, label %11

11:                                               ; preds = %9
  %12 = call ptr @strstr(ptr noundef nonnull dereferenceable(1) %10, ptr noundef nonnull dereferenceable(1) %0) #8
  %13 = icmp eq ptr %12, null
  br i1 %13, label %9, label %14, !llvm.loop !5

14:                                               ; preds = %11
  %15 = call ptr @strtok(ptr noundef nonnull %10, ptr noundef nonnull @.str.8) #7
  %.not182225 = icmp eq ptr %15, null
  br i1 %.not182225, label %.outer19, label %.lr.ph, !llvm.loop !5

.lr.ph:                                           ; preds = %14, %.outer
  %.1.ph27 = phi i64 [ %25, %.outer ], [ %.0.ph.ph, %14 ]
  %.013.ph26 = phi ptr [ %26, %.outer ], [ %15, %14 ]
  br label %16

16:                                               ; preds = %.lr.ph, %18
  %.01323 = phi ptr [ %.013.ph26, %.lr.ph ], [ %19, %18 ]
  %17 = call zeroext i1 @is_str_number(ptr noundef nonnull %.01323)
  br i1 %17, label %.outer, label %18

18:                                               ; preds = %16
  %19 = call ptr @strtok(ptr noundef null, ptr noundef nonnull @.str.8) #7
  %.not18 = icmp eq ptr %19, null
  br i1 %.not18, label %.outer19.outer.backedge, label %16, !llvm.loop !7

.outer:                                           ; preds = %16
  %20 = tail call ptr @__errno_location() #9
  store i32 0, ptr %20, align 4, !tbaa !8
  %21 = call i64 @strtoull(ptr nocapture noundef nonnull %.01323, ptr noundef null, i32 noundef 10) #7
  %22 = load i32, ptr %20, align 4, !tbaa !8
  %23 = icmp eq i32 %22, 0
  %24 = select i1 %23, i64 %21, i64 0
  %25 = add i64 %24, %.1.ph27
  %26 = call ptr @strtok(ptr noundef null, ptr noundef nonnull @.str.8) #7
  %.not1822 = icmp eq ptr %26, null
  br i1 %.not1822, label %.outer19.outer.backedge, label %.lr.ph, !llvm.loop !7

27:                                               ; preds = %9
  %28 = call i32 @fclose(ptr noundef nonnull %3)
  call void @llvm.lifetime.end.p0(i64 12480, ptr nonnull %2) #7
  br label %29

29:                                               ; preds = %6, %27, %5
  %.014 = phi i64 [ 0, %5 ], [ %.0.ph.ph, %27 ], [ 0, %6 ]
  ret i64 %.014
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare ptr @strstr(ptr noundef, ptr nocapture noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nofree nounwind willreturn
declare ptr @strtok(ptr noundef, ptr nocapture noundef readonly) local_unnamed_addr #5

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

; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtoull(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #5

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 = { "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 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 nounwind willreturn memory(argmem: read) "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 nofree nounwind willreturn "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 = { 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 #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }
attributes #9 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C/C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass