; LLVM IR from monolith-network/nettle :: lib (Writer)

; 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"

%"class.std::function" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }
%struct.sockaddr_in = type { i16, i16, %struct.in_addr, [8 x i8] }
%struct.in_addr = type { i32 }
%"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.nettle::Writer" = type <{ %"class.nettle::Socket", i8, [7 x i8] }>
%"class.nettle::Socket" = type { i8, i32, %struct.sockaddr_in, %struct.timeval, %struct.timeval, %"class.std::function" }
%struct.timeval = type { i64, i64 }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6nettle6WriterC2ENS_8HostPortENS_10WriterTypeESt8functionIFvNS_11SocketErrorEEE(ptr noundef nonnull align 8 dereferenceable(89) %0, ptr noundef %1, i32 noundef %2, ptr noundef %3) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca %"class.std::function", align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca %struct.sockaddr_in, align 4
  %13 = alloca i32, align 4
  %14 = alloca %"class.std::__cxx11::basic_string", align 8
  %15 = alloca %struct.sockaddr_in, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  store ptr %3, ptr %8, align 8, !tbaa !5
  %16 = load ptr, ptr %5, align 8
  call void @_ZNSt8functionIFvN6nettle11SocketErrorEEEC2ERKS3_(ptr noundef nonnull align 8 dereferenceable(32) %9, ptr noundef nonnull align 8 dereferenceable(32) %3)
  invoke void @_ZN6nettle6SocketC2ESt8functionIFvNS_11SocketErrorEEE(ptr noundef nonnull align 8 dereferenceable(88) %16, ptr noundef %9)
          to label %17 unwind label %28

17:                                               ; preds = %4
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #8
  %18 = getelementptr inbounds %"class.nettle::Writer", ptr %16, i32 0, i32 1
  store i8 0, ptr %18, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #8
  %19 = load i32, ptr %7, align 4, !tbaa !9
  %20 = icmp eq i32 %19, 0
  br i1 %20, label %21, label %37

21:                                               ; preds = %17
  %22 = call i32 @socket(i32 noundef 2, i32 noundef 1, i32 noundef 6) #8
  %23 = getelementptr inbounds %"class.nettle::Socket", ptr %16, i32 0, i32 1
  store i32 %22, ptr %23, align 4, !tbaa !23
  %24 = icmp slt i32 %22, 0
  br i1 %24, label %25, label %36

25:                                               ; preds = %21
  invoke void @_ZNKSt8functionIFvN6nettle11SocketErrorEEEclES1_(ptr noundef nonnull align 8 dereferenceable(32) %3, i32 noundef 4)
          to label %26 unwind label %32

26:                                               ; preds = %25
  %27 = getelementptr inbounds %"class.nettle::Writer", ptr %16, i32 0, i32 1
  store i8 1, ptr %27, align 8, !tbaa !11
  store i32 1, ptr %13, align 4
  br label %82

28:                                               ; preds = %4
  %29 = landingpad { ptr, i32 }
          cleanup
  %30 = extractvalue { ptr, i32 } %29, 0
  store ptr %30, ptr %10, align 8
  %31 = extractvalue { ptr, i32 } %29, 1
  store i32 %31, ptr %11, align 4
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #8
  br label %86

32:                                               ; preds = %73, %70, %63, %61, %59, %52, %41, %25
  %33 = landingpad { ptr, i32 }
          cleanup
  %34 = extractvalue { ptr, i32 } %33, 0
  store ptr %34, ptr %10, align 8
  %35 = extractvalue { ptr, i32 } %33, 1
  store i32 %35, ptr %11, align 4
  br label %85

36:                                               ; preds = %21
  br label %45

37:                                               ; preds = %17
  %38 = call i32 @socket(i32 noundef 2, i32 noundef 2, i32 noundef 17) #8
  %39 = getelementptr inbounds %"class.nettle::Socket", ptr %16, i32 0, i32 1
  store i32 %38, ptr %39, align 4, !tbaa !23
  %40 = icmp slt i32 %38, 0
  br i1 %40, label %41, label %44

41:                                               ; preds = %37
  invoke void @_ZNKSt8functionIFvN6nettle11SocketErrorEEEclES1_(ptr noundef nonnull align 8 dereferenceable(32) %3, i32 noundef 4)
          to label %42 unwind label %32

42:                                               ; preds = %41
  %43 = getelementptr inbounds %"class.nettle::Writer", ptr %16, i32 0, i32 1
  store i8 1, ptr %43, align 8, !tbaa !11
  store i32 1, ptr %13, align 4
  br label %82

44:                                               ; preds = %37
  br label %45

45:                                               ; preds = %44, %36
  call void @llvm.memset.p0.i64(ptr align 4 %12, i8 0, i64 16, i1 false)
  %46 = getelementptr inbounds %struct.sockaddr_in, ptr %12, i32 0, i32 0
  store i16 2, ptr %46, align 4, !tbaa !24
  call void @llvm.lifetime.start.p0(i64 32, ptr %14) #8
  invoke void @_ZNK6nettle8HostPort10getAddressB5cxx11Ev(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %14, ptr noundef nonnull align 8 dereferenceable(34) %1)
          to label %47 unwind label %55

47:                                               ; preds = %45
  %48 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %14) #8
  %49 = getelementptr inbounds %struct.sockaddr_in, ptr %12, i32 0, i32 2
  %50 = call i32 @inet_pton(i32 noundef 2, ptr noundef %48, ptr noundef %49) #8
  %51 = icmp sle i32 %50, 0
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %14) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %14) #8
  br i1 %51, label %52, label %59

52:                                               ; preds = %47
  invoke void @_ZNKSt8functionIFvN6nettle11SocketErrorEEEclES1_(ptr noundef nonnull align 8 dereferenceable(32) %3, i32 noundef 4)
          to label %53 unwind label %32

53:                                               ; preds = %52
  %54 = getelementptr inbounds %"class.nettle::Writer", ptr %16, i32 0, i32 1
  store i8 1, ptr %54, align 8, !tbaa !11
  store i32 1, ptr %13, align 4
  br label %82

55:                                               ; preds = %45
  %56 = landingpad { ptr, i32 }
          cleanup
  %57 = extractvalue { ptr, i32 } %56, 0
  store ptr %57, ptr %10, align 8
  %58 = extractvalue { ptr, i32 } %56, 1
  store i32 %58, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 32, ptr %14) #8
  br label %85

59:                                               ; preds = %47
  %60 = invoke noundef signext i16 @_ZNK6nettle8HostPort7getPortEv(ptr noundef nonnull align 8 dereferenceable(34) %1)
          to label %61 unwind label %32

61:                                               ; preds = %59
  %62 = invoke noundef zeroext i16 @_ZL10__bswap_16t(i16 noundef zeroext %60)
          to label %63 unwind label %32

63:                                               ; preds = %61
  %64 = getelementptr inbounds %struct.sockaddr_in, ptr %12, i32 0, i32 1
  store i16 %62, ptr %64, align 2, !tbaa !25
  %65 = getelementptr inbounds %"class.nettle::Socket", ptr %16, i32 0, i32 1
  %66 = load i32, ptr %65, align 4, !tbaa !23
  %67 = invoke i32 @connect(i32 noundef %66, ptr noundef %12, i32 noundef 16)
          to label %68 unwind label %32

68:                                               ; preds = %63
  %69 = icmp slt i32 %67, 0
  br i1 %69, label %70, label %73

70:                                               ; preds = %68
  invoke void @_ZNKSt8functionIFvN6nettle11SocketErrorEEEclES1_(ptr noundef nonnull align 8 dereferenceable(32) %3, i32 noundef 9)
          to label %71 unwind label %32

71:                                               ; preds = %70
  %72 = getelementptr inbounds %"class.nettle::Writer", ptr %16, i32 0, i32 1
  store i8 1, ptr %72, align 8, !tbaa !11
  store i32 1, ptr %13, align 4
  br label %82

73:                                               ; preds = %68
  %74 = getelementptr inbounds %"class.nettle::Socket", ptr %16, i32 0, i32 1
  %75 = load i32, ptr %74, align 4, !tbaa !23
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 %12, i64 16, i1 false), !tbaa.struct !26
  %76 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 0
  %77 = load i64, ptr %76, align 4
  %78 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 1
  %79 = load i64, ptr %78, align 4
  %80 = invoke noundef zeroext i1 @_ZN6nettle6Socket11setupSocketEi11sockaddr_in(ptr noundef nonnull align 8 dereferenceable(88) %16, i32 noundef %75, i64 %77, i64 %79)
          to label %81 unwind label %32

81:                                               ; preds = %73
  store i32 0, ptr %13, align 4
  br label %82

82:                                               ; preds = %81, %71, %53, %42, %26
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #8
  %83 = load i32, ptr %13, align 4
  switch i32 %83, label %91 [
    i32 0, label %84
    i32 1, label %84
  ]

84:                                               ; preds = %82, %82
  ret void

85:                                               ; preds = %55, %32
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #8
  call void @_ZN6nettle6SocketD2Ev(ptr noundef nonnull align 8 dereferenceable(88) %16) #8
  br label %86

86:                                               ; preds = %85, %28
  %87 = load ptr, ptr %10, align 8
  %88 = load i32, ptr %11, align 4
  %89 = insertvalue { ptr, i32 } poison, ptr %87, 0
  %90 = insertvalue { ptr, i32 } %89, i32 %88, 1
  resume { ptr, i32 } %90

91:                                               ; preds = %82
  unreachable
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt8functionIFvN6nettle11SocketErrorEEEC2ERKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

declare void @_ZN6nettle6SocketC2ESt8functionIFvNS_11SocketErrorEEE(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef) unnamed_addr #1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNKSt8functionIFvN6nettle11SocketErrorEEEclES1_(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) #0 align 2

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

; Function Attrs: nounwind
declare i32 @inet_pton(i32 noundef, ptr noundef, ptr noundef) #4

declare void @_ZNK6nettle8HostPort10getAddressB5cxx11Ev(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 8 dereferenceable(34)) #1

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

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

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

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

declare noundef signext i16 @_ZNK6nettle8HostPort7getPortEv(ptr noundef nonnull align 8 dereferenceable(34)) #1

declare i32 @connect(i32 noundef, ptr noundef, i32 noundef) #1

declare noundef zeroext i1 @_ZN6nettle6Socket11setupSocketEi11sockaddr_in(ptr noundef nonnull align 8 dereferenceable(88), i32 noundef, i64, i64) #1

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

; Function Attrs: nounwind
declare void @_ZN6nettle6SocketD2Ev(ptr noundef nonnull align 8 dereferenceable(88)) unnamed_addr #4

attributes #0 = { 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 #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 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 #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { inlinehint 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 #7 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!10, !10, i64 0}
!10 = !{!"_ZTSN6nettle10WriterTypeE", !7, i64 0}
!11 = !{!12, !14, i64 88}
!12 = !{!"_ZTSN6nettle6WriterE", !13, i64 0, !14, i64 88}
!13 = !{!"_ZTSN6nettle6SocketE", !14, i64 0, !15, i64 4, !16, i64 8, !19, i64 24, !19, i64 40, !21, i64 56}
!14 = !{!"bool", !7, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = !{!"_ZTS11sockaddr_in", !17, i64 0, !17, i64 2, !18, i64 4, !7, i64 8}
!17 = !{!"short", !7, i64 0}
!18 = !{!"_ZTS7in_addr", !15, i64 0}
!19 = !{!"_ZTS7timeval", !20, i64 0, !20, i64 8}
!20 = !{!"long", !7, i64 0}
!21 = !{!"_ZTSSt8functionIFvN6nettle11SocketErrorEEE", !22, i64 0, !6, i64 24}
!22 = !{!"_ZTSSt14_Function_base", !7, i64 0, !6, i64 16}
!23 = !{!13, !15, i64 4}
!24 = !{!16, !17, i64 0}
!25 = !{!16, !17, i64 2}
!26 = !{i64 0, i64 2, !27, i64 2, i64 2, !27, i64 4, i64 4, !28, i64 8, i64 8, !29}
!27 = !{!17, !17, i64 0}
!28 = !{!15, !15, i64 0}
!29 = !{!7, !7, 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"

%"class.std::function" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }
%struct.sockaddr_in = type { i16, i16, %struct.in_addr, [8 x i8] }
%struct.in_addr = type { i32 }
%"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] }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6nettle6WriterC2ENS_8HostPortENS_10WriterTypeESt8functionIFvNS_11SocketErrorEEE(ptr noundef nonnull align 8 dereferenceable(89) %0, ptr noundef %1, i32 noundef %2, ptr noundef nonnull %3) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca %"class.std::function", align 8
  %6 = alloca %struct.sockaddr_in, align 8
  %7 = alloca %"class.std::__cxx11::basic_string", align 8
  call void @_ZNSt8functionIFvN6nettle11SocketErrorEEEC2ERKS3_(ptr noundef nonnull align 8 dereferenceable(32) %5, ptr noundef nonnull align 8 dereferenceable(32) %3)
  invoke void @_ZN6nettle6SocketC2ESt8functionIFvNS_11SocketErrorEEE(ptr noundef nonnull align 8 dereferenceable(88) %0, ptr noundef nonnull %5)
          to label %8 unwind label %15

8:                                                ; preds = %4
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #7
  %9 = getelementptr inbounds i8, ptr %0, i64 88
  store i8 0, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #7
  %10 = icmp eq i32 %2, 0
  %11 = getelementptr inbounds i8, ptr %0, i64 4
  br i1 %10, label %12, label %19

12:                                               ; preds = %8
  %13 = call i32 @socket(i32 noundef 2, i32 noundef 1, i32 noundef 6) #7
  store i32 %13, ptr %11, align 4, !tbaa !20
  %14 = icmp slt i32 %13, 0
  br i1 %14, label %.invoke, label %22

15:                                               ; preds = %4
  %16 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #7
  br label %46

17:                                               ; preds = %.invoke, %41, %32, %30
  %18 = landingpad { ptr, i32 }
          cleanup
  br label %45

19:                                               ; preds = %8
  %20 = call i32 @socket(i32 noundef 2, i32 noundef 2, i32 noundef 17) #7
  store i32 %20, ptr %11, align 4, !tbaa !20
  %21 = icmp slt i32 %20, 0
  br i1 %21, label %.invoke, label %22

22:                                               ; preds = %19, %12
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %6, i8 0, i64 16, i1 false)
  store i16 2, ptr %6, align 8, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %7) #7
  invoke void @_ZNK6nettle8HostPort10getAddressB5cxx11Ev(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %7, ptr noundef nonnull align 8 dereferenceable(34) %1)
          to label %23 unwind label %28

23:                                               ; preds = %22
  %24 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %7) #7
  %25 = getelementptr inbounds i8, ptr %6, i64 4
  %26 = call i32 @inet_pton(i32 noundef 2, ptr noundef %24, ptr noundef nonnull %25) #7
  %27 = icmp slt i32 %26, 1
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #7
  br i1 %27, label %.invoke, label %30

28:                                               ; preds = %22
  %29 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %7) #7
  br label %45

30:                                               ; preds = %23
  %31 = invoke noundef signext i16 @_ZNK6nettle8HostPort7getPortEv(ptr noundef nonnull align 8 dereferenceable(34) %1)
          to label %32 unwind label %17

32:                                               ; preds = %30
  %33 = call noundef zeroext i16 @_ZL10__bswap_16t(i16 noundef zeroext %31)
  %34 = getelementptr inbounds i8, ptr %6, i64 2
  store i16 %33, ptr %34, align 2, !tbaa !22
  %35 = getelementptr inbounds i8, ptr %0, i64 4
  %36 = load i32, ptr %35, align 4, !tbaa !20
  %37 = invoke i32 @connect(i32 noundef %36, ptr noundef nonnull %6, i32 noundef 16)
          to label %38 unwind label %17

38:                                               ; preds = %32
  %39 = icmp slt i32 %37, 0
  br i1 %39, label %.invoke, label %41

.invoke:                                          ; preds = %12, %38, %23, %19
  %40 = phi i32 [ 4, %19 ], [ 4, %23 ], [ 9, %38 ], [ 4, %12 ]
  invoke void @_ZNKSt8functionIFvN6nettle11SocketErrorEEEclES1_(ptr noundef nonnull align 8 dereferenceable(32) %3, i32 noundef %40)
          to label %.sink.split unwind label %17

41:                                               ; preds = %38
  %42 = load i32, ptr %35, align 4, !tbaa !20
  %.sroa.0.0.copyload = load i64, ptr %6, align 8
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %6, i64 8
  %.sroa.2.0.copyload = load i64, ptr %.sroa.2.0..sroa_idx, align 8, !tbaa !23
  %43 = invoke noundef zeroext i1 @_ZN6nettle6Socket11setupSocketEi11sockaddr_in(ptr noundef nonnull align 8 dereferenceable(88) %0, i32 noundef %42, i64 %.sroa.0.0.copyload, i64 %.sroa.2.0.copyload)
          to label %44 unwind label %17

.sink.split:                                      ; preds = %.invoke
  store i8 1, ptr %9, align 8, !tbaa !5
  br label %44

44:                                               ; preds = %.sink.split, %41
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #7
  ret void

45:                                               ; preds = %28, %17
  %.pn = phi { ptr, i32 } [ %18, %17 ], [ %29, %28 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #7
  call void @_ZN6nettle6SocketD2Ev(ptr noundef nonnull align 8 dereferenceable(88) %0) #7
  br label %46

46:                                               ; preds = %45, %15
  %.pn.pn = phi { ptr, i32 } [ %.pn, %45 ], [ %16, %15 ]
  resume { ptr, i32 } %.pn.pn
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt8functionIFvN6nettle11SocketErrorEEEC2ERKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

declare void @_ZN6nettle6SocketC2ESt8functionIFvNS_11SocketErrorEEE(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef) unnamed_addr #1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNKSt8functionIFvN6nettle11SocketErrorEEEclES1_(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef) local_unnamed_addr #0 align 2

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

; Function Attrs: nounwind
declare i32 @inet_pton(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

declare void @_ZNK6nettle8HostPort10getAddressB5cxx11Ev(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 8 dereferenceable(34)) local_unnamed_addr #1

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

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

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

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

declare noundef signext i16 @_ZNK6nettle8HostPort7getPortEv(ptr noundef nonnull align 8 dereferenceable(34)) local_unnamed_addr #1

declare i32 @connect(i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

declare noundef zeroext i1 @_ZN6nettle6Socket11setupSocketEi11sockaddr_in(ptr noundef nonnull align 8 dereferenceable(88), i32 noundef, i64, i64) local_unnamed_addr #1

; Function Attrs: nounwind
declare void @_ZN6nettle6SocketD2Ev(ptr noundef nonnull align 8 dereferenceable(88)) unnamed_addr #4

attributes #0 = { 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 #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 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { inlinehint 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 #7 = { 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, !8, i64 88}
!6 = !{!"_ZTSN6nettle6WriterE", !7, i64 0, !8, i64 88}
!7 = !{!"_ZTSN6nettle6SocketE", !8, i64 0, !11, i64 4, !12, i64 8, !15, i64 24, !15, i64 40, !17, i64 56}
!8 = !{!"bool", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = !{!"_ZTS11sockaddr_in", !13, i64 0, !13, i64 2, !14, i64 4, !9, i64 8}
!13 = !{!"short", !9, i64 0}
!14 = !{!"_ZTS7in_addr", !11, i64 0}
!15 = !{!"_ZTS7timeval", !16, i64 0, !16, i64 8}
!16 = !{!"long", !9, i64 0}
!17 = !{!"_ZTSSt8functionIFvN6nettle11SocketErrorEEE", !18, i64 0, !19, i64 24}
!18 = !{!"_ZTSSt14_Function_base", !9, i64 0, !19, i64 16}
!19 = !{!"any pointer", !9, i64 0}
!20 = !{!7, !11, i64 4}
!21 = !{!12, !13, i64 0}
!22 = !{!12, !13, i64 2}
!23 = !{!9, !9, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass