; 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.8 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [23 x i8], align 1
@.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

; 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 uwtable
define dso_local i32 @UPNP_GetStatusInfo(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) #3 {
  %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 ptr, align 8
  %12 = alloca %struct.NameValueParserData, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = 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 ptr %4, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 104, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 4, 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
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  store i32 -1, ptr %18, align 4, !tbaa !9
  %20 = load ptr, ptr %9, align 8, !tbaa !5
  %21 = icmp ne ptr %20, null
  br i1 %21, label %26, label %22

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

25:                                               ; preds = %22
  store i32 -2, ptr %6, align 4
  store i32 1, ptr %19, align 4
  br label %99

26:                                               ; preds = %22, %5
  %27 = load ptr, ptr %7, align 8, !tbaa !5
  %28 = load ptr, ptr %8, align 8, !tbaa !5
  %29 = call ptr @simpleUPnPcommand(i32 noundef -1, ptr noundef %27, ptr noundef %28, ptr noundef @.str.8, ptr noundef null, ptr noundef %14)
  store ptr %29, ptr %13, align 8, !tbaa !5
  %30 = icmp ne ptr %29, null
  br i1 %30, label %32, label %31

31:                                               ; preds = %26
  store i32 -3, ptr %6, align 4
  store i32 1, ptr %19, align 4
  br label %99

32:                                               ; preds = %26
  %33 = load ptr, ptr %13, align 8, !tbaa !5
  %34 = load i32, ptr %14, align 4, !tbaa !9
  call void @ParseNameValue(ptr noundef %33, i32 noundef %34, ptr noundef %12)
  %35 = load ptr, ptr %13, align 8, !tbaa !5
  call void @free(ptr noundef %35) #4
  %36 = call ptr @GetValueFromNameValueList(ptr noundef %12, ptr noundef @.str.9)
  store ptr %36, ptr %16, align 8, !tbaa !5
  %37 = call ptr @GetValueFromNameValueList(ptr noundef %12, ptr noundef @.str.10)
  store ptr %37, ptr %15, align 8, !tbaa !5
  %38 = call ptr @GetValueFromNameValueList(ptr noundef %12, ptr noundef @.str.11)
  store ptr %38, ptr %17, align 8, !tbaa !5
  %39 = load ptr, ptr %15, align 8, !tbaa !5
  %40 = icmp ne ptr %39, null
  br i1 %40, label %41, label %45

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

44:                                               ; preds = %41
  store i32 0, ptr %18, align 4, !tbaa !9
  br label %45

45:                                               ; preds = %44, %41, %32
  %46 = load ptr, ptr %9, align 8, !tbaa !5
  %47 = icmp ne ptr %46, null
  br i1 %47, label %48, label %61

48:                                               ; preds = %45
  %49 = load ptr, ptr %15, align 8, !tbaa !5
  %50 = icmp ne ptr %49, null
  br i1 %50, label %51, label %57

51:                                               ; preds = %48
  %52 = load ptr, ptr %9, align 8, !tbaa !5
  %53 = load ptr, ptr %15, align 8, !tbaa !5
  %54 = call ptr @strncpy(ptr noundef %52, ptr noundef %53, i64 noundef 64) #4
  %55 = load ptr, ptr %9, align 8, !tbaa !5
  %56 = getelementptr inbounds i8, ptr %55, i64 63
  store i8 0, ptr %56, align 1, !tbaa !11
  br label %60

57:                                               ; preds = %48
  %58 = load ptr, ptr %9, align 8, !tbaa !5
  %59 = getelementptr inbounds i8, ptr %58, i64 0
  store i8 0, ptr %59, align 1, !tbaa !11
  br label %60

60:                                               ; preds = %57, %51
  br label %61

61:                                               ; preds = %60, %45
  %62 = load ptr, ptr %10, align 8, !tbaa !5
  %63 = icmp ne ptr %62, null
  br i1 %63, label %64, label %74

64:                                               ; preds = %61
  %65 = load ptr, ptr %16, align 8, !tbaa !5
  %66 = icmp ne ptr %65, null
  br i1 %66, label %67, label %71

67:                                               ; preds = %64
  %68 = load ptr, ptr %16, align 8, !tbaa !5
  %69 = load ptr, ptr %10, align 8, !tbaa !5
  %70 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %68, ptr noundef @.str.12, ptr noundef %69) #4
  br label %73

71:                                               ; preds = %64
  %72 = load ptr, ptr %10, align 8, !tbaa !5
  store i32 0, ptr %72, align 4, !tbaa !9
  br label %73

73:                                               ; preds = %71, %67
  br label %74

74:                                               ; preds = %73, %61
  %75 = load ptr, ptr %11, align 8, !tbaa !5
  %76 = icmp ne ptr %75, null
  br i1 %76, label %77, label %90

77:                                               ; preds = %74
  %78 = load ptr, ptr %17, align 8, !tbaa !5
  %79 = icmp ne ptr %78, null
  br i1 %79, label %80, label %86

80:                                               ; preds = %77
  %81 = load ptr, ptr %11, align 8, !tbaa !5
  %82 = load ptr, ptr %17, align 8, !tbaa !5
  %83 = call ptr @strncpy(ptr noundef %81, ptr noundef %82, i64 noundef 64) #4
  %84 = load ptr, ptr %11, align 8, !tbaa !5
  %85 = getelementptr inbounds i8, ptr %84, i64 63
  store i8 0, ptr %85, align 1, !tbaa !11
  br label %89

86:                                               ; preds = %77
  %87 = load ptr, ptr %11, align 8, !tbaa !5
  %88 = getelementptr inbounds i8, ptr %87, i64 0
  store i8 0, ptr %88, align 1, !tbaa !11
  br label %89

89:                                               ; preds = %86, %80
  br label %90

90:                                               ; preds = %89, %74
  %91 = call ptr @GetValueFromNameValueList(ptr noundef %12, ptr noundef @.str.13)
  store ptr %91, ptr %15, align 8, !tbaa !5
  %92 = load ptr, ptr %15, align 8, !tbaa !5
  %93 = icmp ne ptr %92, null
  br i1 %93, label %94, label %97

94:                                               ; preds = %90
  store i32 -1, ptr %18, align 4, !tbaa !9
  %95 = load ptr, ptr %15, align 8, !tbaa !5
  %96 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %95, ptr noundef @.str.14, ptr noundef %18) #4
  br label %97

97:                                               ; preds = %94, %90
  call void @ClearNameValueList(ptr noundef %12)
  %98 = load i32, ptr %18, align 4, !tbaa !9
  store i32 %98, ptr %6, align 4
  store i32 1, ptr %19, align 4
  br label %99

99:                                               ; preds = %97, %31, %25
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  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 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 104, ptr %12) #4
  %100 = load i32, ptr %6, align 4
  ret i32 %100
}

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

; Function Attrs: nounwind
declare i32 @__isoc99_sscanf(ptr noundef, ptr noundef, ...) #2

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}
!11 = !{!7, !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.8 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [23 x i8], align 1
@.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

; 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: nounwind uwtable
define dso_local i32 @UPNP_GetStatusInfo(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4) local_unnamed_addr #3 {
  %6 = alloca %struct.NameValueParserData, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #6
  store i32 -1, ptr %8, align 4, !tbaa !5
  %9 = icmp ne ptr %2, null
  %10 = icmp ne ptr %3, null
  %or.cond = or i1 %9, %10
  br i1 %or.cond, label %11, label %42

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

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

20:                                               ; preds = %13
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %21

21:                                               ; preds = %20, %13
  br i1 %9, label %22, label %26

22:                                               ; preds = %21
  br i1 %18, label %23, label %.sink.split

23:                                               ; preds = %22
  %24 = call ptr @strncpy(ptr noundef nonnull dereferenceable(1) %2, ptr noundef nonnull dereferenceable(1) %16, i64 noundef 64) #6
  %25 = getelementptr inbounds i8, ptr %2, i64 63
  br label %.sink.split

.sink.split:                                      ; preds = %22, %23
  %.sink = phi ptr [ %25, %23 ], [ %2, %22 ]
  store i8 0, ptr %.sink, align 1, !tbaa !9
  br label %26

26:                                               ; preds = %.sink.split, %21
  br i1 %10, label %27, label %31

27:                                               ; preds = %26
  br i1 %19, label %28, label %30

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

30:                                               ; preds = %27
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %28, %30, %26
  %.not38 = icmp eq ptr %4, null
  br i1 %.not38, label %36, label %32

32:                                               ; preds = %31
  %.not39 = icmp eq ptr %17, null
  br i1 %.not39, label %.sink.split41, label %33

33:                                               ; preds = %32
  %34 = call ptr @strncpy(ptr noundef nonnull dereferenceable(1) %4, ptr noundef nonnull dereferenceable(1) %17, i64 noundef 64) #6
  %35 = getelementptr inbounds i8, ptr %4, i64 63
  br label %.sink.split41

.sink.split41:                                    ; preds = %32, %33
  %.sink42 = phi ptr [ %35, %33 ], [ %4, %32 ]
  store i8 0, ptr %.sink42, align 1, !tbaa !9
  br label %36

36:                                               ; preds = %.sink.split41, %31
  %37 = call ptr @GetValueFromNameValueList(ptr noundef nonnull %6, ptr noundef nonnull @.str.13) #6
  %.not40 = icmp eq ptr %37, null
  br i1 %.not40, label %40, label %38

38:                                               ; preds = %36
  store i32 -1, ptr %8, align 4, !tbaa !5
  %39 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %37, ptr noundef nonnull @.str.14, ptr noundef nonnull %8) #6
  br label %40

40:                                               ; preds = %38, %36
  call void @ClearNameValueList(ptr noundef nonnull %6) #6
  %41 = load i32, ptr %8, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %11, %5, %40
  %.0 = phi i32 [ %41, %40 ], [ -2, %5 ], [ -3, %11 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %6) #6
  ret i32 %.0
}

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

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

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


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