; 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

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

30:                                               ; preds = %3
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %141

31:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 -1, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %32 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %32, ptr %14, align 8, !tbaa !5
  br label %33

33:                                               ; preds = %60, %31
  %34 = load ptr, ptr %14, align 8, !tbaa !5
  %35 = icmp ne ptr %34, null
  br i1 %35, label %36, label %39

36:                                               ; preds = %33
  %37 = load i32, ptr %12, align 4, !tbaa !9
  %38 = icmp eq i32 %37, -1
  br label %39

39:                                               ; preds = %36, %33
  %40 = phi i1 [ false, %33 ], [ %38, %36 ]
  br i1 %40, label %42, label %41

41:                                               ; preds = %39
  store i32 2, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  br label %64

42:                                               ; preds = %39
  %43 = load ptr, ptr %14, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.addrinfo, ptr %43, i32 0, i32 1
  %45 = load i32, ptr %44, align 4, !tbaa !13
  %46 = icmp eq i32 %45, 10
  br i1 %46, label %47, label %59

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

59:                                               ; preds = %47, %42
  br label %60

60:                                               ; preds = %59
  %61 = load ptr, ptr %14, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.addrinfo, ptr %61, i32 0, i32 7
  %63 = load ptr, ptr %62, align 8, !tbaa !16
  store ptr %63, ptr %14, align 8, !tbaa !5
  br label %33, !llvm.loop !17

64:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %65 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %65, ptr %15, align 8, !tbaa !5
  br label %66

66:                                               ; preds = %93, %64
  %67 = load ptr, ptr %15, align 8, !tbaa !5
  %68 = icmp ne ptr %67, null
  br i1 %68, label %69, label %72

69:                                               ; preds = %66
  %70 = load i32, ptr %12, align 4, !tbaa !9
  %71 = icmp eq i32 %70, -1
  br label %72

72:                                               ; preds = %69, %66
  %73 = phi i1 [ false, %66 ], [ %71, %69 ]
  br i1 %73, label %75, label %74

74:                                               ; preds = %72
  store i32 5, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  br label %97

75:                                               ; preds = %72
  %76 = load ptr, ptr %15, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.addrinfo, ptr %76, i32 0, i32 1
  %78 = load i32, ptr %77, align 4, !tbaa !13
  %79 = icmp eq i32 %78, 2
  br i1 %79, label %80, label %92

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

92:                                               ; preds = %80, %75
  br label %93

93:                                               ; preds = %92
  %94 = load ptr, ptr %15, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.addrinfo, ptr %94, i32 0, i32 7
  %96 = load ptr, ptr %95, align 8, !tbaa !16
  store ptr %96, ptr %15, align 8, !tbaa !5
  br label %66, !llvm.loop !19

97:                                               ; preds = %74
  %98 = load i32, ptr %12, align 4, !tbaa !9
  %99 = icmp eq i32 %98, -1
  br i1 %99, label %100, label %102

100:                                              ; preds = %97
  %101 = load ptr, ptr %9, align 8, !tbaa !5
  call void @freeaddrinfo(ptr noundef %101) #5
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %140

102:                                              ; preds = %97
  %103 = load i32, ptr %6, align 4, !tbaa !9
  %104 = icmp ne i32 %103, 0
  br i1 %104, label %105, label %115

105:                                              ; preds = %102
  %106 = load i32, ptr %7, align 4, !tbaa !9
  %107 = and i32 %106, 1
  %108 = icmp ne i32 %107, 0
  br i1 %108, label %112, label %109

109:                                              ; preds = %105
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  store i32 1, ptr %16, align 4, !tbaa !9
  %110 = load i32, ptr %12, align 4, !tbaa !9
  %111 = call i32 @setsockopt(i32 noundef %110, i32 noundef 1, i32 noundef 15, ptr noundef %16, i32 noundef 4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  br label %112

112:                                              ; preds = %109, %105
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  store i32 1, ptr %17, align 4, !tbaa !9
  %113 = load i32, ptr %12, align 4, !tbaa !9
  %114 = call i32 @setsockopt(i32 noundef %113, i32 noundef 1, i32 noundef 2, ptr noundef %17, i32 noundef 4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %115

115:                                              ; preds = %112, %102
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  store i32 0, ptr %18, align 4, !tbaa !9
  %116 = load i32, ptr %12, align 4, !tbaa !9
  %117 = call i32 @setsockopt(i32 noundef %116, i32 noundef 41, i32 noundef 26, ptr noundef %18, i32 noundef 4) #5
  %118 = load i32, ptr %12, align 4, !tbaa !9
  %119 = load ptr, ptr %13, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.addrinfo, ptr %119, i32 0, i32 5
  %121 = load ptr, ptr %120, align 8, !tbaa !20
  store ptr %121, ptr %19, align 8, !tbaa !21
  %122 = load ptr, ptr %13, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.addrinfo, ptr %122, i32 0, i32 4
  %124 = load i32, ptr %123, align 8, !tbaa !22
  %125 = getelementptr inbounds %union.__CONST_SOCKADDR_ARG, ptr %19, i32 0, i32 0
  %126 = load ptr, ptr %125, align 8
  %127 = call i32 @bind(i32 noundef %118, ptr %126, i32 noundef %124) #5
  %128 = icmp ne i32 %127, 0
  br i1 %128, label %133, label %129

129:                                              ; preds = %115
  %130 = load i32, ptr %12, align 4, !tbaa !9
  %131 = call i32 @listen(i32 noundef %130, i32 noundef 512) #5
  %132 = icmp ne i32 %131, 0
  br i1 %132, label %133, label %136

133:                                              ; preds = %129, %115
  %134 = load i32, ptr %12, align 4, !tbaa !9
  call void @bsd_close_socket(i32 noundef %134)
  %135 = load ptr, ptr %9, align 8, !tbaa !5
  call void @freeaddrinfo(ptr noundef %135) #5
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %139

136:                                              ; preds = %129
  %137 = load ptr, ptr %9, align 8, !tbaa !5
  call void @freeaddrinfo(ptr noundef %137) #5
  %138 = load i32, ptr %12, align 4, !tbaa !9
  store i32 %138, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %139

139:                                              ; preds = %136, %133
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  br label %140

140:                                              ; preds = %139, %100
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %141

141:                                              ; preds = %140, %30
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr %8) #5
  %142 = load i32, ptr %4, align 4
  ret i32 %142
}

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

; Function Attrs: nounwind
declare i32 @snprintf(ptr noundef, i64 noundef, ptr noundef, ...) #1

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

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

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

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

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

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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

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

.preheader45:                                     ; preds = %3
  %.03146 = load ptr, ptr %5, align 8, !tbaa !13
  %.not57 = icmp eq ptr %.03146, null
  br i1 %.not57, label %._crit_edge.thread, label %.lr.ph

.preheader:                                       ; preds = %27
  %.03050.pre = load ptr, ptr %5, align 8, !tbaa !13
  %15 = icmp ne ptr %.03050.pre, null
  %16 = icmp eq i32 %.136, -1
  %17 = select i1 %15, i1 %16, i1 false
  br i1 %17, label %.lr.ph53, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader45, %27
  %.03148 = phi ptr [ %.031, %27 ], [ %.03146, %.preheader45 ]
  %.03247 = phi ptr [ %.133, %27 ], [ undef, %.preheader45 ]
  %18 = getelementptr inbounds i8, ptr %.03148, i64 4
  %19 = load i32, ptr %18, align 4, !tbaa !11
  %20 = icmp eq i32 %19, 10
  br i1 %20, label %21, label %27

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

27:                                               ; preds = %.lr.ph, %21
  %.136 = phi i32 [ %26, %21 ], [ -1, %.lr.ph ]
  %.133 = phi ptr [ %.03148, %21 ], [ %.03247, %.lr.ph ]
  %28 = getelementptr inbounds i8, ptr %.03148, i64 40
  %.031 = load ptr, ptr %28, align 8, !tbaa !13
  %29 = icmp ne ptr %.031, null
  %30 = icmp eq i32 %.136, -1
  %31 = select i1 %29, i1 %30, i1 false
  br i1 %31, label %.lr.ph, label %.preheader, !llvm.loop !15

._crit_edge:                                      ; preds = %41, %.preheader
  %.237.lcssa = phi i32 [ %.136, %.preheader ], [ %.338, %41 ]
  %.234.lcssa = phi ptr [ %.133, %.preheader ], [ %.3, %41 ]
  %.lcssa = phi i1 [ %16, %.preheader ], [ %44, %41 ]
  br i1 %.lcssa, label %._crit_edge.thread, label %47

.lr.ph53:                                         ; preds = %.preheader, %41
  %.03052 = phi ptr [ %.030, %41 ], [ %.03050.pre, %.preheader ]
  %.23451 = phi ptr [ %.3, %41 ], [ %.133, %.preheader ]
  %32 = getelementptr inbounds i8, ptr %.03052, i64 4
  %33 = load i32, ptr %32, align 4, !tbaa !11
  %34 = icmp eq i32 %33, 2
  br i1 %34, label %35, label %41

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

41:                                               ; preds = %.lr.ph53, %35
  %.338 = phi i32 [ %40, %35 ], [ -1, %.lr.ph53 ]
  %.3 = phi ptr [ %.03052, %35 ], [ %.23451, %.lr.ph53 ]
  %42 = getelementptr inbounds i8, ptr %.03052, i64 40
  %.030 = load ptr, ptr %42, align 8, !tbaa !13
  %43 = icmp ne ptr %.030, null
  %44 = icmp eq i32 %.338, -1
  %45 = select i1 %43, i1 %44, i1 false
  br i1 %45, label %.lr.ph53, label %._crit_edge, !llvm.loop !17

._crit_edge.thread:                               ; preds = %.preheader45, %._crit_edge
  %46 = load ptr, ptr %5, align 8, !tbaa !13
  call void @freeaddrinfo(ptr noundef %46) #6
  br label %65

47:                                               ; preds = %._crit_edge
  %.not41 = icmp eq i32 %1, 0
  br i1 %.not41, label %54, label %48

48:                                               ; preds = %47
  %49 = and i32 %2, 1
  %.not42 = icmp eq i32 %49, 0
  br i1 %.not42, label %50, label %52

50:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #6
  store i32 1, ptr %7, align 4, !tbaa !18
  %51 = call i32 @setsockopt(i32 noundef %.237.lcssa, i32 noundef 1, i32 noundef 15, ptr noundef nonnull %7, i32 noundef 4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #6
  br label %52

52:                                               ; preds = %50, %48
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #6
  store i32 1, ptr %8, align 4, !tbaa !18
  %53 = call i32 @setsockopt(i32 noundef %.237.lcssa, i32 noundef 1, i32 noundef 2, ptr noundef nonnull %8, i32 noundef 4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #6
  br label %54

54:                                               ; preds = %52, %47
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #6
  store i32 0, ptr %9, align 4, !tbaa !18
  %55 = call i32 @setsockopt(i32 noundef %.237.lcssa, i32 noundef 41, i32 noundef 26, ptr noundef nonnull %9, i32 noundef 4) #6
  %56 = getelementptr inbounds i8, ptr %.234.lcssa, i64 24
  %57 = load ptr, ptr %56, align 8, !tbaa !19
  %58 = getelementptr inbounds i8, ptr %.234.lcssa, i64 16
  %59 = load i32, ptr %58, align 8, !tbaa !20
  %60 = call i32 @bind(i32 noundef %.237.lcssa, ptr %57, i32 noundef %59) #6
  %.not43 = icmp eq i32 %60, 0
  br i1 %.not43, label %61, label %63

61:                                               ; preds = %54
  %62 = call i32 @listen(i32 noundef %.237.lcssa, i32 noundef 512) #6
  %.not44 = icmp eq i32 %62, 0
  br i1 %.not44, label %64, label %63

63:                                               ; preds = %61, %54
  call void @bsd_close_socket(i32 noundef %.237.lcssa)
  br label %64

64:                                               ; preds = %61, %63
  %.0 = phi i32 [ -1, %63 ], [ %.237.lcssa, %61 ]
  %.sink = load ptr, ptr %5, align 8, !tbaa !13
  call void @freeaddrinfo(ptr noundef %.sink) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #6
  br label %65

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

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

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

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

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

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 nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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 #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 }

!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