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

; 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.NameValueParserData = type { ptr, [64 x i8], ptr, i32, i32, ptr, i32 }
%struct.UPNParg = type { ptr, ptr }

@.str.13 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [23 x i8], align 1

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

declare ptr @simpleUPnPcommand(i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #1

declare void @ParseNameValue(ptr noundef, i32 noundef, ptr noundef) #1

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

declare ptr @GetValueFromNameValueList(ptr noundef, ptr noundef) #1

declare void @ClearNameValueList(ptr noundef) #1

; 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 @__isoc99_sscanf(ptr noundef, ptr noundef, ...) #2

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

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

23:                                               ; preds = %6
  %24 = load ptr, ptr %11, align 8, !tbaa !5
  %25 = icmp ne ptr %24, null
  br i1 %25, label %26, label %32

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

29:                                               ; preds = %26
  %30 = load ptr, ptr %13, align 8, !tbaa !5
  %31 = icmp ne ptr %30, null
  br i1 %31, label %33, label %32

32:                                               ; preds = %29, %26, %23, %6
  store i32 -2, ptr %7, align 4
  store i32 1, ptr %20, align 4
  br label %88

33:                                               ; preds = %29
  %34 = call noalias ptr @calloc(i64 noundef 5, i64 noundef 16) #6
  store ptr %34, ptr %14, align 8, !tbaa !5
  %35 = load ptr, ptr %14, align 8, !tbaa !5
  %36 = icmp eq ptr %35, null
  br i1 %36, label %37, label %38

37:                                               ; preds = %33
  store i32 -5, ptr %7, align 4
  store i32 1, ptr %20, align 4
  br label %88

38:                                               ; preds = %33
  %39 = load ptr, ptr %14, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.UPNParg, ptr %39, i64 0
  %41 = getelementptr inbounds %struct.UPNParg, ptr %40, i32 0, i32 0
  store ptr @.str.37, ptr %41, align 8, !tbaa !9
  %42 = load ptr, ptr %10, align 8, !tbaa !5
  %43 = load ptr, ptr %14, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.UPNParg, ptr %43, i64 0
  %45 = getelementptr inbounds %struct.UPNParg, ptr %44, i32 0, i32 1
  store ptr %42, ptr %45, align 8, !tbaa !11
  %46 = load ptr, ptr %14, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.UPNParg, ptr %46, i64 1
  %48 = getelementptr inbounds %struct.UPNParg, ptr %47, i32 0, i32 0
  store ptr @.str.38, ptr %48, align 8, !tbaa !9
  %49 = load ptr, ptr %11, align 8, !tbaa !5
  %50 = load ptr, ptr %14, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.UPNParg, ptr %50, i64 1
  %52 = getelementptr inbounds %struct.UPNParg, ptr %51, i32 0, i32 1
  store ptr %49, ptr %52, align 8, !tbaa !11
  %53 = load ptr, ptr %14, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.UPNParg, ptr %53, i64 2
  %55 = getelementptr inbounds %struct.UPNParg, ptr %54, i32 0, i32 0
  store ptr @.str.24, ptr %55, align 8, !tbaa !9
  %56 = load ptr, ptr %12, align 8, !tbaa !5
  %57 = load ptr, ptr %14, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.UPNParg, ptr %57, i64 2
  %59 = getelementptr inbounds %struct.UPNParg, ptr %58, i32 0, i32 1
  store ptr %56, ptr %59, align 8, !tbaa !11
  %60 = load ptr, ptr %14, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.UPNParg, ptr %60, i64 3
  %62 = getelementptr inbounds %struct.UPNParg, ptr %61, i32 0, i32 0
  store ptr @.str.39, ptr %62, align 8, !tbaa !9
  %63 = load ptr, ptr %13, align 8, !tbaa !5
  %64 = load ptr, ptr %14, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.UPNParg, ptr %64, i64 3
  %66 = getelementptr inbounds %struct.UPNParg, ptr %65, i32 0, i32 1
  store ptr %63, ptr %66, align 8, !tbaa !11
  %67 = load ptr, ptr %8, align 8, !tbaa !5
  %68 = load ptr, ptr %9, align 8, !tbaa !5
  %69 = load ptr, ptr %14, align 8, !tbaa !5
  %70 = call ptr @simpleUPnPcommand(i32 noundef -1, ptr noundef %67, ptr noundef %68, ptr noundef @.str.40, ptr noundef %69, ptr noundef %16)
  store ptr %70, ptr %15, align 8, !tbaa !5
  %71 = load ptr, ptr %14, align 8, !tbaa !5
  call void @free(ptr noundef %71) #5
  %72 = load ptr, ptr %15, align 8, !tbaa !5
  %73 = icmp ne ptr %72, null
  br i1 %73, label %75, label %74

74:                                               ; preds = %38
  store i32 -3, ptr %7, align 4
  store i32 1, ptr %20, align 4
  br label %88

75:                                               ; preds = %38
  %76 = load ptr, ptr %15, align 8, !tbaa !5
  %77 = load i32, ptr %16, align 4, !tbaa !12
  call void @ParseNameValue(ptr noundef %76, i32 noundef %77, ptr noundef %17)
  %78 = load ptr, ptr %15, align 8, !tbaa !5
  call void @free(ptr noundef %78) #5
  %79 = call ptr @GetValueFromNameValueList(ptr noundef %17, ptr noundef @.str.13)
  store ptr %79, ptr %18, align 8, !tbaa !5
  %80 = load ptr, ptr %18, align 8, !tbaa !5
  %81 = icmp ne ptr %80, null
  br i1 %81, label %82, label %85

82:                                               ; preds = %75
  store i32 -1, ptr %19, align 4, !tbaa !12
  %83 = load ptr, ptr %18, align 8, !tbaa !5
  %84 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %83, ptr noundef @.str.14, ptr noundef %19) #5
  br label %86

