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

; 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::v2_decoder_t" = type { %"class.zmq::decoder_base_t", [8 x i8], i8, %"class.zmq::msg_t", i8, i64 }
%"class.zmq::decoder_base_t" = type { %"class.zmq::i_decoder", { i64, i64 }, ptr, i64, %"class.zmq::shared_message_memory_allocator", ptr }
%"class.zmq::i_decoder" = type { ptr }
%"class.zmq::shared_message_memory_allocator" = type { ptr, i64, i64, ptr, i64 }
%"class.zmq::msg_t" = type { %union.anon }
%union.anon = type { %struct.anon }
%struct.anon = type { ptr, [34 x i8], i8, i8, [16 x i8], i32 }

@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [12 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [114 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [8 x i8], align 1
@__PRETTY_FUNCTION__._ZN3zmq12v2_decoder_t10size_readyEmPKh = external hidden unnamed_addr constant [67 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

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

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

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

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

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

declare i32 @fflush(ptr noundef) #1

declare void @_ZN3zmq9zmq_abortEPKc(ptr noundef) #1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3zmq14decoder_base_tINS_12v2_decoder_tENS_31shared_message_memory_allocatorEE9next_stepEPvmMS1_FiPKhE(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef, i64 noundef, i64, i64) #5 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN3zmq12v2_decoder_t10size_readyEmPKh(ptr noundef nonnull align 8 dereferenceable(184) %0, i64 noundef %1, ptr noundef %2) #6 align 2 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca { i64, i64 }, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i64 %1, ptr %6, align 8, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  %14 = load ptr, ptr %5, align 8
  %15 = getelementptr inbounds %"class.zmq::v2_decoder_t", ptr %14, i32 0, i32 5
  %16 = load i64, ptr %15, align 8, !tbaa !11
  %17 = icmp sge i64 %16, 0
  br i1 %17, label %18, label %29

18:                                               ; preds = %3
  %19 = load i64, ptr %6, align 8, !tbaa !9
  %20 = getelementptr inbounds %"class.zmq::v2_decoder_t", ptr %14, i32 0, i32 5
  %21 = load i64, ptr %20, align 8, !tbaa !11
  %22 = icmp ugt i64 %19, %21
  %23 = zext i1 %22 to i64
  %24 = call i64 @llvm.expect.i64(i64 %23, i64 0)
  %25 = icmp ne i64 %24, 0
  br i1 %25, label %26, label %28

26:                                               ; preds = %18
  %27 = call ptr @__errno_location() #8
  store i32 90, ptr %27, align 4, !tbaa !18
  store i32 -1, ptr %4, align 4
  br label %150

28:                                               ; preds = %18
  br label %29

29:                                               ; preds = %28, %3
  %30 = load i64, ptr %6, align 8, !tbaa !9
  %31 = load i64, ptr %6, align 8, !tbaa !9
  %32 = icmp ne i64 %30, %31
  %33 = zext i1 %32 to i64
  %34 = call i64 @llvm.expect.i64(i64 %33, i64 0)
  %35 = icmp ne i64 %34, 0
  br i1 %35, label %36, label %38

36:                                               ; preds = %29
  %37 = call ptr @__errno_location() #8
  store i32 90, ptr %37, align 4, !tbaa !18
  store i32 -1, ptr %4, align 4
  br label %150

38:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #9
  %39 = getelementptr inbounds %"class.zmq::v2_decoder_t", ptr %14, i32 0, i32 3
  %40 = call noundef i32 @_ZN3zmq5msg_t5closeEv(ptr noundef nonnull align 8 dereferenceable(64) %39)
  store i32 %40, ptr %8, align 4, !tbaa !18
  %41 = load i32, ptr %8, align 4, !tbaa !18
  %42 = icmp eq i32 %41, 0
  br i1 %42, label %43, label %44

43:                                               ; preds = %38
  br label %46

44:                                               ; preds = %38
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 111, ptr noundef @__PRETTY_FUNCTION__._ZN3zmq12v2_decoder_t10size_readyEmPKh) #10
  unreachable

45:                                               ; No predecessors!
  br label %46

46:                                               ; preds = %45, %43
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #9
  %47 = call noundef nonnull align 8 dereferenceable(40) ptr @_ZN3zmq14decoder_base_tINS_12v2_decoder_tENS_31shared_message_memory_allocatorEE13get_allocatorEv(ptr noundef nonnull align 8 dereferenceable(88) %14)
  store ptr %47, ptr %9, align 8, !tbaa !5
  %48 = getelementptr inbounds %"class.zmq::v2_decoder_t", ptr %14, i32 0, i32 4
  %49 = load i8, ptr %48, align 8, !tbaa !20, !range !21, !noundef !22
  %50 = trunc i8 %49 to i1
  br i1 %50, label %51, label %63

51:                                               ; preds = %46
  %52 = load i64, ptr %6, align 8, !tbaa !9
  %53 = load ptr, ptr %9, align 8, !tbaa !5
  %54 = call noundef ptr @_ZN3zmq31shared_message_memory_allocator4dataEv(ptr noundef nonnull align 8 dereferenceable(40) %53)
  %55 = load ptr, ptr %9, align 8, !tbaa !5
  %56 = call noundef i64 @_ZNK3zmq31shared_message_memory_allocator4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %55)
  %57 = getelementptr inbounds i8, ptr %54, i64 %56
  %58 = load ptr, ptr %7, align 8, !tbaa !5
  %59 = ptrtoint ptr %57 to i64
  %60 = ptrtoint ptr %58 to i64
  %61 = sub i64 %59, %60
  %62 = icmp ugt i64 %52, %61
  br label %63

63:                                               ; preds = %51, %46
  %64 = phi i1 [ true, %46 ], [ %62, %51 ]
  %65 = zext i1 %64 to i64
  %66 = call i64 @llvm.expect.i64(i64 %65, i64 0)
  %67 = icmp ne i64 %66, 0
  br i1 %67, label %68, label %72

68:                                               ; preds = %63
  %69 = getelementptr inbounds %"class.zmq::v2_decoder_t", ptr %14, i32 0, i32 3
  %70 = load i64, ptr %6, align 8, !tbaa !9
  %71 = call noundef i32 @_ZN3zmq5msg_t9init_sizeEm(ptr noundef nonnull align 8 dereferenceable(64) %69, i64 noundef %70)
  store i32 %71, ptr %8, align 4, !tbaa !18
  br label %87

72:                                               ; preds = %63
  %73 = getelementptr inbounds %"class.zmq::v2_decoder_t", ptr %14, i32 0, i32 3
  %74 = load ptr, ptr %7, align 8, !tbaa !5
  %75 = load i64, ptr %6, align 8, !tbaa !9
  %76 = load ptr, ptr %9, align 8, !tbaa !5
  %77 = call noundef ptr @_ZN3zmq31shared_message_memory_allocator6bufferEv(ptr noundef nonnull align 8 dereferenceable(40) %76)
  %78 = load ptr, ptr %9, align 8, !tbaa !5
  %79 = call noundef ptr @_ZN3zmq31shared_message_memory_allocator15provide_contentEv(ptr noundef nonnull align 8 dereferenceable(40) %78)
  %80 = call noundef i32 @_ZN3zmq5msg_t4initEPvmPFvS1_S1_ES1_PNS0_9content_tE(ptr noundef nonnull align 8 dereferenceable(64) %73, ptr noundef %74, i64 noundef %75, ptr noundef @_ZN3zmq31shared_message_memory_allocator12call_dec_refEPvS1_, ptr noundef %77, ptr noundef %79)
  store i32 %80, ptr %8, align 4, !tbaa !18
  %81 = getelementptr inbounds %"class.zmq::v2_decoder_t", ptr %14, i32 0, i32 3
  %82 = call noundef zeroext i1 @_ZNK3zmq5msg_t8is_zcmsgEv(ptr noundef nonnull align 8 dereferenceable(64) %81)
  br i1 %82, label %83, label %86

83:                                               ; preds = %72
  %84 = load ptr, ptr %9, align 8, !tbaa !5
  call void @_ZN3zmq31shared_message_memory_allocator15advance_contentEv(ptr noundef nonnull align 8 dereferenceable(40) %84)
  %85 = load ptr, ptr %9, align 8, !tbaa !5
  call void @_ZN3zmq31shared_message_memory_allocator7inc_refEv(ptr noundef nonnull align 8 dereferenceable(40) %85)
  br label %86

86:                                               ; preds = %83, %72
  br label %87

87:                                               ; preds = %86, %68
  %88 = load i32, ptr %8, align 4, !tbaa !18
  %89 = sext i32 %88 to i64
  %90 = call i64 @llvm.expect.i64(i64 %89, i64 0)
  %91 = icmp ne i64 %90, 0
  br i1 %91, label %92, label %137

92:                                               ; preds = %87
  br label %93

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

101:                                              ; preds = %93
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #9
  %102 = call ptr @__errno_location() #8
  %103 = load i32, ptr %102, align 4, !tbaa !18
  %104 = call ptr @strerror(i32 noundef %103) #9
  store ptr %104, ptr %10, align 8, !tbaa !5
  %105 = load ptr, ptr @stderr, align 8, !tbaa !5
  %106 = load ptr, ptr %10, align 8, !tbaa !5
  %107 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %105, ptr noundef @.str, ptr noundef %106, ptr noundef @.str.1, i32 noundef 141) #9
  %108 = load ptr, ptr @stderr, align 8, !tbaa !5
  %109 = call i32 @fflush(ptr noundef %108)
  %110 = load ptr, ptr %10, align 8, !tbaa !5
  call void @_ZN3zmq9zmq_abortEPKc(ptr noundef %110)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #9
  br label %111

111:                                              ; preds = %101, %93
  br label %112

112:                                              ; preds = %111
  br label %113

113:                                              ; preds = %112
  %114 = getelementptr inbounds %"class.zmq::v2_decoder_t", ptr %14, i32 0, i32 3
  %115 = call noundef i32 @_ZN3zmq5msg_t4initEv(ptr noundef nonnull align 8 dereferenceable(64) %114)
  store i32 %115, ptr %8, align 4, !tbaa !18
  br label %116

116:                                              ; preds = %113
  %117 = load i32, ptr %8, align 4, !tbaa !18
  %118 = icmp eq i32 %117, 0
  %119 = xor i1 %118, true
  %120 = zext i1 %119 to i64
  %121 = call i64 @llvm.expect.i64(i64 %120, i64 0)
  %122 = icmp ne i64 %121, 0
  br i1 %122, label %123, label %133

123:                                              ; preds = %116
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #9
  %124 = call ptr @__errno_location() #8
  %125 = load i32, ptr %124, align 4, !tbaa !18
  %126 = call ptr @strerror(i32 noundef %125) #9
  store ptr %126, ptr %11, align 8, !tbaa !5
  %127 = load ptr, ptr @stderr, align 8, !tbaa !5
  %128 = load ptr, ptr %11, align 8, !tbaa !5
  %129 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %127, ptr noundef @.str, ptr noundef %128, ptr noundef @.str.1, i32 noundef 143) #9
  %130 = load ptr, ptr @stderr, align 8, !tbaa !5
  %131 = call i32 @fflush(ptr noundef %130)
  %132 = load ptr, ptr %11, align 8, !tbaa !5
  call void @_ZN3zmq9zmq_abortEPKc(ptr noundef %132)
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #9
  br label %133

133:                                              ; preds = %123, %116
  br label %134

134:                                              ; preds = %133
  br label %135

135:                                              ; preds = %134
  %136 = call ptr @__errno_location() #8
  store i32 12, ptr %136, align 4, !tbaa !18
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %12, align 4
  br label %149

137:                                              ; preds = %87
  %138 = getelementptr inbounds %"class.zmq::v2_decoder_t", ptr %14, i32 0, i32 3
  %139 = getelementptr inbounds %"class.zmq::v2_decoder_t", ptr %14, i32 0, i32 2
  %140 = load i8, ptr %139, align 8, !tbaa !23
  call void @_ZN3zmq5msg_t9set_flagsEh(ptr noundef nonnull align 8 dereferenceable(64) %138, i8 noundef zeroext %140)
  %141 = getelementptr inbounds %"class.zmq::v2_decoder_t", ptr %14, i32 0, i32 3
  %142 = call noundef ptr @_ZN3zmq5msg_t4dataEv(ptr noundef nonnull align 8 dereferenceable(64) %141)
  %143 = getelementptr inbounds %"class.zmq::v2_decoder_t", ptr %14, i32 0, i32 3
  %144 = call noundef i64 @_ZNK3zmq5msg_t4sizeEv(ptr noundef nonnull align 8 dereferenceable(64) %143)
  store { i64, i64 } { i64 ptrtoint (ptr @_ZN3zmq12v2_decoder_t13message_readyEPKh to i64), i64 0 }, ptr %13, align 8, !tbaa !24
  %145 = getelementptr inbounds { i64, i64 }, ptr %13, i32 0, i32 0
  %146 = load i64, ptr %145, align 8
  %147 = getelementptr inbounds { i64, i64 }, ptr %13, i32 0, i32 1
  %148 = load i64, ptr %147, align 8
  call void @_ZN3zmq14decoder_base_tINS_12v2_decoder_tENS_31shared_message_memory_allocatorEE9next_stepEPvmMS1_FiPKhE(ptr noundef nonnull align 8 dereferenceable(88) %14, ptr noundef %142, i64 noundef %144, i64 %146, i64 %148)
  store i32 0, ptr %4, align 4
  store i32 1, ptr %12, align 4
  br label %149

149:                                              ; preds = %137, %135
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #9
  br label %150

150:                                              ; preds = %149, %36, %26
  %151 = load i32, ptr %4, align 4
  ret i32 %151
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #7

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(40) ptr @_ZN3zmq14decoder_base_tINS_12v2_decoder_tENS_31shared_message_memory_allocatorEE13get_allocatorEv(ptr noundef nonnull align 8 dereferenceable(88)) #5 align 2

declare noundef ptr @_ZN3zmq31shared_message_memory_allocator4dataEv(ptr noundef nonnull align 8 dereferenceable(40)) #1

declare noundef i64 @_ZNK3zmq31shared_message_memory_allocator4sizeEv(ptr noundef nonnull align 8 dereferenceable(40)) #1

declare noundef i32 @_ZN3zmq5msg_t9init_sizeEm(ptr noundef nonnull align 8 dereferenceable(64), i64 noundef) #1

declare noundef i32 @_ZN3zmq5msg_t4initEPvmPFvS1_S1_ES1_PNS0_9content_tE(ptr noundef nonnull align 8 dereferenceable(64), ptr noundef, i64 noundef, ptr noundef, ptr noundef, ptr noundef) #1

declare void @_ZN3zmq31shared_message_memory_allocator12call_dec_refEPvS1_(ptr noundef, ptr noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN3zmq31shared_message_memory_allocator6bufferEv(ptr noundef nonnull align 8 dereferenceable(40)) #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN3zmq31shared_message_memory_allocator15provide_contentEv(ptr noundef nonnull align 8 dereferenceable(40)) #5 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3zmq31shared_message_memory_allocator15advance_contentEv(ptr noundef nonnull align 8 dereferenceable(40)) #5 align 2

declare void @_ZN3zmq31shared_message_memory_allocator7inc_refEv(ptr noundef nonnull align 8 dereferenceable(40)) #1

declare void @_ZN3zmq5msg_t9set_flagsEh(ptr noundef nonnull align 8 dereferenceable(64), i8 noundef zeroext) #1

declare noundef ptr @_ZN3zmq5msg_t4dataEv(ptr noundef nonnull align 8 dereferenceable(64)) #1

declare noundef i64 @_ZNK3zmq5msg_t4sizeEv(ptr noundef nonnull align 8 dereferenceable(64)) #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN3zmq12v2_decoder_t13message_readyEPKh(ptr noundef nonnull align 8 dereferenceable(184), ptr noundef) #6 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nosync nounwind willreturn memory(none) }
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 = { 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 = { 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 = { 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 #7 = { noreturn 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 = { nounwind willreturn memory(none) }
attributes #9 = { nounwind }
attributes #10 = { noreturn nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !10, i64 176}
!12 = !{!"_ZTSN3zmq12v2_decoder_tE", !13, i64 0, !7, i64 88, !7, i64 96, !16, i64 104, !17, i64 168, !10, i64 176}
!13 = !{!"_ZTSN3zmq14decoder_base_tINS_12v2_decoder_tENS_31shared_message_memory_allocatorEEE", !14, i64 0, !7, i64 8, !6, i64 24, !10, i64 32, !15, i64 40, !6, i64 80}
!14 = !{!"_ZTSN3zmq9i_decoderE"}
!15 = !{!"_ZTSN3zmq31shared_message_memory_allocatorE", !6, i64 0, !10, i64 8, !10, i64 16, !6, i64 24, !10, i64 32}
!16 = !{!"_ZTSN3zmq5msg_tE", !7, i64 0}
!17 = !{!"bool", !7, i64 0}
!18 = !{!19, !19, i64 0}
!19 = !{!"int", !7, i64 0}
!20 = !{!12, !17, i64 168}
!21 = !{i8 0, i8 2}
!22 = !{}
!23 = !{!12, !7, i64 96}
!24 = !{!7, !7, i64 0}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [12 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [114 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [8 x i8], align 1
@__PRETTY_FUNCTION__._ZN3zmq12v2_decoder_t10size_readyEmPKh = external hidden unnamed_addr constant [67 x i8], align 1

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

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

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

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

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

declare void @_ZN3zmq9zmq_abortEPKc(ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3zmq14decoder_base_tINS_12v2_decoder_tENS_31shared_message_memory_allocatorEE9next_stepEPvmMS1_FiPKhE(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef, i64 noundef, i64, i64) local_unnamed_addr #4 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 -1, 1) i32 @_ZN3zmq12v2_decoder_t10size_readyEmPKh(ptr noundef nonnull align 8 dereferenceable(184) %0, i64 noundef %1, ptr noundef %2) local_unnamed_addr #5 align 2 {
  %4 = getelementptr inbounds i8, ptr %0, i64 176
  %5 = load i64, ptr %4, align 8, !tbaa !5
  %6 = icmp sgt i64 %5, -1
  %7 = icmp ult i64 %5, %1
  %or.cond = and i1 %6, %7
  br i1 %or.cond, label %8, label %10, !prof !16

8:                                                ; preds = %3
  %9 = tail call ptr @__errno_location() #7
  store i32 90, ptr %9, align 4, !tbaa !17
  br label %60

10:                                               ; preds = %3
  %11 = getelementptr inbounds i8, ptr %0, i64 104
  %12 = tail call noundef i32 @_ZN3zmq5msg_t5closeEv(ptr noundef nonnull align 8 dereferenceable(64) %11)
  %13 = icmp eq i32 %12, 0
  br i1 %13, label %15, label %14

14:                                               ; preds = %10
  tail call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 111, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN3zmq12v2_decoder_t10size_readyEmPKh) #8
  unreachable

15:                                               ; preds = %10
  %16 = tail call noundef nonnull align 8 dereferenceable(40) ptr @_ZN3zmq14decoder_base_tINS_12v2_decoder_tENS_31shared_message_memory_allocatorEE13get_allocatorEv(ptr noundef nonnull align 8 dereferenceable(88) %0)
  %17 = getelementptr inbounds i8, ptr %0, i64 168
  %18 = load i8, ptr %17, align 8, !tbaa !19, !range !20, !noundef !21
  %19 = trunc nuw i8 %18 to i1
  br i1 %19, label %20, label %.critedge, !prof !22

20:                                               ; preds = %15
  %21 = tail call noundef ptr @_ZN3zmq31shared_message_memory_allocator4dataEv(ptr noundef nonnull align 8 dereferenceable(40) %16)
  %22 = tail call noundef i64 @_ZNK3zmq31shared_message_memory_allocator4sizeEv(ptr noundef nonnull align 8 dereferenceable(40) %16)
  %23 = getelementptr inbounds i8, ptr %21, i64 %22
  %24 = ptrtoint ptr %23 to i64
  %25 = ptrtoint ptr %2 to i64
  %26 = sub i64 %24, %25
  %27 = icmp ult i64 %26, %1
  br i1 %27, label %.critedge, label %29, !prof !23

.critedge:                                        ; preds = %15, %20
  %28 = tail call noundef i32 @_ZN3zmq5msg_t9init_sizeEm(ptr noundef nonnull align 8 dereferenceable(64) %11, i64 noundef %1)
  br label %35

29:                                               ; preds = %20
  %30 = tail call noundef ptr @_ZN3zmq31shared_message_memory_allocator6bufferEv(ptr noundef nonnull align 8 dereferenceable(40) %16)
  %31 = tail call noundef ptr @_ZN3zmq31shared_message_memory_allocator15provide_contentEv(ptr noundef nonnull align 8 dereferenceable(40) %16)
  %32 = tail call noundef i32 @_ZN3zmq5msg_t4initEPvmPFvS1_S1_ES1_PNS0_9content_tE(ptr noundef nonnull align 8 dereferenceable(64) %11, ptr noundef %2, i64 noundef %1, ptr noundef nonnull @_ZN3zmq31shared_message_memory_allocator12call_dec_refEPvS1_, ptr noundef %30, ptr noundef %31)
  %33 = tail call noundef zeroext i1 @_ZNK3zmq5msg_t8is_zcmsgEv(ptr noundef nonnull align 8 dereferenceable(64) %11)
  br i1 %33, label %34, label %35

34:                                               ; preds = %29
  tail call void @_ZN3zmq31shared_message_memory_allocator15advance_contentEv(ptr noundef nonnull align 8 dereferenceable(40) %16)
  tail call void @_ZN3zmq31shared_message_memory_allocator7inc_refEv(ptr noundef nonnull align 8 dereferenceable(40) %16)
  br label %35

35:                                               ; preds = %29, %34, %.critedge
  %.022 = phi i32 [ %28, %.critedge ], [ %32, %34 ], [ %32, %29 ]
  %.not = icmp eq i32 %.022, 0
  br i1 %.not, label %55, label %36, !prof !22

36:                                               ; preds = %35
  %37 = tail call ptr @__errno_location() #7
  %38 = load i32, ptr %37, align 4, !tbaa !17
  %.not24 = icmp eq i32 %38, 12
  br i1 %.not24, label %45, label %39, !prof !22

39:                                               ; preds = %36
  %40 = tail call ptr @strerror(i32 noundef %38) #9
  %41 = load ptr, ptr @stderr, align 8, !tbaa !24
  %42 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %41, ptr noundef nonnull @.str, ptr noundef %40, ptr noundef nonnull @.str.1, i32 noundef 141) #10
  %43 = load ptr, ptr @stderr, align 8, !tbaa !24
  %44 = tail call i32 @fflush(ptr noundef %43)
  tail call void @_ZN3zmq9zmq_abortEPKc(ptr noundef %40)
  br label %45

45:                                               ; preds = %39, %36
  %46 = tail call noundef i32 @_ZN3zmq5msg_t4initEv(ptr noundef nonnull align 8 dereferenceable(64) %11)
  %.not25 = icmp eq i32 %46, 0
  br i1 %.not25, label %54, label %47, !prof !22

47:                                               ; preds = %45
  %48 = load i32, ptr %37, align 4, !tbaa !17
  %49 = tail call ptr @strerror(i32 noundef %48) #9
  %50 = load ptr, ptr @stderr, align 8, !tbaa !24
  %51 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %50, ptr noundef nonnull @.str, ptr noundef %49, ptr noundef nonnull @.str.1, i32 noundef 143) #10
  %52 = load ptr, ptr @stderr, align 8, !tbaa !24
  %53 = tail call i32 @fflush(ptr noundef %52)
  tail call void @_ZN3zmq9zmq_abortEPKc(ptr noundef %49)
  br label %54

54:                                               ; preds = %47, %45
  store i32 12, ptr %37, align 4, !tbaa !17
  br label %60

55:                                               ; preds = %35
  %56 = getelementptr inbounds i8, ptr %0, i64 96
  %57 = load i8, ptr %56, align 8, !tbaa !25
  tail call void @_ZN3zmq5msg_t9set_flagsEh(ptr noundef nonnull align 8 dereferenceable(64) %11, i8 noundef zeroext %57)
  %58 = tail call noundef ptr @_ZN3zmq5msg_t4dataEv(ptr noundef nonnull align 8 dereferenceable(64) %11)
  %59 = tail call noundef i64 @_ZNK3zmq5msg_t4sizeEv(ptr noundef nonnull align 8 dereferenceable(64) %11)
  tail call void @_ZN3zmq14decoder_base_tINS_12v2_decoder_tENS_31shared_message_memory_allocatorEE9next_stepEPvmMS1_FiPKhE(ptr noundef nonnull align 8 dereferenceable(88) %0, ptr noundef %58, i64 noundef %59, i64 ptrtoint (ptr @_ZN3zmq12v2_decoder_t13message_readyEPKh to i64), i64 0)
  br label %60

60:                                               ; preds = %54, %55, %8
  %.1 = phi i32 [ -1, %8 ], [ -1, %54 ], [ 0, %55 ]
  ret i32 %.1
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #6

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(40) ptr @_ZN3zmq14decoder_base_tINS_12v2_decoder_tENS_31shared_message_memory_allocatorEE13get_allocatorEv(ptr noundef nonnull align 8 dereferenceable(88)) local_unnamed_addr #4 align 2

declare noundef ptr @_ZN3zmq31shared_message_memory_allocator4dataEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #0

declare noundef i64 @_ZNK3zmq31shared_message_memory_allocator4sizeEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #0

declare noundef i32 @_ZN3zmq5msg_t9init_sizeEm(ptr noundef nonnull align 8 dereferenceable(64), i64 noundef) local_unnamed_addr #0

declare noundef i32 @_ZN3zmq5msg_t4initEPvmPFvS1_S1_ES1_PNS0_9content_tE(ptr noundef nonnull align 8 dereferenceable(64), ptr noundef, i64 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

declare void @_ZN3zmq31shared_message_memory_allocator12call_dec_refEPvS1_(ptr noundef, ptr noundef) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN3zmq31shared_message_memory_allocator6bufferEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN3zmq31shared_message_memory_allocator15provide_contentEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #4 align 2

declare noundef zeroext i1 @_ZNK3zmq5msg_t8is_zcmsgEv(ptr noundef nonnull align 8 dereferenceable(64)) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3zmq31shared_message_memory_allocator15advance_contentEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #4 align 2

declare void @_ZN3zmq31shared_message_memory_allocator7inc_refEv(ptr noundef nonnull align 8 dereferenceable(40)) local_unnamed_addr #0

declare void @_ZN3zmq5msg_t9set_flagsEh(ptr noundef nonnull align 8 dereferenceable(64), i8 noundef zeroext) local_unnamed_addr #0

declare noundef ptr @_ZN3zmq5msg_t4dataEv(ptr noundef nonnull align 8 dereferenceable(64)) local_unnamed_addr #0

declare noundef i64 @_ZNK3zmq5msg_t4sizeEv(ptr noundef nonnull align 8 dereferenceable(64)) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN3zmq12v2_decoder_t13message_readyEPKh(ptr noundef nonnull align 8 dereferenceable(184), ptr noundef) #5 align 2

attributes #0 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 = { 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 #3 = { 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 #4 = { 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 = { noreturn 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 = { nounwind willreturn memory(none) }
attributes #8 = { noreturn nounwind }
attributes #9 = { nounwind }
attributes #10 = { 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, !12, i64 176}
!6 = !{!"_ZTSN3zmq12v2_decoder_tE", !7, i64 0, !9, i64 88, !9, i64 96, !14, i64 104, !15, i64 168, !12, i64 176}
!7 = !{!"_ZTSN3zmq14decoder_base_tINS_12v2_decoder_tENS_31shared_message_memory_allocatorEEE", !8, i64 0, !9, i64 8, !11, i64 24, !12, i64 32, !13, i64 40, !11, i64 80}
!8 = !{!"_ZTSN3zmq9i_decoderE"}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"any pointer", !9, i64 0}
!12 = !{!"long", !9, i64 0}
!13 = !{!"_ZTSN3zmq31shared_message_memory_allocatorE", !11, i64 0, !12, i64 8, !12, i64 16, !11, i64 24, !12, i64 32}
!14 = !{!"_ZTSN3zmq5msg_tE", !9, i64 0}
!15 = !{!"bool", !9, i64 0}
!16 = !{!"branch_weights", i32 1, i32 4001}
!17 = !{!18, !18, i64 0}
!18 = !{!"int", !9, i64 0}
!19 = !{!6, !15, i64 168}
!20 = !{i8 0, i8 2}
!21 = !{}
!22 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!23 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!24 = !{!11, !11, i64 0}
!25 = !{!6, !9, i64 96}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,LowerExpectIntrinsicPass,SROAPass,SimplifyCFGPass,TailCallElimPass