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

; 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_endpoint = type { i32, ptr, i32, i32, %struct.timeval, %struct.timeval, i32, i32, i8, ptr, ptr, ptr, i8, ptr, i32, [8 x i32] }
%struct.timeval = type { i64, i64 }
%struct.ntttcp_stream_server = type { ptr, i32, i32, ptr, i32, i64, i8, i8, i8, i8, i8, i32, i32, %struct.fd_set, %struct.fd_set, i32, i64 }
%struct.fd_set = type { [16 x i64] }
%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 }

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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

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

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

13:                                               ; preds = %1
  store ptr null, ptr %2, align 8
  store i32 1, ptr %6, align 4
  br label %72

14:                                               ; preds = %1
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 8 %15, i8 0, i64 328, i1 false)
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.ntttcp_stream_server, ptr %17, i32 0, i32 0
  store ptr %16, ptr %18, align 8, !tbaa !15
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.ntttcp_test, ptr %19, i32 0, i32 14
  %21 = load i32, ptr %20, align 4, !tbaa !18
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.ntttcp_stream_server, ptr %22, i32 0, i32 1
  store i32 %21, ptr %23, align 8, !tbaa !20
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.ntttcp_test, ptr %24, i32 0, i32 15
  %26 = load i32, ptr %25, align 8, !tbaa !21
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.ntttcp_stream_server, ptr %27, i32 0, i32 2
  store i32 %26, ptr %28, align 4, !tbaa !22
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.ntttcp_test, ptr %29, i32 0, i32 10
  %31 = load ptr, ptr %30, align 8, !tbaa !23
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.ntttcp_stream_server, ptr %32, i32 0, i32 3
  store ptr %31, ptr %33, align 8, !tbaa !24
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.ntttcp_test, ptr %34, i32 0, i32 18
  %36 = load i64, ptr %35, align 8, !tbaa !25
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.ntttcp_stream_server, ptr %37, i32 0, i32 5
  store i64 %36, ptr %38, align 8, !tbaa !26
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.ntttcp_test, ptr %39, i32 0, i32 35
  %41 = load i8, ptr %40, align 1, !tbaa !27, !range !28, !noundef !29
  %42 = trunc i8 %41 to i1
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.ntttcp_stream_server, ptr %43, i32 0, i32 9
  %45 = zext i1 %42 to i8
  store i8 %45, ptr %44, align 1, !tbaa !30
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.ntttcp_stream_server, ptr %46, i32 0, i32 6
  store i8 0, ptr %47, align 8, !tbaa !31
  %48 = load ptr, ptr %5, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.ntttcp_test, ptr %48, i32 0, i32 13
  %50 = load i8, ptr %49, align 8, !tbaa !32, !range !28, !noundef !29
  %51 = trunc i8 %50 to i1
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.ntttcp_stream_server, ptr %52, i32 0, i32 7
  %54 = zext i1 %51 to i8
  store i8 %54, ptr %53, align 1, !tbaa !33
  %55 = load ptr, ptr %5, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.ntttcp_test, ptr %55, i32 0, i32 23
  %57 = load i32, ptr %56, align 4, !tbaa !34
  %58 = icmp eq i32 %57, 0
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.ntttcp_stream_server, ptr %59, i32 0, i32 8
  %61 = zext i1 %58 to i8
  store i8 %61, ptr %60, align 2, !tbaa !35
  %62 = load ptr, ptr %5, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.ntttcp_test, ptr %62, i32 0, i32 5
  %64 = load i8, ptr %63, align 1, !tbaa !36, !range !28, !noundef !29
  %65 = trunc i8 %64 to i1
  %66 = load ptr, ptr %4, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.ntttcp_stream_server, ptr %66, i32 0, i32 10
  %68 = zext i1 %65 to i8
  store i8 %68, ptr %67, align 4, !tbaa !37
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.ntttcp_stream_server, ptr %69, i32 0, i32 16
  store i64 0, ptr %70, align 8, !tbaa !38
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %71, ptr %2, align 8
  store i32 1, ptr %6, align 4
  br label %72

72:                                               ; preds = %14, %13
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  %73 = load ptr, ptr %2, align 8
  ret ptr %73
}

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

!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, !6, i64 8}
!10 = !{!"ntttcp_test_endpoint", !11, i64 0, !6, i64 8, !11, i64 16, !11, i64 20, !12, i64 24, !12, i64 40, !11, i64 56, !11, i64 60, !14, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !14, i64 96, !6, i64 104, !11, i64 112, !7, i64 116}
!11 = !{!"int", !7, i64 0}
!12 = !{!"timeval", !13, i64 0, !13, i64 8}
!13 = !{!"long", !7, i64 0}
!14 = !{!"_Bool", !7, i64 0}
!15 = !{!16, !6, i64 0}
!16 = !{!"ntttcp_stream_server", !6, i64 0, !11, i64 8, !11, i64 12, !6, i64 16, !11, i64 24, !13, i64 32, !14, i64 40, !14, i64 41, !14, i64 42, !14, i64 43, !14, i64 44, !11, i64 48, !11, i64 52, !17, i64 56, !17, i64 184, !11, i64 312, !13, i64 320}
!17 = !{!"", !7, i64 0}
!18 = !{!19, !11, i64 44}
!19 = !{!"ntttcp_test", !14, i64 0, !14, i64 1, !14, i64 2, !14, i64 3, !14, i64 4, !14, i64 5, !14, i64 6, !6, i64 8, !11, i64 16, !11, i64 20, !6, i64 24, !11, i64 32, !11, i64 36, !14, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56, !13, i64 64, !13, i64 72, !13, i64 80, !13, i64 88, !11, i64 96, !11, i64 100, !11, i64 104, !14, i64 108, !6, i64 112, !6, i64 120, !14, i64 128, !6, i64 136, !14, i64 144, !6, i64 152, !14, i64 160, !6, i64 168, !14, i64 176, !14, i64 177}
!20 = !{!16, !11, i64 8}
!21 = !{!19, !11, i64 48}
!22 = !{!16, !11, i64 12}
!23 = !{!19, !6, i64 24}
!24 = !{!16, !6, i64 16}
!25 = !{!19, !13, i64 64}
!26 = !{!16, !13, i64 32}
!27 = !{!19, !14, i64 177}
!28 = !{i8 0, i8 2}
!29 = !{}
!30 = !{!16, !14, i64 43}
!31 = !{!16, !14, i64 40}
!32 = !{!19, !14, i64 40}
!33 = !{!16, !14, i64 41}
!34 = !{!19, !11, i64 100}
!35 = !{!16, !14, i64 42}
!36 = !{!19, !14, i64 5}
!37 = !{!16, !14, i64 44}
!38 = !{!16, !13, i64 320}


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

; Function Attrs: mustprogress nofree nounwind willreturn memory(readwrite, argmem: read) uwtable
define dso_local noalias noundef ptr @new_ntttcp_server_stream(ptr noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 8
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %calloc = tail call dereferenceable_or_null(328) ptr @calloc(i64 1, i64 328)
  %.not = icmp eq ptr %calloc, null
  br i1 %.not, label %28, label %4

4:                                                ; preds = %1
  store ptr %0, ptr %calloc, align 8, !tbaa !14
  %5 = getelementptr inbounds i8, ptr %3, i64 44
  %6 = getelementptr inbounds i8, ptr %calloc, i64 8
  %7 = load <2 x i32>, ptr %5, align 4, !tbaa !17
  store <2 x i32> %7, ptr %6, align 8, !tbaa !17
  %8 = getelementptr inbounds i8, ptr %3, i64 24
  %9 = load ptr, ptr %8, align 8, !tbaa !18
  %10 = getelementptr inbounds i8, ptr %calloc, i64 16
  store ptr %9, ptr %10, align 8, !tbaa !20
  %11 = getelementptr inbounds i8, ptr %3, i64 64
  %12 = load i64, ptr %11, align 8, !tbaa !21
  %13 = getelementptr inbounds i8, ptr %calloc, i64 32
  store i64 %12, ptr %13, align 8, !tbaa !22
  %14 = getelementptr inbounds i8, ptr %3, i64 177
  %15 = load i8, ptr %14, align 1, !tbaa !23, !range !24, !noundef !25
  %16 = getelementptr inbounds i8, ptr %calloc, i64 43
  store i8 %15, ptr %16, align 1, !tbaa !26
  %17 = getelementptr inbounds i8, ptr %3, i64 40
  %18 = load i8, ptr %17, align 8, !tbaa !27, !range !24, !noundef !25
  %19 = getelementptr inbounds i8, ptr %calloc, i64 41
  store i8 %18, ptr %19, align 1, !tbaa !28
  %20 = getelementptr inbounds i8, ptr %3, i64 100
  %21 = load i32, ptr %20, align 4, !tbaa !29
  %22 = icmp eq i32 %21, 0
  %23 = getelementptr inbounds i8, ptr %calloc, i64 42
  %24 = zext i1 %22 to i8
  store i8 %24, ptr %23, align 2, !tbaa !30
  %25 = getelementptr inbounds i8, ptr %3, i64 5
  %26 = load i8, ptr %25, align 1, !tbaa !31, !range !24, !noundef !25
  %27 = getelementptr inbounds i8, ptr %calloc, i64 44
  store i8 %26, ptr %27, align 4, !tbaa !32
  br label %28

28:                                               ; preds = %1, %4
  ret ptr %calloc
}

; Function Attrs: nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nofree nounwind willreturn memory(readwrite, argmem: 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 #1 = { nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }

!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_endpoint", !7, i64 0, !10, i64 8, !7, i64 16, !7, i64 20, !11, i64 24, !11, i64 40, !7, i64 56, !7, i64 60, !13, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !13, i64 96, !10, i64 104, !7, i64 112, !8, i64 116}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"timeval", !12, i64 0, !12, i64 8}
!12 = !{!"long", !8, i64 0}
!13 = !{!"_Bool", !8, i64 0}
!14 = !{!15, !10, i64 0}
!15 = !{!"ntttcp_stream_server", !10, i64 0, !7, i64 8, !7, i64 12, !10, i64 16, !7, i64 24, !12, i64 32, !13, i64 40, !13, i64 41, !13, i64 42, !13, i64 43, !13, i64 44, !7, i64 48, !7, i64 52, !16, i64 56, !16, i64 184, !7, i64 312, !12, i64 320}
!16 = !{!"", !8, i64 0}
!17 = !{!7, !7, i64 0}
!18 = !{!19, !10, i64 24}
!19 = !{!"ntttcp_test", !13, i64 0, !13, i64 1, !13, i64 2, !13, i64 3, !13, i64 4, !13, i64 5, !13, i64 6, !10, i64 8, !7, i64 16, !7, i64 20, !10, i64 24, !7, i64 32, !7, i64 36, !13, i64 40, !7, i64 44, !7, i64 48, !7, i64 52, !7, i64 56, !12, i64 64, !12, i64 72, !12, i64 80, !12, i64 88, !7, i64 96, !7, i64 100, !7, i64 104, !13, i64 108, !10, i64 112, !10, i64 120, !13, i64 128, !10, i64 136, !13, i64 144, !10, i64 152, !13, i64 160, !10, i64 168, !13, i64 176, !13, i64 177}
!20 = !{!15, !10, i64 16}
!21 = !{!19, !12, i64 64}
!22 = !{!15, !12, i64 32}
!23 = !{!19, !13, i64 177}
!24 = !{i8 0, i8 2}
!25 = !{}
!26 = !{!15, !13, i64 43}
!27 = !{!19, !13, i64 40}
!28 = !{!15, !13, i64 41}
!29 = !{!19, !7, i64 100}
!30 = !{!15, !13, i64 42}
!31 = !{!19, !13, i64 5}
!32 = !{!15, !13, i64 44}


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