; LLVM IR from erwincoumans/tiny-differentiable-simulator :: third_party/zeromq/src/dist.ll (ZN3zmq6dist_t10distributeEPNS_5msg_tE)

; 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.zmq::dist_t" = type <{ %"class.zmq::array_t", i64, i64, i64, i8, [7 x i8] }>
%"class.zmq::array_t" = type { %"class.std::vector" }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<zmq::pipe_t *, std::allocator<zmq::pipe_t *>>::_Vector_impl" }
%"struct.std::_Vector_base<zmq::pipe_t *, std::allocator<zmq::pipe_t *>>::_Vector_impl" = type { %"struct.std::_Vector_base<zmq::pipe_t *, std::allocator<zmq::pipe_t *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<zmq::pipe_t *, std::allocator<zmq::pipe_t *>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@stderr = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [108 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [12 x i8], align 1

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

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

declare i32 @fflush(ptr noundef) #2

declare void @_ZN3zmq9zmq_abortEPKc(ptr noundef) #2

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3zmq6dist_t10distributeEPNS_5msg_tE(ptr noundef nonnull align 8 dereferenceable(49) %0, ptr noundef %1) #4 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca i64, align 8
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %16 = load ptr, ptr %3, align 8
  %17 = getelementptr inbounds %"class.zmq::dist_t", ptr %16, i32 0, i32 1
  %18 = load i64, ptr %17, align 8, !tbaa !9
  %19 = icmp eq i64 %18, 0
  br i1 %19, label %20, label %65

20:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = call noundef i32 @_ZN3zmq5msg_t5closeEv(ptr noundef nonnull align 8 dereferenceable(64) %21)
  store i32 %22, ptr %5, align 4, !tbaa !18
  br label %23

23:                                               ; preds = %20
  %24 = load i32, ptr %5, align 4, !tbaa !18
  %25 = icmp eq i32 %24, 0
  %26 = xor i1 %25, true
  %27 = zext i1 %26 to i64
  %28 = call i64 @llvm.expect.i64(i64 %27, i64 0)
  %29 = icmp ne i64 %28, 0
  br i1 %29, label %30, label %40

30:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %31 = call ptr @__errno_location() #8
  %32 = load i32, ptr %31, align 4, !tbaa !18
  %33 = call ptr @strerror(i32 noundef %32) #7
  store ptr %33, ptr %6, align 8, !tbaa !5
  %34 = load ptr, ptr @stderr, align 8, !tbaa !5
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %34, ptr noundef @.str.3, ptr noundef %35, ptr noundef @.str.2, i32 noundef 167) #7
  %37 = load ptr, ptr @stderr, align 8, !tbaa !5
  %38 = call i32 @fflush(ptr noundef %37)
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN3zmq9zmq_abortEPKc(ptr noundef %39)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  br label %40

40:                                               ; preds = %30, %23
  br label %41

41:                                               ; preds = %40
  br label %42

42:                                               ; preds = %41
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = call noundef i32 @_ZN3zmq5msg_t4initEv(ptr noundef nonnull align 8 dereferenceable(64) %43)
  store i32 %44, ptr %5, align 4, !tbaa !18
  br label %45

45:                                               ; preds = %42
  %46 = load i32, ptr %5, align 4, !tbaa !18
  %47 = icmp eq i32 %46, 0
  %48 = xor i1 %47, true
  %49 = zext i1 %48 to i64
  %50 = call i64 @llvm.expect.i64(i64 %49, i64 0)
  %51 = icmp ne i64 %50, 0
  br i1 %51, label %52, label %62

52:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %53 = call ptr @__errno_location() #8
  %54 = load i32, ptr %53, align 4, !tbaa !18
  %55 = call ptr @strerror(i32 noundef %54) #7
  store ptr %55, ptr %7, align 8, !tbaa !5
  %56 = load ptr, ptr @stderr, align 8, !tbaa !5
  %57 = load ptr, ptr %7, align 8, !tbaa !5
  %58 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %56, ptr noundef @.str.3, ptr noundef %57, ptr noundef @.str.2, i32 noundef 169) #7
  %59 = load ptr, ptr @stderr, align 8, !tbaa !5
  %60 = call i32 @fflush(ptr noundef %59)
  %61 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZN3zmq9zmq_abortEPKc(ptr noundef %61)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  br label %62

62:                                               ; preds = %52, %45
  br label %63

63:                                               ; preds = %62
  br label %64

64:                                               ; preds = %63
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  br label %194

65:                                               ; preds = %2
  %66 = load ptr, ptr %4, align 8, !tbaa !5
  %67 = call noundef zeroext i1 @_ZNK3zmq5msg_t6is_vsmEv(ptr noundef nonnull align 8 dereferenceable(64) %66)
  br i1 %67, label %68, label %134

68:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  store i64 0, ptr %8, align 8, !tbaa !20
  br label %69

69:                                               ; preds = %86, %68
  %70 = load i64, ptr %8, align 8, !tbaa !20
  %71 = getelementptr inbounds %"class.zmq::dist_t", ptr %16, i32 0, i32 1
  %72 = load i64, ptr %71, align 8, !tbaa !9
  %73 = icmp ult i64 %70, %72
  br i1 %73, label %75, label %74

74:                                               ; preds = %69
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  br label %89

75:                                               ; preds = %69
  %76 = getelementptr inbounds %"class.zmq::dist_t", ptr %16, i32 0, i32 0
  %77 = load i64, ptr %8, align 8, !tbaa !20
  %78 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN3zmq7array_tINS_6pipe_tELi2EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %76, i64 noundef %77)
  %79 = load ptr, ptr %78, align 8, !tbaa !5
  %80 = load ptr, ptr %4, align 8, !tbaa !5
  %81 = call noundef zeroext i1 @_ZN3zmq6dist_t5writeEPNS_6pipe_tEPNS_5msg_tE(ptr noundef nonnull align 8 dereferenceable(49) %16, ptr noundef %79, ptr noundef %80)
  br i1 %81, label %85, label %82

82:                                               ; preds = %75
  %83 = load i64, ptr %8, align 8, !tbaa !20
  %84 = add i64 %83, -1
  store i64 %84, ptr %8, align 8, !tbaa !20
  br label %85

85:                                               ; preds = %82, %75
  br label %86

86:                                               ; preds = %85
  %87 = load i64, ptr %8, align 8, !tbaa !20
  %88 = add i64 %87, 1
  store i64 %88, ptr %8, align 8, !tbaa !20
  br label %69, !llvm.loop !21

89:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = call noundef i32 @_ZN3zmq5msg_t5closeEv(ptr noundef nonnull align 8 dereferenceable(64) %90)
  store i32 %91, ptr %9, align 4, !tbaa !18
  br label %92

92:                                               ; preds = %89
  %93 = load i32, ptr %9, align 4, !tbaa !18
  %94 = icmp eq i32 %93, 0
  %95 = xor i1 %94, true
  %96 = zext i1 %95 to i64
  %97 = call i64 @llvm.expect.i64(i64 %96, i64 0)
  %98 = icmp ne i64 %97, 0
  br i1 %98, label %99, label %109

99:                                               ; preds = %92
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %100 = call ptr @__errno_location() #8
  %101 = load i32, ptr %100, align 4, !tbaa !18
  %102 = call ptr @strerror(i32 noundef %101) #7
  store ptr %102, ptr %10, align 8, !tbaa !5
  %103 = load ptr, ptr @stderr, align 8, !tbaa !5
  %104 = load ptr, ptr %10, align 8, !tbaa !5
  %105 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %103, ptr noundef @.str.3, ptr noundef %104, ptr noundef @.str.2, i32 noundef 178) #7
  %106 = load ptr, ptr @stderr, align 8, !tbaa !5
  %107 = call i32 @fflush(ptr noundef %106)
  %108 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN3zmq9zmq_abortEPKc(ptr noundef %108)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  br label %109

109:                                              ; preds = %99, %92
  br label %110

110:                                              ; preds = %109
  br label %111

111:                                              ; preds = %110
  %112 = load ptr, ptr %4, align 8, !tbaa !5
  %113 = call noundef i32 @_ZN3zmq5msg_t4initEv(ptr noundef nonnull align 8 dereferenceable(64) %112)
  store i32 %113, ptr %9, align 4, !tbaa !18
  br label %114

114:                                              ; preds = %111
  %115 = load i32, ptr %9, align 4, !tbaa !18
  %116 = icmp eq i32 %115, 0
  %117 = xor i1 %116, true
  %118 = zext i1 %117 to i64
  %119 = call i64 @llvm.expect.i64(i64 %118, i64 0)
  %120 = icmp ne i64 %119, 0
  br i1 %120, label %121, label %131

121:                                              ; preds = %114
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %122 = call ptr @__errno_location() #8
  %123 = load i32, ptr %122, align 4, !tbaa !18
  %124 = call ptr @strerror(i32 noundef %123) #7
  store ptr %124, ptr %11, align 8, !tbaa !5
  %125 = load ptr, ptr @stderr, align 8, !tbaa !5
  %126 = load ptr, ptr %11, align 8, !tbaa !5
  %127 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %125, ptr noundef @.str.3, ptr noundef %126, ptr noundef @.str.2, i32 noundef 180) #7
  %128 = load ptr, ptr @stderr, align 8, !tbaa !5
  %129 = call i32 @fflush(ptr noundef %128)
  %130 = load ptr, ptr %11, align 8, !tbaa !5
  call void @_ZN3zmq9zmq_abortEPKc(ptr noundef %130)
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  br label %131

131:                                              ; preds = %121, %114
  br label %132

132:                                              ; preds = %131
  br label %133

133:                                              ; preds = %132
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %194

134:                                              ; preds = %65
  %135 = load ptr, ptr %4, align 8, !tbaa !5
  %136 = getelementptr inbounds %"class.zmq::dist_t", ptr %16, i32 0, i32 1
  %137 = load i64, ptr %136, align 8, !tbaa !9
  %138 = trunc i64 %137 to i32
  %139 = sub nsw i32 %138, 1
  call void @_ZN3zmq5msg_t8add_refsEi(ptr noundef nonnull align 8 dereferenceable(64) %135, i32 noundef %139)
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 0, ptr %12, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  store i64 0, ptr %13, align 8, !tbaa !20
  br label %140

140:                                              ; preds = %159, %134
  %141 = load i64, ptr %13, align 8, !tbaa !20
  %142 = getelementptr inbounds %"class.zmq::dist_t", ptr %16, i32 0, i32 1
  %143 = load i64, ptr %142, align 8, !tbaa !9
  %144 = icmp ult i64 %141, %143
  br i1 %144, label %146, label %145

145:                                              ; preds = %140
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  br label %162

146:                                              ; preds = %140
  %147 = getelementptr inbounds %"class.zmq::dist_t", ptr %16, i32 0, i32 0
  %148 = load i64, ptr %13, align 8, !tbaa !20
  %149 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN3zmq7array_tINS_6pipe_tELi2EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %147, i64 noundef %148)
  %150 = load ptr, ptr %149, align 8, !tbaa !5
  %151 = load ptr, ptr %4, align 8, !tbaa !5
  %152 = call noundef zeroext i1 @_ZN3zmq6dist_t5writeEPNS_6pipe_tEPNS_5msg_tE(ptr noundef nonnull align 8 dereferenceable(49) %16, ptr noundef %150, ptr noundef %151)
  br i1 %152, label %158, label %153

153:                                              ; preds = %146
  %154 = load i32, ptr %12, align 4, !tbaa !18
  %155 = add nsw i32 %154, 1
  store i32 %155, ptr %12, align 4, !tbaa !18
  %156 = load i64, ptr %13, align 8, !tbaa !20
  %157 = add i64 %156, -1
  store i64 %157, ptr %13, align 8, !tbaa !20
  br label %158

158:                                              ; preds = %153, %146
  br label %159

159:                                              ; preds = %158
  %160 = load i64, ptr %13, align 8, !tbaa !20
  %161 = add i64 %160, 1
  store i64 %161, ptr %13, align 8, !tbaa !20
  br label %140, !llvm.loop !23

162:                                              ; preds = %145
  %163 = load i32, ptr %12, align 4, !tbaa !18
  %164 = sext i32 %163 to i64
  %165 = call i64 @llvm.expect.i64(i64 %164, i64 0)
  %166 = icmp ne i64 %165, 0
  br i1 %166, label %167, label %171

167:                                              ; preds = %162
  %168 = load ptr, ptr %4, align 8, !tbaa !5
  %169 = load i32, ptr %12, align 4, !tbaa !18
  %170 = call noundef zeroext i1 @_ZN3zmq5msg_t7rm_refsEi(ptr noundef nonnull align 8 dereferenceable(64) %168, i32 noundef %169)
  br label %171

171:                                              ; preds = %167, %162
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  %172 = load ptr, ptr %4, align 8, !tbaa !5
  %173 = call noundef i32 @_ZN3zmq5msg_t4initEv(ptr noundef nonnull align 8 dereferenceable(64) %172)
  store i32 %173, ptr %14, align 4, !tbaa !18
  br label %174

174:                                              ; preds = %171
  %175 = load i32, ptr %14, align 4, !tbaa !18
  %176 = icmp eq i32 %175, 0
  %177 = xor i1 %176, true
  %178 = zext i1 %177 to i64
  %179 = call i64 @llvm.expect.i64(i64 %178, i64 0)
  %180 = icmp ne i64 %179, 0
  br i1 %180, label %181, label %191

181:                                              ; preds = %174
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %182 = call ptr @__errno_location() #8
  %183 = load i32, ptr %182, align 4, !tbaa !18
  %184 = call ptr @strerror(i32 noundef %183) #7
  store ptr %184, ptr %15, align 8, !tbaa !5
  %185 = load ptr, ptr @stderr, align 8, !tbaa !5
  %186 = load ptr, ptr %15, align 8, !tbaa !5
  %187 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %185, ptr noundef @.str.3, ptr noundef %186, ptr noundef @.str.2, i32 noundef 201) #7
  %188 = load ptr, ptr @stderr, align 8, !tbaa !5
  %189 = call i32 @fflush(ptr noundef %188)
  %190 = load ptr, ptr %15, align 8, !tbaa !5
  call void @_ZN3zmq9zmq_abortEPKc(ptr noundef %190)
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  br label %191

191:                                              ; preds = %181, %174
  br label %192

192:                                              ; preds = %191
  br label %193

193:                                              ; preds = %192
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %194

194:                                              ; preds = %193, %133, %64
  ret void
}

declare noundef i32 @_ZN3zmq5msg_t5closeEv(ptr noundef nonnull align 8 dereferenceable(64)) #2

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

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

declare noundef i32 @_ZN3zmq5msg_t4initEv(ptr noundef nonnull align 8 dereferenceable(64)) #2

declare noundef zeroext i1 @_ZNK3zmq5msg_t6is_vsmEv(ptr noundef nonnull align 8 dereferenceable(64)) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3zmq6dist_t5writeEPNS_6pipe_tEPNS_5msg_tE(ptr noundef nonnull align 8 dereferenceable(49), ptr noundef, ptr noundef) #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN3zmq7array_tINS_6pipe_tELi2EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #6 align 2

declare void @_ZN3zmq5msg_t8add_refsEi(ptr noundef nonnull align 8 dereferenceable(64), i32 noundef) #2

declare noundef zeroext i1 @_ZN3zmq5msg_t7rm_refsEi(ptr noundef nonnull align 8 dereferenceable(64), i32 noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #1 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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 }
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++ TBAA"}
!9 = !{!10, !16, i64 24}
!10 = !{!"_ZTSN3zmq6dist_tE", !11, i64 0, !16, i64 24, !16, i64 32, !16, i64 40, !17, i64 48}
!11 = !{!"_ZTSN3zmq7array_tINS_6pipe_tELi2EEE", !12, i64 0}
!12 = !{!"_ZTSSt6vectorIPN3zmq6pipe_tESaIS2_EE", !13, i64 0}
!13 = !{!"_ZTSSt12_Vector_baseIPN3zmq6pipe_tESaIS2_EE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIPN3zmq6pipe_tESaIS2_EE12_Vector_implE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIPN3zmq6pipe_tESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!16 = !{!"long", !7, i64 0}
!17 = !{!"bool", !7, i64 0}
!18 = !{!19, !19, i64 0}
!19 = !{!"int", !7, i64 0}
!20 = !{!16, !16, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = distinct !{!23, !22}


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

@stderr = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [108 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [12 x i8], align 1

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

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

declare void @_ZN3zmq9zmq_abortEPKc(ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3zmq6dist_t10distributeEPNS_5msg_tE(ptr noundef nonnull align 8 dereferenceable(49) %0, ptr noundef %1) local_unnamed_addr #2 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 24
  %4 = load i64, ptr %3, align 8, !tbaa !5
  %5 = icmp eq i64 %4, 0
  br i1 %5, label %6, label %18

6:                                                ; preds = %2
  %7 = tail call noundef i32 @_ZN3zmq5msg_t5closeEv(ptr noundef nonnull align 8 dereferenceable(64) %1)
  %.not43 = icmp eq i32 %7, 0
  br i1 %.not43, label %16, label %8, !prof !17

8:                                                ; preds = %6
  %9 = tail call ptr @__errno_location() #6
  %10 = load i32, ptr %9, align 4, !tbaa !18
  %11 = tail call ptr @strerror(i32 noundef %10) #7
  %12 = load ptr, ptr @stderr, align 8, !tbaa !20
  %13 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %12, ptr noundef nonnull @.str.3, ptr noundef %11, ptr noundef nonnull @.str.2, i32 noundef 167) #8
  %14 = load ptr, ptr @stderr, align 8, !tbaa !20
  %15 = tail call i32 @fflush(ptr noundef %14)
  tail call void @_ZN3zmq9zmq_abortEPKc(ptr noundef %11)
  br label %16

16:                                               ; preds = %8, %6
  %17 = tail call noundef i32 @_ZN3zmq5msg_t4initEv(ptr noundef nonnull align 8 dereferenceable(64) %1)
  %.not44 = icmp eq i32 %17, 0
  br i1 %.not44, label %61, label %.sink.split, !prof !17

18:                                               ; preds = %2
  %19 = tail call noundef zeroext i1 @_ZNK3zmq5msg_t6is_vsmEv(ptr noundef nonnull align 8 dereferenceable(64) %1)
  %20 = load i64, ptr %3, align 8, !tbaa !5
  br i1 %19, label %.preheader, label %39

.preheader:                                       ; preds = %18
  %.not53 = icmp eq i64 %20, 0
  br i1 %.not53, label %._crit_edge51, label %.lr.ph50

._crit_edge51:                                    ; preds = %.lr.ph50, %.preheader
  %21 = tail call noundef i32 @_ZN3zmq5msg_t5closeEv(ptr noundef nonnull align 8 dereferenceable(64) %1)
  %.not41 = icmp eq i32 %21, 0
  br i1 %.not41, label %37, label %29, !prof !17

.lr.ph50:                                         ; preds = %.preheader, %.lr.ph50
  %.049 = phi i64 [ %26, %.lr.ph50 ], [ 0, %.preheader ]
  %22 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN3zmq7array_tINS_6pipe_tELi2EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %.049)
  %23 = load ptr, ptr %22, align 8, !tbaa !20
  %24 = tail call noundef zeroext i1 @_ZN3zmq6dist_t5writeEPNS_6pipe_tEPNS_5msg_tE(ptr noundef nonnull align 8 dereferenceable(49) %0, ptr noundef %23, ptr noundef nonnull %1)
  %not.46 = xor i1 %24, true
  %25 = sext i1 %not.46 to i64
  %spec.select = add nuw i64 %.049, 1
  %26 = add i64 %spec.select, %25
  %27 = load i64, ptr %3, align 8, !tbaa !5
  %28 = icmp ult i64 %26, %27
  br i1 %28, label %.lr.ph50, label %._crit_edge51, !llvm.loop !21

29:                                               ; preds = %._crit_edge51
  %30 = tail call ptr @__errno_location() #6
  %31 = load i32, ptr %30, align 4, !tbaa !18
  %32 = tail call ptr @strerror(i32 noundef %31) #7
  %33 = load ptr, ptr @stderr, align 8, !tbaa !20
  %34 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %33, ptr noundef nonnull @.str.3, ptr noundef %32, ptr noundef nonnull @.str.2, i32 noundef 178) #8
  %35 = load ptr, ptr @stderr, align 8, !tbaa !20
  %36 = tail call i32 @fflush(ptr noundef %35)
  tail call void @_ZN3zmq9zmq_abortEPKc(ptr noundef %32)
  br label %37

37:                                               ; preds = %29, %._crit_edge51
  %38 = tail call noundef i32 @_ZN3zmq5msg_t4initEv(ptr noundef nonnull align 8 dereferenceable(64) %1)
  %.not42 = icmp eq i32 %38, 0
  br i1 %.not42, label %61, label %.sink.split, !prof !17

39:                                               ; preds = %18
  %40 = trunc i64 %20 to i32
  %41 = add nsw i32 %40, -1
  tail call void @_ZN3zmq5msg_t8add_refsEi(ptr noundef nonnull align 8 dereferenceable(64) %1, i32 noundef %41)
  %42 = load i64, ptr %3, align 8, !tbaa !5
  %.not52 = icmp eq i64 %42, 0
  br i1 %.not52, label %._crit_edge.thread, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph
  %.not = icmp eq i32 %.139, 0
  br i1 %.not, label %._crit_edge.thread, label %51, !prof !23

.lr.ph:                                           ; preds = %39, %.lr.ph
  %.03648 = phi i64 [ %48, %.lr.ph ], [ 0, %39 ]
  %.03847 = phi i32 [ %.139, %.lr.ph ], [ 0, %39 ]
  %43 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN3zmq7array_tINS_6pipe_tELi2EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %.03648)
  %44 = load ptr, ptr %43, align 8, !tbaa !20
  %45 = tail call noundef zeroext i1 @_ZN3zmq6dist_t5writeEPNS_6pipe_tEPNS_5msg_tE(ptr noundef nonnull align 8 dereferenceable(49) %0, ptr noundef %44, ptr noundef nonnull %1)
  %not. = xor i1 %45, true
  %46 = zext i1 %not. to i32
  %.139 = add nuw nsw i32 %.03847, %46
  %47 = sext i1 %not. to i64
  %.137 = add nuw i64 %.03648, 1
  %48 = add i64 %.137, %47
  %49 = load i64, ptr %3, align 8, !tbaa !5
  %50 = icmp ult i64 %48, %49
  br i1 %50, label %.lr.ph, label %._crit_edge, !llvm.loop !24

51:                                               ; preds = %._crit_edge
  %52 = tail call noundef zeroext i1 @_ZN3zmq5msg_t7rm_refsEi(ptr noundef nonnull align 8 dereferenceable(64) %1, i32 noundef %.139)
  br label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %39, %51, %._crit_edge
  %53 = tail call noundef i32 @_ZN3zmq5msg_t4initEv(ptr noundef nonnull align 8 dereferenceable(64) %1)
  %.not40 = icmp eq i32 %53, 0
  br i1 %.not40, label %61, label %.sink.split, !prof !17

.sink.split:                                      ; preds = %._crit_edge.thread, %37, %16
  %.sink59 = phi i32 [ 169, %16 ], [ 180, %37 ], [ 201, %._crit_edge.thread ]
  %54 = tail call ptr @__errno_location() #6
  %55 = load i32, ptr %54, align 4, !tbaa !18
  %56 = tail call ptr @strerror(i32 noundef %55) #7
  %57 = load ptr, ptr @stderr, align 8, !tbaa !20
  %58 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %57, ptr noundef nonnull @.str.3, ptr noundef %56, ptr noundef nonnull @.str.2, i32 noundef %.sink59) #8
  %59 = load ptr, ptr @stderr, align 8, !tbaa !20
  %60 = tail call i32 @fflush(ptr noundef %59)
  tail call void @_ZN3zmq9zmq_abortEPKc(ptr noundef %56)
  br label %61

61:                                               ; preds = %.sink.split, %._crit_edge.thread, %37, %16
  ret void
}

declare noundef i32 @_ZN3zmq5msg_t5closeEv(ptr noundef nonnull align 8 dereferenceable(64)) local_unnamed_addr #1

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

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

declare noundef i32 @_ZN3zmq5msg_t4initEv(ptr noundef nonnull align 8 dereferenceable(64)) local_unnamed_addr #1

declare noundef zeroext i1 @_ZNK3zmq5msg_t6is_vsmEv(ptr noundef nonnull align 8 dereferenceable(64)) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN3zmq6dist_t5writeEPNS_6pipe_tEPNS_5msg_tE(ptr noundef nonnull align 8 dereferenceable(49), ptr noundef, ptr noundef) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN3zmq7array_tINS_6pipe_tELi2EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #5 align 2

declare void @_ZN3zmq5msg_t8add_refsEi(ptr noundef nonnull align 8 dereferenceable(64), i32 noundef) local_unnamed_addr #1

declare noundef zeroext i1 @_ZN3zmq5msg_t7rm_refsEi(ptr noundef nonnull align 8 dereferenceable(64), i32 noundef) local_unnamed_addr #1

attributes #0 = { 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 #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 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 "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 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 #5 = { 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 #6 = { nounwind willreturn memory(none) }
attributes #7 = { nounwind }
attributes #8 = { 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 = !{!6, !15, i64 24}
!6 = !{!"_ZTSN3zmq6dist_tE", !7, i64 0, !15, i64 24, !15, i64 32, !15, i64 40, !16, i64 48}
!7 = !{!"_ZTSN3zmq7array_tINS_6pipe_tELi2EEE", !8, i64 0}
!8 = !{!"_ZTSSt6vectorIPN3zmq6pipe_tESaIS2_EE", !9, i64 0}
!9 = !{!"_ZTSSt12_Vector_baseIPN3zmq6pipe_tESaIS2_EE", !10, i64 0}
!10 = !{!"_ZTSNSt12_Vector_baseIPN3zmq6pipe_tESaIS2_EE12_Vector_implE", !11, i64 0}
!11 = !{!"_ZTSNSt12_Vector_baseIPN3zmq6pipe_tESaIS2_EE17_Vector_impl_dataE", !12, i64 0, !12, i64 8, !12, i64 16}
!12 = !{!"any pointer", !13, i64 0}
!13 = !{!"omnipotent char", !14, i64 0}
!14 = !{!"Simple C++ TBAA"}
!15 = !{!"long", !13, i64 0}
!16 = !{!"bool", !13, i64 0}
!17 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!18 = !{!19, !19, i64 0}
!19 = !{!"int", !13, i64 0}
!20 = !{!12, !12, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!"branch_weights", !"expected", i32 2145766520, i32 1717128}
!24 = distinct !{!24, !22}


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