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

; 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.anon = type { i32, i32 }

@reserved = external hidden constant [18 x %struct.anon], align 16

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

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

12:                                               ; preds = %1
  %13 = load i32, ptr %4, align 4, !tbaa !9
  %14 = call i32 @__bswap_32(i32 noundef %13)
  store i32 %14, ptr %5, align 4, !tbaa !9
  store i64 0, ptr %6, align 8, !tbaa !11
  br label %15

15:                                               ; preds = %37, %12
  %16 = load i64, ptr %6, align 8, !tbaa !11
  %17 = icmp ult i64 %16, 18
  br i1 %17, label %18, label %40

18:                                               ; preds = %15
  %19 = load i32, ptr %5, align 4, !tbaa !9
  %20 = load i64, ptr %6, align 8, !tbaa !11
  %21 = getelementptr inbounds [18 x %struct.anon], ptr @reserved, i64 0, i64 %20
  %22 = getelementptr inbounds %struct.anon, ptr %21, i32 0, i32 1
  %23 = load i32, ptr %22, align 4, !tbaa !13
  %24 = lshr i32 %19, %23
  %25 = load i64, ptr %6, align 8, !tbaa !11
  %26 = getelementptr inbounds [18 x %struct.anon], ptr @reserved, i64 0, i64 %25
  %27 = getelementptr inbounds %struct.anon, ptr %26, i32 0, i32 0
  %28 = load i32, ptr %27, align 8, !tbaa !15
  %29 = load i64, ptr %6, align 8, !tbaa !11
  %30 = getelementptr inbounds [18 x %struct.anon], ptr @reserved, i64 0, i64 %29
  %31 = getelementptr inbounds %struct.anon, ptr %30, i32 0, i32 1
  %32 = load i32, ptr %31, align 4, !tbaa !13
  %33 = lshr i32 %28, %32
  %34 = icmp eq i32 %24, %33
  br i1 %34, label %35, label %36

35:                                               ; preds = %18
  store i32 1, ptr %2, align 4
  store i32 1, ptr %7, align 4
  br label %41

36:                                               ; preds = %18
  br label %37

37:                                               ; preds = %36
  %38 = load i64, ptr %6, align 8, !tbaa !11
  %39 = add i64 %38, 1
  store i64 %39, ptr %6, align 8, !tbaa !11
  br label %15, !llvm.loop !16

40:                                               ; preds = %15
  store i32 0, ptr %2, align 4
  store i32 1, ptr %7, align 4
  br label %41

41:                                               ; preds = %40, %35, %11
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  %42 = load i32, ptr %2, align 4
  ret i32 %42
}

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @__bswap_32(i32 noundef) #3

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

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 = { inlinehint 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 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !10, i64 4}
!14 = !{!"", !10, i64 0, !10, i64 4}
!15 = !{!14, !10, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}


; 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.anon = type { i32, i32 }

@reserved = external hidden local_unnamed_addr constant [18 x %struct.anon], align 16

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @addr_is_reserved(ptr noundef %0) local_unnamed_addr #0 {
  %2 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  %3 = call i32 @inet_pton(i32 noundef 2, ptr noundef %0, ptr noundef nonnull %2) #4
  %4 = icmp slt i32 %3, 1
  br i1 %4, label %.loopexit, label %5

5:                                                ; preds = %1
  %6 = load i32, ptr %2, align 4, !tbaa !5
  %7 = call i32 @__bswap_32(i32 noundef %6)
  %8 = load i32, ptr getelementptr inbounds (i8, ptr @reserved, i64 4), align 4, !tbaa !9
  %9 = lshr i32 %7, %8
  %10 = load i32, ptr @reserved, align 16, !tbaa !11
  %11 = lshr i32 %10, %8
  %12 = icmp eq i32 %9, %11
  br i1 %12, label %.loopexit, label %13

13:                                               ; preds = %5
  %14 = load i32, ptr getelementptr inbounds (i8, ptr @reserved, i64 12), align 4, !tbaa !9
  %15 = lshr i32 %7, %14
  %16 = load i32, ptr getelementptr inbounds (i8, ptr @reserved, i64 8), align 8, !tbaa !11
  %17 = lshr i32 %16, %14
  %18 = icmp eq i32 %15, %17
  br i1 %18, label %.loopexit, label %19

19:                                               ; preds = %13
  %20 = load i32, ptr getelementptr inbounds (i8, ptr @reserved, i64 20), align 4, !tbaa !9
  %21 = lshr i32 %7, %20
  %22 = load i32, ptr getelementptr inbounds (i8, ptr @reserved, i64 16), align 16, !tbaa !11
  %23 = lshr i32 %22, %20
  %24 = icmp eq i32 %21, %23
  br i1 %24, label %.loopexit, label %25

25:                                               ; preds = %19
  %26 = load i32, ptr getelementptr inbounds (i8, ptr @reserved, i64 28), align 4, !tbaa !9
  %27 = lshr i32 %7, %26
  %28 = load i32, ptr getelementptr inbounds (i8, ptr @reserved, i64 24), align 8, !tbaa !11
  %29 = lshr i32 %28, %26
  %30 = icmp eq i32 %27, %29
  br i1 %30, label %.loopexit, label %31

31:                                               ; preds = %25
  %32 = load i32, ptr getelementptr inbounds (i8, ptr @reserved, i64 36), align 4, !tbaa !9
  %33 = lshr i32 %7, %32
  %34 = load i32, ptr getelementptr inbounds (i8, ptr @reserved, i64 32), align 16, !tbaa !11
  %35 = lshr i32 %34, %32
  %36 = icmp eq i32 %33, %35
  br i1 %36, label %.loopexit, label %37

37:                                               ; preds = %31
  %38 = load i32, ptr getelementptr inbounds (i8, ptr @reserved, i64 44), align 4, !tbaa !9
  %39 = lshr i32 %7, %38
  %40 = load i32, ptr getelementptr inbounds (i8, ptr @reserved, i64 40), align 8, !tbaa !11
  %41 = lshr i32 %40, %38
  %42 = icmp eq i32 %39, %41
  br i1 %42, label %.loopexit, label %43

43:                                               ; preds = %37
  %44 = load i32, ptr getelementptr inbounds (i8, ptr @reserved, i64 52), align 4, !tbaa !9
  %45 = lshr i32 %7, %44
  %46 = load i32, ptr getelementptr inbounds (i8, ptr @reserved, i64 48), align 16, !tbaa !11
  %47 = lshr i32 %46, %44
  %48 = icmp eq i32 %45, %47
  br i1 %48, label %.loopexit, label %49

49:                                               ; preds = %43
  %50 = load i32, ptr getelementptr inbounds (i8, ptr @reserved, i64 60), align 4, !tbaa !9
  %51 = lshr i32 %7, %50
  %52 = load i32, ptr getelementptr inbounds (i8, ptr @reserved, i64 56), align 8, !tbaa !11
  %53 = lshr i32 %52, %50
  %54 = icmp eq i32 %51, %53
  br i1 %54, label %.loopexit, label %55

55:                                               ; preds = %49
  %56 = load i32, ptr getelementptr inbounds (i8, ptr @reserved, i64 68), align 4, !tbaa !9
  %57 = lshr i32 %7, %56
  %58 = load i32, ptr getelementptr inbounds (i8, ptr @reserved, i64 64), align 16, !tbaa !11
  %59 = lshr i32 %58, %56
  %60 = icmp eq i32 %57, %59
  br i1 %60, label %.loopexit, label %61

61:                                               ; preds = %55
  %62 = load i32, ptr getelementptr inbounds (i8, ptr @reserved, i64 76), align 4, !tbaa !9
  %63 = lshr i32 %7, %62
  %64 = load i32, ptr getelementptr inbounds (i8, ptr @reserved, i64 72), align 8, !tbaa !11
  %65 = lshr i32 %64, %62
  %66 = icmp eq i32 %63, %65
  br i1 %66, label %.loopexit, label %67

67:                                               ; preds = %61
  %68 = load i32, ptr getelementptr inbounds (i8, ptr @reserved, i64 84), align 4, !tbaa !9
  %69 = lshr i32 %7, %68
  %70 = load i32, ptr getelementptr inbounds (i8, ptr @reserved, i64 80), align 16, !tbaa !11
  %71 = lshr i32 %70, %68
  %72 = icmp eq i32 %69, %71
  br i1 %72, label %.loopexit, label %73

73:                                               ; preds = %67
  %74 = load i32, ptr getelementptr inbounds (i8, ptr @reserved, i64 92), align 4, !tbaa !9
  %75 = lshr i32 %7, %74
  %76 = load i32, ptr getelementptr inbounds (i8, ptr @reserved, i64 88), align 8, !tbaa !11
  %77 = lshr i32 %76, %74
  %78 = icmp eq i32 %75, %77
  br i1 %78, label %.loopexit, label %79

79:                                               ; preds = %73
  %80 = load i32, ptr getelementptr inbounds (i8, ptr @reserved, i64 100), align 4, !tbaa !9
  %81 = lshr i32 %7, %80
  %82 = load i32, ptr getelementptr inbounds (i8, ptr @reserved, i64 96), align 16, !tbaa !11
  %83 = lshr i32 %82, %80
  %84 = icmp eq i32 %81, %83
  br i1 %84, label %.loopexit, label %85

85:                                               ; preds = %79
  %86 = load i32, ptr getelementptr inbounds (i8, ptr @reserved, i64 108), align 4, !tbaa !9
  %87 = lshr i32 %7, %86
  %88 = load i32, ptr getelementptr inbounds (i8, ptr @reserved, i64 104), align 8, !tbaa !11
  %89 = lshr i32 %88, %86
  %90 = icmp eq i32 %87, %89
  br i1 %90, label %.loopexit, label %91

91:                                               ; preds = %85
  %92 = load i32, ptr getelementptr inbounds (i8, ptr @reserved, i64 116), align 4, !tbaa !9
  %93 = lshr i32 %7, %92
  %94 = load i32, ptr getelementptr inbounds (i8, ptr @reserved, i64 112), align 16, !tbaa !11
  %95 = lshr i32 %94, %92
  %96 = icmp eq i32 %93, %95
  br i1 %96, label %.loopexit, label %97

97:                                               ; preds = %91
  %98 = load i32, ptr getelementptr inbounds (i8, ptr @reserved, i64 124), align 4, !tbaa !9
  %99 = lshr i32 %7, %98
  %100 = load i32, ptr getelementptr inbounds (i8, ptr @reserved, i64 120), align 8, !tbaa !11
  %101 = lshr i32 %100, %98
  %102 = icmp eq i32 %99, %101
  br i1 %102, label %.loopexit, label %103

103:                                              ; preds = %97
  %104 = load i32, ptr getelementptr inbounds (i8, ptr @reserved, i64 132), align 4, !tbaa !9
  %105 = lshr i32 %7, %104
  %106 = load i32, ptr getelementptr inbounds (i8, ptr @reserved, i64 128), align 16, !tbaa !11
  %107 = lshr i32 %106, %104
  %108 = icmp eq i32 %105, %107
  br i1 %108, label %.loopexit, label %109

109:                                              ; preds = %103
  %110 = load i32, ptr getelementptr inbounds (i8, ptr @reserved, i64 140), align 4, !tbaa !9
  %111 = lshr i32 %7, %110
  %112 = load i32, ptr getelementptr inbounds (i8, ptr @reserved, i64 136), align 8, !tbaa !11
  %113 = lshr i32 %112, %110
  %114 = icmp eq i32 %111, %113
  %spec.select = zext i1 %114 to i32
  br label %.loopexit

.loopexit:                                        ; preds = %109, %5, %13, %19, %25, %31, %37, %43, %49, %55, %61, %67, %73, %79, %85, %91, %97, %103, %1
  %.07 = phi i32 [ 1, %1 ], [ 1, %5 ], [ 1, %13 ], [ 1, %19 ], [ 1, %25 ], [ 1, %31 ], [ 1, %37 ], [ 1, %43 ], [ 1, %49 ], [ 1, %55 ], [ 1, %61 ], [ 1, %67 ], [ 1, %73 ], [ 1, %79 ], [ 1, %85 ], [ 1, %91 ], [ 1, %97 ], [ 1, %103 ], [ %spec.select, %109 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  ret i32 %.07
}

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

; Function Attrs: nounwind
declare i32 @inet_pton(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @__bswap_32(i32 noundef) local_unnamed_addr #3

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

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


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,SROAPass,SimplifyCFGPass