85:                                               ; preds = %75
  store i32 0, ptr %19, align 4, !tbaa !12
  br label %86

86:                                               ; preds = %85, %82
  call void @ClearNameValueList(ptr noundef %17)
  %87 = load i32, ptr %19, align 4, !tbaa !12
  store i32 %87, ptr %7, align 4
  store i32 1, ptr %20, align 4
  br label %88

88:                                               ; preds = %86, %74, %37, %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 104, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  %89 = load i32, ptr %7, align 4
  ret i32 %89
}

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

!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 0}
!10 = !{!"UPNParg", !6, i64 0, !6, i64 8}
!11 = !{!10, !6, i64 8}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.NameValueParserData = type { ptr, [64 x i8], ptr, i32, i32, ptr, i32 }

@.str.13 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [23 x i8], align 1

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

declare ptr @simpleUPnPcommand(i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @ParseNameValue(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

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

declare ptr @GetValueFromNameValueList(ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @ClearNameValueList(ptr noundef) local_unnamed_addr #1

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @UPNP_DeletePortMappingRange(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) local_unnamed_addr #5 {
  %7 = alloca i32, align 4
  %8 = alloca %struct.NameValueParserData, align 8
  %9 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #6
  call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %8) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #6
  %10 = insertelement <4 x ptr> poison, ptr %2, i64 0
  %11 = insertelement <4 x ptr> %10, ptr %3, i64 1
  %12 = insertelement <4 x ptr> %11, ptr %4, i64 2
  %13 = insertelement <4 x ptr> %12, ptr %5, i64 3
  %14 = icmp eq <4 x ptr> %13, zeroinitializer
  %15 = bitcast <4 x i1> %14 to i4
  %16 = icmp eq i4 %15, 0
  br i1 %16, label %17, label %37

17:                                               ; preds = %6
  %18 = tail call noalias dereferenceable_or_null(80) ptr @calloc(i64 noundef 5, i64 noundef 16) #7
  %19 = icmp eq ptr %18, null
  br i1 %19, label %37, label %20

20:                                               ; preds = %17
  store ptr @.str.37, ptr %18, align 8, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %18, i64 8
  store ptr %2, ptr %21, align 8, !tbaa !10
  %22 = getelementptr inbounds i8, ptr %18, i64 16
  store ptr @.str.38, ptr %22, align 8, !tbaa !5
  %23 = getelementptr inbounds i8, ptr %18, i64 24
  store ptr %3, ptr %23, align 8, !tbaa !10
  %24 = getelementptr inbounds i8, ptr %18, i64 32
  store ptr @.str.24, ptr %24, align 8, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %18, i64 40
  store ptr %4, ptr %25, align 8, !tbaa !10
  %26 = getelementptr inbounds i8, ptr %18, i64 48
  store ptr @.str.39, ptr %26, align 8, !tbaa !5
  %27 = getelementptr inbounds i8, ptr %18, i64 56
  store ptr %5, ptr %27, align 8, !tbaa !10
  %28 = call ptr @simpleUPnPcommand(i32 noundef -1, ptr noundef %0, ptr noundef %1, ptr noundef nonnull @.str.40, ptr noundef nonnull %18, ptr noundef nonnull %7) #6
  call void @free(ptr noundef nonnull %18) #6
  %.not = icmp eq ptr %28, null
  br i1 %.not, label %37, label %29

29:                                               ; preds = %20
  %30 = load i32, ptr %7, align 4, !tbaa !11
  call void @ParseNameValue(ptr noundef nonnull %28, i32 noundef %30, ptr noundef nonnull %8) #6
  call void @free(ptr noundef nonnull %28) #6
  %31 = call ptr @GetValueFromNameValueList(ptr noundef nonnull %8, ptr noundef nonnull @.str.13) #6
  %.not38 = icmp eq ptr %31, null
  br i1 %.not38, label %34, label %32

32:                                               ; preds = %29
  store i32 -1, ptr %9, align 4, !tbaa !11
  %33 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %31, ptr noundef nonnull @.str.14, ptr noundef nonnull %9) #6
  br label %35

34:                                               ; preds = %29
  store i32 0, ptr %9, align 4, !tbaa !11
  br label %35

35:                                               ; preds = %34, %32
  call void @ClearNameValueList(ptr noundef nonnull %8) #6
  %36 = load i32, ptr %9, align 4, !tbaa !11
  br label %37

37:                                               ; preds = %20, %17, %6, %35
  %.0 = phi i32 [ %36, %35 ], [ -2, %6 ], [ -5, %17 ], [ -3, %20 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #6
  ret i32 %.0
}

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

!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, !7, i64 0}
!6 = !{!"UPNParg", !7, i64 0, !7, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !8, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalDCEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass