; LLVM IR from dynexcoin/Dynex :: external/miniupnpc (minissdpc)

; 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.in6_addr = type { %union.anon }
%union.anon = type { [4 x i32] }
%struct.sockaddr_storage = type { i16, [118 x i8], i64 }
%struct.addrinfo = type { i32, i32, i32, i32, i32, ptr, ptr, ptr }
%struct.in_addr = type { i32 }
%struct.ip_mreqn = type { %struct.in_addr, %struct.in_addr, i32 }
%struct.ifreq = type { %union.anon.0, %union.anon.1 }
%union.anon.0 = type { [16 x i8] }
%union.anon.1 = type { %struct.ifmap }
%struct.ifmap = type { i64, i64, i16, i8, i8, i8 }
%struct.timeval = type { i64, i64 }
%struct.sockaddr_in6 = type { i16, i16, i32, %struct.in6_addr, i32 }
%struct.sockaddr_in = type { i16, i16, %struct.in_addr, [8 x i8] }
%struct.UPNPDev = type { ptr, ptr, ptr, ptr, i32, [0 x i8] }

@ssdpDiscoverDevices.MSearchMsgFmt = external hidden constant [77 x i8], align 16
@.str.5 = external hidden unnamed_addr constant [7 x i8], align 1
@in6addr_any = external constant %struct.in6_addr, align 4
@.str.6 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [33 x i8], align 1
@stderr = external global ptr, align 8
@.str.9 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [7 x i8], align 1

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

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

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

declare void @perror(ptr noundef) #2

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

; Function Attrs: nounwind
declare ptr @strncpy(ptr noundef, ptr noundef, i64 noundef) #1

declare i32 @close(i32 noundef) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

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

; Function Attrs: nounwind uwtable
define dso_local ptr @ssdpDiscoverDevices(ptr noundef %0, i32 noundef %1, ptr noundef %2, i32 noundef %3, i32 noundef %4, i8 noundef zeroext %5, ptr noundef %6, i32 noundef %7) #6 {
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i8, align 1
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca [1536 x i8], align 16
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca %struct.sockaddr_storage, align 8
  %27 = alloca i32, align 4
  %28 = alloca i32, align 4
  %29 = alloca %struct.addrinfo, align 8
  %30 = alloca ptr, align 8
  %31 = alloca i32, align 4
  %32 = alloca i32, align 4
  %33 = alloca i32, align 4
  %34 = alloca ptr, align 8
  %35 = alloca ptr, align 8
  %36 = alloca i32, align 4
  %37 = alloca i32, align 4
  %38 = alloca %struct.in_addr, align 4
  %39 = alloca %struct.ip_mreqn, align 4
  %40 = alloca %struct.ifreq, align 8
  %41 = alloca i32, align 4
  %42 = alloca ptr, align 8
  %43 = alloca %struct.timeval, align 8
  %44 = alloca %struct.timeval, align 8
  %45 = alloca ptr, align 8
  %46 = alloca i32, align 4
  %47 = alloca ptr, align 8
  %48 = alloca i32, align 4
  %49 = alloca ptr, align 8
  %50 = alloca i32, align 4
  %51 = alloca i64, align 8
  store ptr %0, ptr %10, align 8, !tbaa !5
  store i32 %1, ptr %11, align 4, !tbaa !9
  store ptr %2, ptr %12, align 8, !tbaa !5
  store i32 %3, ptr %13, align 4, !tbaa !9
  store i32 %4, ptr %14, align 4, !tbaa !9
  store i8 %5, ptr %15, align 1, !tbaa !11
  store ptr %6, ptr %16, align 8, !tbaa !5
  store i32 %7, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #9
  store ptr null, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #9
  store i32 0, ptr %20, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #9
  store i32 1, ptr %21, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #9
  call void @llvm.lifetime.start.p0(i64 1536, ptr %23) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #9
  call void @llvm.lifetime.start.p0(i64 128, ptr %26) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #9
  call void @llvm.lifetime.start.p0(i64 48, ptr %29) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %31) #9
  store i32 1, ptr %31, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %32) #9
  %52 = load ptr, ptr %16, align 8, !tbaa !5
  %53 = icmp ne ptr %52, null
  br i1 %53, label %54, label %56

54:                                               ; preds = %8
  %55 = load ptr, ptr %16, align 8, !tbaa !5
  store i32 -1, ptr %55, align 4, !tbaa !9
  br label %56

56:                                               ; preds = %54, %8
  %57 = load i32, ptr %13, align 4, !tbaa !9
  %58 = icmp eq i32 %57, 1
  br i1 %58, label %59, label %60

59:                                               ; preds = %56
  store i32 1900, ptr %13, align 4, !tbaa !9
  br label %60

60:                                               ; preds = %59, %56
  %61 = load i32, ptr %14, align 4, !tbaa !9
  %62 = icmp ne i32 %61, 0
  %63 = zext i1 %62 to i64
  %64 = select i1 %62, i32 10, i32 2
  %65 = call i32 @socket(i32 noundef %64, i32 noundef 2, i32 noundef 0) #9
  store i32 %65, ptr %24, align 4, !tbaa !9
  %66 = load i32, ptr %24, align 4, !tbaa !9
  %67 = icmp slt i32 %66, 0
  br i1 %67, label %68, label %74

68:                                               ; preds = %60
  %69 = load ptr, ptr %16, align 8, !tbaa !5
  %70 = icmp ne ptr %69, null
  br i1 %70, label %71, label %73

71:                                               ; preds = %68
  %72 = load ptr, ptr %16, align 8, !tbaa !5
  store i32 -101, ptr %72, align 4, !tbaa !9
  br label %73

73:                                               ; preds = %71, %68
  call void @perror(ptr noundef @.str.5)
  store ptr null, ptr %9, align 8
  store i32 1, ptr %33, align 4
  br label %651

74:                                               ; preds = %60
  call void @llvm.memset.p0.i64(ptr align 8 %26, i8 0, i64 128, i1 false)
  %75 = load i32, ptr %14, align 4, !tbaa !9
  %76 = icmp ne i32 %75, 0
  br i1 %76, label %77, label %94

77:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 8, ptr %34) #9
  store ptr %26, ptr %34, align 8, !tbaa !5
  %78 = load ptr, ptr %34, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.sockaddr_in6, ptr %78, i32 0, i32 0
  store i16 10, ptr %79, align 4, !tbaa !12
  %80 = load i32, ptr %13, align 4, !tbaa !9
  %81 = icmp sgt i32 %80, 0
  br i1 %81, label %82, label %91

82:                                               ; preds = %77
  %83 = load i32, ptr %13, align 4, !tbaa !9
  %84 = icmp slt i32 %83, 65536
  br i1 %84, label %85, label %91

85:                                               ; preds = %82
  %86 = load i32, ptr %13, align 4, !tbaa !9
  %87 = trunc i32 %86 to i16
  %88 = call zeroext i16 @__bswap_16(i16 noundef zeroext %87)
  %89 = load ptr, ptr %34, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.sockaddr_in6, ptr %89, i32 0, i32 1
  store i16 %88, ptr %90, align 2, !tbaa !16
  br label %91

91:                                               ; preds = %85, %82, %77
  %92 = load ptr, ptr %34, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.sockaddr_in6, ptr %92, i32 0, i32 3
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %93, ptr align 4 @in6addr_any, i64 16, i1 false), !tbaa.struct !17
  call void @llvm.lifetime.end.p0(i64 8, ptr %34) #9
  br label %112

94:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 8, ptr %35) #9
  store ptr %26, ptr %35, align 8, !tbaa !5
  %95 = load ptr, ptr %35, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.sockaddr_in, ptr %95, i32 0, i32 0
  store i16 2, ptr %96, align 4, !tbaa !18
  %97 = load i32, ptr %13, align 4, !tbaa !9
  %98 = icmp sgt i32 %97, 0
  br i1 %98, label %99, label %108

99:                                               ; preds = %94
  %100 = load i32, ptr %13, align 4, !tbaa !9
  %101 = icmp slt i32 %100, 65536
  br i1 %101, label %102, label %108

102:                                              ; preds = %99
  %103 = load i32, ptr %13, align 4, !tbaa !9
  %104 = trunc i32 %103 to i16
  %105 = call zeroext i16 @__bswap_16(i16 noundef zeroext %104)
  %106 = load ptr, ptr %35, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.sockaddr_in, ptr %106, i32 0, i32 1
  store i16 %105, ptr %107, align 2, !tbaa !21
  br label %108

108:                                              ; preds = %102, %99, %94
  %109 = load ptr, ptr %35, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.sockaddr_in, ptr %109, i32 0, i32 2
  %111 = getelementptr inbounds %struct.in_addr, ptr %110, i32 0, i32 0
  store i32 0, ptr %111, align 4, !tbaa !22
  call void @llvm.lifetime.end.p0(i64 8, ptr %35) #9
  br label %112

112:                                              ; preds = %108, %91
  %113 = load i32, ptr %24, align 4, !tbaa !9
  %114 = call i32 @setsockopt(i32 noundef %113, i32 noundef 1, i32 noundef 2, ptr noundef %21, i32 noundef 4) #9
  %115 = icmp slt i32 %114, 0
  br i1 %115, label %116, label %122

116:                                              ; preds = %112
  %117 = load ptr, ptr %16, align 8, !tbaa !5
  %118 = icmp ne ptr %117, null
  br i1 %118, label %119, label %121

119:                                              ; preds = %116
  %120 = load ptr, ptr %16, align 8, !tbaa !5
  store i32 -101, ptr %120, align 4, !tbaa !9
  br label %121

121:                                              ; preds = %119, %116
  call void @perror(ptr noundef @.str.6)
  br label %647

122:                                              ; preds = %112
  %123 = load i32, ptr %14, align 4, !tbaa !9
  %124 = icmp ne i32 %123, 0
  br i1 %124, label %125, label %133

125:                                              ; preds = %122
  call void @llvm.lifetime.start.p0(i64 4, ptr %36) #9
  %126 = load i8, ptr %15, align 1, !tbaa !11
  %127 = zext i8 %126 to i32
  store i32 %127, ptr %36, align 4, !tbaa !9
  %128 = load i32, ptr %24, align 4, !tbaa !9
  %129 = call i32 @setsockopt(i32 noundef %128, i32 noundef 41, i32 noundef 18, ptr noundef %36, i32 noundef 4) #9
  %130 = icmp slt i32 %129, 0
  br i1 %130, label %131, label %132

131:                                              ; preds = %125
  call void @perror(ptr noundef @.str.7)
  br label %132

132:                                              ; preds = %131, %125
  call void @llvm.lifetime.end.p0(i64 4, ptr %36) #9
  br label %139

133:                                              ; preds = %122
  %134 = load i32, ptr %24, align 4, !tbaa !9
  %135 = call i32 @setsockopt(i32 noundef %134, i32 noundef 0, i32 noundef 33, ptr noundef %15, i32 noundef 1) #9
  %136 = icmp slt i32 %135, 0
  br i1 %136, label %137, label %138

137:                                              ; preds = %133
  call void @perror(ptr noundef @.str.8)
  br label %138

138:                                              ; preds = %137, %133
  br label %139

139:                                              ; preds = %138, %132
  %140 = load ptr, ptr %12, align 8, !tbaa !5
  %141 = icmp ne ptr %140, null
  br i1 %141, label %142, label %239

142:                                              ; preds = %139
  %143 = load i32, ptr %14, align 4, !tbaa !9
  %144 = icmp ne i32 %143, 0
  br i1 %144, label %145, label %168

145:                                              ; preds = %142
  call void @llvm.lifetime.start.p0(i64 4, ptr %37) #9
  %146 = load ptr, ptr %12, align 8, !tbaa !5
  %147 = call i32 @if_nametoindex(ptr noundef %146) #9
  store i32 %147, ptr %37, align 4, !tbaa !9
  %148 = load i32, ptr %37, align 4, !tbaa !9
  %149 = icmp eq i32 %148, 0
  br i1 %149, label %150, label %159

150:                                              ; preds = %145
  %151 = load ptr, ptr %16, align 8, !tbaa !5
  %152 = icmp ne ptr %151, null
  br i1 %152, label %153, label %155

153:                                              ; preds = %150
  %154 = load ptr, ptr %16, align 8, !tbaa !5
  store i32 -103, ptr %154, align 4, !tbaa !9
  br label %155

155:                                              ; preds = %153, %150
  %156 = load ptr, ptr @stderr, align 8, !tbaa !5
  %157 = load ptr, ptr %12, align 8, !tbaa !5
  %158 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %156, ptr noundef @.str.9, ptr noundef %157) #9
  store i32 2, ptr %33, align 4
  br label %165

159:                                              ; preds = %145
  %160 = load i32, ptr %24, align 4, !tbaa !9
  %161 = call i32 @setsockopt(i32 noundef %160, i32 noundef 41, i32 noundef 17, ptr noundef %37, i32 noundef 4) #9
  %162 = icmp slt i32 %161, 0
  br i1 %162, label %163, label %164

163:                                              ; preds = %159
  call void @perror(ptr noundef @.str.10)
  br label %164

164:                                              ; preds = %163, %159
  store i32 0, ptr %33, align 4
  br label %165

165:                                              ; preds = %164, %155
  call void @llvm.lifetime.end.p0(i64 4, ptr %37) #9
  %166 = load i32, ptr %33, align 4
  switch i32 %166, label %651 [
    i32 0, label %167
    i32 2, label %647
  ]

167:                                              ; preds = %165
  br label %238

168:                                              ; preds = %142
  call void @llvm.lifetime.start.p0(i64 4, ptr %38) #9
  %169 = load ptr, ptr %12, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.in_addr, ptr %38, i32 0, i32 0
  %171 = call i32 @inet_pton(i32 noundef 2, ptr noundef %169, ptr noundef %170) #9
  %172 = icmp sle i32 %171, 0
  br i1 %172, label %173, label %175

173:                                              ; preds = %168
  %174 = getelementptr inbounds %struct.in_addr, ptr %38, i32 0, i32 0
  store i32 -1, ptr %174, align 4, !tbaa !23
  br label %175

175:                                              ; preds = %173, %168
  %176 = getelementptr inbounds %struct.in_addr, ptr %38, i32 0, i32 0
  %177 = load i32, ptr %176, align 4, !tbaa !23
  %178 = icmp ne i32 %177, -1
  br i1 %178, label %179, label %189

179:                                              ; preds = %175
  %180 = getelementptr inbounds %struct.in_addr, ptr %38, i32 0, i32 0
  %181 = load i32, ptr %180, align 4, !tbaa !23
  %182 = getelementptr inbounds %struct.sockaddr_in, ptr %26, i32 0, i32 2
  %183 = getelementptr inbounds %struct.in_addr, ptr %182, i32 0, i32 0
  store i32 %181, ptr %183, align 4, !tbaa !22
  %184 = load i32, ptr %24, align 4, !tbaa !9
  %185 = call i32 @setsockopt(i32 noundef %184, i32 noundef 0, i32 noundef 32, ptr noundef %38, i32 noundef 4) #9
  %186 = icmp slt i32 %185, 0
  br i1 %186, label %187, label %188

187:                                              ; preds = %179
  call void @perror(ptr noundef @.str.11)
  br label %188

188:                                              ; preds = %187, %179
  br label %234

189:                                              ; preds = %175
  call void @llvm.lifetime.start.p0(i64 12, ptr %39) #9
  call void @llvm.lifetime.start.p0(i64 40, ptr %40) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %41) #9
  store i32 40, ptr %41, align 4, !tbaa !9
  %190 = getelementptr inbounds %struct.ifreq, ptr %40, i32 0, i32 0
  %191 = getelementptr inbounds [16 x i8], ptr %190, i64 0, i64 0
  %192 = load ptr, ptr %12, align 8, !tbaa !5
  %193 = call ptr @strncpy(ptr noundef %191, ptr noundef %192, i64 noundef 16) #9
  %194 = getelementptr inbounds %struct.ifreq, ptr %40, i32 0, i32 0
  %195 = getelementptr inbounds [16 x i8], ptr %194, i64 0, i64 15
  store i8 0, ptr %195, align 1, !tbaa !11
  %196 = load i32, ptr %24, align 4, !tbaa !9
  %197 = call i32 (i32, i64, ...) @ioctl(i32 noundef %196, i64 noundef 35093, ptr noundef %40, ptr noundef %41) #9
  %198 = icmp slt i32 %197, 0
  br i1 %198, label %199, label %200

199:                                              ; preds = %189
  call void @perror(ptr noundef @.str.12)
  store i32 2, ptr %33, align 4
  br label %231

200:                                              ; preds = %189
  %201 = getelementptr inbounds %struct.ifreq, ptr %40, i32 0, i32 1
  %202 = getelementptr inbounds %struct.sockaddr_in, ptr %201, i32 0, i32 2
  %203 = getelementptr inbounds %struct.in_addr, ptr %202, i32 0, i32 0
  %204 = load i32, ptr %203, align 4, !tbaa !11
  %205 = getelementptr inbounds %struct.in_addr, ptr %38, i32 0, i32 0
  store i32 %204, ptr %205, align 4, !tbaa !23
  call void @llvm.memset.p0.i64(ptr align 4 %39, i8 0, i64 12, i1 false)
  %206 = getelementptr inbounds %struct.in_addr, ptr %38, i32 0, i32 0
  %207 = load i32, ptr %206, align 4, !tbaa !23
  %208 = getelementptr inbounds %struct.ip_mreqn, ptr %39, i32 0, i32 1
  %209 = getelementptr inbounds %struct.in_addr, ptr %208, i32 0, i32 0
  store i32 %207, ptr %209, align 4, !tbaa !24
  %210 = load ptr, ptr %12, align 8, !tbaa !5
  %211 = call i32 @if_nametoindex(ptr noundef %210) #9
  %212 = getelementptr inbounds %struct.ip_mreqn, ptr %39, i32 0, i32 2
  store i32 %211, ptr %212, align 4, !tbaa !26
  %213 = getelementptr inbounds %struct.ip_mreqn, ptr %39, i32 0, i32 2
  %214 = load i32, ptr %213, align 4, !tbaa !26
  %215 = icmp eq i32 %214, 0
  br i1 %215, label %216, label %225

216:                                              ; preds = %200
  %217 = load ptr, ptr %16, align 8, !tbaa !5
  %218 = icmp ne ptr %217, null
  br i1 %218, label %219, label %221

219:                                              ; preds = %216
  %220 = load ptr, ptr %16, align 8, !tbaa !5
  store i32 -103, ptr %220, align 4, !tbaa !9
  br label %221

221:                                              ; preds = %219, %216
  %222 = load ptr, ptr @stderr, align 8, !tbaa !5
  %223 = load ptr, ptr %12, align 8, !tbaa !5
  %224 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %222, ptr noundef @.str.13, ptr noundef %223) #9
  store i32 2, ptr %33, align 4
  br label %231

225:                                              ; preds = %200
  %226 = load i32, ptr %24, align 4, !tbaa !9
  %227 = call i32 @setsockopt(i32 noundef %226, i32 noundef 0, i32 noundef 32, ptr noundef %39, i32 noundef 12) #9
  %228 = icmp slt i32 %227, 0
  br i1 %228, label %229, label %230

229:                                              ; preds = %225
  call void @perror(ptr noundef @.str.11)
  br label %230

230:                                              ; preds = %229, %225
  store i32 0, ptr %33, align 4
  br label %231

231:                                              ; preds = %230, %221, %199
  call void @llvm.lifetime.end.p0(i64 4, ptr %41) #9
  call void @llvm.lifetime.end.p0(i64 40, ptr %40) #9
  call void @llvm.lifetime.end.p0(i64 12, ptr %39) #9
  %232 = load i32, ptr %33, align 4
  switch i32 %232, label %235 [
    i32 0, label %233
  ]

233:                                              ; preds = %231
  br label %234

234:                                              ; preds = %233, %188
  store i32 0, ptr %33, align 4
  br label %235

235:                                              ; preds = %234, %231
  call void @llvm.lifetime.end.p0(i64 4, ptr %38) #9
  %236 = load i32, ptr %33, align 4
  switch i32 %236, label %651 [
    i32 0, label %237
    i32 2, label %647
  ]

237:                                              ; preds = %235
  br label %238

238:                                              ; preds = %237, %167
  br label %239

239:                                              ; preds = %238, %139
  %240 = load i32, ptr %24, align 4, !tbaa !9
  %241 = load i32, ptr %14, align 4, !tbaa !9
  %242 = icmp ne i32 %241, 0
  %243 = zext i1 %242 to i64
  %244 = select i1 %242, i64 28, i64 16
  %245 = trunc i64 %244 to i32
  %246 = call i32 @bind(i32 noundef %240, ptr noundef %26, i32 noundef %245) #9
  %247 = icmp ne i32 %246, 0
  br i1 %247, label %248, label %256

248:                                              ; preds = %239
  %249 = load ptr, ptr %16, align 8, !tbaa !5
  %250 = icmp ne ptr %249, null
  br i1 %250, label %251, label %253

251:                                              ; preds = %248
  %252 = load ptr, ptr %16, align 8, !tbaa !5
  store i32 -101, ptr %252, align 4, !tbaa !9
  br label %253

253:                                              ; preds = %251, %248
  call void @perror(ptr noundef @.str.14)
  %254 = load i32, ptr %24, align 4, !tbaa !9
  %255 = call i32 @close(i32 noundef %254)
  store ptr null, ptr %9, align 8
  store i32 1, ptr %33, align 4
  br label %651

256:                                              ; preds = %239
  %257 = load ptr, ptr %16, align 8, !tbaa !5
  %258 = icmp ne ptr %257, null
  br i1 %258, label %259, label %261

259:                                              ; preds = %256
  %260 = load ptr, ptr %16, align 8, !tbaa !5
  store i32 0, ptr %260, align 4, !tbaa !9
  br label %261

261:                                              ; preds = %259, %256
  %262 = load i32, ptr %11, align 4, !tbaa !9
  %263 = udiv i32 %262, 1000
  store i32 %263, ptr %27, align 4, !tbaa !9
  %264 = load i32, ptr %27, align 4, !tbaa !9
  %265 = icmp eq i32 %264, 0
  br i1 %265, label %266, label %267

266:                                              ; preds = %261
  store i32 1, ptr %27, align 4, !tbaa !9
  store i32 1000, ptr %11, align 4, !tbaa !9
  br label %267

267:                                              ; preds = %266, %261
  store i32 0, ptr %22, align 4, !tbaa !9
  br label %268

268:                                              ; preds = %643, %267
  %269 = load ptr, ptr %10, align 8, !tbaa !5
  %270 = load i32, ptr %22, align 4, !tbaa !9
  %271 = sext i32 %270 to i64
  %272 = getelementptr inbounds ptr, ptr %269, i64 %271
  %273 = load ptr, ptr %272, align 8, !tbaa !5
  %274 = icmp ne ptr %273, null
  br i1 %274, label %275, label %646

275:                                              ; preds = %268
  store i32 0, ptr %32, align 4, !tbaa !9
  %276 = getelementptr inbounds [1536 x i8], ptr %23, i64 0, i64 0
  %277 = load i32, ptr %14, align 4, !tbaa !9
  %278 = icmp ne i32 %277, 0
  br i1 %278, label %279, label %284

279:                                              ; preds = %275
  %280 = load i32, ptr %31, align 4, !tbaa !9
  %281 = icmp ne i32 %280, 0
  %282 = zext i1 %281 to i64
  %283 = select i1 %281, ptr @.str.15, ptr @.str.16
  br label %285

284:                                              ; preds = %275
  br label %285

285:                                              ; preds = %284, %279
  %286 = phi ptr [ %283, %279 ], [ @.str.17, %284 ]
  %287 = load ptr, ptr %10, align 8, !tbaa !5
  %288 = load i32, ptr %22, align 4, !tbaa !9
  %289 = sext i32 %288 to i64
  %290 = getelementptr inbounds ptr, ptr %287, i64 %289
  %291 = load ptr, ptr %290, align 8, !tbaa !5
  %292 = load i32, ptr %27, align 4, !tbaa !9
  %293 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %276, i64 noundef 1536, ptr noundef @ssdpDiscoverDevices.MSearchMsgFmt, ptr noundef %286, ptr noundef %291, i32 noundef %292) #9
  store i32 %293, ptr %25, align 4, !tbaa !9
  %294 = load i32, ptr %25, align 4, !tbaa !9
  %295 = zext i32 %294 to i64
  %296 = icmp uge i64 %295, 1536
  br i1 %296, label %297, label %303

297:                                              ; preds = %285
  %298 = load ptr, ptr %16, align 8, !tbaa !5
  %299 = icmp ne ptr %298, null
  br i1 %299, label %300, label %302

300:                                              ; preds = %297
  %301 = load ptr, ptr %16, align 8, !tbaa !5
  store i32 -102, ptr %301, align 4, !tbaa !9
  br label %302

302:                                              ; preds = %300, %297
  br label %647

303:                                              ; preds = %285
  call void @llvm.memset.p0.i64(ptr align 8 %29, i8 0, i64 48, i1 false)
  %304 = getelementptr inbounds %struct.addrinfo, ptr %29, i32 0, i32 1
  store i32 0, ptr %304, align 4, !tbaa !27
  %305 = getelementptr inbounds %struct.addrinfo, ptr %29, i32 0, i32 2
  store i32 2, ptr %305, align 8, !tbaa !29
  %306 = load i32, ptr %14, align 4, !tbaa !9
  %307 = icmp ne i32 %306, 0
  br i1 %307, label %308, label %313

308:                                              ; preds = %303
  %309 = load i32, ptr %31, align 4, !tbaa !9
  %310 = icmp ne i32 %309, 0
  %311 = zext i1 %310 to i64
  %312 = select i1 %310, ptr @.str.18, ptr @.str.19
  br label %314

313:                                              ; preds = %303
  br label %314

314:                                              ; preds = %313, %308
  %315 = phi ptr [ %312, %308 ], [ @.str.17, %313 ]
  %316 = call i32 @getaddrinfo(ptr noundef %315, ptr noundef @.str.20, ptr noundef %29, ptr noundef %30)
  store i32 %316, ptr %28, align 4, !tbaa !9
  %317 = icmp ne i32 %316, 0
  br i1 %317, label %318, label %328

318:                                              ; preds = %314
  %319 = load ptr, ptr %16, align 8, !tbaa !5
  %320 = icmp ne ptr %319, null
  br i1 %320, label %321, label %323

321:                                              ; preds = %318
  %322 = load ptr, ptr %16, align 8, !tbaa !5
  store i32 -101, ptr %322, align 4, !tbaa !9
  br label %323

323:                                              ; preds = %321, %318
  %324 = load ptr, ptr @stderr, align 8, !tbaa !5
  %325 = load i32, ptr %28, align 4, !tbaa !9
  %326 = call ptr @gai_strerror(i32 noundef %325) #9
  %327 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %324, ptr noundef @.str.21, ptr noundef %326) #9
  br label %646

328:                                              ; preds = %314
  call void @llvm.lifetime.start.p0(i64 8, ptr %42) #9
  %329 = load ptr, ptr %30, align 8, !tbaa !5
  store ptr %329, ptr %42, align 8, !tbaa !5
  br label %330

330:                                              ; preds = %351, %328
  %331 = load ptr, ptr %42, align 8, !tbaa !5
  %332 = icmp ne ptr %331, null
  br i1 %332, label %333, label %355

333:                                              ; preds = %330
  %334 = load i32, ptr %24, align 4, !tbaa !9
  %335 = getelementptr inbounds [1536 x i8], ptr %23, i64 0, i64 0
  %336 = load i32, ptr %25, align 4, !tbaa !9
  %337 = sext i32 %336 to i64
  %338 = load ptr, ptr %42, align 8, !tbaa !5
  %339 = getelementptr inbounds %struct.addrinfo, ptr %338, i32 0, i32 5
  %340 = load ptr, ptr %339, align 8, !tbaa !30
  %341 = load ptr, ptr %42, align 8, !tbaa !5
  %342 = getelementptr inbounds %struct.addrinfo, ptr %341, i32 0, i32 4
  %343 = load i32, ptr %342, align 8, !tbaa !31
  %344 = call i64 @sendto(i32 noundef %334, ptr noundef %335, i64 noundef %337, i32 noundef 0, ptr noundef %340, i32 noundef %343)
  %345 = trunc i64 %344 to i32
  store i32 %345, ptr %25, align 4, !tbaa !9
  %346 = load i32, ptr %25, align 4, !tbaa !9
  %347 = icmp slt i32 %346, 0
  br i1 %347, label %348, label %349

348:                                              ; preds = %333
  call void @perror(ptr noundef @.str.22)
  br label %351

349:                                              ; preds = %333
  store i32 1, ptr %32, align 4, !tbaa !9
  br label %350

350:                                              ; preds = %349
  br label %351

351:                                              ; preds = %350, %348
  %352 = load ptr, ptr %42, align 8, !tbaa !5
  %353 = getelementptr inbounds %struct.addrinfo, ptr %352, i32 0, i32 7
  %354 = load ptr, ptr %353, align 8, !tbaa !32
  store ptr %354, ptr %42, align 8, !tbaa !5
  br label %330, !llvm.loop !33

355:                                              ; preds = %330
  %356 = load ptr, ptr %30, align 8, !tbaa !5
  call void @freeaddrinfo(ptr noundef %356) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %42) #9
  br label %357

357:                                              ; preds = %355
  %358 = load i32, ptr %32, align 4, !tbaa !9
  %359 = icmp ne i32 %358, 0
  br i1 %359, label %366, label %360

360:                                              ; preds = %357
  %361 = load ptr, ptr %16, align 8, !tbaa !5
  %362 = icmp ne ptr %361, null
  br i1 %362, label %363, label %365

363:                                              ; preds = %360
  %364 = load ptr, ptr %16, align 8, !tbaa !5
  store i32 -101, ptr %364, align 4, !tbaa !9
  br label %365

365:                                              ; preds = %363, %360
  br label %366

366:                                              ; preds = %365, %357
  %367 = load i32, ptr %32, align 4, !tbaa !9
  %368 = icmp ne i32 %367, 0
  br i1 %368, label %369, label %372

369:                                              ; preds = %366
  %370 = load i32, ptr %17, align 4, !tbaa !9
  %371 = icmp ne i32 %370, 0
  br i1 %371, label %372, label %380

372:                                              ; preds = %369, %366
  %373 = load ptr, ptr %10, align 8, !tbaa !5
  %374 = load i32, ptr %22, align 4, !tbaa !9
  %375 = add nsw i32 %374, 1
  %376 = sext i32 %375 to i64
  %377 = getelementptr inbounds ptr, ptr %373, i64 %376
  %378 = load ptr, ptr %377, align 8, !tbaa !5
  %379 = icmp ne ptr %378, null
  br i1 %379, label %631, label %380

380:                                              ; preds = %372, %369
  call void @llvm.lifetime.start.p0(i64 16, ptr %43) #9
  call void @llvm.memset.p0.i64(ptr align 8 %43, i8 0, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr %44) #9
  call void @llvm.memset.p0.i64(ptr align 8 %44, i8 0, i64 16, i1 false)
  %381 = call i32 @upnp_gettimeofday(ptr noundef %43)
  br label %382

382:                                              ; preds = %624, %380
  %383 = load i32, ptr %24, align 4, !tbaa !9
  %384 = getelementptr inbounds [1536 x i8], ptr %23, i64 0, i64 0
  %385 = load i32, ptr %11, align 4, !tbaa !9
  %386 = call i32 @receivedata(i32 noundef %383, ptr noundef %384, i32 noundef 1536, i32 noundef %385, ptr noundef %20)
  store i32 %386, ptr %25, align 4, !tbaa !9
  %387 = load i32, ptr %25, align 4, !tbaa !9
  %388 = icmp slt i32 %387, 0
  br i1 %388, label %389, label %395

389:                                              ; preds = %382
  %390 = load ptr, ptr %16, align 8, !tbaa !5
  %391 = icmp ne ptr %390, null
  br i1 %391, label %392, label %394

392:                                              ; preds = %389
  %393 = load ptr, ptr %16, align 8, !tbaa !5
  store i32 -101, ptr %393, align 4, !tbaa !9
  br label %394

394:                                              ; preds = %392, %389
  store i32 2, ptr %33, align 4
  br label %628

395:                                              ; preds = %382
  %396 = load i32, ptr %25, align 4, !tbaa !9
  %397 = icmp eq i32 %396, 0
  br i1 %397, label %398, label %411

398:                                              ; preds = %395
  %399 = load ptr, ptr %19, align 8, !tbaa !5
  %400 = icmp ne ptr %399, null
  br i1 %400, label %401, label %410

401:                                              ; preds = %398
  %402 = load i32, ptr %17, align 4, !tbaa !9
  %403 = icmp ne i32 %402, 0
  br i1 %403, label %410, label %404

404:                                              ; preds = %401
  %405 = load ptr, ptr %16, align 8, !tbaa !5
  %406 = icmp ne ptr %405, null
  br i1 %406, label %407, label %409

407:                                              ; preds = %404
  %408 = load ptr, ptr %16, align 8, !tbaa !5
  store i32 0, ptr %408, align 4, !tbaa !9
  br label %409

409:                                              ; preds = %407, %404
  store i32 2, ptr %33, align 4
  br label %628

410:                                              ; preds = %401, %398
  br label %622

411:                                              ; preds = %395
  call void @llvm.lifetime.start.p0(i64 8, ptr %45) #9
  store ptr null, ptr %45, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %46) #9
  store i32 0, ptr %46, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %47) #9
  store ptr null, ptr %47, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %48) #9
  store i32 0, ptr %48, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %49) #9
  store ptr null, ptr %49, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %50) #9
  store i32 0, ptr %50, align 4, !tbaa !9
  %412 = getelementptr inbounds [1536 x i8], ptr %23, i64 0, i64 0
  %413 = load i32, ptr %25, align 4, !tbaa !9
  call void @parseMSEARCHReply(ptr noundef %412, i32 noundef %413, ptr noundef %45, ptr noundef %46, ptr noundef %47, ptr noundef %48, ptr noundef %49, ptr noundef %50)
  %414 = load ptr, ptr %47, align 8, !tbaa !5
  %415 = icmp ne ptr %414, null
  br i1 %415, label %416, label %591

416:                                              ; preds = %411
  %417 = load ptr, ptr %45, align 8, !tbaa !5
  %418 = icmp ne ptr %417, null
  br i1 %418, label %419, label %591

419:                                              ; preds = %416
  %420 = load ptr, ptr %19, align 8, !tbaa !5
  store ptr %420, ptr %18, align 8, !tbaa !5
  br label %421

421:                                              ; preds = %486, %419
  %422 = load ptr, ptr %18, align 8, !tbaa !5
  %423 = icmp ne ptr %422, null
  br i1 %423, label %424, label %490

424:                                              ; preds = %421
  %425 = load ptr, ptr %18, align 8, !tbaa !5
  %426 = getelementptr inbounds %struct.UPNPDev, ptr %425, i32 0, i32 1
  %427 = load ptr, ptr %426, align 8, !tbaa !35
  %428 = load ptr, ptr %45, align 8, !tbaa !5
  %429 = load i32, ptr %46, align 4, !tbaa !9
  %430 = sext i32 %429 to i64
  %431 = call i32 @strncmp(ptr noundef %427, ptr noundef %428, i64 noundef %430) #10
  %432 = icmp eq i32 %431, 0
  br i1 %432, label %433, label %485

433:                                              ; preds = %424
  %434 = load ptr, ptr %18, align 8, !tbaa !5
  %435 = getelementptr inbounds %struct.UPNPDev, ptr %434, i32 0, i32 1
  %436 = load ptr, ptr %435, align 8, !tbaa !35
  %437 = load i32, ptr %46, align 4, !tbaa !9
  %438 = sext i32 %437 to i64
  %439 = getelementptr inbounds i8, ptr %436, i64 %438
  %440 = load i8, ptr %439, align 1, !tbaa !11
  %441 = sext i8 %440 to i32
  %442 = icmp eq i32 %441, 0
  br i1 %442, label %443, label %485

443:                                              ; preds = %433
  %444 = load ptr, ptr %18, align 8, !tbaa !5
  %445 = getelementptr inbounds %struct.UPNPDev, ptr %444, i32 0, i32 2
  %446 = load ptr, ptr %445, align 8, !tbaa !37
  %447 = load ptr, ptr %47, align 8, !tbaa !5
  %448 = load i32, ptr %48, align 4, !tbaa !9
  %449 = sext i32 %448 to i64
  %450 = call i32 @strncmp(ptr noundef %446, ptr noundef %447, i64 noundef %449) #10
  %451 = icmp eq i32 %450, 0
  br i1 %451, label %452, label %485

452:                                              ; preds = %443
  %453 = load ptr, ptr %18, align 8, !tbaa !5
  %454 = getelementptr inbounds %struct.UPNPDev, ptr %453, i32 0, i32 2
  %455 = load ptr, ptr %454, align 8, !tbaa !37
  %456 = load i32, ptr %48, align 4, !tbaa !9
  %457 = sext i32 %456 to i64
  %458 = getelementptr inbounds i8, ptr %455, i64 %457
  %459 = load i8, ptr %458, align 1, !tbaa !11
  %460 = sext i8 %459 to i32
  %461 = icmp eq i32 %460, 0
  br i1 %461, label %462, label %485

462:                                              ; preds = %452
  %463 = load i32, ptr %50, align 4, !tbaa !9
  %464 = icmp eq i32 %463, 0
  br i1 %464, label %474, label %465

465:                                              ; preds = %462
  %466 = load ptr, ptr %18, align 8, !tbaa !5
  %467 = getelementptr inbounds %struct.UPNPDev, ptr %466, i32 0, i32 3
  %468 = load ptr, ptr %467, align 8, !tbaa !38
  %469 = load ptr, ptr %49, align 8, !tbaa !5
  %470 = load i32, ptr %50, align 4, !tbaa !9
  %471 = sext i32 %470 to i64
  %472 = call i32 @strncmp(ptr noundef %468, ptr noundef %469, i64 noundef %471) #10
  %473 = icmp eq i32 %472, 0
  br i1 %473, label %474, label %485

474:                                              ; preds = %465, %462
  %475 = load ptr, ptr %18, align 8, !tbaa !5
  %476 = getelementptr inbounds %struct.UPNPDev, ptr %475, i32 0, i32 3
  %477 = load ptr, ptr %476, align 8, !tbaa !38
  %478 = load i32, ptr %50, align 4, !tbaa !9
  %479 = sext i32 %478 to i64
  %480 = getelementptr inbounds i8, ptr %477, i64 %479
  %481 = load i8, ptr %480, align 1, !tbaa !11
  %482 = sext i8 %481 to i32
  %483 = icmp eq i32 %482, 0
  br i1 %483, label %484, label %485

484:                                              ; preds = %474
  br label %490

485:                                              ; preds = %474, %465, %452, %443, %433, %424
  br label %486

486:                                              ; preds = %485
  %487 = load ptr, ptr %18, align 8, !tbaa !5
  %488 = getelementptr inbounds %struct.UPNPDev, ptr %487, i32 0, i32 0
  %489 = load ptr, ptr %488, align 8, !tbaa !39
  store ptr %489, ptr %18, align 8, !tbaa !5
  br label %421, !llvm.loop !40

490:                                              ; preds = %484, %421
  %491 = load ptr, ptr %18, align 8, !tbaa !5
  %492 = icmp ne ptr %491, null
  br i1 %492, label %493, label %494

493:                                              ; preds = %490
  store i32 10, ptr %33, align 4
  br label %619

494:                                              ; preds = %490
  %495 = load i32, ptr %46, align 4, !tbaa !9
  %496 = sext i32 %495 to i64
  %497 = add i64 40, %496
  %498 = load i32, ptr %48, align 4, !tbaa !9
  %499 = sext i32 %498 to i64
  %500 = add i64 %497, %499
  %501 = load i32, ptr %50, align 4, !tbaa !9
  %502 = sext i32 %501 to i64
  %503 = add i64 %500, %502
  %504 = add i64 %503, 3
  %505 = call noalias ptr @malloc(i64 noundef %504) #11
  store ptr %505, ptr %18, align 8, !tbaa !5
  %506 = load ptr, ptr %18, align 8, !tbaa !5
  %507 = icmp ne ptr %506, null
  br i1 %507, label %514, label %508

508:                                              ; preds = %494
  %509 = load ptr, ptr %16, align 8, !tbaa !5
  %510 = icmp ne ptr %509, null
  br i1 %510, label %511, label %513

511:                                              ; preds = %508
  %512 = load ptr, ptr %16, align 8, !tbaa !5
  store i32 -102, ptr %512, align 4, !tbaa !9
  br label %513

513:                                              ; preds = %511, %508
  store i32 2, ptr %33, align 4
  br label %619

514:                                              ; preds = %494
  %515 = load ptr, ptr %19, align 8, !tbaa !5
  %516 = load ptr, ptr %18, align 8, !tbaa !5
  %517 = getelementptr inbounds %struct.UPNPDev, ptr %516, i32 0, i32 0
  store ptr %515, ptr %517, align 8, !tbaa !39
  %518 = load ptr, ptr %18, align 8, !tbaa !5
  %519 = getelementptr inbounds %struct.UPNPDev, ptr %518, i32 0, i32 5
  %520 = getelementptr inbounds [0 x i8], ptr %519, i64 0, i64 0
  %521 = load ptr, ptr %18, align 8, !tbaa !5
  %522 = getelementptr inbounds %struct.UPNPDev, ptr %521, i32 0, i32 1
  store ptr %520, ptr %522, align 8, !tbaa !35
  %523 = load ptr, ptr %18, align 8, !tbaa !5
  %524 = getelementptr inbounds %struct.UPNPDev, ptr %523, i32 0, i32 5
  %525 = getelementptr inbounds [0 x i8], ptr %524, i64 0, i64 0
  %526 = getelementptr inbounds i8, ptr %525, i64 1
  %527 = load i32, ptr %46, align 4, !tbaa !9
  %528 = sext i32 %527 to i64
  %529 = getelementptr inbounds i8, ptr %526, i64 %528
  %530 = load ptr, ptr %18, align 8, !tbaa !5
  %531 = getelementptr inbounds %struct.UPNPDev, ptr %530, i32 0, i32 2
  store ptr %529, ptr %531, align 8, !tbaa !37
  %532 = load ptr, ptr %18, align 8, !tbaa !5
  %533 = getelementptr inbounds %struct.UPNPDev, ptr %532, i32 0, i32 2
  %534 = load ptr, ptr %533, align 8, !tbaa !37
  %535 = getelementptr inbounds i8, ptr %534, i64 1
  %536 = load i32, ptr %48, align 4, !tbaa !9
  %537 = sext i32 %536 to i64
  %538 = getelementptr inbounds i8, ptr %535, i64 %537
  %539 = load ptr, ptr %18, align 8, !tbaa !5
  %540 = getelementptr inbounds %struct.UPNPDev, ptr %539, i32 0, i32 3
  store ptr %538, ptr %540, align 8, !tbaa !38
  %541 = load ptr, ptr %18, align 8, !tbaa !5
  %542 = getelementptr inbounds %struct.UPNPDev, ptr %541, i32 0, i32 5
  %543 = getelementptr inbounds [0 x i8], ptr %542, i64 0, i64 0
  %544 = load ptr, ptr %45, align 8, !tbaa !5
  %545 = load i32, ptr %46, align 4, !tbaa !9
  %546 = sext i32 %545 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %543, ptr align 1 %544, i64 %546, i1 false)
  %547 = load ptr, ptr %18, align 8, !tbaa !5
  %548 = getelementptr inbounds %struct.UPNPDev, ptr %547, i32 0, i32 5
  %549 = load i32, ptr %46, align 4, !tbaa !9
  %550 = sext i32 %549 to i64
  %551 = getelementptr inbounds [0 x i8], ptr %548, i64 0, i64 %550
  store i8 0, ptr %551, align 1, !tbaa !11
  %552 = load ptr, ptr %18, align 8, !tbaa !5
  %553 = getelementptr inbounds %struct.UPNPDev, ptr %552, i32 0, i32 2
  %554 = load ptr, ptr %553, align 8, !tbaa !37
  %555 = load ptr, ptr %47, align 8, !tbaa !5
  %556 = load i32, ptr %48, align 4, !tbaa !9
  %557 = sext i32 %556 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %554, ptr align 1 %555, i64 %557, i1 false)
  %558 = load ptr, ptr %18, align 8, !tbaa !5
  %559 = getelementptr inbounds %struct.UPNPDev, ptr %558, i32 0, i32 5
  %560 = load i32, ptr %46, align 4, !tbaa !9
  %561 = add nsw i32 %560, 1
  %562 = load i32, ptr %48, align 4, !tbaa !9
  %563 = add nsw i32 %561, %562
  %564 = sext i32 %563 to i64
  %565 = getelementptr inbounds [0 x i8], ptr %559, i64 0, i64 %564
  store i8 0, ptr %565, align 1, !tbaa !11
  %566 = load ptr, ptr %49, align 8, !tbaa !5
  %567 = icmp ne ptr %566, null
  br i1 %567, label %568, label %575

568:                                              ; preds = %514
  %569 = load ptr, ptr %18, align 8, !tbaa !5
  %570 = getelementptr inbounds %struct.UPNPDev, ptr %569, i32 0, i32 3
  %571 = load ptr, ptr %570, align 8, !tbaa !38
  %572 = load ptr, ptr %49, align 8, !tbaa !5
  %573 = load i32, ptr %50, align 4, !tbaa !9
  %574 = sext i32 %573 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %571, ptr align 1 %572, i64 %574, i1 false)
  br label %575

575:                                              ; preds = %568, %514
  %576 = load ptr, ptr %18, align 8, !tbaa !5
  %577 = getelementptr inbounds %struct.UPNPDev, ptr %576, i32 0, i32 5
  %578 = load i32, ptr %46, align 4, !tbaa !9
  %579 = add nsw i32 %578, 1
  %580 = load i32, ptr %48, align 4, !tbaa !9
  %581 = add nsw i32 %579, %580
  %582 = add nsw i32 %581, 1
  %583 = load i32, ptr %50, align 4, !tbaa !9
  %584 = add nsw i32 %582, %583
  %585 = sext i32 %584 to i64
  %586 = getelementptr inbounds [0 x i8], ptr %577, i64 0, i64 %585
  store i8 0, ptr %586, align 1, !tbaa !11
  %587 = load i32, ptr %20, align 4, !tbaa !9
  %588 = load ptr, ptr %18, align 8, !tbaa !5
  %589 = getelementptr inbounds %struct.UPNPDev, ptr %588, i32 0, i32 4
  store i32 %587, ptr %589, align 8, !tbaa !41
  %590 = load ptr, ptr %18, align 8, !tbaa !5
  store ptr %590, ptr %19, align 8, !tbaa !5
  br label %591

591:                                              ; preds = %575, %416, %411
  %592 = call i32 @upnp_gettimeofday(ptr noundef %44)
  %593 = icmp sge i32 %592, 0
  br i1 %593, label %594, label %618

594:                                              ; preds = %591
  call void @llvm.lifetime.start.p0(i64 8, ptr %51) #9
  %595 = getelementptr inbounds %struct.timeval, ptr %44, i32 0, i32 0
  %596 = load i64, ptr %595, align 8, !tbaa !42
  %597 = getelementptr inbounds %struct.timeval, ptr %43, i32 0, i32 0
  %598 = load i64, ptr %597, align 8, !tbaa !42
  %599 = sub nsw i64 %596, %598
  %600 = mul nsw i64 %599, 1000
  store i64 %600, ptr %51, align 8, !tbaa !45
  %601 = getelementptr inbounds %struct.timeval, ptr %44, i32 0, i32 1
  %602 = load i64, ptr %601, align 8, !tbaa !46
  %603 = getelementptr inbounds %struct.timeval, ptr %43, i32 0, i32 1
  %604 = load i64, ptr %603, align 8, !tbaa !46
  %605 = sub nsw i64 %602, %604
  %606 = sdiv i64 %605, 1000
  %607 = load i64, ptr %51, align 8, !tbaa !45
  %608 = add nsw i64 %607, %606
  store i64 %608, ptr %51, align 8, !tbaa !45
  %609 = load i64, ptr %51, align 8, !tbaa !45
  %610 = load i32, ptr %11, align 4, !tbaa !9
  %611 = sext i32 %610 to i64
  %612 = icmp sgt i64 %609, %611
  br i1 %612, label %613, label %614

613:                                              ; preds = %594
  store i32 9, ptr %33, align 4
  br label %615

614:                                              ; preds = %594
  store i32 0, ptr %33, align 4
  br label %615

615:                                              ; preds = %614, %613
  call void @llvm.lifetime.end.p0(i64 8, ptr %51) #9
  %616 = load i32, ptr %33, align 4
  switch i32 %616, label %619 [
    i32 0, label %617
  ]

617:                                              ; preds = %615
  br label %618

618:                                              ; preds = %617, %591
  store i32 0, ptr %33, align 4
  br label %619

619:                                              ; preds = %618, %615, %513, %493
  call void @llvm.lifetime.end.p0(i64 4, ptr %50) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %49) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %48) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %47) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %46) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %45) #9
  %620 = load i32, ptr %33, align 4
  switch i32 %620, label %628 [
    i32 0, label %621
    i32 10, label %624
    i32 9, label %627
  ]

621:                                              ; preds = %619
  br label %622

622:                                              ; preds = %621, %410
  br label %623

623:                                              ; preds = %622
  br label %624

624:                                              ; preds = %623, %619
  %625 = load i32, ptr %25, align 4, !tbaa !9
  %626 = icmp sgt i32 %625, 0
  br i1 %626, label %382, label %627, !llvm.loop !47

627:                                              ; preds = %624, %619
  store i32 0, ptr %33, align 4
  br label %628

628:                                              ; preds = %627, %619, %409, %394
  call void @llvm.lifetime.end.p0(i64 16, ptr %44) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr %43) #9
  %629 = load i32, ptr %33, align 4
  switch i32 %629, label %651 [
    i32 0, label %630
    i32 2, label %647
  ]

630:                                              ; preds = %628
  br label %631

631:                                              ; preds = %630, %372
  %632 = load i32, ptr %14, align 4, !tbaa !9
  %633 = icmp ne i32 %632, 0
  br i1 %633, label %634, label %642

634:                                              ; preds = %631
  %635 = load i32, ptr %31, align 4, !tbaa !9
  %636 = icmp ne i32 %635, 0
  br i1 %636, label %637, label %640

637:                                              ; preds = %634
  store i32 0, ptr %31, align 4, !tbaa !9
  %638 = load i32, ptr %22, align 4, !tbaa !9
  %639 = add nsw i32 %638, -1
  store i32 %639, ptr %22, align 4, !tbaa !9
  br label %641

640:                                              ; preds = %634
  store i32 1, ptr %31, align 4, !tbaa !9
  br label %641

641:                                              ; preds = %640, %637
  br label %642

642:                                              ; preds = %641, %631
  br label %643

643:                                              ; preds = %642
  %644 = load i32, ptr %22, align 4, !tbaa !9
  %645 = add nsw i32 %644, 1
  store i32 %645, ptr %22, align 4, !tbaa !9
  br label %268, !llvm.loop !48

646:                                              ; preds = %323, %268
  br label %647

647:                                              ; preds = %646, %628, %302, %235, %165, %121
  %648 = load i32, ptr %24, align 4, !tbaa !9
  %649 = call i32 @close(i32 noundef %648)
  %650 = load ptr, ptr %19, align 8, !tbaa !5
  store ptr %650, ptr %9, align 8
  store i32 1, ptr %33, align 4
  br label %651

651:                                              ; preds = %647, %628, %253, %235, %165, %73
  call void @llvm.lifetime.end.p0(i64 4, ptr %32) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %31) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #9
  call void @llvm.lifetime.end.p0(i64 48, ptr %29) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #9
  call void @llvm.lifetime.end.p0(i64 128, ptr %26) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #9
  call void @llvm.lifetime.end.p0(i64 1536, ptr %23) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #9
  %652 = load ptr, ptr %9, align 8
  ret ptr %652
}

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

; Function Attrs: nounwind
declare i32 @setsockopt(i32 noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef) #1

; Function Attrs: nounwind
declare i32 @if_nametoindex(ptr noundef) #1

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #1

; Function Attrs: nounwind
declare i32 @inet_pton(i32 noundef, ptr noundef, ptr noundef) #1

; Function Attrs: nounwind
declare i32 @ioctl(i32 noundef, i64 noundef, ...) #1

; Function Attrs: nounwind
declare i32 @bind(i32 noundef, ptr noundef, i32 noundef) #1

; Function Attrs: nounwind
declare i32 @snprintf(ptr noundef, i64 noundef, ptr noundef, ...) #1

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

; Function Attrs: nounwind
declare ptr @gai_strerror(i32 noundef) #1

declare i64 @sendto(i32 noundef, ptr noundef, i64 noundef, i32 noundef, ptr noundef, i32 noundef) #2

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

; Function Attrs: nounwind uwtable
declare hidden i32 @upnp_gettimeofday(ptr noundef) #6

declare i32 @receivedata(i32 noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @parseMSEARCHReply(ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #6

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strncmp(ptr noundef, ptr noundef, i64 noundef) #8

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { 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 #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 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 #9 = { nounwind }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !14, i64 0}
!13 = !{!"sockaddr_in6", !14, i64 0, !14, i64 2, !10, i64 4, !15, i64 8, !10, i64 24}
!14 = !{!"short", !7, i64 0}
!15 = !{!"in6_addr", !7, i64 0}
!16 = !{!13, !14, i64 2}
!17 = !{i64 0, i64 16, !11}
!18 = !{!19, !14, i64 0}
!19 = !{!"sockaddr_in", !14, i64 0, !14, i64 2, !20, i64 4, !7, i64 8}
!20 = !{!"in_addr", !10, i64 0}
!21 = !{!19, !14, i64 2}
!22 = !{!19, !10, i64 4}
!23 = !{!20, !10, i64 0}
!24 = !{!25, !10, i64 4}
!25 = !{!"ip_mreqn", !20, i64 0, !20, i64 4, !10, i64 8}
!26 = !{!25, !10, i64 8}
!27 = !{!28, !10, i64 4}
!28 = !{!"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}
!29 = !{!28, !10, i64 8}
!30 = !{!28, !6, i64 24}
!31 = !{!28, !10, i64 16}
!32 = !{!28, !6, i64 40}
!33 = distinct !{!33, !34}
!34 = !{!"llvm.loop.mustprogress"}
!35 = !{!36, !6, i64 8}
!36 = !{!"UPNPDev", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !10, i64 32, !7, i64 36}
!37 = !{!36, !6, i64 16}
!38 = !{!36, !6, i64 24}
!39 = !{!36, !6, i64 0}
!40 = distinct !{!40, !34}
!41 = !{!36, !10, i64 32}
!42 = !{!43, !44, i64 0}
!43 = !{!"timeval", !44, i64 0, !44, i64 8}
!44 = !{!"long", !7, i64 0}
!45 = !{!44, !44, i64 0}
!46 = !{!43, !44, i64 8}
!47 = distinct !{!47, !34}
!48 = distinct !{!48, !34}


; 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.in6_addr = type { %union.anon }
%union.anon = type { [4 x i32] }
%struct.sockaddr_storage = type { i16, [118 x i8], i64 }
%struct.addrinfo = type { i32, i32, i32, i32, i32, ptr, ptr, ptr }
%struct.in_addr = type { i32 }
%struct.ip_mreqn = type { %struct.in_addr, %struct.in_addr, i32 }
%struct.ifreq = type { %union.anon.0, %union.anon.1 }
%union.anon.0 = type { [16 x i8] }
%union.anon.1 = type { %struct.ifmap }
%struct.ifmap = type { i64, i64, i16, i8, i8, i8 }
%struct.timeval = type { i64, i64 }

@ssdpDiscoverDevices.MSearchMsgFmt = external hidden constant [77 x i8], align 16
@.str.5 = external hidden unnamed_addr constant [7 x i8], align 1
@in6addr_any = external local_unnamed_addr constant %struct.in6_addr, align 4
@.str.6 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [33 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.9 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [50 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [7 x i8], align 1

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

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

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

; Function Attrs: nofree nounwind
declare void @perror(ptr nocapture noundef readonly) local_unnamed_addr #2

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strncpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly, i64 noundef) local_unnamed_addr #4

declare i32 @close(i32 noundef) local_unnamed_addr #5

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6

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

; Function Attrs: nounwind uwtable
define dso_local ptr @ssdpDiscoverDevices(ptr nocapture noundef readonly %0, i32 noundef %1, ptr noundef %2, i32 noundef %3, i32 noundef %4, i8 noundef zeroext %5, ptr noundef writeonly %6, i32 noundef %7) local_unnamed_addr #8 {
  %9 = alloca i8, align 1
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca [1536 x i8], align 16
  %13 = alloca %struct.sockaddr_storage, align 8
  %14 = alloca %struct.addrinfo, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca %struct.in_addr, align 4
  %19 = alloca %struct.ip_mreqn, align 4
  %20 = alloca %struct.ifreq, align 8
  %21 = alloca i32, align 4
  %22 = alloca %struct.timeval, align 8
  %23 = alloca %struct.timeval, align 8
  %24 = alloca ptr, align 8
  %25 = alloca i32, align 4
  %26 = alloca ptr, align 8
  %27 = alloca i32, align 4
  %28 = alloca ptr, align 8
  %29 = alloca i32, align 4
  store i8 %5, ptr %9, align 1, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #12
  store i32 0, ptr %10, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #12
  store i32 1, ptr %11, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 1536, ptr nonnull %12) #12
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %13) #12
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %14) #12
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %15) #12
  %30 = icmp ne ptr %6, null
  br i1 %30, label %31, label %32

31:                                               ; preds = %8
  store i32 -1, ptr %6, align 4, !tbaa !8
  br label %32

32:                                               ; preds = %31, %8
  %33 = icmp eq i32 %3, 1
  %spec.store.select = select i1 %33, i32 1900, i32 %3
  %.not = icmp ne i32 %4, 0
  %34 = select i1 %.not, i32 10, i32 2
  %35 = tail call i32 @socket(i32 noundef %34, i32 noundef 2, i32 noundef 0) #12
  %36 = icmp slt i32 %35, 0
  br i1 %36, label %37, label %40

37:                                               ; preds = %32
  br i1 %30, label %38, label %39

38:                                               ; preds = %37
  store i32 -101, ptr %6, align 4, !tbaa !8
  br label %39

39:                                               ; preds = %38, %37
  tail call void @perror(ptr noundef nonnull @.str.5) #13
  br label %302

40:                                               ; preds = %32
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(128) %13, i8 0, i64 128, i1 false)
  %41 = add i32 %spec.store.select, -1
  %or.cond = icmp ult i32 %41, 65535
  br i1 %.not, label %42, label %47

42:                                               ; preds = %40
  store i16 10, ptr %13, align 8, !tbaa !10
  br i1 %or.cond, label %43, label %.thread

43:                                               ; preds = %42
  %44 = trunc nuw i32 %spec.store.select to i16
  %45 = tail call zeroext i16 @__bswap_16(i16 noundef zeroext %44)
  %46 = getelementptr inbounds i8, ptr %13, i64 2
  store i16 %45, ptr %46, align 2, !tbaa !14
  br label %.thread

47:                                               ; preds = %40
  store i16 2, ptr %13, align 8, !tbaa !15
  br i1 %or.cond, label %48, label %52

48:                                               ; preds = %47
  %49 = trunc nuw i32 %spec.store.select to i16
  %50 = tail call zeroext i16 @__bswap_16(i16 noundef zeroext %49)
  %51 = getelementptr inbounds i8, ptr %13, i64 2
  store i16 %50, ptr %51, align 2, !tbaa !18
  br label %52

52:                                               ; preds = %47, %48
  %53 = getelementptr inbounds i8, ptr %13, i64 4
  store i32 0, ptr %53, align 4, !tbaa !19
  %54 = call i32 @setsockopt(i32 noundef %35, i32 noundef 1, i32 noundef 2, ptr noundef nonnull %11, i32 noundef 4) #12
  %55 = icmp slt i32 %54, 0
  br i1 %55, label %59, label %67

.thread:                                          ; preds = %42, %43
  %56 = getelementptr inbounds i8, ptr %13, i64 8
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %56, ptr noundef nonnull align 4 dereferenceable(16) @in6addr_any, i64 16, i1 false), !tbaa.struct !20
  %57 = call i32 @setsockopt(i32 noundef %35, i32 noundef 1, i32 noundef 2, ptr noundef nonnull %11, i32 noundef 4) #12
  %58 = icmp slt i32 %57, 0
  br i1 %58, label %59, label %.thread203

59:                                               ; preds = %.thread, %52
  br i1 %30, label %60, label %61

60:                                               ; preds = %59
  store i32 -101, ptr %6, align 4, !tbaa !8
  br label %61

61:                                               ; preds = %60, %59
  call void @perror(ptr noundef nonnull @.str.6) #13
  br label %.loopexit

.thread203:                                       ; preds = %.thread
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %16) #12
  %62 = load i8, ptr %9, align 1, !tbaa !5
  %63 = zext i8 %62 to i32
  store i32 %63, ptr %16, align 4, !tbaa !8
  %64 = call i32 @setsockopt(i32 noundef %35, i32 noundef 41, i32 noundef 18, ptr noundef nonnull %16, i32 noundef 4) #12
  %65 = icmp slt i32 %64, 0
  br i1 %65, label %66, label %.thread204

66:                                               ; preds = %.thread203
  call void @perror(ptr noundef nonnull @.str.7) #13
  br label %.thread204

67:                                               ; preds = %52
  %68 = call i32 @setsockopt(i32 noundef %35, i32 noundef 0, i32 noundef 33, ptr noundef nonnull %9, i32 noundef 1) #12
  %69 = icmp slt i32 %68, 0
  br i1 %69, label %70, label %71

70:                                               ; preds = %67
  call void @perror(ptr noundef nonnull @.str.8) #13
  br label %71

71:                                               ; preds = %67, %70
  %.not184 = icmp eq ptr %2, null
  br i1 %.not184, label %114, label %83

.thread204:                                       ; preds = %.thread203, %66
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %16) #12
  %.not184205 = icmp eq ptr %2, null
  br i1 %.not184205, label %114, label %.thread206

.thread206:                                       ; preds = %.thread204
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %17) #12
  %72 = call i32 @if_nametoindex(ptr noundef nonnull %2) #12
  store i32 %72, ptr %17, align 4, !tbaa !8
  %73 = icmp eq i32 %72, 0
  br i1 %73, label %74, label %76

74:                                               ; preds = %.thread206
  br i1 %30, label %75, label %80

75:                                               ; preds = %74
  store i32 -103, ptr %6, align 4, !tbaa !8
  br label %80

76:                                               ; preds = %.thread206
  %77 = call i32 @setsockopt(i32 noundef %35, i32 noundef 41, i32 noundef 17, ptr noundef nonnull %17, i32 noundef 4) #12
  %78 = icmp slt i32 %77, 0
  br i1 %78, label %79, label %.thread207

79:                                               ; preds = %76
  call void @perror(ptr noundef nonnull @.str.10) #13
  br label %.thread207

.thread207:                                       ; preds = %79, %76
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %17) #12
  br label %114

80:                                               ; preds = %74, %75
  %81 = load ptr, ptr @stderr, align 8, !tbaa !21
  %82 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %81, ptr noundef nonnull @.str.9, ptr noundef nonnull %2) #14
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %17) #12
  br label %.loopexit

83:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %18) #12
  %84 = call i32 @inet_pton(i32 noundef 2, ptr noundef nonnull %2, ptr noundef nonnull %18) #12
  %85 = icmp slt i32 %84, 1
  br i1 %85, label %.thread210, label %86

.thread210:                                       ; preds = %83
  store i32 -1, ptr %18, align 4, !tbaa !23
  br label %91

86:                                               ; preds = %83
  %.pr = load i32, ptr %18, align 4, !tbaa !23
  %.not185 = icmp eq i32 %.pr, -1
  br i1 %.not185, label %91, label %87

87:                                               ; preds = %86
  store i32 %.pr, ptr %53, align 4, !tbaa !19
  %88 = call i32 @setsockopt(i32 noundef %35, i32 noundef 0, i32 noundef 32, ptr noundef nonnull %18, i32 noundef 4) #12
  %89 = icmp slt i32 %88, 0
  br i1 %89, label %90, label %.thread217

90:                                               ; preds = %87
  call void @perror(ptr noundef nonnull @.str.11) #13
  br label %.thread217

91:                                               ; preds = %.thread210, %86
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %19) #12
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %20) #12
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %21) #12
  store i32 40, ptr %21, align 4, !tbaa !8
  %92 = call ptr @strncpy(ptr noundef nonnull dereferenceable(1) %20, ptr noundef nonnull dereferenceable(1) %2, i64 noundef 16) #12
  %93 = getelementptr inbounds i8, ptr %20, i64 15
  store i8 0, ptr %93, align 1, !tbaa !5
  %94 = call i32 (i32, i64, ...) @ioctl(i32 noundef %35, i64 noundef 35093, ptr noundef nonnull %20, ptr noundef nonnull %21) #12
  %95 = icmp slt i32 %94, 0
  br i1 %95, label %96, label %97

96:                                               ; preds = %91
  call void @perror(ptr noundef nonnull @.str.12) #13
  br label %113

97:                                               ; preds = %91
  %98 = getelementptr inbounds i8, ptr %20, i64 20
  %99 = load i32, ptr %98, align 4, !tbaa !5
  store i32 %99, ptr %18, align 4, !tbaa !23
  store i32 0, ptr %19, align 4
  %100 = getelementptr inbounds i8, ptr %19, i64 4
  store i32 %99, ptr %100, align 4, !tbaa !24
  %101 = call i32 @if_nametoindex(ptr noundef nonnull %2) #12
  %102 = getelementptr inbounds i8, ptr %19, i64 8
  store i32 %101, ptr %102, align 4, !tbaa !26
  %103 = icmp eq i32 %101, 0
  br i1 %103, label %104, label %109

104:                                              ; preds = %97
  br i1 %30, label %105, label %106

105:                                              ; preds = %104
  store i32 -103, ptr %6, align 4, !tbaa !8
  br label %106

106:                                              ; preds = %105, %104
  %107 = load ptr, ptr @stderr, align 8, !tbaa !21
  %108 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %107, ptr noundef nonnull @.str.13, ptr noundef nonnull %2) #14
  br label %113

109:                                              ; preds = %97
  %110 = call i32 @setsockopt(i32 noundef %35, i32 noundef 0, i32 noundef 32, ptr noundef nonnull %19, i32 noundef 12) #12
  %111 = icmp slt i32 %110, 0
  br i1 %111, label %112, label %.thread213

112:                                              ; preds = %109
  call void @perror(ptr noundef nonnull @.str.11) #13
  br label %.thread213

.thread213:                                       ; preds = %112, %109
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %21) #12
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %20) #12
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %19) #12
  br label %.thread217

.thread217:                                       ; preds = %.thread213, %87, %90
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %18) #12
  br label %114

113:                                              ; preds = %96, %106
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %21) #12
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %20) #12
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %19) #12
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %18) #12
  br label %.loopexit

114:                                              ; preds = %.thread217, %.thread207, %.thread204, %71
  %115 = phi i32 [ 16, %.thread217 ], [ 28, %.thread207 ], [ 28, %.thread204 ], [ 16, %71 ]
  %116 = call i32 @bind(i32 noundef %35, ptr noundef nonnull %13, i32 noundef %115) #12
  %.not186 = icmp eq i32 %116, 0
  br i1 %.not186, label %121, label %117

117:                                              ; preds = %114
  br i1 %30, label %118, label %119

118:                                              ; preds = %117
  store i32 -101, ptr %6, align 4, !tbaa !8
  br label %119

119:                                              ; preds = %118, %117
  call void @perror(ptr noundef nonnull @.str.14) #13
  %120 = call i32 @close(i32 noundef %35) #12
  br label %302

121:                                              ; preds = %114
  br i1 %30, label %122, label %123

122:                                              ; preds = %121
  store i32 0, ptr %6, align 4, !tbaa !8
  br label %123

123:                                              ; preds = %122, %121
  %124 = udiv i32 %1, 1000
  %125 = icmp ult i32 %1, 1000
  %spec.select = select i1 %125, i32 1, i32 %124
  %spec.select200 = call i32 @llvm.umax.i32(i32 %1, i32 1000)
  %126 = load ptr, ptr %0, align 8, !tbaa !21
  %.not187267 = icmp eq ptr %126, null
  br i1 %.not187267, label %.loopexit, label %.lr.ph272

.lr.ph272:                                        ; preds = %123
  %127 = getelementptr inbounds i8, ptr %14, i64 8
  %128 = icmp ne i32 %7, 0
  %129 = getelementptr inbounds i8, ptr %23, i64 8
  %130 = getelementptr inbounds i8, ptr %22, i64 8
  %131 = sext i32 %spec.select200 to i64
  br label %132

132:                                              ; preds = %.lr.ph272, %296
  %133 = phi ptr [ %126, %.lr.ph272 ], [ %300, %296 ]
  %134 = phi ptr [ %0, %.lr.ph272 ], [ %299, %296 ]
  %.0153270 = phi i32 [ 1, %.lr.ph272 ], [ %.1154, %296 ]
  %.0158269 = phi ptr [ null, %.lr.ph272 ], [ %.7, %296 ]
  %.0164268 = phi i32 [ 0, %.lr.ph272 ], [ %297, %296 ]
  %.not188 = icmp ne i32 %.0153270, 0
  %135 = select i1 %.not188, ptr @.str.15, ptr @.str.16
  %136 = select i1 %.not, ptr %135, ptr @.str.17
  %137 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %12, i64 noundef 1536, ptr noundef nonnull @ssdpDiscoverDevices.MSearchMsgFmt, ptr noundef nonnull %136, ptr noundef nonnull %133, i32 noundef %spec.select) #12
  %138 = icmp ugt i32 %137, 1535
  br i1 %138, label %139, label %141

