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

; 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.UPNPDev = type { ptr, ptr, ptr, ptr, i32, [0 x i8] }
%struct.xml_desc = type { [40 x i8], ptr, i32, i32 }
%struct.IGDdatas = type { [128 x i8], [128 x i8], [128 x i8], i32, %struct.IGDdatas_service, %struct.IGDdatas_service, %struct.IGDdatas_service, %struct.IGDdatas_service, %struct.IGDdatas_service }
%struct.IGDdatas_service = type { [128 x i8], [128 x i8], [128 x i8], [128 x i8] }
%struct.UPNPUrls = type { ptr, ptr, ptr, ptr, ptr }

@.str.10 = external hidden unnamed_addr constant [55 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @parserootdesc(ptr noundef, i32 noundef, ptr noundef) #0

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @GetUPNPUrls(ptr noundef, ptr noundef, ptr noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @FreeUPNPUrls(ptr noundef) #0

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @UPNPIGD_IsConnected(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @UPNP_GetValidIGD(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i32 noundef %4) #0 {
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca [16 x i8], align 16
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store i32 %4, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  store ptr null, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  store i32 0, ptr %14, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  store i32 -1, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %17) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #8
  store i32 -1, ptr %18, align 4, !tbaa !9
  %21 = load ptr, ptr %7, align 8, !tbaa !5
  %22 = icmp ne ptr %21, null
  br i1 %22, label %24, label %23

23:                                               ; preds = %5
  store i32 0, ptr %6, align 4
  store i32 1, ptr %19, align 4
  br label %307

24:                                               ; preds = %5
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %25, ptr %13, align 8, !tbaa !5
  br label %26

26:                                               ; preds = %32, %24
  %27 = load ptr, ptr %13, align 8, !tbaa !5
  %28 = icmp ne ptr %27, null
  br i1 %28, label %29, label %36

29:                                               ; preds = %26
  %30 = load i32, ptr %14, align 4, !tbaa !9
  %31 = add nsw i32 %30, 1
  store i32 %31, ptr %14, align 4, !tbaa !9
  br label %32

32:                                               ; preds = %29
  %33 = load ptr, ptr %13, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.UPNPDev, ptr %33, i32 0, i32 0
  %35 = load ptr, ptr %34, align 8, !tbaa !11
  store ptr %35, ptr %13, align 8, !tbaa !5
  br label %26, !llvm.loop !13

36:                                               ; preds = %26
  %37 = load i32, ptr %14, align 4, !tbaa !9
  %38 = sext i32 %37 to i64
  %39 = call noalias ptr @calloc(i64 noundef %38, i64 noundef 56) #9
  store ptr %39, ptr %12, align 8, !tbaa !5
  %40 = load ptr, ptr %12, align 8, !tbaa !5
  %41 = icmp ne ptr %40, null
  br i1 %41, label %43, label %42

42:                                               ; preds = %36
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %19, align 4
  br label %307

43:                                               ; preds = %36
  %44 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %44, ptr %13, align 8, !tbaa !5
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %45

45:                                               ; preds = %109, %43
  %46 = load ptr, ptr %13, align 8, !tbaa !5
  %47 = icmp ne ptr %46, null
  br i1 %47, label %48, label %115

48:                                               ; preds = %45
  %49 = load ptr, ptr %13, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.UPNPDev, ptr %49, i32 0, i32 1
  %51 = load ptr, ptr %50, align 8, !tbaa !15
  %52 = load ptr, ptr %12, align 8, !tbaa !5
  %53 = load i32, ptr %15, align 4, !tbaa !9
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds %struct.xml_desc, ptr %52, i64 %54
  %56 = getelementptr inbounds %struct.xml_desc, ptr %55, i32 0, i32 2
  %57 = load ptr, ptr %12, align 8, !tbaa !5
  %58 = load i32, ptr %15, align 4, !tbaa !9
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds %struct.xml_desc, ptr %57, i64 %59
  %61 = getelementptr inbounds %struct.xml_desc, ptr %60, i32 0, i32 0
  %62 = getelementptr inbounds [40 x i8], ptr %61, i64 0, i64 0
  %63 = load ptr, ptr %13, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.UPNPDev, ptr %63, i32 0, i32 4
  %65 = load i32, ptr %64, align 8, !tbaa !16
  %66 = call ptr @miniwget_getaddr(ptr noundef %51, ptr noundef %56, ptr noundef %62, i32 noundef 40, i32 noundef %65, ptr noundef %18)
  %67 = load ptr, ptr %12, align 8, !tbaa !5
  %68 = load i32, ptr %15, align 4, !tbaa !9
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds %struct.xml_desc, ptr %67, i64 %69
  %71 = getelementptr inbounds %struct.xml_desc, ptr %70, i32 0, i32 1
  store ptr %66, ptr %71, align 8, !tbaa !17
  %72 = load ptr, ptr %12, align 8, !tbaa !5
  %73 = load i32, ptr %15, align 4, !tbaa !9
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds %struct.xml_desc, ptr %72, i64 %74
  %76 = getelementptr inbounds %struct.xml_desc, ptr %75, i32 0, i32 1
  %77 = load ptr, ptr %76, align 8, !tbaa !17
  %78 = icmp ne ptr %77, null
  br i1 %78, label %79, label %108

79:                                               ; preds = %48
  %80 = load ptr, ptr %9, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 4 %80, i8 0, i64 2948, i1 false)
  %81 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 8 %81, i8 0, i64 40, i1 false)
  %82 = load ptr, ptr %12, align 8, !tbaa !5
  %83 = load i32, ptr %15, align 4, !tbaa !9
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds %struct.xml_desc, ptr %82, i64 %84
  %86 = getelementptr inbounds %struct.xml_desc, ptr %85, i32 0, i32 1
  %87 = load ptr, ptr %86, align 8, !tbaa !17
  %88 = load ptr, ptr %12, align 8, !tbaa !5
  %89 = load i32, ptr %15, align 4, !tbaa !9
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds %struct.xml_desc, ptr %88, i64 %90
  %92 = getelementptr inbounds %struct.xml_desc, ptr %91, i32 0, i32 2
  %93 = load i32, ptr %92, align 8, !tbaa !19
  %94 = load ptr, ptr %9, align 8, !tbaa !5
  call void @parserootdesc(ptr noundef %87, i32 noundef %93, ptr noundef %94)
  %95 = load ptr, ptr %9, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.IGDdatas, ptr %95, i32 0, i32 4
  %97 = getelementptr inbounds %struct.IGDdatas_service, ptr %96, i32 0, i32 3
  %98 = getelementptr inbounds [128 x i8], ptr %97, i64 0, i64 0
  %99 = call i32 @strncmp(ptr noundef %98, ptr noundef @.str.10, i64 noundef 54) #10
  %100 = icmp eq i32 0, %99
  br i1 %100, label %101, label %107

101:                                              ; preds = %79
  %102 = load ptr, ptr %12, align 8, !tbaa !5
  %103 = load i32, ptr %15, align 4, !tbaa !9
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds %struct.xml_desc, ptr %102, i64 %104
  %106 = getelementptr inbounds %struct.xml_desc, ptr %105, i32 0, i32 3
  store i32 1, ptr %106, align 4, !tbaa !20
  br label %107

107:                                              ; preds = %101, %79
  br label %108

108:                                              ; preds = %107, %48
  br label %109

109:                                              ; preds = %108
  %110 = load ptr, ptr %13, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.UPNPDev, ptr %110, i32 0, i32 0
  %112 = load ptr, ptr %111, align 8, !tbaa !11
  store ptr %112, ptr %13, align 8, !tbaa !5
  %113 = load i32, ptr %15, align 4, !tbaa !9
  %114 = add nsw i32 %113, 1
  store i32 %114, ptr %15, align 4, !tbaa !9
  br label %45, !llvm.loop !21

115:                                              ; preds = %45
  store i32 1, ptr %16, align 4, !tbaa !9
  br label %116

116:                                              ; preds = %261, %115
  %117 = load i32, ptr %16, align 4, !tbaa !9
  %118 = icmp sle i32 %117, 3
  br i1 %118, label %119, label %264

119:                                              ; preds = %116
  %120 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %120, ptr %13, align 8, !tbaa !5
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %121

121:                                              ; preds = %254, %119
  %122 = load ptr, ptr %13, align 8, !tbaa !5
  %123 = icmp ne ptr %122, null
  br i1 %123, label %124, label %260

124:                                              ; preds = %121
  %125 = load ptr, ptr %12, align 8, !tbaa !5
  %126 = load i32, ptr %15, align 4, !tbaa !9
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds %struct.xml_desc, ptr %125, i64 %127
  %129 = getelementptr inbounds %struct.xml_desc, ptr %128, i32 0, i32 1
  %130 = load ptr, ptr %129, align 8, !tbaa !17
  %131 = icmp ne ptr %130, null
  br i1 %131, label %132, label %253

132:                                              ; preds = %124
  %133 = load ptr, ptr %9, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 4 %133, i8 0, i64 2948, i1 false)
  %134 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 8 %134, i8 0, i64 40, i1 false)
  %135 = load ptr, ptr %12, align 8, !tbaa !5
  %136 = load i32, ptr %15, align 4, !tbaa !9
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds %struct.xml_desc, ptr %135, i64 %137
  %139 = getelementptr inbounds %struct.xml_desc, ptr %138, i32 0, i32 1
  %140 = load ptr, ptr %139, align 8, !tbaa !17
  %141 = load ptr, ptr %12, align 8, !tbaa !5
  %142 = load i32, ptr %15, align 4, !tbaa !9
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds %struct.xml_desc, ptr %141, i64 %143
  %145 = getelementptr inbounds %struct.xml_desc, ptr %144, i32 0, i32 2
  %146 = load i32, ptr %145, align 8, !tbaa !19
  %147 = load ptr, ptr %9, align 8, !tbaa !5
  call void @parserootdesc(ptr noundef %140, i32 noundef %146, ptr noundef %147)
  %148 = load ptr, ptr %12, align 8, !tbaa !5
  %149 = load i32, ptr %15, align 4, !tbaa !9
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds %struct.xml_desc, ptr %148, i64 %150
  %152 = getelementptr inbounds %struct.xml_desc, ptr %151, i32 0, i32 3
  %153 = load i32, ptr %152, align 4, !tbaa !20
  %154 = icmp ne i32 %153, 0
  br i1 %154, label %158, label %155

155:                                              ; preds = %132
  %156 = load i32, ptr %16, align 4, !tbaa !9
  %157 = icmp sge i32 %156, 3
  br i1 %157, label %158, label %251

158:                                              ; preds = %155, %132
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #8
  %159 = load ptr, ptr %8, align 8, !tbaa !5
  %160 = load ptr, ptr %9, align 8, !tbaa !5
  %161 = load ptr, ptr %13, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.UPNPDev, ptr %161, i32 0, i32 1
  %163 = load ptr, ptr %162, align 8, !tbaa !15
  %164 = load ptr, ptr %13, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.UPNPDev, ptr %164, i32 0, i32 4
  %166 = load i32, ptr %165, align 8, !tbaa !16
  call void @GetUPNPUrls(ptr noundef %159, ptr noundef %160, ptr noundef %163, i32 noundef %166)
  %167 = load i32, ptr %16, align 4, !tbaa !9
  %168 = icmp sge i32 %167, 2
  br i1 %168, label %169, label %170

169:                                              ; preds = %158
  store i32 14, ptr %19, align 4
  br label %248

170:                                              ; preds = %158
  %171 = load ptr, ptr %8, align 8, !tbaa !5
  %172 = load ptr, ptr %9, align 8, !tbaa !5
  %173 = call i32 @UPNPIGD_IsConnected(ptr noundef %171, ptr noundef %172)
  store i32 %173, ptr %20, align 4, !tbaa !9
  %174 = load i32, ptr %20, align 4, !tbaa !9
  %175 = icmp ne i32 %174, 0
  br i1 %175, label %176, label %193

176:                                              ; preds = %170
  %177 = load ptr, ptr %8, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.UPNPUrls, ptr %177, i32 0, i32 0
  %179 = load ptr, ptr %178, align 8, !tbaa !22
  %180 = load ptr, ptr %9, align 8, !tbaa !5
  %181 = getelementptr inbounds %struct.IGDdatas, ptr %180, i32 0, i32 5
  %182 = getelementptr inbounds %struct.IGDdatas_service, ptr %181, i32 0, i32 3
  %183 = getelementptr inbounds [128 x i8], ptr %182, i64 0, i64 0
  %184 = getelementptr inbounds [16 x i8], ptr %17, i64 0, i64 0
  %185 = call i32 @UPNP_GetExternalIPAddress(ptr noundef %179, ptr noundef %183, ptr noundef %184)
  %186 = icmp eq i32 %185, 0
  br i1 %186, label %187, label %193

187:                                              ; preds = %176
  %188 = getelementptr inbounds [16 x i8], ptr %17, i64 0, i64 0
  %189 = call i32 @addr_is_reserved(ptr noundef %188)
  %190 = icmp ne i32 %189, 0
  br i1 %190, label %192, label %191

191:                                              ; preds = %187
  store i32 14, ptr %19, align 4
  br label %248

192:                                              ; preds = %187
  br label %193

193:                                              ; preds = %192, %176, %170
  %194 = load ptr, ptr %8, align 8, !tbaa !5
  call void @FreeUPNPUrls(ptr noundef %194)
  %195 = load ptr, ptr %9, align 8, !tbaa !5
  %196 = getelementptr inbounds %struct.IGDdatas, ptr %195, i32 0, i32 6
  %197 = getelementptr inbounds %struct.IGDdatas_service, ptr %196, i32 0, i32 3
  %198 = getelementptr inbounds [128 x i8], ptr %197, i64 0, i64 0
  %199 = load i8, ptr %198, align 4, !tbaa !24
  %200 = sext i8 %199 to i32
  %201 = icmp ne i32 %200, 0
  br i1 %201, label %202, label %247

202:                                              ; preds = %193
  %203 = load ptr, ptr %9, align 8, !tbaa !5
  %204 = getelementptr inbounds %struct.IGDdatas, ptr %203, i32 0, i32 8
  %205 = load ptr, ptr %9, align 8, !tbaa !5
  %206 = getelementptr inbounds %struct.IGDdatas, ptr %205, i32 0, i32 5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %204, ptr align 4 %206, i64 512, i1 false)
  %207 = load ptr, ptr %9, align 8, !tbaa !5
  %208 = getelementptr inbounds %struct.IGDdatas, ptr %207, i32 0, i32 5
  %209 = load ptr, ptr %9, align 8, !tbaa !5
  %210 = getelementptr inbounds %struct.IGDdatas, ptr %209, i32 0, i32 6
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %208, ptr align 4 %210, i64 512, i1 false)
  %211 = load ptr, ptr %9, align 8, !tbaa !5
  %212 = getelementptr inbounds %struct.IGDdatas, ptr %211, i32 0, i32 6
  %213 = load ptr, ptr %9, align 8, !tbaa !5
  %214 = getelementptr inbounds %struct.IGDdatas, ptr %213, i32 0, i32 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %212, ptr align 4 %214, i64 512, i1 false)
  %215 = load ptr, ptr %8, align 8, !tbaa !5
  %216 = load ptr, ptr %9, align 8, !tbaa !5
  %217 = load ptr, ptr %13, align 8, !tbaa !5
  %218 = getelementptr inbounds %struct.UPNPDev, ptr %217, i32 0, i32 1
  %219 = load ptr, ptr %218, align 8, !tbaa !15
  %220 = load ptr, ptr %13, align 8, !tbaa !5
  %221 = getelementptr inbounds %struct.UPNPDev, ptr %220, i32 0, i32 4
  %222 = load i32, ptr %221, align 8, !tbaa !16
  call void @GetUPNPUrls(ptr noundef %215, ptr noundef %216, ptr noundef %219, i32 noundef %222)
  %223 = load ptr, ptr %8, align 8, !tbaa !5
  %224 = load ptr, ptr %9, align 8, !tbaa !5
  %225 = call i32 @UPNPIGD_IsConnected(ptr noundef %223, ptr noundef %224)
  store i32 %225, ptr %20, align 4, !tbaa !9
  %226 = load i32, ptr %20, align 4, !tbaa !9
  %227 = icmp ne i32 %226, 0
  br i1 %227, label %228, label %245

228:                                              ; preds = %202
  %229 = load ptr, ptr %8, align 8, !tbaa !5
  %230 = getelementptr inbounds %struct.UPNPUrls, ptr %229, i32 0, i32 0
  %231 = load ptr, ptr %230, align 8, !tbaa !22
  %232 = load ptr, ptr %9, align 8, !tbaa !5
  %233 = getelementptr inbounds %struct.IGDdatas, ptr %232, i32 0, i32 5
  %234 = getelementptr inbounds %struct.IGDdatas_service, ptr %233, i32 0, i32 3
  %235 = getelementptr inbounds [128 x i8], ptr %234, i64 0, i64 0
  %236 = getelementptr inbounds [16 x i8], ptr %17, i64 0, i64 0
  %237 = call i32 @UPNP_GetExternalIPAddress(ptr noundef %231, ptr noundef %235, ptr noundef %236)
  %238 = icmp eq i32 %237, 0
  br i1 %238, label %239, label %245

239:                                              ; preds = %228
  %240 = getelementptr inbounds [16 x i8], ptr %17, i64 0, i64 0
  %241 = call i32 @addr_is_reserved(ptr noundef %240)
  %242 = icmp ne i32 %241, 0
  br i1 %242, label %244, label %243

243:                                              ; preds = %239
  store i32 14, ptr %19, align 4
  br label %248

244:                                              ; preds = %239
  br label %245

245:                                              ; preds = %244, %228, %202
  %246 = load ptr, ptr %8, align 8, !tbaa !5
  call void @FreeUPNPUrls(ptr noundef %246)
  br label %247

247:                                              ; preds = %245, %193
  store i32 0, ptr %19, align 4
  br label %248

248:                                              ; preds = %247, %243, %191, %169
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #8
  %249 = load i32, ptr %19, align 4
  switch i32 %249, label %307 [
    i32 0, label %250
    i32 14, label %265
  ]

250:                                              ; preds = %248
  br label %251

251:                                              ; preds = %250, %155
  %252 = load ptr, ptr %9, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 4 %252, i8 0, i64 2948, i1 false)
  br label %253

253:                                              ; preds = %251, %124
  br label %254

254:                                              ; preds = %253
  %255 = load ptr, ptr %13, align 8, !tbaa !5
  %256 = getelementptr inbounds %struct.UPNPDev, ptr %255, i32 0, i32 0
  %257 = load ptr, ptr %256, align 8, !tbaa !11
  store ptr %257, ptr %13, align 8, !tbaa !5
  %258 = load i32, ptr %15, align 4, !tbaa !9
  %259 = add nsw i32 %258, 1
  store i32 %259, ptr %15, align 4, !tbaa !9
  br label %121, !llvm.loop !25

260:                                              ; preds = %121
  br label %261

261:                                              ; preds = %260
  %262 = load i32, ptr %16, align 4, !tbaa !9
  %263 = add nsw i32 %262, 1
  store i32 %263, ptr %16, align 4, !tbaa !9
  br label %116, !llvm.loop !26

264:                                              ; preds = %116
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %265

265:                                              ; preds = %264, %248
  %266 = load ptr, ptr %10, align 8, !tbaa !5
  %267 = icmp ne ptr %266, null
  br i1 %267, label %268, label %289

268:                                              ; preds = %265
  %269 = load i32, ptr %16, align 4, !tbaa !9
  %270 = icmp sge i32 %269, 1
  br i1 %270, label %271, label %289

271:                                              ; preds = %268
  %272 = load i32, ptr %16, align 4, !tbaa !9
  %273 = icmp sle i32 %272, 3
  br i1 %273, label %274, label %289

274:                                              ; preds = %271
  %275 = load i32, ptr %15, align 4, !tbaa !9
  %276 = load i32, ptr %14, align 4, !tbaa !9
  %277 = icmp slt i32 %275, %276
  br i1 %277, label %278, label %289

278:                                              ; preds = %274
  %279 = load ptr, ptr %10, align 8, !tbaa !5
  %280 = load ptr, ptr %12, align 8, !tbaa !5
  %281 = load i32, ptr %15, align 4, !tbaa !9
  %282 = sext i32 %281 to i64
  %283 = getelementptr inbounds %struct.xml_desc, ptr %280, i64 %282
  %284 = getelementptr inbounds %struct.xml_desc, ptr %283, i32 0, i32 0
  %285 = getelementptr inbounds [40 x i8], ptr %284, i64 0, i64 0
  %286 = load i32, ptr %11, align 4, !tbaa !9
  %287 = sext i32 %286 to i64
  %288 = call ptr @strncpy(ptr noundef %279, ptr noundef %285, i64 noundef %287) #8
  br label %289

289:                                              ; preds = %278, %274, %271, %268, %265
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %290

290:                                              ; preds = %301, %289
  %291 = load i32, ptr %15, align 4, !tbaa !9
  %292 = load i32, ptr %14, align 4, !tbaa !9
  %293 = icmp slt i32 %291, %292
  br i1 %293, label %294, label %304

294:                                              ; preds = %290
  %295 = load ptr, ptr %12, align 8, !tbaa !5
  %296 = load i32, ptr %15, align 4, !tbaa !9
  %297 = sext i32 %296 to i64
  %298 = getelementptr inbounds %struct.xml_desc, ptr %295, i64 %297
  %299 = getelementptr inbounds %struct.xml_desc, ptr %298, i32 0, i32 1
  %300 = load ptr, ptr %299, align 8, !tbaa !17
  call void @free(ptr noundef %300) #8
  br label %301

301:                                              ; preds = %294
  %302 = load i32, ptr %15, align 4, !tbaa !9
  %303 = add nsw i32 %302, 1
  store i32 %303, ptr %15, align 4, !tbaa !9
  br label %290, !llvm.loop !27

304:                                              ; preds = %290
  %305 = load ptr, ptr %12, align 8, !tbaa !5
  call void @free(ptr noundef %305) #8
  %306 = load i32, ptr %16, align 4, !tbaa !9
  store i32 %306, ptr %6, align 4
  store i32 1, ptr %19, align 4
  br label %307

307:                                              ; preds = %304, %248, %42, %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  %308 = load i32, ptr %6, align 4
  ret i32 %308
}

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

declare ptr @miniwget_getaddr(ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) #4

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

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

declare i32 @UPNP_GetExternalIPAddress(ptr noundef, ptr noundef, ptr noundef) #4

declare i32 @addr_is_reserved(ptr noundef) #4

; 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) #7

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind allocsize(0,1) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind willreturn memory(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 #7 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #8 = { nounwind }
attributes #9 = { nounwind allocsize(0,1) }
attributes #10 = { nounwind willreturn memory(read) }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"UPNPDev", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !10, i64 32, !7, i64 36}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!12, !6, i64 8}
!16 = !{!12, !10, i64 32}
!17 = !{!18, !6, i64 40}
!18 = !{!"xml_desc", !7, i64 0, !6, i64 40, !10, i64 48, !10, i64 52}
!19 = !{!18, !10, i64 48}
!20 = !{!18, !10, i64 52}
!21 = distinct !{!21, !14}
!22 = !{!23, !6, i64 0}
!23 = !{!"UPNPUrls", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!24 = !{!7, !7, i64 0}
!25 = distinct !{!25, !14}
!26 = distinct !{!26, !14}
!27 = distinct !{!27, !14}


; 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.xml_desc = type { [40 x i8], ptr, i32, i32 }

@.str.10 = external hidden unnamed_addr constant [55 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @parserootdesc(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @GetUPNPUrls(ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @FreeUPNPUrls(ptr noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @UPNPIGD_IsConnected(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local i32 @UPNP_GetValidIGD(ptr noundef readonly %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i32 noundef %4) local_unnamed_addr #0 {
  %6 = alloca [16 x i8], align 16
  %7 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #9
  store i32 -1, ptr %7, align 4, !tbaa !5
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %109, label %.preheader132

.preheader132:                                    ; preds = %5, %.preheader132
  %indvars.iv198 = phi i32 [ %indvars.iv.next199, %.preheader132 ], [ 1, %5 ]
  %.0103136 = phi i32 [ %8, %.preheader132 ], [ 0, %5 ]
  %.0104135 = phi ptr [ %9, %.preheader132 ], [ %0, %5 ]
  %8 = add nuw nsw i32 %.0103136, 1
  %9 = load ptr, ptr %.0104135, align 8, !tbaa !9
  %.not111 = icmp eq ptr %9, null
  %indvars.iv.next199 = add nuw i32 %indvars.iv198, 1
  br i1 %.not111, label %10, label %.preheader132, !llvm.loop !12

10:                                               ; preds = %.preheader132
  %11 = zext nneg i32 %8 to i64
  %12 = tail call noalias ptr @calloc(i64 noundef %11, i64 noundef 56) #10
  %.not112 = icmp eq ptr %12, null
  br i1 %.not112, label %109, label %.preheader131

.preheader131:                                    ; preds = %10
  %13 = getelementptr inbounds i8, ptr %2, i64 772
  br label %19

.preheader130:                                    ; preds = %34
  %14 = getelementptr inbounds i8, ptr %2, i64 1284
  %15 = getelementptr inbounds i8, ptr %2, i64 1796
  %16 = getelementptr inbounds i8, ptr %2, i64 1412
  %17 = getelementptr inbounds i8, ptr %2, i64 2436
  %18 = getelementptr inbounds i8, ptr %2, i64 900
  br label %.preheader

19:                                               ; preds = %.preheader131, %34
  %indvars.iv = phi i64 [ 0, %.preheader131 ], [ %indvars.iv.next, %34 ]
  %.1105137 = phi ptr [ %0, %.preheader131 ], [ %35, %34 ]
  %20 = getelementptr inbounds i8, ptr %.1105137, i64 8
  %21 = load ptr, ptr %20, align 8, !tbaa !14
  %22 = getelementptr inbounds %struct.xml_desc, ptr %12, i64 %indvars.iv
  %23 = getelementptr inbounds i8, ptr %22, i64 48
  %24 = getelementptr inbounds i8, ptr %.1105137, i64 32
  %25 = load i32, ptr %24, align 8, !tbaa !15
  %26 = call ptr @miniwget_getaddr(ptr noundef %21, ptr noundef nonnull %23, ptr noundef nonnull %22, i32 noundef 40, i32 noundef %25, ptr noundef nonnull %7) #9
  %27 = getelementptr inbounds i8, ptr %22, i64 40
  store ptr %26, ptr %27, align 8, !tbaa !16
  %.not121 = icmp eq ptr %26, null
  br i1 %.not121, label %34, label %28

28:                                               ; preds = %19
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(2948) %2, i8 0, i64 2948, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(40) %1, i8 0, i64 40, i1 false)
  %29 = load i32, ptr %23, align 8, !tbaa !18
  call void @parserootdesc(ptr noundef nonnull %26, i32 noundef %29, ptr noundef %2)
  %30 = call i32 @strncmp(ptr noundef nonnull dereferenceable(1) %13, ptr noundef nonnull dereferenceable(1) @.str.10, i64 noundef 54) #11
  %31 = icmp eq i32 %30, 0
  br i1 %31, label %32, label %34

32:                                               ; preds = %28
  %33 = getelementptr inbounds i8, ptr %22, i64 52
  store i32 1, ptr %33, align 4, !tbaa !19
  br label %34

34:                                               ; preds = %19, %32, %28
  %35 = load ptr, ptr %.1105137, align 8, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %.not113 = icmp eq ptr %35, null
  br i1 %.not113, label %.preheader130, label %19, !llvm.loop !20

.preheader:                                       ; preds = %.preheader130, %.split146.us
  %.0100165 = phi i32 [ 1, %.preheader130 ], [ %97, %.split146.us ]
  %36 = icmp eq i32 %.0100165, 3
  %37 = icmp ugt i32 %.0100165, 1
  br i1 %37, label %.preheader.split.us, label %.preheader.split

.preheader.split.us:                              ; preds = %.preheader
  br i1 %36, label %.preheader.split.us.split.us, label %.preheader.split.us.split

.preheader.split.us.split.us:                     ; preds = %.preheader.split.us, %43
  %indvars.iv192 = phi i64 [ %indvars.iv.next193, %43 ], [ 0, %.preheader.split.us ]
  %.2106139.us.us = phi ptr [ %44, %43 ], [ %0, %.preheader.split.us ]
  %38 = getelementptr inbounds %struct.xml_desc, ptr %12, i64 %indvars.iv192
  %39 = getelementptr inbounds i8, ptr %38, i64 40
  %40 = load ptr, ptr %39, align 8, !tbaa !16
  %.not115.us.us = icmp eq ptr %40, null
  br i1 %.not115.us.us, label %43, label %.split152.us

.split152.us:                                     ; preds = %.preheader.split.us.split.us
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(2948) %2, i8 0, i64 2948, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(40) %1, i8 0, i64 40, i1 false)
  %41 = getelementptr inbounds i8, ptr %38, i64 48
  %42 = load i32, ptr %41, align 8, !tbaa !18
  call void @parserootdesc(ptr noundef nonnull %40, i32 noundef %42, ptr noundef %2)
  br label %.split152

43:                                               ; preds = %.preheader.split.us.split.us
  %44 = load ptr, ptr %.2106139.us.us, align 8, !tbaa !9
  %indvars.iv.next193 = add nuw nsw i64 %indvars.iv192, 1
  %.not114.us.us = icmp eq ptr %44, null
  br i1 %.not114.us.us, label %.split146.us, label %.preheader.split.us.split.us, !llvm.loop !21

.preheader.split.us.split:                        ; preds = %.preheader.split.us, %58
  %indvars.iv189 = phi i64 [ %indvars.iv.next190, %58 ], [ 0, %.preheader.split.us ]
  %.2106139.us = phi ptr [ %59, %58 ], [ %0, %.preheader.split.us ]
  %45 = getelementptr inbounds %struct.xml_desc, ptr %12, i64 %indvars.iv189
  %46 = getelementptr inbounds i8, ptr %45, i64 40
  %47 = load ptr, ptr %46, align 8, !tbaa !16
  %.not115.us = icmp eq ptr %47, null
  br i1 %.not115.us, label %58, label %48

48:                                               ; preds = %.preheader.split.us.split
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(2948) %2, i8 0, i64 2948, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(40) %1, i8 0, i64 40, i1 false)
  %49 = getelementptr inbounds i8, ptr %45, i64 48
  %50 = load i32, ptr %49, align 8, !tbaa !18
  call void @parserootdesc(ptr noundef nonnull %47, i32 noundef %50, ptr noundef %2)
  %51 = getelementptr inbounds i8, ptr %45, i64 52
  %52 = load i32, ptr %51, align 4, !tbaa !19
  %.not168 = icmp eq i32 %52, 0
  br i1 %.not168, label %57, label %.split152

.split152:                                        ; preds = %48, %.split152.us
  %.0100165183 = phi i32 [ 3, %.split152.us ], [ %.0100165, %48 ]
  %.us-phi154.in = phi i64 [ %indvars.iv192, %.split152.us ], [ %indvars.iv189, %48 ]
  %.us-phi155 = phi ptr [ %.2106139.us.us, %.split152.us ], [ %.2106139.us, %48 ]
  %53 = getelementptr inbounds i8, ptr %.us-phi155, i64 8
  %54 = load ptr, ptr %53, align 8, !tbaa !14
  %55 = getelementptr inbounds i8, ptr %.us-phi155, i64 32
  %56 = load i32, ptr %55, align 8, !tbaa !15
  call void @GetUPNPUrls(ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef %54, i32 noundef %56)
  br label %.split

57:                                               ; preds = %48
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(2948) %2, i8 0, i64 2948, i1 false)
  br label %58

58:                                               ; preds = %57, %.preheader.split.us.split
  %59 = load ptr, ptr %.2106139.us, align 8, !tbaa !9
  %indvars.iv.next190 = add nuw nsw i64 %indvars.iv189, 1
  %.not114.us = icmp eq ptr %59, null
  br i1 %.not114.us, label %.split146.us, label %.preheader.split.us.split, !llvm.loop !21

.preheader.split:                                 ; preds = %.preheader, %95
  %indvars.iv186 = phi i64 [ %indvars.iv.next187, %95 ], [ 0, %.preheader ]
  %.2106139 = phi ptr [ %96, %95 ], [ %0, %.preheader ]
  %60 = getelementptr inbounds %struct.xml_desc, ptr %12, i64 %indvars.iv186
  %61 = getelementptr inbounds i8, ptr %60, i64 40
  %62 = load ptr, ptr %61, align 8, !tbaa !16
  %.not115 = icmp eq ptr %62, null
  br i1 %.not115, label %95, label %63

63:                                               ; preds = %.preheader.split
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(2948) %2, i8 0, i64 2948, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(40) %1, i8 0, i64 40, i1 false)
  %64 = getelementptr inbounds i8, ptr %60, i64 48
  %65 = load i32, ptr %64, align 8, !tbaa !18
  call void @parserootdesc(ptr noundef nonnull %62, i32 noundef %65, ptr noundef %2)
  %66 = getelementptr inbounds i8, ptr %60, i64 52
  %67 = load i32, ptr %66, align 4, !tbaa !19
  %68 = icmp ne i32 %67, 0
  %or.cond = or i1 %36, %68
  br i1 %or.cond, label %69, label %94

69:                                               ; preds = %63
  %70 = getelementptr inbounds i8, ptr %.2106139, i64 8
  %71 = load ptr, ptr %70, align 8, !tbaa !14
  %72 = getelementptr inbounds i8, ptr %.2106139, i64 32
  %73 = load i32, ptr %72, align 8, !tbaa !15
  call void @GetUPNPUrls(ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef %71, i32 noundef %73)
  %74 = call i32 @UPNPIGD_IsConnected(ptr noundef nonnull %1, ptr noundef nonnull %2)
  %.not116 = icmp eq i32 %74, 0
  br i1 %.not116, label %81, label %75

75:                                               ; preds = %69
  %76 = load ptr, ptr %1, align 8, !tbaa !22
  %77 = call i32 @UPNP_GetExternalIPAddress(ptr noundef %76, ptr noundef nonnull %14, ptr noundef nonnull %6) #9
  %78 = icmp eq i32 %77, 0
  br i1 %78, label %79, label %81

79:                                               ; preds = %75
  %80 = call i32 @addr_is_reserved(ptr noundef nonnull %6) #9
  %.not117 = icmp eq i32 %80, 0
  br i1 %.not117, label %.split, label %81

81:                                               ; preds = %79, %75, %69
  call void @FreeUPNPUrls(ptr noundef nonnull %1)
  %82 = load i8, ptr %15, align 4, !tbaa !24
  %.not118 = icmp eq i8 %82, 0
  br i1 %.not118, label %94, label %83

83:                                               ; preds = %81
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(512) %17, ptr noundef nonnull align 4 dereferenceable(512) %18, i64 512, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(512) %18, ptr noundef nonnull align 4 dereferenceable(512) %16, i64 512, i1 false)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(512) %16, ptr noundef nonnull align 4 dereferenceable(512) %17, i64 512, i1 false)
  %84 = load ptr, ptr %70, align 8, !tbaa !14
  %85 = load i32, ptr %72, align 8, !tbaa !15
  call void @GetUPNPUrls(ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef %84, i32 noundef %85)
  %86 = call i32 @UPNPIGD_IsConnected(ptr noundef nonnull %1, ptr noundef nonnull %2)
  %.not119 = icmp eq i32 %86, 0
  br i1 %.not119, label %93, label %87

87:                                               ; preds = %83
  %88 = load ptr, ptr %1, align 8, !tbaa !22
  %89 = call i32 @UPNP_GetExternalIPAddress(ptr noundef %88, ptr noundef nonnull %14, ptr noundef nonnull %6) #9
  %90 = icmp eq i32 %89, 0
  br i1 %90, label %91, label %93

91:                                               ; preds = %87
  %92 = call i32 @addr_is_reserved(ptr noundef nonnull %6) #9
  %.not120 = icmp eq i32 %92, 0
  br i1 %.not120, label %.split, label %93

93:                                               ; preds = %91, %87, %83
  call void @FreeUPNPUrls(ptr noundef nonnull %1)
  br label %94

94:                                               ; preds = %93, %81, %63
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(2948) %2, i8 0, i64 2948, i1 false)
  br label %95

95:                                               ; preds = %.preheader.split, %94
  %96 = load ptr, ptr %.2106139, align 8, !tbaa !9
  %indvars.iv.next187 = add nuw nsw i64 %indvars.iv186, 1
  %.not114 = icmp eq ptr %96, null
  br i1 %.not114, label %.split146.us, label %.preheader.split, !llvm.loop !21

.split146.us:                                     ; preds = %95, %58, %43
  %97 = add nuw nsw i32 %.0100165, 1
  %exitcond.not = icmp eq i32 %97, 4
  br i1 %exitcond.not, label %.thread124, label %.preheader, !llvm.loop !25

.split:                                           ; preds = %91, %79, %.split152
  %.0100165182 = phi i32 [ %.0100165183, %.split152 ], [ %.0100165, %79 ], [ %.0100165, %91 ]
  %.us-phi144.in = phi i64 [ %.us-phi154.in, %.split152 ], [ %indvars.iv186, %79 ], [ %indvars.iv186, %91 ]
  %.us-phi144 = trunc i64 %.us-phi144.in to i32
  %98 = icmp ne ptr %3, null
  %99 = icmp uge i32 %.0103136, %.us-phi144
  %or.cond122 = select i1 %98, i1 %99, i1 false
  br i1 %or.cond122, label %100, label %.thread124

100:                                              ; preds = %.split
  %101 = and i64 %.us-phi144.in, 4294967295
  %102 = getelementptr inbounds %struct.xml_desc, ptr %12, i64 %101
  %103 = sext i32 %4 to i64
  %104 = call ptr @strncpy(ptr noundef nonnull %3, ptr noundef nonnull %102, i64 noundef %103) #9
  br label %.thread124

.thread124:                                       ; preds = %.split146.us, %100, %.split
  %.1129 = phi i32 [ %.0100165182, %100 ], [ %.0100165182, %.split ], [ 0, %.split146.us ]
  %wide.trip.count = zext i32 %indvars.iv198 to i64
  br label %105

105:                                              ; preds = %.thread124, %105
  %indvars.iv195 = phi i64 [ 0, %.thread124 ], [ %indvars.iv.next196, %105 ]
  %106 = getelementptr inbounds %struct.xml_desc, ptr %12, i64 %indvars.iv195, i32 1
  %107 = load ptr, ptr %106, align 8, !tbaa !16
  call void @free(ptr noundef %107) #9
  %indvars.iv.next196 = add nuw nsw i64 %indvars.iv195, 1
  %exitcond200.not = icmp eq i64 %indvars.iv.next196, %wide.trip.count
  br i1 %exitcond200.not, label %108, label %105, !llvm.loop !26

108:                                              ; preds = %105
  call void @free(ptr noundef nonnull %12) #9
  br label %109

109:                                              ; preds = %10, %5, %108
  %.0107 = phi i32 [ %.1129, %108 ], [ 0, %5 ], [ -1, %10 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #9
  ret i32 %.0107
}

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

declare ptr @miniwget_getaddr(ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

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

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

declare i32 @UPNP_GetExternalIPAddress(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

declare i32 @addr_is_reserved(ptr noundef) local_unnamed_addr #4

; 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) #7

; 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 #8

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) 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 #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { mustprogress 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 #7 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #8 = { 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 #9 = { nounwind }
attributes #10 = { nounwind allocsize(0,1) }
attributes #11 = { nounwind willreturn memory(read) }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"UPNPDev", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !6, i64 32, !7, i64 36}
!11 = !{!"any pointer", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!10, !11, i64 8}
!15 = !{!10, !6, i64 32}
!16 = !{!17, !11, i64 40}
!17 = !{!"xml_desc", !7, i64 0, !11, i64 40, !6, i64 48, !6, i64 52}
!18 = !{!17, !6, i64 48}
!19 = !{!17, !6, i64 52}
!20 = distinct !{!20, !13}
!21 = distinct !{!21, !13}
!22 = !{!23, !11, i64 0}
!23 = !{!"UPNPUrls", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32}
!24 = !{!7, !7, i64 0}
!25 = distinct !{!25, !13}
!26 = distinct !{!26, !13}


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