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

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

%struct.ntttcp_test = type { i8, i8, i8, i8, i8, i8, i8, ptr, i32, i32, ptr, i32, i32, i8, i32, i32, i32, i32, i64, i64, i64, i64, i32, i32, i32, i8, ptr, ptr, i8, ptr, i8, ptr, i8, ptr, i8, i8 }

@.str.17 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.121 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.122 = external hidden unnamed_addr constant [95 x i8], align 1
@.str.123 = external hidden unnamed_addr constant [56 x i8], align 1
@.str.124 = external hidden unnamed_addr constant [51 x i8], align 1

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

; Function Attrs: nounwind uwtable
define dso_local i32 @process_mappings(ptr noundef %0) #1 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 0, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 0, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  store ptr null, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 -1, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !9
  store i32 0, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.ntttcp_test, ptr %11, i32 0, i32 7
  %13 = load ptr, ptr %12, align 8, !tbaa !11
  %14 = call noalias ptr @strdup(ptr noundef %13) #6
  store ptr %14, ptr %9, align 8, !tbaa !5
  br label %15

15:                                               ; preds = %79, %50, %1
  %16 = call ptr @strsep(ptr noundef %9, ptr noundef @.str.121) #6
  store ptr %16, ptr %6, align 8, !tbaa !5
  %17 = icmp ne ptr %16, null
  br i1 %17, label %18, label %80

18:                                               ; preds = %15
  %19 = load i32, ptr %4, align 4, !tbaa !9
  %20 = icmp eq i32 0, %19
  br i1 %20, label %21, label %35

21:                                               ; preds = %18
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = call i32 @atoi(ptr noundef %22) #7
  store i32 %23, ptr %5, align 4, !tbaa !9
  %24 = load i32, ptr %5, align 4, !tbaa !9
  %25 = icmp sgt i32 1, %24
  br i1 %25, label %26, label %27

26:                                               ; preds = %21
  store i32 -1001, ptr %2, align 4
  store i32 1, ptr %10, align 4
  br label %81

27:                                               ; preds = %21
  %28 = load i32, ptr %5, align 4, !tbaa !9
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.ntttcp_test, ptr %29, i32 0, i32 8
  store i32 %28, ptr %30, align 8, !tbaa !15
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.ntttcp_test, ptr %31, i32 0, i32 11
  store i32 1, ptr %32, align 8, !tbaa !16
  %33 = load i32, ptr %4, align 4, !tbaa !9
  %34 = add nsw i32 %33, 1
  store i32 %34, ptr %4, align 4, !tbaa !9
  br label %79

35:                                               ; preds = %18
  %36 = load i32, ptr %4, align 4, !tbaa !9
  %37 = icmp eq i32 1, %36
  br i1 %37, label %38, label %67

38:                                               ; preds = %35
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = call i32 @strcmp(ptr noundef %39, ptr noundef @.str.17) #7
  %41 = icmp eq i32 0, %40
  br i1 %41, label %42, label %43

42:                                               ; preds = %38
  br label %64

43:                                               ; preds = %38
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = call i32 @atoi(ptr noundef %44) #7
  store i32 %45, ptr %7, align 4, !tbaa !9
  %46 = call i64 @sysconf(i32 noundef 84) #6
  %47 = trunc i64 %46 to i32
  store i32 %47, ptr %8, align 4, !tbaa !9
  %48 = load i32, ptr %8, align 4, !tbaa !9
  %49 = icmp slt i32 %48, 1
  br i1 %49, label %50, label %51

50:                                               ; preds = %43
  call void @PRINT_ERR(ptr noundef @.str.122)
  br label %15, !llvm.loop !17

51:                                               ; preds = %43
  %52 = load i32, ptr %7, align 4, !tbaa !9
  %53 = icmp slt i32 %52, -1
  br i1 %53, label %59, label %54

54:                                               ; preds = %51
  %55 = load i32, ptr %7, align 4, !tbaa !9
  %56 = load i32, ptr %8, align 4, !tbaa !9
  %57 = sub nsw i32 %56, 1
  %58 = icmp sgt i32 %55, %57
  br i1 %58, label %59, label %60

59:                                               ; preds = %54, %51
  call void @PRINT_ERR(ptr noundef @.str.123)
  store i32 -1001, ptr %2, align 4
  store i32 1, ptr %10, align 4
  br label %81

60:                                               ; preds = %54
  %61 = load i32, ptr %7, align 4, !tbaa !9
  %62 = load ptr, ptr %3, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.ntttcp_test, ptr %62, i32 0, i32 9
  store i32 %61, ptr %63, align 4, !tbaa !19
  br label %64

64:                                               ; preds = %60, %42
  %65 = load i32, ptr %4, align 4, !tbaa !9
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %4, align 4, !tbaa !9
  br label %78

67:                                               ; preds = %35
  %68 = load i32, ptr %4, align 4, !tbaa !9
  %69 = icmp eq i32 2, %68
  br i1 %69, label %70, label %76

70:                                               ; preds = %67
  %71 = load ptr, ptr %6, align 8, !tbaa !5
  %72 = load ptr, ptr %3, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.ntttcp_test, ptr %72, i32 0, i32 10
  store ptr %71, ptr %73, align 8, !tbaa !20
  %74 = load i32, ptr %4, align 4, !tbaa !9
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %4, align 4, !tbaa !9
  br label %77

76:                                               ; preds = %67
  call void @PRINT_ERR(ptr noundef @.str.124)
  store i32 -1001, ptr %2, align 4
  store i32 1, ptr %10, align 4
  br label %81

77:                                               ; preds = %70
  br label %78

78:                                               ; preds = %77, %64
  br label %79

79:                                               ; preds = %78, %27
  br label %15, !llvm.loop !17

80:                                               ; preds = %15
  store i32 0, ptr %2, align 4
  store i32 1, ptr %10, align 4
  br label %81

81:                                               ; preds = %80, %76, %59, %26
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  %82 = load i32, ptr %2, align 4
  ret i32 %82
}

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

; Function Attrs: nounwind
declare noalias ptr @strdup(ptr noundef) #3

; Function Attrs: nounwind
declare ptr @strsep(ptr noundef, ptr noundef) #3

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr noundef nonnull) #4

; Function Attrs: nounwind
declare i64 @sysconf(i32 noundef) #3

declare void @PRINT_ERR(ptr noundef) #5

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

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

!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 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 8}
!12 = !{!"ntttcp_test", !13, i64 0, !13, i64 1, !13, i64 2, !13, i64 3, !13, i64 4, !13, i64 5, !13, i64 6, !6, i64 8, !10, i64 16, !10, i64 20, !6, i64 24, !10, i64 32, !10, i64 36, !13, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56, !14, i64 64, !14, i64 72, !14, i64 80, !14, i64 88, !10, i64 96, !10, i64 100, !10, i64 104, !13, i64 108, !6, i64 112, !6, i64 120, !13, i64 128, !6, i64 136, !13, i64 144, !6, i64 152, !13, i64 160, !6, i64 168, !13, i64 176, !13, i64 177}
!13 = !{!"_Bool", !7, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!12, !10, i64 16}
!16 = !{!12, !10, i64 32}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!12, !10, i64 20}
!20 = !{!12, !6, i64 24}


; 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.17 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.121 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.122 = external hidden unnamed_addr constant [95 x i8], align 1
@.str.123 = external hidden unnamed_addr constant [56 x i8], align 1
@.str.124 = external hidden unnamed_addr constant [51 x i8], align 1

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1001, 1) i32 @process_mappings(ptr nocapture noundef %0) local_unnamed_addr #1 {
  %2 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = tail call noalias ptr @strdup(ptr noundef %4) #7
  store ptr %5, ptr %2, align 8, !tbaa !13
  %6 = call ptr @strsep(ptr noundef nonnull %2, ptr noundef nonnull @.str.121) #7
  %.not28 = icmp eq ptr %6, null
  br i1 %.not28, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %1
  %7 = getelementptr inbounds i8, ptr %0, i64 24
  %8 = getelementptr inbounds i8, ptr %0, i64 20
  %9 = getelementptr inbounds i8, ptr %0, i64 16
  %10 = getelementptr inbounds i8, ptr %0, i64 32
  br label %11

11:                                               ; preds = %.lr.ph, %.backedge
  %12 = phi ptr [ %6, %.lr.ph ], [ %26, %.backedge ]
  %.029 = phi i32 [ 0, %.lr.ph ], [ %.0.be, %.backedge ]
  switch i32 %.029, label %.loopexit.sink.split [
    i32 0, label %13
    i32 1, label %17
    i32 2, label %30
  ]

13:                                               ; preds = %11
  %14 = call i32 @atoi(ptr nocapture noundef %12) #8
  %15 = icmp slt i32 %14, 1
  br i1 %15, label %.loopexit, label %16

16:                                               ; preds = %13
  store i32 %14, ptr %9, align 8, !tbaa !14
  store i32 1, ptr %10, align 8, !tbaa !15
  br label %.backedge

17:                                               ; preds = %11
  %18 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %12, ptr noundef nonnull dereferenceable(1) @.str.17) #8
  %19 = icmp eq i32 %18, 0
  br i1 %19, label %.backedge, label %20

20:                                               ; preds = %17
  %21 = call i32 @atoi(ptr nocapture noundef %12) #8
  %22 = call i64 @sysconf(i32 noundef 84) #7
  %23 = trunc i64 %22 to i32
  %24 = icmp slt i32 %23, 1
  br i1 %24, label %25, label %27

25:                                               ; preds = %20
  call void @PRINT_ERR(ptr noundef nonnull @.str.122) #7
  br label %.backedge

.backedge:                                        ; preds = %16, %30, %17, %29, %25
  %.0.be = phi i32 [ 1, %25 ], [ 1, %16 ], [ 3, %30 ], [ 2, %17 ], [ 2, %29 ]
  %26 = call ptr @strsep(ptr noundef nonnull %2, ptr noundef nonnull @.str.121) #7
  %.not = icmp eq ptr %26, null
  br i1 %.not, label %.loopexit, label %11, !llvm.loop !16

27:                                               ; preds = %20
  %28 = icmp sgt i32 %21, -2
  %.not27 = icmp slt i32 %21, %23
  %or.cond = and i1 %28, %.not27
  br i1 %or.cond, label %29, label %.loopexit.sink.split

29:                                               ; preds = %27
  store i32 %21, ptr %8, align 4, !tbaa !18
  br label %.backedge

30:                                               ; preds = %11
  store ptr %12, ptr %7, align 8, !tbaa !19
  br label %.backedge

.loopexit.sink.split:                             ; preds = %11, %27
  %.str.124.sink = phi ptr [ @.str.123, %27 ], [ @.str.124, %11 ]
  call void @PRINT_ERR(ptr noundef nonnull %.str.124.sink) #7
  br label %.loopexit

.loopexit:                                        ; preds = %13, %.backedge, %.loopexit.sink.split, %1
  %.022 = phi i32 [ 0, %1 ], [ -1001, %.loopexit.sink.split ], [ -1001, %13 ], [ 0, %.backedge ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  ret i32 %.022
}

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias ptr @strdup(ptr nocapture noundef readonly) local_unnamed_addr #3

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

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr nocapture noundef nonnull) local_unnamed_addr #5

; Function Attrs: nounwind
declare i64 @sysconf(i32 noundef) local_unnamed_addr #4

declare void @PRINT_ERR(ptr noundef) local_unnamed_addr #6

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

attributes #0 = { 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 #1 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { inlinehint mustprogress nofree nounwind willreturn memory(read) 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 = { "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) }

!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 = !{!"ntttcp_test", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !7, i64 6, !10, i64 8, !11, i64 16, !11, i64 20, !10, i64 24, !11, i64 32, !11, i64 36, !7, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56, !12, i64 64, !12, i64 72, !12, i64 80, !12, i64 88, !11, i64 96, !11, i64 100, !11, i64 104, !7, i64 108, !10, i64 112, !10, i64 120, !7, i64 128, !10, i64 136, !7, i64 144, !10, i64 152, !7, i64 160, !10, i64 168, !7, i64 176, !7, i64 177}
!7 = !{!"_Bool", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!"long", !8, i64 0}
!13 = !{!10, !10, i64 0}
!14 = !{!6, !11, i64 16}
!15 = !{!6, !11, i64 32}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!6, !11, i64 20}
!19 = !{!6, !10, i64 24}


; Effective O3 passes: GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass