; LLVM IR from ohler55/agoo :: ext/agoo (con)

; 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._agooServer = type { i8, i8, i32, i8, i8, i8, i8, i64, %struct._agooQueue, ptr, ptr, ptr, %struct._agooQueue, ptr, i32, i32, %struct._agooAtom, ptr, ptr, %union.pthread_mutex_t, i32, ptr, ptr, %struct._agooAtom }
%struct._agooQueue = type { ptr, ptr, %struct._agooAtom, %struct._agooAtom, i8, i8, %struct._agooAtom, %struct._agooAtom, %struct._agooAtom, i32, i32 }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%struct._agooAtom = type { ptr, %union.pthread_mutex_t }
%struct._agooLogCat = type { ptr, [32 x i8], ptr, i32, i8 }
%struct._agooHandler = type { ptr, ptr, ptr, ptr, ptr, ptr }
%struct._agooErr = type { i32, [256 x i8] }
%struct._agooConLoop = type { ptr, %struct._agooQueue, i64, i32, ptr, ptr, %union.pthread_mutex_t }
%struct._agooCon = type { ptr, i32, ptr, ptr, i64, [46 x i8], [8192 x i8], i64, i64, i64, double, i8, i8, i8, ptr, ptr, ptr, %union.pthread_mutex_t, ptr, ptr, ptr }
%struct._agooBind = type { ptr, i32, i32, i16, %union.anon.0, ptr, ptr, ptr, ptr, ptr, i32 }
%union.anon.0 = type { %struct.in6_addr }
%struct.in6_addr = type { %union.anon }
%union.anon = type { [4 x i32] }

@agoo_server = external global %struct._agooServer, align 8
@agoo_error_cat = external global %struct._agooLogCat, align 8
@.str.12 = external hidden unnamed_addr constant [40 x i8], align 1
@con_queue_handler = external hidden global %struct._agooHandler, align 8
@pub_queue_handler = external hidden global %struct._agooHandler, align 8
@.str.13 = external hidden unnamed_addr constant [46 x i8], align 1
@con_handler = external hidden global %struct._agooHandler, align 8
@.str.14 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [13 x i8], align 1

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @atomic_fetch_sub(ptr noundef, i32 noundef) #1

declare void @agoo_log_cat(ptr noundef, ptr noundef, ...) #2

; Function Attrs: nounwind uwtable
define dso_local ptr @agoo_con_loop(ptr noundef %0) #3 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca %struct._agooErr, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  %10 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %10, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 260, ptr %4) #6
  call void @llvm.memset.p0.i64(ptr align 4 %4, i8 0, i64 260, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  %11 = call ptr @agoo_ready_create(ptr noundef %4)
  store ptr %11, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %12 = call i32 @agoo_queue_listen(ptr noundef getelementptr inbounds (%struct._agooServer, ptr @agoo_server, i32 0, i32 8))
  store i32 %12, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct._agooConLoop, ptr %13, i32 0, i32 1
  %15 = call i32 @agoo_queue_listen(ptr noundef %14)
  store i32 %15, ptr %9, align 4, !tbaa !9
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = icmp eq ptr null, %16
  br i1 %17, label %18, label %21

18:                                               ; preds = %1
  %19 = getelementptr inbounds %struct._agooErr, ptr %4, i32 0, i32 1
  %20 = getelementptr inbounds [256 x i8], ptr %19, i64 0, i64 0
  call void (ptr, ptr, ...) @agoo_log_cat(ptr noundef @agoo_error_cat, ptr noundef @.str.12, ptr noundef %20)
  call void @exit(i32 noundef 1) #7
  unreachable

21:                                               ; preds = %1
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = load i32, ptr %8, align 4, !tbaa !9
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = call i32 @agoo_ready_add(ptr noundef %4, ptr noundef %22, i32 noundef %23, ptr noundef @con_queue_handler, ptr noundef %24)
  %26 = icmp ne i32 0, %25
  br i1 %26, label %33, label %27

27:                                               ; preds = %21
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = load i32, ptr %9, align 4, !tbaa !9
  %30 = load ptr, ptr %3, align 8, !tbaa !5
  %31 = call i32 @agoo_ready_add(ptr noundef %4, ptr noundef %28, i32 noundef %29, ptr noundef @pub_queue_handler, ptr noundef %30)
  %32 = icmp ne i32 0, %31
  br i1 %32, label %33, label %36

33:                                               ; preds = %27, %21
  %34 = getelementptr inbounds %struct._agooErr, ptr %4, i32 0, i32 1
  %35 = getelementptr inbounds [256 x i8], ptr %34, i64 0, i64 0
  call void (ptr, ptr, ...) @agoo_log_cat(ptr noundef @agoo_error_cat, ptr noundef @.str.13, ptr noundef %35)
  call void @exit(i32 noundef 1) #7
  unreachable

36:                                               ; preds = %27
  %37 = call i32 @atomic_fetch_add(ptr noundef getelementptr inbounds (%struct._agooServer, ptr @agoo_server, i32 0, i32 23), i32 noundef 1)
  br label %38

38:                                               ; preds = %85, %36
  %39 = load volatile i8, ptr getelementptr inbounds (%struct._agooServer, ptr @agoo_server, i32 0, i32 1), align 1, !tbaa !11, !range !17, !noundef !18
  %40 = trunc i8 %39 to i1
  br i1 %40, label %41, label %86

41:                                               ; preds = %38
  br label %42

42:                                               ; preds = %68, %41
  %43 = call ptr @agoo_queue_pop(ptr noundef getelementptr inbounds (%struct._agooServer, ptr @agoo_server, i32 0, i32 8), double noundef 0.000000e+00)
  store ptr %43, ptr %7, align 8, !tbaa !5
  %44 = icmp ne ptr null, %43
  br i1 %44, label %45, label %69

45:                                               ; preds = %42
  %46 = load ptr, ptr %3, align 8, !tbaa !5
  %47 = load ptr, ptr %7, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct._agooCon, ptr %47, i32 0, i32 20
  store ptr %46, ptr %48, align 8, !tbaa !19
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct._agooCon, ptr %50, i32 0, i32 1
  %52 = load i32, ptr %51, align 8, !tbaa !22
  %53 = load ptr, ptr %7, align 8, !tbaa !5
  %54 = call i32 @agoo_ready_add(ptr noundef %4, ptr noundef %49, i32 noundef %52, ptr noundef @con_handler, ptr noundef %53)
  %55 = icmp ne i32 0, %54
  br i1 %55, label %56, label %59

56:                                               ; preds = %45
  %57 = getelementptr inbounds %struct._agooErr, ptr %4, i32 0, i32 1
  %58 = getelementptr inbounds [256 x i8], ptr %57, i64 0, i64 0
  call void (ptr, ptr, ...) @agoo_log_cat(ptr noundef @agoo_error_cat, ptr noundef @.str.14, ptr noundef %58)
  call void @agoo_err_clear(ptr noundef %4)
  br label %59

59:                                               ; preds = %56, %45
  %60 = load ptr, ptr %7, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct._agooCon, ptr %60, i32 0, i32 2
  %62 = load ptr, ptr %61, align 8, !tbaa !23
  %63 = getelementptr inbounds %struct._agooBind, ptr %62, i32 0, i32 10
  %64 = load i32, ptr %63, align 8, !tbaa !24
  %65 = icmp eq i32 84, %64
  br i1 %65, label %66, label %68

66:                                               ; preds = %59
  %67 = load ptr, ptr %7, align 8, !tbaa !5
  call void @con_ssl_setup(ptr noundef %67)
  br label %68

68:                                               ; preds = %66, %59
  br label %42, !llvm.loop !27

69:                                               ; preds = %42
  br label %70

70:                                               ; preds = %75, %69
  %71 = load ptr, ptr %3, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct._agooConLoop, ptr %71, i32 0, i32 1
  %73 = call ptr @agoo_queue_pop(ptr noundef %72, double noundef 0.000000e+00)
  store ptr %73, ptr %6, align 8, !tbaa !5
  %74 = icmp ne ptr null, %73
  br i1 %74, label %75, label %78

75:                                               ; preds = %70
  %76 = load ptr, ptr %6, align 8, !tbaa !5
  %77 = load ptr, ptr %3, align 8, !tbaa !5
  call void @process_pub_con(ptr noundef %76, ptr noundef %77)
  br label %70, !llvm.loop !29

78:                                               ; preds = %70
  %79 = load ptr, ptr %5, align 8, !tbaa !5
  %80 = call i32 @agoo_ready_go(ptr noundef %4, ptr noundef %79)
  %81 = icmp ne i32 0, %80
  br i1 %81, label %82, label %85

82:                                               ; preds = %78
  %83 = getelementptr inbounds %struct._agooErr, ptr %4, i32 0, i32 1
  %84 = getelementptr inbounds [256 x i8], ptr %83, i64 0, i64 0
  call void (ptr, ptr, ...) @agoo_log_cat(ptr noundef @agoo_error_cat, ptr noundef @.str.15, ptr noundef %84)
  call void @agoo_err_clear(ptr noundef %4)
  br label %85

85:                                               ; preds = %82, %78
  br label %38, !llvm.loop !30

86:                                               ; preds = %38
  %87 = load ptr, ptr %5, align 8, !tbaa !5
  call void @agoo_ready_destroy(ptr noundef %87)
  %88 = call i32 @atomic_fetch_sub(ptr noundef getelementptr inbounds (%struct._agooServer, ptr @agoo_server, i32 0, i32 23), i32 noundef 1)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 260, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  ret ptr null
}

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

declare ptr @agoo_ready_create(ptr noundef) #2

declare i32 @agoo_queue_listen(ptr noundef) #2

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @atomic_fetch_add(ptr noundef, i32 noundef) #1

declare ptr @agoo_queue_pop(ptr noundef, double noundef) #2

declare void @agoo_err_clear(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @con_ssl_setup(ptr noundef) #3

; Function Attrs: nounwind uwtable
declare hidden void @process_pub_con(ptr noundef, ptr noundef) #3

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

declare void @agoo_ready_destroy(ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { 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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !13, i64 1}
!12 = !{!"_agooServer", !13, i64 0, !13, i64 1, !10, i64 4, !13, i64 8, !13, i64 9, !13, i64 10, !13, i64 11, !14, i64 16, !15, i64 24, !6, i64 296, !6, i64 304, !6, i64 312, !15, i64 320, !6, i64 592, !10, i64 600, !10, i64 604, !16, i64 608, !6, i64 656, !6, i64 664, !7, i64 672, !10, i64 712, !6, i64 720, !6, i64 728, !16, i64 736}
!13 = !{!"_Bool", !7, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!"_agooQueue", !6, i64 0, !6, i64 8, !16, i64 16, !16, i64 64, !13, i64 112, !13, i64 113, !16, i64 120, !16, i64 168, !16, i64 216, !10, i64 264, !10, i64 268}
!16 = !{!"_agooAtom", !6, i64 0, !7, i64 8}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = !{!20, !6, i64 8400}
!20 = !{!"_agooCon", !6, i64 0, !10, i64 8, !6, i64 16, !6, i64 24, !14, i64 32, !7, i64 40, !7, i64 86, !14, i64 8280, !14, i64 8288, !14, i64 8296, !21, i64 8304, !13, i64 8312, !13, i64 8313, !13, i64 8314, !6, i64 8320, !6, i64 8328, !6, i64 8336, !7, i64 8344, !6, i64 8384, !6, i64 8392, !6, i64 8400}
!21 = !{!"double", !7, i64 0}
!22 = !{!20, !10, i64 8}
!23 = !{!20, !6, i64 16}
!24 = !{!25, !10, i64 80}
!25 = !{!"_agooBind", !6, i64 0, !10, i64 8, !10, i64 12, !26, i64 16, !7, i64 20, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !10, i64 80}
!26 = !{!"short", !7, i64 0}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}
!29 = distinct !{!29, !28}
!30 = distinct !{!30, !28}


; 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._agooServer = type { i8, i8, i32, i8, i8, i8, i8, i64, %struct._agooQueue, ptr, ptr, ptr, %struct._agooQueue, ptr, i32, i32, %struct._agooAtom, ptr, ptr, %union.pthread_mutex_t, i32, ptr, ptr, %struct._agooAtom }
%struct._agooQueue = type { ptr, ptr, %struct._agooAtom, %struct._agooAtom, i8, i8, %struct._agooAtom, %struct._agooAtom, %struct._agooAtom, i32, i32 }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%struct._agooAtom = type { ptr, %union.pthread_mutex_t }
%struct._agooLogCat = type { ptr, [32 x i8], ptr, i32, i8 }
%struct._agooHandler = type { ptr, ptr, ptr, ptr, ptr, ptr }
%struct._agooErr = type { i32, [256 x i8] }

@agoo_server = external global %struct._agooServer, align 8
@agoo_error_cat = external global %struct._agooLogCat, align 8
@.str.12 = external hidden unnamed_addr constant [40 x i8], align 1
@con_queue_handler = external hidden global %struct._agooHandler, align 8
@pub_queue_handler = external hidden global %struct._agooHandler, align 8
@.str.13 = external hidden unnamed_addr constant [46 x i8], align 1
@con_handler = external hidden global %struct._agooHandler, align 8
@.str.14 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [13 x i8], align 1

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @atomic_fetch_sub(ptr noundef, i32 noundef) local_unnamed_addr #1

declare void @agoo_log_cat(ptr noundef, ptr noundef, ...) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local noalias noundef ptr @agoo_con_loop(ptr noundef %0) local_unnamed_addr #3 {
  %2 = alloca %struct._agooErr, align 4
  call void @llvm.lifetime.start.p0(i64 260, ptr nonnull %2) #6
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(260) %2, i8 0, i64 260, i1 false)
  %3 = call ptr @agoo_ready_create(ptr noundef nonnull %2) #6
  %4 = call i32 @agoo_queue_listen(ptr noundef nonnull getelementptr inbounds (i8, ptr @agoo_server, i64 24)) #6
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  %6 = call i32 @agoo_queue_listen(ptr noundef nonnull %5) #6
  %7 = icmp eq ptr %3, null
  br i1 %7, label %8, label %10

8:                                                ; preds = %1
  %9 = getelementptr inbounds i8, ptr %2, i64 4
  call void (ptr, ptr, ...) @agoo_log_cat(ptr noundef nonnull @agoo_error_cat, ptr noundef nonnull @.str.12, ptr noundef nonnull %9) #6
  call void @exit(i32 noundef 1) #7
  unreachable

10:                                               ; preds = %1
  %11 = call i32 @agoo_ready_add(ptr noundef nonnull %2, ptr noundef nonnull %3, i32 noundef %4, ptr noundef nonnull @con_queue_handler, ptr noundef %0) #6
  %.not = icmp eq i32 %11, 0
  br i1 %.not, label %12, label %14

12:                                               ; preds = %10
  %13 = call i32 @agoo_ready_add(ptr noundef nonnull %2, ptr noundef nonnull %3, i32 noundef %6, ptr noundef nonnull @pub_queue_handler, ptr noundef %0) #6
  %.not22 = icmp eq i32 %13, 0
  br i1 %.not22, label %16, label %14

14:                                               ; preds = %12, %10
  %15 = getelementptr inbounds i8, ptr %2, i64 4
  call void (ptr, ptr, ...) @agoo_log_cat(ptr noundef nonnull @agoo_error_cat, ptr noundef nonnull @.str.13, ptr noundef nonnull %15) #6
  call void @exit(i32 noundef 1) #7
  unreachable

16:                                               ; preds = %12
  %17 = call i32 @atomic_fetch_add(ptr noundef nonnull getelementptr inbounds (i8, ptr @agoo_server, i64 736), i32 noundef 1)
  %18 = load volatile i8, ptr getelementptr inbounds (i8, ptr @agoo_server, i64 1), align 1, !tbaa !5, !range !15, !noundef !16
  %19 = trunc nuw i8 %18 to i1
  br i1 %19, label %.preheader27.lr.ph, label %._crit_edge31

.preheader27.lr.ph:                               ; preds = %16
  %20 = getelementptr inbounds i8, ptr %2, i64 4
  br label %.preheader27

.preheader27:                                     ; preds = %.preheader27.lr.ph, %42
  %21 = call ptr @agoo_queue_pop(ptr noundef nonnull getelementptr inbounds (i8, ptr @agoo_server, i64 24), double noundef 0.000000e+00) #6
  %.not2328 = icmp eq ptr %21, null
  br i1 %.not2328, label %.preheader, label %.lr.ph

.preheader:                                       ; preds = %36, %.preheader27
  %22 = call ptr @agoo_queue_pop(ptr noundef nonnull %5, double noundef 0.000000e+00) #6
  %.not2429 = icmp eq ptr %22, null
  br i1 %.not2429, label %._crit_edge, label %.lr.ph30

.lr.ph:                                           ; preds = %.preheader27, %36
  %23 = phi ptr [ %37, %36 ], [ %21, %.preheader27 ]
  %24 = getelementptr inbounds i8, ptr %23, i64 8400
  store ptr %0, ptr %24, align 8, !tbaa !17
  %25 = getelementptr inbounds i8, ptr %23, i64 8
  %26 = load i32, ptr %25, align 8, !tbaa !20
  %27 = call i32 @agoo_ready_add(ptr noundef nonnull %2, ptr noundef nonnull %3, i32 noundef %26, ptr noundef nonnull @con_handler, ptr noundef nonnull %23) #6
  %.not26 = icmp eq i32 %27, 0
  br i1 %.not26, label %29, label %28

28:                                               ; preds = %.lr.ph
  call void (ptr, ptr, ...) @agoo_log_cat(ptr noundef nonnull @agoo_error_cat, ptr noundef nonnull @.str.14, ptr noundef nonnull %20) #6
  call void @agoo_err_clear(ptr noundef nonnull %2) #6
  br label %29

29:                                               ; preds = %28, %.lr.ph
  %30 = getelementptr inbounds i8, ptr %23, i64 16
  %31 = load ptr, ptr %30, align 8, !tbaa !21
  %32 = getelementptr inbounds i8, ptr %31, i64 80
  %33 = load i32, ptr %32, align 8, !tbaa !22
  %34 = icmp eq i32 %33, 84
  br i1 %34, label %35, label %36

35:                                               ; preds = %29
  call void @con_ssl_setup(ptr noundef nonnull %23)
  br label %36

36:                                               ; preds = %35, %29
  %37 = call ptr @agoo_queue_pop(ptr noundef nonnull getelementptr inbounds (i8, ptr @agoo_server, i64 24), double noundef 0.000000e+00) #6
  %.not23 = icmp eq ptr %37, null
  br i1 %.not23, label %.preheader, label %.lr.ph, !llvm.loop !25

.lr.ph30:                                         ; preds = %.preheader, %.lr.ph30
  %38 = phi ptr [ %39, %.lr.ph30 ], [ %22, %.preheader ]
  call void @process_pub_con(ptr noundef nonnull %38, ptr noundef %0)
  %39 = call ptr @agoo_queue_pop(ptr noundef nonnull %5, double noundef 0.000000e+00) #6
  %.not24 = icmp eq ptr %39, null
  br i1 %.not24, label %._crit_edge, label %.lr.ph30, !llvm.loop !27

._crit_edge:                                      ; preds = %.lr.ph30, %.preheader
  %40 = call i32 @agoo_ready_go(ptr noundef nonnull %2, ptr noundef nonnull %3) #6
  %.not25 = icmp eq i32 %40, 0
  br i1 %.not25, label %42, label %41

41:                                               ; preds = %._crit_edge
  call void (ptr, ptr, ...) @agoo_log_cat(ptr noundef nonnull @agoo_error_cat, ptr noundef nonnull @.str.15, ptr noundef nonnull %20) #6
  call void @agoo_err_clear(ptr noundef nonnull %2) #6
  br label %42

42:                                               ; preds = %41, %._crit_edge
  %43 = load volatile i8, ptr getelementptr inbounds (i8, ptr @agoo_server, i64 1), align 1, !tbaa !5, !range !15, !noundef !16
  %44 = trunc nuw i8 %43 to i1
  br i1 %44, label %.preheader27, label %._crit_edge31, !llvm.loop !28

._crit_edge31:                                    ; preds = %42, %16
  call void @agoo_ready_destroy(ptr noundef nonnull %3) #6
  %45 = call i32 @atomic_fetch_sub(ptr noundef nonnull getelementptr inbounds (i8, ptr @agoo_server, i64 736), i32 noundef 1)
  call void @llvm.lifetime.end.p0(i64 260, ptr nonnull %2) #6
  ret ptr null
}

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

declare ptr @agoo_ready_create(ptr noundef) local_unnamed_addr #2

declare i32 @agoo_queue_listen(ptr noundef) local_unnamed_addr #2

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

declare i32 @agoo_ready_add(ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @atomic_fetch_add(ptr noundef, i32 noundef) local_unnamed_addr #1

declare ptr @agoo_queue_pop(ptr noundef, double noundef) local_unnamed_addr #2

declare void @agoo_err_clear(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden void @con_ssl_setup(ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare hidden void @process_pub_con(ptr noundef, ptr noundef) local_unnamed_addr #3

declare i32 @agoo_ready_go(ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @agoo_ready_destroy(ptr noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { 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, !7, i64 1}
!6 = !{!"_agooServer", !7, i64 0, !7, i64 1, !10, i64 4, !7, i64 8, !7, i64 9, !7, i64 10, !7, i64 11, !11, i64 16, !12, i64 24, !13, i64 296, !13, i64 304, !13, i64 312, !12, i64 320, !13, i64 592, !10, i64 600, !10, i64 604, !14, i64 608, !13, i64 656, !13, i64 664, !8, i64 672, !10, i64 712, !13, i64 720, !13, i64 728, !14, i64 736}
!7 = !{!"_Bool", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"long", !8, i64 0}
!12 = !{!"_agooQueue", !13, i64 0, !13, i64 8, !14, i64 16, !14, i64 64, !7, i64 112, !7, i64 113, !14, i64 120, !14, i64 168, !14, i64 216, !10, i64 264, !10, i64 268}
!13 = !{!"any pointer", !8, i64 0}
!14 = !{!"_agooAtom", !13, i64 0, !8, i64 8}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = !{!18, !13, i64 8400}
!18 = !{!"_agooCon", !13, i64 0, !10, i64 8, !13, i64 16, !13, i64 24, !11, i64 32, !8, i64 40, !8, i64 86, !11, i64 8280, !11, i64 8288, !11, i64 8296, !19, i64 8304, !7, i64 8312, !7, i64 8313, !7, i64 8314, !13, i64 8320, !13, i64 8328, !13, i64 8336, !8, i64 8344, !13, i64 8384, !13, i64 8392, !13, i64 8400}
!19 = !{!"double", !8, i64 0}
!20 = !{!18, !10, i64 8}
!21 = !{!18, !13, i64 16}
!22 = !{!23, !10, i64 80}
!23 = !{!"_agooBind", !13, i64 0, !10, i64 8, !10, i64 12, !24, i64 16, !8, i64 20, !13, i64 40, !13, i64 48, !13, i64 56, !13, i64 64, !13, i64 72, !10, i64 80}
!24 = !{!"short", !8, i64 0}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}
!27 = distinct !{!27, !26}
!28 = distinct !{!28, !26}


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