; LLVM IR from chdb-io/chdb :: base/poco/Foundation/src (pcre_study)

; 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.compile_data = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [4 x i8] }
%struct.real_pcre8_or_16 = type { i32, i32, i32, i32, i32, i32, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, ptr, ptr }
%struct.pcre_extra = type { i64, ptr, i64, ptr, ptr, i64, ptr, ptr }
%struct.pcre_study_data = type { i32, i32, [32 x i8], i32 }

@.str = external hidden unnamed_addr constant [46 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [42 x i8], align 1
@pcre_malloc = external global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [21 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local ptr @pcre_study(ptr noundef %0, i32 noundef %1, ptr noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca [32 x i8], align 16
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca %struct.compile_data, align 8
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 32, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  store ptr null, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.start.p0(i64 192, ptr %16) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %20, ptr %17, align 8, !tbaa !5
  %21 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr null, ptr %21, align 8, !tbaa !5
  %22 = load ptr, ptr %17, align 8, !tbaa !5
  %23 = icmp eq ptr %22, null
  br i1 %23, label %30, label %24

24:                                               ; preds = %3
  %25 = load ptr, ptr %17, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.real_pcre8_or_16, ptr %25, i32 0, i32 0
  %27 = load i32, ptr %26, align 8, !tbaa !11
  %28 = zext i32 %27 to i64
  %29 = icmp ne i64 %28, 1346589253
  br i1 %29, label %30, label %32

30:                                               ; preds = %24, %3
  %31 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr @.str, ptr %31, align 8, !tbaa !5
  store ptr null, ptr %4, align 8
  store i32 1, ptr %18, align 4
  br label %193

32:                                               ; preds = %24
  %33 = load ptr, ptr %17, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.real_pcre8_or_16, ptr %33, i32 0, i32 3
  %35 = load i32, ptr %34, align 4, !tbaa !14
  %36 = and i32 %35, 1
  %37 = icmp eq i32 %36, 0
  br i1 %37, label %38, label %40

38:                                               ; preds = %32
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr @.str.1, ptr %39, align 8, !tbaa !5
  store ptr null, ptr %4, align 8
  store i32 1, ptr %18, align 4
  br label %193

40:                                               ; preds = %32
  %41 = load i32, ptr %6, align 4, !tbaa !9
  %42 = and i32 %41, -16
  %43 = icmp ne i32 %42, 0
  br i1 %43, label %44, label %46

44:                                               ; preds = %40
  %45 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr @.str.2, ptr %45, align 8, !tbaa !5
  store ptr null, ptr %4, align 8
  store i32 1, ptr %18, align 4
  br label %193

46:                                               ; preds = %40
  %47 = load ptr, ptr %17, align 8, !tbaa !5
  %48 = load ptr, ptr %17, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.real_pcre8_or_16, ptr %48, i32 0, i32 11
  %50 = load i16, ptr %49, align 2, !tbaa !15
  %51 = zext i16 %50 to i32
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds i8, ptr %47, i64 %52
  %54 = load ptr, ptr %17, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.real_pcre8_or_16, ptr %54, i32 0, i32 13
  %56 = load i16, ptr %55, align 2, !tbaa !16
  %57 = zext i16 %56 to i32
  %58 = load ptr, ptr %17, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.real_pcre8_or_16, ptr %58, i32 0, i32 12
  %60 = load i16, ptr %59, align 4, !tbaa !17
  %61 = zext i16 %60 to i32
  %62 = mul nsw i32 %57, %61
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds i8, ptr %53, i64 %63
  store ptr %64, ptr %15, align 8, !tbaa !5
  %65 = load ptr, ptr %17, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.real_pcre8_or_16, ptr %65, i32 0, i32 2
  %67 = load i32, ptr %66, align 8, !tbaa !18
  %68 = and i32 %67, 16
  %69 = icmp eq i32 %68, 0
  br i1 %69, label %70, label %119

70:                                               ; preds = %46
  %71 = load ptr, ptr %17, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.real_pcre8_or_16, ptr %71, i32 0, i32 3
  %73 = load i32, ptr %72, align 4, !tbaa !14
  %74 = and i32 %73, 272
  %75 = icmp eq i32 %74, 0
  br i1 %75, label %76, label %119

76:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  %77 = load ptr, ptr %17, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.real_pcre8_or_16, ptr %77, i32 0, i32 18
  %79 = load ptr, ptr %78, align 8, !tbaa !19
  store ptr %79, ptr %14, align 8, !tbaa !5
  %80 = load ptr, ptr %14, align 8, !tbaa !5
  %81 = icmp eq ptr %80, null
  br i1 %81, label %82, label %85

82:                                               ; preds = %76
  %83 = load ptr, ptr %5, align 8, !tbaa !5
  %84 = call i32 @pcre_fullinfo(ptr noundef %83, ptr noundef null, i32 noundef 11, ptr noundef %14)
  br label %85

85:                                               ; preds = %82, %76
  %86 = load ptr, ptr %14, align 8, !tbaa !5
  %87 = getelementptr inbounds i8, ptr %86, i64 0
  %88 = getelementptr inbounds %struct.compile_data, ptr %16, i32 0, i32 0
  store ptr %87, ptr %88, align 8, !tbaa !20
  %89 = load ptr, ptr %14, align 8, !tbaa !5
  %90 = getelementptr inbounds i8, ptr %89, i64 256
  %91 = getelementptr inbounds %struct.compile_data, ptr %16, i32 0, i32 1
  store ptr %90, ptr %91, align 8, !tbaa !22
  %92 = load ptr, ptr %14, align 8, !tbaa !5
  %93 = getelementptr inbounds i8, ptr %92, i64 512
  %94 = getelementptr inbounds %struct.compile_data, ptr %16, i32 0, i32 2
  store ptr %93, ptr %94, align 8, !tbaa !23
  %95 = load ptr, ptr %14, align 8, !tbaa !5
  %96 = getelementptr inbounds i8, ptr %95, i64 832
  %97 = getelementptr inbounds %struct.compile_data, ptr %16, i32 0, i32 3
  store ptr %96, ptr %97, align 8, !tbaa !24
  %98 = getelementptr inbounds [32 x i8], ptr %11, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 16 %98, i8 0, i64 32, i1 false)
  %99 = load ptr, ptr %15, align 8, !tbaa !5
  %100 = getelementptr inbounds [32 x i8], ptr %11, i64 0, i64 0
  %101 = load ptr, ptr %17, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.real_pcre8_or_16, ptr %101, i32 0, i32 2
  %103 = load i32, ptr %102, align 8, !tbaa !18
  %104 = and i32 %103, 2048
  %105 = icmp ne i32 %104, 0
  %106 = zext i1 %105 to i32
  %107 = call i32 @set_start_bits(ptr noundef %99, ptr noundef %100, i32 noundef %106, ptr noundef %16)
  store i32 %107, ptr %19, align 4, !tbaa !9
  %108 = load i32, ptr %19, align 4, !tbaa !9
  %109 = icmp eq i32 %108, 1
  %110 = zext i1 %109 to i32
  store i32 %110, ptr %10, align 4, !tbaa !9
  %111 = load i32, ptr %19, align 4, !tbaa !9
  %112 = icmp eq i32 %111, 3
  br i1 %112, label %113, label %115

113:                                              ; preds = %85
  %114 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr @.str.3, ptr %114, align 8, !tbaa !5
  store ptr null, ptr %4, align 8
  store i32 1, ptr %18, align 4
  br label %116

115:                                              ; preds = %85
  store i32 0, ptr %18, align 4
  br label %116

116:                                              ; preds = %115, %113
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  %117 = load i32, ptr %18, align 4
  switch i32 %117, label %193 [
    i32 0, label %118
  ]

118:                                              ; preds = %116
  br label %119

119:                                              ; preds = %118, %70, %46
  %120 = load ptr, ptr %17, align 8, !tbaa !5
  %121 = load ptr, ptr %15, align 8, !tbaa !5
  %122 = load ptr, ptr %15, align 8, !tbaa !5
  %123 = load ptr, ptr %17, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.real_pcre8_or_16, ptr %123, i32 0, i32 2
  %125 = load i32, ptr %124, align 8, !tbaa !18
  %126 = call i32 @find_minlength(ptr noundef %120, ptr noundef %121, ptr noundef %122, i32 noundef %125, ptr noundef null, ptr noundef %9)
  store i32 %126, ptr %8, align 4, !tbaa !9
  switch i32 %126, label %131 [
    i32 -2, label %127
    i32 -3, label %129
  ]

127:                                              ; preds = %119
  %128 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr @.str.4, ptr %128, align 8, !tbaa !5
  store ptr null, ptr %4, align 8
  store i32 1, ptr %18, align 4
  br label %193

129:                                              ; preds = %119
  %130 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr @.str.3, ptr %130, align 8, !tbaa !5
  store ptr null, ptr %4, align 8
  store i32 1, ptr %18, align 4
  br label %193

131:                                              ; preds = %119
  br label %132

132:                                              ; preds = %131
  %133 = load i32, ptr %10, align 4, !tbaa !9
  %134 = icmp ne i32 %133, 0
  br i1 %134, label %142, label %135

135:                                              ; preds = %132
  %136 = load i32, ptr %8, align 4, !tbaa !9
  %137 = icmp sgt i32 %136, 0
  br i1 %137, label %142, label %138

138:                                              ; preds = %135
  %139 = load i32, ptr %6, align 4, !tbaa !9
  %140 = and i32 %139, 8
  %141 = icmp ne i32 %140, 0
  br i1 %141, label %142, label %191

142:                                              ; preds = %138, %135, %132
  %143 = load ptr, ptr @pcre_malloc, align 8, !tbaa !5
  %144 = call ptr %143(i64 noundef 108)
  store ptr %144, ptr %12, align 8, !tbaa !5
  %145 = load ptr, ptr %12, align 8, !tbaa !5
  %146 = icmp eq ptr %145, null
  br i1 %146, label %147, label %149

147:                                              ; preds = %142
  %148 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr @.str.5, ptr %148, align 8, !tbaa !5
  store ptr null, ptr %4, align 8
  store i32 1, ptr %18, align 4
  br label %193

149:                                              ; preds = %142
  %150 = load ptr, ptr %12, align 8, !tbaa !5
  %151 = getelementptr inbounds i8, ptr %150, i64 64
  store ptr %151, ptr %13, align 8, !tbaa !5
  %152 = load ptr, ptr %12, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.pcre_extra, ptr %152, i32 0, i32 0
  store i64 1, ptr %153, align 8, !tbaa !25
  %154 = load ptr, ptr %13, align 8, !tbaa !5
  %155 = load ptr, ptr %12, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.pcre_extra, ptr %155, i32 0, i32 1
  store ptr %154, ptr %156, align 8, !tbaa !28
  %157 = load ptr, ptr %13, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.pcre_study_data, ptr %157, i32 0, i32 0
  store i32 44, ptr %158, align 4, !tbaa !29
  %159 = load ptr, ptr %13, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.pcre_study_data, ptr %159, i32 0, i32 1
  store i32 0, ptr %160, align 4, !tbaa !31
  %161 = load i32, ptr %10, align 4, !tbaa !9
  %162 = icmp ne i32 %161, 0
  br i1 %162, label %163, label %172

163:                                              ; preds = %149
  %164 = load ptr, ptr %13, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.pcre_study_data, ptr %164, i32 0, i32 1
  %166 = load i32, ptr %165, align 4, !tbaa !31
  %167 = or i32 %166, 1
  store i32 %167, ptr %165, align 4, !tbaa !31
  %168 = load ptr, ptr %13, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.pcre_study_data, ptr %168, i32 0, i32 2
  %170 = getelementptr inbounds [32 x i8], ptr %169, i64 0, i64 0
  %171 = getelementptr inbounds [32 x i8], ptr %11, i64 0, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %170, ptr align 16 %171, i64 32, i1 false)
  br label %176

172:                                              ; preds = %149
  %173 = load ptr, ptr %13, align 8, !tbaa !5
  %174 = getelementptr inbounds %struct.pcre_study_data, ptr %173, i32 0, i32 2
  %175 = getelementptr inbounds [32 x i8], ptr %174, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 4 %175, i8 0, i64 32, i1 false)
  br label %176

176:                                              ; preds = %172, %163
  %177 = load i32, ptr %8, align 4, !tbaa !9
  %178 = icmp sgt i32 %177, 0
  br i1 %178, label %179, label %187

179:                                              ; preds = %176
  %180 = load ptr, ptr %13, align 8, !tbaa !5
  %181 = getelementptr inbounds %struct.pcre_study_data, ptr %180, i32 0, i32 1
  %182 = load i32, ptr %181, align 4, !tbaa !31
  %183 = or i32 %182, 2
  store i32 %183, ptr %181, align 4, !tbaa !31
  %184 = load i32, ptr %8, align 4, !tbaa !9
  %185 = load ptr, ptr %13, align 8, !tbaa !5
  %186 = getelementptr inbounds %struct.pcre_study_data, ptr %185, i32 0, i32 3
  store i32 %184, ptr %186, align 4, !tbaa !32
  br label %190

187:                                              ; preds = %176
  %188 = load ptr, ptr %13, align 8, !tbaa !5
  %189 = getelementptr inbounds %struct.pcre_study_data, ptr %188, i32 0, i32 3
  store i32 0, ptr %189, align 4, !tbaa !32
  br label %190

190:                                              ; preds = %187, %179
  br label %191

191:                                              ; preds = %190, %138
  %192 = load ptr, ptr %12, align 8, !tbaa !5
  store ptr %192, ptr %4, align 8
  store i32 1, ptr %18, align 4
  br label %193

193:                                              ; preds = %191, %147, %129, %127, %116, %44, %38, %30
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 192, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  %194 = load ptr, ptr %4, align 8
  ret ptr %194
}

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

declare i32 @pcre_fullinfo(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"real_pcre8_or_16", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !13, i64 24, !13, i64 26, !13, i64 28, !13, i64 30, !13, i64 32, !13, i64 34, !13, i64 36, !13, i64 38, !13, i64 40, !13, i64 42, !13, i64 44, !13, i64 46, !6, i64 48, !6, i64 56}
!13 = !{!"short", !7, i64 0}
!14 = !{!12, !10, i64 12}
!15 = !{!12, !13, i64 34}
!16 = !{!12, !13, i64 38}
!17 = !{!12, !13, i64 36}
!18 = !{!12, !10, i64 8}
!19 = !{!12, !6, i64 48}
!20 = !{!21, !6, i64 0}
!21 = !{!"compile_data", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !10, i64 96, !10, i64 100, !10, i64 104, !10, i64 108, !10, i64 112, !10, i64 116, !10, i64 120, !10, i64 124, !10, i64 128, !10, i64 132, !10, i64 136, !10, i64 140, !10, i64 144, !10, i64 148, !10, i64 152, !10, i64 156, !10, i64 160, !10, i64 164, !10, i64 168, !10, i64 172, !10, i64 176, !10, i64 180, !10, i64 184, !7, i64 188}
!22 = !{!21, !6, i64 8}
!23 = !{!21, !6, i64 16}
!24 = !{!21, !6, i64 24}
!25 = !{!26, !27, i64 0}
!26 = !{!"pcre_extra", !27, i64 0, !6, i64 8, !27, i64 16, !6, i64 24, !6, i64 32, !27, i64 40, !6, i64 48, !6, i64 56}
!27 = !{!"long", !7, i64 0}
!28 = !{!26, !6, i64 8}
!29 = !{!30, !10, i64 0}
!30 = !{!"pcre_study_data", !10, i64 0, !10, i64 4, !7, i64 8, !10, i64 40}
!31 = !{!30, !10, i64 4}
!32 = !{!30, !10, i64 40}


; 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.compile_data = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [4 x i8] }

@.str = external hidden unnamed_addr constant [46 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [42 x i8], align 1
@pcre_malloc = external local_unnamed_addr global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [21 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local ptr @pcre_study(ptr noundef %0, i32 noundef %1, ptr nocapture noundef writeonly %2) local_unnamed_addr #0 {
  %4 = alloca i32, align 4
  %5 = alloca [32 x i8], align 16
  %6 = alloca ptr, align 8
  %7 = alloca %struct.compile_data, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  call void @llvm.lifetime.start.p0(i64 192, ptr nonnull %7) #5
  store ptr null, ptr %2, align 8, !tbaa !9
  %8 = icmp eq ptr %0, null
  br i1 %8, label %11, label %9

9:                                                ; preds = %3
  %10 = load i32, ptr %0, align 8, !tbaa !11
  %.not = icmp eq i32 %10, 1346589253
  br i1 %.not, label %12, label %11

11:                                               ; preds = %9, %3
  store ptr @.str, ptr %2, align 8, !tbaa !9
  br label %83

12:                                               ; preds = %9
  %13 = getelementptr inbounds i8, ptr %0, i64 12
  %14 = load i32, ptr %13, align 4, !tbaa !14
  %15 = and i32 %14, 1
  %16 = icmp eq i32 %15, 0
  br i1 %16, label %17, label %18

17:                                               ; preds = %12
  store ptr @.str.1, ptr %2, align 8, !tbaa !9
  br label %83

18:                                               ; preds = %12
  %.not56 = icmp ult i32 %1, 16
  br i1 %.not56, label %20, label %19

19:                                               ; preds = %18
  store ptr @.str.2, ptr %2, align 8, !tbaa !9
  br label %83

20:                                               ; preds = %18
  %21 = getelementptr inbounds i8, ptr %0, i64 34
  %22 = load i16, ptr %21, align 2, !tbaa !15
  %23 = zext i16 %22 to i64
  %24 = getelementptr inbounds i8, ptr %0, i64 %23
  %25 = getelementptr inbounds i8, ptr %0, i64 38
  %26 = load i16, ptr %25, align 2, !tbaa !16
  %27 = zext i16 %26 to i64
  %28 = getelementptr inbounds i8, ptr %0, i64 36
  %29 = load i16, ptr %28, align 4, !tbaa !17
  %30 = zext i16 %29 to i64
  %31 = mul nuw nsw i64 %30, %27
  %32 = getelementptr inbounds i8, ptr %24, i64 %31
  %33 = getelementptr inbounds i8, ptr %0, i64 8
  %34 = load i32, ptr %33, align 8, !tbaa !18
  %35 = and i32 %34, 16
  %36 = and i32 %14, 272
  %37 = or i32 %35, %36
  %or.cond60 = icmp eq i32 %37, 0
  br i1 %or.cond60, label %38, label %.critedge

38:                                               ; preds = %20
  %39 = getelementptr inbounds i8, ptr %0, i64 48
  %40 = load ptr, ptr %39, align 8, !tbaa !19
  store ptr %40, ptr %6, align 8, !tbaa !9
  %41 = icmp eq ptr %40, null
  br i1 %41, label %42, label %44

42:                                               ; preds = %38
  %43 = call i32 @pcre_fullinfo(ptr noundef nonnull %0, ptr noundef null, i32 noundef 11, ptr noundef nonnull %6) #5
  %.pre = load ptr, ptr %6, align 8, !tbaa !9
  %.pre62 = load i32, ptr %33, align 8, !tbaa !18
  br label %44

44:                                               ; preds = %42, %38
  %45 = phi i32 [ %.pre62, %42 ], [ %34, %38 ]
  %46 = phi ptr [ %.pre, %42 ], [ %40, %38 ]
  store ptr %46, ptr %7, align 8, !tbaa !20
  %47 = getelementptr inbounds i8, ptr %46, i64 256
  %48 = getelementptr inbounds i8, ptr %7, i64 8
  store ptr %47, ptr %48, align 8, !tbaa !22
  %49 = getelementptr inbounds i8, ptr %46, i64 512
  %50 = getelementptr inbounds i8, ptr %7, i64 16
  store ptr %49, ptr %50, align 8, !tbaa !23
  %51 = getelementptr inbounds i8, ptr %46, i64 832
  %52 = getelementptr inbounds i8, ptr %7, i64 24
  store ptr %51, ptr %52, align 8, !tbaa !24
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %5, i8 0, i64 32, i1 false)
  %53 = lshr i32 %45, 11
  %.lobit = and i32 %53, 1
  %54 = call i32 @set_start_bits(ptr noundef nonnull %32, ptr noundef nonnull %5, i32 noundef %.lobit, ptr noundef nonnull %7)
  %.not57 = icmp eq i32 %54, 3
  br i1 %.not57, label %56, label %..critedge_crit_edge

..critedge_crit_edge:                             ; preds = %44
  %55 = icmp eq i32 %54, 1
  %.pre63 = load i32, ptr %33, align 8, !tbaa !18
  br label %.critedge

56:                                               ; preds = %44
  store ptr @.str.3, ptr %2, align 8, !tbaa !9
  br label %83

.critedge:                                        ; preds = %..critedge_crit_edge, %20
  %57 = phi i32 [ %34, %20 ], [ %.pre63, %..critedge_crit_edge ]
  %.052 = phi i1 [ false, %20 ], [ %55, %..critedge_crit_edge ]
  %58 = call i32 @find_minlength(ptr noundef nonnull %0, ptr noundef nonnull %32, ptr noundef nonnull %32, i32 noundef %57, ptr noundef null, ptr noundef nonnull %4)
  switch i32 %58, label %61 [
    i32 -2, label %59
    i32 -3, label %60
  ]

59:                                               ; preds = %.critedge
  store ptr @.str.4, ptr %2, align 8, !tbaa !9
  br label %83

60:                                               ; preds = %.critedge
  store ptr @.str.3, ptr %2, align 8, !tbaa !9
  br label %83

61:                                               ; preds = %.critedge
  %62 = icmp sgt i32 %58, 0
  %.not58 = icmp ugt i32 %1, 7
  %63 = or i1 %.not58, %62
  %or.cond61.not = or i1 %.052, %63
  br i1 %or.cond61.not, label %64, label %83

64:                                               ; preds = %61
  %65 = load ptr, ptr @pcre_malloc, align 8, !tbaa !9
  %66 = call ptr %65(i64 noundef 108) #5
  %67 = icmp eq ptr %66, null
  br i1 %67, label %68, label %69

68:                                               ; preds = %64
  store ptr @.str.5, ptr %2, align 8, !tbaa !9
  br label %83

69:                                               ; preds = %64
  %70 = getelementptr inbounds i8, ptr %66, i64 64
  store i64 1, ptr %66, align 8, !tbaa !25
  %71 = getelementptr inbounds i8, ptr %66, i64 8
  store ptr %70, ptr %71, align 8, !tbaa !28
  store i32 44, ptr %70, align 4, !tbaa !29
  %72 = getelementptr inbounds i8, ptr %66, i64 68
  store i32 0, ptr %72, align 4, !tbaa !31
  br i1 %.052, label %73, label %75

73:                                               ; preds = %69
  store i32 1, ptr %72, align 4, !tbaa !31
  %74 = getelementptr inbounds i8, ptr %66, i64 72
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(32) %74, ptr noundef nonnull align 16 dereferenceable(32) %5, i64 32, i1 false)
  br label %77

75:                                               ; preds = %69
  %76 = getelementptr inbounds i8, ptr %66, i64 72
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(32) %76, i8 0, i64 32, i1 false)
  br label %77

77:                                               ; preds = %75, %73
  %78 = phi i32 [ 2, %75 ], [ 3, %73 ]
  br i1 %62, label %79, label %81

79:                                               ; preds = %77
  store i32 %78, ptr %72, align 4, !tbaa !31
  %80 = getelementptr inbounds i8, ptr %66, i64 104
  store i32 %58, ptr %80, align 4, !tbaa !32
  br label %83

81:                                               ; preds = %77
  %82 = getelementptr inbounds i8, ptr %66, i64 104
  store i32 0, ptr %82, align 4, !tbaa !32
  br label %83

83:                                               ; preds = %56, %81, %79, %61, %68, %60, %59, %19, %17, %11
  %.1 = phi ptr [ null, %11 ], [ null, %17 ], [ null, %19 ], [ null, %68 ], [ null, %60 ], [ null, %59 ], [ null, %56 ], [ %66, %79 ], [ %66, %81 ], [ null, %61 ]
  call void @llvm.lifetime.end.p0(i64 192, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  ret ptr %.1
}

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

declare i32 @pcre_fullinfo(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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

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

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"real_pcre8_or_16", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !13, i64 24, !13, i64 26, !13, i64 28, !13, i64 30, !13, i64 32, !13, i64 34, !13, i64 36, !13, i64 38, !13, i64 40, !13, i64 42, !13, i64 44, !13, i64 46, !10, i64 48, !10, i64 56}
!13 = !{!"short", !7, i64 0}
!14 = !{!12, !6, i64 12}
!15 = !{!12, !13, i64 34}
!16 = !{!12, !13, i64 38}
!17 = !{!12, !13, i64 36}
!18 = !{!12, !6, i64 8}
!19 = !{!12, !10, i64 48}
!20 = !{!21, !10, i64 0}
!21 = !{!"compile_data", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !6, i64 96, !6, i64 100, !6, i64 104, !6, i64 108, !6, i64 112, !6, i64 116, !6, i64 120, !6, i64 124, !6, i64 128, !6, i64 132, !6, i64 136, !6, i64 140, !6, i64 144, !6, i64 148, !6, i64 152, !6, i64 156, !6, i64 160, !6, i64 164, !6, i64 168, !6, i64 172, !6, i64 176, !6, i64 180, !6, i64 184, !7, i64 188}
!22 = !{!21, !10, i64 8}
!23 = !{!21, !10, i64 16}
!24 = !{!21, !10, i64 24}
!25 = !{!26, !27, i64 0}
!26 = !{!"pcre_extra", !27, i64 0, !10, i64 8, !27, i64 16, !10, i64 24, !10, i64 32, !27, i64 40, !10, i64 48, !10, i64 56}
!27 = !{!"long", !7, i64 0}
!28 = !{!26, !10, i64 8}
!29 = !{!30, !6, i64 0}
!30 = !{!"pcre_study_data", !6, i64 0, !6, i64 4, !7, i64 8, !6, i64 40}
!31 = !{!30, !6, i64 4}
!32 = !{!30, !6, i64 40}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass