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

; 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.sockaddr_storage = type { i16, [118 x i8], i64 }
%struct.addrinfo = type { i32, i32, i32, i32, i32, ptr, ptr, ptr }
%union.__CONST_SOCKADDR_ARG = type { ptr }
%union.__SOCKADDR_ARG = type { ptr }
%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.sockaddr_in = type { i16, i16, %struct.in_addr, [8 x i8] }
%struct.in_addr = type { i32 }
%struct.sockaddr_in6 = type { i16, i16, i32, %struct.in6_addr, i32 }
%struct.in6_addr = type { %union.anon }
%union.anon = type { [4 x i32] }

@.str = external hidden unnamed_addr constant [45 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [63 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [48 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @create_sender_sync_socket(ptr noundef %0) #0 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca %struct.sockaddr_storage, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca %struct.addrinfo, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca %union.__CONST_SOCKADDR_ARG, align 8
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca %union.__SOCKADDR_ARG, align 8
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #8
  store ptr null, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  store i32 0, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.ntttcp_test_endpoint, ptr %25, i32 0, i32 1
  %27 = load ptr, ptr %26, align 8, !tbaa !11
  store ptr %27, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 128, ptr %7) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  store i32 0, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  call void @llvm.lifetime.start.p0(i64 48, ptr %13) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  store i32 0, ptr %16, align 4, !tbaa !9
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.ntttcp_test, ptr %28, i32 0, i32 16
  %30 = load i32, ptr %29, align 4, !tbaa !16
  %31 = sub i32 %30, 1
  store i32 %31, ptr %11, align 4, !tbaa !9
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.ntttcp_test, ptr %32, i32 0, i32 14
  %34 = load i32, ptr %33, align 4, !tbaa !18
  %35 = icmp eq i32 %34, 2
  %36 = zext i1 %35 to i64
  %37 = select i1 %35, i32 16, i32 46
  store i32 %37, ptr %10, align 4, !tbaa !9
  %38 = load i32, ptr %10, align 4, !tbaa !9
  %39 = sext i32 %38 to i64
  %40 = call noalias ptr @malloc(i64 noundef %39) #9
  store ptr %40, ptr %9, align 8, !tbaa !5
  %41 = icmp eq ptr %40, null
  br i1 %41, label %42, label %44

42:                                               ; preds = %1
  call void @PRINT_ERR(ptr noundef @.str)
  %43 = load ptr, ptr %14, align 8, !tbaa !5
  call void @freeaddrinfo(ptr noundef %43) #8
  store i32 0, ptr %2, align 4
  store i32 1, ptr %17, align 4
  br label %184

44:                                               ; preds = %1
  call void @llvm.memset.p0.i64(ptr align 8 %13, i8 0, i64 48, i1 false)
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.ntttcp_test, ptr %45, i32 0, i32 14
  %47 = load i32, ptr %46, align 4, !tbaa !18
  %48 = getelementptr inbounds %struct.addrinfo, ptr %13, i32 0, i32 1
  store i32 %47, ptr %48, align 4, !tbaa !19
  %49 = getelementptr inbounds %struct.addrinfo, ptr %13, i32 0, i32 2
  store i32 1, ptr %49, align 8, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #8
  %50 = load i32, ptr %11, align 4, !tbaa !9
  %51 = call i32 (ptr, ptr, ...) @asprintf(ptr noundef %12, ptr noundef @.str.1, i32 noundef %50) #8
  store i32 %51, ptr %18, align 4, !tbaa !9
  %52 = load i32, ptr %18, align 4, !tbaa !9
  %53 = icmp slt i32 %52, 0
  br i1 %53, label %54, label %55

54:                                               ; preds = %44
  call void @PRINT_ERR(ptr noundef @.str.2)
  br label %55

55:                                               ; preds = %54, %44
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #8
  %56 = load ptr, ptr %6, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.ntttcp_test, ptr %56, i32 0, i32 10
  %58 = load ptr, ptr %57, align 8, !tbaa !22
  %59 = load ptr, ptr %12, align 8, !tbaa !5
  %60 = call i32 @getaddrinfo(ptr noundef %58, ptr noundef %59, ptr noundef %13, ptr noundef %14)
  %61 = icmp ne i32 %60, 0
  br i1 %61, label %62, label %64

62:                                               ; preds = %55
  call void @PRINT_ERR(ptr noundef @.str.3)
  %63 = load ptr, ptr %12, align 8, !tbaa !5
  call void @free(ptr noundef %63) #8
  store i32 0, ptr %2, align 4
  store i32 1, ptr %17, align 4
  br label %184

64:                                               ; preds = %55
  %65 = load ptr, ptr %12, align 8, !tbaa !5
  call void @free(ptr noundef %65) #8
  %66 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr %66, ptr %15, align 8, !tbaa !5
  br label %67

67:                                               ; preds = %136, %64
  %68 = load ptr, ptr %15, align 8, !tbaa !5
  %69 = icmp ne ptr %68, null
  br i1 %69, label %70, label %140

70:                                               ; preds = %67
  %71 = load ptr, ptr %15, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.addrinfo, ptr %71, i32 0, i32 1
  %73 = load i32, ptr %72, align 4, !tbaa !19
  %74 = load ptr, ptr %15, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.addrinfo, ptr %74, i32 0, i32 2
  %76 = load i32, ptr %75, align 8, !tbaa !21
  %77 = load ptr, ptr %15, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.addrinfo, ptr %77, i32 0, i32 3
  %79 = load i32, ptr %78, align 4, !tbaa !23
  %80 = call i32 @socket(i32 noundef %73, i32 noundef %76, i32 noundef %79) #8
  store i32 %80, ptr %5, align 4, !tbaa !9
  %81 = icmp slt i32 %80, 0
  br i1 %81, label %82, label %85

82:                                               ; preds = %70
  call void @PRINT_ERR(ptr noundef @.str.4)
  %83 = load ptr, ptr %14, align 8, !tbaa !5
  call void @freeaddrinfo(ptr noundef %83) #8
  %84 = load ptr, ptr %9, align 8, !tbaa !5
  call void @free(ptr noundef %84) #8
  store i32 0, ptr %2, align 4
  store i32 1, ptr %17, align 4
  br label %184

85:                                               ; preds = %70
  %86 = load ptr, ptr %15, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.addrinfo, ptr %86, i32 0, i32 5
  %88 = load ptr, ptr %87, align 8, !tbaa !24
  %89 = load ptr, ptr %9, align 8, !tbaa !5
  %90 = load i32, ptr %10, align 4, !tbaa !9
  %91 = sext i32 %90 to i64
  %92 = call ptr @retrive_ip_address_str(ptr noundef %88, ptr noundef %89, i64 noundef %91)
  store ptr %92, ptr %9, align 8, !tbaa !5
  %93 = load i32, ptr %5, align 4, !tbaa !9
  %94 = load ptr, ptr %15, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.addrinfo, ptr %94, i32 0, i32 5
  %96 = load ptr, ptr %95, align 8, !tbaa !24
  store ptr %96, ptr %19, align 8, !tbaa !25
  %97 = load ptr, ptr %15, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.addrinfo, ptr %97, i32 0, i32 4
  %99 = load i32, ptr %98, align 8, !tbaa !26
  %100 = getelementptr inbounds %union.__CONST_SOCKADDR_ARG, ptr %19, i32 0, i32 0
  %101 = load ptr, ptr %100, align 8
  %102 = call i32 @connect(i32 noundef %93, ptr %101, i32 noundef %99)
  store i32 %102, ptr %16, align 4, !tbaa !9
  %103 = icmp slt i32 %102, 0
  br i1 %103, label %104, label %135

104:                                              ; preds = %85
  %105 = load i32, ptr %16, align 4, !tbaa !9
  %106 = icmp eq i32 %105, -1
  br i1 %106, label %107, label %119

107:                                              ; preds = %104
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #8
  %108 = load ptr, ptr %9, align 8, !tbaa !5
  %109 = load i32, ptr %11, align 4, !tbaa !9
  %110 = load i32, ptr %5, align 4, !tbaa !9
  %111 = call ptr @__errno_location() #10
  %112 = load i32, ptr %111, align 4, !tbaa !9
  %113 = call i32 (ptr, ptr, ...) @asprintf(ptr noundef %4, ptr noundef @.str.5, ptr noundef %108, i32 noundef %109, i32 noundef %110, i32 noundef %112) #8
  store i32 %113, ptr %20, align 4, !tbaa !9
  %114 = load i32, ptr %20, align 4, !tbaa !9
  %115 = icmp slt i32 %114, 0
  br i1 %115, label %116, label %117

116:                                              ; preds = %107
  call void @PRINT_ERR(ptr noundef @.str.2)
  br label %117

117:                                              ; preds = %116, %107
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #8
  %118 = load ptr, ptr %4, align 8, !tbaa !5
  call void @PRINT_ERR_FREE(ptr noundef %118)
  br label %130

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

127:                                              ; preds = %119
  call void @PRINT_ERR(ptr noundef @.str.2)
  br label %128

128:                                              ; preds = %127, %119
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #8
  %129 = load ptr, ptr %4, align 8, !tbaa !5
  call void @PRINT_ERR_FREE(ptr noundef %129)
  br label %130

130:                                              ; preds = %128, %117
  %131 = load ptr, ptr %14, align 8, !tbaa !5
  call void @freeaddrinfo(ptr noundef %131) #8
  %132 = load ptr, ptr %9, align 8, !tbaa !5
  call void @free(ptr noundef %132) #8
  %133 = load i32, ptr %5, align 4, !tbaa !9
  %134 = call i32 @close(i32 noundef %133)
  store i32 0, ptr %2, align 4
  store i32 1, ptr %17, align 4
  br label %184

135:                                              ; preds = %85
  br label %140

136:                                              ; No predecessors!
  %137 = load ptr, ptr %15, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.addrinfo, ptr %137, i32 0, i32 7
  %139 = load ptr, ptr %138, align 8, !tbaa !27
  store ptr %139, ptr %15, align 8, !tbaa !5
  br label %67, !llvm.loop !28

140:                                              ; preds = %135, %67
  store i32 128, ptr %8, align 4, !tbaa !9
  %141 = load i32, ptr %5, align 4, !tbaa !9
  store ptr %7, ptr %22, align 8, !tbaa !25
  %142 = getelementptr inbounds %union.__SOCKADDR_ARG, ptr %22, i32 0, i32 0
  %143 = load ptr, ptr %142, align 8
  %144 = call i32 @getsockname(i32 noundef %141, ptr %143, ptr noundef %8) #8
  %145 = icmp ne i32 %144, 0
  br i1 %145, label %146, label %154

146:                                              ; preds = %140
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #8
  %147 = load i32, ptr %5, align 4, !tbaa !9
  %148 = call i32 (ptr, ptr, ...) @asprintf(ptr noundef %4, ptr noundef @.str.7, i32 noundef %147) #8
  store i32 %148, ptr %23, align 4, !tbaa !9
  %149 = load i32, ptr %23, align 4, !tbaa !9
  %150 = icmp slt i32 %149, 0
  br i1 %150, label %151, label %152

151:                                              ; preds = %146
  call void @PRINT_ERR(ptr noundef @.str.2)
  br label %152

152:                                              ; preds = %151, %146
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #8
  %153 = load ptr, ptr %4, align 8, !tbaa !5
  call void @PRINT_ERR_FREE(ptr noundef %153)
  br label %154

154:                                              ; preds = %152, %140
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #8
  %155 = load ptr, ptr %6, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.ntttcp_test, ptr %155, i32 0, i32 14
  %157 = load i32, ptr %156, align 4, !tbaa !18
  %158 = icmp eq i32 %157, 2
  br i1 %158, label %159, label %163

159:                                              ; preds = %154
  %160 = getelementptr inbounds %struct.sockaddr_in, ptr %7, i32 0, i32 1
  %161 = load i16, ptr %160, align 2, !tbaa !30
  %162 = zext i16 %161 to i32
  br label %167

163:                                              ; preds = %154
  %164 = getelementptr inbounds %struct.sockaddr_in6, ptr %7, i32 0, i32 1
  %165 = load i16, ptr %164, align 2, !tbaa !34
  %166 = zext i16 %165 to i32
  br label %167

167:                                              ; preds = %163, %159
  %168 = phi i32 [ %162, %159 ], [ %166, %163 ]
  %169 = trunc i32 %168 to i16
  %170 = call zeroext i16 @__bswap_16(i16 noundef zeroext %169)
  %171 = zext i16 %170 to i32
  %172 = load i32, ptr %5, align 4, !tbaa !9
  %173 = load ptr, ptr %9, align 8, !tbaa !5
  %174 = load i32, ptr %11, align 4, !tbaa !9
  %175 = call i32 (ptr, ptr, ...) @asprintf(ptr noundef %4, ptr noundef @.str.8, i32 noundef %171, i32 noundef %172, ptr noundef %173, i32 noundef %174) #8
  store i32 %175, ptr %24, align 4, !tbaa !9
  %176 = load i32, ptr %24, align 4, !tbaa !9
  %177 = icmp slt i32 %176, 0
  br i1 %177, label %178, label %179

178:                                              ; preds = %167
  call void @PRINT_ERR(ptr noundef @.str.2)
  br label %179

179:                                              ; preds = %178, %167
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #8
  %180 = load ptr, ptr %4, align 8, !tbaa !5
  call void @PRINT_DBG_FREE(ptr noundef %180)
  %181 = load ptr, ptr %9, align 8, !tbaa !5
  call void @free(ptr noundef %181) #8
  %182 = load ptr, ptr %14, align 8, !tbaa !5
  call void @freeaddrinfo(ptr noundef %182) #8
  %183 = load i32, ptr %5, align 4, !tbaa !9
  store i32 %183, ptr %2, align 4
  store i32 1, ptr %17, align 4
  br label %184

184:                                              ; preds = %179, %130, %82, %62, %42
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 128, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #8
  %185 = load i32, ptr %2, align 4
  ret i32 %185
}

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

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

declare void @PRINT_ERR(ptr noundef) #3

; Function Attrs: nounwind
declare void @freeaddrinfo(ptr noundef) #4

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

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

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

declare i32 @getaddrinfo(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #3

; Function Attrs: nounwind
declare void @free(ptr noundef) #4

; Function Attrs: nounwind
declare i32 @socket(i32 noundef, i32 noundef, i32 noundef) #4

declare ptr @retrive_ip_address_str(ptr noundef, ptr noundef, i64 noundef) #3

declare i32 @connect(i32 noundef, ptr, i32 noundef) #3

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

declare void @PRINT_ERR_FREE(ptr noundef) #3

declare i32 @close(i32 noundef) #3

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i16 @__bswap_16(i16 noundef zeroext) #7

declare void @PRINT_DBG_FREE(ptr noundef) #3

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { 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 = { inlinehint 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 #8 = { nounwind }
attributes #9 = { nounwind allocsize(0) }
attributes #10 = { 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 = !{!"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 52}
!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, !10, i64 44}
!19 = !{!20, !10, i64 4}
!20 = !{!"addrinfo", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!21 = !{!20, !10, i64 8}
!22 = !{!17, !6, i64 24}
!23 = !{!20, !10, i64 12}
!24 = !{!20, !6, i64 24}
!25 = !{!7, !7, i64 0}
!26 = !{!20, !10, i64 16}
!27 = !{!20, !6, i64 40}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}
!30 = !{!31, !32, i64 2}
!31 = !{!"sockaddr_in", !32, i64 0, !32, i64 2, !33, i64 4, !7, i64 8}
!32 = !{!"short", !7, i64 0}
!33 = !{!"in_addr", !10, i64 0}
!34 = !{!35, !32, i64 2}
!35 = !{!"sockaddr_in6", !32, i64 0, !32, i64 2, !10, i64 4, !36, i64 8, !10, i64 24}
!36 = !{!"in6_addr", !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"

%struct.sockaddr_storage = type { i16, [118 x i8], i64 }
%struct.addrinfo = type { i32, i32, i32, i32, i32, ptr, ptr, ptr }

@.str = external hidden unnamed_addr constant [45 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [63 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [48 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, -2147483648) i32 @create_sender_sync_socket(ptr nocapture noundef readonly %0) local_unnamed_addr #0 {
  %2 = alloca ptr, align 8
  %3 = alloca %struct.sockaddr_storage, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca %struct.addrinfo, align 8
  %7 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #9
  store ptr null, ptr %2, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %0, i64 8
  %9 = load ptr, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %3) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #9
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %6) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #9
  %10 = getelementptr inbounds i8, ptr %9, i64 52
  %11 = load i32, ptr %10, align 4, !tbaa !15
  %12 = add i32 %11, -1
  %13 = getelementptr inbounds i8, ptr %9, i64 44
  %14 = load i32, ptr %13, align 4, !tbaa !17
  %15 = icmp eq i32 %14, 2
  %16 = select i1 %15, i64 16, i64 46
  %17 = tail call noalias ptr @malloc(i64 noundef %16) #10
  %18 = icmp eq ptr %17, null
  br i1 %18, label %19, label %20

19:                                               ; preds = %1
  tail call void @PRINT_ERR(ptr noundef nonnull @.str) #9
  tail call void @freeaddrinfo(ptr noundef undef) #9
  br label %88

20:                                               ; preds = %1
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(48) %6, i8 0, i64 48, i1 false)
  %21 = getelementptr inbounds i8, ptr %6, i64 4
  store i32 %14, ptr %21, align 4, !tbaa !18
  %22 = getelementptr inbounds i8, ptr %6, i64 8
  store i32 1, ptr %22, align 8, !tbaa !20
  %23 = call i32 (ptr, ptr, ...) @asprintf(ptr noundef nonnull %5, ptr noundef nonnull @.str.1, i32 noundef %12) #9
  %24 = icmp slt i32 %23, 0
  br i1 %24, label %25, label %26

25:                                               ; preds = %20
  call void @PRINT_ERR(ptr noundef nonnull @.str.2) #9
  br label %26

26:                                               ; preds = %25, %20
  %27 = getelementptr inbounds i8, ptr %9, i64 24
  %28 = load ptr, ptr %27, align 8, !tbaa !21
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = call i32 @getaddrinfo(ptr noundef %28, ptr noundef %29, ptr noundef nonnull %6, ptr noundef nonnull %7) #9
  %.not = icmp eq i32 %30, 0
  br i1 %.not, label %33, label %31

31:                                               ; preds = %26
  call void @PRINT_ERR(ptr noundef nonnull @.str.3) #9
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  call void @free(ptr noundef %32) #9
  br label %88

33:                                               ; preds = %26
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  call void @free(ptr noundef %34) #9
  %35 = load ptr, ptr %7, align 8, !tbaa !5
  %.not48 = icmp eq ptr %35, null
  br i1 %.not48, label %69, label %36

36:                                               ; preds = %33
  %37 = getelementptr inbounds i8, ptr %35, i64 4
  %38 = load i32, ptr %37, align 4, !tbaa !18
  %39 = getelementptr inbounds i8, ptr %35, i64 8
  %40 = load i32, ptr %39, align 8, !tbaa !20
  %41 = getelementptr inbounds i8, ptr %35, i64 12
  %42 = load i32, ptr %41, align 4, !tbaa !22
  %43 = call i32 @socket(i32 noundef %38, i32 noundef %40, i32 noundef %42) #9
  %44 = icmp slt i32 %43, 0
  br i1 %44, label %45, label %47

45:                                               ; preds = %36
  call void @PRINT_ERR(ptr noundef nonnull @.str.4) #9
  %46 = load ptr, ptr %7, align 8, !tbaa !5
  call void @freeaddrinfo(ptr noundef %46) #9
  call void @free(ptr noundef nonnull %17) #9
  br label %88

47:                                               ; preds = %36
  %48 = getelementptr inbounds i8, ptr %35, i64 24
  %49 = load ptr, ptr %48, align 8, !tbaa !23
  %50 = call ptr @retrive_ip_address_str(ptr noundef %49, ptr noundef nonnull %17, i64 noundef %16) #9
  %51 = load ptr, ptr %48, align 8, !tbaa !23
  %52 = getelementptr inbounds i8, ptr %35, i64 16
  %53 = load i32, ptr %52, align 8, !tbaa !24
  %54 = call i32 @connect(i32 noundef %43, ptr %51, i32 noundef %53) #9
  %55 = icmp slt i32 %54, 0
  br i1 %55, label %56, label %69

56:                                               ; preds = %47
  %57 = icmp eq i32 %54, -1
  br i1 %57, label %58, label %63

58:                                               ; preds = %56
  %59 = tail call ptr @__errno_location() #11
  %60 = load i32, ptr %59, align 4, !tbaa !25
  %61 = call i32 (ptr, ptr, ...) @asprintf(ptr noundef nonnull %2, ptr noundef nonnull @.str.5, ptr noundef %50, i32 noundef %12, i32 noundef %43, i32 noundef %60) #9
  %62 = icmp slt i32 %61, 0
  br i1 %62, label %.sink.split, label %66

63:                                               ; preds = %56
  %64 = call i32 (ptr, ptr, ...) @asprintf(ptr noundef nonnull %2, ptr noundef nonnull @.str.6, ptr noundef %50, i32 noundef %12, i32 noundef %43, i32 noundef %54) #9
  %65 = icmp slt i32 %64, 0
  br i1 %65, label %.sink.split, label %66

.sink.split:                                      ; preds = %63, %58
  call void @PRINT_ERR(ptr noundef nonnull @.str.2) #9
  br label %66

66:                                               ; preds = %.sink.split, %63, %58
  %.sink = load ptr, ptr %2, align 8, !tbaa !5
  call void @PRINT_ERR_FREE(ptr noundef %.sink) #9
  %67 = load ptr, ptr %7, align 8, !tbaa !5
  call void @freeaddrinfo(ptr noundef %67) #9
  call void @free(ptr noundef %50) #9
  %68 = call i32 @close(i32 noundef %43) #9
  br label %88

69:                                               ; preds = %47, %33
  %.043 = phi ptr [ %50, %47 ], [ %17, %33 ]
  %.042 = phi i32 [ %43, %47 ], [ 0, %33 ]
  store i32 128, ptr %4, align 4, !tbaa !25
  %70 = call i32 @getsockname(i32 noundef %.042, ptr nonnull %3, ptr noundef nonnull %4) #9
  %.not49 = icmp eq i32 %70, 0
  br i1 %.not49, label %77, label %71

71:                                               ; preds = %69
  %72 = call i32 (ptr, ptr, ...) @asprintf(ptr noundef nonnull %2, ptr noundef nonnull @.str.7, i32 noundef %.042) #9
  %73 = icmp slt i32 %72, 0
  br i1 %73, label %74, label %75

74:                                               ; preds = %71
  call void @PRINT_ERR(ptr noundef nonnull @.str.2) #9
  br label %75

75:                                               ; preds = %74, %71
  %76 = load ptr, ptr %2, align 8, !tbaa !5
  call void @PRINT_ERR_FREE(ptr noundef %76) #9
  br label %77

77:                                               ; preds = %75, %69
  %78 = getelementptr inbounds i8, ptr %3, i64 2
  %79 = load i16, ptr %78, align 2
  %80 = call zeroext i16 @__bswap_16(i16 noundef zeroext %79)
  %81 = zext i16 %80 to i32
  %82 = call i32 (ptr, ptr, ...) @asprintf(ptr noundef nonnull %2, ptr noundef nonnull @.str.8, i32 noundef %81, i32 noundef %.042, ptr noundef %.043, i32 noundef %12) #9
  %83 = icmp slt i32 %82, 0
  br i1 %83, label %84, label %85

84:                                               ; preds = %77
  call void @PRINT_ERR(ptr noundef nonnull @.str.2) #9
  br label %85

85:                                               ; preds = %84, %77
  %86 = load ptr, ptr %2, align 8, !tbaa !5
  call void @PRINT_DBG_FREE(ptr noundef %86) #9
  call void @free(ptr noundef %.043) #9
  %87 = load ptr, ptr %7, align 8, !tbaa !5
  call void @freeaddrinfo(ptr noundef %87) #9
  br label %88

88:                                               ; preds = %85, %66, %45, %31, %19
  %.0 = phi i32 [ 0, %19 ], [ 0, %31 ], [ 0, %45 ], [ 0, %66 ], [ %.042, %85 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #9
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %6) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #9
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %3) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #9
  ret i32 %.0
}

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

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2

declare void @PRINT_ERR(ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind
declare void @freeaddrinfo(ptr noundef) local_unnamed_addr #4

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

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

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

declare i32 @getaddrinfo(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #6

; Function Attrs: nounwind
declare i32 @socket(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #4

declare ptr @retrive_ip_address_str(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #3

declare i32 @connect(i32 noundef, ptr, i32 noundef) local_unnamed_addr #3

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

declare void @PRINT_ERR_FREE(ptr noundef) local_unnamed_addr #3

declare i32 @close(i32 noundef) local_unnamed_addr #3

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i16 @__bswap_16(i16 noundef zeroext) local_unnamed_addr #8

declare void @PRINT_DBG_FREE(ptr noundef) local_unnamed_addr #3

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(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 #3 = { "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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { mustprogress nounwind willreturn allockind("free") 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 #7 = { 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 #8 = { inlinehint 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 #9 = { nounwind }
attributes #10 = { nounwind allocsize(0) }
attributes #11 = { 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, !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, !11, i64 52}
!16 = !{!"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}
!17 = !{!16, !11, i64 44}
!18 = !{!19, !11, i64 4}
!19 = !{!"addrinfo", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!20 = !{!19, !11, i64 8}
!21 = !{!16, !6, i64 24}
!22 = !{!19, !11, i64 12}
!23 = !{!19, !6, i64 24}
!24 = !{!19, !11, i64 16}
!25 = !{!11, !11, i64 0}


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