139:                                              ; preds = %132
  br i1 %30, label %140, label %.loopexit

140:                                              ; preds = %139
  store i32 -102, ptr %6, align 4, !tbaa !8
  br label %.loopexit

141:                                              ; preds = %132
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(48) %14, i8 0, i64 48, i1 false)
  store i32 2, ptr %127, align 8, !tbaa !27
  %142 = select i1 %.not188, ptr @.str.18, ptr @.str.19
  %143 = select i1 %.not, ptr %142, ptr @.str.17
  %144 = call i32 @getaddrinfo(ptr noundef nonnull %143, ptr noundef nonnull @.str.20, ptr noundef nonnull %14, ptr noundef nonnull %15) #12
  %.not190 = icmp eq i32 %144, 0
  br i1 %.not190, label %.preheader239, label %145

.preheader239:                                    ; preds = %141
  %.0148253 = load ptr, ptr %15, align 8, !tbaa !21
  %.not191254 = icmp eq ptr %.0148253, null
  br i1 %.not191254, label %._crit_edge, label %.lr.ph

145:                                              ; preds = %141
  br i1 %30, label %146, label %147

146:                                              ; preds = %145
  store i32 -101, ptr %6, align 4, !tbaa !8
  br label %147

147:                                              ; preds = %146, %145
  %148 = load ptr, ptr @stderr, align 8, !tbaa !21
  %149 = call ptr @gai_strerror(i32 noundef %144) #12
  %150 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %148, ptr noundef nonnull @.str.21, ptr noundef %149) #14
  br label %.loopexit

.lr.ph:                                           ; preds = %.preheader239, %160
  %.0148257 = phi ptr [ %.0148, %160 ], [ %.0148253, %.preheader239 ]
  %.0151256 = phi i32 [ %.1152, %160 ], [ 0, %.preheader239 ]
  %.0157255 = phi i32 [ %157, %160 ], [ %137, %.preheader239 ]
  %151 = sext i32 %.0157255 to i64
  %152 = getelementptr inbounds i8, ptr %.0148257, i64 24
  %153 = load ptr, ptr %152, align 8, !tbaa !29
  %154 = getelementptr inbounds i8, ptr %.0148257, i64 16
  %155 = load i32, ptr %154, align 8, !tbaa !30
  %156 = call i64 @sendto(i32 noundef %35, ptr noundef nonnull %12, i64 noundef %151, i32 noundef 0, ptr noundef %153, i32 noundef %155) #12
  %157 = trunc i64 %156 to i32
  %158 = icmp slt i32 %157, 0
  br i1 %158, label %159, label %160

159:                                              ; preds = %.lr.ph
  call void @perror(ptr noundef nonnull @.str.22) #13
  br label %160

160:                                              ; preds = %.lr.ph, %159
  %.1152 = phi i32 [ %.0151256, %159 ], [ 1, %.lr.ph ]
  %161 = getelementptr inbounds i8, ptr %.0148257, i64 40
  %.0148 = load ptr, ptr %161, align 8, !tbaa !21
  %.not191 = icmp eq ptr %.0148, null
  br i1 %.not191, label %._crit_edge.loopexit, label %.lr.ph, !llvm.loop !31

._crit_edge.loopexit:                             ; preds = %160
  %.pre = load ptr, ptr %15, align 8, !tbaa !21
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader239
  %162 = phi ptr [ null, %.preheader239 ], [ %.pre, %._crit_edge.loopexit ]
  %.0151.lcssa = phi i32 [ 0, %.preheader239 ], [ %.1152, %._crit_edge.loopexit ]
  call void @freeaddrinfo(ptr noundef %162) #12
  %163 = icmp eq i32 %.0151.lcssa, 0
  %or.cond12 = and i1 %30, %163
  br i1 %or.cond12, label %.thread219, label %164

.thread219:                                       ; preds = %._crit_edge
  store i32 -101, ptr %6, align 4, !tbaa !8
  br label %165

164:                                              ; preds = %._crit_edge
  %or.cond6 = or i1 %128, %163
  br i1 %or.cond6, label %165, label %.split

165:                                              ; preds = %.thread219, %164
  %166 = getelementptr i8, ptr %134, i64 8
  %167 = load ptr, ptr %166, align 8, !tbaa !21
  %.not192 = icmp eq ptr %167, null
  br i1 %.not192, label %.split, label %296

.split:                                           ; preds = %164, %165
  %168 = phi i1 [ false, %164 ], [ %128, %165 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %22) #12
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %22, i8 0, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %23) #12
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %23, i8 0, i64 16, i1 false)
  %169 = call i32 @upnp_gettimeofday(ptr noundef nonnull %22)
  %170 = call i32 @receivedata(i32 noundef %35, ptr noundef nonnull %12, i32 noundef 1536, i32 noundef %spec.select200, ptr noundef nonnull %10) #12
  %171 = icmp slt i32 %170, 0
  br i1 %171, label %.split._crit_edge, label %.lr.ph263

.split._crit_edge:                                ; preds = %.split, %.thread226
  %.1159.lcssa = phi ptr [ %.3161.ph, %.thread226 ], [ %.0158269, %.split ]
  br i1 %30, label %172, label %.thread232

172:                                              ; preds = %.split._crit_edge
  store i32 -101, ptr %6, align 4, !tbaa !8
  br label %.thread232

.lr.ph263:                                        ; preds = %.split, %.thread226
  %173 = phi i32 [ %293, %.thread226 ], [ %170, %.split ]
  %.1159261 = phi ptr [ %.3161.ph, %.thread226 ], [ %.0158269, %.split ]
  %174 = icmp eq i32 %173, 0
  br i1 %174, label %175, label %179

175:                                              ; preds = %.lr.ph263
  %176 = icmp eq ptr %.1159261, null
  %or.cond8 = or i1 %168, %176
  br i1 %or.cond8, label %.thread236, label %177

177:                                              ; preds = %175
  br i1 %30, label %178, label %.thread232

178:                                              ; preds = %177
  store i32 0, ptr %6, align 4, !tbaa !8
  br label %.thread232

179:                                              ; preds = %.lr.ph263
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %24) #12
  store ptr null, ptr %24, align 8, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %25) #12
  store i32 0, ptr %25, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %26) #12
  store ptr null, ptr %26, align 8, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %27) #12
  store i32 0, ptr %27, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %28) #12
  store ptr null, ptr %28, align 8, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %29) #12
  store i32 0, ptr %29, align 4, !tbaa !8
  call void @parseMSEARCHReply(ptr noundef nonnull %12, i32 noundef %173, ptr noundef nonnull %24, ptr noundef nonnull %25, ptr noundef nonnull %26, ptr noundef nonnull %27, ptr noundef nonnull %28, ptr noundef nonnull %29)
  %180 = load ptr, ptr %26, align 8, !tbaa !21
  %181 = icmp ne ptr %180, null
  %182 = load ptr, ptr %24, align 8
  %183 = icmp ne ptr %182, null
  %or.cond10 = select i1 %181, i1 %183, i1 false
  br i1 %or.cond10, label %.preheader, label %280

.preheader:                                       ; preds = %179
  %.not193258 = icmp eq ptr %.1159261, null
  %.pre292 = load i32, ptr %25, align 4, !tbaa !8
  %.pre293 = load i32, ptr %27, align 4
  %.pre294 = load i32, ptr %29, align 4
  %.fr274 = freeze i32 %.pre294
  %.pre297 = sext i32 %.pre292 to i64
  %.pre298 = sext i32 %.pre293 to i64
  br i1 %.not193258, label %.critedge, label %.lr.ph260

.lr.ph260:                                        ; preds = %.preheader
  %184 = icmp eq i32 %.fr274, 0
  %185 = load ptr, ptr %28, align 8
  %186 = sext i32 %.fr274 to i64
  br i1 %184, label %.lr.ph260.split.us, label %.lr.ph260.split

.lr.ph260.split.us:                               ; preds = %.lr.ph260, %210
  %.0155259.us = phi ptr [ %211, %210 ], [ %.1159261, %.lr.ph260 ]
  %187 = getelementptr inbounds i8, ptr %.0155259.us, i64 8
  %188 = load ptr, ptr %187, align 8, !tbaa !33
  %189 = call i32 @strncmp(ptr noundef %188, ptr noundef nonnull %182, i64 noundef %.pre297) #15
  %190 = icmp eq i32 %189, 0
  br i1 %190, label %191, label %210

191:                                              ; preds = %.lr.ph260.split.us
  %192 = getelementptr inbounds i8, ptr %188, i64 %.pre297
  %193 = load i8, ptr %192, align 1, !tbaa !5
  %194 = icmp eq i8 %193, 0
  br i1 %194, label %195, label %210

195:                                              ; preds = %191
  %196 = getelementptr inbounds i8, ptr %.0155259.us, i64 16
  %197 = load ptr, ptr %196, align 8, !tbaa !35
  %198 = call i32 @strncmp(ptr noundef %197, ptr noundef nonnull %180, i64 noundef %.pre298) #15
  %199 = icmp eq i32 %198, 0
  br i1 %199, label %200, label %210

200:                                              ; preds = %195
  %201 = getelementptr inbounds i8, ptr %197, i64 %.pre298
  %202 = load i8, ptr %201, align 1, !tbaa !5
  %203 = icmp eq i8 %202, 0
  br i1 %203, label %204, label %210

204:                                              ; preds = %200
  %205 = getelementptr inbounds i8, ptr %.0155259.us, i64 24
  %206 = load ptr, ptr %205, align 8, !tbaa !36
  %207 = getelementptr inbounds i8, ptr %206, i64 %186
  %208 = load i8, ptr %207, align 1, !tbaa !5
  %209 = icmp eq i8 %208, 0
  br i1 %209, label %.thread226, label %210

210:                                              ; preds = %204, %200, %195, %191, %.lr.ph260.split.us
  %211 = load ptr, ptr %.0155259.us, align 8, !tbaa !37
  %.not193.us = icmp eq ptr %211, null
  br i1 %.not193.us, label %.critedge, label %.lr.ph260.split.us, !llvm.loop !38

.lr.ph260.split:                                  ; preds = %.lr.ph260, %238
  %.0155259 = phi ptr [ %239, %238 ], [ %.1159261, %.lr.ph260 ]
  %212 = getelementptr inbounds i8, ptr %.0155259, i64 8
  %213 = load ptr, ptr %212, align 8, !tbaa !33
  %214 = call i32 @strncmp(ptr noundef %213, ptr noundef nonnull %182, i64 noundef %.pre297) #15
  %215 = icmp eq i32 %214, 0
  br i1 %215, label %216, label %238

216:                                              ; preds = %.lr.ph260.split
  %217 = getelementptr inbounds i8, ptr %213, i64 %.pre297
  %218 = load i8, ptr %217, align 1, !tbaa !5
  %219 = icmp eq i8 %218, 0
  br i1 %219, label %220, label %238

220:                                              ; preds = %216
  %221 = getelementptr inbounds i8, ptr %.0155259, i64 16
  %222 = load ptr, ptr %221, align 8, !tbaa !35
  %223 = call i32 @strncmp(ptr noundef %222, ptr noundef nonnull %180, i64 noundef %.pre298) #15
  %224 = icmp eq i32 %223, 0
  br i1 %224, label %225, label %238

225:                                              ; preds = %220
  %226 = getelementptr inbounds i8, ptr %222, i64 %.pre298
  %227 = load i8, ptr %226, align 1, !tbaa !5
  %228 = icmp eq i8 %227, 0
  br i1 %228, label %229, label %238

229:                                              ; preds = %225
  %230 = getelementptr inbounds i8, ptr %.0155259, i64 24
  %231 = load ptr, ptr %230, align 8, !tbaa !36
  %232 = call i32 @strncmp(ptr noundef %231, ptr noundef %185, i64 noundef %186) #15
  %233 = icmp eq i32 %232, 0
  br i1 %233, label %234, label %238

234:                                              ; preds = %229
  %235 = getelementptr inbounds i8, ptr %231, i64 %186
  %236 = load i8, ptr %235, align 1, !tbaa !5
  %237 = icmp eq i8 %236, 0
  br i1 %237, label %.thread226, label %238

238:                                              ; preds = %.lr.ph260.split, %216, %220, %225, %229, %234
  %239 = load ptr, ptr %.0155259, align 8, !tbaa !37
  %.not193 = icmp eq ptr %239, null
  br i1 %.not193, label %.critedge, label %.lr.ph260.split, !llvm.loop !38

.critedge:                                        ; preds = %238, %210, %.preheader
  %240 = sext i32 %.fr274 to i64
  %241 = add nsw i64 %.pre297, 43
  %242 = add nsw i64 %241, %.pre298
  %243 = add nsw i64 %242, %240
  %244 = call noalias ptr @malloc(i64 noundef %243) #16
  %.not194 = icmp eq ptr %244, null
  br i1 %.not194, label %245, label %247

245:                                              ; preds = %.critedge
  br i1 %30, label %246, label %.thread222

246:                                              ; preds = %245
  store i32 -102, ptr %6, align 4, !tbaa !8
  br label %.thread222

247:                                              ; preds = %.critedge
  store ptr %.1159261, ptr %244, align 8, !tbaa !37
  %248 = getelementptr inbounds i8, ptr %244, i64 36
  %249 = getelementptr inbounds i8, ptr %244, i64 8
  store ptr %248, ptr %249, align 8, !tbaa !33
  %250 = getelementptr inbounds i8, ptr %244, i64 37
  %251 = getelementptr inbounds i8, ptr %250, i64 %.pre297
  %252 = getelementptr inbounds i8, ptr %244, i64 16
  store ptr %251, ptr %252, align 8, !tbaa !35
  %253 = getelementptr inbounds i8, ptr %251, i64 1
  %254 = getelementptr inbounds i8, ptr %253, i64 %.pre298
  %255 = getelementptr inbounds i8, ptr %244, i64 24
  store ptr %254, ptr %255, align 8, !tbaa !36
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 4 %248, ptr nonnull align 1 %182, i64 %.pre297, i1 false)
  %256 = getelementptr inbounds [0 x i8], ptr %248, i64 0, i64 %.pre297
  store i8 0, ptr %256, align 1, !tbaa !5
  %257 = load ptr, ptr %252, align 8, !tbaa !35
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %257, ptr nonnull align 1 %180, i64 %.pre298, i1 false)
  %258 = load i32, ptr %25, align 4, !tbaa !8
  %259 = add nsw i32 %258, 1
  %260 = load i32, ptr %27, align 4, !tbaa !8
  %261 = add nsw i32 %259, %260
  %262 = sext i32 %261 to i64
  %263 = getelementptr inbounds [0 x i8], ptr %248, i64 0, i64 %262
  store i8 0, ptr %263, align 1, !tbaa !5
  %264 = load ptr, ptr %28, align 8, !tbaa !21
  %.not195 = icmp eq ptr %264, null
  br i1 %.not195, label %269, label %265

265:                                              ; preds = %247
  %266 = load ptr, ptr %255, align 8, !tbaa !36
  %267 = load i32, ptr %29, align 4, !tbaa !8
  %268 = sext i32 %267 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %266, ptr nonnull align 1 %264, i64 %268, i1 false)
  %.pre295 = load i32, ptr %25, align 4, !tbaa !8
  %.pre296 = load i32, ptr %27, align 4, !tbaa !8
  br label %269

269:                                              ; preds = %265, %247
  %270 = phi i32 [ %.pre296, %265 ], [ %260, %247 ]
  %271 = phi i32 [ %.pre295, %265 ], [ %258, %247 ]
  %272 = load i32, ptr %29, align 4, !tbaa !8
  %273 = add i32 %271, 2
  %274 = add i32 %273, %270
  %275 = add nsw i32 %274, %272
  %276 = sext i32 %275 to i64
  %277 = getelementptr inbounds [0 x i8], ptr %248, i64 0, i64 %276
  store i8 0, ptr %277, align 1, !tbaa !5
  %278 = load i32, ptr %10, align 4, !tbaa !8
  %279 = getelementptr inbounds i8, ptr %244, i64 32
  store i32 %278, ptr %279, align 8, !tbaa !39
  br label %280

280:                                              ; preds = %269, %179
  %.2160 = phi ptr [ %244, %269 ], [ %.1159261, %179 ]
  %281 = call i32 @upnp_gettimeofday(ptr noundef nonnull %23)
  %282 = icmp sgt i32 %281, -1
  br i1 %282, label %283, label %.thread226

283:                                              ; preds = %280
  %284 = load i64, ptr %23, align 8, !tbaa !40
  %285 = load i64, ptr %22, align 8, !tbaa !40
  %286 = sub nsw i64 %284, %285
  %287 = mul nsw i64 %286, 1000
  %288 = load i64, ptr %129, align 8, !tbaa !43
  %289 = load i64, ptr %130, align 8, !tbaa !43
  %290 = sub nsw i64 %288, %289
  %291 = sdiv i64 %290, 1000
  %292 = add nsw i64 %291, %287
  %.not196 = icmp sgt i64 %292, %131
  br i1 %.not196, label %295, label %.thread226

.thread222:                                       ; preds = %246, %245
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %29) #12
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %28) #12
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %27) #12
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %26) #12
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %25) #12
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %24) #12
  br label %.thread232

.thread226:                                       ; preds = %234, %204, %283, %280
  %.3161.ph = phi ptr [ %.2160, %283 ], [ %.2160, %280 ], [ %.1159261, %204 ], [ %.1159261, %234 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %29) #12
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %28) #12
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %27) #12
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %26) #12
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %25) #12
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %24) #12
  %293 = call i32 @receivedata(i32 noundef %35, ptr noundef nonnull %12, i32 noundef 1536, i32 noundef %spec.select200, ptr noundef nonnull %10) #12
  %294 = icmp slt i32 %293, 0
  br i1 %294, label %.split._crit_edge, label %.lr.ph263

295:                                              ; preds = %283
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %29) #12
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %28) #12
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %27) #12
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %26) #12
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %25) #12
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %24) #12
  br label %.thread236

.thread232:                                       ; preds = %172, %.split._crit_edge, %178, %177, %.thread222
  %.1159244 = phi ptr [ %.1159.lcssa, %172 ], [ %.1159.lcssa, %.split._crit_edge ], [ %.1159261, %178 ], [ %.1159261, %177 ], [ %.1159261, %.thread222 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %23) #12
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %22) #12
  br label %.loopexit

.thread236:                                       ; preds = %295, %175
  %.6.ph = phi ptr [ %.1159261, %175 ], [ %.2160, %295 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %23) #12
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %22) #12
  br label %296

296:                                              ; preds = %.thread236, %165
  %.7 = phi ptr [ %.0158269, %165 ], [ %.6.ph, %.thread236 ]
  %not..not188 = xor i1 %.not188, true
  %spec.select202 = zext i1 %not..not188 to i32
  %narrow = select i1 %.not, i1 %.not188, i1 false
  %spec.select201 = sext i1 %narrow to i32
  %.1154 = select i1 %.not, i32 %spec.select202, i32 %.0153270
  %.1165 = add i32 %.0164268, 1
  %297 = add i32 %.1165, %spec.select201
  %298 = sext i32 %297 to i64
  %299 = getelementptr inbounds ptr, ptr %0, i64 %298
  %300 = load ptr, ptr %299, align 8, !tbaa !21
  %.not187 = icmp eq ptr %300, null
  br i1 %.not187, label %.loopexit, label %132, !llvm.loop !44

.loopexit:                                        ; preds = %296, %123, %.thread232, %113, %80, %147, %139, %140, %61
  %.8 = phi ptr [ null, %61 ], [ null, %80 ], [ %.0158269, %140 ], [ %.0158269, %139 ], [ %.0158269, %147 ], [ null, %113 ], [ %.1159244, %.thread232 ], [ null, %123 ], [ %.7, %296 ]
  %301 = call i32 @close(i32 noundef %35) #12
  br label %302

302:                                              ; preds = %.loopexit, %119, %39
  %.0 = phi ptr [ null, %39 ], [ %.8, %.loopexit ], [ null, %119 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %15) #12
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %14) #12
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %13) #12
  call void @llvm.lifetime.end.p0(i64 1536, ptr nonnull %12) #12
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #12
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #12
  ret ptr %.0
}

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

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

; Function Attrs: nounwind
declare i32 @if_nametoindex(ptr noundef) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #2

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

; Function Attrs: nounwind
declare i32 @ioctl(i32 noundef, i64 noundef, ...) local_unnamed_addr #1

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

; Function Attrs: nofree nounwind
declare noundef i32 @snprintf(ptr noalias nocapture noundef writeonly, i64 noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #2

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

; Function Attrs: nounwind
declare ptr @gai_strerror(i32 noundef) local_unnamed_addr #1

declare i64 @sendto(i32 noundef, ptr noundef, i64 noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #5

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

; Function Attrs: nounwind uwtable
declare hidden i32 @upnp_gettimeofday(ptr noundef) local_unnamed_addr #8

declare i32 @receivedata(i32 noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #5

; Function Attrs: nounwind uwtable
declare hidden void @parseMSEARCHReply(ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #8

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umax.i32(i32, i32) #11

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { 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 #8 = { 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 = { 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 #10 = { 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 #11 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #12 = { nounwind }
attributes #13 = { cold }
attributes #14 = { cold nounwind }
attributes #15 = { nounwind willreturn memory(read) }
attributes #16 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = !{!11, !12, i64 0}
!11 = !{!"sockaddr_in6", !12, i64 0, !12, i64 2, !9, i64 4, !13, i64 8, !9, i64 24}
!12 = !{!"short", !6, i64 0}
!13 = !{!"in6_addr", !6, i64 0}
!14 = !{!11, !12, i64 2}
!15 = !{!16, !12, i64 0}
!16 = !{!"sockaddr_in", !12, i64 0, !12, i64 2, !17, i64 4, !6, i64 8}
!17 = !{!"in_addr", !9, i64 0}
!18 = !{!16, !12, i64 2}
!19 = !{!16, !9, i64 4}
!20 = !{i64 0, i64 16, !5}
!21 = !{!22, !22, i64 0}
!22 = !{!"any pointer", !6, i64 0}
!23 = !{!17, !9, i64 0}
!24 = !{!25, !9, i64 4}
!25 = !{!"ip_mreqn", !17, i64 0, !17, i64 4, !9, i64 8}
!26 = !{!25, !9, i64 8}
!27 = !{!28, !9, i64 8}
!28 = !{!"addrinfo", !9, i64 0, !9, i64 4, !9, i64 8, !9, i64 12, !9, i64 16, !22, i64 24, !22, i64 32, !22, i64 40}
!29 = !{!28, !22, i64 24}
!30 = !{!28, !9, i64 16}
!31 = distinct !{!31, !32}
!32 = !{!"llvm.loop.mustprogress"}
!33 = !{!34, !22, i64 8}
!34 = !{!"UPNPDev", !22, i64 0, !22, i64 8, !22, i64 16, !22, i64 24, !9, i64 32, !6, i64 36}
!35 = !{!34, !22, i64 16}
!36 = !{!34, !22, i64 24}
!37 = !{!34, !22, i64 0}
!38 = distinct !{!38, !32}
!39 = !{!34, !9, i64 32}
!40 = !{!41, !42, i64 0}
!41 = !{!"timeval", !42, i64 0, !42, i64 8}
!42 = !{!"long", !6, i64 0}
!43 = !{!41, !42, i64 8}
!44 = distinct !{!44, !32}


; Effective O3 passes: ConstraintEliminationPass,CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,MemCpyOptPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass