; LLVM IR from CerebusOSS/CereLink :: Central/UDPsocket.ll (ZN9UDPSocket7OpenTCPE15STARTUP_OPTIONSibPKcS2_bbbiiii)

; 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.sockaddr_in = type { i16, i16, %struct.in_addr, [8 x i8] }
%struct.in_addr = type { i32 }
%class.UDPSocket = type <{ ptr, i32, %struct.sockaddr_in, i32, i32, i8, i8, [2 x i8] }>

@.str.4 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [61 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9UDPSocket5CloseEv(ptr noundef nonnull align 8 dereferenceable(38)) #0 align 2

; Function Attrs: nounwind
declare i32 @socket(i32 noundef, i32 noundef, i32 noundef) #1

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

; Function Attrs: nounwind
declare i32 @setsockopt(i32 noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef) #1

; Function Attrs: nounwind
declare i32 @getsockopt(i32 noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef) #1

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

declare i32 @fcntl(i32 noundef, i32 noundef, ...) #3

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef zeroext i16 @_ZL10__bswap_16t(i16 noundef zeroext) #5

; Function Attrs: nounwind
declare i32 @inet_addr(ptr noundef) #1

declare i32 @printf(ptr noundef, ...) #3

; Function Attrs: nounwind
declare ptr @inet_ntoa(i32) #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN9UDPSocket7OpenTCPE15STARTUP_OPTIONSibPKcS2_bbbiiii(ptr noundef nonnull align 8 dereferenceable(38) %0, i32 noundef %1, i32 noundef %2, i1 noundef zeroext %3, ptr noundef %4, ptr noundef %5, i1 noundef zeroext %6, i1 noundef zeroext %7, i1 noundef zeroext %8, i32 noundef %9, i32 noundef %10, i32 noundef %11, i32 noundef %12) #0 align 2 {
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i8, align 1
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca i8, align 1
  %22 = alloca i8, align 1
  %23 = alloca i8, align 1
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca i32, align 4
  %28 = alloca i32, align 4
  %29 = alloca i32, align 4
  %30 = alloca i32, align 4
  %31 = alloca i32, align 4
  %32 = alloca i32, align 4
  %33 = alloca i8, align 1
  %34 = alloca %struct.sockaddr_in, align 4
  %35 = alloca i32, align 4
  %36 = alloca %struct.in_addr, align 4
  %37 = alloca %struct.in_addr, align 4
  store ptr %0, ptr %15, align 8, !tbaa !5
  store i32 %1, ptr %16, align 4, !tbaa !9
  store i32 %2, ptr %17, align 4, !tbaa !11
  %38 = zext i1 %3 to i8
  store i8 %38, ptr %18, align 1, !tbaa !13
  store ptr %4, ptr %19, align 8, !tbaa !5
  store ptr %5, ptr %20, align 8, !tbaa !5
  %39 = zext i1 %6 to i8
  store i8 %39, ptr %21, align 1, !tbaa !13
  %40 = zext i1 %7 to i8
  store i8 %40, ptr %22, align 1, !tbaa !13
  %41 = zext i1 %8 to i8
  store i8 %41, ptr %23, align 1, !tbaa !13
  store i32 %9, ptr %24, align 4, !tbaa !11
  store i32 %10, ptr %25, align 4, !tbaa !11
  store i32 %11, ptr %26, align 4, !tbaa !11
  store i32 %12, ptr %27, align 4, !tbaa !11
  %42 = load ptr, ptr %15, align 8
  %43 = load i8, ptr %18, align 1, !tbaa !13, !range !15, !noundef !16
  %44 = trunc i8 %43 to i1
  %45 = getelementptr inbounds %class.UDPSocket, ptr %42, i32 0, i32 5
  %46 = zext i1 %44 to i8
  store i8 %46, ptr %45, align 4, !tbaa !17
  %47 = load i32, ptr %27, align 4, !tbaa !11
  %48 = getelementptr inbounds %class.UDPSocket, ptr %42, i32 0, i32 4
  store i32 %47, ptr %48, align 8, !tbaa !22
  %49 = load i32, ptr %16, align 4, !tbaa !9
  %50 = getelementptr inbounds %class.UDPSocket, ptr %42, i32 0, i32 3
  store i32 %49, ptr %50, align 4, !tbaa !23
  %51 = call i32 @socket(i32 noundef 2, i32 noundef 1, i32 noundef 0) #7
  %52 = getelementptr inbounds %class.UDPSocket, ptr %42, i32 0, i32 1
  store i32 %51, ptr %52, align 8, !tbaa !24
  %53 = getelementptr inbounds %class.UDPSocket, ptr %42, i32 0, i32 1
  %54 = load i32, ptr %53, align 8, !tbaa !24
  %55 = icmp eq i32 %54, -1
  br i1 %55, label %56, label %57

56:                                               ; preds = %13
  call void @_ZN9UDPSocket5CloseEv(ptr noundef nonnull align 8 dereferenceable(38) %42)
  store i32 21, ptr %14, align 4
  br label %155

57:                                               ; preds = %13
  %58 = load i32, ptr %24, align 4, !tbaa !11
  %59 = icmp sgt i32 %58, 0
  br i1 %59, label %60, label %88

60:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 4, ptr %28) #7
  %61 = load i32, ptr %24, align 4, !tbaa !11
  store i32 %61, ptr %28, align 4, !tbaa !11
  %62 = getelementptr inbounds %class.UDPSocket, ptr %42, i32 0, i32 1
  %63 = load i32, ptr %62, align 8, !tbaa !24
  %64 = call i32 @setsockopt(i32 noundef %63, i32 noundef 1, i32 noundef 8, ptr noundef %28, i32 noundef 4) #7
  %65 = icmp ne i32 %64, 0
  br i1 %65, label %66, label %67

66:                                               ; preds = %60
  call void @_ZN9UDPSocket5CloseEv(ptr noundef nonnull align 8 dereferenceable(38) %42)
  store i32 22, ptr %14, align 4
  store i32 1, ptr %29, align 4
  br label %85

67:                                               ; preds = %60
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #7
  store i32 4, ptr %30, align 4, !tbaa !11
  %68 = getelementptr inbounds %class.UDPSocket, ptr %42, i32 0, i32 1
  %69 = load i32, ptr %68, align 8, !tbaa !24
  %70 = call i32 @getsockopt(i32 noundef %69, i32 noundef 1, i32 noundef 8, ptr noundef %28, ptr noundef %30) #7
  %71 = icmp ne i32 %70, 0
  br i1 %71, label %72, label %73

72:                                               ; preds = %67
  call void @_ZN9UDPSocket5CloseEv(ptr noundef nonnull align 8 dereferenceable(38) %42)
  store i32 22, ptr %14, align 4
  store i32 1, ptr %29, align 4
  br label %84

73:                                               ; preds = %67
  %74 = load i32, ptr %28, align 4, !tbaa !11
  %75 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %74)
  br label %76

76:                                               ; preds = %73
  %77 = load i32, ptr %28, align 4, !tbaa !11
  %78 = sdiv i32 %77, 2
  store i32 %78, ptr %28, align 4, !tbaa !11
  %79 = load i32, ptr %28, align 4, !tbaa !11
  %80 = load i32, ptr %24, align 4, !tbaa !11
  %81 = icmp slt i32 %79, %80
  br i1 %81, label %82, label %83

82:                                               ; preds = %76
  call void @_ZN9UDPSocket5CloseEv(ptr noundef nonnull align 8 dereferenceable(38) %42)
  store i32 23, ptr %14, align 4
  store i32 1, ptr %29, align 4
  br label %84

83:                                               ; preds = %76
  store i32 0, ptr %29, align 4
  br label %84

84:                                               ; preds = %83, %82, %72
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #7
  br label %85

85:                                               ; preds = %84, %66
  call void @llvm.lifetime.end.p0(i64 4, ptr %28) #7
  %86 = load i32, ptr %29, align 4
  switch i32 %86, label %157 [
    i32 0, label %87
    i32 1, label %155
  ]

87:                                               ; preds = %85
  br label %88

88:                                               ; preds = %87, %57
  call void @llvm.lifetime.start.p0(i64 4, ptr %31) #7
  %89 = load i32, ptr %24, align 4, !tbaa !11
  store i32 %89, ptr %31, align 4, !tbaa !11
  %90 = getelementptr inbounds %class.UDPSocket, ptr %42, i32 0, i32 1
  %91 = load i32, ptr %90, align 8, !tbaa !24
  %92 = call i32 @setsockopt(i32 noundef %91, i32 noundef 1, i32 noundef 7, ptr noundef %31, i32 noundef 4) #7
  %93 = icmp ne i32 %92, 0
  br i1 %93, label %94, label %95

94:                                               ; preds = %88
  call void @_ZN9UDPSocket5CloseEv(ptr noundef nonnull align 8 dereferenceable(38) %42)
  store i32 22, ptr %14, align 4
  store i32 1, ptr %29, align 4
  br label %154

95:                                               ; preds = %88
  call void @llvm.lifetime.start.p0(i64 4, ptr %32) #7
  store i32 1, ptr %32, align 4, !tbaa !11
  %96 = getelementptr inbounds %class.UDPSocket, ptr %42, i32 0, i32 1
  %97 = load i32, ptr %96, align 8, !tbaa !24
  %98 = call i32 @setsockopt(i32 noundef %97, i32 noundef 1, i32 noundef 5, ptr noundef %32, i32 noundef 4) #7
  %99 = icmp ne i32 %98, 0
  br i1 %99, label %100, label %101

100:                                              ; preds = %95
  call void @_ZN9UDPSocket5CloseEv(ptr noundef nonnull align 8 dereferenceable(38) %42)
  store i32 22, ptr %14, align 4
  store i32 1, ptr %29, align 4
  br label %102

101:                                              ; preds = %95
  store i32 0, ptr %29, align 4
  br label %102

102:                                              ; preds = %101, %100
  call void @llvm.lifetime.end.p0(i64 4, ptr %32) #7
  %103 = load i32, ptr %29, align 4
  switch i32 %103, label %154 [
    i32 0, label %104
  ]

104:                                              ; preds = %102
  %105 = getelementptr inbounds %class.UDPSocket, ptr %42, i32 0, i32 1
  %106 = load i32, ptr %105, align 8, !tbaa !24
  %107 = call i32 (i32, i32, ...) @fcntl(i32 noundef %106, i32 noundef 4, i32 noundef 2048)
  %108 = icmp ne i32 %107, 0
  br i1 %108, label %109, label %110

109:                                              ; preds = %104
  call void @_ZN9UDPSocket5CloseEv(ptr noundef nonnull align 8 dereferenceable(38) %42)
  store i32 22, ptr %14, align 4
  store i32 1, ptr %29, align 4
  br label %154

110:                                              ; preds = %104
  call void @llvm.lifetime.start.p0(i64 1, ptr %33) #7
  store i8 0, ptr %33, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 16, ptr %34) #7
  call void @llvm.memset.p0.i64(ptr align 4 %34, i8 0, i64 16, i1 false)
  %111 = getelementptr inbounds %struct.sockaddr_in, ptr %34, i32 0, i32 0
  store i16 2, ptr %111, align 4, !tbaa !25
  %112 = load i32, ptr %25, align 4, !tbaa !11
  %113 = trunc i32 %112 to i16
  %114 = call noundef zeroext i16 @_ZL10__bswap_16t(i16 noundef zeroext %113)
  %115 = getelementptr inbounds %struct.sockaddr_in, ptr %34, i32 0, i32 1
  store i16 %114, ptr %115, align 2, !tbaa !26
  %116 = load ptr, ptr %19, align 8, !tbaa !5
  %117 = call i32 @inet_addr(ptr noundef %116) #7
  %118 = getelementptr inbounds %struct.sockaddr_in, ptr %34, i32 0, i32 2
  %119 = getelementptr inbounds %struct.in_addr, ptr %118, i32 0, i32 0
  store i32 %117, ptr %119, align 4, !tbaa !27
  call void @llvm.lifetime.start.p0(i64 4, ptr %35) #7
  %120 = getelementptr inbounds %class.UDPSocket, ptr %42, i32 0, i32 1
  %121 = load i32, ptr %120, align 8, !tbaa !24
  %122 = call i32 @connect(i32 noundef %121, ptr noundef %34, i32 noundef 16)
  store i32 %122, ptr %35, align 4, !tbaa !11
  %123 = load i32, ptr %35, align 4, !tbaa !11
  %124 = icmp eq i32 %123, 0
  br i1 %124, label %125, label %126

125:                                              ; preds = %110
  call void @_ZN9UDPSocket5CloseEv(ptr noundef nonnull align 8 dereferenceable(38) %42)
  store i32 22, ptr %14, align 4
  store i32 1, ptr %29, align 4
  br label %153

126:                                              ; preds = %110
  %127 = getelementptr inbounds %class.UDPSocket, ptr %42, i32 0, i32 5
  %128 = load i8, ptr %127, align 4, !tbaa !17, !range !15, !noundef !16
  %129 = trunc i8 %128 to i1
  br i1 %129, label %130, label %151

130:                                              ; preds = %126
  %131 = getelementptr inbounds %struct.sockaddr_in, ptr %34, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %36, ptr align 4 %131, i64 4, i1 false), !tbaa.struct !28
  %132 = getelementptr inbounds %struct.in_addr, ptr %36, i32 0, i32 0
  %133 = load i32, ptr %132, align 4
  %134 = call ptr @inet_ntoa(i32 %133) #7
  %135 = getelementptr inbounds %struct.sockaddr_in, ptr %34, i32 0, i32 1
  %136 = load i16, ptr %135, align 2, !tbaa !26
  %137 = call noundef zeroext i16 @_ZL10__bswap_16t(i16 noundef zeroext %136)
  %138 = zext i16 %137 to i32
  %139 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, ptr noundef %134, i32 noundef %138)
  %140 = getelementptr inbounds %class.UDPSocket, ptr %42, i32 0, i32 2
  %141 = getelementptr inbounds %struct.sockaddr_in, ptr %140, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %37, ptr align 4 %141, i64 4, i1 false), !tbaa.struct !28
  %142 = getelementptr inbounds %struct.in_addr, ptr %37, i32 0, i32 0
  %143 = load i32, ptr %142, align 4
  %144 = call ptr @inet_ntoa(i32 %143) #7
  %145 = getelementptr inbounds %class.UDPSocket, ptr %42, i32 0, i32 2
  %146 = getelementptr inbounds %struct.sockaddr_in, ptr %145, i32 0, i32 1
  %147 = load i16, ptr %146, align 2, !tbaa !29
  %148 = call noundef zeroext i16 @_ZL10__bswap_16t(i16 noundef zeroext %147)
  %149 = zext i16 %148 to i32
  %150 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, ptr noundef %144, i32 noundef %149)
  br label %151

151:                                              ; preds = %130, %126
  %152 = getelementptr inbounds %class.UDPSocket, ptr %42, i32 0, i32 6
  store i8 1, ptr %152, align 1, !tbaa !30
  store i32 0, ptr %14, align 4
  store i32 1, ptr %29, align 4
  br label %153

153:                                              ; preds = %151, %125
  call void @llvm.lifetime.end.p0(i64 4, ptr %35) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %34) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %33) #7
  br label %154

154:                                              ; preds = %153, %109, %102, %94
  call void @llvm.lifetime.end.p0(i64 4, ptr %31) #7
  br label %155

155:                                              ; preds = %154, %85, %56
  %156 = load i32, ptr %14, align 4
  ret i32 %156

157:                                              ; preds = %85
  unreachable
}

declare i32 @connect(i32 noundef, ptr noundef, i32 noundef) #3

attributes #0 = { mustprogress 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 = { 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { inlinehint mustprogress 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"_ZTS15STARTUP_OPTIONS", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = !{!18, !14, i64 36}
!18 = !{!"_ZTS9UDPSocket", !12, i64 8, !19, i64 12, !10, i64 28, !12, i64 32, !14, i64 36, !14, i64 37}
!19 = !{!"_ZTS11sockaddr_in", !20, i64 0, !20, i64 2, !21, i64 4, !7, i64 8}
!20 = !{!"short", !7, i64 0}
!21 = !{!"_ZTS7in_addr", !12, i64 0}
!22 = !{!18, !12, i64 32}
!23 = !{!18, !10, i64 28}
!24 = !{!18, !12, i64 8}
!25 = !{!19, !20, i64 0}
!26 = !{!19, !20, i64 2}
!27 = !{!19, !12, i64 4}
!28 = !{i64 0, i64 4, !11}
!29 = !{!18, !20, i64 14}
!30 = !{!18, !14, i64 37}


; 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.sockaddr_in = type { i16, i16, %struct.in_addr, [8 x i8] }
%struct.in_addr = type { i32 }

@.str.4 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [61 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9UDPSocket5CloseEv(ptr noundef nonnull align 8 dereferenceable(38)) local_unnamed_addr #0 align 2

; Function Attrs: nounwind
declare i32 @socket(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind
declare i32 @setsockopt(i32 noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind
declare i32 @getsockopt(i32 noundef, i32 noundef, i32 noundef, ptr noundef, 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) #2

declare i32 @fcntl(i32 noundef, i32 noundef, ...) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef zeroext i16 @_ZL10__bswap_16t(i16 noundef zeroext) local_unnamed_addr #4

; Function Attrs: nounwind
declare i32 @inet_addr(ptr noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind
declare ptr @inet_ntoa(i32) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN9UDPSocket7OpenTCPE15STARTUP_OPTIONSibPKcS2_bbbiiii(ptr noundef nonnull align 8 dereferenceable(38) %0, i32 noundef %1, i32 noundef %2, i1 noundef zeroext %3, ptr noundef %4, ptr nocapture noundef readnone %5, i1 noundef zeroext %6, i1 noundef zeroext %7, i1 noundef zeroext %8, i32 noundef %9, i32 noundef %10, i32 noundef %11, i32 noundef %12) local_unnamed_addr #0 align 2 {
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca %struct.sockaddr_in, align 4
  %19 = zext i1 %3 to i8
  %20 = getelementptr inbounds i8, ptr %0, i64 36
  store i8 %19, ptr %20, align 4, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 %12, ptr %21, align 8, !tbaa !15
  %22 = getelementptr inbounds i8, ptr %0, i64 28
  store i32 %1, ptr %22, align 4, !tbaa !16
  %23 = tail call i32 @socket(i32 noundef 2, i32 noundef 1, i32 noundef 0) #6
  %24 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 %23, ptr %24, align 8, !tbaa !17
  %25 = icmp eq i32 %23, -1
  br i1 %25, label %26, label %27

26:                                               ; preds = %13
  tail call void @_ZN9UDPSocket5CloseEv(ptr noundef nonnull align 8 dereferenceable(38) %0)
  br label %84

27:                                               ; preds = %13
  %28 = icmp sgt i32 %9, 0
  br i1 %28, label %29, label %41

29:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %14) #6
  store i32 %9, ptr %14, align 4, !tbaa !18
  %30 = call i32 @setsockopt(i32 noundef %23, i32 noundef 1, i32 noundef 8, ptr noundef nonnull %14, i32 noundef 4) #6
  %.not = icmp eq i32 %30, 0
  br i1 %.not, label %31, label %.thread

.thread:                                          ; preds = %29
  call void @_ZN9UDPSocket5CloseEv(ptr noundef nonnull align 8 dereferenceable(38) %0)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %14) #6
  br label %84

31:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %15) #6
  store i32 4, ptr %15, align 4, !tbaa !18
  %32 = load i32, ptr %24, align 8, !tbaa !17
  %33 = call i32 @getsockopt(i32 noundef %32, i32 noundef 1, i32 noundef 8, ptr noundef nonnull %14, ptr noundef nonnull %15) #6
  %.not18 = icmp eq i32 %33, 0
  br i1 %.not18, label %34, label %.thread25

34:                                               ; preds = %31
  %35 = load i32, ptr %14, align 4, !tbaa !18
  %36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %35)
  %37 = load i32, ptr %14, align 4, !tbaa !18
  %38 = sdiv i32 %37, 2
  store i32 %38, ptr %14, align 4, !tbaa !18
  %39 = icmp slt i32 %38, %9
  br i1 %39, label %.thread25, label %40

.thread25:                                        ; preds = %34, %31
  %.0.ph = phi i32 [ 22, %31 ], [ 23, %34 ]
  call void @_ZN9UDPSocket5CloseEv(ptr noundef nonnull align 8 dereferenceable(38) %0)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %14) #6
  br label %84

40:                                               ; preds = %34
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %14) #6
  %.pre = load i32, ptr %24, align 8, !tbaa !17
  br label %41

41:                                               ; preds = %40, %27
  %42 = phi i32 [ %.pre, %40 ], [ %23, %27 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %16) #6
  store i32 %9, ptr %16, align 4, !tbaa !18
  %43 = call i32 @setsockopt(i32 noundef %42, i32 noundef 1, i32 noundef 7, ptr noundef nonnull %16, i32 noundef 4) #6
  %.not19 = icmp eq i32 %43, 0
  br i1 %.not19, label %45, label %44

44:                                               ; preds = %41
  call void @_ZN9UDPSocket5CloseEv(ptr noundef nonnull align 8 dereferenceable(38) %0)
  br label %83

45:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %17) #6
  store i32 1, ptr %17, align 4, !tbaa !18
  %46 = load i32, ptr %24, align 8, !tbaa !17
  %47 = call i32 @setsockopt(i32 noundef %46, i32 noundef 1, i32 noundef 5, ptr noundef nonnull %17, i32 noundef 4) #6
  %.not20 = icmp eq i32 %47, 0
  br i1 %.not20, label %49, label %48

48:                                               ; preds = %45
  call void @_ZN9UDPSocket5CloseEv(ptr noundef nonnull align 8 dereferenceable(38) %0)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %17) #6
  br label %83

49:                                               ; preds = %45
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %17) #6
  %50 = load i32, ptr %24, align 8, !tbaa !17
  %51 = call i32 (i32, i32, ...) @fcntl(i32 noundef %50, i32 noundef 4, i32 noundef 2048)
  %.not21 = icmp eq i32 %51, 0
  br i1 %.not21, label %53, label %52

52:                                               ; preds = %49
  call void @_ZN9UDPSocket5CloseEv(ptr noundef nonnull align 8 dereferenceable(38) %0)
  br label %83

53:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %18) #6
  %54 = getelementptr inbounds i8, ptr %18, i64 8
  store i64 0, ptr %54, align 4
  store i16 2, ptr %18, align 4, !tbaa !19
  %55 = trunc i32 %10 to i16
  %56 = call noundef zeroext i16 @_ZL10__bswap_16t(i16 noundef zeroext %55)
  %57 = getelementptr inbounds i8, ptr %18, i64 2
  store i16 %56, ptr %57, align 2, !tbaa !20
  %58 = call i32 @inet_addr(ptr noundef %4) #6
  %59 = getelementptr inbounds i8, ptr %18, i64 4
  store i32 %58, ptr %59, align 4, !tbaa !21
  %60 = load i32, ptr %24, align 8, !tbaa !17
  %61 = call i32 @connect(i32 noundef %60, ptr noundef nonnull %18, i32 noundef 16)
  %62 = icmp eq i32 %61, 0
  br i1 %62, label %63, label %64

63:                                               ; preds = %53
  call void @_ZN9UDPSocket5CloseEv(ptr noundef nonnull align 8 dereferenceable(38) %0)
  br label %82

64:                                               ; preds = %53
  %65 = load i8, ptr %20, align 4, !tbaa !5, !range !22, !noundef !23
  %66 = trunc nuw i8 %65 to i1
  br i1 %66, label %67, label %80

67:                                               ; preds = %64
  %.sroa.01.0.copyload = load i32, ptr %59, align 4, !tbaa !18
  %68 = call ptr @inet_ntoa(i32 %.sroa.01.0.copyload) #6
  %69 = load i16, ptr %57, align 2, !tbaa !20
  %70 = call noundef zeroext i16 @_ZL10__bswap_16t(i16 noundef zeroext %69)
  %71 = zext i16 %70 to i32
  %72 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, ptr noundef %68, i32 noundef %71)
  %73 = getelementptr inbounds i8, ptr %0, i64 16
  %.sroa.0.0.copyload = load i32, ptr %73, align 8, !tbaa !18
  %74 = call ptr @inet_ntoa(i32 %.sroa.0.0.copyload) #6
  %75 = getelementptr inbounds i8, ptr %0, i64 14
  %76 = load i16, ptr %75, align 2, !tbaa !24
  %77 = call noundef zeroext i16 @_ZL10__bswap_16t(i16 noundef zeroext %76)
  %78 = zext i16 %77 to i32
  %79 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, ptr noundef %74, i32 noundef %78)
  br label %80

80:                                               ; preds = %67, %64
  %81 = getelementptr inbounds i8, ptr %0, i64 37
  store i8 1, ptr %81, align 1, !tbaa !25
  br label %82

82:                                               ; preds = %80, %63
  %.4 = phi i32 [ 22, %63 ], [ 0, %80 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %18) #6
  br label %83

83:                                               ; preds = %48, %82, %52, %44
  %.5 = phi i32 [ 22, %44 ], [ 22, %52 ], [ %.4, %82 ], [ 22, %48 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %16) #6
  br label %84

84:                                               ; preds = %.thread25, %.thread, %83, %26
  %.6 = phi i32 [ 21, %26 ], [ %.5, %83 ], [ 22, %.thread ], [ %.0.ph, %.thread25 ]
  ret i32 %.6
}

declare i32 @connect(i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

attributes #0 = { mustprogress 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 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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 = { inlinehint mustprogress 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 = { 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, !14, i64 36}
!6 = !{!"_ZTS9UDPSocket", !7, i64 8, !10, i64 12, !13, i64 28, !7, i64 32, !14, i64 36, !14, i64 37}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTS11sockaddr_in", !11, i64 0, !11, i64 2, !12, i64 4, !8, i64 8}
!11 = !{!"short", !8, i64 0}
!12 = !{!"_ZTS7in_addr", !7, i64 0}
!13 = !{!"_ZTS15STARTUP_OPTIONS", !8, i64 0}
!14 = !{!"bool", !8, i64 0}
!15 = !{!6, !7, i64 32}
!16 = !{!6, !13, i64 28}
!17 = !{!6, !7, i64 8}
!18 = !{!7, !7, i64 0}
!19 = !{!10, !11, i64 0}
!20 = !{!10, !11, i64 2}
!21 = !{!10, !7, i64 4}
!22 = !{i8 0, i8 2}
!23 = !{}
!24 = !{!6, !11, i64 14}
!25 = !{!6, !14, i64 37}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass