; LLVM IR from jonhoo/volley :: servers/c-threaded (main)

; 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.sockaddr_in = type { i16, i16, %struct.in_addr, [8 x i8] }
%struct.in_addr = type { i32 }
%struct.timeval = type { i64, i64 }

@done = external hidden global i32, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@optarg = external global ptr, align 8
@stderr = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [19 x i8], align 1
@optind = external global i32, align 4
@.str.2 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [28 x i8], align 1
@ONE = external hidden constant i32, align 4
@.str.8 = external hidden unnamed_addr constant [30 x i8], align 1

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

; 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 i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %10 = alloca %struct.sockaddr_in, align 4
  %11 = alloca %struct.timeval, align 8
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca i64, align 8
  %15 = 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 4, ptr %6) #10
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #10
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #10
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #10
  %16 = call ptr @signal(i32 noundef 2, ptr noundef @sig_handler) #10
  %17 = call ptr @signal(i32 noundef 9, ptr noundef @sig_handler) #10
  %18 = call ptr @signal(i32 noundef 15, ptr noundef @sig_handler) #10
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #10
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #10
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #10
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #10
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #10
  br label %19

19:                                               ; preds = %35, %2
  %20 = load i32, ptr %4, align 4, !tbaa !5
  %21 = load ptr, ptr %5, align 8, !tbaa !9
  %22 = call i32 @getopt(i32 noundef %20, ptr noundef %21, ptr noundef @.str) #10
  store i32 %22, ptr %6, align 4, !tbaa !5
  %23 = icmp ne i32 %22, -1
  br i1 %23, label %24, label %36

24:                                               ; preds = %19
  %25 = load i32, ptr %6, align 4, !tbaa !5
  switch i32 %25, label %29 [
    i32 112, label %26
  ]

26:                                               ; preds = %24
  %27 = load ptr, ptr @optarg, align 8, !tbaa !9
  %28 = call i32 @atoi(ptr noundef %27) #11
  store i32 %28, ptr %8, align 4, !tbaa !5
  br label %35

29:                                               ; preds = %24
  %30 = load ptr, ptr @stderr, align 8, !tbaa !9
  %31 = load ptr, ptr %5, align 8, !tbaa !9
  %32 = getelementptr inbounds ptr, ptr %31, i64 0
  %33 = load ptr, ptr %32, align 8, !tbaa !9
  %34 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %30, ptr noundef @.str.1, ptr noundef %33) #10
  call void @exit(i32 noundef 1) #12
  unreachable

35:                                               ; preds = %26
  br label %19, !llvm.loop !11

36:                                               ; preds = %19
  %37 = load i32, ptr @optind, align 4, !tbaa !5
  %38 = load i32, ptr %4, align 4, !tbaa !5
  %39 = icmp slt i32 %37, %38
  br i1 %39, label %40, label %63

40:                                               ; preds = %36
  %41 = load ptr, ptr @stderr, align 8, !tbaa !9
  %42 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %41, ptr noundef @.str.2) #10
  %43 = load i32, ptr @optind, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  store i64 %44, ptr %9, align 8, !tbaa !13
  br label %45

45:                                               ; preds = %57, %40
  %46 = load i64, ptr %9, align 8, !tbaa !13
  %47 = load i32, ptr %4, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = icmp slt i64 %46, %48
  br i1 %49, label %50, label %60

50:                                               ; preds = %45
  %51 = load ptr, ptr @stderr, align 8, !tbaa !9
  %52 = load ptr, ptr %5, align 8, !tbaa !9
  %53 = load i64, ptr %9, align 8, !tbaa !13
  %54 = getelementptr inbounds ptr, ptr %52, i64 %53
  %55 = load ptr, ptr %54, align 8, !tbaa !9
  %56 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %51, ptr noundef @.str.3, ptr noundef %55) #10
  br label %57

57:                                               ; preds = %50
  %58 = load i64, ptr %9, align 8, !tbaa !13
  %59 = add nsw i64 %58, 1
  store i64 %59, ptr %9, align 8, !tbaa !13
  br label %45, !llvm.loop !15

60:                                               ; preds = %45
  %61 = load ptr, ptr @stderr, align 8, !tbaa !9
  %62 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %61, ptr noundef @.str.4) #10
  call void @exit(i32 noundef 1) #12
  unreachable

63:                                               ; preds = %36
  call void @llvm.memset.p0.i64(ptr align 4 %10, i8 0, i64 16, i1 false)
  %64 = getelementptr inbounds %struct.sockaddr_in, ptr %10, i32 0, i32 0
  store i16 2, ptr %64, align 4, !tbaa !16
  %65 = call i32 @__bswap_32(i32 noundef 2130706433)
  %66 = getelementptr inbounds %struct.sockaddr_in, ptr %10, i32 0, i32 2
  %67 = getelementptr inbounds %struct.in_addr, ptr %66, i32 0, i32 0
  store i32 %65, ptr %67, align 4, !tbaa !20
  %68 = load i32, ptr %8, align 4, !tbaa !5
  %69 = trunc i32 %68 to i16
  %70 = call zeroext i16 @__bswap_16(i16 noundef zeroext %69)
  %71 = getelementptr inbounds %struct.sockaddr_in, ptr %10, i32 0, i32 1
  store i16 %70, ptr %71, align 2, !tbaa !21
  %72 = call i32 @socket(i32 noundef 2, i32 noundef 1, i32 noundef 0) #10
  store i32 %72, ptr %12, align 4, !tbaa !5
  %73 = load i32, ptr %12, align 4, !tbaa !5
  %74 = icmp eq i32 %73, -1
  br i1 %74, label %75, label %76

75:                                               ; preds = %63
  br label %76

76:                                               ; preds = %75, %63
  %77 = getelementptr inbounds %struct.timeval, ptr %11, i32 0, i32 0
  store i64 1, ptr %77, align 8, !tbaa !22
  %78 = getelementptr inbounds %struct.timeval, ptr %11, i32 0, i32 1
  store i64 0, ptr %78, align 8, !tbaa !24
  %79 = load i32, ptr %12, align 4, !tbaa !5
  %80 = call i32 @setsockopt(i32 noundef %79, i32 noundef 1, i32 noundef 20, ptr noundef %11, i32 noundef 16) #10
  %81 = load i32, ptr %12, align 4, !tbaa !5
  %82 = call i32 @bind(i32 noundef %81, ptr noundef %10, i32 noundef 16) #10
  store i32 %82, ptr %7, align 4, !tbaa !5
  %83 = load i32, ptr %7, align 4, !tbaa !5
  %84 = icmp eq i32 %83, -1
  br i1 %84, label %85, label %86

85:                                               ; preds = %76
  call void @perror(ptr noundef @.str.5)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %15, align 4
  br label %136

86:                                               ; preds = %76
  %87 = load i32, ptr %12, align 4, !tbaa !5
  %88 = call i32 @listen(i32 noundef %87, i32 noundef 0) #10
  store i32 %88, ptr %7, align 4, !tbaa !5
  %89 = load i32, ptr %7, align 4, !tbaa !5
  %90 = icmp eq i32 %89, -1
  br i1 %90, label %91, label %92

91:                                               ; preds = %86
  call void @perror(ptr noundef @.str.6)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %15, align 4
  br label %136

92:                                               ; preds = %86
  br label %93

93:                                               ; preds = %132, %120, %92
  %94 = load i32, ptr @done, align 4, !tbaa !5
  %95 = icmp eq i32 %94, 0
  br i1 %95, label %96, label %133

96:                                               ; preds = %93
  %97 = call noalias ptr @malloc(i64 noundef 4) #13
  store ptr %97, ptr %13, align 8, !tbaa !9
  br label %98

98:                                               ; preds = %110, %96
  %99 = load i32, ptr %12, align 4, !tbaa !5
  %100 = call i32 @accept(i32 noundef %99, ptr noundef null, ptr noundef null)
  %101 = load ptr, ptr %13, align 8, !tbaa !9
  store i32 %100, ptr %101, align 4, !tbaa !5
  br label %102

102:                                              ; preds = %98
  %103 = load ptr, ptr %13, align 8, !tbaa !9
  %104 = load i32, ptr %103, align 4, !tbaa !5
  %105 = icmp eq i32 %104, -1
  br i1 %105, label %106, label %110

106:                                              ; preds = %102
  %107 = call ptr @__errno_location() #14
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = icmp eq i32 %108, 11
  br label %110

110:                                              ; preds = %106, %102
  %111 = phi i1 [ false, %102 ], [ %109, %106 ]
  br i1 %111, label %98, label %112, !llvm.loop !25

112:                                              ; preds = %110
  %113 = load ptr, ptr %13, align 8, !tbaa !9
  %114 = load i32, ptr %113, align 4, !tbaa !5
  %115 = icmp eq i32 %114, -1
  br i1 %115, label %116, label %123

116:                                              ; preds = %112
  %117 = call ptr @__errno_location() #14
  %118 = load i32, ptr %117, align 4, !tbaa !5
  %119 = icmp eq i32 %118, 4
  br i1 %119, label %120, label %122

120:                                              ; preds = %116
  %121 = load ptr, ptr %13, align 8, !tbaa !9
  call void @free(ptr noundef %121) #10
  br label %93, !llvm.loop !26

122:                                              ; preds = %116
  call void @perror(ptr noundef @.str.7)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %15, align 4
  br label %136

123:                                              ; preds = %112
  %124 = load ptr, ptr %13, align 8, !tbaa !9
  %125 = load i32, ptr %124, align 4, !tbaa !5
  %126 = call i32 @setsockopt(i32 noundef %125, i32 noundef 6, i32 noundef 1, ptr noundef @ONE, i32 noundef 4) #10
  %127 = load ptr, ptr %13, align 8, !tbaa !9
  %128 = call i32 @pthread_create(ptr noundef %14, ptr noundef null, ptr noundef @handle_client, ptr noundef %127) #10
  store i32 %128, ptr %7, align 4, !tbaa !5
  %129 = load i32, ptr %7, align 4, !tbaa !5
  %130 = icmp ne i32 %129, 0
  br i1 %130, label %131, label %132

131:                                              ; preds = %123
  call void @perror(ptr noundef @.str.8)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %15, align 4
  br label %136

132:                                              ; preds = %123
  br label %93, !llvm.loop !26

133:                                              ; preds = %93
  %134 = load i32, ptr %12, align 4, !tbaa !5
  %135 = call i32 @close(i32 noundef %134)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %15, align 4
  br label %136

136:                                              ; preds = %133, %131, %122, %91, %85
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #10
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #10
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #10
  %137 = load i32, ptr %3, align 4
  ret i32 %137
}

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

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

; Function Attrs: nounwind
declare i32 @getopt(i32 noundef, ptr noundef, ptr noundef) #2

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr noundef nonnull) #3

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #2

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @__bswap_32(i32 noundef) #6

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i16 @__bswap_16(i16 noundef zeroext) #6

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

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

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

declare void @perror(ptr noundef) #7

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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #8

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

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__errno_location() #9

; Function Attrs: nounwind
declare void @free(ptr noundef) #2

; Function Attrs: nounwind
declare i32 @pthread_create(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local ptr @handle_client(ptr noundef) #0

declare i32 @close(i32 noundef) #7

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

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 = { 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 = { inlinehint nounwind willreturn memory(read) 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 #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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { inlinehint 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 #7 = { "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 allocsize(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 #9 = { nounwind willreturn memory(none) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #10 = { nounwind }
attributes #11 = { nounwind willreturn memory(read) }
attributes #12 = { noreturn nounwind }
attributes #13 = { nounwind allocsize(0) }
attributes #14 = { nounwind willreturn memory(none) }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = distinct !{!15, !12}
!16 = !{!17, !18, i64 0}
!17 = !{!"sockaddr_in", !18, i64 0, !18, i64 2, !19, i64 4, !7, i64 8}
!18 = !{!"short", !7, i64 0}
!19 = !{!"in_addr", !6, i64 0}
!20 = !{!17, !6, i64 4}
!21 = !{!17, !18, i64 2}
!22 = !{!23, !14, i64 0}
!23 = !{!"timeval", !14, i64 0, !14, i64 8}
!24 = !{!23, !14, i64 8}
!25 = distinct !{!25, !12}
!26 = distinct !{!26, !12}


; 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.sockaddr_in = type { i16, i16, %struct.in_addr, [8 x i8] }
%struct.in_addr = type { i32 }
%struct.timeval = type { i64, i64 }

@done = external hidden local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@optarg = external local_unnamed_addr global ptr, align 8
@stderr = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [19 x i8], align 1
@optind = external local_unnamed_addr global i32, align 4
@.str.2 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [28 x i8], align 1
@ONE = external hidden constant i32, align 4
@.str.8 = external hidden unnamed_addr constant [30 x i8], align 1

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @main(i32 noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca %struct.sockaddr_in, align 4
  %4 = alloca %struct.timeval, align 8
  %5 = alloca i64, align 8
  %6 = tail call ptr @signal(i32 noundef 2, ptr noundef nonnull @sig_handler) #11
  %7 = tail call ptr @signal(i32 noundef 9, ptr noundef nonnull @sig_handler) #11
  %8 = tail call ptr @signal(i32 noundef 15, ptr noundef nonnull @sig_handler) #11
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #11
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #11
  br label %9

9:                                                ; preds = %11, %2
  %.027 = phi i32 [ undef, %2 ], [ %13, %11 ]
  %10 = tail call i32 @getopt(i32 noundef %0, ptr noundef %1, ptr noundef nonnull @.str) #11
  switch i32 %10, label %14 [
    i32 -1, label %18
    i32 112, label %11
  ]

11:                                               ; preds = %9
  %12 = load ptr, ptr @optarg, align 8, !tbaa !5
  %13 = tail call i32 @atoi(ptr nocapture noundef %12) #12
  br label %9, !llvm.loop !9

14:                                               ; preds = %9
  %15 = load ptr, ptr @stderr, align 8, !tbaa !5
  %16 = load ptr, ptr %1, align 8, !tbaa !5
  %17 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %15, ptr noundef nonnull @.str.1, ptr noundef %16) #13
  tail call void @exit(i32 noundef 1) #14
  unreachable

18:                                               ; preds = %9
  %19 = load i32, ptr @optind, align 4, !tbaa !11
  %20 = icmp slt i32 %19, %0
  br i1 %20, label %21, label %35

21:                                               ; preds = %18
  %22 = load ptr, ptr @stderr, align 8, !tbaa !5
  %23 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %22, ptr noundef nonnull @.str.2) #13
  %24 = load i32, ptr @optind, align 4, !tbaa !11
  %25 = sext i32 %0 to i64
  %26 = icmp slt i32 %24, %0
  br i1 %26, label %.lr.ph36.preheader, label %._crit_edge37

.lr.ph36.preheader:                               ; preds = %21
  %27 = sext i32 %24 to i64
  br label %.lr.ph36

.lr.ph36:                                         ; preds = %.lr.ph36.preheader, %.lr.ph36
  %.02634 = phi i64 [ %32, %.lr.ph36 ], [ %27, %.lr.ph36.preheader ]
  %28 = load ptr, ptr @stderr, align 8, !tbaa !5
  %29 = getelementptr inbounds ptr, ptr %1, i64 %.02634
  %30 = load ptr, ptr %29, align 8, !tbaa !5
  %31 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %28, ptr noundef nonnull @.str.3, ptr noundef %30) #13
  %32 = add nsw i64 %.02634, 1
  %exitcond.not = icmp eq i64 %32, %25
  br i1 %exitcond.not, label %._crit_edge37, label %.lr.ph36, !llvm.loop !13

._crit_edge37:                                    ; preds = %.lr.ph36, %21
  %33 = load ptr, ptr @stderr, align 8, !tbaa !5
  %34 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %33, ptr noundef nonnull @.str.4) #13
  tail call void @exit(i32 noundef 1) #14
  unreachable

35:                                               ; preds = %18
  %36 = getelementptr inbounds i8, ptr %3, i64 8
  store i64 0, ptr %36, align 4
  store i16 2, ptr %3, align 4, !tbaa !14
  %37 = tail call i32 @__bswap_32(i32 noundef 2130706433)
  %38 = getelementptr inbounds i8, ptr %3, i64 4
  store i32 %37, ptr %38, align 4, !tbaa !18
  %39 = trunc i32 %.027 to i16
  %40 = tail call zeroext i16 @__bswap_16(i16 noundef zeroext %39)
  %41 = getelementptr inbounds i8, ptr %3, i64 2
  store i16 %40, ptr %41, align 2, !tbaa !19
  %42 = tail call i32 @socket(i32 noundef 2, i32 noundef 1, i32 noundef 0) #11
  store i64 1, ptr %4, align 8, !tbaa !20
  %43 = getelementptr inbounds i8, ptr %4, i64 8
  store i64 0, ptr %43, align 8, !tbaa !23
  %44 = call i32 @setsockopt(i32 noundef %42, i32 noundef 1, i32 noundef 20, ptr noundef nonnull %4, i32 noundef 16) #11
  %45 = call i32 @bind(i32 noundef %42, ptr noundef nonnull %3, i32 noundef 16) #11
  %46 = icmp eq i32 %45, -1
  br i1 %46, label %47, label %48

47:                                               ; preds = %35
  call void @perror(ptr noundef nonnull @.str.5) #15
  br label %69

48:                                               ; preds = %35
  %49 = call i32 @listen(i32 noundef %42, i32 noundef 0) #11
  %50 = icmp eq i32 %49, -1
  br i1 %50, label %53, label %.preheader

.preheader:                                       ; preds = %48
  %51 = load i32, ptr @done, align 4, !tbaa !11
  %52 = icmp eq i32 %51, 0
  br i1 %52, label %.lr.ph, label %._crit_edge

53:                                               ; preds = %48
  call void @perror(ptr noundef nonnull @.str.6) #15
  br label %69

.lr.ph:                                           ; preds = %.preheader, %.backedge
  %54 = call noalias dereferenceable_or_null(4) ptr @malloc(i64 noundef 4) #16
  br label %55

55:                                               ; preds = %58, %.lr.ph
  %56 = call i32 @accept(i32 noundef %42, ptr noundef null, ptr noundef null) #11
  store i32 %56, ptr %54, align 4, !tbaa !11
  %57 = icmp eq i32 %56, -1
  br i1 %57, label %58, label %.critedge

58:                                               ; preds = %55
  %59 = tail call ptr @__errno_location() #17
  %60 = load i32, ptr %59, align 4, !tbaa !11
  switch i32 %60, label %64 [
    i32 11, label %55
    i32 4, label %61
  ]

61:                                               ; preds = %58
  call void @free(ptr noundef nonnull %54) #11
  br label %.backedge

.backedge:                                        ; preds = %61, %.critedge
  %62 = load i32, ptr @done, align 4, !tbaa !11
  %63 = icmp eq i32 %62, 0
  br i1 %63, label %.lr.ph, label %._crit_edge, !llvm.loop !24

64:                                               ; preds = %58
  call void @perror(ptr noundef nonnull @.str.7) #15
  br label %69

.critedge:                                        ; preds = %55
  %65 = call i32 @setsockopt(i32 noundef %56, i32 noundef 6, i32 noundef 1, ptr noundef nonnull @ONE, i32 noundef 4) #11
  %66 = call i32 @pthread_create(ptr noundef nonnull %5, ptr noundef null, ptr noundef nonnull @handle_client, ptr noundef nonnull %54) #11
  %.not31 = icmp eq i32 %66, 0
  br i1 %.not31, label %.backedge, label %67

67:                                               ; preds = %.critedge
  call void @perror(ptr noundef nonnull @.str.8) #15
  br label %69

._crit_edge:                                      ; preds = %.backedge, %.preheader
  %68 = call i32 @close(i32 noundef %42) #11
  br label %69

69:                                               ; preds = %._crit_edge, %67, %64, %53, %47
  %.0 = phi i32 [ 1, %47 ], [ 1, %53 ], [ 1, %64 ], [ 1, %67 ], [ 0, %._crit_edge ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #11
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #11
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #11
  ret i32 %.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: nounwind
declare ptr @signal(i32 noundef, ptr noundef) local_unnamed_addr #2

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

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr nocapture noundef nonnull) local_unnamed_addr #3

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @__bswap_32(i32 noundef) local_unnamed_addr #6

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i16 @__bswap_16(i16 noundef zeroext) local_unnamed_addr #6

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

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

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

; Function Attrs: nofree nounwind
declare void @perror(ptr nocapture noundef readonly) local_unnamed_addr #4

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

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #7

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

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

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #10

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @handle_client(ptr noundef) #0

declare i32 @close(i32 noundef) local_unnamed_addr #8

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

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 = { 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 = { inlinehint mustprogress nofree nounwind willreturn memory(read) 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 #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 = { 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 #6 = { inlinehint 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 #7 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { "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 #9 = { mustprogress nofree nosync nounwind willreturn memory(none) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #10 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #11 = { nounwind }
attributes #12 = { nounwind willreturn memory(read) }
attributes #13 = { cold nounwind }
attributes #14 = { noreturn nounwind }
attributes #15 = { cold }
attributes #16 = { nounwind allocsize(0) }
attributes #17 = { nounwind willreturn memory(none) }

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

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


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