; LLVM IR from Montimage/mmt-security :: src/lib (mmt_single_security)

; 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.message_struct = type { i64, i64, i64, ptr, i16, %struct.mmt_bit_t, ptr, i32, i32, ptr, [32 x i8] }
%struct.mmt_bit_t = type { [32 x i8] }
%struct.mmt_single_sec_handler_struct = type { i64, ptr, ptr, ptr, ptr, ptr, ptr, %struct.mmt_bit_t, i64, i8, ptr, i32 }
%struct.rule_info_struct = type { i32, i32, ptr, ptr, ptr, ptr, i8, i8, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.mmt_array_struct = type { i64, ptr }

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @mmt_single_is_ignore_remain_flow(ptr noundef, i64 noundef) #2

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

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

; Function Attrs: nounwind uwtable
define dso_local void @mmt_single_sec_process(ptr noundef %0, ptr noundef %1) #2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.message_struct, ptr %12, i32 0, i32 5
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.mmt_single_sec_handler_struct, ptr %14, i32 0, i32 7
  %16 = call zeroext i1 @mmt_bit_is_zero_and(ptr noundef %13, ptr noundef %15)
  %17 = xor i1 %16, true
  %18 = xor i1 %17, true
  %19 = zext i1 %18 to i32
  %20 = sext i32 %19 to i64
  %21 = call i64 @llvm.expect.i64(i64 %20, i64 0)
  %22 = icmp ne i64 %21, 0
  br i1 %22, label %23, label %24

23:                                               ; preds = %2
  br label %202

24:                                               ; preds = %2
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.message_struct, ptr %26, i32 0, i32 2
  %28 = load i64, ptr %27, align 16, !tbaa !9
  %29 = call zeroext i1 @mmt_single_is_ignore_remain_flow(ptr noundef %25, i64 noundef %28)
  br i1 %29, label %30, label %31

30:                                               ; preds = %24
  br label %202

31:                                               ; preds = %24
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.mmt_single_sec_handler_struct, ptr %32, i32 0, i32 8
  %34 = load i64, ptr %33, align 8, !tbaa !15
  %35 = add i64 %34, 1
  store i64 %35, ptr %33, align 8, !tbaa !15
  store i64 0, ptr %5, align 8, !tbaa !18
  br label %36

36:                                               ; preds = %198, %31
  %37 = load i64, ptr %5, align 8, !tbaa !18
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.mmt_single_sec_handler_struct, ptr %38, i32 0, i32 0
  %40 = load i64, ptr %39, align 64, !tbaa !19
  %41 = icmp ult i64 %37, %40
  br i1 %41, label %42, label %201

42:                                               ; preds = %36
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.message_struct, ptr %43, i32 0, i32 5
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.mmt_single_sec_handler_struct, ptr %45, i32 0, i32 6
  %47 = load ptr, ptr %46, align 16, !tbaa !20
  %48 = load i64, ptr %5, align 8, !tbaa !18
  %49 = getelementptr inbounds %struct.mmt_bit_t, ptr %47, i64 %48
  %50 = call zeroext i1 @mmt_bit_is_zero_and(ptr noundef %44, ptr noundef %49)
  br i1 %50, label %51, label %52

51:                                               ; preds = %42
  br label %198

52:                                               ; preds = %42
  %53 = load ptr, ptr %3, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.mmt_single_sec_handler_struct, ptr %53, i32 0, i32 4
  %55 = load ptr, ptr %54, align 32, !tbaa !21
  %56 = load i64, ptr %5, align 8, !tbaa !18
  %57 = getelementptr inbounds ptr, ptr %55, i64 %56
  %58 = load ptr, ptr %57, align 8, !tbaa !5
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = call i32 @rule_engine_process(ptr noundef %58, ptr noundef %59)
  store i32 %60, ptr %7, align 4, !tbaa !22
  %61 = load i32, ptr %7, align 4, !tbaa !22
  %62 = icmp ne i32 %61, 4
  %63 = xor i1 %62, true
  %64 = xor i1 %63, true
  %65 = zext i1 %64 to i32
  %66 = sext i32 %65 to i64
  %67 = call i64 @llvm.expect.i64(i64 %66, i64 0)
  %68 = icmp ne i64 %67, 0
  br i1 %68, label %69, label %197

69:                                               ; preds = %52
  %70 = load ptr, ptr %3, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.mmt_single_sec_handler_struct, ptr %70, i32 0, i32 5
  %72 = load ptr, ptr %71, align 8, !tbaa !23
  %73 = load i64, ptr %5, align 8, !tbaa !18
  %74 = getelementptr inbounds i64, ptr %72, i64 %73
  %75 = load i64, ptr %74, align 8, !tbaa !18
  %76 = add i64 %75, 1
  store i64 %76, ptr %74, align 8, !tbaa !18
  %77 = load ptr, ptr %3, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.mmt_single_sec_handler_struct, ptr %77, i32 0, i32 4
  %79 = load ptr, ptr %78, align 32, !tbaa !21
  %80 = load i64, ptr %5, align 8, !tbaa !18
  %81 = getelementptr inbounds ptr, ptr %79, i64 %80
  %82 = load ptr, ptr %81, align 8, !tbaa !5
  %83 = call ptr @rule_engine_get_valide_trace(ptr noundef %82)
  store ptr %83, ptr %8, align 8, !tbaa !5
  %84 = load ptr, ptr %3, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.mmt_single_sec_handler_struct, ptr %84, i32 0, i32 1
  %86 = load ptr, ptr %85, align 8, !tbaa !24
  %87 = load i64, ptr %5, align 8, !tbaa !18
  %88 = getelementptr inbounds ptr, ptr %86, i64 %87
  %89 = load ptr, ptr %88, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.rule_info_struct, ptr %89, i32 0, i32 4
  %91 = load ptr, ptr %90, align 8, !tbaa !25
  %92 = icmp ne ptr %91, null
  br i1 %92, label %93, label %116

93:                                               ; preds = %69
  %94 = load ptr, ptr %3, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.mmt_single_sec_handler_struct, ptr %94, i32 0, i32 1
  %96 = load ptr, ptr %95, align 8, !tbaa !24
  %97 = load i64, ptr %5, align 8, !tbaa !18
  %98 = getelementptr inbounds ptr, ptr %96, i64 %97
  %99 = load ptr, ptr %98, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.rule_info_struct, ptr %99, i32 0, i32 4
  %101 = load ptr, ptr %100, align 8, !tbaa !25
  %102 = load ptr, ptr %3, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.mmt_single_sec_handler_struct, ptr %102, i32 0, i32 1
  %104 = load ptr, ptr %103, align 8, !tbaa !24
  %105 = load i64, ptr %5, align 8, !tbaa !18
  %106 = getelementptr inbounds ptr, ptr %104, i64 %105
  %107 = load ptr, ptr %106, align 8, !tbaa !5
  %108 = load i32, ptr %7, align 4, !tbaa !22
  %109 = load ptr, ptr %4, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.message_struct, ptr %109, i32 0, i32 1
  %111 = load i64, ptr %110, align 8, !tbaa !27
  %112 = load ptr, ptr %4, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.message_struct, ptr %112, i32 0, i32 0
  %114 = load i64, ptr %113, align 64, !tbaa !28
  %115 = load ptr, ptr %8, align 8, !tbaa !5
  call void %101(ptr noundef %107, i32 noundef %108, i64 noundef %111, i64 noundef %114, ptr noundef %115)
  br label %116

116:                                              ; preds = %93, %69
  %117 = load ptr, ptr %3, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.mmt_single_sec_handler_struct, ptr %117, i32 0, i32 2
  %119 = load ptr, ptr %118, align 16, !tbaa !29
  %120 = icmp ne ptr %119, null
  br i1 %120, label %121, label %142

121:                                              ; preds = %116
  %122 = load ptr, ptr %3, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.mmt_single_sec_handler_struct, ptr %122, i32 0, i32 2
  %124 = load ptr, ptr %123, align 16, !tbaa !29
  %125 = load ptr, ptr %3, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.mmt_single_sec_handler_struct, ptr %125, i32 0, i32 1
  %127 = load ptr, ptr %126, align 8, !tbaa !24
  %128 = load i64, ptr %5, align 8, !tbaa !18
  %129 = getelementptr inbounds ptr, ptr %127, i64 %128
  %130 = load ptr, ptr %129, align 8, !tbaa !5
  %131 = load i32, ptr %7, align 4, !tbaa !22
  %132 = load ptr, ptr %4, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.message_struct, ptr %132, i32 0, i32 1
  %134 = load i64, ptr %133, align 8, !tbaa !27
  %135 = load ptr, ptr %4, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.message_struct, ptr %135, i32 0, i32 0
  %137 = load i64, ptr %136, align 64, !tbaa !28
  %138 = load ptr, ptr %8, align 8, !tbaa !5
  %139 = load ptr, ptr %3, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.mmt_single_sec_handler_struct, ptr %139, i32 0, i32 3
  %141 = load ptr, ptr %140, align 8, !tbaa !30
  call void %124(ptr noundef %130, i32 noundef %131, i64 noundef %134, i64 noundef %137, ptr noundef %138, ptr noundef %141)
  br label %142

142:                                              ; preds = %121, %116
  %143 = load ptr, ptr %3, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.mmt_single_sec_handler_struct, ptr %143, i32 0, i32 10
  %145 = load ptr, ptr %144, align 8, !tbaa !31
  %146 = icmp ne ptr %145, null
  br i1 %146, label %147, label %196

147:                                              ; preds = %142
  %148 = load ptr, ptr %3, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct.mmt_single_sec_handler_struct, ptr %148, i32 0, i32 11
  %150 = call i32 @pthread_spin_lock(ptr noundef %149) #6
  %151 = icmp eq i32 %150, 0
  br i1 %151, label %152, label %196

152:                                              ; preds = %147
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  store i64 -1, ptr %9, align 8, !tbaa !18
  store i64 0, ptr %6, align 8, !tbaa !18
  br label %153

153:                                              ; preds = %189, %152
  %154 = load i64, ptr %6, align 8, !tbaa !18
  %155 = load ptr, ptr %8, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.mmt_array_struct, ptr %155, i32 0, i32 0
  %157 = load i64, ptr %156, align 8, !tbaa !32
  %158 = icmp ult i64 %154, %157
  br i1 %158, label %159, label %192

159:                                              ; preds = %153
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %160 = load ptr, ptr %8, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.mmt_array_struct, ptr %160, i32 0, i32 1
  %162 = load ptr, ptr %161, align 8, !tbaa !34
  %163 = load i64, ptr %6, align 8, !tbaa !18
  %164 = getelementptr inbounds ptr, ptr %162, i64 %163
  %165 = load ptr, ptr %164, align 8, !tbaa !5
  store ptr %165, ptr %10, align 8, !tbaa !5
  %166 = load ptr, ptr %10, align 8, !tbaa !5
  %167 = icmp eq ptr %166, null
  br i1 %167, label %174, label %168

168:                                              ; preds = %159
  %169 = load ptr, ptr %10, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.message_struct, ptr %169, i32 0, i32 2
  %171 = load i64, ptr %170, align 16, !tbaa !9
  %172 = load i64, ptr %9, align 8, !tbaa !18
  %173 = icmp eq i64 %171, %172
  br i1 %173, label %174, label %175

174:                                              ; preds = %168, %159
  store i32 8, ptr %11, align 4
  br label %186

175:                                              ; preds = %168
  %176 = load ptr, ptr %10, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct.message_struct, ptr %176, i32 0, i32 2
  %178 = load i64, ptr %177, align 16, !tbaa !9
  store i64 %178, ptr %9, align 8, !tbaa !18
  %179 = load ptr, ptr %3, align 8, !tbaa !5
  %180 = getelementptr inbounds %struct.mmt_single_sec_handler_struct, ptr %179, i32 0, i32 10
  %181 = load ptr, ptr %180, align 8, !tbaa !31
  %182 = load ptr, ptr %10, align 8, !tbaa !5
  %183 = getelementptr inbounds %struct.message_struct, ptr %182, i32 0, i32 2
  %184 = load i64, ptr %183, align 16, !tbaa !9
  %185 = call zeroext i1 @mmt_set_ex_add(ptr noundef %181, i64 noundef %184)
  store i32 0, ptr %11, align 4
  br label %186

186:                                              ; preds = %175, %174
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  %187 = load i32, ptr %11, align 4
  switch i32 %187, label %205 [
    i32 0, label %188
    i32 8, label %189
  ]

188:                                              ; preds = %186
  br label %189

189:                                              ; preds = %188, %186
  %190 = load i64, ptr %6, align 8, !tbaa !18
  %191 = add i64 %190, 1
  store i64 %191, ptr %6, align 8, !tbaa !18
  br label %153, !llvm.loop !35

192:                                              ; preds = %153
  %193 = load ptr, ptr %3, align 8, !tbaa !5
  %194 = getelementptr inbounds %struct.mmt_single_sec_handler_struct, ptr %193, i32 0, i32 11
  %195 = call i32 @pthread_spin_unlock(ptr noundef %194) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %196

196:                                              ; preds = %192, %147, %142
  br label %197

197:                                              ; preds = %196, %52
  br label %198

198:                                              ; preds = %197, %51
  %199 = load i64, ptr %5, align 8, !tbaa !18
  %200 = add i64 %199, 1
  store i64 %200, ptr %5, align 8, !tbaa !18
  br label %36, !llvm.loop !37

201:                                              ; preds = %36
  br label %202

202:                                              ; preds = %201, %30, %23
  %203 = load ptr, ptr %4, align 8, !tbaa !5
  %204 = call i64 @free_message_t(ptr noundef %203)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  ret void

205:                                              ; preds = %186
  unreachable
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @mmt_bit_is_zero_and(ptr noundef, ptr noundef) #4

declare i32 @rule_engine_process(ptr noundef, ptr noundef) #5

declare ptr @rule_engine_get_valide_trace(ptr noundef) #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @mmt_set_ex_add(ptr noundef, i64 noundef) #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @free_message_t(ptr noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #2 = { 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 = { 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 = { inlinehint 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 = { "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 }

!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, !11, i64 16}
!10 = !{!"message_struct", !11, i64 0, !11, i64 8, !11, i64 16, !6, i64 24, !12, i64 32, !13, i64 34, !6, i64 72, !14, i64 80, !14, i64 84, !6, i64 88}
!11 = !{!"long", !7, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!"", !7, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!16, !11, i64 88}
!16 = !{!"mmt_single_sec_handler_struct", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !13, i64 56, !11, i64 88, !17, i64 96, !6, i64 104, !14, i64 112}
!17 = !{!"_Bool", !7, i64 0}
!18 = !{!11, !11, i64 0}
!19 = !{!16, !11, i64 0}
!20 = !{!16, !6, i64 48}
!21 = !{!16, !6, i64 32}
!22 = !{!14, !14, i64 0}
!23 = !{!16, !6, i64 40}
!24 = !{!16, !6, i64 8}
!25 = !{!26, !6, i64 24}
!26 = !{!"rule_info_struct", !14, i64 0, !14, i64 4, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !7, i64 40, !7, i64 41, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88}
!27 = !{!10, !11, i64 8}
!28 = !{!10, !11, i64 0}
!29 = !{!16, !6, i64 16}
!30 = !{!16, !6, i64 24}
!31 = !{!16, !6, i64 104}
!32 = !{!33, !11, i64 0}
!33 = !{!"mmt_array_struct", !11, i64 0, !6, i64 8}
!34 = !{!33, !6, i64 8}
!35 = distinct !{!35, !36}
!36 = !{!"llvm.loop.mustprogress"}
!37 = distinct !{!37, !36}


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

%struct.mmt_bit_t = type { [32 x i8] }

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @mmt_single_is_ignore_remain_flow(ptr noundef, i64 noundef) local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
define dso_local void @mmt_single_sec_process(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %1, i64 34
  %4 = getelementptr inbounds i8, ptr %0, i64 56
  %5 = tail call zeroext i1 @mmt_bit_is_zero_and(ptr noundef nonnull %3, ptr noundef nonnull %4)
  br i1 %5, label %.loopexit, label %6, !prof !5

6:                                                ; preds = %2
  %7 = getelementptr inbounds i8, ptr %1, i64 16
  %8 = load i64, ptr %7, align 16, !tbaa !6
  %9 = tail call zeroext i1 @mmt_single_is_ignore_remain_flow(ptr noundef %0, i64 noundef %8)
  br i1 %9, label %.loopexit, label %10

10:                                               ; preds = %6
  %11 = getelementptr inbounds i8, ptr %0, i64 88
  %12 = load i64, ptr %11, align 8, !tbaa !15
  %13 = add i64 %12, 1
  store i64 %13, ptr %11, align 8, !tbaa !15
  %14 = load i64, ptr %0, align 64, !tbaa !18
  %.not67 = icmp eq i64 %14, 0
  br i1 %.not67, label %.loopexit, label %.lr.ph66

.lr.ph66:                                         ; preds = %10
  %15 = getelementptr inbounds i8, ptr %0, i64 48
  %16 = getelementptr inbounds i8, ptr %0, i64 32
  %17 = getelementptr inbounds i8, ptr %0, i64 40
  %18 = getelementptr inbounds i8, ptr %0, i64 8
  %19 = getelementptr inbounds i8, ptr %1, i64 8
  %20 = getelementptr inbounds i8, ptr %0, i64 16
  %21 = getelementptr inbounds i8, ptr %0, i64 24
  %22 = getelementptr inbounds i8, ptr %0, i64 104
  %23 = getelementptr inbounds i8, ptr %0, i64 112
  br label %24

24:                                               ; preds = %.lr.ph66, %84
  %.064 = phi i64 [ 0, %.lr.ph66 ], [ %85, %84 ]
  %25 = load ptr, ptr %15, align 16, !tbaa !19
  %26 = getelementptr inbounds %struct.mmt_bit_t, ptr %25, i64 %.064
  %27 = tail call zeroext i1 @mmt_bit_is_zero_and(ptr noundef nonnull %3, ptr noundef %26)
  br i1 %27, label %84, label %28

28:                                               ; preds = %24
  %29 = load ptr, ptr %16, align 32, !tbaa !20
  %30 = getelementptr inbounds ptr, ptr %29, i64 %.064
  %31 = load ptr, ptr %30, align 8, !tbaa !21
  %32 = tail call i32 @rule_engine_process(ptr noundef %31, ptr noundef %1) #4
  %.not = icmp eq i32 %32, 4
  br i1 %.not, label %84, label %33, !prof !22

33:                                               ; preds = %28
  %34 = load ptr, ptr %17, align 8, !tbaa !23
  %35 = getelementptr inbounds i64, ptr %34, i64 %.064
  %36 = load i64, ptr %35, align 8, !tbaa !24
  %37 = add i64 %36, 1
  store i64 %37, ptr %35, align 8, !tbaa !24
  %38 = load ptr, ptr %16, align 32, !tbaa !20
  %39 = getelementptr inbounds ptr, ptr %38, i64 %.064
  %40 = load ptr, ptr %39, align 8, !tbaa !21
  %41 = tail call ptr @rule_engine_get_valide_trace(ptr noundef %40) #4
  %42 = load ptr, ptr %18, align 8, !tbaa !25
  %43 = getelementptr inbounds ptr, ptr %42, i64 %.064
  %44 = load ptr, ptr %43, align 8, !tbaa !21
  %45 = getelementptr inbounds i8, ptr %44, i64 24
  %46 = load ptr, ptr %45, align 8, !tbaa !26
  %.not59 = icmp eq ptr %46, null
  br i1 %.not59, label %50, label %47

47:                                               ; preds = %33
  %48 = load i64, ptr %19, align 8, !tbaa !28
  %49 = load i64, ptr %1, align 64, !tbaa !29
  tail call void %46(ptr noundef nonnull %44, i32 noundef %32, i64 noundef %48, i64 noundef %49, ptr noundef %41) #4
  br label %50

50:                                               ; preds = %47, %33
  %51 = load ptr, ptr %20, align 16, !tbaa !30
  %.not60 = icmp eq ptr %51, null
  br i1 %.not60, label %59, label %52

52:                                               ; preds = %50
  %53 = load ptr, ptr %18, align 8, !tbaa !25
  %54 = getelementptr inbounds ptr, ptr %53, i64 %.064
  %55 = load ptr, ptr %54, align 8, !tbaa !21
  %56 = load i64, ptr %19, align 8, !tbaa !28
  %57 = load i64, ptr %1, align 64, !tbaa !29
  %58 = load ptr, ptr %21, align 8, !tbaa !31
  tail call void %51(ptr noundef %55, i32 noundef %32, i64 noundef %56, i64 noundef %57, ptr noundef %41, ptr noundef %58) #4
  br label %59

59:                                               ; preds = %52, %50
  %60 = load ptr, ptr %22, align 8, !tbaa !32
  %.not61 = icmp eq ptr %60, null
  br i1 %.not61, label %84, label %61

61:                                               ; preds = %59
  %62 = tail call i32 @pthread_spin_lock(ptr noundef nonnull %23) #4
  %63 = icmp eq i32 %62, 0
  br i1 %63, label %.preheader, label %84

.preheader:                                       ; preds = %61
  %64 = load i64, ptr %41, align 8, !tbaa !33
  %.not68 = icmp eq i64 %64, 0
  br i1 %.not68, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader
  %65 = getelementptr inbounds i8, ptr %41, i64 8
  br label %66

66:                                               ; preds = %.lr.ph, %79
  %67 = phi i64 [ %64, %.lr.ph ], [ %80, %79 ]
  %.05263 = phi i64 [ -1, %.lr.ph ], [ %.1, %79 ]
  %.05362 = phi i64 [ 0, %.lr.ph ], [ %81, %79 ]
  %68 = load ptr, ptr %65, align 8, !tbaa !35
  %69 = getelementptr inbounds ptr, ptr %68, i64 %.05362
  %70 = load ptr, ptr %69, align 8, !tbaa !21
  %71 = icmp eq ptr %70, null
  br i1 %71, label %79, label %72

72:                                               ; preds = %66
  %73 = getelementptr inbounds i8, ptr %70, i64 16
  %74 = load i64, ptr %73, align 16, !tbaa !6
  %75 = icmp eq i64 %74, %.05263
  br i1 %75, label %79, label %76

76:                                               ; preds = %72
  %77 = load ptr, ptr %22, align 8, !tbaa !32
  %78 = tail call zeroext i1 @mmt_set_ex_add(ptr noundef %77, i64 noundef %74)
  %.pre = load i64, ptr %41, align 8, !tbaa !33
  br label %79

79:                                               ; preds = %66, %72, %76
  %80 = phi i64 [ %.pre, %76 ], [ %67, %72 ], [ %67, %66 ]
  %.1 = phi i64 [ %74, %76 ], [ %.05263, %72 ], [ %.05263, %66 ]
  %81 = add nuw i64 %.05362, 1
  %82 = icmp ult i64 %81, %80
  br i1 %82, label %66, label %._crit_edge, !llvm.loop !36

._crit_edge:                                      ; preds = %79, %.preheader
  %83 = tail call i32 @pthread_spin_unlock(ptr noundef nonnull %23) #4
  br label %84

84:                                               ; preds = %28, %._crit_edge, %61, %59, %24
  %85 = add nuw i64 %.064, 1
  %86 = load i64, ptr %0, align 64, !tbaa !18
  %87 = icmp ult i64 %85, %86
  br i1 %87, label %24, label %.loopexit, !llvm.loop !38

.loopexit:                                        ; preds = %84, %10, %6, %2
  %88 = tail call i64 @free_message_t(ptr noundef %1)
  ret void
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @mmt_bit_is_zero_and(ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @rule_engine_process(ptr noundef, ptr noundef) local_unnamed_addr #3

declare ptr @rule_engine_get_valide_trace(ptr noundef) local_unnamed_addr #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @mmt_set_ex_add(ptr noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @free_message_t(ptr noundef) local_unnamed_addr #2

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 = { 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 = { inlinehint 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 = { "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 }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!6 = !{!7, !8, i64 16}
!7 = !{!"message_struct", !8, i64 0, !8, i64 8, !8, i64 16, !11, i64 24, !12, i64 32, !13, i64 34, !11, i64 72, !14, i64 80, !14, i64 84, !11, i64 88}
!8 = !{!"long", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"any pointer", !9, i64 0}
!12 = !{!"short", !9, i64 0}
!13 = !{!"", !9, i64 0}
!14 = !{!"int", !9, i64 0}
!15 = !{!16, !8, i64 88}
!16 = !{!"mmt_single_sec_handler_struct", !8, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !13, i64 56, !8, i64 88, !17, i64 96, !11, i64 104, !14, i64 112}
!17 = !{!"_Bool", !9, i64 0}
!18 = !{!16, !8, i64 0}
!19 = !{!16, !11, i64 48}
!20 = !{!16, !11, i64 32}
!21 = !{!11, !11, i64 0}
!22 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!23 = !{!16, !11, i64 40}
!24 = !{!8, !8, i64 0}
!25 = !{!16, !11, i64 8}
!26 = !{!27, !11, i64 24}
!27 = !{!"rule_info_struct", !14, i64 0, !14, i64 4, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !9, i64 40, !9, i64 41, !11, i64 48, !11, i64 56, !11, i64 64, !11, i64 72, !11, i64 80, !11, i64 88}
!28 = !{!7, !8, i64 8}
!29 = !{!7, !8, i64 0}
!30 = !{!16, !11, i64 16}
!31 = !{!16, !11, i64 24}
!32 = !{!16, !11, i64 104}
!33 = !{!34, !8, i64 0}
!34 = !{!"mmt_array_struct", !8, i64 0, !11, i64 8}
!35 = !{!34, !11, i64 8}
!36 = distinct !{!36, !37}
!37 = !{!"llvm.loop.mustprogress"}
!38 = distinct !{!38, !37}


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