; LLVM IR from tleonhardt/practical_cryptography_engineering :: mbedtls (net_sockets)

; 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 }
%struct.mbedtls_net_context = type { i32 }

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

; Function Attrs: nounwind uwtable
declare hidden i32 @net_prepare() #1

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

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

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

declare i32 @close(i32 noundef) #3

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @mbedtls_net_bind(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3) #1 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %struct.addrinfo, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store i32 %3, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 48, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %16 = call i32 @net_prepare()
  store i32 %16, ptr %11, align 4, !tbaa !9
  %17 = icmp ne i32 %16, 0
  br i1 %17, label %18, label %20

18:                                               ; preds = %4
  %19 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %19, ptr %5, align 4
  store i32 1, ptr %15, align 4
  br label %116

20:                                               ; preds = %4
  call void @llvm.memset.p0.i64(ptr align 8 %12, i8 0, i64 48, i1 false)
  %21 = getelementptr inbounds %struct.addrinfo, ptr %12, i32 0, i32 1
  store i32 0, ptr %21, align 4, !tbaa !11
  %22 = load i32, ptr %9, align 4, !tbaa !9
  %23 = icmp eq i32 %22, 1
  %24 = zext i1 %23 to i64
  %25 = select i1 %23, i32 2, i32 1
  %26 = getelementptr inbounds %struct.addrinfo, ptr %12, i32 0, i32 2
  store i32 %25, ptr %26, align 8, !tbaa !13
  %27 = load i32, ptr %9, align 4, !tbaa !9
  %28 = icmp eq i32 %27, 1
  %29 = zext i1 %28 to i64
  %30 = select i1 %28, i32 17, i32 6
  %31 = getelementptr inbounds %struct.addrinfo, ptr %12, i32 0, i32 3
  store i32 %30, ptr %31, align 4, !tbaa !14
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = icmp eq ptr %32, null
  br i1 %33, label %34, label %36

34:                                               ; preds = %20
  %35 = getelementptr inbounds %struct.addrinfo, ptr %12, i32 0, i32 0
  store i32 1, ptr %35, align 8, !tbaa !15
  br label %36

36:                                               ; preds = %34, %20
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = load ptr, ptr %8, align 8, !tbaa !5
  %39 = call i32 @getaddrinfo(ptr noundef %37, ptr noundef %38, ptr noundef %12, ptr noundef %13)
  %40 = icmp ne i32 %39, 0
  br i1 %40, label %41, label %42

41:                                               ; preds = %36
  store i32 -82, ptr %5, align 4
  store i32 1, ptr %15, align 4
  br label %116

42:                                               ; preds = %36
  store i32 -82, ptr %11, align 4, !tbaa !9
  %43 = load ptr, ptr %13, align 8, !tbaa !5
  store ptr %43, ptr %14, align 8, !tbaa !5
  br label %44

44:                                               ; preds = %109, %42
  %45 = load ptr, ptr %14, align 8, !tbaa !5
  %46 = icmp ne ptr %45, null
  br i1 %46, label %47, label %113

47:                                               ; preds = %44
  %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 !11
  %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 !13
  %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 !14
  %57 = call i32 @socket(i32 noundef %50, i32 noundef %53, i32 noundef %56) #5
  %58 = load ptr, ptr %6, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.mbedtls_net_context, ptr %58, i32 0, i32 0
  store i32 %57, ptr %59, align 4, !tbaa !16
  %60 = load ptr, ptr %6, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.mbedtls_net_context, ptr %60, i32 0, i32 0
  %62 = load i32, ptr %61, align 4, !tbaa !16
  %63 = icmp slt i32 %62, 0
  br i1 %63, label %64, label %65

64:                                               ; preds = %47
  store i32 -66, ptr %11, align 4, !tbaa !9
  br label %109

65:                                               ; preds = %47
  store i32 1, ptr %10, align 4, !tbaa !9
  %66 = load ptr, ptr %6, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.mbedtls_net_context, ptr %66, i32 0, i32 0
  %68 = load i32, ptr %67, align 4, !tbaa !16
  %69 = call i32 @setsockopt(i32 noundef %68, i32 noundef 1, i32 noundef 2, ptr noundef %10, i32 noundef 4) #5
  %70 = icmp ne i32 %69, 0
  br i1 %70, label %71, label %76

71:                                               ; preds = %65
  %72 = load ptr, ptr %6, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.mbedtls_net_context, ptr %72, i32 0, i32 0
  %74 = load i32, ptr %73, align 4, !tbaa !16
  %75 = call i32 @close(i32 noundef %74)
  store i32 -66, ptr %11, align 4, !tbaa !9
  br label %109

76:                                               ; preds = %65
  %77 = load ptr, ptr %6, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.mbedtls_net_context, ptr %77, i32 0, i32 0
  %79 = load i32, ptr %78, align 4, !tbaa !16
  %80 = load ptr, ptr %14, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.addrinfo, ptr %80, i32 0, i32 5
  %82 = load ptr, ptr %81, align 8, !tbaa !18
  %83 = load ptr, ptr %14, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.addrinfo, ptr %83, i32 0, i32 4
  %85 = load i32, ptr %84, align 8, !tbaa !19
  %86 = call i32 @bind(i32 noundef %79, ptr noundef %82, i32 noundef %85) #5
  %87 = icmp ne i32 %86, 0
  br i1 %87, label %88, label %93

88:                                               ; preds = %76
  %89 = load ptr, ptr %6, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.mbedtls_net_context, ptr %89, i32 0, i32 0
  %91 = load i32, ptr %90, align 4, !tbaa !16
  %92 = call i32 @close(i32 noundef %91)
  store i32 -70, ptr %11, align 4, !tbaa !9
  br label %109

93:                                               ; preds = %76
  %94 = load i32, ptr %9, align 4, !tbaa !9
  %95 = icmp eq i32 %94, 0
  br i1 %95, label %96, label %108

96:                                               ; preds = %93
  %97 = load ptr, ptr %6, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.mbedtls_net_context, ptr %97, i32 0, i32 0
  %99 = load i32, ptr %98, align 4, !tbaa !16
  %100 = call i32 @listen(i32 noundef %99, i32 noundef 10) #5
  %101 = icmp ne i32 %100, 0
  br i1 %101, label %102, label %107

102:                                              ; preds = %96
  %103 = load ptr, ptr %6, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.mbedtls_net_context, ptr %103, i32 0, i32 0
  %105 = load i32, ptr %104, align 4, !tbaa !16
  %106 = call i32 @close(i32 noundef %105)
  store i32 -72, ptr %11, align 4, !tbaa !9
  br label %109

107:                                              ; preds = %96
  br label %108

108:                                              ; preds = %107, %93
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %113

109:                                              ; preds = %102, %88, %71, %64
  %110 = load ptr, ptr %14, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.addrinfo, ptr %110, i32 0, i32 7
  %112 = load ptr, ptr %111, align 8, !tbaa !20
  store ptr %112, ptr %14, align 8, !tbaa !5
  br label %44, !llvm.loop !21

113:                                              ; preds = %108, %44
  %114 = load ptr, ptr %13, align 8, !tbaa !5
  call void @freeaddrinfo(ptr noundef %114) #5
  %115 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %115, ptr %5, align 4
  store i32 1, ptr %15, align 4
  br label %116

116:                                              ; preds = %113, %41, %18
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  %117 = load i32, ptr %5, align 4
  ret i32 %117
}

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

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { 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 = { 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 4}
!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 8}
!14 = !{!12, !10, i64 12}
!15 = !{!12, !10, i64 0}
!16 = !{!17, !10, i64 0}
!17 = !{!"", !10, i64 0}
!18 = !{!12, !6, i64 24}
!19 = !{!12, !10, i64 16}
!20 = !{!12, !6, i64 40}
!21 = distinct !{!21, !22}
!22 = !{!"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.addrinfo = type { i32, i32, i32, i32, i32, ptr, ptr, ptr }

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

; Function Attrs: nounwind uwtable
declare hidden i32 @net_prepare() local_unnamed_addr #1

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

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

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

declare i32 @close(i32 noundef) local_unnamed_addr #3

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @mbedtls_net_bind(ptr nocapture noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3) local_unnamed_addr #1 {
  %5 = alloca i32, align 4
  %6 = alloca %struct.addrinfo, align 8
  %7 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %6) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  %8 = tail call i32 @net_prepare()
  %.not = icmp eq i32 %8, 0
  br i1 %.not, label %9, label %68

9:                                                ; preds = %4
  %10 = icmp eq i32 %3, 1
  %11 = select i1 %10, i32 2, i32 1
  %12 = getelementptr inbounds i8, ptr %6, i64 8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(48) %6, i8 0, i64 48, i1 false)
  store i32 %11, ptr %12, align 8, !tbaa !5
  %13 = select i1 %10, i32 17, i32 6
  %14 = getelementptr inbounds i8, ptr %6, i64 12
  store i32 %13, ptr %14, align 4, !tbaa !11
  %15 = icmp eq ptr %1, null
  br i1 %15, label %16, label %17

16:                                               ; preds = %9
  store i32 1, ptr %6, align 8, !tbaa !12
  br label %17

17:                                               ; preds = %16, %9
  %18 = call i32 @getaddrinfo(ptr noundef %1, ptr noundef %2, ptr noundef nonnull %6, ptr noundef nonnull %7) #5
  %.not26 = icmp eq i32 %18, 0
  br i1 %.not26, label %.preheader, label %68

.preheader:                                       ; preds = %17
  %.031 = load ptr, ptr %7, align 8, !tbaa !13
  %.not2732 = icmp eq ptr %.031, null
  br i1 %.not2732, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader
  %19 = icmp eq i32 %3, 0
  br i1 %19, label %.lr.ph.split.us, label %.lr.ph.split

.lr.ph.split.us:                                  ; preds = %.lr.ph, %43
  %.033.us = phi ptr [ %.0.us, %43 ], [ %.031, %.lr.ph ]
  %20 = getelementptr inbounds i8, ptr %.033.us, i64 4
  %21 = load i32, ptr %20, align 4, !tbaa !14
  %22 = getelementptr inbounds i8, ptr %.033.us, i64 8
  %23 = load i32, ptr %22, align 8, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %.033.us, i64 12
  %25 = load i32, ptr %24, align 4, !tbaa !11
  %26 = call i32 @socket(i32 noundef %21, i32 noundef %23, i32 noundef %25) #5
  store i32 %26, ptr %0, align 4, !tbaa !15
  %27 = icmp slt i32 %26, 0
  br i1 %27, label %43, label %28

28:                                               ; preds = %.lr.ph.split.us
  store i32 1, ptr %5, align 4, !tbaa !17
  %29 = call i32 @setsockopt(i32 noundef %26, i32 noundef 1, i32 noundef 2, ptr noundef nonnull %5, i32 noundef 4) #5
  %.not28.us = icmp eq i32 %29, 0
  %30 = load i32, ptr %0, align 4, !tbaa !15
  br i1 %.not28.us, label %31, label %.sink.split

31:                                               ; preds = %28
  %32 = getelementptr inbounds i8, ptr %.033.us, i64 24
  %33 = load ptr, ptr %32, align 8, !tbaa !18
  %34 = getelementptr inbounds i8, ptr %.033.us, i64 16
  %35 = load i32, ptr %34, align 8, !tbaa !19
  %36 = call i32 @bind(i32 noundef %30, ptr noundef %33, i32 noundef %35) #5
  %.not29.us = icmp eq i32 %36, 0
  %37 = load i32, ptr %0, align 4, !tbaa !15
  br i1 %.not29.us, label %38, label %.sink.split

38:                                               ; preds = %31
  %39 = call i32 @listen(i32 noundef %37, i32 noundef 10) #5
  %.not30.us = icmp eq i32 %39, 0
  br i1 %.not30.us, label %._crit_edge, label %40

40:                                               ; preds = %38
  %41 = load i32, ptr %0, align 4, !tbaa !15
  br label %.sink.split

.sink.split:                                      ; preds = %31, %28, %40
  %.sink = phi i32 [ %41, %40 ], [ %30, %28 ], [ %37, %31 ]
  %.1.us.ph = phi i32 [ -72, %40 ], [ -66, %28 ], [ -70, %31 ]
  %42 = call i32 @close(i32 noundef %.sink) #5
  br label %43

43:                                               ; preds = %.sink.split, %.lr.ph.split.us
  %.1.us = phi i32 [ -66, %.lr.ph.split.us ], [ %.1.us.ph, %.sink.split ]
  %44 = getelementptr inbounds i8, ptr %.033.us, i64 40
  %.0.us = load ptr, ptr %44, align 8, !tbaa !13
  %.not27.us = icmp eq ptr %.0.us, null
  br i1 %.not27.us, label %._crit_edge, label %.lr.ph.split.us, !llvm.loop !20

.lr.ph.split:                                     ; preds = %.lr.ph, %65
  %.033 = phi ptr [ %.0, %65 ], [ %.031, %.lr.ph ]
  %45 = getelementptr inbounds i8, ptr %.033, i64 4
  %46 = load i32, ptr %45, align 4, !tbaa !14
  %47 = getelementptr inbounds i8, ptr %.033, i64 8
  %48 = load i32, ptr %47, align 8, !tbaa !5
  %49 = getelementptr inbounds i8, ptr %.033, i64 12
  %50 = load i32, ptr %49, align 4, !tbaa !11
  %51 = call i32 @socket(i32 noundef %46, i32 noundef %48, i32 noundef %50) #5
  store i32 %51, ptr %0, align 4, !tbaa !15
  %52 = icmp slt i32 %51, 0
  br i1 %52, label %65, label %53

53:                                               ; preds = %.lr.ph.split
  store i32 1, ptr %5, align 4, !tbaa !17
  %54 = call i32 @setsockopt(i32 noundef %51, i32 noundef 1, i32 noundef 2, ptr noundef nonnull %5, i32 noundef 4) #5
  %.not28 = icmp eq i32 %54, 0
  %55 = load i32, ptr %0, align 4, !tbaa !15
  br i1 %.not28, label %56, label %.sink.split43

56:                                               ; preds = %53
  %57 = getelementptr inbounds i8, ptr %.033, i64 24
  %58 = load ptr, ptr %57, align 8, !tbaa !18
  %59 = getelementptr inbounds i8, ptr %.033, i64 16
  %60 = load i32, ptr %59, align 8, !tbaa !19
  %61 = call i32 @bind(i32 noundef %55, ptr noundef %58, i32 noundef %60) #5
  %.not29 = icmp eq i32 %61, 0
  br i1 %.not29, label %._crit_edge, label %62

62:                                               ; preds = %56
  %63 = load i32, ptr %0, align 4, !tbaa !15
  br label %.sink.split43

.sink.split43:                                    ; preds = %53, %62
  %.sink44 = phi i32 [ %63, %62 ], [ %55, %53 ]
  %.1.ph = phi i32 [ -70, %62 ], [ -66, %53 ]
  %64 = call i32 @close(i32 noundef %.sink44) #5
  br label %65

65:                                               ; preds = %.sink.split43, %.lr.ph.split
  %.1 = phi i32 [ -66, %.lr.ph.split ], [ %.1.ph, %.sink.split43 ]
  %66 = getelementptr inbounds i8, ptr %.033, i64 40
  %.0 = load ptr, ptr %66, align 8, !tbaa !13
  %.not27 = icmp eq ptr %.0, null
  br i1 %.not27, label %._crit_edge, label %.lr.ph.split, !llvm.loop !20

._crit_edge:                                      ; preds = %65, %56, %43, %38, %.preheader
  %.2 = phi i32 [ -82, %.preheader ], [ 0, %38 ], [ %.1.us, %43 ], [ 0, %56 ], [ %.1, %65 ]
  %67 = load ptr, ptr %7, align 8, !tbaa !13
  call void @freeaddrinfo(ptr noundef %67) #5
  br label %68

68:                                               ; preds = %17, %4, %._crit_edge
  %.024 = phi i32 [ %.2, %._crit_edge ], [ %8, %4 ], [ -82, %17 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  ret i32 %.024
}

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

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { 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 = { 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 8}
!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 12}
!12 = !{!6, !7, i64 0}
!13 = !{!10, !10, i64 0}
!14 = !{!6, !7, i64 4}
!15 = !{!16, !7, i64 0}
!16 = !{!"", !7, i64 0}
!17 = !{!7, !7, i64 0}
!18 = !{!6, !10, i64 24}
!19 = !{!6, !7, i64 16}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass