; 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._agooLogCat = type { ptr, [32 x i8], ptr, i32, i8 }
%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 }
%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._agooText = type { ptr, i64, i64, %struct._agooAtom, i8, [8 x i8] }
%struct._agooAtom = type { ptr, %union.pthread_mutex_t }
%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] }
%struct._agooRes = type { ptr, ptr, ptr, %union.pthread_mutex_t, i8, i32, i8, i8, i8 }

@con_timeout = external dso_local global double, align 8
@agoo_error_cat = external global %struct._agooLogCat, align 8
@.str.3 = external hidden unnamed_addr constant [31 x i8], align 1
@agoo_debug_cat = external global %struct._agooLogCat, align 8
@agoo_resp_cat = external global %struct._agooLogCat, align 8
@.str.8 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [21 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

declare double @dtime() #1

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

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

declare ptr @agoo_con_kind_str(i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @agoo_con_http_write(ptr noundef %0) #3 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca [4096 x i8], align 16
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i8, align 1
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = call ptr @agoo_con_res_pop(ptr noundef %12)
  store ptr %13, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = call ptr @agoo_res_message_peek(ptr noundef %14)
  store ptr %15, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  store i64 0, ptr %6, align 8, !tbaa !9
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = icmp eq ptr null, %16
  br i1 %17, label %18, label %19

18:                                               ; preds = %1
  store i1 true, ptr %2, align 1
  store i32 1, ptr %7, align 4
  br label %193

19:                                               ; preds = %1
  %20 = call double @dtime()
  %21 = load double, ptr @con_timeout, align 8, !tbaa !11
  %22 = fadd double %20, %21
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct._agooCon, ptr %23, i32 0, i32 10
  store double %22, ptr %24, align 8, !tbaa !13
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct._agooCon, ptr %25, i32 0, i32 9
  %27 = load i64, ptr %26, align 8, !tbaa !17
  %28 = icmp eq i64 0, %27
  br i1 %28, label %29, label %109

29:                                               ; preds = %19
  %30 = load i8, ptr getelementptr inbounds (%struct._agooLogCat, ptr @agoo_resp_cat, i32 0, i32 4), align 4, !tbaa !18, !range !20, !noundef !21
  %31 = trunc i8 %30 to i1
  br i1 %31, label %32, label %92

32:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4096, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct._agooText, ptr %33, i32 0, i32 5
  %35 = getelementptr inbounds [8 x i8], ptr %34, i64 0, i64 0
  %36 = call ptr @strstr(ptr noundef %35, ptr noundef @.str.8) #7
  store ptr %36, ptr %9, align 8, !tbaa !5
  %37 = load ptr, ptr %9, align 8, !tbaa !5
  %38 = icmp eq ptr null, %37
  br i1 %38, label %39, label %47

39:                                               ; preds = %32
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct._agooText, ptr %40, i32 0, i32 5
  %42 = getelementptr inbounds [8 x i8], ptr %41, i64 0, i64 0
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct._agooText, ptr %43, i32 0, i32 1
  %45 = load i64, ptr %44, align 8, !tbaa !22
  %46 = getelementptr inbounds i8, ptr %42, i64 %45
  store ptr %46, ptr %9, align 8, !tbaa !5
  br label %47

47:                                               ; preds = %39, %32
  %48 = load ptr, ptr %9, align 8, !tbaa !5
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct._agooText, ptr %49, i32 0, i32 5
  %51 = getelementptr inbounds [8 x i8], ptr %50, i64 0, i64 0
  %52 = ptrtoint ptr %48 to i64
  %53 = ptrtoint ptr %51 to i64
  %54 = sub i64 %52, %53
  %55 = icmp sle i64 4096, %54
  br i1 %55, label %56, label %62

56:                                               ; preds = %47
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct._agooText, ptr %57, i32 0, i32 5
  %59 = getelementptr inbounds [8 x i8], ptr %58, i64 0, i64 0
  %60 = getelementptr inbounds i8, ptr %59, i64 4096
  %61 = getelementptr inbounds i8, ptr %60, i64 -1
  store ptr %61, ptr %9, align 8, !tbaa !5
  br label %62

62:                                               ; preds = %56, %47
  %63 = getelementptr inbounds [4096 x i8], ptr %8, i64 0, i64 0
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct._agooText, ptr %64, i32 0, i32 5
  %66 = getelementptr inbounds [8 x i8], ptr %65, i64 0, i64 0
  %67 = load ptr, ptr %9, align 8, !tbaa !5
  %68 = load ptr, ptr %5, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct._agooText, ptr %68, i32 0, i32 5
  %70 = getelementptr inbounds [8 x i8], ptr %69, i64 0, i64 0
  %71 = ptrtoint ptr %67 to i64
  %72 = ptrtoint ptr %70 to i64
  %73 = sub i64 %71, %72
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %63, ptr align 1 %66, i64 %73, i1 false)
  %74 = load ptr, ptr %9, align 8, !tbaa !5
  %75 = load ptr, ptr %5, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct._agooText, ptr %75, i32 0, i32 5
  %77 = getelementptr inbounds [8 x i8], ptr %76, i64 0, i64 0
  %78 = ptrtoint ptr %74 to i64
  %79 = ptrtoint ptr %77 to i64
  %80 = sub i64 %78, %79
  %81 = getelementptr inbounds [4096 x i8], ptr %8, i64 0, i64 %80
  store i8 0, ptr %81, align 1, !tbaa !25
  %82 = load ptr, ptr %3, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct._agooCon, ptr %82, i32 0, i32 2
  %84 = load ptr, ptr %83, align 8, !tbaa !26
  %85 = getelementptr inbounds %struct._agooBind, ptr %84, i32 0, i32 10
  %86 = load i32, ptr %85, align 8, !tbaa !27
  %87 = call ptr @agoo_con_kind_str(i32 noundef %86)
  %88 = load ptr, ptr %3, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct._agooCon, ptr %88, i32 0, i32 4
  %90 = load i64, ptr %89, align 8, !tbaa !30
  %91 = getelementptr inbounds [4096 x i8], ptr %8, i64 0, i64 0
  call void (ptr, ptr, ...) @agoo_log_cat(ptr noundef @agoo_resp_cat, ptr noundef @.str.9, ptr noundef %87, i64 noundef %90, ptr noundef %91)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4096, ptr %8) #6
  br label %92

92:                                               ; preds = %62, %29
  %93 = load i8, ptr getelementptr inbounds (%struct._agooLogCat, ptr @agoo_debug_cat, i32 0, i32 4), align 4, !tbaa !18, !range !20, !noundef !21
  %94 = trunc i8 %93 to i1
  br i1 %94, label %95, label %108

95:                                               ; preds = %92
  %96 = load ptr, ptr %3, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct._agooCon, ptr %96, i32 0, i32 2
  %98 = load ptr, ptr %97, align 8, !tbaa !26
  %99 = getelementptr inbounds %struct._agooBind, ptr %98, i32 0, i32 10
  %100 = load i32, ptr %99, align 8, !tbaa !27
  %101 = call ptr @agoo_con_kind_str(i32 noundef %100)
  %102 = load ptr, ptr %3, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct._agooCon, ptr %102, i32 0, i32 4
  %104 = load i64, ptr %103, align 8, !tbaa !30
  %105 = load ptr, ptr %5, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct._agooText, ptr %105, i32 0, i32 5
  %107 = getelementptr inbounds [8 x i8], ptr %106, i64 0, i64 0
  call void (ptr, ptr, ...) @agoo_log_cat(ptr noundef @agoo_debug_cat, ptr noundef @.str.10, ptr noundef %101, i64 noundef %104, ptr noundef %107)
  br label %108

108:                                              ; preds = %95, %92
  br label %109

109:                                              ; preds = %108, %19
  %110 = load ptr, ptr %3, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct._agooCon, ptr %110, i32 0, i32 2
  %112 = load ptr, ptr %111, align 8, !tbaa !26
  %113 = getelementptr inbounds %struct._agooBind, ptr %112, i32 0, i32 10
  %114 = load i32, ptr %113, align 8, !tbaa !27
  %115 = icmp eq i32 84, %114
  br i1 %115, label %116, label %119

116:                                              ; preds = %109
  call void (ptr, ptr, ...) @agoo_log_cat(ptr noundef @agoo_error_cat, ptr noundef @.str.3)
  %117 = load ptr, ptr %3, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct._agooCon, ptr %117, i32 0, i32 12
  store i8 1, ptr %118, align 1, !tbaa !31
  br label %151

119:                                              ; preds = %109
  %120 = load ptr, ptr %3, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct._agooCon, ptr %120, i32 0, i32 1
  %122 = load i32, ptr %121, align 8, !tbaa !32
  %123 = load ptr, ptr %5, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct._agooText, ptr %123, i32 0, i32 5
  %125 = getelementptr inbounds [8 x i8], ptr %124, i64 0, i64 0
  %126 = load ptr, ptr %3, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct._agooCon, ptr %126, i32 0, i32 9
  %128 = load i64, ptr %127, align 8, !tbaa !17
  %129 = getelementptr inbounds i8, ptr %125, i64 %128
  %130 = load ptr, ptr %5, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct._agooText, ptr %130, i32 0, i32 1
  %132 = load i64, ptr %131, align 8, !tbaa !22
  %133 = load ptr, ptr %3, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct._agooCon, ptr %133, i32 0, i32 9
  %135 = load i64, ptr %134, align 8, !tbaa !17
  %136 = sub nsw i64 %132, %135
  %137 = call i64 @send(i32 noundef %122, ptr noundef %129, i64 noundef %136, i32 noundef 64)
  store i64 %137, ptr %6, align 8, !tbaa !9
  %138 = icmp sgt i64 0, %137
  br i1 %138, label %139, label %150

139:                                              ; preds = %119
  %140 = call ptr @__errno_location() #8
  %141 = load i32, ptr %140, align 4, !tbaa !33
  %142 = icmp eq i32 11, %141
  br i1 %142, label %143, label %144

143:                                              ; preds = %139
  store i1 true, ptr %2, align 1
  store i32 1, ptr %7, align 4
  br label %193

144:                                              ; preds = %139
  %145 = load ptr, ptr %3, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct._agooCon, ptr %145, i32 0, i32 4
  %147 = load i64, ptr %146, align 8, !tbaa !30
  call void (ptr, ptr, ...) @agoo_log_cat(ptr noundef @agoo_error_cat, ptr noundef @.str.11, i64 noundef %147)
  %148 = load ptr, ptr %3, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct._agooCon, ptr %148, i32 0, i32 12
  store i8 1, ptr %149, align 1, !tbaa !31
  store i1 false, ptr %2, align 1
  store i32 1, ptr %7, align 4
  br label %193

150:                                              ; preds = %119
  br label %151

151:                                              ; preds = %150, %116
  %152 = load i64, ptr %6, align 8, !tbaa !9
  %153 = load ptr, ptr %3, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct._agooCon, ptr %153, i32 0, i32 9
  %155 = load i64, ptr %154, align 8, !tbaa !17
  %156 = add nsw i64 %155, %152
  store i64 %156, ptr %154, align 8, !tbaa !17
  %157 = load ptr, ptr %3, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct._agooCon, ptr %157, i32 0, i32 9
  %159 = load i64, ptr %158, align 8, !tbaa !17
  %160 = load ptr, ptr %5, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct._agooText, ptr %160, i32 0, i32 1
  %162 = load i64, ptr %161, align 8, !tbaa !22
  %163 = icmp eq i64 %159, %162
  br i1 %163, label %164, label %190

164:                                              ; preds = %151
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %165 = load ptr, ptr %4, align 8, !tbaa !5
  %166 = call ptr @agoo_res_message_next(ptr noundef %165)
  store ptr %166, ptr %10, align 8, !tbaa !5
  %167 = load ptr, ptr %3, align 8, !tbaa !5
  %168 = getelementptr inbounds %struct._agooCon, ptr %167, i32 0, i32 9
  store i64 0, ptr %168, align 8, !tbaa !17
  %169 = load ptr, ptr %10, align 8, !tbaa !5
  %170 = icmp eq ptr null, %169
  br i1 %170, label %171, label %186

171:                                              ; preds = %164
  %172 = load ptr, ptr %4, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct._agooRes, ptr %172, i32 0, i32 4
  %174 = load volatile i8, ptr %173, align 8, !tbaa !34, !range !20, !noundef !21
  %175 = trunc i8 %174 to i1
  br i1 %175, label %176, label %186

176:                                              ; preds = %171
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #6
  %177 = load ptr, ptr %4, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct._agooRes, ptr %177, i32 0, i32 6
  %179 = load i8, ptr %178, align 8, !tbaa !36, !range !20, !noundef !21
  %180 = trunc i8 %179 to i1
  %181 = zext i1 %180 to i8
  store i8 %181, ptr %11, align 1, !tbaa !37
  %182 = load ptr, ptr %4, align 8, !tbaa !5
  call void @agoo_res_destroy(ptr noundef %182)
  %183 = load i8, ptr %11, align 1, !tbaa !37, !range !20, !noundef !21
  %184 = trunc i8 %183 to i1
  %185 = xor i1 %184, true
  store i1 %185, ptr %2, align 1
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #6
  br label %187

186:                                              ; preds = %171, %164
  store i32 0, ptr %7, align 4
  br label %187

187:                                              ; preds = %186, %176
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  %188 = load i32, ptr %7, align 4
  switch i32 %188, label %193 [
    i32 0, label %189
  ]

189:                                              ; preds = %187
  br label %190

190:                                              ; preds = %189, %151
  %191 = load ptr, ptr %3, align 8, !tbaa !5
  %192 = load ptr, ptr %4, align 8, !tbaa !5
  call void @agoo_con_res_prepend(ptr noundef %191, ptr noundef %192)
  store i1 true, ptr %2, align 1
  store i32 1, ptr %7, align 4
  br label %193

193:                                              ; preds = %190, %187, %144, %143, %18
  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 8, ptr %4) #6
  %194 = load i1, ptr %2, align 1
  ret i1 %194
}

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

declare ptr @agoo_res_message_peek(ptr noundef) #1

; Function Attrs: nounwind willreturn memory(read)
declare ptr @strstr(ptr noundef, ptr noundef) #4

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

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

declare ptr @agoo_res_message_next(ptr noundef) #1

declare void @agoo_res_destroy(ptr noundef) #1

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #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 #2 = { 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 #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 = { nounwind willreturn memory(read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
attributes #8 = { 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 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !12, i64 8304}
!14 = !{!"_agooCon", !6, i64 0, !15, i64 8, !6, i64 16, !6, i64 24, !10, i64 32, !7, i64 40, !7, i64 86, !10, i64 8280, !10, i64 8288, !10, i64 8296, !12, i64 8304, !16, i64 8312, !16, i64 8313, !16, i64 8314, !6, i64 8320, !6, i64 8328, !6, i64 8336, !7, i64 8344, !6, i64 8384, !6, i64 8392, !6, i64 8400}
!15 = !{!"int", !7, i64 0}
!16 = !{!"_Bool", !7, i64 0}
!17 = !{!14, !10, i64 8296}
!18 = !{!19, !16, i64 52}
!19 = !{!"_agooLogCat", !6, i64 0, !7, i64 8, !6, i64 40, !15, i64 48, !16, i64 52}
!20 = !{i8 0, i8 2}
!21 = !{}
!22 = !{!23, !10, i64 8}
!23 = !{!"_agooText", !6, i64 0, !10, i64 8, !10, i64 16, !24, i64 24, !16, i64 72, !7, i64 73}
!24 = !{!"_agooAtom", !6, i64 0, !7, i64 8}
!25 = !{!7, !7, i64 0}
!26 = !{!14, !6, i64 16}
!27 = !{!28, !15, i64 80}
!28 = !{!"_agooBind", !6, i64 0, !15, i64 8, !15, i64 12, !29, i64 16, !7, i64 20, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !15, i64 80}
!29 = !{!"short", !7, i64 0}
!30 = !{!14, !10, i64 32}
!31 = !{!14, !16, i64 8313}
!32 = !{!14, !15, i64 8}
!33 = !{!15, !15, i64 0}
!34 = !{!35, !16, i64 64}
!35 = !{!"_agooRes", !6, i64 0, !6, i64 8, !6, i64 16, !7, i64 24, !16, i64 64, !15, i64 68, !16, i64 72, !16, i64 73, !16, i64 74}
!36 = !{!35, !16, i64 72}
!37 = !{!16, !16, i64 0}


; 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._agooLogCat = type { ptr, [32 x i8], ptr, i32, i8 }

@con_timeout = external dso_local local_unnamed_addr global double, align 8
@agoo_error_cat = external global %struct._agooLogCat, align 8
@.str.3 = external hidden unnamed_addr constant [31 x i8], align 1
@agoo_debug_cat = external global %struct._agooLogCat, align 8
@agoo_resp_cat = external global %struct._agooLogCat, align 8
@.str.8 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [21 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

declare double @dtime() local_unnamed_addr #1

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

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

declare ptr @agoo_con_kind_str(i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @agoo_con_http_write(ptr noundef %0) local_unnamed_addr #3 {
  %2 = alloca [4096 x i8], align 16
  %3 = tail call ptr @agoo_con_res_pop(ptr noundef %0)
  %4 = tail call ptr @agoo_res_message_peek(ptr noundef %3) #6
  %5 = icmp eq ptr %4, null
  br i1 %5, label %98, label %6

6:                                                ; preds = %1
  %7 = tail call double @dtime() #6
  %8 = load double, ptr @con_timeout, align 8, !tbaa !5
  %9 = fadd double %7, %8
  %10 = getelementptr inbounds i8, ptr %0, i64 8304
  store double %9, ptr %10, align 8, !tbaa !9
  %11 = getelementptr inbounds i8, ptr %0, i64 8296
  %12 = load i64, ptr %11, align 8, !tbaa !15
  %13 = icmp eq i64 %12, 0
  br i1 %13, label %14, label %53

14:                                               ; preds = %6
  %15 = load i8, ptr getelementptr inbounds (i8, ptr @agoo_resp_cat, i64 52), align 4, !tbaa !16, !range !18, !noundef !19
  %16 = trunc nuw i8 %15 to i1
  br i1 %16, label %17, label %41

17:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 4096, ptr nonnull %2) #6
  %18 = getelementptr inbounds i8, ptr %4, i64 73
  %19 = tail call ptr @strstr(ptr noundef nonnull dereferenceable(1) %18, ptr noundef nonnull dereferenceable(1) @.str.8) #7
  %20 = icmp eq ptr %19, null
  br i1 %20, label %21, label %25

21:                                               ; preds = %17
  %22 = getelementptr inbounds i8, ptr %4, i64 8
  %23 = load i64, ptr %22, align 8, !tbaa !20
  %24 = getelementptr inbounds i8, ptr %18, i64 %23
  br label %25

25:                                               ; preds = %21, %17
  %.046 = phi ptr [ %24, %21 ], [ %19, %17 ]
  %26 = ptrtoint ptr %.046 to i64
  %27 = ptrtoint ptr %18 to i64
  %28 = sub i64 %26, %27
  %29 = icmp sgt i64 %28, 4095
  %30 = getelementptr inbounds i8, ptr %4, i64 4168
  %spec.select = select i1 %29, ptr %30, ptr %.046
  %31 = ptrtoint ptr %spec.select to i64
  %32 = sub i64 %31, %27
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 %2, ptr nonnull align 1 %18, i64 %32, i1 false)
  %33 = getelementptr inbounds [4096 x i8], ptr %2, i64 0, i64 %32
  store i8 0, ptr %33, align 1, !tbaa !23
  %34 = getelementptr inbounds i8, ptr %0, i64 16
  %35 = load ptr, ptr %34, align 8, !tbaa !24
  %36 = getelementptr inbounds i8, ptr %35, i64 80
  %37 = load i32, ptr %36, align 8, !tbaa !25
  %38 = tail call ptr @agoo_con_kind_str(i32 noundef %37) #6
  %39 = getelementptr inbounds i8, ptr %0, i64 32
  %40 = load i64, ptr %39, align 8, !tbaa !28
  call void (ptr, ptr, ...) @agoo_log_cat(ptr noundef nonnull @agoo_resp_cat, ptr noundef nonnull @.str.9, ptr noundef %38, i64 noundef %40, ptr noundef nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4096, ptr nonnull %2) #6
  br label %41

41:                                               ; preds = %25, %14
  %42 = load i8, ptr getelementptr inbounds (i8, ptr @agoo_debug_cat, i64 52), align 4, !tbaa !16, !range !18, !noundef !19
  %43 = trunc nuw i8 %42 to i1
  br i1 %43, label %44, label %53

44:                                               ; preds = %41
  %45 = getelementptr inbounds i8, ptr %0, i64 16
  %46 = load ptr, ptr %45, align 8, !tbaa !24
  %47 = getelementptr inbounds i8, ptr %46, i64 80
  %48 = load i32, ptr %47, align 8, !tbaa !25
  %49 = call ptr @agoo_con_kind_str(i32 noundef %48) #6
  %50 = getelementptr inbounds i8, ptr %0, i64 32
  %51 = load i64, ptr %50, align 8, !tbaa !28
  %52 = getelementptr inbounds i8, ptr %4, i64 73
  call void (ptr, ptr, ...) @agoo_log_cat(ptr noundef nonnull @agoo_debug_cat, ptr noundef nonnull @.str.10, ptr noundef %49, i64 noundef %51, ptr noundef nonnull %52) #6
  br label %53

53:                                               ; preds = %41, %44, %6
  %54 = getelementptr inbounds i8, ptr %0, i64 16
  %55 = load ptr, ptr %54, align 8, !tbaa !24
  %56 = getelementptr inbounds i8, ptr %55, i64 80
  %57 = load i32, ptr %56, align 8, !tbaa !25
  %58 = icmp eq i32 %57, 84
  br i1 %58, label %59, label %61

59:                                               ; preds = %53
  call void (ptr, ptr, ...) @agoo_log_cat(ptr noundef nonnull @agoo_error_cat, ptr noundef nonnull @.str.3) #6
  %60 = getelementptr inbounds i8, ptr %0, i64 8313
  store i8 1, ptr %60, align 1, !tbaa !29
  br label %80

61:                                               ; preds = %53
  %62 = getelementptr inbounds i8, ptr %0, i64 8
  %63 = load i32, ptr %62, align 8, !tbaa !30
  %64 = getelementptr inbounds i8, ptr %4, i64 73
  %65 = load i64, ptr %11, align 8, !tbaa !15
  %66 = getelementptr inbounds i8, ptr %64, i64 %65
  %67 = getelementptr inbounds i8, ptr %4, i64 8
  %68 = load i64, ptr %67, align 8, !tbaa !20
  %69 = sub nsw i64 %68, %65
  %70 = call i64 @send(i32 noundef %63, ptr noundef nonnull %66, i64 noundef %69, i32 noundef 64) #6
  %71 = icmp slt i64 %70, 0
  br i1 %71, label %72, label %80

72:                                               ; preds = %61
  %73 = tail call ptr @__errno_location() #8
  %74 = load i32, ptr %73, align 4, !tbaa !31
  %75 = icmp eq i32 %74, 11
  br i1 %75, label %98, label %76

76:                                               ; preds = %72
  %77 = getelementptr inbounds i8, ptr %0, i64 32
  %78 = load i64, ptr %77, align 8, !tbaa !28
  call void (ptr, ptr, ...) @agoo_log_cat(ptr noundef nonnull @agoo_error_cat, ptr noundef nonnull @.str.11, i64 noundef %78) #6
  %79 = getelementptr inbounds i8, ptr %0, i64 8313
  store i8 1, ptr %79, align 1, !tbaa !29
  br label %98

80:                                               ; preds = %61, %59
  %.045 = phi i64 [ 0, %59 ], [ %70, %61 ]
  %81 = load i64, ptr %11, align 8, !tbaa !15
  %82 = add nsw i64 %81, %.045
  store i64 %82, ptr %11, align 8, !tbaa !15
  %83 = getelementptr inbounds i8, ptr %4, i64 8
  %84 = load i64, ptr %83, align 8, !tbaa !20
  %85 = icmp eq i64 %82, %84
  br i1 %85, label %86, label %.thread

86:                                               ; preds = %80
  %87 = call ptr @agoo_res_message_next(ptr noundef %3) #6
  store i64 0, ptr %11, align 8, !tbaa !15
  %88 = icmp eq ptr %87, null
  br i1 %88, label %89, label %.thread

89:                                               ; preds = %86
  %90 = getelementptr inbounds i8, ptr %3, i64 64
  %91 = load volatile i8, ptr %90, align 8, !tbaa !32, !range !18, !noundef !19
  %92 = trunc nuw i8 %91 to i1
  br i1 %92, label %93, label %.thread

93:                                               ; preds = %89
  %94 = getelementptr inbounds i8, ptr %3, i64 72
  %95 = load i8, ptr %94, align 8, !tbaa !34, !range !18, !noundef !19
  %96 = trunc nuw i8 %95 to i1
  call void @agoo_res_destroy(ptr noundef nonnull %3) #6
  %97 = xor i1 %96, true
  br label %98

.thread:                                          ; preds = %86, %89, %80
  call void @agoo_con_res_prepend(ptr noundef nonnull %0, ptr noundef %3)
  br label %98

98:                                               ; preds = %93, %72, %1, %.thread, %76
  %.1 = phi i1 [ true, %.thread ], [ %97, %93 ], [ false, %76 ], [ true, %1 ], [ true, %72 ]
  ret i1 %.1
}

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

declare ptr @agoo_res_message_peek(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare ptr @strstr(ptr noundef, ptr nocapture noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

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

declare ptr @agoo_res_message_next(ptr noundef) local_unnamed_addr #1

declare void @agoo_res_destroy(ptr noundef) local_unnamed_addr #1

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #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 #2 = { 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 #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 nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }
attributes #8 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 8304}
!10 = !{!"_agooCon", !11, i64 0, !12, i64 8, !11, i64 16, !11, i64 24, !13, i64 32, !7, i64 40, !7, i64 86, !13, i64 8280, !13, i64 8288, !13, i64 8296, !6, i64 8304, !14, i64 8312, !14, i64 8313, !14, i64 8314, !11, i64 8320, !11, i64 8328, !11, i64 8336, !7, i64 8344, !11, i64 8384, !11, i64 8392, !11, i64 8400}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!"_Bool", !7, i64 0}
!15 = !{!10, !13, i64 8296}
!16 = !{!17, !14, i64 52}
!17 = !{!"_agooLogCat", !11, i64 0, !7, i64 8, !11, i64 40, !12, i64 48, !14, i64 52}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = !{!21, !13, i64 8}
!21 = !{!"_agooText", !11, i64 0, !13, i64 8, !13, i64 16, !22, i64 24, !14, i64 72, !7, i64 73}
!22 = !{!"_agooAtom", !11, i64 0, !7, i64 8}
!23 = !{!7, !7, i64 0}
!24 = !{!10, !11, i64 16}
!25 = !{!26, !12, i64 80}
!26 = !{!"_agooBind", !11, i64 0, !12, i64 8, !12, i64 12, !27, i64 16, !7, i64 20, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64, !11, i64 72, !12, i64 80}
!27 = !{!"short", !7, i64 0}
!28 = !{!10, !13, i64 32}
!29 = !{!10, !14, i64 8313}
!30 = !{!10, !12, i64 8}
!31 = !{!12, !12, i64 0}
!32 = !{!33, !14, i64 64}
!33 = !{!"_agooRes", !11, i64 0, !11, i64 8, !11, i64 16, !7, i64 24, !14, i64 64, !12, i64 68, !14, i64 72, !14, i64 73, !14, i64 74}
!34 = !{!33, !14, i64 72}


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