; LLVM IR from erwincoumans/tiny-differentiable-simulator :: third_party/zeromq/src/fq.ll (ZN3zmq4fq_t8recvpipeEPNS_5msg_tEPPNS_6pipe_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::fq_t" = type <{ %"class.zmq::array_t", i64, ptr, 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 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [106 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [7 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: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3zmq7array_tINS_6pipe_tELi1EE4swapEmm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, i64 noundef) #3 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN3zmq4fq_t8recvpipeEPNS_5msg_tEPPNS_6pipe_tE(ptr noundef nonnull align 8 dereferenceable(49) %0, ptr noundef %1, ptr noundef %2) #5 align 2 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i8, align 1
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  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
  %13 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  %14 = load ptr, ptr %6, align 8, !tbaa !5
  %15 = call noundef i32 @_ZN3zmq5msg_t5closeEv(ptr noundef nonnull align 8 dereferenceable(64) %14)
  store i32 %15, ptr %8, align 4, !tbaa !9
  br label %16

16:                                               ; preds = %3
  %17 = load i32, ptr %8, align 4, !tbaa !9
  %18 = icmp eq i32 %17, 0
  %19 = xor i1 %18, true
  %20 = zext i1 %19 to i64
  %21 = call i64 @llvm.expect.i64(i64 %20, i64 0)
  %22 = icmp ne i64 %21, 0
  br i1 %22, label %23, label %33

23:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %24 = call ptr @__errno_location() #8
  %25 = load i32, ptr %24, align 4, !tbaa !9
  %26 = call ptr @strerror(i32 noundef %25) #7
  store ptr %26, ptr %9, align 8, !tbaa !5
  %27 = load ptr, ptr @stderr, align 8, !tbaa !5
  %28 = load ptr, ptr %9, align 8, !tbaa !5
  %29 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %27, ptr noundef @.str.3, ptr noundef %28, ptr noundef @.str.2, i32 noundef 87) #7
  %30 = load ptr, ptr @stderr, align 8, !tbaa !5
  %31 = call i32 @fflush(ptr noundef %30)
  %32 = load ptr, ptr %9, align 8, !tbaa !5
  call void @_ZN3zmq9zmq_abortEPKc(ptr noundef %32)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  br label %33

33:                                               ; preds = %23, %16
  br label %34

34:                                               ; preds = %33
  br label %35

35:                                               ; preds = %34
  br label %36

36:                                               ; preds = %123, %35
  %37 = getelementptr inbounds %"class.zmq::fq_t", ptr %13, i32 0, i32 1
  %38 = load i64, ptr %37, align 8, !tbaa !11
  %39 = icmp ugt i64 %38, 0
  br i1 %39, label %40, label %124

40:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #7
  %41 = getelementptr inbounds %"class.zmq::fq_t", ptr %13, i32 0, i32 0
  %42 = getelementptr inbounds %"class.zmq::fq_t", ptr %13, i32 0, i32 3
  %43 = load i64, ptr %42, align 8, !tbaa !20
  %44 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN3zmq7array_tINS_6pipe_tELi1EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %41, i64 noundef %43)
  %45 = load ptr, ptr %44, align 8, !tbaa !5
  %46 = load ptr, ptr %6, align 8, !tbaa !5
  %47 = call noundef zeroext i1 @_ZN3zmq6pipe_t4readEPNS_5msg_tE(ptr noundef nonnull align 8 dereferenceable(264) %45, ptr noundef %46)
  %48 = zext i1 %47 to i8
  store i8 %48, ptr %10, align 1, !tbaa !21
  %49 = load i8, ptr %10, align 1, !tbaa !21, !range !22, !noundef !23
  %50 = trunc i8 %49 to i1
  br i1 %50, label %51, label %87

51:                                               ; preds = %40
  %52 = load ptr, ptr %7, align 8, !tbaa !5
  %53 = icmp ne ptr %52, null
  br i1 %53, label %54, label %61

54:                                               ; preds = %51
  %55 = getelementptr inbounds %"class.zmq::fq_t", ptr %13, i32 0, i32 0
  %56 = getelementptr inbounds %"class.zmq::fq_t", ptr %13, i32 0, i32 3
  %57 = load i64, ptr %56, align 8, !tbaa !20
  %58 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN3zmq7array_tINS_6pipe_tELi1EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %55, i64 noundef %57)
  %59 = load ptr, ptr %58, align 8, !tbaa !5
  %60 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %59, ptr %60, align 8, !tbaa !5
  br label %61

61:                                               ; preds = %54, %51
  %62 = load ptr, ptr %6, align 8, !tbaa !5
  %63 = call noundef zeroext i8 @_ZNK3zmq5msg_t5flagsEv(ptr noundef nonnull align 8 dereferenceable(64) %62)
  %64 = zext i8 %63 to i32
  %65 = and i32 %64, 1
  %66 = icmp ne i32 %65, 0
  %67 = getelementptr inbounds %"class.zmq::fq_t", ptr %13, i32 0, i32 4
  %68 = zext i1 %66 to i8
  store i8 %68, ptr %67, align 8, !tbaa !24
  %69 = getelementptr inbounds %"class.zmq::fq_t", ptr %13, i32 0, i32 4
  %70 = load i8, ptr %69, align 8, !tbaa !24, !range !22, !noundef !23
  %71 = trunc i8 %70 to i1
  br i1 %71, label %86, label %72

72:                                               ; preds = %61
  %73 = getelementptr inbounds %"class.zmq::fq_t", ptr %13, i32 0, i32 0
  %74 = getelementptr inbounds %"class.zmq::fq_t", ptr %13, i32 0, i32 3
  %75 = load i64, ptr %74, align 8, !tbaa !20
  %76 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN3zmq7array_tINS_6pipe_tELi1EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %73, i64 noundef %75)
  %77 = load ptr, ptr %76, align 8, !tbaa !5
  %78 = getelementptr inbounds %"class.zmq::fq_t", ptr %13, i32 0, i32 2
  store ptr %77, ptr %78, align 8, !tbaa !25
  %79 = getelementptr inbounds %"class.zmq::fq_t", ptr %13, i32 0, i32 3
  %80 = load i64, ptr %79, align 8, !tbaa !20
  %81 = add i64 %80, 1
  %82 = getelementptr inbounds %"class.zmq::fq_t", ptr %13, i32 0, i32 1
  %83 = load i64, ptr %82, align 8, !tbaa !11
  %84 = urem i64 %81, %83
  %85 = getelementptr inbounds %"class.zmq::fq_t", ptr %13, i32 0, i32 3
  store i64 %84, ptr %85, align 8, !tbaa !20
  br label %86

86:                                               ; preds = %72, %61
  store i32 0, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %121

87:                                               ; preds = %40
  br label %88

88:                                               ; preds = %87
  %89 = getelementptr inbounds %"class.zmq::fq_t", ptr %13, i32 0, i32 4
  %90 = load i8, ptr %89, align 8, !tbaa !24, !range !22, !noundef !23
  %91 = trunc i8 %90 to i1
  %92 = xor i1 %91, true
  %93 = xor i1 %92, true
  %94 = zext i1 %93 to i64
  %95 = call i64 @llvm.expect.i64(i64 %94, i64 0)
  %96 = icmp ne i64 %95, 0
  br i1 %96, label %97, label %102

97:                                               ; preds = %88
  %98 = load ptr, ptr @stderr, align 8, !tbaa !5
  %99 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %98, ptr noundef @.str, ptr noundef @.str.4, ptr noundef @.str.2, i32 noundef 112) #7
  %100 = load ptr, ptr @stderr, align 8, !tbaa !5
  %101 = call i32 @fflush(ptr noundef %100)
  call void @_ZN3zmq9zmq_abortEPKc(ptr noundef @.str.4)
  br label %102

102:                                              ; preds = %97, %88
  br label %103

103:                                              ; preds = %102
  br label %104

104:                                              ; preds = %103
  %105 = getelementptr inbounds %"class.zmq::fq_t", ptr %13, i32 0, i32 1
  %106 = load i64, ptr %105, align 8, !tbaa !11
  %107 = add i64 %106, -1
  store i64 %107, ptr %105, align 8, !tbaa !11
  %108 = getelementptr inbounds %"class.zmq::fq_t", ptr %13, i32 0, i32 0
  %109 = getelementptr inbounds %"class.zmq::fq_t", ptr %13, i32 0, i32 3
  %110 = load i64, ptr %109, align 8, !tbaa !20
  %111 = getelementptr inbounds %"class.zmq::fq_t", ptr %13, i32 0, i32 1
  %112 = load i64, ptr %111, align 8, !tbaa !11
  call void @_ZN3zmq7array_tINS_6pipe_tELi1EE4swapEmm(ptr noundef nonnull align 8 dereferenceable(24) %108, i64 noundef %110, i64 noundef %112)
  %113 = getelementptr inbounds %"class.zmq::fq_t", ptr %13, i32 0, i32 3
  %114 = load i64, ptr %113, align 8, !tbaa !20
  %115 = getelementptr inbounds %"class.zmq::fq_t", ptr %13, i32 0, i32 1
  %116 = load i64, ptr %115, align 8, !tbaa !11
  %117 = icmp eq i64 %114, %116
  br i1 %117, label %118, label %120

118:                                              ; preds = %104
  %119 = getelementptr inbounds %"class.zmq::fq_t", ptr %13, i32 0, i32 3
  store i64 0, ptr %119, align 8, !tbaa !20
  br label %120

120:                                              ; preds = %118, %104
  store i32 0, ptr %11, align 4
  br label %121

121:                                              ; preds = %120, %86
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #7
  %122 = load i32, ptr %11, align 4
  switch i32 %122, label %148 [
    i32 0, label %123
  ]

123:                                              ; preds = %121
  br label %36, !llvm.loop !26

124:                                              ; preds = %36
  %125 = load ptr, ptr %6, align 8, !tbaa !5
  %126 = call noundef i32 @_ZN3zmq5msg_t4initEv(ptr noundef nonnull align 8 dereferenceable(64) %125)
  store i32 %126, ptr %8, align 4, !tbaa !9
  br label %127

127:                                              ; preds = %124
  %128 = load i32, ptr %8, align 4, !tbaa !9
  %129 = icmp eq i32 %128, 0
  %130 = xor i1 %129, true
  %131 = zext i1 %130 to i64
  %132 = call i64 @llvm.expect.i64(i64 %131, i64 0)
  %133 = icmp ne i64 %132, 0
  br i1 %133, label %134, label %144

134:                                              ; preds = %127
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %135 = call ptr @__errno_location() #8
  %136 = load i32, ptr %135, align 4, !tbaa !9
  %137 = call ptr @strerror(i32 noundef %136) #7
  store ptr %137, ptr %12, align 8, !tbaa !5
  %138 = load ptr, ptr @stderr, align 8, !tbaa !5
  %139 = load ptr, ptr %12, align 8, !tbaa !5
  %140 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %138, ptr noundef @.str.3, ptr noundef %139, ptr noundef @.str.2, i32 noundef 123) #7
  %141 = load ptr, ptr @stderr, align 8, !tbaa !5
  %142 = call i32 @fflush(ptr noundef %141)
  %143 = load ptr, ptr %12, align 8, !tbaa !5
  call void @_ZN3zmq9zmq_abortEPKc(ptr noundef %143)
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  br label %144

144:                                              ; preds = %134, %127
  br label %145

145:                                              ; preds = %144
  br label %146

146:                                              ; preds = %145
  %147 = call ptr @__errno_location() #8
  store i32 11, ptr %147, align 4, !tbaa !9
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %11, align 4
  br label %148

148:                                              ; preds = %146, %121
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  %149 = load i32, ptr %4, align 4
  ret i32 %149
}

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() #6

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

declare noundef zeroext i1 @_ZN3zmq6pipe_t4readEPNS_5msg_tE(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #2

declare noundef zeroext i8 @_ZNK3zmq5msg_t5flagsEv(ptr noundef nonnull align 8 dereferenceable(64)) #2

declare noundef i32 @_ZN3zmq5msg_t4initEv(ptr noundef nonnull align 8 dereferenceable(64)) #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 = { 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 #4 = { nocallback nofree nosync 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 = { 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 #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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !18, i64 24}
!12 = !{!"_ZTSN3zmq4fq_tE", !13, i64 0, !18, i64 24, !6, i64 32, !18, i64 40, !19, i64 48}
!13 = !{!"_ZTSN3zmq7array_tINS_6pipe_tELi1EEE", !14, i64 0}
!14 = !{!"_ZTSSt6vectorIPN3zmq6pipe_tESaIS2_EE", !15, i64 0}
!15 = !{!"_ZTSSt12_Vector_baseIPN3zmq6pipe_tESaIS2_EE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIPN3zmq6pipe_tESaIS2_EE12_Vector_implE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIPN3zmq6pipe_tESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!18 = !{!"long", !7, i64 0}
!19 = !{!"bool", !7, i64 0}
!20 = !{!12, !18, i64 40}
!21 = !{!19, !19, i64 0}
!22 = !{i8 0, i8 2}
!23 = !{}
!24 = !{!12, !19, i64 48}
!25 = !{!12, !6, i64 32}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}


; 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 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [106 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [7 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: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3zmq7array_tINS_6pipe_tELi1EE4swapEmm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, i64 noundef) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN3zmq4fq_t8recvpipeEPNS_5msg_tEPPNS_6pipe_tE(ptr noundef nonnull align 8 dereferenceable(49) %0, ptr noundef nonnull %1, ptr noundef writeonly %2) local_unnamed_addr #3 align 2 {
  %4 = tail call noundef i32 @_ZN3zmq5msg_t5closeEv(ptr noundef nonnull align 8 dereferenceable(64) %1)
  %.not = icmp eq i32 %4, 0
  br i1 %.not, label %13, label %5, !prof !5

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

13:                                               ; preds = %5, %3
  %14 = getelementptr inbounds i8, ptr %0, i64 24
  %15 = load i64, ptr %14, align 8, !tbaa !12
  %.not1723 = icmp eq i64 %15, 0
  br i1 %.not1723, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %13
  %16 = getelementptr inbounds i8, ptr %0, i64 40
  %17 = getelementptr inbounds i8, ptr %0, i64 48
  %.pre = load i64, ptr %16, align 8, !tbaa !21
  br label %18

18:                                               ; preds = %.lr.ph, %56
  %19 = phi i64 [ %.pre, %.lr.ph ], [ %57, %56 ]
  %20 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN3zmq7array_tINS_6pipe_tELi1EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %19)
  %21 = load ptr, ptr %20, align 8, !tbaa !10
  %22 = tail call noundef zeroext i1 @_ZN3zmq6pipe_t4readEPNS_5msg_tE(ptr noundef nonnull align 8 dereferenceable(264) %21, ptr noundef nonnull %1)
  br i1 %22, label %23, label %40

23:                                               ; preds = %18
  %.not19 = icmp eq ptr %2, null
  br i1 %.not19, label %28, label %24

24:                                               ; preds = %23
  %25 = load i64, ptr %16, align 8, !tbaa !21
  %26 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN3zmq7array_tINS_6pipe_tELi1EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %25)
  %27 = load ptr, ptr %26, align 8, !tbaa !10
  store ptr %27, ptr %2, align 8, !tbaa !10
  br label %28

28:                                               ; preds = %24, %23
  %29 = tail call noundef zeroext i8 @_ZNK3zmq5msg_t5flagsEv(ptr noundef nonnull align 8 dereferenceable(64) %1)
  %30 = and i8 %29, 1
  %.not20 = icmp eq i8 %30, 0
  store i8 %30, ptr %17, align 8, !tbaa !22
  br i1 %.not20, label %31, label %.thread

31:                                               ; preds = %28
  %32 = load i64, ptr %16, align 8, !tbaa !21
  %33 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN3zmq7array_tINS_6pipe_tELi1EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %32)
  %34 = load ptr, ptr %33, align 8, !tbaa !10
  %35 = getelementptr inbounds i8, ptr %0, i64 32
  store ptr %34, ptr %35, align 8, !tbaa !23
  %36 = load i64, ptr %16, align 8, !tbaa !21
  %37 = add i64 %36, 1
  %38 = load i64, ptr %14, align 8, !tbaa !12
  %39 = urem i64 %37, %38
  store i64 %39, ptr %16, align 8, !tbaa !21
  br label %.thread

40:                                               ; preds = %18
  %41 = load i8, ptr %17, align 8, !tbaa !22, !range !24, !noundef !25
  %42 = trunc nuw i8 %41 to i1
  br i1 %42, label %43, label %48, !prof !26

43:                                               ; preds = %40
  %44 = load ptr, ptr @stderr, align 8, !tbaa !10
  %45 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %44, ptr noundef nonnull @.str, ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.2, i32 noundef 112) #8
  %46 = load ptr, ptr @stderr, align 8, !tbaa !10
  %47 = tail call i32 @fflush(ptr noundef %46)
  tail call void @_ZN3zmq9zmq_abortEPKc(ptr noundef nonnull @.str.4)
  br label %48

48:                                               ; preds = %43, %40
  %49 = load i64, ptr %14, align 8, !tbaa !12
  %50 = add i64 %49, -1
  store i64 %50, ptr %14, align 8, !tbaa !12
  %51 = load i64, ptr %16, align 8, !tbaa !21
  tail call void @_ZN3zmq7array_tINS_6pipe_tELi1EE4swapEmm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %51, i64 noundef %50)
  %52 = load i64, ptr %16, align 8, !tbaa !21
  %53 = load i64, ptr %14, align 8, !tbaa !12
  %54 = icmp eq i64 %52, %53
  br i1 %54, label %55, label %56

55:                                               ; preds = %48
  store i64 0, ptr %16, align 8, !tbaa !21
  br label %56

56:                                               ; preds = %48, %55
  %57 = phi i64 [ %52, %48 ], [ 0, %55 ]
  %.not17 = icmp eq i64 %53, 0
  br i1 %.not17, label %._crit_edge, label %18

._crit_edge:                                      ; preds = %56, %13
  %58 = tail call noundef i32 @_ZN3zmq5msg_t4initEv(ptr noundef nonnull align 8 dereferenceable(64) %1)
  %.not18 = icmp eq i32 %58, 0
  %.pre24 = tail call ptr @__errno_location() #6
  br i1 %.not18, label %._crit_edge._crit_edge, label %59, !prof !5

59:                                               ; preds = %._crit_edge
  %60 = load i32, ptr %.pre24, align 4, !tbaa !6
  %61 = tail call ptr @strerror(i32 noundef %60) #7
  %62 = load ptr, ptr @stderr, align 8, !tbaa !10
  %63 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %62, ptr noundef nonnull @.str.3, ptr noundef %61, ptr noundef nonnull @.str.2, i32 noundef 123) #8
  %64 = load ptr, ptr @stderr, align 8, !tbaa !10
  %65 = tail call i32 @fflush(ptr noundef %64)
  tail call void @_ZN3zmq9zmq_abortEPKc(ptr noundef %61)
  br label %._crit_edge._crit_edge

._crit_edge._crit_edge:                           ; preds = %._crit_edge, %59
  store i32 11, ptr %.pre24, align 4, !tbaa !6
  br label %.thread

.thread:                                          ; preds = %31, %28, %._crit_edge._crit_edge
  %.2 = phi i32 [ -1, %._crit_edge._crit_edge ], [ 0, %28 ], [ 0, %31 ]
  ret i32 %.2
}

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

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

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

declare noundef zeroext i1 @_ZN3zmq6pipe_t4readEPNS_5msg_tE(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) local_unnamed_addr #1

declare noundef zeroext i8 @_ZNK3zmq5msg_t5flagsEv(ptr noundef nonnull align 8 dereferenceable(64)) local_unnamed_addr #1

declare noundef i32 @_ZN3zmq5msg_t4initEv(ptr noundef nonnull align 8 dereferenceable(64)) 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 = { 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 #3 = { 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 #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 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 #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 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!6 = !{!7, !7, i64 0}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!13, !19, i64 24}
!13 = !{!"_ZTSN3zmq4fq_tE", !14, i64 0, !19, i64 24, !11, i64 32, !19, i64 40, !20, i64 48}
!14 = !{!"_ZTSN3zmq7array_tINS_6pipe_tELi1EEE", !15, i64 0}
!15 = !{!"_ZTSSt6vectorIPN3zmq6pipe_tESaIS2_EE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseIPN3zmq6pipe_tESaIS2_EE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIPN3zmq6pipe_tESaIS2_EE12_Vector_implE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIPN3zmq6pipe_tESaIS2_EE17_Vector_impl_dataE", !11, i64 0, !11, i64 8, !11, i64 16}
!19 = !{!"long", !8, i64 0}
!20 = !{!"bool", !8, i64 0}
!21 = !{!13, !19, i64 40}
!22 = !{!13, !20, i64 48}
!23 = !{!13, !11, i64 32}
!24 = !{i8 0, i8 2}
!25 = !{}
!26 = !{!"branch_weights", !"expected", i32 1, i32 2000}


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