; LLVM IR from SvrAdityaReddy/RTOS :: Assignment_4/sockets/sockets_client_server_bi_directional (client)

; 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 }

@sfd = external dso_local global i32, align 4
@.str.4 = external hidden unnamed_addr constant [56 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [29 x i8], align 1
@stdin = external global ptr, align 8
@.str.9 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [32 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @my_signal_handler(i32 noundef) #0

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

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

declare i32 @close(i32 noundef) #2

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #3

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

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

15:                                               ; preds = %2
  %16 = call i32 (ptr, ...) @printf(ptr noundef @.str.4)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %112

17:                                               ; preds = %2
  %18 = call ptr @signal(i32 noundef 2, ptr noundef @my_signal_handler) #7
  %19 = icmp eq ptr %18, inttoptr (i64 -1 to ptr)
  br i1 %19, label %20, label %22

20:                                               ; preds = %17
  %21 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %112

22:                                               ; preds = %17
  call void @llvm.memset.p0.i64(ptr align 8 %6, i8 0, i64 48, i1 false)
  %23 = getelementptr inbounds %struct.addrinfo, ptr %6, i32 0, i32 1
  store i32 0, ptr %23, align 4, !tbaa !11
  %24 = getelementptr inbounds %struct.addrinfo, ptr %6, i32 0, i32 2
  store i32 1, ptr %24, align 8, !tbaa !13
  %25 = load ptr, ptr %5, align 8, !tbaa !9
  %26 = getelementptr inbounds ptr, ptr %25, i64 1
  %27 = load ptr, ptr %26, align 8, !tbaa !9
  %28 = load ptr, ptr %5, align 8, !tbaa !9
  %29 = getelementptr inbounds ptr, ptr %28, i64 2
  %30 = load ptr, ptr %29, align 8, !tbaa !9
  %31 = call i32 @getaddrinfo(ptr noundef %27, ptr noundef %30, ptr noundef %6, ptr noundef %7)
  %32 = icmp ne i32 %31, 0
  br i1 %32, label %33, label %35

33:                                               ; preds = %22
  %34 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %112

35:                                               ; preds = %22
  %36 = load ptr, ptr %7, align 8, !tbaa !9
  store ptr %36, ptr %8, align 8, !tbaa !9
  br label %37

37:                                               ; preds = %69, %35
  %38 = load ptr, ptr %8, align 8, !tbaa !9
  %39 = icmp ne ptr %38, null
  br i1 %39, label %40, label %73

40:                                               ; preds = %37
  %41 = load ptr, ptr %8, align 8, !tbaa !9
  %42 = getelementptr inbounds %struct.addrinfo, ptr %41, i32 0, i32 1
  %43 = load i32, ptr %42, align 4, !tbaa !11
  %44 = load ptr, ptr %8, align 8, !tbaa !9
  %45 = getelementptr inbounds %struct.addrinfo, ptr %44, i32 0, i32 2
  %46 = load i32, ptr %45, align 8, !tbaa !13
  %47 = load ptr, ptr %8, align 8, !tbaa !9
  %48 = getelementptr inbounds %struct.addrinfo, ptr %47, i32 0, i32 3
  %49 = load i32, ptr %48, align 4, !tbaa !14
  %50 = call i32 @socket(i32 noundef %43, i32 noundef %46, i32 noundef %49) #7
  store i32 %50, ptr @sfd, align 4, !tbaa !5
  %51 = load i32, ptr @sfd, align 4, !tbaa !5
  %52 = icmp eq i32 %51, -1
  br i1 %52, label %53, label %55

53:                                               ; preds = %40
  %54 = call i32 (ptr, ...) @printf(ptr noundef @.str.7)
  br label %69

55:                                               ; preds = %40
  %56 = load i32, ptr @sfd, align 4, !tbaa !5
  %57 = load ptr, ptr %8, align 8, !tbaa !9
  %58 = getelementptr inbounds %struct.addrinfo, ptr %57, i32 0, i32 5
  %59 = load ptr, ptr %58, align 8, !tbaa !15
  %60 = load ptr, ptr %8, align 8, !tbaa !9
  %61 = getelementptr inbounds %struct.addrinfo, ptr %60, i32 0, i32 4
  %62 = load i32, ptr %61, align 8, !tbaa !16
  %63 = call i32 @connect(i32 noundef %56, ptr noundef %59, i32 noundef %62)
  %64 = icmp eq i32 %63, 0
  br i1 %64, label %65, label %66

65:                                               ; preds = %55
  br label %73

66:                                               ; preds = %55
  %67 = load i32, ptr @sfd, align 4, !tbaa !5
  %68 = call i32 @close(i32 noundef %67)
  br label %69

69:                                               ; preds = %66, %53
  %70 = load ptr, ptr %8, align 8, !tbaa !9
  %71 = getelementptr inbounds %struct.addrinfo, ptr %70, i32 0, i32 7
  %72 = load ptr, ptr %71, align 8, !tbaa !17
  store ptr %72, ptr %8, align 8, !tbaa !9
  br label %37, !llvm.loop !18

73:                                               ; preds = %65, %37
  %74 = load ptr, ptr %8, align 8, !tbaa !9
  %75 = icmp eq ptr %74, null
  br i1 %75, label %76, label %78

76:                                               ; preds = %73
  %77 = call i32 (ptr, ...) @printf(ptr noundef @.str.8)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %112

78:                                               ; preds = %73
  %79 = load ptr, ptr %7, align 8, !tbaa !9
  call void @freeaddrinfo(ptr noundef %79) #7
  %80 = call i32 @fork() #7
  %81 = icmp ne i32 %80, 0
  br i1 %81, label %99, label %82

82:                                               ; preds = %78
  br label %83

83:                                               ; preds = %97, %82
  %84 = getelementptr inbounds [50 x i8], ptr %9, i64 0, i64 0
  %85 = load ptr, ptr @stdin, align 8, !tbaa !9
  %86 = call ptr @fgets(ptr noundef %84, i32 noundef 50, ptr noundef %85)
  %87 = icmp ne ptr %86, null
  br i1 %87, label %88, label %98

88:                                               ; preds = %83
  %89 = load i32, ptr @sfd, align 4, !tbaa !5
  %90 = getelementptr inbounds [50 x i8], ptr %9, i64 0, i64 0
  %91 = getelementptr inbounds [50 x i8], ptr %9, i64 0, i64 0
  %92 = call i64 @strlen(ptr noundef %91) #8
  %93 = call i64 @send(i32 noundef %89, ptr noundef %90, i64 noundef %92, i32 noundef 0)
  %94 = icmp eq i64 %93, -1
  br i1 %94, label %95, label %97

95:                                               ; preds = %88
  %96 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  br label %97

97:                                               ; preds = %95, %88
  br label %83, !llvm.loop !20

98:                                               ; preds = %83
  call void @exit(i32 noundef 1) #9
  unreachable

99:                                               ; preds = %78
  br label %100

100:                                              ; preds = %105, %99
  %101 = load i32, ptr @sfd, align 4, !tbaa !5
  %102 = getelementptr inbounds [50 x i8], ptr %10, i64 0, i64 0
  %103 = call i64 @recv(i32 noundef %101, ptr noundef %102, i64 noundef 49, i32 noundef 0)
  store i64 %103, ptr %11, align 8, !tbaa !21
  %104 = icmp sgt i64 %103, 0
  br i1 %104, label %105, label %110

105:                                              ; preds = %100
  %106 = load i64, ptr %11, align 8, !tbaa !21
  %107 = getelementptr inbounds [50 x i8], ptr %10, i64 0, i64 %106
  store i8 0, ptr %107, align 1, !tbaa !23
  %108 = getelementptr inbounds [50 x i8], ptr %10, i64 0, i64 0
  %109 = call i32 (ptr, ...) @printf(ptr noundef @.str.10, ptr noundef %108)
  br label %100, !llvm.loop !24

110:                                              ; preds = %100
  br label %111

111:                                              ; preds = %110
  store i32 0, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %112

112:                                              ; preds = %111, %76, %33, %20, %15
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 50, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 50, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr %6) #7
  %113 = load i32, ptr %3, align 4
  ret i32 %113
}

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

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

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

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

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

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

; Function Attrs: nounwind
declare i32 @fork() #4

declare ptr @fgets(ptr noundef, i32 noundef, ptr noundef) #2

declare i64 @send(i32 noundef, ptr noundef, i64 noundef, i32 noundef) #2

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #6

declare i64 @recv(i32 noundef, ptr noundef, i64 noundef, i32 noundef) #2

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 = { noreturn 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 #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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind willreturn memory(read) "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(read) }
attributes #9 = { noreturn nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !6, i64 4}
!12 = !{!"addrinfo", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !10, i64 24, !10, i64 32, !10, i64 40}
!13 = !{!12, !6, i64 8}
!14 = !{!12, !6, i64 12}
!15 = !{!12, !10, i64 24}
!16 = !{!12, !6, i64 16}
!17 = !{!12, !10, i64 40}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = distinct !{!20, !19}
!21 = !{!22, !22, i64 0}
!22 = !{!"long", !7, i64 0}
!23 = !{!7, !7, i64 0}
!24 = distinct !{!24, !19}


; 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 }

@sfd = external dso_local local_unnamed_addr global i32, align 4
@.str.4 = external hidden unnamed_addr constant [56 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [29 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.9 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [32 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @my_signal_handler(i32 noundef) #0

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

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

declare i32 @close(i32 noundef) local_unnamed_addr #3

; Function Attrs: noreturn nounwind
declare void @exit(i32 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) #1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = alloca %struct.addrinfo, align 8
  %4 = alloca ptr, align 8
  %5 = alloca [50 x i8], align 16
  %6 = alloca [50 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %3) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  call void @llvm.lifetime.start.p0(i64 50, ptr nonnull %5) #8
  call void @llvm.lifetime.start.p0(i64 50, ptr nonnull %6) #8
  %.not = icmp eq i32 %0, 3
  br i1 %.not, label %9, label %7

7:                                                ; preds = %2
  %8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
  br label %.loopexit

9:                                                ; preds = %2
  %10 = tail call ptr @signal(i32 noundef 2, ptr noundef nonnull @my_signal_handler) #8
  %11 = icmp eq ptr %10, inttoptr (i64 -1 to ptr)
  br i1 %11, label %12, label %14

12:                                               ; preds = %9
  %13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5)
  br label %.loopexit

14:                                               ; preds = %9
  %15 = getelementptr inbounds i8, ptr %3, i64 8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(48) %3, i8 0, i64 48, i1 false)
  store i32 1, ptr %15, align 8, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %1, i64 8
  %17 = load ptr, ptr %16, align 8, !tbaa !11
  %18 = getelementptr inbounds i8, ptr %1, i64 16
  %19 = load ptr, ptr %18, align 8, !tbaa !11
  %20 = call i32 @getaddrinfo(ptr noundef %17, ptr noundef %19, ptr noundef nonnull %3, ptr noundef nonnull %4) #8
  %.not14 = icmp eq i32 %20, 0
  br i1 %.not14, label %.preheader19, label %21

.preheader19:                                     ; preds = %14
  %.01220 = load ptr, ptr %4, align 8, !tbaa !11
  %cond21 = icmp eq ptr %.01220, null
  br i1 %cond21, label %._crit_edge, label %.lr.ph

21:                                               ; preds = %14
  %22 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  br label %.loopexit

.lr.ph:                                           ; preds = %.preheader19, %43
  %.01222 = phi ptr [ %.012, %43 ], [ %.01220, %.preheader19 ]
  %23 = getelementptr inbounds i8, ptr %.01222, i64 4
  %24 = load i32, ptr %23, align 4, !tbaa !12
  %25 = getelementptr inbounds i8, ptr %.01222, i64 8
  %26 = load i32, ptr %25, align 8, !tbaa !5
  %27 = getelementptr inbounds i8, ptr %.01222, i64 12
  %28 = load i32, ptr %27, align 4, !tbaa !13
  %29 = call i32 @socket(i32 noundef %24, i32 noundef %26, i32 noundef %28) #8
  store i32 %29, ptr @sfd, align 4, !tbaa !14
  %30 = icmp eq i32 %29, -1
  br i1 %30, label %31, label %33

31:                                               ; preds = %.lr.ph
  %32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7)
  br label %43

33:                                               ; preds = %.lr.ph
  %34 = getelementptr inbounds i8, ptr %.01222, i64 24
  %35 = load ptr, ptr %34, align 8, !tbaa !15
  %36 = getelementptr inbounds i8, ptr %.01222, i64 16
  %37 = load i32, ptr %36, align 8, !tbaa !16
  %38 = call i32 @connect(i32 noundef %29, ptr noundef %35, i32 noundef %37) #8
  %39 = icmp eq i32 %38, 0
  br i1 %39, label %46, label %40

40:                                               ; preds = %33
  %41 = load i32, ptr @sfd, align 4, !tbaa !14
  %42 = call i32 @close(i32 noundef %41) #8
  br label %43

43:                                               ; preds = %40, %31
  %44 = getelementptr inbounds i8, ptr %.01222, i64 40
  %.012 = load ptr, ptr %44, align 8, !tbaa !11
  %cond = icmp eq ptr %.012, null
  br i1 %cond, label %._crit_edge, label %.lr.ph, !llvm.loop !17

._crit_edge:                                      ; preds = %43, %.preheader19
  %45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8)
  br label %.loopexit

46:                                               ; preds = %33
  %47 = load ptr, ptr %4, align 8, !tbaa !11
  call void @freeaddrinfo(ptr noundef %47) #8
  %48 = call i32 @fork() #8
  %.not16 = icmp eq i32 %48, 0
  br i1 %.not16, label %.preheader, label %.preheader18

.preheader18:                                     ; preds = %46
  %49 = load i32, ptr @sfd, align 4, !tbaa !14
  %50 = call i64 @recv(i32 noundef %49, ptr noundef nonnull %6, i64 noundef 49, i32 noundef 0) #8
  %51 = icmp sgt i64 %50, 0
  br i1 %51, label %.lr.ph23, label %.loopexit

.preheader:                                       ; preds = %46
  %52 = load ptr, ptr @stdin, align 8, !tbaa !11
  %53 = call ptr @fgets(ptr noundef nonnull %5, i32 noundef 50, ptr noundef %52)
  %.not1724 = icmp eq ptr %53, null
  br i1 %.not1724, label %._crit_edge26, label %.lr.ph25

.lr.ph25:                                         ; preds = %.preheader, %60
  %54 = load i32, ptr @sfd, align 4, !tbaa !14
  %55 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %5) #9
  %56 = call i64 @send(i32 noundef %54, ptr noundef nonnull %5, i64 noundef %55, i32 noundef 0) #8
  %57 = icmp eq i64 %56, -1
  br i1 %57, label %58, label %60

58:                                               ; preds = %.lr.ph25
  %59 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9)
  br label %60

60:                                               ; preds = %58, %.lr.ph25
  %61 = load ptr, ptr @stdin, align 8, !tbaa !11
  %62 = call ptr @fgets(ptr noundef nonnull %5, i32 noundef 50, ptr noundef %61)
  %.not17 = icmp eq ptr %62, null
  br i1 %.not17, label %._crit_edge26, label %.lr.ph25, !llvm.loop !19

._crit_edge26:                                    ; preds = %60, %.preheader
  call void @exit(i32 noundef 1) #10
  unreachable

.lr.ph23:                                         ; preds = %.preheader18, %.lr.ph23
  %63 = phi i64 [ %67, %.lr.ph23 ], [ %50, %.preheader18 ]
  %64 = getelementptr inbounds [50 x i8], ptr %6, i64 0, i64 %63
  store i8 0, ptr %64, align 1, !tbaa !20
  %65 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10, ptr noundef nonnull %6)
  %66 = load i32, ptr @sfd, align 4, !tbaa !14
  %67 = call i64 @recv(i32 noundef %66, ptr noundef nonnull %6, i64 noundef 49, i32 noundef 0) #8
  %68 = icmp sgt i64 %67, 0
  br i1 %68, label %.lr.ph23, label %.loopexit, !llvm.loop !21

.loopexit:                                        ; preds = %.lr.ph23, %.preheader18, %._crit_edge, %21, %12, %7
  call void @llvm.lifetime.end.p0(i64 50, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 50, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %3) #8
  ret i32 0
}

; Function Attrs: nounwind
declare ptr @signal(i32 noundef, ptr noundef) local_unnamed_addr #5

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

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 #5

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

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

; Function Attrs: nofree nounwind
declare i32 @fork() local_unnamed_addr #2

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

declare i64 @send(i32 noundef, ptr noundef, i64 noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #7

declare i64 @recv(i32 noundef, ptr noundef, i64 noundef, i32 noundef) local_unnamed_addr #3

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = { noreturn 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 "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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 #8 = { nounwind }
attributes #9 = { nounwind willreturn memory(read) }
attributes #10 = { noreturn 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 = !{!10, !10, i64 0}
!12 = !{!6, !7, i64 4}
!13 = !{!6, !7, i64 12}
!14 = !{!7, !7, i64 0}
!15 = !{!6, !10, i64 24}
!16 = !{!6, !7, i64 16}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}
!20 = !{!8, !8, i64 0}
!21 = distinct !{!21, !18}


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