; LLVM IR from SvrAdityaReddy/RTOS :: Assignment_4/sockets/sockets_client_server_uni_directional (server)

; 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.sockaddr_storage = type { i16, [118 x i8], i64 }
%struct.sigaction = type { %union.anon, %struct.__sigset_t, i32, ptr }
%union.anon = type { ptr }
%struct.__sigset_t = type { [16 x i64] }

@cfd = external dso_local global i32, align 4
@.str.4 = external hidden unnamed_addr constant [65 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [28 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
declare dso_local void @grim_reap(i32 noundef) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca %struct.addrinfo, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %struct.sockaddr_storage, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca [1025 x i8], align 16
  %10 = alloca [32 x i8], align 16
  %11 = alloca [1067 x i8], align 16
  %12 = alloca i64, align 8
  %13 = alloca [50 x i8], align 16
  %14 = alloca %struct.sigaction, align 8
  %15 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 48, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 128, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 1025, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 1067, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 50, ptr %13) #6
  call void @llvm.lifetime.start.p0(i64 152, ptr %14) #6
  %16 = getelementptr inbounds %struct.sigaction, ptr %14, i32 0, i32 1
  %17 = call i32 @sigemptyset(ptr noundef %16) #6
  %18 = getelementptr inbounds %struct.sigaction, ptr %14, i32 0, i32 2
  store i32 268435456, ptr %18, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.sigaction, ptr %14, i32 0, i32 0
  store ptr @grim_reap, ptr %19, align 8, !tbaa !12
  %20 = call i32 @sigaction(i32 noundef 17, ptr noundef %14, ptr noundef null) #6
  %21 = icmp eq i32 %20, -1
  br i1 %21, label %22, label %24

22:                                               ; preds = %0
  %23 = call i32 (ptr, ...) @printf(ptr noundef @.str.4)
  call void @exit(i32 noundef 0) #7
  unreachable

24:                                               ; preds = %0
  %25 = call ptr @signal(i32 noundef 13, ptr noundef inttoptr (i64 1 to ptr)) #6
  %26 = icmp eq ptr %25, inttoptr (i64 -1 to ptr)
  br i1 %26, label %27, label %29

27:                                               ; preds = %24
  %28 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %15, align 4
  br label %141

29:                                               ; preds = %24
  %30 = call ptr @signal(i32 noundef 2, ptr noundef @my_signal_handler) #6
  %31 = icmp eq ptr %30, inttoptr (i64 -1 to ptr)
  br i1 %31, label %32, label %34

32:                                               ; preds = %29
  %33 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %15, align 4
  br label %141

34:                                               ; preds = %29
  call void @llvm.memset.p0.i64(ptr align 8 %2, i8 0, i64 48, i1 false)
  %35 = getelementptr inbounds %struct.addrinfo, ptr %2, i32 0, i32 6
  store ptr null, ptr %35, align 8, !tbaa !13
  %36 = getelementptr inbounds %struct.addrinfo, ptr %2, i32 0, i32 7
  store ptr null, ptr %36, align 8, !tbaa !15
  %37 = getelementptr inbounds %struct.addrinfo, ptr %2, i32 0, i32 5
  store ptr null, ptr %37, align 8, !tbaa !16
  %38 = getelementptr inbounds %struct.addrinfo, ptr %2, i32 0, i32 1
  store i32 0, ptr %38, align 4, !tbaa !17
  %39 = getelementptr inbounds %struct.addrinfo, ptr %2, i32 0, i32 2
  store i32 1, ptr %39, align 8, !tbaa !18
  %40 = getelementptr inbounds %struct.addrinfo, ptr %2, i32 0, i32 0
  store i32 1, ptr %40, align 8, !tbaa !19
  %41 = call i32 @getaddrinfo(ptr noundef null, ptr noundef @.str.7, ptr noundef %2, ptr noundef %3)
  %42 = icmp ne i32 %41, 0
  br i1 %42, label %43, label %45

43:                                               ; preds = %34
  %44 = call i32 (ptr, ...) @printf(ptr noundef @.str.8)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %15, align 4
  br label %141

45:                                               ; preds = %34
  store i32 1, ptr %8, align 4, !tbaa !20
  %46 = load ptr, ptr %3, align 8, !tbaa !21
  store ptr %46, ptr %4, align 8, !tbaa !21
  br label %47

47:                                               ; preds = %85, %45
  %48 = load ptr, ptr %4, align 8, !tbaa !21
  %49 = icmp ne ptr %48, null
  br i1 %49, label %50, label %89

50:                                               ; preds = %47
  %51 = load ptr, ptr %4, align 8, !tbaa !21
  %52 = getelementptr inbounds %struct.addrinfo, ptr %51, i32 0, i32 1
  %53 = load i32, ptr %52, align 4, !tbaa !17
  %54 = load ptr, ptr %4, align 8, !tbaa !21
  %55 = getelementptr inbounds %struct.addrinfo, ptr %54, i32 0, i32 2
  %56 = load i32, ptr %55, align 8, !tbaa !18
  %57 = load ptr, ptr %4, align 8, !tbaa !21
  %58 = getelementptr inbounds %struct.addrinfo, ptr %57, i32 0, i32 3
  %59 = load i32, ptr %58, align 4, !tbaa !22
  %60 = call i32 @socket(i32 noundef %53, i32 noundef %56, i32 noundef %59) #6
  store i32 %60, ptr %7, align 4, !tbaa !20
  %61 = load i32, ptr %7, align 4, !tbaa !20
  %62 = icmp eq i32 %61, -1
  br i1 %62, label %63, label %65

63:                                               ; preds = %50
  %64 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  br label %85

65:                                               ; preds = %50
  %66 = load i32, ptr %7, align 4, !tbaa !20
  %67 = call i32 @setsockopt(i32 noundef %66, i32 noundef 1, i32 noundef 2, ptr noundef %8, i32 noundef 4) #6
  %68 = icmp eq i32 %67, -1
  br i1 %68, label %69, label %71

69:                                               ; preds = %65
  %70 = call i32 (ptr, ...) @printf(ptr noundef @.str.10)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %15, align 4
  br label %141

71:                                               ; preds = %65
  %72 = load i32, ptr %7, align 4, !tbaa !20
  %73 = load ptr, ptr %4, align 8, !tbaa !21
  %74 = getelementptr inbounds %struct.addrinfo, ptr %73, i32 0, i32 5
  %75 = load ptr, ptr %74, align 8, !tbaa !16
  %76 = load ptr, ptr %4, align 8, !tbaa !21
  %77 = getelementptr inbounds %struct.addrinfo, ptr %76, i32 0, i32 4
  %78 = load i32, ptr %77, align 8, !tbaa !23
  %79 = call i32 @bind(i32 noundef %72, ptr noundef %75, i32 noundef %78) #6
  %80 = icmp eq i32 %79, 0
  br i1 %80, label %81, label %82

81:                                               ; preds = %71
  br label %89

82:                                               ; preds = %71
  %83 = load i32, ptr %7, align 4, !tbaa !20
  %84 = call i32 @close(i32 noundef %83)
  br label %85

85:                                               ; preds = %82, %63
  %86 = load ptr, ptr %4, align 8, !tbaa !21
  %87 = getelementptr inbounds %struct.addrinfo, ptr %86, i32 0, i32 7
  %88 = load ptr, ptr %87, align 8, !tbaa !15
  store ptr %88, ptr %4, align 8, !tbaa !21
  br label %47, !llvm.loop !24

89:                                               ; preds = %81, %47
  %90 = load ptr, ptr %4, align 8, !tbaa !21
  %91 = icmp eq ptr %90, null
  br i1 %91, label %92, label %94

92:                                               ; preds = %89
  %93 = call i32 (ptr, ...) @printf(ptr noundef @.str.11)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %15, align 4
  br label %141

94:                                               ; preds = %89
  %95 = load i32, ptr %7, align 4, !tbaa !20
  %96 = call i32 @listen(i32 noundef %95, i32 noundef 50) #6
  %97 = icmp eq i32 %96, -1
  br i1 %97, label %98, label %100

98:                                               ; preds = %94
  %99 = call i32 (ptr, ...) @printf(ptr noundef @.str.12)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %15, align 4
  br label %141

100:                                              ; preds = %94
  %101 = load ptr, ptr %3, align 8, !tbaa !21
  call void @freeaddrinfo(ptr noundef %101) #6
  br label %102

102:                                              ; preds = %140, %107, %100
  store i32 128, ptr %6, align 4, !tbaa !20
  %103 = load i32, ptr %7, align 4, !tbaa !20
  %104 = call i32 @accept(i32 noundef %103, ptr noundef %5, ptr noundef %6)
  store i32 %104, ptr @cfd, align 4, !tbaa !20
  %105 = load i32, ptr @cfd, align 4, !tbaa !20
  %106 = icmp eq i32 %105, -1
  br i1 %106, label %107, label %109

107:                                              ; preds = %102
  %108 = call i32 (ptr, ...) @printf(ptr noundef @.str.13)
  br label %102

109:                                              ; preds = %102
  %110 = load i32, ptr %6, align 4, !tbaa !20
  %111 = getelementptr inbounds [1025 x i8], ptr %9, i64 0, i64 0
  %112 = getelementptr inbounds [32 x i8], ptr %10, i64 0, i64 0
  %113 = call i32 @getnameinfo(ptr noundef %5, i32 noundef %110, ptr noundef %111, i32 noundef 1025, ptr noundef %112, i32 noundef 32, i32 noundef 0)
  %114 = icmp eq i32 %113, 0
  br i1 %114, label %115, label %120

115:                                              ; preds = %109
  %116 = getelementptr inbounds [1067 x i8], ptr %11, i64 0, i64 0
  %117 = getelementptr inbounds [1025 x i8], ptr %9, i64 0, i64 0
  %118 = getelementptr inbounds [32 x i8], ptr %10, i64 0, i64 0
  %119 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %116, i64 noundef 1067, ptr noundef @.str.14, ptr noundef %117, ptr noundef %118) #6
  br label %120

120:                                              ; preds = %115, %109
  %121 = getelementptr inbounds [1067 x i8], ptr %11, i64 0, i64 0
  %122 = call i32 (ptr, ...) @printf(ptr noundef @.str.15, ptr noundef %121)
  %123 = call i32 @fork() #6
  %124 = icmp ne i32 %123, 0
  br i1 %124, label %140, label %125

125:                                              ; preds = %120
  %126 = load i32, ptr %7, align 4, !tbaa !20
  %127 = call i32 @close(i32 noundef %126)
  br label %128

128:                                              ; preds = %133, %125
  %129 = load i32, ptr @cfd, align 4, !tbaa !20
  %130 = getelementptr inbounds [50 x i8], ptr %13, i64 0, i64 0
  %131 = call i64 @recv(i32 noundef %129, ptr noundef %130, i64 noundef 49, i32 noundef 0)
  store i64 %131, ptr %12, align 8, !tbaa !26
  %132 = icmp sgt i64 %131, 0
  br i1 %132, label %133, label %139

133:                                              ; preds = %128
  %134 = load i64, ptr %12, align 8, !tbaa !26
  %135 = getelementptr inbounds [50 x i8], ptr %13, i64 0, i64 %134
  store i8 0, ptr %135, align 1, !tbaa !12
  %136 = getelementptr inbounds [1025 x i8], ptr %9, i64 0, i64 0
  %137 = getelementptr inbounds [50 x i8], ptr %13, i64 0, i64 0
  %138 = call i32 (ptr, ...) @printf(ptr noundef @.str.16, ptr noundef %136, ptr noundef %137)
  br label %128, !llvm.loop !28

139:                                              ; preds = %128
  call void @exit(i32 noundef 1) #7
  unreachable

140:                                              ; preds = %120
  br label %102

141:                                              ; preds = %98, %92, %69, %43, %32, %27
  call void @llvm.lifetime.end.p0(i64 152, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 50, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 1067, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 1025, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 128, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %2) #6
  %142 = load i32, ptr %1, align 4
  ret i32 %142
}

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

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

; 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

; 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

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

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

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

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

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

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 }
attributes #7 = { 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, !10, i64 136}
!6 = !{!"sigaction", !7, i64 0, !9, i64 8, !10, i64 136, !11, i64 144}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"", !7, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!7, !7, i64 0}
!13 = !{!14, !11, i64 32}
!14 = !{!"addrinfo", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !11, i64 24, !11, i64 32, !11, i64 40}
!15 = !{!14, !11, i64 40}
!16 = !{!14, !11, i64 24}
!17 = !{!14, !10, i64 4}
!18 = !{!14, !10, i64 8}
!19 = !{!14, !10, i64 0}
!20 = !{!10, !10, i64 0}
!21 = !{!11, !11, i64 0}
!22 = !{!14, !10, i64 12}
!23 = !{!14, !10, i64 16}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{!27, !27, i64 0}
!27 = !{!"long", !7, i64 0}
!28 = distinct !{!28, !25}


; 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 }
%struct.sockaddr_storage = type { i16, [118 x i8], i64 }
%struct.sigaction = type { %union.anon, %struct.__sigset_t, i32, ptr }
%union.anon = type { ptr }
%struct.__sigset_t = type { [16 x i64] }

@cfd = external dso_local local_unnamed_addr global i32, align 4
@.str.4 = external hidden unnamed_addr constant [65 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [28 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
declare dso_local void @grim_reap(i32 noundef) #0

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca %struct.addrinfo, align 8
  %2 = alloca ptr, align 8
  %3 = alloca %struct.sockaddr_storage, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca [1025 x i8], align 16
  %7 = alloca [32 x i8], align 16
  %8 = alloca [1067 x i8], align 16
  %9 = alloca [50 x i8], align 16
  %10 = alloca %struct.sigaction, align 8
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #7
  call void @llvm.lifetime.start.p0(i64 1025, ptr nonnull %6) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #7
  call void @llvm.lifetime.start.p0(i64 1067, ptr nonnull %8) #7
  call void @llvm.lifetime.start.p0(i64 50, ptr nonnull %9) #7
  call void @llvm.lifetime.start.p0(i64 152, ptr nonnull %10) #7
  %11 = getelementptr inbounds i8, ptr %10, i64 8
  %12 = call i32 @sigemptyset(ptr noundef nonnull %11) #7
  %13 = getelementptr inbounds i8, ptr %10, i64 136
  store i32 268435456, ptr %13, align 8, !tbaa !5
  store ptr @grim_reap, ptr %10, align 8, !tbaa !12
  %14 = call i32 @sigaction(i32 noundef 17, ptr noundef nonnull %10, ptr noundef null) #7
  %15 = icmp eq i32 %14, -1
  br i1 %15, label %16, label %18

16:                                               ; preds = %0
  %17 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
  call void @exit(i32 noundef 0) #8
  unreachable

18:                                               ; preds = %0
  %19 = call ptr @signal(i32 noundef 13, ptr noundef nonnull inttoptr (i64 1 to ptr)) #7
  %20 = icmp eq ptr %19, inttoptr (i64 -1 to ptr)
  br i1 %20, label %._crit_edge, label %21

21:                                               ; preds = %18
  %22 = call ptr @signal(i32 noundef 2, ptr noundef nonnull @my_signal_handler) #7
  %23 = icmp eq ptr %22, inttoptr (i64 -1 to ptr)
  br i1 %23, label %._crit_edge, label %24

24:                                               ; preds = %21
  %25 = getelementptr inbounds i8, ptr %1, i64 8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(48) %1, i8 0, i64 48, i1 false)
  store i32 1, ptr %25, align 8, !tbaa !13
  store i32 1, ptr %1, align 8, !tbaa !15
  %26 = call i32 @getaddrinfo(ptr noundef null, ptr noundef nonnull @.str.7, ptr noundef nonnull %1, ptr noundef nonnull %2) #7
  %.not = icmp eq i32 %26, 0
  br i1 %.not, label %27, label %._crit_edge

27:                                               ; preds = %24
  store i32 1, ptr %5, align 4, !tbaa !16
  %.01723 = load ptr, ptr %2, align 8, !tbaa !17
  %.not1924 = icmp eq ptr %.01723, null
  br i1 %.not1924, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %27, %50
  %.01725 = phi ptr [ %.017, %50 ], [ %.01723, %27 ]
  %28 = getelementptr inbounds i8, ptr %.01725, i64 4
  %29 = load i32, ptr %28, align 4, !tbaa !18
  %30 = getelementptr inbounds i8, ptr %.01725, i64 8
  %31 = load i32, ptr %30, align 8, !tbaa !13
  %32 = getelementptr inbounds i8, ptr %.01725, i64 12
  %33 = load i32, ptr %32, align 4, !tbaa !19
  %34 = call i32 @socket(i32 noundef %29, i32 noundef %31, i32 noundef %33) #7
  %35 = icmp eq i32 %34, -1
  br i1 %35, label %36, label %38

36:                                               ; preds = %.lr.ph
  %37 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9)
  br label %50

38:                                               ; preds = %.lr.ph
  %39 = call i32 @setsockopt(i32 noundef %34, i32 noundef 1, i32 noundef 2, ptr noundef nonnull %5, i32 noundef 4) #7
  %40 = icmp eq i32 %39, -1
  br i1 %40, label %._crit_edge, label %41

41:                                               ; preds = %38
  %42 = getelementptr inbounds i8, ptr %.01725, i64 24
  %43 = load ptr, ptr %42, align 8, !tbaa !20
  %44 = getelementptr inbounds i8, ptr %.01725, i64 16
  %45 = load i32, ptr %44, align 8, !tbaa !21
  %46 = call i32 @bind(i32 noundef %34, ptr noundef %43, i32 noundef %45) #7
  %47 = icmp eq i32 %46, 0
  br i1 %47, label %52, label %48

48:                                               ; preds = %41
  %49 = call i32 @close(i32 noundef %34) #7
  br label %50

50:                                               ; preds = %48, %36
  %51 = getelementptr inbounds i8, ptr %.01725, i64 40
  %.017 = load ptr, ptr %51, align 8, !tbaa !17
  %.not19 = icmp eq ptr %.017, null
  br i1 %.not19, label %._crit_edge, label %.lr.ph, !llvm.loop !22

52:                                               ; preds = %41
  %53 = call i32 @listen(i32 noundef %34, i32 noundef 50) #7
  %54 = icmp eq i32 %53, -1
  br i1 %54, label %._crit_edge, label %55

55:                                               ; preds = %52
  %56 = load ptr, ptr %2, align 8, !tbaa !17
  call void @freeaddrinfo(ptr noundef %56) #7
  br label %.backedge

.backedge:                                        ; preds = %.backedge.backedge, %55
  store i32 128, ptr %4, align 4, !tbaa !16
  %57 = call i32 @accept(i32 noundef %34, ptr noundef nonnull %3, ptr noundef nonnull %4) #7
  store i32 %57, ptr @cfd, align 4, !tbaa !16
  %58 = icmp eq i32 %57, -1
  br i1 %58, label %59, label %61

59:                                               ; preds = %.backedge
  %60 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13)
  br label %.backedge.backedge

.backedge.backedge:                               ; preds = %59, %67
  br label %.backedge

61:                                               ; preds = %.backedge
  %62 = load i32, ptr %4, align 4, !tbaa !16
  %63 = call i32 @getnameinfo(ptr noundef nonnull %3, i32 noundef %62, ptr noundef nonnull %6, i32 noundef 1025, ptr noundef nonnull %7, i32 noundef 32, i32 noundef 0) #7
  %64 = icmp eq i32 %63, 0
  br i1 %64, label %65, label %67

65:                                               ; preds = %61
  %66 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %8, i64 noundef 1067, ptr noundef nonnull @.str.14, ptr noundef nonnull %6, ptr noundef nonnull %7) #7
  br label %67

67:                                               ; preds = %65, %61
  %68 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15, ptr noundef nonnull %8)
  %69 = call i32 @fork() #7
  %.not20 = icmp eq i32 %69, 0
  br i1 %.not20, label %70, label %.backedge.backedge

70:                                               ; preds = %67
  %71 = call i32 @close(i32 noundef %34) #7
  %72 = load i32, ptr @cfd, align 4, !tbaa !16
  %73 = call i64 @recv(i32 noundef %72, ptr noundef nonnull %9, i64 noundef 49, i32 noundef 0) #7
  %74 = icmp sgt i64 %73, 0
  br i1 %74, label %.lr.ph27, label %._crit_edge28

.lr.ph27:                                         ; preds = %70, %.lr.ph27
  %75 = phi i64 [ %79, %.lr.ph27 ], [ %73, %70 ]
  %76 = getelementptr inbounds [50 x i8], ptr %9, i64 0, i64 %75
  store i8 0, ptr %76, align 1, !tbaa !12
  %77 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.16, ptr noundef nonnull %6, ptr noundef nonnull %9)
  %78 = load i32, ptr @cfd, align 4, !tbaa !16
  %79 = call i64 @recv(i32 noundef %78, ptr noundef nonnull %9, i64 noundef 49, i32 noundef 0) #7
  %80 = icmp sgt i64 %79, 0
  br i1 %80, label %.lr.ph27, label %._crit_edge28, !llvm.loop !24

._crit_edge28:                                    ; preds = %.lr.ph27, %70
  call void @exit(i32 noundef 1) #8
  unreachable

._crit_edge:                                      ; preds = %50, %38, %52, %27, %24, %21, %18
  %.str.12.sink = phi ptr [ @.str.5, %18 ], [ @.str.6, %21 ], [ @.str.8, %24 ], [ @.str.11, %27 ], [ @.str.12, %52 ], [ @.str.10, %38 ], [ @.str.11, %50 ]
  %81 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.12.sink)
  call void @llvm.lifetime.end.p0(i64 152, ptr nonnull %10) #7
  call void @llvm.lifetime.end.p0(i64 50, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 1067, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 1025, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %1) #7
  ret i32 0
}

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

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

; 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

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

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

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

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

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

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

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

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

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


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass