; LLVM IR from erwincoumans/tiny-differentiable-simulator :: third_party/zeromq/src (socks)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.addrinfo = type { i32, i32, i32, i32, i32, ptr, ptr, ptr }
%"struct.zmq::socks_request_t" = type <{ i8, [7 x i8], %"class.std::__cxx11::basic_string", i16, [6 x i8] }>
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.zmq::socks_request_encoder_t" = type <{ i64, i64, [262 x i8], [2 x i8] }>
%struct.sockaddr_in = type { i16, i16, %struct.in_addr, [8 x i8] }
%struct.in_addr = type { i32 }
%struct.sockaddr_in6 = type { i16, i16, i32, %struct.in6_addr, i32 }
%struct.in6_addr = type { %union.anon.0 }
%union.anon.0 = type { [4 x i32] }

@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [30 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [109 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [35 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: nocallback nofree nosync nounwind willreturn memory(none)
declare i64 @llvm.expect.i64(i64, i64) #1

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

declare i32 @fflush(ptr noundef) #3

declare void @_ZN3zmq9zmq_abortEPKc(ptr noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32)) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32)) #4 align 2

; 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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3zmq23socks_request_encoder_t6encodeERKNS_15socks_request_tE(ptr noundef nonnull align 8 dereferenceable(278) %0, ptr noundef nonnull align 8 dereferenceable(42) %1) #6 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %struct.addrinfo, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %11 = load ptr, ptr %3, align 8
  br label %12

12:                                               ; preds = %2
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %"struct.zmq::socks_request_t", ptr %13, i32 0, i32 2
  %15 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %14) #8
  %16 = icmp ule i64 %15, 255
  %17 = xor i1 %16, true
  %18 = zext i1 %17 to i64
  %19 = call i64 @llvm.expect.i64(i64 %18, i64 0)
  %20 = icmp ne i64 %19, 0
  br i1 %20, label %21, label %26

21:                                               ; preds = %12
  %22 = load ptr, ptr @stderr, align 8, !tbaa !5
  %23 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %22, ptr noundef @.str, ptr noundef @.str.7, ptr noundef @.str.2, i32 noundef 241) #8
  %24 = load ptr, ptr @stderr, align 8, !tbaa !5
  %25 = call i32 @fflush(ptr noundef %24)
  call void @_ZN3zmq9zmq_abortEPKc(ptr noundef @.str.7)
  br label %26

26:                                               ; preds = %21, %12
  br label %27

27:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #8
  %28 = getelementptr inbounds %"class.zmq::socks_request_encoder_t", ptr %11, i32 0, i32 2
  %29 = getelementptr inbounds [262 x i8], ptr %28, i64 0, i64 0
  store ptr %29, ptr %5, align 8, !tbaa !5
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds i8, ptr %30, i32 1
  store ptr %31, ptr %5, align 8, !tbaa !5
  store i8 5, ptr %30, align 1, !tbaa !9
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %"struct.zmq::socks_request_t", ptr %32, i32 0, i32 0
  %34 = load i8, ptr %33, align 8, !tbaa !10
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = getelementptr inbounds i8, ptr %35, i32 1
  store ptr %36, ptr %5, align 8, !tbaa !5
  store i8 %34, ptr %35, align 1, !tbaa !9
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds i8, ptr %37, i32 1
  store ptr %38, ptr %5, align 8, !tbaa !5
  store i8 0, ptr %37, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 48, ptr %6) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  store ptr null, ptr %7, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 8 %6, i8 0, i64 48, i1 false)
  %39 = getelementptr inbounds %struct.addrinfo, ptr %6, i32 0, i32 0
  store i32 4, ptr %39, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = getelementptr inbounds %"struct.zmq::socks_request_t", ptr %40, i32 0, i32 2
  %42 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %41) #8
  %43 = call i32 @getaddrinfo(ptr noundef %42, ptr noundef null, ptr noundef %6, ptr noundef %7)
  store i32 %43, ptr %8, align 4, !tbaa !19
  %44 = load i32, ptr %8, align 4, !tbaa !19
  %45 = icmp eq i32 %44, 0
  br i1 %45, label %46, label %62

46:                                               ; preds = %27
  %47 = load ptr, ptr %7, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.addrinfo, ptr %47, i32 0, i32 1
  %49 = load i32, ptr %48, align 4, !tbaa !20
  %50 = icmp eq i32 %49, 2
  br i1 %50, label %51, label %62

51:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  %52 = load ptr, ptr %7, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.addrinfo, ptr %52, i32 0, i32 5
  %54 = load ptr, ptr %53, align 8, !tbaa !21
  store ptr %54, ptr %9, align 8, !tbaa !5
  %55 = load ptr, ptr %5, align 8, !tbaa !5
  %56 = getelementptr inbounds i8, ptr %55, i32 1
  store ptr %56, ptr %5, align 8, !tbaa !5
  store i8 1, ptr %55, align 1, !tbaa !9
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = load ptr, ptr %9, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.sockaddr_in, ptr %58, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %57, ptr align 4 %59, i64 4, i1 false)
  %60 = load ptr, ptr %5, align 8, !tbaa !5
  %61 = getelementptr inbounds i8, ptr %60, i64 4
  store ptr %61, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  br label %103

62:                                               ; preds = %46, %27
  %63 = load i32, ptr %8, align 4, !tbaa !19
  %64 = icmp eq i32 %63, 0
  br i1 %64, label %65, label %81

65:                                               ; preds = %62
  %66 = load ptr, ptr %7, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.addrinfo, ptr %66, i32 0, i32 1
  %68 = load i32, ptr %67, align 4, !tbaa !20
  %69 = icmp eq i32 %68, 10
  br i1 %69, label %70, label %81

70:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  %71 = load ptr, ptr %7, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.addrinfo, ptr %71, i32 0, i32 5
  %73 = load ptr, ptr %72, align 8, !tbaa !21
  store ptr %73, ptr %10, align 8, !tbaa !5
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = getelementptr inbounds i8, ptr %74, i32 1
  store ptr %75, ptr %5, align 8, !tbaa !5
  store i8 4, ptr %74, align 1, !tbaa !9
  %76 = load ptr, ptr %5, align 8, !tbaa !5
  %77 = load ptr, ptr %10, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.sockaddr_in6, ptr %77, i32 0, i32 3
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %76, ptr align 4 %78, i64 16, i1 false)
  %79 = load ptr, ptr %5, align 8, !tbaa !5
  %80 = getelementptr inbounds i8, ptr %79, i64 16
  store ptr %80, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  br label %102

81:                                               ; preds = %65, %62
  %82 = load ptr, ptr %5, align 8, !tbaa !5
  %83 = getelementptr inbounds i8, ptr %82, i32 1
  store ptr %83, ptr %5, align 8, !tbaa !5
  store i8 3, ptr %82, align 1, !tbaa !9
  %84 = load ptr, ptr %4, align 8, !tbaa !5
  %85 = getelementptr inbounds %"struct.zmq::socks_request_t", ptr %84, i32 0, i32 2
  %86 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %85) #8
  %87 = trunc i64 %86 to i8
  %88 = load ptr, ptr %5, align 8, !tbaa !5
  %89 = getelementptr inbounds i8, ptr %88, i32 1
  store ptr %89, ptr %5, align 8, !tbaa !5
  store i8 %87, ptr %88, align 1, !tbaa !9
  %90 = load ptr, ptr %5, align 8, !tbaa !5
  %91 = load ptr, ptr %4, align 8, !tbaa !5
  %92 = getelementptr inbounds %"struct.zmq::socks_request_t", ptr %91, i32 0, i32 2
  %93 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %92) #8
  %94 = load ptr, ptr %4, align 8, !tbaa !5
  %95 = getelementptr inbounds %"struct.zmq::socks_request_t", ptr %94, i32 0, i32 2
  %96 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %95) #8
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %90, ptr align 1 %93, i64 %96, i1 false)
  %97 = load ptr, ptr %4, align 8, !tbaa !5
  %98 = getelementptr inbounds %"struct.zmq::socks_request_t", ptr %97, i32 0, i32 2
  %99 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %98) #8
  %100 = load ptr, ptr %5, align 8, !tbaa !5
  %101 = getelementptr inbounds i8, ptr %100, i64 %99
  store ptr %101, ptr %5, align 8, !tbaa !5
  br label %102

102:                                              ; preds = %81, %70
  br label %103

103:                                              ; preds = %102, %51
  %104 = load i32, ptr %8, align 4, !tbaa !19
  %105 = icmp eq i32 %104, 0
  br i1 %105, label %106, label %108

106:                                              ; preds = %103
  %107 = load ptr, ptr %7, align 8, !tbaa !5
  call void @freeaddrinfo(ptr noundef %107) #8
  br label %108

108:                                              ; preds = %106, %103
  %109 = load ptr, ptr %4, align 8, !tbaa !5
  %110 = getelementptr inbounds %"struct.zmq::socks_request_t", ptr %109, i32 0, i32 3
  %111 = load i16, ptr %110, align 8, !tbaa !22
  %112 = zext i16 %111 to i32
  %113 = sdiv i32 %112, 256
  %114 = trunc i32 %113 to i8
  %115 = load ptr, ptr %5, align 8, !tbaa !5
  %116 = getelementptr inbounds i8, ptr %115, i32 1
  store ptr %116, ptr %5, align 8, !tbaa !5
  store i8 %114, ptr %115, align 1, !tbaa !9
  %117 = load ptr, ptr %4, align 8, !tbaa !5
  %118 = getelementptr inbounds %"struct.zmq::socks_request_t", ptr %117, i32 0, i32 3
  %119 = load i16, ptr %118, align 8, !tbaa !22
  %120 = zext i16 %119 to i32
  %121 = srem i32 %120, 256
  %122 = trunc i32 %121 to i8
  %123 = load ptr, ptr %5, align 8, !tbaa !5
  %124 = getelementptr inbounds i8, ptr %123, i32 1
  store ptr %124, ptr %5, align 8, !tbaa !5
  store i8 %122, ptr %123, align 1, !tbaa !9
  %125 = load ptr, ptr %5, align 8, !tbaa !5
  %126 = getelementptr inbounds %"class.zmq::socks_request_encoder_t", ptr %11, i32 0, i32 2
  %127 = getelementptr inbounds [262 x i8], ptr %126, i64 0, i64 0
  %128 = ptrtoint ptr %125 to i64
  %129 = ptrtoint ptr %127 to i64
  %130 = sub i64 %128, %129
  %131 = getelementptr inbounds %"class.zmq::socks_request_encoder_t", ptr %11, i32 0, i32 0
  store i64 %130, ptr %131, align 8, !tbaa !23
  %132 = getelementptr inbounds %"class.zmq::socks_request_encoder_t", ptr %11, i32 0, i32 1
  store i64 0, ptr %132, align 8, !tbaa !25
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #8
  ret void
}

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

declare i32 @getaddrinfo(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #3

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(none) }
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 = { "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 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { mustprogress 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { 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++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !7, i64 0}
!11 = !{!"_ZTSN3zmq15socks_request_tE", !7, i64 0, !12, i64 8, !15, i64 40}
!12 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !13, i64 0, !14, i64 8, !7, i64 16}
!13 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!"short", !7, i64 0}
!16 = !{!17, !18, i64 0}
!17 = !{!"_ZTS8addrinfo", !18, i64 0, !18, i64 4, !18, i64 8, !18, i64 12, !18, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!18 = !{!"int", !7, i64 0}
!19 = !{!18, !18, i64 0}
!20 = !{!17, !18, i64 4}
!21 = !{!17, !6, i64 24}
!22 = !{!11, !15, i64 40}
!23 = !{!24, !14, i64 0}
!24 = !{!"_ZTSN3zmq23socks_request_encoder_tE", !14, i64 0, !14, i64 8, !7, i64 16}
!25 = !{!24, !14, i64 8}


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

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

@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [30 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [109 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [35 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: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @fflush(ptr nocapture noundef) local_unnamed_addr #1

declare void @_ZN3zmq9zmq_abortEPKc(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

; 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) #4

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3zmq23socks_request_encoder_t6encodeERKNS_15socks_request_tE(ptr noundef nonnull align 8 dereferenceable(278) %0, ptr noundef nonnull align 8 dereferenceable(42) %1) local_unnamed_addr #5 align 2 {
  %3 = alloca %struct.addrinfo, align 8
  %4 = alloca ptr, align 8
  %5 = getelementptr inbounds i8, ptr %1, i64 8
  %6 = tail call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %5) #8
  %7 = icmp ugt i64 %6, 255
  br i1 %7, label %8, label %13, !prof !5

8:                                                ; preds = %2
  %9 = load ptr, ptr @stderr, align 8, !tbaa !6
  %10 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %9, ptr noundef nonnull @.str, ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.2, i32 noundef 241) #9
  %11 = load ptr, ptr @stderr, align 8, !tbaa !6
  %12 = tail call i32 @fflush(ptr noundef %11)
  tail call void @_ZN3zmq9zmq_abortEPKc(ptr noundef nonnull @.str.7)
  br label %13

13:                                               ; preds = %2, %8
  %14 = getelementptr inbounds i8, ptr %0, i64 16
  %15 = getelementptr inbounds i8, ptr %0, i64 17
  store i8 5, ptr %14, align 8, !tbaa !10
  %16 = load i8, ptr %1, align 8, !tbaa !11
  %17 = getelementptr inbounds i8, ptr %0, i64 18
  store i8 %16, ptr %15, align 1, !tbaa !10
  %18 = getelementptr inbounds i8, ptr %0, i64 19
  store i8 0, ptr %17, align 2, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %3) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  store ptr null, ptr %4, align 8, !tbaa !6
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(48) %3, i8 0, i64 48, i1 false)
  store i32 4, ptr %3, align 8, !tbaa !17
  %19 = tail call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %5) #8
  %20 = call i32 @getaddrinfo(ptr noundef %19, ptr noundef null, ptr noundef nonnull %3, ptr noundef nonnull %4)
  %21 = icmp eq i32 %20, 0
  br i1 %21, label %22, label %39

22:                                               ; preds = %13
  %23 = load ptr, ptr %4, align 8, !tbaa !6
  %24 = getelementptr inbounds i8, ptr %23, i64 4
  %25 = load i32, ptr %24, align 4, !tbaa !20
  switch i32 %25, label %39 [
    i32 2, label %26
    i32 10, label %33
  ]

26:                                               ; preds = %22
  %27 = getelementptr inbounds i8, ptr %23, i64 24
  %28 = load ptr, ptr %27, align 8, !tbaa !21
  %29 = getelementptr inbounds i8, ptr %0, i64 20
  store i8 1, ptr %18, align 1, !tbaa !10
  %30 = getelementptr inbounds i8, ptr %28, i64 4
  %31 = load i32, ptr %30, align 4
  store i32 %31, ptr %29, align 4
  %32 = getelementptr inbounds i8, ptr %0, i64 24
  br label %.thread

33:                                               ; preds = %22
  %34 = getelementptr inbounds i8, ptr %23, i64 24
  %35 = load ptr, ptr %34, align 8, !tbaa !21
  %36 = getelementptr inbounds i8, ptr %0, i64 20
  store i8 4, ptr %18, align 1, !tbaa !10
  %37 = getelementptr inbounds i8, ptr %35, i64 8
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(16) %36, ptr noundef nonnull align 4 dereferenceable(16) %37, i64 16, i1 false)
  %38 = getelementptr inbounds i8, ptr %0, i64 36
  br label %.thread

39:                                               ; preds = %22, %13
  %40 = getelementptr inbounds i8, ptr %0, i64 20
  store i8 3, ptr %18, align 1, !tbaa !10
  %41 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %5) #8
  %42 = trunc i64 %41 to i8
  %43 = getelementptr inbounds i8, ptr %0, i64 21
  store i8 %42, ptr %40, align 4, !tbaa !10
  %44 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %5) #8
  %45 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %5) #8
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 1 %43, ptr align 1 %44, i64 %45, i1 false)
  %46 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %5) #8
  %47 = getelementptr inbounds i8, ptr %43, i64 %46
  br i1 %21, label %..thread_crit_edge, label %49

..thread_crit_edge:                               ; preds = %39
  %.pre = load ptr, ptr %4, align 8, !tbaa !6
  br label %.thread

.thread:                                          ; preds = %..thread_crit_edge, %26, %33
  %48 = phi ptr [ %.pre, %..thread_crit_edge ], [ %23, %33 ], [ %23, %26 ]
  %.032 = phi ptr [ %47, %..thread_crit_edge ], [ %38, %33 ], [ %32, %26 ]
  call void @freeaddrinfo(ptr noundef %48) #8
  br label %49

49:                                               ; preds = %.thread, %39
  %.031 = phi ptr [ %.032, %.thread ], [ %47, %39 ]
  %50 = getelementptr inbounds i8, ptr %1, i64 40
  %51 = load i16, ptr %50, align 8, !tbaa !22
  %52 = lshr i16 %51, 8
  %53 = trunc nuw i16 %52 to i8
  %54 = getelementptr inbounds i8, ptr %.031, i64 1
  store i8 %53, ptr %.031, align 1, !tbaa !10
  %55 = load i16, ptr %50, align 8, !tbaa !22
  %56 = trunc i16 %55 to i8
  %57 = getelementptr inbounds i8, ptr %.031, i64 2
  store i8 %56, ptr %54, align 1, !tbaa !10
  %58 = ptrtoint ptr %57 to i64
  %59 = ptrtoint ptr %14 to i64
  %60 = sub i64 %58, %59
  store i64 %60, ptr %0, align 8, !tbaa !23
  %61 = getelementptr inbounds i8, ptr %0, i64 8
  store i64 0, ptr %61, align 8, !tbaa !25
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %3) #8
  ret void
}

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

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { mustprogress 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: readwrite) }
attributes #5 = { mustprogress 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 #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { 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 #8 = { nounwind }
attributes #9 = { cold 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 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!6 = !{!7, !7, i64 0}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!8, !8, i64 0}
!11 = !{!12, !8, i64 0}
!12 = !{!"_ZTSN3zmq15socks_request_tE", !8, i64 0, !13, i64 8, !16, i64 40}
!13 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !14, i64 0, !15, i64 8, !8, i64 16}
!14 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !7, i64 0}
!15 = !{!"long", !8, i64 0}
!16 = !{!"short", !8, i64 0}
!17 = !{!18, !19, i64 0}
!18 = !{!"_ZTS8addrinfo", !19, i64 0, !19, i64 4, !19, i64 8, !19, i64 12, !19, i64 16, !7, i64 24, !7, i64 32, !7, i64 40}
!19 = !{!"int", !8, i64 0}
!20 = !{!18, !19, i64 4}
!21 = !{!18, !7, i64 24}
!22 = !{!12, !16, i64 40}
!23 = !{!24, !15, i64 0}
!24 = !{!"_ZTSN3zmq23socks_request_encoder_tE", !15, i64 0, !15, i64 8, !8, i64 16}
!25 = !{!24, !15, i64 8}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LowerExpectIntrinsicPass,SROAPass,SimplifyCFGPass,TailCallElimPass