; LLVM IR from uNetworking/uSockets :: src (bsd)

; 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.addrinfo = type { i32, i32, i32, i32, i32, ptr, ptr, ptr }
%union.__CONST_SOCKADDR_ARG = type { ptr }

@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [25 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

; 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 @setsockopt(i32 noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @bsd_create_socket(i32 noundef, i32 noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @bsd_close_socket(i32 noundef) #2

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__errno_location() #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: nounwind
declare i32 @snprintf(ptr noundef, i64 noundef, ptr noundef, ...) #1

declare i32 @getaddrinfo(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #5

; Function Attrs: nounwind
declare void @freeaddrinfo(ptr noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local i32 @bsd_create_udp_socket(ptr noundef %0, i32 noundef %1) #2 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca %struct.addrinfo, align 8
  %7 = alloca ptr, align 8
  %8 = alloca [16 x i8], align 16
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca %union.__CONST_SOCKADDR_ARG, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 48, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  call void @llvm.memset.p0.i64(ptr align 8 %6, i8 0, i64 48, i1 false)
  %18 = getelementptr inbounds %struct.addrinfo, ptr %6, i32 0, i32 0
  store i32 1, ptr %18, align 8, !tbaa !11
  %19 = getelementptr inbounds %struct.addrinfo, ptr %6, i32 0, i32 1
  store i32 0, ptr %19, align 4, !tbaa !13
  %20 = getelementptr inbounds %struct.addrinfo, ptr %6, i32 0, i32 2
  store i32 2, ptr %20, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #6
  %21 = getelementptr inbounds [16 x i8], ptr %8, i64 0, i64 0
  %22 = load i32, ptr %5, align 4, !tbaa !9
  %23 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %21, i64 noundef 16, ptr noundef @.str, i32 noundef %22) #6
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds [16 x i8], ptr %8, i64 0, i64 0
  %26 = call i32 @getaddrinfo(ptr noundef %24, ptr noundef %25, ptr noundef %6, ptr noundef %7)
  %27 = icmp ne i32 %26, 0
  br i1 %27, label %28, label %29

28:                                               ; preds = %2
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %164

29:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 -1, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %30 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %30, ptr %12, align 8, !tbaa !5
  br label %31

31:                                               ; preds = %58, %29
  %32 = load ptr, ptr %12, align 8, !tbaa !5
  %33 = icmp ne ptr %32, null
  br i1 %33, label %34, label %37

34:                                               ; preds = %31
  %35 = load i32, ptr %10, align 4, !tbaa !9
  %36 = icmp eq i32 %35, -1
  br label %37

37:                                               ; preds = %34, %31
  %38 = phi i1 [ false, %31 ], [ %36, %34 ]
  br i1 %38, label %40, label %39

39:                                               ; preds = %37
  store i32 2, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  br label %62

40:                                               ; preds = %37
  %41 = load ptr, ptr %12, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.addrinfo, ptr %41, i32 0, i32 1
  %43 = load i32, ptr %42, align 4, !tbaa !13
  %44 = icmp eq i32 %43, 10
  br i1 %44, label %45, label %57

45:                                               ; preds = %40
  %46 = load ptr, ptr %12, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.addrinfo, ptr %46, i32 0, i32 1
  %48 = load i32, ptr %47, align 4, !tbaa !13
  %49 = load ptr, ptr %12, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.addrinfo, ptr %49, i32 0, i32 2
  %51 = load i32, ptr %50, align 8, !tbaa !14
  %52 = load ptr, ptr %12, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.addrinfo, ptr %52, i32 0, i32 3
  %54 = load i32, ptr %53, align 4, !tbaa !15
  %55 = call i32 @bsd_create_socket(i32 noundef %48, i32 noundef %51, i32 noundef %54)
  store i32 %55, ptr %10, align 4, !tbaa !9
  %56 = load ptr, ptr %12, align 8, !tbaa !5
  store ptr %56, ptr %11, align 8, !tbaa !5
  br label %57

57:                                               ; preds = %45, %40
  br label %58

58:                                               ; preds = %57
  %59 = load ptr, ptr %12, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.addrinfo, ptr %59, i32 0, i32 7
  %61 = load ptr, ptr %60, align 8, !tbaa !16
  store ptr %61, ptr %12, align 8, !tbaa !5
  br label %31, !llvm.loop !17

62:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %63 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %63, ptr %13, align 8, !tbaa !5
  br label %64

64:                                               ; preds = %91, %62
  %65 = load ptr, ptr %13, align 8, !tbaa !5
  %66 = icmp ne ptr %65, null
  br i1 %66, label %67, label %70

67:                                               ; preds = %64
  %68 = load i32, ptr %10, align 4, !tbaa !9
  %69 = icmp eq i32 %68, -1
  br label %70

70:                                               ; preds = %67, %64
  %71 = phi i1 [ false, %64 ], [ %69, %67 ]
  br i1 %71, label %73, label %72

72:                                               ; preds = %70
  store i32 5, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  br label %95

73:                                               ; preds = %70
  %74 = load ptr, ptr %13, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.addrinfo, ptr %74, i32 0, i32 1
  %76 = load i32, ptr %75, align 4, !tbaa !13
  %77 = icmp eq i32 %76, 2
  br i1 %77, label %78, label %90

78:                                               ; preds = %73
  %79 = load ptr, ptr %13, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.addrinfo, ptr %79, i32 0, i32 1
  %81 = load i32, ptr %80, align 4, !tbaa !13
  %82 = load ptr, ptr %13, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.addrinfo, ptr %82, i32 0, i32 2
  %84 = load i32, ptr %83, align 8, !tbaa !14
  %85 = load ptr, ptr %13, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.addrinfo, ptr %85, i32 0, i32 3
  %87 = load i32, ptr %86, align 4, !tbaa !15
  %88 = call i32 @bsd_create_socket(i32 noundef %81, i32 noundef %84, i32 noundef %87)
  store i32 %88, ptr %10, align 4, !tbaa !9
  %89 = load ptr, ptr %13, align 8, !tbaa !5
  store ptr %89, ptr %11, align 8, !tbaa !5
  br label %90

90:                                               ; preds = %78, %73
  br label %91

91:                                               ; preds = %90
  %92 = load ptr, ptr %13, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.addrinfo, ptr %92, i32 0, i32 7
  %94 = load ptr, ptr %93, align 8, !tbaa !16
  store ptr %94, ptr %13, align 8, !tbaa !5
  br label %64, !llvm.loop !19

95:                                               ; preds = %72
  %96 = load i32, ptr %10, align 4, !tbaa !9
  %97 = icmp eq i32 %96, -1
  br i1 %97, label %98, label %100

98:                                               ; preds = %95
  %99 = load ptr, ptr %7, align 8, !tbaa !5
  call void @freeaddrinfo(ptr noundef %99) #6
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %163

100:                                              ; preds = %95
  %101 = load i32, ptr %5, align 4, !tbaa !9
  %102 = icmp ne i32 %101, 0
  br i1 %102, label %103, label %106

103:                                              ; preds = %100
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 1, ptr %14, align 4, !tbaa !9
  %104 = load i32, ptr %10, align 4, !tbaa !9
  %105 = call i32 @setsockopt(i32 noundef %104, i32 noundef 1, i32 noundef 2, ptr noundef %14, i32 noundef 4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %106

106:                                              ; preds = %103, %100
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  store i32 0, ptr %15, align 4, !tbaa !9
  %107 = load i32, ptr %10, align 4, !tbaa !9
  %108 = call i32 @setsockopt(i32 noundef %107, i32 noundef 41, i32 noundef 26, ptr noundef %15, i32 noundef 4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  store i32 1, ptr %16, align 4, !tbaa !9
  %109 = load i32, ptr %10, align 4, !tbaa !9
  %110 = call i32 @setsockopt(i32 noundef %109, i32 noundef 41, i32 noundef 49, ptr noundef %16, i32 noundef 4) #6
  %111 = icmp eq i32 %110, -1
  br i1 %111, label %112, label %126

112:                                              ; preds = %106
  %113 = call ptr @__errno_location() #7
  %114 = load i32, ptr %113, align 4, !tbaa !9
  %115 = icmp eq i32 %114, 92
  br i1 %115, label %116, label %123

116:                                              ; preds = %112
  %117 = load i32, ptr %10, align 4, !tbaa !9
  %118 = call i32 @setsockopt(i32 noundef %117, i32 noundef 0, i32 noundef 8, ptr noundef %16, i32 noundef 4) #6
  %119 = icmp ne i32 %118, 0
  br i1 %119, label %120, label %122

120:                                              ; preds = %116
  %121 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  br label %122

122:                                              ; preds = %120, %116
  br label %125

123:                                              ; preds = %112
  %124 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  br label %125

125:                                              ; preds = %123, %122
  br label %126

126:                                              ; preds = %125, %106
  %127 = load i32, ptr %10, align 4, !tbaa !9
  %128 = call i32 @setsockopt(i32 noundef %127, i32 noundef 41, i32 noundef 66, ptr noundef %16, i32 noundef 4) #6
  %129 = icmp eq i32 %128, -1
  br i1 %129, label %130, label %144

130:                                              ; preds = %126
  %131 = call ptr @__errno_location() #7
  %132 = load i32, ptr %131, align 4, !tbaa !9
  %133 = icmp eq i32 %132, 92
  br i1 %133, label %134, label %141

134:                                              ; preds = %130
  %135 = load i32, ptr %10, align 4, !tbaa !9
  %136 = call i32 @setsockopt(i32 noundef %135, i32 noundef 0, i32 noundef 13, ptr noundef %16, i32 noundef 4) #6
  %137 = icmp ne i32 %136, 0
  br i1 %137, label %138, label %140

138:                                              ; preds = %134
  %139 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  br label %140

140:                                              ; preds = %138, %134
  br label %143

141:                                              ; preds = %130
  %142 = call i32 (ptr, ...) @printf(ptr noundef @.str.4)
  br label %143

143:                                              ; preds = %141, %140
  br label %144

144:                                              ; preds = %143, %126
  %145 = load i32, ptr %10, align 4, !tbaa !9
  %146 = load ptr, ptr %11, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.addrinfo, ptr %146, i32 0, i32 5
  %148 = load ptr, ptr %147, align 8, !tbaa !20
  store ptr %148, ptr %17, align 8, !tbaa !21
  %149 = load ptr, ptr %11, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.addrinfo, ptr %149, i32 0, i32 4
  %151 = load i32, ptr %150, align 8, !tbaa !22
  %152 = getelementptr inbounds %union.__CONST_SOCKADDR_ARG, ptr %17, i32 0, i32 0
  %153 = load ptr, ptr %152, align 8
  %154 = call i32 @bind(i32 noundef %145, ptr %153, i32 noundef %151) #6
  %155 = icmp ne i32 %154, 0
  br i1 %155, label %156, label %159

156:                                              ; preds = %144
  %157 = load i32, ptr %10, align 4, !tbaa !9
  call void @bsd_close_socket(i32 noundef %157)
  %158 = load ptr, ptr %7, align 8, !tbaa !5
  call void @freeaddrinfo(ptr noundef %158) #6
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %162

159:                                              ; preds = %144
  %160 = load ptr, ptr %7, align 8, !tbaa !5
  call void @freeaddrinfo(ptr noundef %160) #6
  %161 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %161, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %162

162:                                              ; preds = %159, %156
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  br label %163

163:                                              ; preds = %162, %98
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %164

164:                                              ; preds = %163, %28
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %6) #6
  %165 = load i32, ptr %3, align 4
  ret i32 %165
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #3 = { nounwind willreturn memory(none) "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 = { "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 willreturn memory(none) }

!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, !10, i64 0}
!12 = !{!"addrinfo", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!13 = !{!12, !10, i64 4}
!14 = !{!12, !10, i64 8}
!15 = !{!12, !10, i64 12}
!16 = !{!12, !6, i64 40}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}
!20 = !{!12, !6, i64 24}
!21 = !{!7, !7, i64 0}
!22 = !{!12, !10, i64 16}


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

@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [25 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

; 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
declare i32 @setsockopt(i32 noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @bsd_create_socket(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local void @bsd_close_socket(i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__errno_location() local_unnamed_addr #3

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

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

declare i32 @getaddrinfo(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #6

; Function Attrs: nounwind
declare void @freeaddrinfo(ptr noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local i32 @bsd_create_udp_socket(ptr noundef %0, i32 noundef %1) local_unnamed_addr #2 {
  %3 = alloca %struct.addrinfo, align 8
  %4 = alloca ptr, align 8
  %5 = alloca [16 x i8], align 16
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %9 = getelementptr inbounds i8, ptr %3, i64 8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(48) %9, i8 0, i64 40, i1 false)
  store i32 1, ptr %3, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %3, i64 4
  store i32 0, ptr %10, align 4, !tbaa !11
  %11 = getelementptr inbounds i8, ptr %3, i64 8
  store i32 2, ptr %11, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #7
  %12 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %5, i64 noundef 16, ptr noundef nonnull @.str, i32 noundef %1) #7
  %13 = call i32 @getaddrinfo(ptr noundef %0, ptr noundef nonnull %5, ptr noundef nonnull %3, ptr noundef nonnull %4) #7
  %.not = icmp eq i32 %13, 0
  br i1 %.not, label %.preheader46, label %78

.preheader46:                                     ; preds = %2
  %.03247 = load ptr, ptr %4, align 8, !tbaa !13
  %.not58 = icmp eq ptr %.03247, null
  br i1 %.not58, label %._crit_edge.thread, label %.lr.ph

.preheader:                                       ; preds = %26
  %.03151.pre = load ptr, ptr %4, align 8, !tbaa !13
  %14 = icmp ne ptr %.03151.pre, null
  %15 = icmp eq i32 %.137, -1
  %16 = select i1 %14, i1 %15, i1 false
  br i1 %16, label %.lr.ph54, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader46, %26
  %.03249 = phi ptr [ %.032, %26 ], [ %.03247, %.preheader46 ]
  %.03348 = phi ptr [ %.134, %26 ], [ undef, %.preheader46 ]
  %17 = getelementptr inbounds i8, ptr %.03249, i64 4
  %18 = load i32, ptr %17, align 4, !tbaa !11
  %19 = icmp eq i32 %18, 10
  br i1 %19, label %20, label %26

20:                                               ; preds = %.lr.ph
  %21 = getelementptr inbounds i8, ptr %.03249, i64 8
  %22 = load i32, ptr %21, align 8, !tbaa !12
  %23 = getelementptr inbounds i8, ptr %.03249, i64 12
  %24 = load i32, ptr %23, align 4, !tbaa !14
  %25 = call i32 @bsd_create_socket(i32 noundef 10, i32 noundef %22, i32 noundef %24)
  br label %26

26:                                               ; preds = %.lr.ph, %20
  %.137 = phi i32 [ %25, %20 ], [ -1, %.lr.ph ]
  %.134 = phi ptr [ %.03249, %20 ], [ %.03348, %.lr.ph ]
  %27 = getelementptr inbounds i8, ptr %.03249, i64 40
  %.032 = load ptr, ptr %27, align 8, !tbaa !13
  %28 = icmp ne ptr %.032, null
  %29 = icmp eq i32 %.137, -1
  %30 = select i1 %28, i1 %29, i1 false
  br i1 %30, label %.lr.ph, label %.preheader, !llvm.loop !15

._crit_edge:                                      ; preds = %40, %.preheader
  %.238.lcssa = phi i32 [ %.137, %.preheader ], [ %.339, %40 ]
  %.235.lcssa = phi ptr [ %.134, %.preheader ], [ %.3, %40 ]
  %.lcssa = phi i1 [ %15, %.preheader ], [ %43, %40 ]
  br i1 %.lcssa, label %._crit_edge.thread, label %46

.lr.ph54:                                         ; preds = %.preheader, %40
  %.03153 = phi ptr [ %.031, %40 ], [ %.03151.pre, %.preheader ]
  %.23552 = phi ptr [ %.3, %40 ], [ %.134, %.preheader ]
  %31 = getelementptr inbounds i8, ptr %.03153, i64 4
  %32 = load i32, ptr %31, align 4, !tbaa !11
  %33 = icmp eq i32 %32, 2
  br i1 %33, label %34, label %40

34:                                               ; preds = %.lr.ph54
  %35 = getelementptr inbounds i8, ptr %.03153, i64 8
  %36 = load i32, ptr %35, align 8, !tbaa !12
  %37 = getelementptr inbounds i8, ptr %.03153, i64 12
  %38 = load i32, ptr %37, align 4, !tbaa !14
  %39 = call i32 @bsd_create_socket(i32 noundef 2, i32 noundef %36, i32 noundef %38)
  br label %40

40:                                               ; preds = %.lr.ph54, %34
  %.339 = phi i32 [ %39, %34 ], [ -1, %.lr.ph54 ]
  %.3 = phi ptr [ %.03153, %34 ], [ %.23552, %.lr.ph54 ]
  %41 = getelementptr inbounds i8, ptr %.03153, i64 40
  %.031 = load ptr, ptr %41, align 8, !tbaa !13
  %42 = icmp ne ptr %.031, null
  %43 = icmp eq i32 %.339, -1
  %44 = select i1 %42, i1 %43, i1 false
  br i1 %44, label %.lr.ph54, label %._crit_edge, !llvm.loop !17

._crit_edge.thread:                               ; preds = %.preheader46, %._crit_edge
  %45 = load ptr, ptr %4, align 8, !tbaa !13
  call void @freeaddrinfo(ptr noundef %45) #7
  br label %78

46:                                               ; preds = %._crit_edge
  %.not42 = icmp eq i32 %1, 0
  br i1 %.not42, label %49, label %47

47:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #7
  store i32 1, ptr %6, align 4, !tbaa !18
  %48 = call i32 @setsockopt(i32 noundef %.238.lcssa, i32 noundef 1, i32 noundef 2, ptr noundef nonnull %6, i32 noundef 4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  br label %49

49:                                               ; preds = %47, %46
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #7
  store i32 0, ptr %7, align 4, !tbaa !18
  %50 = call i32 @setsockopt(i32 noundef %.238.lcssa, i32 noundef 41, i32 noundef 26, ptr noundef nonnull %7, i32 noundef 4) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #7
  store i32 1, ptr %8, align 4, !tbaa !18
  %51 = call i32 @setsockopt(i32 noundef %.238.lcssa, i32 noundef 41, i32 noundef 49, ptr noundef nonnull %8, i32 noundef 4) #7
  %52 = icmp eq i32 %51, -1
  br i1 %52, label %53, label %60

53:                                               ; preds = %49
  %54 = tail call ptr @__errno_location() #8
  %55 = load i32, ptr %54, align 4, !tbaa !18
  %56 = icmp eq i32 %55, 92
  br i1 %56, label %57, label %.sink.split

57:                                               ; preds = %53
  %58 = call i32 @setsockopt(i32 noundef %.238.lcssa, i32 noundef 0, i32 noundef 8, ptr noundef nonnull %8, i32 noundef 4) #7
  %.not43 = icmp eq i32 %58, 0
  br i1 %.not43, label %60, label %.sink.split

.sink.split:                                      ; preds = %53, %57
  %.str.2.sink = phi ptr [ @.str.1, %57 ], [ @.str.2, %53 ]
  %59 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
  br label %60

60:                                               ; preds = %.sink.split, %57, %49
  %61 = call i32 @setsockopt(i32 noundef %.238.lcssa, i32 noundef 41, i32 noundef 66, ptr noundef nonnull %8, i32 noundef 4) #7
  %62 = icmp eq i32 %61, -1
  br i1 %62, label %63, label %70

63:                                               ; preds = %60
  %64 = tail call ptr @__errno_location() #8
  %65 = load i32, ptr %64, align 4, !tbaa !18
  %66 = icmp eq i32 %65, 92
  br i1 %66, label %67, label %.sink.split68

67:                                               ; preds = %63
  %68 = call i32 @setsockopt(i32 noundef %.238.lcssa, i32 noundef 0, i32 noundef 13, ptr noundef nonnull %8, i32 noundef 4) #7
  %.not44 = icmp eq i32 %68, 0
  br i1 %.not44, label %70, label %.sink.split68

.sink.split68:                                    ; preds = %63, %67
  %.str.4.sink = phi ptr [ @.str.3, %67 ], [ @.str.4, %63 ]
  %69 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.4.sink)
  br label %70

70:                                               ; preds = %.sink.split68, %67, %60
  %71 = getelementptr inbounds i8, ptr %.235.lcssa, i64 24
  %72 = load ptr, ptr %71, align 8, !tbaa !19
  %73 = getelementptr inbounds i8, ptr %.235.lcssa, i64 16
  %74 = load i32, ptr %73, align 8, !tbaa !20
  %75 = call i32 @bind(i32 noundef %.238.lcssa, ptr %72, i32 noundef %74) #7
  %.not45 = icmp eq i32 %75, 0
  br i1 %.not45, label %77, label %76

76:                                               ; preds = %70
  call void @bsd_close_socket(i32 noundef %.238.lcssa)
  br label %77

77:                                               ; preds = %70, %76
  %.0 = phi i32 [ -1, %76 ], [ %.238.lcssa, %70 ]
  %.sink = load ptr, ptr %4, align 8, !tbaa !13
  call void @freeaddrinfo(ptr noundef %.sink) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #7
  br label %78

78:                                               ; preds = %._crit_edge.thread, %77, %2
  %.2 = phi i32 [ -1, %2 ], [ -1, %._crit_edge.thread ], [ %.0, %77 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %3) #7
  ret i32 %.2
}

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #3 = { mustprogress nofree nosync nounwind willreturn memory(none) "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 nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { "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 #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(none) }

!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 = !{!"addrinfo", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !10, i64 24, !10, i64 32, !10, i64 40}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !7, i64 4}
!12 = !{!6, !7, i64 8}
!13 = !{!10, !10, i64 0}
!14 = !{!6, !7, i64 12}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = !{!7, !7, i64 0}
!19 = !{!6, !10, i64 24}
!20 = !{!6, !7, i64 16}


; Effective O3 passes: DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass