; LLVM IR from erwincoumans/tiny-differentiable-simulator :: third_party/zeromq/src/lb.ll (ZN3zmq4lb_t8sendpipeEPNS_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::lb_t" = type <{ %"class.zmq::array_t", i64, i64, i8, i8, [6 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 [106 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: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3zmq7array_tINS_6pipe_tELi2EE4swapEmm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, i64 noundef) #4 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: mustprogress uwtable
define dso_local noundef i32 @_ZN3zmq4lb_t8sendpipeEPNS_5msg_tEPPNS_6pipe_tE(ptr noundef nonnull align 8 dereferenceable(42) %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 ptr, align 8
  %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
  %14 = getelementptr inbounds %"class.zmq::lb_t", ptr %13, i32 0, i32 4
  %15 = load i8, ptr %14, align 1, !tbaa !9, !range !18, !noundef !19
  %16 = trunc i8 %15 to i1
  br i1 %16, label %17, label %74

17:                                               ; preds = %3
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = call noundef zeroext i8 @_ZNK3zmq5msg_t5flagsEv(ptr noundef nonnull align 8 dereferenceable(64) %18)
  %20 = zext i8 %19 to i32
  %21 = and i32 %20, 1
  %22 = icmp ne i32 %21, 0
  %23 = getelementptr inbounds %"class.zmq::lb_t", ptr %13, i32 0, i32 3
  %24 = zext i1 %22 to i8
  store i8 %24, ptr %23, align 8, !tbaa !20
  %25 = getelementptr inbounds %"class.zmq::lb_t", ptr %13, i32 0, i32 3
  %26 = load i8, ptr %25, align 8, !tbaa !20, !range !18, !noundef !19
  %27 = trunc i8 %26 to i1
  %28 = getelementptr inbounds %"class.zmq::lb_t", ptr %13, i32 0, i32 4
  %29 = zext i1 %27 to i8
  store i8 %29, ptr %28, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  %31 = call noundef i32 @_ZN3zmq5msg_t5closeEv(ptr noundef nonnull align 8 dereferenceable(64) %30)
  store i32 %31, ptr %8, align 4, !tbaa !21
  br label %32

32:                                               ; preds = %17
  %33 = load i32, ptr %8, align 4, !tbaa !21
  %34 = icmp eq i32 %33, 0
  %35 = xor i1 %34, true
  %36 = zext i1 %35 to i64
  %37 = call i64 @llvm.expect.i64(i64 %36, i64 0)
  %38 = icmp ne i64 %37, 0
  br i1 %38, label %39, label %49

39:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %40 = call ptr @__errno_location() #8
  %41 = load i32, ptr %40, align 4, !tbaa !21
  %42 = call ptr @strerror(i32 noundef %41) #7
  store ptr %42, ptr %9, align 8, !tbaa !5
  %43 = load ptr, ptr @stderr, align 8, !tbaa !5
  %44 = load ptr, ptr %9, align 8, !tbaa !5
  %45 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %43, ptr noundef @.str.3, ptr noundef %44, ptr noundef @.str.2, i32 noundef 92) #7
  %46 = load ptr, ptr @stderr, align 8, !tbaa !5
  %47 = call i32 @fflush(ptr noundef %46)
  %48 = load ptr, ptr %9, align 8, !tbaa !5
  call void @_ZN3zmq9zmq_abortEPKc(ptr noundef %48)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  br label %49

49:                                               ; preds = %39, %32
  br label %50

50:                                               ; preds = %49
  br label %51

51:                                               ; preds = %50
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  %53 = call noundef i32 @_ZN3zmq5msg_t4initEv(ptr noundef nonnull align 8 dereferenceable(64) %52)
  store i32 %53, ptr %8, align 4, !tbaa !21
  br label %54

54:                                               ; preds = %51
  %55 = load i32, ptr %8, align 4, !tbaa !21
  %56 = icmp eq i32 %55, 0
  %57 = xor i1 %56, true
  %58 = zext i1 %57 to i64
  %59 = call i64 @llvm.expect.i64(i64 %58, i64 0)
  %60 = icmp ne i64 %59, 0
  br i1 %60, label %61, label %71

61:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %62 = call ptr @__errno_location() #8
  %63 = load i32, ptr %62, align 4, !tbaa !21
  %64 = call ptr @strerror(i32 noundef %63) #7
  store ptr %64, ptr %10, align 8, !tbaa !5
  %65 = load ptr, ptr @stderr, align 8, !tbaa !5
  %66 = load ptr, ptr %10, align 8, !tbaa !5
  %67 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %65, ptr noundef @.str.3, ptr noundef %66, ptr noundef @.str.2, i32 noundef 94) #7
  %68 = load ptr, ptr @stderr, align 8, !tbaa !5
  %69 = call i32 @fflush(ptr noundef %68)
  %70 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN3zmq9zmq_abortEPKc(ptr noundef %70)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  br label %71

71:                                               ; preds = %61, %54
  br label %72

72:                                               ; preds = %71
  br label %73

73:                                               ; preds = %72
  store i32 0, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %190

74:                                               ; preds = %3
  br label %75

75:                                               ; preds = %134, %74
  %76 = getelementptr inbounds %"class.zmq::lb_t", ptr %13, i32 0, i32 1
  %77 = load i64, ptr %76, align 8, !tbaa !23
  %78 = icmp ugt i64 %77, 0
  br i1 %78, label %79, label %135

79:                                               ; preds = %75
  %80 = getelementptr inbounds %"class.zmq::lb_t", ptr %13, i32 0, i32 0
  %81 = getelementptr inbounds %"class.zmq::lb_t", ptr %13, i32 0, i32 2
  %82 = load i64, ptr %81, align 8, !tbaa !24
  %83 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN3zmq7array_tINS_6pipe_tELi2EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %80, i64 noundef %82)
  %84 = load ptr, ptr %83, align 8, !tbaa !5
  %85 = load ptr, ptr %6, align 8, !tbaa !5
  %86 = call noundef zeroext i1 @_ZN3zmq6pipe_t5writeEPNS_5msg_tE(ptr noundef nonnull align 8 dereferenceable(264) %84, ptr noundef %85)
  br i1 %86, label %87, label %98

87:                                               ; preds = %79
  %88 = load ptr, ptr %7, align 8, !tbaa !5
  %89 = icmp ne ptr %88, null
  br i1 %89, label %90, label %97

90:                                               ; preds = %87
  %91 = getelementptr inbounds %"class.zmq::lb_t", ptr %13, i32 0, i32 0
  %92 = getelementptr inbounds %"class.zmq::lb_t", ptr %13, i32 0, i32 2
  %93 = load i64, ptr %92, align 8, !tbaa !24
  %94 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN3zmq7array_tINS_6pipe_tELi2EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %91, i64 noundef %93)
  %95 = load ptr, ptr %94, align 8, !tbaa !5
  %96 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %95, ptr %96, align 8, !tbaa !5
  br label %97

97:                                               ; preds = %90, %87
  br label %135

98:                                               ; preds = %79
  %99 = getelementptr inbounds %"class.zmq::lb_t", ptr %13, i32 0, i32 3
  %100 = load i8, ptr %99, align 8, !tbaa !20, !range !18, !noundef !19
  %101 = trunc i8 %100 to i1
  br i1 %101, label %102, label %117

102:                                              ; preds = %98
  %103 = getelementptr inbounds %"class.zmq::lb_t", ptr %13, i32 0, i32 0
  %104 = getelementptr inbounds %"class.zmq::lb_t", ptr %13, i32 0, i32 2
  %105 = load i64, ptr %104, align 8, !tbaa !24
  %106 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN3zmq7array_tINS_6pipe_tELi2EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %103, i64 noundef %105)
  %107 = load ptr, ptr %106, align 8, !tbaa !5
  call void @_ZNK3zmq6pipe_t8rollbackEv(ptr noundef nonnull align 8 dereferenceable(264) %107)
  %108 = load ptr, ptr %6, align 8, !tbaa !5
  %109 = call noundef zeroext i8 @_ZNK3zmq5msg_t5flagsEv(ptr noundef nonnull align 8 dereferenceable(64) %108)
  %110 = zext i8 %109 to i32
  %111 = and i32 %110, 1
  %112 = icmp ne i32 %111, 0
  %113 = getelementptr inbounds %"class.zmq::lb_t", ptr %13, i32 0, i32 4
  %114 = zext i1 %112 to i8
  store i8 %114, ptr %113, align 1, !tbaa !9
  %115 = getelementptr inbounds %"class.zmq::lb_t", ptr %13, i32 0, i32 3
  store i8 0, ptr %115, align 8, !tbaa !20
  %116 = call ptr @__errno_location() #8
  store i32 11, ptr %116, align 4, !tbaa !21
  store i32 -2, ptr %4, align 4
  br label %190

117:                                              ; preds = %98
  %118 = getelementptr inbounds %"class.zmq::lb_t", ptr %13, i32 0, i32 1
  %119 = load i64, ptr %118, align 8, !tbaa !23
  %120 = add i64 %119, -1
  store i64 %120, ptr %118, align 8, !tbaa !23
  %121 = getelementptr inbounds %"class.zmq::lb_t", ptr %13, i32 0, i32 2
  %122 = load i64, ptr %121, align 8, !tbaa !24
  %123 = getelementptr inbounds %"class.zmq::lb_t", ptr %13, i32 0, i32 1
  %124 = load i64, ptr %123, align 8, !tbaa !23
  %125 = icmp ult i64 %122, %124
  br i1 %125, label %126, label %132

126:                                              ; preds = %117
  %127 = getelementptr inbounds %"class.zmq::lb_t", ptr %13, i32 0, i32 0
  %128 = getelementptr inbounds %"class.zmq::lb_t", ptr %13, i32 0, i32 2
  %129 = load i64, ptr %128, align 8, !tbaa !24
  %130 = getelementptr inbounds %"class.zmq::lb_t", ptr %13, i32 0, i32 1
  %131 = load i64, ptr %130, align 8, !tbaa !23
  call void @_ZN3zmq7array_tINS_6pipe_tELi2EE4swapEmm(ptr noundef nonnull align 8 dereferenceable(24) %127, i64 noundef %129, i64 noundef %131)
  br label %134

132:                                              ; preds = %117
  %133 = getelementptr inbounds %"class.zmq::lb_t", ptr %13, i32 0, i32 2
  store i64 0, ptr %133, align 8, !tbaa !24
  br label %134

134:                                              ; preds = %132, %126
  br label %75, !llvm.loop !25

135:                                              ; preds = %97, %75
  %136 = getelementptr inbounds %"class.zmq::lb_t", ptr %13, i32 0, i32 1
  %137 = load i64, ptr %136, align 8, !tbaa !23
  %138 = icmp eq i64 %137, 0
  br i1 %138, label %139, label %141

139:                                              ; preds = %135
  %140 = call ptr @__errno_location() #8
  store i32 11, ptr %140, align 4, !tbaa !21
  store i32 -1, ptr %4, align 4
  br label %190

141:                                              ; preds = %135
  %142 = load ptr, ptr %6, align 8, !tbaa !5
  %143 = call noundef zeroext i8 @_ZNK3zmq5msg_t5flagsEv(ptr noundef nonnull align 8 dereferenceable(64) %142)
  %144 = zext i8 %143 to i32
  %145 = and i32 %144, 1
  %146 = icmp ne i32 %145, 0
  %147 = getelementptr inbounds %"class.zmq::lb_t", ptr %13, i32 0, i32 3
  %148 = zext i1 %146 to i8
  store i8 %148, ptr %147, align 8, !tbaa !20
  %149 = getelementptr inbounds %"class.zmq::lb_t", ptr %13, i32 0, i32 3
  %150 = load i8, ptr %149, align 8, !tbaa !20, !range !18, !noundef !19
  %151 = trunc i8 %150 to i1
  br i1 %151, label %167, label %152

152:                                              ; preds = %141
  %153 = getelementptr inbounds %"class.zmq::lb_t", ptr %13, i32 0, i32 0
  %154 = getelementptr inbounds %"class.zmq::lb_t", ptr %13, i32 0, i32 2
  %155 = load i64, ptr %154, align 8, !tbaa !24
  %156 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN3zmq7array_tINS_6pipe_tELi2EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %153, i64 noundef %155)
  %157 = load ptr, ptr %156, align 8, !tbaa !5
  call void @_ZN3zmq6pipe_t5flushEv(ptr noundef nonnull align 8 dereferenceable(264) %157)
  %158 = getelementptr inbounds %"class.zmq::lb_t", ptr %13, i32 0, i32 2
  %159 = load i64, ptr %158, align 8, !tbaa !24
  %160 = add i64 %159, 1
  store i64 %160, ptr %158, align 8, !tbaa !24
  %161 = getelementptr inbounds %"class.zmq::lb_t", ptr %13, i32 0, i32 1
  %162 = load i64, ptr %161, align 8, !tbaa !23
  %163 = icmp uge i64 %160, %162
  br i1 %163, label %164, label %166

164:                                              ; preds = %152
  %165 = getelementptr inbounds %"class.zmq::lb_t", ptr %13, i32 0, i32 2
  store i64 0, ptr %165, align 8, !tbaa !24
  br label %166

166:                                              ; preds = %164, %152
  br label %167

167:                                              ; preds = %166, %141
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %168 = load ptr, ptr %6, align 8, !tbaa !5
  %169 = call noundef i32 @_ZN3zmq5msg_t4initEv(ptr noundef nonnull align 8 dereferenceable(64) %168)
  store i32 %169, ptr %11, align 4, !tbaa !21
  br label %170

170:                                              ; preds = %167
  %171 = load i32, ptr %11, align 4, !tbaa !21
  %172 = icmp eq i32 %171, 0
  %173 = xor i1 %172, true
  %174 = zext i1 %173 to i64
  %175 = call i64 @llvm.expect.i64(i64 %174, i64 0)
  %176 = icmp ne i64 %175, 0
  br i1 %176, label %177, label %187

177:                                              ; preds = %170
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %178 = call ptr @__errno_location() #8
  %179 = load i32, ptr %178, align 4, !tbaa !21
  %180 = call ptr @strerror(i32 noundef %179) #7
  store ptr %180, ptr %12, align 8, !tbaa !5
  %181 = load ptr, ptr @stderr, align 8, !tbaa !5
  %182 = load ptr, ptr %12, align 8, !tbaa !5
  %183 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %181, ptr noundef @.str.3, ptr noundef %182, ptr noundef @.str.2, i32 noundef 155) #7
  %184 = load ptr, ptr @stderr, align 8, !tbaa !5
  %185 = call i32 @fflush(ptr noundef %184)
  %186 = load ptr, ptr %12, align 8, !tbaa !5
  call void @_ZN3zmq9zmq_abortEPKc(ptr noundef %186)
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  br label %187

187:                                              ; preds = %177, %170
  br label %188

188:                                              ; preds = %187
  br label %189

189:                                              ; preds = %188
  store i32 0, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %190

190:                                              ; preds = %189, %139, %102, %73
  %191 = load i32, ptr %4, align 4
  ret i32 %191
}

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

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

declare noundef i32 @_ZN3zmq5msg_t4initEv(ptr noundef nonnull align 8 dereferenceable(64)) #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) #4 align 2

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

declare void @_ZNK3zmq6pipe_t8rollbackEv(ptr noundef nonnull align 8 dereferenceable(264)) #2

declare void @_ZN3zmq6pipe_t5flushEv(ptr noundef nonnull align 8 dereferenceable(264)) #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 = { 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 #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, !17, i64 41}
!10 = !{!"_ZTSN3zmq4lb_tE", !11, i64 0, !16, i64 24, !16, i64 32, !17, i64 40, !17, i64 41}
!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 = !{i8 0, i8 2}
!19 = !{}
!20 = !{!10, !17, i64 40}
!21 = !{!22, !22, i64 0}
!22 = !{!"int", !7, i64 0}
!23 = !{!10, !16, i64 24}
!24 = !{!10, !16, i64 32}
!25 = distinct !{!25, !26}
!26 = !{!"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.2 = external hidden unnamed_addr constant [106 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: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3zmq7array_tINS_6pipe_tELi2EE4swapEmm(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 range(i32 -2, 1) i32 @_ZN3zmq4lb_t8sendpipeEPNS_5msg_tEPPNS_6pipe_tE(ptr noundef nonnull align 8 dereferenceable(42) %0, ptr noundef %1, ptr noundef writeonly %2) local_unnamed_addr #3 align 2 {
  %4 = getelementptr inbounds i8, ptr %0, i64 41
  %5 = load i8, ptr %4, align 1, !tbaa !5, !range !17, !noundef !18
  %6 = trunc nuw i8 %5 to i1
  br i1 %6, label %11, label %.preheader

.preheader:                                       ; preds = %3
  %7 = getelementptr inbounds i8, ptr %0, i64 24
  %8 = load i64, ptr %7, align 8, !tbaa !19
  %.not33 = icmp eq i64 %8, 0
  br i1 %.not33, label %.thread, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader
  %9 = getelementptr inbounds i8, ptr %0, i64 32
  %10 = getelementptr inbounds i8, ptr %0, i64 40
  br label %34

11:                                               ; preds = %3
  %12 = tail call noundef zeroext i8 @_ZNK3zmq5msg_t5flagsEv(ptr noundef nonnull align 8 dereferenceable(64) %1)
  %13 = and i8 %12, 1
  %14 = getelementptr inbounds i8, ptr %0, i64 40
  store i8 %13, ptr %14, align 8, !tbaa !20
  store i8 %13, ptr %4, align 1, !tbaa !5
  %15 = tail call noundef i32 @_ZN3zmq5msg_t5closeEv(ptr noundef nonnull align 8 dereferenceable(64) %1)
  %.not26 = icmp eq i32 %15, 0
  br i1 %.not26, label %24, label %16, !prof !21

16:                                               ; preds = %11
  %17 = tail call ptr @__errno_location() #6
  %18 = load i32, ptr %17, align 4, !tbaa !22
  %19 = tail call ptr @strerror(i32 noundef %18) #7
  %20 = load ptr, ptr @stderr, align 8, !tbaa !24
  %21 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %20, ptr noundef nonnull @.str.3, ptr noundef %19, ptr noundef nonnull @.str.2, i32 noundef 92) #8
  %22 = load ptr, ptr @stderr, align 8, !tbaa !24
  %23 = tail call i32 @fflush(ptr noundef %22)
  tail call void @_ZN3zmq9zmq_abortEPKc(ptr noundef %19)
  br label %24

24:                                               ; preds = %16, %11
  %25 = tail call noundef i32 @_ZN3zmq5msg_t4initEv(ptr noundef nonnull align 8 dereferenceable(64) %1)
  %.not27 = icmp eq i32 %25, 0
  br i1 %.not27, label %86, label %26, !prof !21

26:                                               ; preds = %24
  %27 = tail call ptr @__errno_location() #6
  %28 = load i32, ptr %27, align 4, !tbaa !22
  %29 = tail call ptr @strerror(i32 noundef %28) #7
  %30 = load ptr, ptr @stderr, align 8, !tbaa !24
  %31 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %30, ptr noundef nonnull @.str.3, ptr noundef %29, ptr noundef nonnull @.str.2, i32 noundef 94) #8
  %32 = load ptr, ptr @stderr, align 8, !tbaa !24
  %33 = tail call i32 @fflush(ptr noundef %32)
  tail call void @_ZN3zmq9zmq_abortEPKc(ptr noundef %29)
  br label %86

34:                                               ; preds = %.lr.ph, %61
  %35 = load i64, ptr %9, align 8, !tbaa !25
  %36 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN3zmq7array_tINS_6pipe_tELi2EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %35)
  %37 = load ptr, ptr %36, align 8, !tbaa !24
  %38 = tail call noundef zeroext i1 @_ZN3zmq6pipe_t5writeEPNS_5msg_tE(ptr noundef nonnull align 8 dereferenceable(264) %37, ptr noundef %1)
  br i1 %38, label %39, label %44

39:                                               ; preds = %34
  %.not22 = icmp eq ptr %2, null
  br i1 %.not22, label %63, label %40

40:                                               ; preds = %39
  %41 = load i64, ptr %9, align 8, !tbaa !25
  %42 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN3zmq7array_tINS_6pipe_tELi2EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %41)
  %43 = load ptr, ptr %42, align 8, !tbaa !24
  store ptr %43, ptr %2, align 8, !tbaa !24
  br label %63

44:                                               ; preds = %34
  %45 = load i8, ptr %10, align 8, !tbaa !20, !range !17, !noundef !18
  %46 = trunc nuw i8 %45 to i1
  br i1 %46, label %47, label %54

47:                                               ; preds = %44
  %48 = load i64, ptr %9, align 8, !tbaa !25
  %49 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN3zmq7array_tINS_6pipe_tELi2EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %48)
  %50 = load ptr, ptr %49, align 8, !tbaa !24
  tail call void @_ZNK3zmq6pipe_t8rollbackEv(ptr noundef nonnull align 8 dereferenceable(264) %50)
  %51 = tail call noundef zeroext i8 @_ZNK3zmq5msg_t5flagsEv(ptr noundef nonnull align 8 dereferenceable(64) %1)
  %52 = and i8 %51, 1
  store i8 %52, ptr %4, align 1, !tbaa !5
  store i8 0, ptr %10, align 8, !tbaa !20
  %53 = tail call ptr @__errno_location() #6
  store i32 11, ptr %53, align 4, !tbaa !22
  br label %86

54:                                               ; preds = %44
  %55 = load i64, ptr %7, align 8, !tbaa !19
  %56 = add i64 %55, -1
  store i64 %56, ptr %7, align 8, !tbaa !19
  %57 = load i64, ptr %9, align 8, !tbaa !25
  %58 = icmp ult i64 %57, %56
  br i1 %58, label %59, label %60

59:                                               ; preds = %54
  tail call void @_ZN3zmq7array_tINS_6pipe_tELi2EE4swapEmm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %57, i64 noundef %56)
  %.pre = load i64, ptr %7, align 8, !tbaa !19
  br label %61

60:                                               ; preds = %54
  store i64 0, ptr %9, align 8, !tbaa !25
  br label %61

61:                                               ; preds = %60, %59
  %62 = phi i64 [ %56, %60 ], [ %.pre, %59 ]
  %.not = icmp eq i64 %62, 0
  br i1 %.not, label %.thread, label %34, !llvm.loop !26

63:                                               ; preds = %39, %40
  %.pr = load i64, ptr %7, align 8, !tbaa !19
  %64 = icmp eq i64 %.pr, 0
  br i1 %64, label %.thread, label %66

.thread:                                          ; preds = %61, %.preheader, %63
  %65 = tail call ptr @__errno_location() #6
  store i32 11, ptr %65, align 4, !tbaa !22
  br label %86

66:                                               ; preds = %63
  %67 = tail call noundef zeroext i8 @_ZNK3zmq5msg_t5flagsEv(ptr noundef nonnull align 8 dereferenceable(64) %1)
  %68 = and i8 %67, 1
  %.not23 = icmp eq i8 %68, 0
  store i8 %68, ptr %10, align 8, !tbaa !20
  br i1 %.not23, label %69, label %76

69:                                               ; preds = %66
  %70 = load i64, ptr %9, align 8, !tbaa !25
  %71 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZN3zmq7array_tINS_6pipe_tELi2EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %70)
  %72 = load ptr, ptr %71, align 8, !tbaa !24
  tail call void @_ZN3zmq6pipe_t5flushEv(ptr noundef nonnull align 8 dereferenceable(264) %72)
  %73 = load i64, ptr %9, align 8, !tbaa !25
  %74 = add i64 %73, 1
  %75 = load i64, ptr %7, align 8, !tbaa !19
  %.not24 = icmp ult i64 %74, %75
  %spec.store.select = select i1 %.not24, i64 %74, i64 0
  store i64 %spec.store.select, ptr %9, align 8
  br label %76

76:                                               ; preds = %69, %66
  %77 = tail call noundef i32 @_ZN3zmq5msg_t4initEv(ptr noundef nonnull align 8 dereferenceable(64) %1)
  %.not25 = icmp eq i32 %77, 0
  br i1 %.not25, label %86, label %78, !prof !21

78:                                               ; preds = %76
  %79 = tail call ptr @__errno_location() #6
  %80 = load i32, ptr %79, align 4, !tbaa !22
  %81 = tail call ptr @strerror(i32 noundef %80) #7
  %82 = load ptr, ptr @stderr, align 8, !tbaa !24
  %83 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %82, ptr noundef nonnull @.str.3, ptr noundef %81, ptr noundef nonnull @.str.2, i32 noundef 155) #8
  %84 = load ptr, ptr @stderr, align 8, !tbaa !24
  %85 = tail call i32 @fflush(ptr noundef %84)
  tail call void @_ZN3zmq9zmq_abortEPKc(ptr noundef %81)
  br label %86

86:                                               ; preds = %76, %78, %24, %26, %.thread, %47
  %.0 = phi i32 [ -1, %.thread ], [ -2, %47 ], [ 0, %26 ], [ 0, %24 ], [ 0, %78 ], [ 0, %76 ]
  ret i32 %.0
}

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

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

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

; 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 #2 align 2

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

declare void @_ZNK3zmq6pipe_t8rollbackEv(ptr noundef nonnull align 8 dereferenceable(264)) local_unnamed_addr #1

declare void @_ZN3zmq6pipe_t5flushEv(ptr noundef nonnull align 8 dereferenceable(264)) 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 = !{!6, !16, i64 41}
!6 = !{!"_ZTSN3zmq4lb_tE", !7, i64 0, !15, i64 24, !15, i64 32, !16, i64 40, !16, i64 41}
!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 = !{i8 0, i8 2}
!18 = !{}
!19 = !{!6, !15, i64 24}
!20 = !{!6, !16, i64 40}
!21 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!22 = !{!23, !23, i64 0}
!23 = !{!"int", !13, i64 0}
!24 = !{!12, !12, i64 0}
!25 = !{!6, !15, i64 32}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}


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