; LLVM IR from ponylang/ponyc :: src/libponyrt/actor (actor)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.pony_ctx_t = type { ptr, ptr, ptr, ptr, ptr, %struct.actormap_t, ptr, i64, %struct.ponyint_serialise_t, ptr, ptr, ptr }
%struct.actormap_t = type { %struct.hashmap_t }
%struct.hashmap_t = type { i64, i64, ptr, ptr }
%struct.ponyint_serialise_t = type { %struct.hashmap_t }
%struct.pony_actor_t = type { ptr, %struct.messageq_t, i8, [39 x i8], %struct.heap_t, i64, i8, i32, %struct.gc_t, [16 x i8] }
%struct.messageq_t = type { ptr, ptr }
%struct.heap_t = type { [5 x ptr], [5 x ptr], ptr, [4 x ptr], i64, i64 }
%struct.gc_t = type { i32, i32, i64, %struct.objectmap_t, %struct.actormap_t, ptr }
%struct.objectmap_t = type { %struct.hashmap_t }

@.str = external hidden unnamed_addr constant [45 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [76 x i8], align 1
@__func__.ponyint_actor_run = external hidden unnamed_addr constant [18 x i8], align 1
@actor_noblock = external hidden global i8, align 1
@.str.2 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @ponyint_actor_run(ptr noundef %0, ptr noundef %1, i1 noundef zeroext %2) #0 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i8, align 1
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i8, align 1
  %14 = alloca i32, align 4
  %15 = alloca i8, align 1
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  %16 = zext i1 %2 to i8
  store i8 %16, ptr %7, align 1, !tbaa !9
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = call zeroext i1 @has_sync_flag(ptr noundef %17, i8 noundef zeroext 8)
  br i1 %18, label %20, label %19

19:                                               ; preds = %3
  br label %21

20:                                               ; preds = %3
  call void @ponyint_assert_fail(ptr noundef @.str, ptr noundef @.str.1, i64 noundef 527, ptr noundef @__func__.ponyint_actor_run)
  br label %21

21:                                               ; preds = %20, %19
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.pony_ctx_t, ptr %23, i32 0, i32 1
  store ptr %22, ptr %24, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  store i64 100, ptr %8, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  store i64 0, ptr %10, align 8, !tbaa !17
  %25 = load i8, ptr @actor_noblock, align 1, !tbaa !9, !range !18, !noundef !19
  %26 = trunc i8 %25 to i1
  br i1 %26, label %35, label %27

27:                                               ; preds = %21
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.pony_actor_t, ptr %28, i32 0, i32 8
  %30 = getelementptr inbounds %struct.gc_t, ptr %29, i32 0, i32 2
  %31 = load i64, ptr %30, align 8, !tbaa !20
  %32 = icmp ugt i64 %31, 0
  br i1 %32, label %33, label %35

33:                                               ; preds = %27
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  call void @set_internal_flag(ptr noundef %34, i8 noundef zeroext 32)
  br label %35

35:                                               ; preds = %33, %27, %21
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.pony_actor_t, ptr %36, i32 0, i32 1
  %38 = getelementptr inbounds %struct.messageq_t, ptr %37, i32 0, i32 0
  %39 = load atomic i64, ptr %38 acquire, align 8
  store i64 %39, ptr %12, align 8
  %40 = load ptr, ptr %12, align 8, !tbaa !5
  store ptr %40, ptr %11, align 8, !tbaa !5
  br label %41

41:                                               ; preds = %95, %35
  %42 = load ptr, ptr %6, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.pony_actor_t, ptr %42, i32 0, i32 1
  %44 = call ptr @ponyint_actor_messageq_pop(ptr noundef %43)
  store ptr %44, ptr %9, align 8, !tbaa !5
  %45 = icmp ne ptr %44, null
  br i1 %45, label %46, label %96

46:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #3
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  %49 = load ptr, ptr %9, align 8, !tbaa !5
  %50 = call zeroext i1 @handle_message(ptr noundef %47, ptr noundef %48, ptr noundef %49)
  %51 = zext i1 %50 to i8
  store i8 %51, ptr %13, align 1, !tbaa !9
  %52 = load i8, ptr @actor_noblock, align 1, !tbaa !9, !range !18, !noundef !19
  %53 = trunc i8 %52 to i1
  br i1 %53, label %62, label %54

54:                                               ; preds = %46
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.pony_actor_t, ptr %55, i32 0, i32 8
  %57 = getelementptr inbounds %struct.gc_t, ptr %56, i32 0, i32 2
  %58 = load i64, ptr %57, align 8, !tbaa !20
  %59 = icmp ugt i64 %58, 0
  br i1 %59, label %60, label %62

60:                                               ; preds = %54
  %61 = load ptr, ptr %6, align 8, !tbaa !5
  call void @set_internal_flag(ptr noundef %61, i8 noundef zeroext 32)
  br label %62

62:                                               ; preds = %60, %54, %46
  %63 = load i8, ptr %13, align 1, !tbaa !9, !range !18, !noundef !19
  %64 = trunc i8 %63 to i1
  br i1 %64, label %65, label %86

65:                                               ; preds = %62
  %66 = load i64, ptr %10, align 8, !tbaa !17
  %67 = add i64 %66, 1
  store i64 %67, ptr %10, align 8, !tbaa !17
  %68 = load ptr, ptr %5, align 8, !tbaa !5
  %69 = load ptr, ptr %6, align 8, !tbaa !5
  call void @try_gc(ptr noundef %68, ptr noundef %69)
  %70 = load ptr, ptr %6, align 8, !tbaa !5
  %71 = call zeroext i1 @maybe_should_mute(ptr noundef %70)
  br i1 %71, label %72, label %73

72:                                               ; preds = %65
  store i1 false, ptr %4, align 1
  store i32 1, ptr %14, align 4
  br label %93

73:                                               ; preds = %65
  %74 = load i64, ptr %10, align 8, !tbaa !17
  %75 = load i64, ptr %8, align 8, !tbaa !17
  %76 = icmp eq i64 %74, %75
  br i1 %76, label %80, label %77

77:                                               ; preds = %73
  %78 = load i8, ptr %7, align 1, !tbaa !9, !range !18, !noundef !19
  %79 = trunc i8 %78 to i1
  br i1 %79, label %80, label %85

80:                                               ; preds = %77, %73
  %81 = load ptr, ptr %6, align 8, !tbaa !5
  %82 = load i8, ptr %7, align 1, !tbaa !9, !range !18, !noundef !19
  %83 = trunc i8 %82 to i1
  %84 = call zeroext i1 @batch_limit_reached(ptr noundef %81, i1 noundef zeroext %83)
  store i1 %84, ptr %4, align 1
  store i32 1, ptr %14, align 4
  br label %93

85:                                               ; preds = %77
  br label %87

86:                                               ; preds = %62
  br label %87

87:                                               ; preds = %86, %85
  %88 = load ptr, ptr %9, align 8, !tbaa !5
  %89 = load ptr, ptr %11, align 8, !tbaa !5
  %90 = icmp eq ptr %88, %89
  br i1 %90, label %91, label %92

91:                                               ; preds = %87
  store i32 3, ptr %14, align 4
  br label %93

92:                                               ; preds = %87
  store i32 0, ptr %14, align 4
  br label %93

93:                                               ; preds = %92, %91, %80, %72
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #3
  %94 = load i32, ptr %14, align 4
  switch i32 %94, label %197 [
    i32 0, label %95
    i32 3, label %96
  ]

95:                                               ; preds = %93
  br label %41, !llvm.loop !27

96:                                               ; preds = %93, %41
  %97 = load i64, ptr %10, align 8, !tbaa !17
  %98 = load i64, ptr %8, align 8, !tbaa !17
  %99 = icmp ult i64 %97, %98
  br i1 %99, label %100, label %101

100:                                              ; preds = %96
  br label %102

101:                                              ; preds = %96
  call void @ponyint_assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i64 noundef 618, ptr noundef @__func__.ponyint_actor_run)
  br label %102

102:                                              ; preds = %101, %100
  %103 = load ptr, ptr %6, align 8, !tbaa !5
  %104 = call zeroext i1 @has_sync_flag(ptr noundef %103, i8 noundef zeroext 8)
  br i1 %104, label %106, label %105

105:                                              ; preds = %102
  br label %107

106:                                              ; preds = %102
  call void @ponyint_assert_fail(ptr noundef @.str, ptr noundef @.str.1, i64 noundef 619, ptr noundef @__func__.ponyint_actor_run)
  br label %107

107:                                              ; preds = %106, %105
  %108 = load ptr, ptr %6, align 8, !tbaa !5
  %109 = call zeroext i1 @has_sync_flag(ptr noundef %108, i8 noundef zeroext 2)
  br i1 %109, label %110, label %112

110:                                              ; preds = %107
  %111 = load ptr, ptr %6, align 8, !tbaa !5
  call void @actor_unsetoverloaded(ptr noundef %111)
  br label %112

112:                                              ; preds = %110, %107
  %113 = load ptr, ptr %5, align 8, !tbaa !5
  %114 = load ptr, ptr %6, align 8, !tbaa !5
  call void @try_gc(ptr noundef %113, ptr noundef %114)
  %115 = load i64, ptr %10, align 8, !tbaa !17
  %116 = icmp ugt i64 %115, 0
  br i1 %116, label %117, label %118

117:                                              ; preds = %112
  store i1 true, ptr %4, align 1
  store i32 1, ptr %14, align 4
  br label %197

118:                                              ; preds = %112
  %119 = load ptr, ptr %6, align 8, !tbaa !5
  %120 = call zeroext i1 @has_internal_flag(ptr noundef %119, i8 noundef zeroext 7)
  br i1 %120, label %123, label %121

121:                                              ; preds = %118
  %122 = load ptr, ptr %6, align 8, !tbaa !5
  call void @set_internal_flag(ptr noundef %122, i8 noundef zeroext 1)
  br label %123

123:                                              ; preds = %121, %118
  %124 = load ptr, ptr %6, align 8, !tbaa !5
  %125 = call zeroext i1 @has_internal_flag(ptr noundef %124, i8 noundef zeroext 1)
  br i1 %125, label %126, label %192

126:                                              ; preds = %123
  %127 = load ptr, ptr %6, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.pony_actor_t, ptr %127, i32 0, i32 8
  %129 = getelementptr inbounds %struct.gc_t, ptr %128, i32 0, i32 2
  %130 = load i64, ptr %129, align 8, !tbaa !20
  %131 = icmp eq i64 %130, 0
  br i1 %131, label %132, label %172

132:                                              ; preds = %126
  %133 = load ptr, ptr %6, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.pony_actor_t, ptr %133, i32 0, i32 7
  %135 = load i32, ptr %134, align 4, !tbaa !29
  %136 = icmp eq i32 %135, 0
  br i1 %136, label %137, label %138

137:                                              ; preds = %132
  br label %139

138:                                              ; preds = %132
  call void @ponyint_assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i64 noundef 651, ptr noundef @__func__.ponyint_actor_run)
  br label %139

139:                                              ; preds = %138, %137
  %140 = load i8, ptr @actor_noblock, align 1, !tbaa !9, !range !18, !noundef !19
  %141 = trunc i8 %140 to i1
  br i1 %141, label %145, label %142

142:                                              ; preds = %139
  %143 = load ptr, ptr %6, align 8, !tbaa !5
  %144 = call zeroext i1 @has_internal_flag(ptr noundef %143, i8 noundef zeroext 32)
  br i1 %144, label %169, label %145

145:                                              ; preds = %142, %139
  %146 = load ptr, ptr %6, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.pony_actor_t, ptr %146, i32 0, i32 1
  %148 = call zeroext i1 @ponyint_messageq_isempty(ptr noundef %147)
  br i1 %148, label %149, label %168

149:                                              ; preds = %145
  call void @llvm.lifetime.start.p0(i64 1, ptr %15) #3
  %150 = load ptr, ptr %6, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.pony_actor_t, ptr %150, i32 0, i32 1
  %152 = call zeroext i1 @ponyint_messageq_markempty(ptr noundef %151)
  %153 = zext i1 %152 to i8
  store i8 %153, ptr %15, align 1, !tbaa !9
  %154 = load i8, ptr %15, align 1, !tbaa !9, !range !18, !noundef !19
  %155 = trunc i8 %154 to i1
  br i1 %155, label %156, label %157

156:                                              ; preds = %149
  br label %158

157:                                              ; preds = %149
  call void @ponyint_assert_fail(ptr noundef @.str.4, ptr noundef @.str.1, i64 noundef 679, ptr noundef @__func__.ponyint_actor_run)
  br label %158

158:                                              ; preds = %157, %156
  %159 = load ptr, ptr %6, align 8, !tbaa !5
  call void @ponyint_actor_setpendingdestroy(ptr noundef %159)
  %160 = load ptr, ptr %5, align 8, !tbaa !5
  %161 = load ptr, ptr %6, align 8, !tbaa !5
  call void @ponyint_actor_final(ptr noundef %160, ptr noundef %161)
  %162 = load ptr, ptr %5, align 8, !tbaa !5
  %163 = load ptr, ptr %6, align 8, !tbaa !5
  call void @ponyint_actor_sendrelease(ptr noundef %162, ptr noundef %163)
  %164 = load ptr, ptr %6, align 8, !tbaa !5
  call void @ponyint_actor_destroy(ptr noundef %164, i32 noundef 0)
  %165 = load i8, ptr %15, align 1, !tbaa !9, !range !18, !noundef !19
  %166 = trunc i8 %165 to i1
  %167 = xor i1 %166, true
  store i1 %167, ptr %4, align 1
  store i32 1, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %15) #3
  br label %197

168:                                              ; preds = %145
  br label %171

169:                                              ; preds = %142
  %170 = load ptr, ptr %6, align 8, !tbaa !5
  call void @send_block(ptr noundef %170)
  store i1 false, ptr %4, align 1
  store i32 1, ptr %14, align 4
  br label %197

171:                                              ; preds = %168
  br label %191

172:                                              ; preds = %126
  %173 = load i8, ptr @actor_noblock, align 1, !tbaa !9, !range !18, !noundef !19
  %174 = trunc i8 %173 to i1
  br i1 %174, label %178, label %175

175:                                              ; preds = %172
  %176 = load ptr, ptr %6, align 8, !tbaa !5
  %177 = call zeroext i1 @has_internal_flag(ptr noundef %176, i8 noundef zeroext 2)
  br i1 %177, label %182, label %178

178:                                              ; preds = %175, %172
  %179 = load ptr, ptr %5, align 8, !tbaa !5
  call void @pony_triggergc(ptr noundef %179)
  %180 = load ptr, ptr %5, align 8, !tbaa !5
  %181 = load ptr, ptr %6, align 8, !tbaa !5
  call void @try_gc(ptr noundef %180, ptr noundef %181)
  br label %182

182:                                              ; preds = %178, %175
  %183 = load i8, ptr @actor_noblock, align 1, !tbaa !9, !range !18, !noundef !19
  %184 = trunc i8 %183 to i1
  br i1 %184, label %190, label %185

185:                                              ; preds = %182
  %186 = load ptr, ptr %6, align 8, !tbaa !5
  %187 = call zeroext i1 @has_internal_flag(ptr noundef %186, i8 noundef zeroext 16)
  br i1 %187, label %190, label %188

188:                                              ; preds = %185
  %189 = load ptr, ptr %6, align 8, !tbaa !5
  call void @send_block(ptr noundef %189)
  br label %190

190:                                              ; preds = %188, %185, %182
  br label %191

191:                                              ; preds = %190, %171
  br label %192

192:                                              ; preds = %191, %123
  %193 = load ptr, ptr %6, align 8, !tbaa !5
  %194 = getelementptr inbounds %struct.pony_actor_t, ptr %193, i32 0, i32 1
  %195 = call zeroext i1 @ponyint_messageq_markempty(ptr noundef %194)
  %196 = xor i1 %195, true
  store i1 %196, ptr %4, align 1
  store i32 1, ptr %14, align 4
  br label %197

197:                                              ; preds = %192, %169, %158, %117, %93
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  %198 = load i1, ptr %4, align 1
  ret i1 %198
}

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @has_sync_flag(ptr noundef, i8 noundef zeroext) #0

declare void @ponyint_assert_fail(ptr noundef, ptr noundef, i64 noundef, ptr noundef) #1

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

; Function Attrs: nounwind uwtable
declare hidden void @set_internal_flag(ptr noundef, i8 noundef zeroext) #0

declare ptr @ponyint_actor_messageq_pop(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @handle_message(ptr noundef, ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @try_gc(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @maybe_should_mute(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @batch_limit_reached(ptr noundef, i1 noundef zeroext) #0

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

; Function Attrs: nounwind uwtable
declare hidden void @actor_unsetoverloaded(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @has_internal_flag(ptr noundef, i8 noundef zeroext) #0

declare zeroext i1 @ponyint_messageq_isempty(ptr noundef) #1

declare zeroext i1 @ponyint_messageq_markempty(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @ponyint_actor_setpendingdestroy(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @ponyint_actor_final(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @ponyint_actor_sendrelease(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @ponyint_actor_destroy(ptr noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @send_block(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @pony_triggergc(ptr noundef) #0

attributes #0 = { 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 #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(argmem: readwrite) }
attributes #3 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"_Bool", !7, i64 0}
!11 = !{!12, !6, i64 8}
!12 = !{!"pony_ctx_t", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !13, i64 40, !6, i64 72, !15, i64 80, !16, i64 88, !6, i64 120, !6, i64 128, !6, i64 136}
!13 = !{!"actormap_t", !14, i64 0}
!14 = !{!"hashmap_t", !15, i64 0, !15, i64 8, !6, i64 16, !6, i64 24}
!15 = !{!"long", !7, i64 0}
!16 = !{!"ponyint_serialise_t", !14, i64 0}
!17 = !{!15, !15, i64 0}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = !{!21, !15, i64 224}
!21 = !{!"pony_actor_t", !6, i64 0, !22, i64 8, !7, i64 24, !23, i64 64, !15, i64 200, !7, i64 208, !24, i64 212, !25, i64 216}
!22 = !{!"messageq_t", !7, i64 0, !6, i64 8}
!23 = !{!"heap_t", !7, i64 0, !7, i64 40, !6, i64 80, !7, i64 88, !15, i64 120, !15, i64 128}
!24 = !{!"int", !7, i64 0}
!25 = !{!"gc_t", !24, i64 0, !24, i64 4, !15, i64 8, !26, i64 16, !13, i64 48, !6, i64 80}
!26 = !{!"objectmap_t", !14, i64 0}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}
!29 = !{!21, !24, i64 212}


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

@.str = external hidden unnamed_addr constant [45 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [76 x i8], align 1
@__func__.ponyint_actor_run = external hidden unnamed_addr constant [18 x i8], align 1
@actor_noblock = external hidden local_unnamed_addr global i8, align 1
@.str.2 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @ponyint_actor_run(ptr noundef %0, ptr noundef %1, i1 noundef zeroext %2) local_unnamed_addr #0 {
  %4 = tail call zeroext i1 @has_sync_flag(ptr noundef %1, i8 noundef zeroext 8)
  br i1 %4, label %5, label %6

5:                                                ; preds = %3
  tail call void @ponyint_assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i64 noundef 527, ptr noundef nonnull @__func__.ponyint_actor_run) #2
  br label %6

6:                                                ; preds = %3, %5
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  store ptr %1, ptr %7, align 8, !tbaa !5
  %8 = load i8, ptr @actor_noblock, align 1, !tbaa !14, !range !16, !noundef !17
  %9 = trunc nuw i8 %8 to i1
  br i1 %9, label %14, label %10

10:                                               ; preds = %6
  %11 = getelementptr inbounds i8, ptr %1, i64 224
  %12 = load i64, ptr %11, align 8, !tbaa !18
  %.not = icmp eq i64 %12, 0
  br i1 %.not, label %14, label %13

13:                                               ; preds = %10
  tail call void @set_internal_flag(ptr noundef nonnull %1, i8 noundef zeroext 32)
  br label %14

14:                                               ; preds = %13, %10, %6
  %15 = getelementptr inbounds i8, ptr %1, i64 8
  %16 = load atomic i64, ptr %15 acquire, align 8
  %17 = inttoptr i64 %16 to ptr
  %18 = getelementptr inbounds i8, ptr %1, i64 224
  br i1 %2, label %.split.us, label %.split

.split.us:                                        ; preds = %14, %30
  %19 = tail call ptr @ponyint_actor_messageq_pop(ptr noundef nonnull %15) #2
  %.not64.us = icmp eq ptr %19, null
  br i1 %.not64.us, label %.thread70.thread, label %20

20:                                               ; preds = %.split.us
  %21 = tail call zeroext i1 @handle_message(ptr noundef %0, ptr noundef %1, ptr noundef nonnull %19)
  %22 = load i8, ptr @actor_noblock, align 1, !tbaa !14, !range !16, !noundef !17
  %23 = trunc nuw i8 %22 to i1
  br i1 %23, label %27, label %24

24:                                               ; preds = %20
  %25 = load i64, ptr %18, align 8, !tbaa !18
  %.not65.us = icmp eq i64 %25, 0
  br i1 %.not65.us, label %27, label %26

26:                                               ; preds = %24
  tail call void @set_internal_flag(ptr noundef nonnull %1, i8 noundef zeroext 32)
  br label %27

27:                                               ; preds = %26, %24, %20
  br i1 %21, label %28, label %30

28:                                               ; preds = %27
  tail call void @try_gc(ptr noundef %0, ptr noundef %1)
  %29 = tail call zeroext i1 @maybe_should_mute(ptr noundef %1)
  br i1 %29, label %.thread, label %.split75.us

30:                                               ; preds = %27
  %31 = icmp eq ptr %19, %17
  br i1 %31, label %.thread70.thread, label %.split.us

.split:                                           ; preds = %14, %47
  %.059 = phi i64 [ %.160, %47 ], [ 0, %14 ]
  %32 = tail call ptr @ponyint_actor_messageq_pop(ptr noundef nonnull %15) #2
  %.not64 = icmp eq ptr %32, null
  br i1 %.not64, label %.thread70, label %33

33:                                               ; preds = %.split
  %34 = tail call zeroext i1 @handle_message(ptr noundef %0, ptr noundef %1, ptr noundef nonnull %32)
  %35 = load i8, ptr @actor_noblock, align 1, !tbaa !14, !range !16, !noundef !17
  %36 = trunc nuw i8 %35 to i1
  br i1 %36, label %40, label %37

37:                                               ; preds = %33
  %38 = load i64, ptr %18, align 8, !tbaa !18
  %.not65 = icmp eq i64 %38, 0
  br i1 %.not65, label %40, label %39

39:                                               ; preds = %37
  tail call void @set_internal_flag(ptr noundef nonnull %1, i8 noundef zeroext 32)
  br label %40

40:                                               ; preds = %39, %37, %33
  br i1 %34, label %41, label %47

41:                                               ; preds = %40
  tail call void @try_gc(ptr noundef %0, ptr noundef %1)
  %42 = tail call zeroext i1 @maybe_should_mute(ptr noundef %1)
  br i1 %42, label %.thread, label %43

43:                                               ; preds = %41
  %44 = add i64 %.059, 1
  %45 = icmp eq i64 %44, 100
  br i1 %45, label %.split75.us, label %47

.split75.us:                                      ; preds = %43, %28
  %46 = tail call zeroext i1 @batch_limit_reached(ptr noundef %1, i1 noundef zeroext %2)
  br label %.thread

47:                                               ; preds = %43, %40
  %.160 = phi i64 [ %.059, %40 ], [ %44, %43 ]
  %48 = icmp eq ptr %32, %17
  br i1 %48, label %.thread70, label %.split

.thread70:                                        ; preds = %.split, %47
  %.us-phi = phi i64 [ %.160, %47 ], [ %.059, %.split ]
  %49 = icmp ult i64 %.us-phi, 100
  br i1 %49, label %.thread70.thread, label %50

50:                                               ; preds = %.thread70
  tail call void @ponyint_assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i64 noundef 618, ptr noundef nonnull @__func__.ponyint_actor_run) #2
  br label %.thread70.thread

.thread70.thread:                                 ; preds = %.split.us, %30, %.thread70, %50
  %.us-phi78 = phi i64 [ %.us-phi, %.thread70 ], [ 1, %50 ], [ 0, %30 ], [ 0, %.split.us ]
  %51 = tail call zeroext i1 @has_sync_flag(ptr noundef %1, i8 noundef zeroext 8)
  br i1 %51, label %52, label %53

52:                                               ; preds = %.thread70.thread
  tail call void @ponyint_assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i64 noundef 619, ptr noundef nonnull @__func__.ponyint_actor_run) #2
  br label %53

53:                                               ; preds = %.thread70.thread, %52
  %54 = tail call zeroext i1 @has_sync_flag(ptr noundef %1, i8 noundef zeroext 2)
  br i1 %54, label %55, label %56

55:                                               ; preds = %53
  tail call void @actor_unsetoverloaded(ptr noundef %1)
  br label %56

56:                                               ; preds = %55, %53
  tail call void @try_gc(ptr noundef %0, ptr noundef %1)
  %.not66 = icmp eq i64 %.us-phi78, 0
  br i1 %.not66, label %57, label %.thread

57:                                               ; preds = %56
  %58 = tail call zeroext i1 @has_internal_flag(ptr noundef %1, i8 noundef zeroext 7)
  br i1 %58, label %60, label %59

59:                                               ; preds = %57
  tail call void @set_internal_flag(ptr noundef %1, i8 noundef zeroext 1)
  br label %60

60:                                               ; preds = %59, %57
  %61 = tail call zeroext i1 @has_internal_flag(ptr noundef %1, i8 noundef zeroext 1)
  br i1 %61, label %62, label %95

62:                                               ; preds = %60
  %63 = load i64, ptr %18, align 8, !tbaa !18
  %64 = icmp eq i64 %63, 0
  br i1 %64, label %65, label %83

65:                                               ; preds = %62
  %66 = getelementptr inbounds i8, ptr %1, i64 212
  %67 = load i32, ptr %66, align 4, !tbaa !25
  %68 = icmp eq i32 %67, 0
  br i1 %68, label %70, label %69

69:                                               ; preds = %65
  tail call void @ponyint_assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i64 noundef 651, ptr noundef nonnull @__func__.ponyint_actor_run) #2
  br label %70

70:                                               ; preds = %65, %69
  %71 = load i8, ptr @actor_noblock, align 1, !tbaa !14, !range !16, !noundef !17
  %72 = trunc nuw i8 %71 to i1
  br i1 %72, label %75, label %73

73:                                               ; preds = %70
  %74 = tail call zeroext i1 @has_internal_flag(ptr noundef nonnull %1, i8 noundef zeroext 32)
  br i1 %74, label %82, label %75

75:                                               ; preds = %73, %70
  %76 = tail call zeroext i1 @ponyint_messageq_isempty(ptr noundef nonnull %15) #2
  br i1 %76, label %77, label %95

77:                                               ; preds = %75
  %78 = tail call zeroext i1 @ponyint_messageq_markempty(ptr noundef nonnull %15) #2
  br i1 %78, label %80, label %79

79:                                               ; preds = %77
  tail call void @ponyint_assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.1, i64 noundef 679, ptr noundef nonnull @__func__.ponyint_actor_run) #2
  br label %80

80:                                               ; preds = %77, %79
  tail call void @ponyint_actor_setpendingdestroy(ptr noundef nonnull %1)
  tail call void @ponyint_actor_final(ptr noundef %0, ptr noundef nonnull %1)
  tail call void @ponyint_actor_sendrelease(ptr noundef %0, ptr noundef nonnull %1)
  tail call void @ponyint_actor_destroy(ptr noundef nonnull %1, i32 noundef 0)
  %81 = xor i1 %78, true
  br label %.thread

82:                                               ; preds = %73
  tail call void @send_block(ptr noundef nonnull %1)
  br label %.thread

83:                                               ; preds = %62
  %84 = load i8, ptr @actor_noblock, align 1, !tbaa !14, !range !16, !noundef !17
  %85 = trunc nuw i8 %84 to i1
  br i1 %85, label %88, label %86

86:                                               ; preds = %83
  %87 = tail call zeroext i1 @has_internal_flag(ptr noundef nonnull %1, i8 noundef zeroext 2)
  br i1 %87, label %89, label %88

88:                                               ; preds = %86, %83
  tail call void @pony_triggergc(ptr noundef %0)
  tail call void @try_gc(ptr noundef %0, ptr noundef nonnull %1)
  br label %89

89:                                               ; preds = %88, %86
  %90 = load i8, ptr @actor_noblock, align 1, !tbaa !14, !range !16, !noundef !17
  %91 = trunc nuw i8 %90 to i1
  br i1 %91, label %95, label %92

92:                                               ; preds = %89
  %93 = tail call zeroext i1 @has_internal_flag(ptr noundef nonnull %1, i8 noundef zeroext 16)
  br i1 %93, label %95, label %94

94:                                               ; preds = %92
  tail call void @send_block(ptr noundef nonnull %1)
  br label %95

95:                                               ; preds = %75, %94, %92, %89, %60
  %96 = tail call zeroext i1 @ponyint_messageq_markempty(ptr noundef nonnull %15) #2
  %97 = xor i1 %96, true
  br label %.thread

.thread:                                          ; preds = %41, %28, %.split75.us, %56, %95, %82, %80
  %.2 = phi i1 [ %81, %80 ], [ %97, %95 ], [ false, %82 ], [ true, %56 ], [ %46, %.split75.us ], [ false, %28 ], [ false, %41 ]
  ret i1 %.2
}

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @has_sync_flag(ptr noundef, i8 noundef zeroext) local_unnamed_addr #0

declare void @ponyint_assert_fail(ptr noundef, ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @set_internal_flag(ptr noundef, i8 noundef zeroext) local_unnamed_addr #0

declare ptr @ponyint_actor_messageq_pop(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @handle_message(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @try_gc(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @maybe_should_mute(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @batch_limit_reached(ptr noundef, i1 noundef zeroext) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @actor_unsetoverloaded(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @has_internal_flag(ptr noundef, i8 noundef zeroext) local_unnamed_addr #0

declare zeroext i1 @ponyint_messageq_isempty(ptr noundef) local_unnamed_addr #1

declare zeroext i1 @ponyint_messageq_markempty(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @ponyint_actor_setpendingdestroy(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @ponyint_actor_final(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @ponyint_actor_sendrelease(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @ponyint_actor_destroy(ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @send_block(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @pony_triggergc(ptr noundef) local_unnamed_addr #0

attributes #0 = { 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 #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 = { 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, !7, i64 8}
!6 = !{!"pony_ctx_t", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !10, i64 40, !7, i64 72, !12, i64 80, !13, i64 88, !7, i64 120, !7, i64 128, !7, i64 136}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"actormap_t", !11, i64 0}
!11 = !{!"hashmap_t", !12, i64 0, !12, i64 8, !7, i64 16, !7, i64 24}
!12 = !{!"long", !8, i64 0}
!13 = !{!"ponyint_serialise_t", !11, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"_Bool", !8, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = !{!19, !12, i64 224}
!19 = !{!"pony_actor_t", !7, i64 0, !20, i64 8, !8, i64 24, !21, i64 64, !12, i64 200, !8, i64 208, !22, i64 212, !23, i64 216}
!20 = !{!"messageq_t", !8, i64 0, !7, i64 8}
!21 = !{!"heap_t", !8, i64 0, !8, i64 40, !7, i64 80, !8, i64 88, !12, i64 120, !12, i64 128}
!22 = !{!"int", !8, i64 0}
!23 = !{!"gc_t", !22, i64 0, !22, i64 4, !12, i64 8, !24, i64 16, !10, i64 48, !7, i64 80}
!24 = !{!"objectmap_t", !11, i64 0}
!25 = !{!19, !22, i64 212}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopInstSimplifyPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass