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

; 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.ifaddrs = type { ptr, ptr, i32, ptr, ptr, %union.anon.1, ptr }
%union.anon.1 = type { ptr }
%struct.sockaddr = type { i16, [14 x i8] }
%"class.zmq::ip_resolver_t" = type <{ ptr, %"class.zmq::ip_resolver_options_t", [3 x i8] }>
%"class.zmq::ip_resolver_options_t" = type { i8, i8, i8, i8, i8 }

@.str.1 = external hidden unnamed_addr constant [115 x i8], align 1
@stderr = external global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [12 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN3zmq21ip_resolver_options_t4ipv6Ev(ptr noundef nonnull align 1 dereferenceable(5)) #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN3zmq13ip_resolver_t16resolve_nic_nameEPNS_9ip_addr_tEPKc(ptr noundef nonnull align 8 dereferenceable(13) %0, ptr noundef %1, ptr noundef %2) #4 align 2 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i8, align 1
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  %18 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #9
  store ptr null, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #9
  store i32 0, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #9
  store i32 10, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #9
  store i32 1, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #9
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %19

19:                                               ; preds = %40, %3
  %20 = load i32, ptr %12, align 4, !tbaa !9
  %21 = icmp slt i32 %20, 10
  br i1 %21, label %23, label %22

22:                                               ; preds = %19
  store i32 2, ptr %13, align 4
  br label %43

23:                                               ; preds = %19
  %24 = call i32 @getifaddrs(ptr noundef %8) #9
  store i32 %24, ptr %9, align 4, !tbaa !9
  %25 = load i32, ptr %9, align 4, !tbaa !9
  %26 = icmp eq i32 %25, 0
  br i1 %26, label %34, label %27

27:                                               ; preds = %23
  %28 = load i32, ptr %9, align 4, !tbaa !9
  %29 = icmp slt i32 %28, 0
  br i1 %29, label %30, label %35

30:                                               ; preds = %27
  %31 = call ptr @__errno_location() #10
  %32 = load i32, ptr %31, align 4, !tbaa !9
  %33 = icmp ne i32 %32, 111
  br i1 %33, label %34, label %35

34:                                               ; preds = %30, %23
  store i32 2, ptr %13, align 4
  br label %43

35:                                               ; preds = %30, %27
  %36 = load i32, ptr %12, align 4, !tbaa !9
  %37 = shl i32 1, %36
  %38 = mul nsw i32 %37, 1000
  %39 = call i32 @usleep(i32 noundef %38)
  br label %40

40:                                               ; preds = %35
  %41 = load i32, ptr %12, align 4, !tbaa !9
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %12, align 4, !tbaa !9
  br label %19, !llvm.loop !11

43:                                               ; preds = %34, %22
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #9
  br label %44

44:                                               ; preds = %43
  %45 = load i32, ptr %9, align 4, !tbaa !9
  %46 = icmp ne i32 %45, 0
  br i1 %46, label %47, label %57

47:                                               ; preds = %44
  %48 = call ptr @__errno_location() #10
  %49 = load i32, ptr %48, align 4, !tbaa !9
  %50 = icmp eq i32 %49, 22
  br i1 %50, label %55, label %51

51:                                               ; preds = %47
  %52 = call ptr @__errno_location() #10
  %53 = load i32, ptr %52, align 4, !tbaa !9
  %54 = icmp eq i32 %53, 95
  br i1 %54, label %55, label %57

55:                                               ; preds = %51, %47
  %56 = call ptr @__errno_location() #10
  store i32 19, ptr %56, align 4, !tbaa !9
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %13, align 4
  br label %150

57:                                               ; preds = %51, %44
  br label %58

58:                                               ; preds = %57
  %59 = load i32, ptr %9, align 4, !tbaa !9
  %60 = icmp eq i32 %59, 0
  %61 = xor i1 %60, true
  %62 = zext i1 %61 to i64
  %63 = call i64 @llvm.expect.i64(i64 %62, i64 0)
  %64 = icmp ne i64 %63, 0
  br i1 %64, label %65, label %75

65:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #9
  %66 = call ptr @__errno_location() #10
  %67 = load i32, ptr %66, align 4, !tbaa !9
  %68 = call ptr @strerror(i32 noundef %67) #9
  store ptr %68, ptr %14, align 8, !tbaa !5
  %69 = load ptr, ptr @stderr, align 8, !tbaa !5
  %70 = load ptr, ptr %14, align 8, !tbaa !5
  %71 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %69, ptr noundef @.str.8, ptr noundef %70, ptr noundef @.str.1, i32 noundef 518) #9
  %72 = load ptr, ptr @stderr, align 8, !tbaa !5
  %73 = call i32 @fflush(ptr noundef %72)
  %74 = load ptr, ptr %14, align 8, !tbaa !5
  call void @_ZN3zmq9zmq_abortEPKc(ptr noundef %74)
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #9
  br label %75

75:                                               ; preds = %65, %58
  br label %76

76:                                               ; preds = %75
  br label %77

77:                                               ; preds = %76
  br label %78

78:                                               ; preds = %77
  %79 = load ptr, ptr %8, align 8, !tbaa !5
  %80 = icmp ne ptr %79, null
  %81 = xor i1 %80, true
  %82 = zext i1 %81 to i64
  %83 = call i64 @llvm.expect.i64(i64 %82, i64 0)
  %84 = icmp ne i64 %83, 0
  br i1 %84, label %85, label %90

85:                                               ; preds = %78
  %86 = load ptr, ptr @stderr, align 8, !tbaa !5
  %87 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %86, ptr noundef @.str.5, ptr noundef @.str.9, ptr noundef @.str.1, i32 noundef 519) #9
  %88 = load ptr, ptr @stderr, align 8, !tbaa !5
  %89 = call i32 @fflush(ptr noundef %88)
  call void @_ZN3zmq9zmq_abortEPKc(ptr noundef @.str.9)
  br label %90

90:                                               ; preds = %85, %78
  br label %91

91:                                               ; preds = %90
  br label %92

92:                                               ; preds = %91
  call void @llvm.lifetime.start.p0(i64 1, ptr %15) #9
  store i8 0, ptr %15, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #9
  %93 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %93, ptr %16, align 8, !tbaa !5
  br label %94

94:                                               ; preds = %137, %92
  %95 = load ptr, ptr %16, align 8, !tbaa !5
  %96 = icmp ne ptr %95, null
  br i1 %96, label %98, label %97

97:                                               ; preds = %94
  store i32 9, ptr %13, align 4
  br label %141

98:                                               ; preds = %94
  %99 = load ptr, ptr %16, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.ifaddrs, ptr %99, i32 0, i32 3
  %101 = load ptr, ptr %100, align 8, !tbaa !15
  %102 = icmp eq ptr %101, null
  br i1 %102, label %103, label %104

103:                                              ; preds = %98
  br label %137

104:                                              ; preds = %98
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #9
  %105 = load ptr, ptr %16, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.ifaddrs, ptr %105, i32 0, i32 3
  %107 = load ptr, ptr %106, align 8, !tbaa !15
  %108 = getelementptr inbounds %struct.sockaddr, ptr %107, i32 0, i32 0
  %109 = load i16, ptr %108, align 2, !tbaa !17
  %110 = zext i16 %109 to i32
  store i32 %110, ptr %17, align 4, !tbaa !9
  %111 = load i32, ptr %17, align 4, !tbaa !9
  %112 = getelementptr inbounds %"class.zmq::ip_resolver_t", ptr %18, i32 0, i32 1
  %113 = call noundef zeroext i1 @_ZN3zmq21ip_resolver_options_t4ipv6Ev(ptr noundef nonnull align 1 dereferenceable(5) %112)
  %114 = zext i1 %113 to i64
  %115 = select i1 %113, i32 10, i32 2
  %116 = icmp eq i32 %111, %115
  br i1 %116, label %117, label %133

117:                                              ; preds = %104
  %118 = load ptr, ptr %7, align 8, !tbaa !5
  %119 = load ptr, ptr %16, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.ifaddrs, ptr %119, i32 0, i32 1
  %121 = load ptr, ptr %120, align 8, !tbaa !20
  %122 = call i32 @strcmp(ptr noundef %118, ptr noundef %121) #11
  %123 = icmp ne i32 %122, 0
  br i1 %123, label %133, label %124

124:                                              ; preds = %117
  %125 = load ptr, ptr %6, align 8, !tbaa !5
  %126 = load ptr, ptr %16, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.ifaddrs, ptr %126, i32 0, i32 3
  %128 = load ptr, ptr %127, align 8, !tbaa !15
  %129 = load i32, ptr %17, align 4, !tbaa !9
  %130 = icmp eq i32 %129, 2
  %131 = zext i1 %130 to i64
  %132 = select i1 %130, i64 16, i64 28
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %125, ptr align 2 %128, i64 %132, i1 false)
  store i8 1, ptr %15, align 1, !tbaa !13
  store i32 9, ptr %13, align 4
  br label %134

133:                                              ; preds = %117, %104
  store i32 0, ptr %13, align 4
  br label %134

134:                                              ; preds = %133, %124
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #9
  %135 = load i32, ptr %13, align 4
  switch i32 %135, label %141 [
    i32 0, label %136
  ]

136:                                              ; preds = %134
  br label %137

137:                                              ; preds = %136, %103
  %138 = load ptr, ptr %16, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.ifaddrs, ptr %138, i32 0, i32 0
  %140 = load ptr, ptr %139, align 8, !tbaa !21
  store ptr %140, ptr %16, align 8, !tbaa !5
  br label %94, !llvm.loop !22

141:                                              ; preds = %134, %97
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #9
  br label %142

142:                                              ; preds = %141
  %143 = load ptr, ptr %8, align 8, !tbaa !5
  call void @freeifaddrs(ptr noundef %143) #9
  %144 = load i8, ptr %15, align 1, !tbaa !13, !range !23, !noundef !24
  %145 = trunc i8 %144 to i1
  br i1 %145, label %148, label %146

146:                                              ; preds = %142
  %147 = call ptr @__errno_location() #10
  store i32 19, ptr %147, align 4, !tbaa !9
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %13, align 4
  br label %149

148:                                              ; preds = %142
  store i32 0, ptr %4, align 4
  store i32 1, ptr %13, align 4
  br label %149

149:                                              ; preds = %148, %146
  call void @llvm.lifetime.end.p0(i64 1, ptr %15) #9
  br label %150

150:                                              ; preds = %149, %55
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #9
  %151 = load i32, ptr %4, align 4
  ret i32 %151
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i64 @llvm.expect.i64(i64, i64) #5

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

declare i32 @fflush(ptr noundef) #7

declare void @_ZN3zmq9zmq_abortEPKc(ptr noundef) #7

; Function Attrs: nounwind
declare i32 @getifaddrs(ptr noundef) #6

declare i32 @usleep(i32 noundef) #7

; Function Attrs: nounwind
declare ptr @strerror(i32 noundef) #6

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #8

; Function Attrs: nounwind
declare void @freeifaddrs(ptr noundef) #6

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #4 = { 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 #5 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #6 = { 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 #7 = { "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 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 #9 = { nounwind }
attributes #10 = { nounwind willreturn memory(none) }
attributes #11 = { nounwind willreturn memory(read) }

!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 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{!16, !6, i64 24}
!16 = !{!"_ZTS7ifaddrs", !6, i64 0, !6, i64 8, !10, i64 16, !6, i64 24, !6, i64 32, !7, i64 40, !6, i64 48}
!17 = !{!18, !19, i64 0}
!18 = !{!"_ZTS8sockaddr", !19, i64 0, !7, i64 2}
!19 = !{!"short", !7, i64 0}
!20 = !{!16, !6, i64 8}
!21 = !{!16, !6, i64 0}
!22 = distinct !{!22, !12}
!23 = !{i8 0, i8 2}
!24 = !{}


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

@.str.1 = external hidden unnamed_addr constant [115 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [12 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: 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) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN3zmq21ip_resolver_options_t4ipv6Ev(ptr noundef nonnull align 1 dereferenceable(5)) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 -1, 1) i32 @_ZN3zmq13ip_resolver_t16resolve_nic_nameEPNS_9ip_addr_tEPKc(ptr noundef nonnull align 8 dereferenceable(13) %0, ptr nocapture noundef writeonly %1, ptr nocapture noundef readonly %2) local_unnamed_addr #4 align 2 {
  %4 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #9
  store ptr null, ptr %4, align 8, !tbaa !5
  %5 = call i32 @getifaddrs(ptr noundef nonnull %4) #9
  %6 = icmp eq i32 %5, 0
  br i1 %6, label %.thread, label %7

7:                                                ; preds = %3
  %8 = icmp slt i32 %5, 0
  br i1 %8, label %9, label %12

9:                                                ; preds = %7
  %10 = tail call ptr @__errno_location() #10
  %11 = load i32, ptr %10, align 4, !tbaa !9
  %.not = icmp eq i32 %11, 111
  br i1 %.not, label %12, label %.thread41

12:                                               ; preds = %9, %7
  %13 = call i32 @usleep(i32 noundef 1000)
  %14 = call i32 @getifaddrs(ptr noundef nonnull %4) #9
  %15 = icmp eq i32 %14, 0
  br i1 %15, label %.thread, label %16

16:                                               ; preds = %12
  %17 = icmp slt i32 %14, 0
  br i1 %17, label %18, label %21

18:                                               ; preds = %16
  %19 = tail call ptr @__errno_location() #10
  %20 = load i32, ptr %19, align 4, !tbaa !9
  %.not.1 = icmp eq i32 %20, 111
  br i1 %.not.1, label %21, label %.thread41

21:                                               ; preds = %18, %16
  %22 = call i32 @usleep(i32 noundef 2000)
  %23 = call i32 @getifaddrs(ptr noundef nonnull %4) #9
  %24 = icmp eq i32 %23, 0
  br i1 %24, label %.thread, label %25

25:                                               ; preds = %21
  %26 = icmp slt i32 %23, 0
  br i1 %26, label %27, label %30

27:                                               ; preds = %25
  %28 = tail call ptr @__errno_location() #10
  %29 = load i32, ptr %28, align 4, !tbaa !9
  %.not.2 = icmp eq i32 %29, 111
  br i1 %.not.2, label %30, label %.thread41

30:                                               ; preds = %27, %25
  %31 = call i32 @usleep(i32 noundef 4000)
  %32 = call i32 @getifaddrs(ptr noundef nonnull %4) #9
  %33 = icmp eq i32 %32, 0
  br i1 %33, label %.thread, label %34

34:                                               ; preds = %30
  %35 = icmp slt i32 %32, 0
  br i1 %35, label %36, label %39

36:                                               ; preds = %34
  %37 = tail call ptr @__errno_location() #10
  %38 = load i32, ptr %37, align 4, !tbaa !9
  %.not.3 = icmp eq i32 %38, 111
  br i1 %.not.3, label %39, label %.thread41

39:                                               ; preds = %36, %34
  %40 = call i32 @usleep(i32 noundef 8000)
  %41 = call i32 @getifaddrs(ptr noundef nonnull %4) #9
  %42 = icmp eq i32 %41, 0
  br i1 %42, label %.thread, label %43

43:                                               ; preds = %39
  %44 = icmp slt i32 %41, 0
  br i1 %44, label %45, label %48

45:                                               ; preds = %43
  %46 = tail call ptr @__errno_location() #10
  %47 = load i32, ptr %46, align 4, !tbaa !9
  %.not.4 = icmp eq i32 %47, 111
  br i1 %.not.4, label %48, label %.thread41

48:                                               ; preds = %45, %43
  %49 = call i32 @usleep(i32 noundef 16000)
  %50 = call i32 @getifaddrs(ptr noundef nonnull %4) #9
  %51 = icmp eq i32 %50, 0
  br i1 %51, label %.thread, label %52

52:                                               ; preds = %48
  %53 = icmp slt i32 %50, 0
  br i1 %53, label %54, label %57

54:                                               ; preds = %52
  %55 = tail call ptr @__errno_location() #10
  %56 = load i32, ptr %55, align 4, !tbaa !9
  %.not.5 = icmp eq i32 %56, 111
  br i1 %.not.5, label %57, label %.thread41

57:                                               ; preds = %54, %52
  %58 = call i32 @usleep(i32 noundef 32000)
  %59 = call i32 @getifaddrs(ptr noundef nonnull %4) #9
  %60 = icmp eq i32 %59, 0
  br i1 %60, label %.thread, label %61

61:                                               ; preds = %57
  %62 = icmp slt i32 %59, 0
  br i1 %62, label %63, label %66

63:                                               ; preds = %61
  %64 = tail call ptr @__errno_location() #10
  %65 = load i32, ptr %64, align 4, !tbaa !9
  %.not.6 = icmp eq i32 %65, 111
  br i1 %.not.6, label %66, label %.thread41

66:                                               ; preds = %63, %61
  %67 = call i32 @usleep(i32 noundef 64000)
  %68 = call i32 @getifaddrs(ptr noundef nonnull %4) #9
  %69 = icmp eq i32 %68, 0
  br i1 %69, label %.thread, label %70

70:                                               ; preds = %66
  %71 = icmp slt i32 %68, 0
  br i1 %71, label %72, label %75

72:                                               ; preds = %70
  %73 = tail call ptr @__errno_location() #10
  %74 = load i32, ptr %73, align 4, !tbaa !9
  %.not.7 = icmp eq i32 %74, 111
  br i1 %.not.7, label %75, label %.thread41

75:                                               ; preds = %72, %70
  %76 = call i32 @usleep(i32 noundef 128000)
  %77 = call i32 @getifaddrs(ptr noundef nonnull %4) #9
  %78 = icmp eq i32 %77, 0
  br i1 %78, label %.thread, label %79

79:                                               ; preds = %75
  %80 = icmp slt i32 %77, 0
  br i1 %80, label %81, label %84

81:                                               ; preds = %79
  %82 = tail call ptr @__errno_location() #10
  %83 = load i32, ptr %82, align 4, !tbaa !9
  %.not.8 = icmp eq i32 %83, 111
  br i1 %.not.8, label %84, label %.thread41

84:                                               ; preds = %81, %79
  %85 = call i32 @usleep(i32 noundef 256000)
  %86 = call i32 @getifaddrs(ptr noundef nonnull %4) #9
  %87 = icmp eq i32 %86, 0
  br i1 %87, label %.thread, label %88

88:                                               ; preds = %84
  %89 = icmp slt i32 %86, 0
  br i1 %89, label %90, label %93

90:                                               ; preds = %88
  %91 = tail call ptr @__errno_location() #10
  %92 = load i32, ptr %91, align 4, !tbaa !9
  %.not.9 = icmp eq i32 %92, 111
  br i1 %.not.9, label %93, label %.thread41

93:                                               ; preds = %90, %88
  %94 = call i32 @usleep(i32 noundef 512000)
  %.pre58 = tail call ptr @__errno_location() #10
  %.pr = load i32, ptr %.pre58, align 4, !tbaa !9
  br label %.thread41

.thread41:                                        ; preds = %93, %90, %81, %72, %63, %54, %45, %36, %27, %18, %9
  %95 = phi i32 [ %.pr, %93 ], [ %92, %90 ], [ %83, %81 ], [ %74, %72 ], [ %65, %63 ], [ %56, %54 ], [ %47, %45 ], [ %38, %36 ], [ %29, %27 ], [ %20, %18 ], [ %11, %9 ]
  %.pre-phi = phi ptr [ %.pre58, %93 ], [ %91, %90 ], [ %82, %81 ], [ %73, %72 ], [ %64, %63 ], [ %55, %54 ], [ %46, %45 ], [ %37, %36 ], [ %28, %27 ], [ %19, %18 ], [ %10, %9 ]
  switch i32 %95, label %97 [
    i32 22, label %96
    i32 95, label %96
  ]

96:                                               ; preds = %.thread41, %.thread41
  store i32 19, ptr %.pre-phi, align 4, !tbaa !9
  br label %131

97:                                               ; preds = %.thread41
  %98 = call ptr @strerror(i32 noundef %95) #9
  %99 = load ptr, ptr @stderr, align 8, !tbaa !5
  %100 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %99, ptr noundef nonnull @.str.8, ptr noundef %98, ptr noundef nonnull @.str.1, i32 noundef 518) #11
  %101 = load ptr, ptr @stderr, align 8, !tbaa !5
  %102 = call i32 @fflush(ptr noundef %101)
  call void @_ZN3zmq9zmq_abortEPKc(ptr noundef %98)
  br label %.thread

.thread:                                          ; preds = %3, %12, %21, %30, %39, %48, %57, %66, %75, %84, %97
  %103 = load ptr, ptr %4, align 8, !tbaa !5
  %.not35 = icmp eq ptr %103, null
  br i1 %.not35, label %104, label %.lr.ph, !prof !11

104:                                              ; preds = %.thread
  %105 = load ptr, ptr @stderr, align 8, !tbaa !5
  %106 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %105, ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.1, i32 noundef 519) #11
  %107 = load ptr, ptr @stderr, align 8, !tbaa !5
  %108 = call i32 @fflush(ptr noundef %107)
  call void @_ZN3zmq9zmq_abortEPKc(ptr noundef nonnull @.str.9)
  %.02253.pre = load ptr, ptr %4, align 8, !tbaa !5
  %.not3654 = icmp eq ptr %.02253.pre, null
  br i1 %.not3654, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.thread, %104
  %.0225362 = phi ptr [ %.02253.pre, %104 ], [ %103, %.thread ]
  %109 = getelementptr inbounds i8, ptr %0, i64 8
  br label %110

110:                                              ; preds = %.lr.ph, %.thread44
  %.02255 = phi ptr [ %.0225362, %.lr.ph ], [ %.022, %.thread44 ]
  %111 = getelementptr inbounds i8, ptr %.02255, i64 24
  %112 = load ptr, ptr %111, align 8, !tbaa !12
  %113 = icmp eq ptr %112, null
  br i1 %113, label %.thread44, label %114

114:                                              ; preds = %110
  %115 = load i16, ptr %112, align 2, !tbaa !14
  %116 = zext i16 %115 to i32
  %117 = call noundef zeroext i1 @_ZN3zmq21ip_resolver_options_t4ipv6Ev(ptr noundef nonnull align 1 dereferenceable(5) %109)
  %118 = select i1 %117, i32 10, i32 2
  %119 = icmp eq i32 %118, %116
  br i1 %119, label %120, label %.thread44

120:                                              ; preds = %114
  %121 = getelementptr inbounds i8, ptr %.02255, i64 8
  %122 = load ptr, ptr %121, align 8, !tbaa !17
  %123 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %2, ptr noundef nonnull dereferenceable(1) %122) #12
  %.not37 = icmp eq i32 %123, 0
  br i1 %.not37, label %.thread47, label %.thread44

.thread47:                                        ; preds = %120
  %124 = getelementptr inbounds i8, ptr %.02255, i64 24
  %125 = load ptr, ptr %124, align 8, !tbaa !12
  %126 = icmp eq i16 %115, 2
  %127 = select i1 %126, i64 16, i64 28
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(16) %1, ptr noundef nonnull align 2 dereferenceable(16) %125, i64 %127, i1 false)
  %128 = load ptr, ptr %4, align 8, !tbaa !5
  call void @freeifaddrs(ptr noundef %128) #9
  br label %131

.thread44:                                        ; preds = %114, %120, %110
  %.022 = load ptr, ptr %.02255, align 8, !tbaa !5
  %.not36 = icmp eq ptr %.022, null
  br i1 %.not36, label %._crit_edge.loopexit, label %110, !llvm.loop !18

._crit_edge.loopexit:                             ; preds = %.thread44
  %.pre = load ptr, ptr %4, align 8, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %104
  %129 = phi ptr [ %.pre, %._crit_edge.loopexit ], [ null, %104 ]
  call void @freeifaddrs(ptr noundef %129) #9
  %130 = tail call ptr @__errno_location() #10
  store i32 19, ptr %130, align 4, !tbaa !9
  br label %131

131:                                              ; preds = %.thread47, %._crit_edge, %96
  %.1 = phi i32 [ -1, %96 ], [ -1, %._crit_edge ], [ 0, %.thread47 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #9
  ret i32 %.1
}

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #5

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

declare void @_ZN3zmq9zmq_abortEPKc(ptr noundef) local_unnamed_addr #6

; Function Attrs: nounwind
declare i32 @getifaddrs(ptr noundef) local_unnamed_addr #7

declare i32 @usleep(i32 noundef) local_unnamed_addr #6

; Function Attrs: nounwind
declare ptr @strerror(i32 noundef) local_unnamed_addr #7

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 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 #4 = { 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 #5 = { 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 #6 = { "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 "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 = { 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 #9 = { nounwind }
attributes #10 = { nounwind willreturn memory(none) }
attributes #11 = { cold nounwind }
attributes #12 = { nounwind willreturn memory(read) }

!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 = !{!"int", !7, i64 0}
!11 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!12 = !{!13, !6, i64 24}
!13 = !{!"_ZTS7ifaddrs", !6, i64 0, !6, i64 8, !10, i64 16, !6, i64 24, !6, i64 32, !7, i64 40, !6, i64 48}
!14 = !{!15, !16, i64 0}
!15 = !{!"_ZTS8sockaddr", !16, i64 0, !7, i64 2}
!16 = !{!"short", !7, i64 0}
!17 = !{!13, !6, i64 8}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LowerExpectIntrinsicPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass