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

@.str.12 = external hidden unnamed_addr constant [3 x i8], align 1
@.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.17 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [28 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 uwtable
define dso_local i32 @UPNP_GetLinkLayerMaxBitRates(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #3 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca %struct.NameValueParserData, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 104, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 -1, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %18 = load ptr, ptr %8, align 8, !tbaa !5
  %19 = icmp ne ptr %18, null
  br i1 %19, label %24, label %20

20:                                               ; preds = %4
  %21 = load ptr, ptr %9, align 8, !tbaa !5
  %22 = icmp ne ptr %21, null
  br i1 %22, label %24, label %23

23:                                               ; preds = %20
  store i32 -2, ptr %5, align 4
  store i32 1, ptr %17, align 4
  br label %77

24:                                               ; preds = %20, %4
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  %27 = call ptr @simpleUPnPcommand(i32 noundef -1, ptr noundef %25, ptr noundef %26, ptr noundef @.str.17, ptr noundef null, ptr noundef %12)
  store ptr %27, ptr %11, align 8, !tbaa !5
  %28 = icmp ne ptr %27, null
  br i1 %28, label %30, label %29

29:                                               ; preds = %24
  store i32 -3, ptr %5, align 4
  store i32 1, ptr %17, align 4
  br label %77

30:                                               ; preds = %24
  %31 = load ptr, ptr %11, align 8, !tbaa !5
  %32 = load i32, ptr %12, align 4, !tbaa !9
  call void @ParseNameValue(ptr noundef %31, i32 noundef %32, ptr noundef %10)
  %33 = load ptr, ptr %11, align 8, !tbaa !5
  call void @free(ptr noundef %33) #4
  %34 = call ptr @GetValueFromNameValueList(ptr noundef %10, ptr noundef @.str.18)
  store ptr %34, ptr %14, align 8, !tbaa !5
  %35 = call ptr @GetValueFromNameValueList(ptr noundef %10, ptr noundef @.str.19)
  store ptr %35, ptr %15, align 8, !tbaa !5
  %36 = load ptr, ptr %14, align 8, !tbaa !5
  %37 = icmp ne ptr %36, null
  br i1 %37, label %38, label %42

38:                                               ; preds = %30
  %39 = load ptr, ptr %15, align 8, !tbaa !5
  %40 = icmp ne ptr %39, null
  br i1 %40, label %41, label %42

41:                                               ; preds = %38
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %42

42:                                               ; preds = %41, %38, %30
  %43 = load ptr, ptr %8, align 8, !tbaa !5
  %44 = icmp ne ptr %43, null
  br i1 %44, label %45, label %55

45:                                               ; preds = %42
  %46 = load ptr, ptr %14, align 8, !tbaa !5
  %47 = icmp ne ptr %46, null
  br i1 %47, label %48, label %52

48:                                               ; preds = %45
  %49 = load ptr, ptr %14, align 8, !tbaa !5
  %50 = load ptr, ptr %8, align 8, !tbaa !5
  %51 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %49, ptr noundef @.str.12, ptr noundef %50) #4
  br label %54

52:                                               ; preds = %45
  %53 = load ptr, ptr %8, align 8, !tbaa !5
  store i32 0, ptr %53, align 4, !tbaa !9
  br label %54

54:                                               ; preds = %52, %48
  br label %55

55:                                               ; preds = %54, %42
  %56 = load ptr, ptr %9, align 8, !tbaa !5
  %57 = icmp ne ptr %56, null
  br i1 %57, label %58, label %68

58:                                               ; preds = %55
  %59 = load ptr, ptr %15, align 8, !tbaa !5
  %60 = icmp ne ptr %59, null
  br i1 %60, label %61, label %65

61:                                               ; preds = %58
  %62 = load ptr, ptr %15, align 8, !tbaa !5
  %63 = load ptr, ptr %9, align 8, !tbaa !5
  %64 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %62, ptr noundef @.str.12, ptr noundef %63) #4
  br label %67

65:                                               ; preds = %58
  %66 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 0, ptr %66, align 4, !tbaa !9
  br label %67

67:                                               ; preds = %65, %61
  br label %68

68:                                               ; preds = %67, %55
  %69 = call ptr @GetValueFromNameValueList(ptr noundef %10, ptr noundef @.str.13)
  store ptr %69, ptr %16, align 8, !tbaa !5
  %70 = load ptr, ptr %16, align 8, !tbaa !5
  %71 = icmp ne ptr %70, null
  br i1 %71, label %72, label %75

72:                                               ; preds = %68
  store i32 -1, ptr %13, align 4, !tbaa !9
  %73 = load ptr, ptr %16, align 8, !tbaa !5
  %74 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %73, ptr noundef @.str.14, ptr noundef %13) #4
  br label %75

75:                                               ; preds = %72, %68
  call void @ClearNameValueList(ptr noundef %10)
  %76 = load i32, ptr %13, align 4, !tbaa !9
  store i32 %76, ptr %5, align 4
  store i32 1, ptr %17, align 4
  br label %77

77:                                               ; preds = %75, %29, %23
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 104, ptr %10) #4
  %78 = load i32, ptr %5, align 4
  ret i32 %78
}

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 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 #4 = { 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, !10, i64 0}
!10 = !{!"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.12 = external hidden unnamed_addr constant [3 x i8], align 1
@.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.17 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [28 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: nounwind uwtable
define dso_local i32 @UPNP_GetLinkLayerMaxBitRates(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) local_unnamed_addr #4 {
  %5 = alloca %struct.NameValueParserData, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #5
  store i32 -1, ptr %7, align 4, !tbaa !5
  %8 = icmp ne ptr %2, null
  %9 = icmp ne ptr %3, null
  %or.cond = or i1 %8, %9
  br i1 %or.cond, label %10, label %35

10:                                               ; preds = %4
  %11 = call ptr @simpleUPnPcommand(i32 noundef -1, ptr noundef %0, ptr noundef %1, ptr noundef nonnull @.str.17, ptr noundef null, ptr noundef nonnull %6) #5
  %.not = icmp eq ptr %11, null
  br i1 %.not, label %35, label %12

12:                                               ; preds = %10
  %13 = load i32, ptr %6, align 4, !tbaa !5
  call void @ParseNameValue(ptr noundef nonnull %11, i32 noundef %13, ptr noundef nonnull %5) #5
  call void @free(ptr noundef nonnull %11) #5
  %14 = call ptr @GetValueFromNameValueList(ptr noundef nonnull %5, ptr noundef nonnull @.str.18) #5
  %15 = call ptr @GetValueFromNameValueList(ptr noundef nonnull %5, ptr noundef nonnull @.str.19) #5
  %16 = icmp ne ptr %14, null
  %17 = icmp ne ptr %15, null
  %or.cond3 = select i1 %16, i1 %17, i1 false
  br i1 %or.cond3, label %18, label %19

18:                                               ; preds = %12
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %19

19:                                               ; preds = %18, %12
  br i1 %8, label %20, label %24

20:                                               ; preds = %19
  br i1 %16, label %21, label %23

21:                                               ; preds = %20
  %22 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %14, ptr noundef nonnull @.str.12, ptr noundef nonnull %2) #5
  br label %24

23:                                               ; preds = %20
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %21, %23, %19
  br i1 %9, label %25, label %29

25:                                               ; preds = %24
  br i1 %17, label %26, label %28

26:                                               ; preds = %25
  %27 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %15, ptr noundef nonnull @.str.12, ptr noundef nonnull %3) #5
  br label %29

28:                                               ; preds = %25
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %26, %28, %24
  %30 = call ptr @GetValueFromNameValueList(ptr noundef nonnull %5, ptr noundef nonnull @.str.13) #5
  %.not29 = icmp eq ptr %30, null
  br i1 %.not29, label %33, label %31

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

33:                                               ; preds = %31, %29
  call void @ClearNameValueList(ptr noundef nonnull %5) #5
  %34 = load i32, ptr %7, align 4, !tbaa !5
  br label %35

35:                                               ; preds = %10, %4, %33
  %.0 = phi i32 [ %34, %33 ], [ -2, %4 ], [ -3, %10 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %5) #5
  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 = { 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 }

!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"}


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