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

; 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_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 }
%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] }

@.str.6 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [34 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

declare void @PRINT_ERR(ptr noundef) #1

; Function Attrs: nounwind
declare i32 @asprintf(ptr noundef, ptr noundef, ...) #2

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

declare void @PRINT_INFO_FREE(ptr noundef) #1

; Function Attrs: nounwind
declare i32 @pthread_create(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

declare i32 @sleep(i32 noundef) #1

declare void @run_ntttcp_throughput_management(ptr noundef) #1

declare i32 @pthread_join(i64 noundef, ptr noundef) #1

declare i32 @process_test_results(ptr noundef) #1

declare void @print_test_results(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @run_ntttcp_receiver(ptr noundef %0) #3 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %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
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 0, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.ntttcp_test_endpoint, ptr %13, i32 0, i32 1
  %15 = load ptr, ptr %14, align 8, !tbaa !11
  store ptr %15, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  store ptr null, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.ntttcp_test, ptr %16, i32 0, i32 14
  %18 = load i32, ptr %17, align 4, !tbaa !16
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.ntttcp_test, ptr %19, i32 0, i32 10
  %21 = load ptr, ptr %20, align 8, !tbaa !18
  %22 = call zeroext i1 @check_is_ip_addr_valid_local(i32 noundef %18, ptr noundef %21)
  br i1 %22, label %24, label %23

23:                                               ; preds = %1
  call void @PRINT_ERR(ptr noundef @.str.16)
  store i32 -1001, ptr %2, align 4
  store i32 1, ptr %11, align 4
  br label %203

24:                                               ; preds = %1
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %25

25:                                               ; preds = %75, %24
  %26 = load i32, ptr %7, align 4, !tbaa !9
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.ntttcp_test, ptr %27, i32 0, i32 8
  %29 = load i32, ptr %28, align 8, !tbaa !19
  %30 = icmp ult i32 %26, %29
  br i1 %30, label %31, label %78

31:                                               ; preds = %25
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.ntttcp_test_endpoint, ptr %32, i32 0, i32 10
  %34 = load ptr, ptr %33, align 8, !tbaa !20
  %35 = load i32, ptr %7, align 4, !tbaa !9
  %36 = zext i32 %35 to i64
  %37 = getelementptr inbounds ptr, ptr %34, i64 %36
  %38 = load ptr, ptr %37, align 8, !tbaa !5
  store ptr %38, ptr %9, align 8, !tbaa !5
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.ntttcp_test, ptr %39, i32 0, i32 16
  %41 = load i32, ptr %40, align 4, !tbaa !21
  %42 = load i32, ptr %7, align 4, !tbaa !9
  %43 = add i32 %41, %42
  %44 = load ptr, ptr %9, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.ntttcp_stream_server, ptr %44, i32 0, i32 4
  store i32 %43, ptr %45, align 8, !tbaa !22
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.ntttcp_test, ptr %46, i32 0, i32 15
  %48 = load i32, ptr %47, align 8, !tbaa !25
  %49 = icmp eq i32 %48, 1
  br i1 %49, label %50, label %59

50:                                               ; preds = %31
  %51 = load ptr, ptr %3, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.ntttcp_test_endpoint, ptr %51, i32 0, i32 11
  %53 = load ptr, ptr %52, align 8, !tbaa !26
  %54 = load i32, ptr %7, align 4, !tbaa !9
  %55 = zext i32 %54 to i64
  %56 = getelementptr inbounds i64, ptr %53, i64 %55
  %57 = load ptr, ptr %9, align 8, !tbaa !5
  %58 = call i32 @pthread_create(ptr noundef %56, ptr noundef null, ptr noundef @run_ntttcp_receiver_tcp_stream, ptr noundef %57) #4
  store i32 %58, ptr %10, align 4, !tbaa !9
  br label %68

59:                                               ; preds = %31
  %60 = load ptr, ptr %3, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.ntttcp_test_endpoint, ptr %60, i32 0, i32 11
  %62 = load ptr, ptr %61, align 8, !tbaa !26
  %63 = load i32, ptr %7, align 4, !tbaa !9
  %64 = zext i32 %63 to i64
  %65 = getelementptr inbounds i64, ptr %62, i64 %64
  %66 = load ptr, ptr %9, align 8, !tbaa !5
  %67 = call i32 @pthread_create(ptr noundef %65, ptr noundef null, ptr noundef @run_ntttcp_receiver_udp_stream, ptr noundef %66) #4
  store i32 %67, ptr %10, align 4, !tbaa !9
  br label %68

68:                                               ; preds = %59, %50
  %69 = load i32, ptr %10, align 4, !tbaa !9
  %70 = icmp ne i32 %69, 0
  br i1 %70, label %71, label %72

71:                                               ; preds = %68
  call void @PRINT_ERR(ptr noundef @.str.17)
  store i32 -1003, ptr %4, align 4, !tbaa !9
  br label %75

72:                                               ; preds = %68
  %73 = load i32, ptr %8, align 4, !tbaa !9
  %74 = add i32 %73, 1
  store i32 %74, ptr %8, align 4, !tbaa !9
  br label %75

75:                                               ; preds = %72, %71
  %76 = load i32, ptr %7, align 4, !tbaa !9
  %77 = add i32 %76, 1
  store i32 %77, ptr %7, align 4, !tbaa !9
  br label %25, !llvm.loop !27

78:                                               ; preds = %25
  %79 = load ptr, ptr %5, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.ntttcp_test, ptr %79, i32 0, i32 13
  %81 = load i8, ptr %80, align 8, !tbaa !29, !range !30, !noundef !31
  %82 = trunc i8 %81 to i1
  %83 = zext i1 %82 to i32
  %84 = icmp eq i32 %83, 0
  br i1 %84, label %85, label %120

85:                                               ; preds = %78
  %86 = load ptr, ptr %3, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.ntttcp_test_endpoint, ptr %86, i32 0, i32 10
  %88 = load ptr, ptr %87, align 8, !tbaa !20
  %89 = load ptr, ptr %5, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.ntttcp_test, ptr %89, i32 0, i32 8
  %91 = load i32, ptr %90, align 8, !tbaa !19
  %92 = zext i32 %91 to i64
  %93 = getelementptr inbounds ptr, ptr %88, i64 %92
  %94 = load ptr, ptr %93, align 8, !tbaa !5
  store ptr %94, ptr %9, align 8, !tbaa !5
  %95 = load ptr, ptr %5, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.ntttcp_test, ptr %95, i32 0, i32 16
  %97 = load i32, ptr %96, align 4, !tbaa !21
  %98 = sub i32 %97, 1
  %99 = load ptr, ptr %9, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.ntttcp_stream_server, ptr %99, i32 0, i32 4
  store i32 %98, ptr %100, align 8, !tbaa !22
  %101 = load ptr, ptr %9, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.ntttcp_stream_server, ptr %101, i32 0, i32 2
  store i32 1, ptr %102, align 4, !tbaa !32
  %103 = load ptr, ptr %9, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.ntttcp_stream_server, ptr %103, i32 0, i32 6
  store i8 1, ptr %104, align 8, !tbaa !33
  %105 = load ptr, ptr %3, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.ntttcp_test_endpoint, ptr %105, i32 0, i32 11
  %107 = load ptr, ptr %106, align 8, !tbaa !26
  %108 = load i32, ptr %7, align 4, !tbaa !9
  %109 = zext i32 %108 to i64
  %110 = getelementptr inbounds i64, ptr %107, i64 %109
  %111 = load ptr, ptr %3, align 8, !tbaa !5
  %112 = call i32 @pthread_create(ptr noundef %110, ptr noundef null, ptr noundef @create_receiver_sync_socket, ptr noundef %111) #4
  store i32 %112, ptr %10, align 4, !tbaa !9
  %113 = load i32, ptr %10, align 4, !tbaa !9
  %114 = icmp ne i32 %113, 0
  br i1 %114, label %115, label %116

115:                                              ; preds = %85
  call void @PRINT_ERR(ptr noundef @.str.17)
  store i32 -1003, ptr %4, align 4, !tbaa !9
  br label %119

116:                                              ; preds = %85
  %117 = load i32, ptr %8, align 4, !tbaa !9
  %118 = add i32 %117, 1
  store i32 %118, ptr %8, align 4, !tbaa !9
  br label %119

119:                                              ; preds = %116, %115
  br label %120

120:                                              ; preds = %119, %78
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %121 = load i32, ptr %8, align 4, !tbaa !9
  %122 = call i32 (ptr, ptr, ...) @asprintf(ptr noundef %6, ptr noundef @.str.9, i32 noundef %121) #4
  store i32 %122, ptr %12, align 4, !tbaa !9
  %123 = load i32, ptr %12, align 4, !tbaa !9
  %124 = icmp slt i32 %123, 0
  br i1 %124, label %125, label %126

125:                                              ; preds = %120
  call void @PRINT_ERR(ptr noundef @.str.6)
  br label %126

126:                                              ; preds = %125, %120
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  %127 = load ptr, ptr %6, align 8, !tbaa !5
  call void @PRINT_INFO_FREE(ptr noundef %127)
  br label %128

128:                                              ; preds = %180, %126
  br label %129

129:                                              ; preds = %128
  call void @wait_light_on()
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %130

130:                                              ; preds = %144, %129
  %131 = load i32, ptr %7, align 4, !tbaa !9
  %132 = load i32, ptr %8, align 4, !tbaa !9
  %133 = icmp ult i32 %131, %132
  br i1 %133, label %134, label %147

134:                                              ; preds = %130
  %135 = load ptr, ptr %3, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.ntttcp_test_endpoint, ptr %135, i32 0, i32 10
  %137 = load ptr, ptr %136, align 8, !tbaa !20
  %138 = load i32, ptr %7, align 4, !tbaa !9
  %139 = zext i32 %138 to i64
  %140 = getelementptr inbounds ptr, ptr %137, i64 %139
  %141 = load ptr, ptr %140, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.ntttcp_stream_server, ptr %141, i32 0, i32 16
  %143 = atomicrmw xchg ptr %142, i64 0 seq_cst, align 8
  br label %144

144:                                              ; preds = %134
  %145 = load i32, ptr %7, align 4, !tbaa !9
  %146 = add i32 %145, 1
  store i32 %146, ptr %7, align 4, !tbaa !9
  br label %130, !llvm.loop !34

147:                                              ; preds = %130
  %148 = load ptr, ptr %3, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct.ntttcp_test_endpoint, ptr %148, i32 0, i32 3
  %150 = load i32, ptr %149, align 4, !tbaa !35
  %151 = icmp eq i32 %150, 0
  br i1 %151, label %152, label %155

152:                                              ; preds = %147
  %153 = call i32 @sleep(i32 noundef -1)
  %154 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %154, ptr %2, align 4
  store i32 1, ptr %11, align 4
  br label %203

155:                                              ; preds = %147
  %156 = load ptr, ptr %3, align 8, !tbaa !5
  call void @run_ntttcp_throughput_management(ptr noundef %156)
  %157 = load ptr, ptr %3, align 8, !tbaa !5
  %158 = call i32 @process_test_results(ptr noundef %157)
  %159 = load ptr, ptr %3, align 8, !tbaa !5
  call void @print_test_results(ptr noundef %159)
  %160 = load ptr, ptr %3, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.ntttcp_test_endpoint, ptr %160, i32 0, i32 14
  store i32 0, ptr %161, align 8, !tbaa !36
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %162

162:                                              ; preds = %171, %155
  %163 = load i32, ptr %7, align 4, !tbaa !9
  %164 = icmp ult i32 %163, 8
  br i1 %164, label %165, label %174

165:                                              ; preds = %162
  %166 = load ptr, ptr %3, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.ntttcp_test_endpoint, ptr %166, i32 0, i32 15
  %168 = load i32, ptr %7, align 4, !tbaa !9
  %169 = zext i32 %168 to i64
  %170 = getelementptr inbounds [8 x i32], ptr %167, i64 0, i64 %169
  store i32 -1, ptr %170, align 4, !tbaa !9
  br label %171

171:                                              ; preds = %165
  %172 = load i32, ptr %7, align 4, !tbaa !9
  %173 = add i32 %172, 1
  store i32 %173, ptr %7, align 4, !tbaa !9
  br label %162, !llvm.loop !37

174:                                              ; preds = %162
  %175 = load ptr, ptr %3, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.ntttcp_test_endpoint, ptr %175, i32 0, i32 8
  %177 = load i8, ptr %176, align 8, !tbaa !38, !range !30, !noundef !31
  %178 = trunc i8 %177 to i1
  br i1 %178, label %179, label %180

179:                                              ; preds = %174
  br label %181

180:                                              ; preds = %174
  br label %128

181:                                              ; preds = %179
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %182

182:                                              ; preds = %198, %181
  %183 = load i32, ptr %7, align 4, !tbaa !9
  %184 = load i32, ptr %8, align 4, !tbaa !9
  %185 = icmp ult i32 %183, %184
  br i1 %185, label %186, label %201

186:                                              ; preds = %182
  %187 = load ptr, ptr %3, align 8, !tbaa !5
  %188 = getelementptr inbounds %struct.ntttcp_test_endpoint, ptr %187, i32 0, i32 11
  %189 = load ptr, ptr %188, align 8, !tbaa !26
  %190 = load i32, ptr %7, align 4, !tbaa !9
  %191 = zext i32 %190 to i64
  %192 = getelementptr inbounds i64, ptr %189, i64 %191
  %193 = load i64, ptr %192, align 8, !tbaa !39
  %194 = call i32 @pthread_join(i64 noundef %193, ptr noundef null)
  %195 = icmp ne i32 %194, 0
  br i1 %195, label %196, label %197

196:                                              ; preds = %186
  call void @PRINT_ERR(ptr noundef @.str.18)
  br label %198

197:                                              ; preds = %186
  br label %198

198:                                              ; preds = %197, %196
  %199 = load i32, ptr %7, align 4, !tbaa !9
  %200 = add i32 %199, 1
  store i32 %200, ptr %7, align 4, !tbaa !9
  br label %182, !llvm.loop !40

201:                                              ; preds = %182
  %202 = load i32, ptr %4, align 4, !tbaa !9
  store i32 %202, ptr %2, align 4
  store i32 1, ptr %11, align 4
  br label %203

203:                                              ; preds = %201, %152, %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  %204 = load i32, ptr %2, align 4
  ret i32 %204
}

declare zeroext i1 @check_is_ip_addr_valid_local(i32 noundef, ptr noundef) #1

declare ptr @run_ntttcp_receiver_tcp_stream(ptr noundef) #1

declare ptr @run_ntttcp_receiver_udp_stream(ptr noundef) #1

declare ptr @create_receiver_sync_socket(ptr noundef) #1

declare void @wait_light_on() #1

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


; 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.6 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [34 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

declare void @PRINT_ERR(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind
declare i32 @asprintf(ptr noundef, ptr noundef, ...) local_unnamed_addr #2

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

declare void @PRINT_INFO_FREE(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind
declare i32 @pthread_create(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @sleep(i32 noundef) local_unnamed_addr #1

declare void @run_ntttcp_throughput_management(ptr noundef) local_unnamed_addr #1

declare i32 @pthread_join(i64 noundef, ptr noundef) local_unnamed_addr #1

declare i32 @process_test_results(ptr noundef) local_unnamed_addr #1

declare void @print_test_results(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1003, 1) i32 @run_ntttcp_receiver(ptr noundef %0) local_unnamed_addr #3 {
  %2 = alloca ptr, align 8
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #5
  store ptr null, ptr %2, align 8, !tbaa !14
  %5 = getelementptr inbounds i8, ptr %4, i64 44
  %6 = load i32, ptr %5, align 4, !tbaa !15
  %7 = getelementptr inbounds i8, ptr %4, i64 24
  %8 = load ptr, ptr %7, align 8, !tbaa !17
  %9 = tail call zeroext i1 @check_is_ip_addr_valid_local(i32 noundef %6, ptr noundef %8) #5
  br i1 %9, label %.preheader67, label %16

.preheader67:                                     ; preds = %1
  %10 = getelementptr inbounds i8, ptr %4, i64 16
  %11 = load i32, ptr %10, align 8, !tbaa !18
  %.not83 = icmp eq i32 %11, 0
  br i1 %.not83, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader67
  %12 = getelementptr inbounds i8, ptr %0, i64 80
  %13 = getelementptr inbounds i8, ptr %4, i64 52
  %14 = getelementptr inbounds i8, ptr %4, i64 48
  %15 = getelementptr inbounds i8, ptr %0, i64 88
  br label %17

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

17:                                               ; preds = %.lr.ph, %33
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %33 ]
  %.05770 = phi i32 [ 0, %.lr.ph ], [ %.1, %33 ]
  %.06168 = phi i32 [ 0, %.lr.ph ], [ %.162, %33 ]
  %18 = load ptr, ptr %12, align 8, !tbaa !19
  %19 = getelementptr inbounds ptr, ptr %18, i64 %indvars.iv
  %20 = load ptr, ptr %19, align 8, !tbaa !14
  %21 = load i32, ptr %13, align 4, !tbaa !20
  %22 = trunc nuw i64 %indvars.iv to i32
  %23 = add i32 %21, %22
  %24 = getelementptr inbounds i8, ptr %20, i64 24
  store i32 %23, ptr %24, align 8, !tbaa !21
  %25 = load i32, ptr %14, align 8, !tbaa !24
  %26 = icmp eq i32 %25, 1
  %27 = load ptr, ptr %15, align 8, !tbaa !25
  %28 = getelementptr inbounds i64, ptr %27, i64 %indvars.iv
  %run_ntttcp_receiver_tcp_stream.run_ntttcp_receiver_udp_stream = select i1 %26, ptr @run_ntttcp_receiver_tcp_stream, ptr @run_ntttcp_receiver_udp_stream
  %29 = tail call i32 @pthread_create(ptr noundef %28, ptr noundef null, ptr noundef nonnull %run_ntttcp_receiver_tcp_stream.run_ntttcp_receiver_udp_stream, ptr noundef nonnull %20) #5
  %.not66 = icmp eq i32 %29, 0
  br i1 %.not66, label %31, label %30

30:                                               ; preds = %17
  tail call void @PRINT_ERR(ptr noundef nonnull @.str.17) #5
  br label %33

31:                                               ; preds = %17
  %32 = add i32 %.05770, 1
  br label %33

33:                                               ; preds = %31, %30
  %.162 = phi i32 [ -1003, %30 ], [ %.06168, %31 ]
  %.1 = phi i32 [ %.05770, %30 ], [ %32, %31 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %34 = load i32, ptr %10, align 8, !tbaa !18
  %35 = zext i32 %34 to i64
  %36 = icmp ult i64 %indvars.iv.next, %35
  br i1 %36, label %17, label %._crit_edge.loopexit, !llvm.loop !26

._crit_edge.loopexit:                             ; preds = %33
  %37 = zext i32 %34 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader67
  %.061.lcssa = phi i32 [ 0, %.preheader67 ], [ %.162, %._crit_edge.loopexit ]
  %.058.lcssa = phi i64 [ 0, %.preheader67 ], [ %indvars.iv.next, %._crit_edge.loopexit ]
  %.057.lcssa = phi i32 [ 0, %.preheader67 ], [ %.1, %._crit_edge.loopexit ]
  %.lcssa = phi i64 [ 0, %.preheader67 ], [ %37, %._crit_edge.loopexit ]
  %38 = getelementptr inbounds i8, ptr %4, i64 40
  %39 = load i8, ptr %38, align 8, !tbaa !28, !range !29, !noundef !30
  %40 = icmp eq i8 %39, 0
  br i1 %40, label %41, label %59

41:                                               ; preds = %._crit_edge
  %42 = getelementptr inbounds i8, ptr %0, i64 80
  %43 = load ptr, ptr %42, align 8, !tbaa !19
  %44 = getelementptr inbounds ptr, ptr %43, i64 %.lcssa
  %45 = load ptr, ptr %44, align 8, !tbaa !14
  %46 = getelementptr inbounds i8, ptr %4, i64 52
  %47 = load i32, ptr %46, align 4, !tbaa !20
  %48 = add i32 %47, -1
  %49 = getelementptr inbounds i8, ptr %45, i64 24
  store i32 %48, ptr %49, align 8, !tbaa !21
  %50 = getelementptr inbounds i8, ptr %45, i64 12
  store i32 1, ptr %50, align 4, !tbaa !31
  %51 = getelementptr inbounds i8, ptr %45, i64 40
  store i8 1, ptr %51, align 8, !tbaa !32
  %52 = getelementptr inbounds i8, ptr %0, i64 88
  %53 = load ptr, ptr %52, align 8, !tbaa !25
  %54 = getelementptr inbounds i64, ptr %53, i64 %.058.lcssa
  %55 = tail call i32 @pthread_create(ptr noundef %54, ptr noundef null, ptr noundef nonnull @create_receiver_sync_socket, ptr noundef nonnull %0) #5
  %.not = icmp eq i32 %55, 0
  br i1 %.not, label %57, label %56

56:                                               ; preds = %41
  tail call void @PRINT_ERR(ptr noundef nonnull @.str.17) #5
  br label %59

57:                                               ; preds = %41
  %58 = add i32 %.057.lcssa, 1
  br label %59

59:                                               ; preds = %56, %57, %._crit_edge
  %.263 = phi i32 [ -1003, %56 ], [ %.061.lcssa, %57 ], [ %.061.lcssa, %._crit_edge ]
  %.2 = phi i32 [ %.057.lcssa, %56 ], [ %58, %57 ], [ %.057.lcssa, %._crit_edge ]
  %60 = call i32 (ptr, ptr, ...) @asprintf(ptr noundef nonnull %2, ptr noundef nonnull @.str.9, i32 noundef %.2) #5
  %61 = icmp slt i32 %60, 0
  br i1 %61, label %62, label %63

62:                                               ; preds = %59
  call void @PRINT_ERR(ptr noundef nonnull @.str.6) #5
  br label %63

63:                                               ; preds = %62, %59
  %64 = load ptr, ptr %2, align 8, !tbaa !14
  call void @PRINT_INFO_FREE(ptr noundef %64) #5
  %.not84 = icmp eq i32 %.2, 0
  %65 = getelementptr inbounds i8, ptr %0, i64 80
  %66 = getelementptr inbounds i8, ptr %0, i64 20
  %67 = getelementptr inbounds i8, ptr %0, i64 112
  %68 = getelementptr i8, ptr %0, i64 116
  %69 = getelementptr inbounds i8, ptr %0, i64 64
  br i1 %.not84, label %.split, label %.lr.ph76.us.preheader

.lr.ph76.us.preheader:                            ; preds = %63
  %wide.trip.count = zext i32 %.2 to i64
  %xtraiter = and i64 %wide.trip.count, 3
  %70 = icmp ult i32 %.2, 4
  %unroll_iter = and i64 %wide.trip.count, 4294967292
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.lr.ph76.us

.lr.ph76.us:                                      ; preds = %.lr.ph76.us.preheader, %71
  call void @wait_light_on() #5
  br i1 %70, label %._crit_edge77.us.unr-lcssa, label %.lr.ph76.us.new

71:                                               ; preds = %._crit_edge77.us
  call void @run_ntttcp_throughput_management(ptr noundef nonnull %0) #5
  %72 = call i32 @process_test_results(ptr noundef nonnull %0) #5
  call void @print_test_results(ptr noundef nonnull %0) #5
  store i32 0, ptr %67, align 8, !tbaa !33
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(32) %68, i8 -1, i64 32, i1 false), !tbaa !34
  %73 = load i8, ptr %69, align 8, !tbaa !35, !range !29, !noundef !30
  %74 = trunc nuw i8 %73 to i1
  br i1 %74, label %.preheader, label %.lr.ph76.us

.lr.ph76.us.new:                                  ; preds = %.lr.ph76.us, %.lr.ph76.us.new
  %indvars.iv91 = phi i64 [ %indvars.iv.next92.3, %.lr.ph76.us.new ], [ 0, %.lr.ph76.us ]
  %niter = phi i64 [ %niter.next.3, %.lr.ph76.us.new ], [ 0, %.lr.ph76.us ]
  %75 = load ptr, ptr %65, align 8, !tbaa !19
  %76 = getelementptr inbounds ptr, ptr %75, i64 %indvars.iv91
  %77 = load ptr, ptr %76, align 8, !tbaa !14
  %78 = getelementptr inbounds i8, ptr %77, i64 320
  %79 = atomicrmw xchg ptr %78, i64 0 seq_cst, align 8
  %indvars.iv.next92 = or disjoint i64 %indvars.iv91, 1
  %80 = load ptr, ptr %65, align 8, !tbaa !19
  %81 = getelementptr inbounds ptr, ptr %80, i64 %indvars.iv.next92
  %82 = load ptr, ptr %81, align 8, !tbaa !14
  %83 = getelementptr inbounds i8, ptr %82, i64 320
  %84 = atomicrmw xchg ptr %83, i64 0 seq_cst, align 8
  %indvars.iv.next92.1 = or disjoint i64 %indvars.iv91, 2
  %85 = load ptr, ptr %65, align 8, !tbaa !19
  %86 = getelementptr inbounds ptr, ptr %85, i64 %indvars.iv.next92.1
  %87 = load ptr, ptr %86, align 8, !tbaa !14
  %88 = getelementptr inbounds i8, ptr %87, i64 320
  %89 = atomicrmw xchg ptr %88, i64 0 seq_cst, align 8
  %indvars.iv.next92.2 = or disjoint i64 %indvars.iv91, 3
  %90 = load ptr, ptr %65, align 8, !tbaa !19
  %91 = getelementptr inbounds ptr, ptr %90, i64 %indvars.iv.next92.2
  %92 = load ptr, ptr %91, align 8, !tbaa !14
  %93 = getelementptr inbounds i8, ptr %92, i64 320
  %94 = atomicrmw xchg ptr %93, i64 0 seq_cst, align 8
  %indvars.iv.next92.3 = add nuw nsw i64 %indvars.iv91, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge77.us.unr-lcssa, label %.lr.ph76.us.new, !llvm.loop !36

._crit_edge77.us.unr-lcssa:                       ; preds = %.lr.ph76.us.new, %.lr.ph76.us
  %indvars.iv91.unr = phi i64 [ 0, %.lr.ph76.us ], [ %indvars.iv.next92.3, %.lr.ph76.us.new ]
  br i1 %lcmp.mod.not, label %._crit_edge77.us, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge77.us.unr-lcssa, %.epil.preheader
  %indvars.iv91.epil = phi i64 [ %indvars.iv.next92.epil, %.epil.preheader ], [ %indvars.iv91.unr, %._crit_edge77.us.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader ], [ 0, %._crit_edge77.us.unr-lcssa ]
  %95 = load ptr, ptr %65, align 8, !tbaa !19
  %96 = getelementptr inbounds ptr, ptr %95, i64 %indvars.iv91.epil
  %97 = load ptr, ptr %96, align 8, !tbaa !14
  %98 = getelementptr inbounds i8, ptr %97, i64 320
  %99 = atomicrmw xchg ptr %98, i64 0 seq_cst, align 8
  %indvars.iv.next92.epil = add nuw nsw i64 %indvars.iv91.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge77.us, label %.epil.preheader, !llvm.loop !37

._crit_edge77.us:                                 ; preds = %.epil.preheader, %._crit_edge77.us.unr-lcssa
  %100 = load i32, ptr %66, align 4, !tbaa !39
  %101 = icmp eq i32 %100, 0
  br i1 %101, label %.split80.us, label %71

.split:                                           ; preds = %63, %105
  call void @wait_light_on() #5
  %102 = load i32, ptr %66, align 4, !tbaa !39
  %103 = icmp eq i32 %102, 0
  br i1 %103, label %.split80.us, label %105

.split80.us:                                      ; preds = %._crit_edge77.us, %.split
  %104 = call i32 @sleep(i32 noundef -1) #5
  br label %.loopexit

105:                                              ; preds = %.split
  call void @run_ntttcp_throughput_management(ptr noundef nonnull %0) #5
  %106 = call i32 @process_test_results(ptr noundef nonnull %0) #5
  call void @print_test_results(ptr noundef nonnull %0) #5
  store i32 0, ptr %67, align 8, !tbaa !33
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(32) %68, i8 -1, i64 32, i1 false), !tbaa !34
  %107 = load i8, ptr %69, align 8, !tbaa !35, !range !29, !noundef !30
  %108 = trunc nuw i8 %107 to i1
  br i1 %108, label %.preheader, label %.split

.preheader:                                       ; preds = %71, %105
  br i1 %.not84, label %.loopexit, label %.lr.ph82

.lr.ph82:                                         ; preds = %.preheader
  %109 = getelementptr inbounds i8, ptr %0, i64 88
  %wide.trip.count103 = zext i32 %.2 to i64
  br label %110

110:                                              ; preds = %.lr.ph82, %116
  %indvars.iv100 = phi i64 [ 0, %.lr.ph82 ], [ %indvars.iv.next101, %116 ]
  %111 = load ptr, ptr %109, align 8, !tbaa !25
  %112 = getelementptr inbounds i64, ptr %111, i64 %indvars.iv100
  %113 = load i64, ptr %112, align 8, !tbaa !40
  %114 = call i32 @pthread_join(i64 noundef %113, ptr noundef null) #5
  %.not65 = icmp eq i32 %114, 0
  br i1 %.not65, label %116, label %115

115:                                              ; preds = %110
  call void @PRINT_ERR(ptr noundef nonnull @.str.18) #5
  br label %116

116:                                              ; preds = %110, %115
  %indvars.iv.next101 = add nuw nsw i64 %indvars.iv100, 1
  %exitcond104.not = icmp eq i64 %indvars.iv.next101, %wide.trip.count103
  br i1 %exitcond104.not, label %.loopexit, label %110, !llvm.loop !41

.loopexit:                                        ; preds = %116, %.preheader, %.split80.us, %16
  %.0 = phi i32 [ %.263, %.split80.us ], [ -1001, %16 ], [ %.263, %.preheader ], [ %.263, %116 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  ret i32 %.0
}

declare zeroext i1 @check_is_ip_addr_valid_local(i32 noundef, ptr noundef) local_unnamed_addr #1

declare ptr @run_ntttcp_receiver_tcp_stream(ptr noundef) #1

declare ptr @run_ntttcp_receiver_udp_stream(ptr noundef) #1

declare ptr @create_receiver_sync_socket(ptr noundef) #1

declare void @wait_light_on() local_unnamed_addr #1

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

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 = { 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 #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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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, !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 = !{!10, !10, i64 0}
!15 = !{!16, !7, i64 44}
!16 = !{!"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}
!17 = !{!16, !10, i64 24}
!18 = !{!16, !7, i64 16}
!19 = !{!6, !10, i64 80}
!20 = !{!16, !7, i64 52}
!21 = !{!22, !7, i64 24}
!22 = !{!"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, !23, i64 56, !23, i64 184, !7, i64 312, !12, i64 320}
!23 = !{!"", !8, i64 0}
!24 = !{!16, !7, i64 48}
!25 = !{!6, !10, i64 88}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = !{!16, !13, i64 40}
!29 = !{i8 0, i8 2}
!30 = !{}
!31 = !{!22, !7, i64 12}
!32 = !{!22, !13, i64 40}
!33 = !{!6, !7, i64 112}
!34 = !{!7, !7, i64 0}
!35 = !{!6, !13, i64 64}
!36 = distinct !{!36, !27}
!37 = distinct !{!37, !38}
!38 = !{!"llvm.loop.unroll.disable"}
!39 = !{!6, !7, i64 20}
!40 = !{!12, !12, i64 0}
!41 = distinct !{!41, !27}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopIdiomRecognizePass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass