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

; 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.upnp_dev_list = type { ptr, ptr, ptr, i64, i64 }
%struct.UPNPDev = type { ptr, ptr, ptr, ptr, i32, [0 x i8] }

@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [28 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [22 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @add_device(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = icmp eq ptr %9, null
  br i1 %10, label %11, label %12

11:                                               ; preds = %2
  store i32 1, ptr %7, align 4
  br label %178

12:                                               ; preds = %2
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = load ptr, ptr %13, align 8, !tbaa !5
  store ptr %14, ptr %5, align 8, !tbaa !5
  br label %15

15:                                               ; preds = %118, %12
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = icmp ne ptr %16, null
  br i1 %17, label %18, label %122

18:                                               ; preds = %15
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.upnp_dev_list, ptr %19, i32 0, i32 1
  %21 = load ptr, ptr %20, align 8, !tbaa !9
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.UPNPDev, ptr %22, i32 0, i32 1
  %24 = load ptr, ptr %23, align 8, !tbaa !12
  %25 = call i32 @strcmp(ptr noundef %21, ptr noundef %24) #7
  %26 = icmp eq i32 %25, 0
  br i1 %26, label %27, label %117

27:                                               ; preds = %18
  store i64 0, ptr %6, align 8, !tbaa !15
  br label %28

28:                                               ; preds = %64, %27
  %29 = load i64, ptr %6, align 8, !tbaa !15
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.upnp_dev_list, ptr %30, i32 0, i32 3
  %32 = load i64, ptr %31, align 8, !tbaa !16
  %33 = icmp ult i64 %29, %32
  br i1 %33, label %34, label %67

34:                                               ; preds = %28
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.upnp_dev_list, ptr %35, i32 0, i32 2
  %37 = load ptr, ptr %36, align 8, !tbaa !17
  %38 = load i64, ptr %6, align 8, !tbaa !15
  %39 = getelementptr inbounds ptr, ptr %37, i64 %38
  %40 = load ptr, ptr %39, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.UPNPDev, ptr %40, i32 0, i32 2
  %42 = load ptr, ptr %41, align 8, !tbaa !18
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.UPNPDev, ptr %43, i32 0, i32 2
  %45 = load ptr, ptr %44, align 8, !tbaa !18
  %46 = call i32 @strcmp(ptr noundef %42, ptr noundef %45) #7
  %47 = icmp eq i32 %46, 0
  br i1 %47, label %48, label %63

48:                                               ; preds = %34
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.upnp_dev_list, ptr %49, i32 0, i32 2
  %51 = load ptr, ptr %50, align 8, !tbaa !17
  %52 = load i64, ptr %6, align 8, !tbaa !15
  %53 = getelementptr inbounds ptr, ptr %51, i64 %52
  %54 = load ptr, ptr %53, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.UPNPDev, ptr %54, i32 0, i32 3
  %56 = load ptr, ptr %55, align 8, !tbaa !19
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.UPNPDev, ptr %57, i32 0, i32 3
  %59 = load ptr, ptr %58, align 8, !tbaa !19
  %60 = call i32 @strcmp(ptr noundef %56, ptr noundef %59) #7
  %61 = icmp eq i32 %60, 0
  br i1 %61, label %62, label %63

62:                                               ; preds = %48
  store i32 1, ptr %7, align 4
  br label %178

63:                                               ; preds = %48, %34
  br label %64

64:                                               ; preds = %63
  %65 = load i64, ptr %6, align 8, !tbaa !15
  %66 = add i64 %65, 1
  store i64 %66, ptr %6, align 8, !tbaa !15
  br label %28, !llvm.loop !20

67:                                               ; preds = %28
  %68 = load ptr, ptr %5, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.upnp_dev_list, ptr %68, i32 0, i32 3
  %70 = load i64, ptr %69, align 8, !tbaa !16
  %71 = load ptr, ptr %5, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.upnp_dev_list, ptr %71, i32 0, i32 4
  %73 = load i64, ptr %72, align 8, !tbaa !22
  %74 = icmp uge i64 %70, %73
  br i1 %74, label %75, label %107

75:                                               ; preds = %67
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %76 = load ptr, ptr %5, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.upnp_dev_list, ptr %76, i32 0, i32 4
  %78 = load i64, ptr %77, align 8, !tbaa !22
  %79 = add i64 %78, 16
  store i64 %79, ptr %77, align 8, !tbaa !22
  %80 = load ptr, ptr %5, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.upnp_dev_list, ptr %80, i32 0, i32 2
  %82 = load ptr, ptr %81, align 8, !tbaa !17
  %83 = load ptr, ptr %5, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.upnp_dev_list, ptr %83, i32 0, i32 4
  %85 = load i64, ptr %84, align 8, !tbaa !22
  %86 = mul i64 %85, 8
  %87 = call ptr @realloc(ptr noundef %82, i64 noundef %86) #8
  store ptr %87, ptr %8, align 8, !tbaa !5
  %88 = load ptr, ptr %8, align 8, !tbaa !5
  %89 = icmp eq ptr %88, null
  br i1 %89, label %90, label %100

90:                                               ; preds = %75
  %91 = load ptr, ptr @stderr, align 8, !tbaa !5
  %92 = load ptr, ptr %5, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.upnp_dev_list, ptr %92, i32 0, i32 2
  %94 = load ptr, ptr %93, align 8, !tbaa !17
  %95 = load ptr, ptr %5, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.upnp_dev_list, ptr %95, i32 0, i32 4
  %97 = load i64, ptr %96, align 8, !tbaa !22
  %98 = mul i64 %97, 8
  %99 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %91, ptr noundef @.str, ptr noundef %94, i64 noundef %98) #6
  store i32 1, ptr %7, align 4
  br label %104

100:                                              ; preds = %75
  %101 = load ptr, ptr %8, align 8, !tbaa !5
  %102 = load ptr, ptr %5, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.upnp_dev_list, ptr %102, i32 0, i32 2
  store ptr %101, ptr %103, align 8, !tbaa !17
  store i32 0, ptr %7, align 4
  br label %104

104:                                              ; preds = %100, %90
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  %105 = load i32, ptr %7, align 4
  switch i32 %105, label %178 [
    i32 0, label %106
  ]

106:                                              ; preds = %104
  br label %107

107:                                              ; preds = %106, %67
  %108 = load ptr, ptr %4, align 8, !tbaa !5
  %109 = load ptr, ptr %5, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.upnp_dev_list, ptr %109, i32 0, i32 2
  %111 = load ptr, ptr %110, align 8, !tbaa !17
  %112 = load ptr, ptr %5, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.upnp_dev_list, ptr %112, i32 0, i32 3
  %114 = load i64, ptr %113, align 8, !tbaa !16
  %115 = add i64 %114, 1
  store i64 %115, ptr %113, align 8, !tbaa !16
  %116 = getelementptr inbounds ptr, ptr %111, i64 %114
  store ptr %108, ptr %116, align 8, !tbaa !5
  store i32 1, ptr %7, align 4
  br label %178

117:                                              ; preds = %18
  br label %118

118:                                              ; preds = %117
  %119 = load ptr, ptr %5, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.upnp_dev_list, ptr %119, i32 0, i32 0
  %121 = load ptr, ptr %120, align 8, !tbaa !23
  store ptr %121, ptr %5, align 8, !tbaa !5
  br label %15, !llvm.loop !24

122:                                              ; preds = %15
  %123 = call noalias ptr @malloc(i64 noundef 40) #9
  store ptr %123, ptr %5, align 8, !tbaa !5
  %124 = load ptr, ptr %5, align 8, !tbaa !5
  %125 = icmp eq ptr %124, null
  br i1 %125, label %126, label %129

126:                                              ; preds = %122
  %127 = load ptr, ptr @stderr, align 8, !tbaa !5
  %128 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %127, ptr noundef @.str.1, i64 noundef 40) #6
  store i32 1, ptr %7, align 4
  br label %178

129:                                              ; preds = %122
  %130 = load ptr, ptr %3, align 8, !tbaa !5
  %131 = load ptr, ptr %130, align 8, !tbaa !5
  %132 = load ptr, ptr %5, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.upnp_dev_list, ptr %132, i32 0, i32 0
  store ptr %131, ptr %133, align 8, !tbaa !23
  %134 = load ptr, ptr %4, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.UPNPDev, ptr %134, i32 0, i32 1
  %136 = load ptr, ptr %135, align 8, !tbaa !12
  %137 = call noalias ptr @strdup(ptr noundef %136) #6
  %138 = load ptr, ptr %5, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.upnp_dev_list, ptr %138, i32 0, i32 1
  store ptr %137, ptr %139, align 8, !tbaa !9
  %140 = load ptr, ptr %5, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.upnp_dev_list, ptr %140, i32 0, i32 1
  %142 = load ptr, ptr %141, align 8, !tbaa !9
  %143 = icmp eq ptr %142, null
  br i1 %143, label %144, label %151

144:                                              ; preds = %129
  %145 = load ptr, ptr @stderr, align 8, !tbaa !5
  %146 = load ptr, ptr %4, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.UPNPDev, ptr %146, i32 0, i32 1
  %148 = load ptr, ptr %147, align 8, !tbaa !12
  %149 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %145, ptr noundef @.str.2, ptr noundef %148) #6
  %150 = load ptr, ptr %5, align 8, !tbaa !5
  call void @free(ptr noundef %150) #6
  store i32 1, ptr %7, align 4
  br label %178

151:                                              ; preds = %129
  %152 = load ptr, ptr %5, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.upnp_dev_list, ptr %152, i32 0, i32 4
  store i64 16, ptr %153, align 8, !tbaa !22
  %154 = call noalias ptr @malloc(i64 noundef 128) #9
  %155 = load ptr, ptr %5, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.upnp_dev_list, ptr %155, i32 0, i32 2
  store ptr %154, ptr %156, align 8, !tbaa !17
  %157 = load ptr, ptr %5, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.upnp_dev_list, ptr %157, i32 0, i32 2
  %159 = load ptr, ptr %158, align 8, !tbaa !17
  %160 = icmp eq ptr %159, null
  br i1 %160, label %161, label %168

161:                                              ; preds = %151
  %162 = load ptr, ptr @stderr, align 8, !tbaa !5
  %163 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %162, ptr noundef @.str.1, i64 noundef 128) #6
  %164 = load ptr, ptr %5, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.upnp_dev_list, ptr %164, i32 0, i32 1
  %166 = load ptr, ptr %165, align 8, !tbaa !9
  call void @free(ptr noundef %166) #6
  %167 = load ptr, ptr %5, align 8, !tbaa !5
  call void @free(ptr noundef %167) #6
  store i32 1, ptr %7, align 4
  br label %178

168:                                              ; preds = %151
  %169 = load ptr, ptr %4, align 8, !tbaa !5
  %170 = load ptr, ptr %5, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.upnp_dev_list, ptr %170, i32 0, i32 2
  %172 = load ptr, ptr %171, align 8, !tbaa !17
  %173 = getelementptr inbounds ptr, ptr %172, i64 0
  store ptr %169, ptr %173, align 8, !tbaa !5
  %174 = load ptr, ptr %5, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.upnp_dev_list, ptr %174, i32 0, i32 3
  store i64 1, ptr %175, align 8, !tbaa !16
  %176 = load ptr, ptr %5, align 8, !tbaa !5
  %177 = load ptr, ptr %3, align 8, !tbaa !5
  store ptr %176, ptr %177, align 8, !tbaa !5
  store i32 0, ptr %7, align 4
  br label %178

178:                                              ; preds = %168, %161, %144, %126, %107, %104, %62, %11
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  %179 = load i32, ptr %7, align 4
  switch i32 %179, label %181 [
    i32 0, label %180
    i32 1, label %180
  ]

180:                                              ; preds = %178, %178
  ret void

181:                                              ; preds = %178
  unreachable
}

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

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #2

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

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

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

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

; Function Attrs: nounwind
declare noalias ptr @strdup(ptr noundef) #4

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

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 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 #3 = { nounwind allocsize(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 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 }
attributes #7 = { nounwind willreturn memory(read) }
attributes #8 = { nounwind allocsize(1) }
attributes #9 = { nounwind allocsize(0) }

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

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


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

@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [28 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [22 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @add_device(ptr nocapture noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = icmp eq ptr %1, null
  br i1 %3, label %.loopexit, label %.preheader56

.preheader56:                                     ; preds = %2
  %4 = getelementptr inbounds i8, ptr %1, i64 8
  br label %5

5:                                                ; preds = %.preheader56, %6
  %.0.in = phi ptr [ %.0, %6 ], [ %0, %.preheader56 ]
  %.0 = load ptr, ptr %.0.in, align 8, !tbaa !5
  %.not = icmp eq ptr %.0, null
  br i1 %.not, label %53, label %6

6:                                                ; preds = %5
  %7 = getelementptr inbounds i8, ptr %.0, i64 8
  %8 = load ptr, ptr %7, align 8, !tbaa !9
  %9 = load ptr, ptr %4, align 8, !tbaa !12
  %10 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %8, ptr noundef nonnull dereferenceable(1) %9) #7
  %11 = icmp eq i32 %10, 0
  br i1 %11, label %.preheader, label %5, !llvm.loop !15

.preheader:                                       ; preds = %6
  %12 = getelementptr inbounds i8, ptr %.0, i64 24
  %13 = load i64, ptr %12, align 8, !tbaa !17
  %.not62 = icmp eq i64 %13, 0
  br i1 %.not62, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader
  %14 = getelementptr inbounds i8, ptr %.0, i64 16
  %15 = load ptr, ptr %14, align 8, !tbaa !18
  %16 = getelementptr inbounds i8, ptr %1, i64 16
  %17 = load ptr, ptr %16, align 8, !tbaa !19
  %18 = getelementptr inbounds i8, ptr %1, i64 24
  br label %19

19:                                               ; preds = %.lr.ph, %32
  %.04761 = phi i64 [ 0, %.lr.ph ], [ %33, %32 ]
  %20 = getelementptr inbounds ptr, ptr %15, i64 %.04761
  %21 = load ptr, ptr %20, align 8, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %21, i64 16
  %23 = load ptr, ptr %22, align 8, !tbaa !19
  %24 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %23, ptr noundef nonnull dereferenceable(1) %17) #7
  %25 = icmp eq i32 %24, 0
  br i1 %25, label %26, label %32

26:                                               ; preds = %19
  %27 = getelementptr inbounds i8, ptr %21, i64 24
  %28 = load ptr, ptr %27, align 8, !tbaa !20
  %29 = load ptr, ptr %18, align 8, !tbaa !20
  %30 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %28, ptr noundef nonnull dereferenceable(1) %29) #7
  %31 = icmp eq i32 %30, 0
  br i1 %31, label %.loopexit, label %32

32:                                               ; preds = %19, %26
  %33 = add nuw i64 %.04761, 1
  %exitcond.not = icmp eq i64 %33, %13
  br i1 %exitcond.not, label %._crit_edge, label %19, !llvm.loop !21

._crit_edge:                                      ; preds = %32, %.preheader
  %34 = getelementptr inbounds i8, ptr %.0, i64 32
  %35 = load i64, ptr %34, align 8, !tbaa !22
  %.not54 = icmp ult i64 %13, %35
  br i1 %.not54, label %._crit_edge._crit_edge, label %36

._crit_edge._crit_edge:                           ; preds = %._crit_edge
  %.phi.trans.insert = getelementptr inbounds i8, ptr %.0, i64 16
  %.pre = load ptr, ptr %.phi.trans.insert, align 8, !tbaa !18
  br label %48

36:                                               ; preds = %._crit_edge
  %37 = add i64 %35, 16
  store i64 %37, ptr %34, align 8, !tbaa !22
  %38 = getelementptr inbounds i8, ptr %.0, i64 16
  %39 = load ptr, ptr %38, align 8, !tbaa !18
  %40 = shl i64 %37, 3
  %41 = tail call ptr @realloc(ptr noundef %39, i64 noundef %40) #8
  %.not55 = icmp eq ptr %41, null
  br i1 %.not55, label %.thread, label %47

.thread:                                          ; preds = %36
  %42 = load ptr, ptr @stderr, align 8, !tbaa !5
  %43 = load ptr, ptr %38, align 8, !tbaa !18
  %44 = load i64, ptr %34, align 8, !tbaa !22
  %45 = shl i64 %44, 3
  %46 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %42, ptr noundef nonnull @.str, ptr noundef %43, i64 noundef %45) #9
  br label %.loopexit

47:                                               ; preds = %36
  store ptr %41, ptr %38, align 8, !tbaa !18
  %.pre64 = load i64, ptr %12, align 8, !tbaa !17
  br label %48

48:                                               ; preds = %._crit_edge._crit_edge, %47
  %49 = phi i64 [ %13, %._crit_edge._crit_edge ], [ %.pre64, %47 ]
  %50 = phi ptr [ %.pre, %._crit_edge._crit_edge ], [ %41, %47 ]
  %51 = add i64 %49, 1
  store i64 %51, ptr %12, align 8, !tbaa !17
  %52 = getelementptr inbounds ptr, ptr %50, i64 %49
  store ptr %1, ptr %52, align 8, !tbaa !5
  br label %.loopexit

53:                                               ; preds = %5
  %54 = tail call noalias dereferenceable_or_null(40) ptr @malloc(i64 noundef 40) #10
  %55 = icmp eq ptr %54, null
  br i1 %55, label %56, label %59

56:                                               ; preds = %53
  %57 = load ptr, ptr @stderr, align 8, !tbaa !5
  %58 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %57, ptr noundef nonnull @.str.1, i64 noundef 40) #9
  br label %.loopexit

59:                                               ; preds = %53
  %60 = load ptr, ptr %0, align 8, !tbaa !5
  store ptr %60, ptr %54, align 8, !tbaa !23
  %61 = load ptr, ptr %4, align 8, !tbaa !12
  %62 = tail call noalias ptr @strdup(ptr noundef %61) #11
  %63 = getelementptr inbounds i8, ptr %54, i64 8
  store ptr %62, ptr %63, align 8, !tbaa !9
  %64 = icmp eq ptr %62, null
  br i1 %64, label %65, label %68

65:                                               ; preds = %59
  %66 = load ptr, ptr @stderr, align 8, !tbaa !5
  %67 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %66, ptr noundef nonnull @.str.2, ptr noundef %61) #9
  tail call void @free(ptr noundef nonnull %54) #11
  br label %.loopexit

68:                                               ; preds = %59
  %69 = getelementptr inbounds i8, ptr %54, i64 32
  store i64 16, ptr %69, align 8, !tbaa !22
  %70 = tail call noalias dereferenceable_or_null(128) ptr @malloc(i64 noundef 128) #10
  %71 = getelementptr inbounds i8, ptr %54, i64 16
  store ptr %70, ptr %71, align 8, !tbaa !18
  %72 = icmp eq ptr %70, null
  br i1 %72, label %73, label %76

73:                                               ; preds = %68
  %74 = load ptr, ptr @stderr, align 8, !tbaa !5
  %75 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %74, ptr noundef nonnull @.str.1, i64 noundef 128) #9
  tail call void @free(ptr noundef nonnull %62) #11
  tail call void @free(ptr noundef nonnull %54) #11
  br label %.loopexit

76:                                               ; preds = %68
  store ptr %1, ptr %70, align 8, !tbaa !5
  %77 = getelementptr inbounds i8, ptr %54, i64 24
  store i64 1, ptr %77, align 8, !tbaa !17
  store ptr %54, ptr %0, align 8, !tbaa !5
  br label %.loopexit

.loopexit:                                        ; preds = %26, %.thread, %2, %76, %73, %65, %56, %48
  ret void
}

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

; Function Attrs: mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias noundef ptr @realloc(ptr allocptr nocapture noundef, i64 noundef) local_unnamed_addr #2

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

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias ptr @strdup(ptr nocapture noundef readonly) local_unnamed_addr #5

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

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

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

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


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