; LLVM IR from uNetworking/uSockets :: examples (hammer_test_unix)

; 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.us_socket_context_options_t = type { ptr, ptr, ptr, ptr, ptr, ptr, i32 }

@long_length = external dso_local global i32, align 4
@websocket_context = external dso_local global ptr, align 8
@http_context = external dso_local global ptr, align 8
@long_buffer = external dso_local global ptr, align 8
@closed_clients = external dso_local global i32, align 4
@closed_servers = external dso_local global i32, align 4
@opened_clients = external dso_local global i32, align 4
@listen_socket = external dso_local global ptr, align 8
@.str.9 = external hidden unnamed_addr constant [17 x i8], align 1
@opened_servers = external dso_local global i32, align 4
@.str.14 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [22 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @print_progress(double 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

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

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

declare void @us_socket_timeout(i32 noundef, ptr noundef, i32 noundef) #2

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

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

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @on_web_socket_close(ptr noundef, i32 noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @on_http_socket_close(ptr noundef, i32 noundef, ptr noundef) #0

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

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @on_web_socket_data(ptr noundef, ptr noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @on_http_socket_data(ptr noundef, ptr noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @on_web_socket_open(ptr noundef, i32 noundef, ptr noundef, i32 noundef) #0

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @on_http_socket_connect_error(ptr noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @on_web_socket_connect_error(ptr noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @on_http_socket_open(ptr noundef, i32 noundef, ptr noundef, i32 noundef) #0

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

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

; Function Attrs: nounwind
declare i64 @time(ptr noundef) #4

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca ptr, align 8
  %3 = alloca %struct.us_socket_context_options_t, align 8
  %4 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %5 = call i64 @time(ptr noundef null) #6
  %6 = trunc i64 %5 to i32
  call void @srand(i32 noundef %6) #6
  %7 = load i32, ptr @long_length, align 4, !tbaa !5
  %8 = zext i32 %7 to i64
  %9 = call noalias ptr @calloc(i64 noundef %8, i64 noundef 1) #7
  store ptr %9, ptr @long_buffer, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #6
  %10 = call ptr @us_create_loop(ptr noundef null, ptr noundef @on_wakeup, ptr noundef @on_pre, ptr noundef @on_post, i32 noundef 0)
  store ptr %10, ptr %2, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 56, ptr %3) #6
  call void @llvm.memset.p0.i64(ptr align 8 %3, i8 0, i64 56, i1 false)
  %11 = getelementptr inbounds %struct.us_socket_context_options_t, ptr %3, i32 0, i32 0
  store ptr @.str.14, ptr %11, align 8, !tbaa !11
  %12 = getelementptr inbounds %struct.us_socket_context_options_t, ptr %3, i32 0, i32 1
  store ptr @.str.15, ptr %12, align 8, !tbaa !13
  %13 = getelementptr inbounds %struct.us_socket_context_options_t, ptr %3, i32 0, i32 2
  store ptr @.str.16, ptr %13, align 8, !tbaa !14
  %14 = load ptr, ptr %2, align 8, !tbaa !9
  %15 = call ptr @us_create_socket_context(i32 noundef 1, ptr noundef %14, i32 noundef 1, ptr noundef byval(%struct.us_socket_context_options_t) align 8 %3)
  store ptr %15, ptr @http_context, align 8, !tbaa !9
  %16 = load ptr, ptr @http_context, align 8, !tbaa !9
  call void @us_socket_context_on_open(i32 noundef 1, ptr noundef %16, ptr noundef @on_http_socket_open)
  %17 = load ptr, ptr @http_context, align 8, !tbaa !9
  call void @us_socket_context_on_data(i32 noundef 1, ptr noundef %17, ptr noundef @on_http_socket_data)
  %18 = load ptr, ptr @http_context, align 8, !tbaa !9
  call void @us_socket_context_on_writable(i32 noundef 1, ptr noundef %18, ptr noundef @on_http_socket_writable)
  %19 = load ptr, ptr @http_context, align 8, !tbaa !9
  call void @us_socket_context_on_close(i32 noundef 1, ptr noundef %19, ptr noundef @on_http_socket_close)
  %20 = load ptr, ptr @http_context, align 8, !tbaa !9
  call void @us_socket_context_on_timeout(i32 noundef 1, ptr noundef %20, ptr noundef @on_http_socket_timeout)
  %21 = load ptr, ptr @http_context, align 8, !tbaa !9
  call void @us_socket_context_on_end(i32 noundef 1, ptr noundef %21, ptr noundef @on_http_socket_end)
  %22 = load ptr, ptr @http_context, align 8, !tbaa !9
  call void @us_socket_context_on_connect_error(i32 noundef 1, ptr noundef %22, ptr noundef @on_http_socket_connect_error)
  %23 = load ptr, ptr @http_context, align 8, !tbaa !9
  %24 = call ptr @us_create_child_socket_context(i32 noundef 1, ptr noundef %23, i32 noundef 1)
  store ptr %24, ptr @websocket_context, align 8, !tbaa !9
  %25 = load ptr, ptr @websocket_context, align 8, !tbaa !9
  call void @us_socket_context_on_open(i32 noundef 1, ptr noundef %25, ptr noundef @on_web_socket_open)
  %26 = load ptr, ptr @websocket_context, align 8, !tbaa !9
  call void @us_socket_context_on_data(i32 noundef 1, ptr noundef %26, ptr noundef @on_web_socket_data)
  %27 = load ptr, ptr @websocket_context, align 8, !tbaa !9
  call void @us_socket_context_on_writable(i32 noundef 1, ptr noundef %27, ptr noundef @on_web_socket_writable)
  %28 = load ptr, ptr @websocket_context, align 8, !tbaa !9
  call void @us_socket_context_on_close(i32 noundef 1, ptr noundef %28, ptr noundef @on_web_socket_close)
  %29 = load ptr, ptr @websocket_context, align 8, !tbaa !9
  call void @us_socket_context_on_timeout(i32 noundef 1, ptr noundef %29, ptr noundef @on_web_socket_timeout)
  %30 = load ptr, ptr @websocket_context, align 8, !tbaa !9
  call void @us_socket_context_on_end(i32 noundef 1, ptr noundef %30, ptr noundef @on_web_socket_end)
  %31 = load ptr, ptr @websocket_context, align 8, !tbaa !9
  call void @us_socket_context_on_connect_error(i32 noundef 1, ptr noundef %31, ptr noundef @on_web_socket_connect_error)
  %32 = load ptr, ptr @http_context, align 8, !tbaa !9
  %33 = call ptr @us_socket_context_listen_unix(i32 noundef 1, ptr noundef %32, ptr noundef @.str.9, i32 noundef 0, i32 noundef 160)
  store ptr %33, ptr @listen_socket, align 8, !tbaa !9
  %34 = load ptr, ptr @listen_socket, align 8, !tbaa !9
  call void @us_socket_timeout(i32 noundef 1, ptr noundef %34, i32 noundef 16)
  %35 = load ptr, ptr @listen_socket, align 8, !tbaa !9
  %36 = icmp ne ptr %35, null
  br i1 %36, label %37, label %41

37:                                               ; preds = %0
  %38 = call i32 (ptr, ...) @printf(ptr noundef @.str.17)
  call void @print_progress(double noundef 0.000000e+00)
  %39 = call ptr @next_connection()
  %40 = load ptr, ptr %2, align 8, !tbaa !9
  call void @us_loop_run(ptr noundef %40)
  br label %43

41:                                               ; preds = %0
  %42 = call i32 (ptr, ...) @printf(ptr noundef @.str.18)
  br label %43

43:                                               ; preds = %41, %37
  %44 = load ptr, ptr @websocket_context, align 8, !tbaa !9
  call void @us_socket_context_free(i32 noundef 1, ptr noundef %44)
  %45 = load ptr, ptr @http_context, align 8, !tbaa !9
  call void @us_socket_context_free(i32 noundef 1, ptr noundef %45)
  %46 = load ptr, ptr %2, align 8, !tbaa !9
  call void @us_loop_free(ptr noundef %46)
  %47 = load ptr, ptr @long_buffer, align 8, !tbaa !9
  call void @free(ptr noundef %47) #6
  call void @print_progress(double noundef 1.000000e+00)
  %48 = call i32 (ptr, ...) @printf(ptr noundef @.str.19)
  %49 = load i32, ptr @opened_clients, align 4, !tbaa !5
  %50 = icmp eq i32 %49, 5000
  br i1 %50, label %51, label %62

51:                                               ; preds = %43
  %52 = load i32, ptr @closed_clients, align 4, !tbaa !5
  %53 = icmp eq i32 %52, 5000
  br i1 %53, label %54, label %62

54:                                               ; preds = %51
  %55 = load i32, ptr @opened_servers, align 4, !tbaa !5
  %56 = icmp eq i32 %55, 5000
  br i1 %56, label %57, label %62

57:                                               ; preds = %54
  %58 = load i32, ptr @closed_servers, align 4, !tbaa !5
  %59 = icmp eq i32 %58, 5000
  br i1 %59, label %60, label %62

60:                                               ; preds = %57
  %61 = call i32 (ptr, ...) @printf(ptr noundef @.str.20)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %4, align 4
  br label %64

62:                                               ; preds = %57, %54, %51, %43
  %63 = call i32 (ptr, ...) @printf(ptr noundef @.str.21)
  store i32 1, ptr %1, align 4
  store i32 1, ptr %4, align 4
  br label %64

64:                                               ; preds = %62, %60
  call void @llvm.lifetime.end.p0(i64 56, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  %65 = load i32, ptr %1, align 4
  ret i32 %65
}

; Function Attrs: nounwind
declare void @srand(i32 noundef) #4

; Function Attrs: nounwind allocsize(0,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #5

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

declare ptr @us_create_socket_context(i32 noundef, ptr noundef, i32 noundef, ptr noundef byval(%struct.us_socket_context_options_t) align 8) #2

declare void @us_socket_context_on_open(i32 noundef, ptr noundef, ptr noundef) #2

declare void @us_socket_context_on_data(i32 noundef, ptr noundef, ptr noundef) #2

declare void @us_socket_context_on_writable(i32 noundef, ptr noundef, ptr noundef) #2

declare void @us_socket_context_on_close(i32 noundef, ptr noundef, ptr noundef) #2

declare void @us_socket_context_on_timeout(i32 noundef, ptr noundef, ptr noundef) #2

declare void @us_socket_context_on_end(i32 noundef, ptr noundef, ptr noundef) #2

declare void @us_socket_context_on_connect_error(i32 noundef, ptr noundef, ptr noundef) #2

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

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

declare void @us_loop_run(ptr noundef) #2

declare void @us_socket_context_free(i32 noundef, ptr noundef) #2

declare void @us_loop_free(ptr noundef) #2

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

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

!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, !10, i64 0}
!12 = !{!"us_socket_context_options_t", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !6, i64 48}
!13 = !{!12, !10, i64 8}
!14 = !{!12, !10, i64 16}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.us_socket_context_options_t = type { ptr, ptr, ptr, ptr, ptr, ptr, i32 }

@long_length = external dso_local local_unnamed_addr global i32, align 4
@websocket_context = external dso_local local_unnamed_addr global ptr, align 8
@http_context = external dso_local local_unnamed_addr global ptr, align 8
@long_buffer = external dso_local local_unnamed_addr global ptr, align 8
@closed_clients = external dso_local local_unnamed_addr global i32, align 4
@closed_servers = external dso_local local_unnamed_addr global i32, align 4
@opened_clients = external dso_local local_unnamed_addr global i32, align 4
@listen_socket = external dso_local local_unnamed_addr global ptr, align 8
@.str.9 = external hidden unnamed_addr constant [17 x i8], align 1
@opened_servers = external dso_local local_unnamed_addr global i32, align 4
@.str.14 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [22 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @print_progress(double noundef) local_unnamed_addr #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

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

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

declare void @us_socket_timeout(i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #4

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

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

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @on_web_socket_close(ptr noundef, i32 noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @on_http_socket_close(ptr noundef, i32 noundef, ptr noundef) #0

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

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @on_web_socket_data(ptr noundef, ptr noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @on_http_socket_data(ptr noundef, ptr noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @on_web_socket_open(ptr noundef, i32 noundef, ptr noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @next_connection() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @on_http_socket_connect_error(ptr noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @on_web_socket_connect_error(ptr noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @on_http_socket_open(ptr noundef, i32 noundef, ptr noundef, i32 noundef) #0

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

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

; Function Attrs: nounwind
declare i64 @time(ptr noundef) local_unnamed_addr #5

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @main() local_unnamed_addr #0 {
  %1 = alloca %struct.us_socket_context_options_t, align 8
  %2 = tail call i64 @time(ptr noundef null) #8
  %3 = trunc i64 %2 to i32
  tail call void @srand(i32 noundef %3) #8
  %4 = load i32, ptr @long_length, align 4, !tbaa !5
  %5 = zext i32 %4 to i64
  %6 = tail call noalias ptr @calloc(i64 noundef %5, i64 noundef 1) #9
  store ptr %6, ptr @long_buffer, align 8, !tbaa !9
  %7 = tail call ptr @us_create_loop(ptr noundef null, ptr noundef nonnull @on_wakeup, ptr noundef nonnull @on_pre, ptr noundef nonnull @on_post, i32 noundef 0) #8
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %1) #8
  %8 = getelementptr inbounds i8, ptr %1, i64 24
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(56) %8, i8 0, i64 32, i1 false)
  store ptr @.str.14, ptr %1, align 8, !tbaa !11
  %9 = getelementptr inbounds i8, ptr %1, i64 8
  store ptr @.str.15, ptr %9, align 8, !tbaa !13
  %10 = getelementptr inbounds i8, ptr %1, i64 16
  store ptr @.str.16, ptr %10, align 8, !tbaa !14
  %11 = tail call ptr @us_create_socket_context(i32 noundef 1, ptr noundef %7, i32 noundef 1, ptr noundef nonnull byval(%struct.us_socket_context_options_t) align 8 %1) #8
  store ptr %11, ptr @http_context, align 8, !tbaa !9
  tail call void @us_socket_context_on_open(i32 noundef 1, ptr noundef %11, ptr noundef nonnull @on_http_socket_open) #8
  %12 = load ptr, ptr @http_context, align 8, !tbaa !9
  tail call void @us_socket_context_on_data(i32 noundef 1, ptr noundef %12, ptr noundef nonnull @on_http_socket_data) #8
  %13 = load ptr, ptr @http_context, align 8, !tbaa !9
  tail call void @us_socket_context_on_writable(i32 noundef 1, ptr noundef %13, ptr noundef nonnull @on_http_socket_writable) #8
  %14 = load ptr, ptr @http_context, align 8, !tbaa !9
  tail call void @us_socket_context_on_close(i32 noundef 1, ptr noundef %14, ptr noundef nonnull @on_http_socket_close) #8
  %15 = load ptr, ptr @http_context, align 8, !tbaa !9
  tail call void @us_socket_context_on_timeout(i32 noundef 1, ptr noundef %15, ptr noundef nonnull @on_http_socket_timeout) #8
  %16 = load ptr, ptr @http_context, align 8, !tbaa !9
  tail call void @us_socket_context_on_end(i32 noundef 1, ptr noundef %16, ptr noundef nonnull @on_http_socket_end) #8
  %17 = load ptr, ptr @http_context, align 8, !tbaa !9
  tail call void @us_socket_context_on_connect_error(i32 noundef 1, ptr noundef %17, ptr noundef nonnull @on_http_socket_connect_error) #8
  %18 = load ptr, ptr @http_context, align 8, !tbaa !9
  %19 = tail call ptr @us_create_child_socket_context(i32 noundef 1, ptr noundef %18, i32 noundef 1) #8
  store ptr %19, ptr @websocket_context, align 8, !tbaa !9
  tail call void @us_socket_context_on_open(i32 noundef 1, ptr noundef %19, ptr noundef nonnull @on_web_socket_open) #8
  %20 = load ptr, ptr @websocket_context, align 8, !tbaa !9
  tail call void @us_socket_context_on_data(i32 noundef 1, ptr noundef %20, ptr noundef nonnull @on_web_socket_data) #8
  %21 = load ptr, ptr @websocket_context, align 8, !tbaa !9
  tail call void @us_socket_context_on_writable(i32 noundef 1, ptr noundef %21, ptr noundef nonnull @on_web_socket_writable) #8
  %22 = load ptr, ptr @websocket_context, align 8, !tbaa !9
  tail call void @us_socket_context_on_close(i32 noundef 1, ptr noundef %22, ptr noundef nonnull @on_web_socket_close) #8
  %23 = load ptr, ptr @websocket_context, align 8, !tbaa !9
  tail call void @us_socket_context_on_timeout(i32 noundef 1, ptr noundef %23, ptr noundef nonnull @on_web_socket_timeout) #8
  %24 = load ptr, ptr @websocket_context, align 8, !tbaa !9
  tail call void @us_socket_context_on_end(i32 noundef 1, ptr noundef %24, ptr noundef nonnull @on_web_socket_end) #8
  %25 = load ptr, ptr @websocket_context, align 8, !tbaa !9
  tail call void @us_socket_context_on_connect_error(i32 noundef 1, ptr noundef %25, ptr noundef nonnull @on_web_socket_connect_error) #8
  %26 = load ptr, ptr @http_context, align 8, !tbaa !9
  %27 = tail call ptr @us_socket_context_listen_unix(i32 noundef 1, ptr noundef %26, ptr noundef nonnull @.str.9, i32 noundef 0, i32 noundef 160) #8
  store ptr %27, ptr @listen_socket, align 8, !tbaa !9
  tail call void @us_socket_timeout(i32 noundef 1, ptr noundef %27, i32 noundef 16) #8
  %28 = load ptr, ptr @listen_socket, align 8, !tbaa !9
  %.not = icmp eq ptr %28, null
  br i1 %.not, label %32, label %29

29:                                               ; preds = %0
  %30 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.17)
  tail call void @print_progress(double noundef 0.000000e+00)
  %31 = tail call ptr @next_connection()
  tail call void @us_loop_run(ptr noundef %7) #8
  br label %34

32:                                               ; preds = %0
  %33 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.18)
  br label %34

34:                                               ; preds = %32, %29
  %35 = load ptr, ptr @websocket_context, align 8, !tbaa !9
  tail call void @us_socket_context_free(i32 noundef 1, ptr noundef %35) #8
  %36 = load ptr, ptr @http_context, align 8, !tbaa !9
  tail call void @us_socket_context_free(i32 noundef 1, ptr noundef %36) #8
  tail call void @us_loop_free(ptr noundef %7) #8
  %37 = load ptr, ptr @long_buffer, align 8, !tbaa !9
  tail call void @free(ptr noundef %37) #8
  tail call void @print_progress(double noundef 1.000000e+00)
  %38 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.19)
  %39 = load i32, ptr @opened_clients, align 4, !tbaa !5
  %40 = icmp ne i32 %39, 5000
  %41 = load i32, ptr @closed_clients, align 4
  %42 = icmp ne i32 %41, 5000
  %or.cond.not13 = select i1 %40, i1 true, i1 %42
  %43 = load i32, ptr @opened_servers, align 4
  %44 = icmp ne i32 %43, 5000
  %or.cond3.not10 = select i1 %or.cond.not13, i1 true, i1 %44
  %45 = load i32, ptr @closed_servers, align 4
  %46 = icmp ne i32 %45, 5000
  %or.cond5.not = select i1 %or.cond3.not10, i1 true, i1 %46
  %.str.20..str.21 = select i1 %or.cond5.not, ptr @.str.21, ptr @.str.20
  %. = zext i1 %or.cond5.not to i32
  %47 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.20..str.21)
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %1) #8
  ret i32 %.
}

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

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #6

declare ptr @us_create_loop(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #4

declare ptr @us_create_socket_context(i32 noundef, ptr noundef, i32 noundef, ptr noundef byval(%struct.us_socket_context_options_t) align 8) local_unnamed_addr #4

declare void @us_socket_context_on_open(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

declare void @us_socket_context_on_data(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

declare void @us_socket_context_on_writable(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

declare void @us_socket_context_on_close(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

declare void @us_socket_context_on_timeout(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

declare void @us_socket_context_on_end(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

declare void @us_socket_context_on_connect_error(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

declare ptr @us_create_child_socket_context(i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #4

declare ptr @us_socket_context_listen_unix(i32 noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #4

declare void @us_loop_run(ptr noundef) local_unnamed_addr #4

declare void @us_socket_context_free(i32 noundef, ptr noundef) local_unnamed_addr #4

declare void @us_loop_free(ptr noundef) local_unnamed_addr #4

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

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

!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, !10, i64 0}
!12 = !{!"us_socket_context_options_t", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !6, i64 48}
!13 = !{!12, !10, i64 8}
!14 = !{!12, !10, i64 16}


; Effective O3 passes: DSEPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass