; LLVM IR from davidesantangelo/krep :: test (test_regex)

; 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.re_pattern_buffer = type { ptr, i64, i64, i64, ptr, ptr, i64, i8 }
%struct.search_params = type { ptr, i64, ptr, ptr, i64, i8, i8, i8, i8, i8, i8, ptr, ptr, i64 }

@tests_passed = external global i32, align 4
@.str.4 = external hidden unnamed_addr constant [8 x i8], align 1
@tests_failed = external global i32, align 4
@.str.6 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [73 x i8], align 1
@.str.63 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.64 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.65 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.66 = external hidden unnamed_addr constant [72 x i8], align 1
@.str.67 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.68 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.69 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.70 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.71 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.72 = external hidden unnamed_addr constant [67 x i8], align 1
@.str.73 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.74 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.75 = external hidden unnamed_addr constant [67 x i8], align 1

declare i32 @printf(ptr noundef, ...) #0

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

; Function Attrs: nounwind uwtable
declare hidden void @create_regex(ptr dead_on_unwind noalias writable sret(%struct.re_pattern_buffer) align 8, ptr noundef, i1 noundef zeroext) #2

declare void @regfree(ptr noundef) #0

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

declare i64 @regex_search(ptr noundef, ptr noundef, i64 noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local void @test_regex_vs_literal_performance() #2 {
  %1 = alloca i64, align 8
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca %struct.search_params, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca double, align 8
  %13 = alloca %struct.re_pattern_buffer, align 8
  %14 = alloca i64, align 8
  %15 = alloca %struct.search_params, align 8
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca double, align 8
  %19 = call i32 (ptr, ...) @printf(ptr noundef @.str.63)
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #5
  store i64 102400, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #5
  %20 = call noalias ptr @malloc(i64 noundef 102401) #6
  store ptr %20, ptr %2, align 8, !tbaa !9
  %21 = load ptr, ptr %2, align 8, !tbaa !9
  %22 = icmp ne ptr %21, null
  br i1 %22, label %24, label %23

23:                                               ; preds = %0
  call void @perror(ptr noundef @.str.64)
  store i32 1, ptr %3, align 4
  br label %181

24:                                               ; preds = %0
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  store i64 0, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  store i64 0, ptr %5, align 8, !tbaa !5
  br label %25

25:                                               ; preds = %47, %24
  %26 = load i64, ptr %5, align 8, !tbaa !5
  %27 = icmp ult i64 %26, 102400
  br i1 %27, label %29, label %28

28:                                               ; preds = %25
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  br label %50

29:                                               ; preds = %25
  %30 = load i64, ptr %5, align 8, !tbaa !5
  %31 = icmp ugt i64 %30, 0
  br i1 %31, label %32, label %42

32:                                               ; preds = %29
  %33 = load i64, ptr %5, align 8, !tbaa !5
  %34 = urem i64 %33, 1000
  %35 = icmp eq i64 %34, 0
  br i1 %35, label %36, label %42

36:                                               ; preds = %32
  %37 = load ptr, ptr %2, align 8, !tbaa !9
  %38 = load i64, ptr %5, align 8, !tbaa !5
  %39 = getelementptr inbounds i8, ptr %37, i64 %38
  store i8 98, ptr %39, align 1, !tbaa !11
  %40 = load i64, ptr %4, align 8, !tbaa !5
  %41 = add i64 %40, 1
  store i64 %41, ptr %4, align 8, !tbaa !5
  br label %46

42:                                               ; preds = %32, %29
  %43 = load ptr, ptr %2, align 8, !tbaa !9
  %44 = load i64, ptr %5, align 8, !tbaa !5
  %45 = getelementptr inbounds i8, ptr %43, i64 %44
  store i8 97, ptr %45, align 1, !tbaa !11
  br label %46

46:                                               ; preds = %42, %36
  br label %47

47:                                               ; preds = %46
  %48 = load i64, ptr %5, align 8, !tbaa !5
  %49 = add i64 %48, 1
  store i64 %49, ptr %5, align 8, !tbaa !5
  br label %25, !llvm.loop !12

50:                                               ; preds = %28
  %51 = load ptr, ptr %2, align 8, !tbaa !9
  %52 = getelementptr inbounds i8, ptr %51, i64 0
  store i8 98, ptr %52, align 1, !tbaa !11
  %53 = load i64, ptr %4, align 8, !tbaa !5
  %54 = add i64 %53, 1
  store i64 %54, ptr %4, align 8, !tbaa !5
  %55 = load ptr, ptr %2, align 8, !tbaa !9
  %56 = getelementptr inbounds i8, ptr %55, i64 102400
  store i8 0, ptr %56, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  store ptr @.str.65, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  store i64 1, ptr %7, align 8, !tbaa !5
  %57 = load ptr, ptr %6, align 8, !tbaa !9
  %58 = call i32 (ptr, ...) @printf(ptr noundef @.str.66, i64 noundef 100, ptr noundef %57)
  %59 = load i64, ptr %4, align 8, !tbaa !5
  %60 = call i32 (ptr, ...) @printf(ptr noundef @.str.67, i64 noundef %59)
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %61 = call i64 @clock() #5
  store i64 %61, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 72, ptr %9) #5
  %62 = getelementptr inbounds %struct.search_params, ptr %9, i32 0, i32 0
  %63 = load ptr, ptr %6, align 8, !tbaa !9
  store ptr %63, ptr %62, align 8, !tbaa !14
  %64 = getelementptr inbounds %struct.search_params, ptr %9, i32 0, i32 1
  %65 = load i64, ptr %7, align 8, !tbaa !5
  store i64 %65, ptr %64, align 8, !tbaa !17
  %66 = getelementptr inbounds %struct.search_params, ptr %9, i32 0, i32 2
  store ptr %6, ptr %66, align 8, !tbaa !18
  %67 = getelementptr inbounds %struct.search_params, ptr %9, i32 0, i32 3
  store ptr %7, ptr %67, align 8, !tbaa !19
  %68 = getelementptr inbounds %struct.search_params, ptr %9, i32 0, i32 4
  store i64 1, ptr %68, align 8, !tbaa !20
  %69 = getelementptr inbounds %struct.search_params, ptr %9, i32 0, i32 5
  store i8 1, ptr %69, align 8, !tbaa !21
  %70 = getelementptr inbounds %struct.search_params, ptr %9, i32 0, i32 6
  store i8 0, ptr %70, align 1, !tbaa !22
  %71 = getelementptr inbounds %struct.search_params, ptr %9, i32 0, i32 7
  store i8 0, ptr %71, align 2, !tbaa !23
  %72 = getelementptr inbounds %struct.search_params, ptr %9, i32 0, i32 8
  store i8 1, ptr %72, align 1, !tbaa !24
  %73 = getelementptr inbounds %struct.search_params, ptr %9, i32 0, i32 9
  store i8 0, ptr %73, align 4, !tbaa !25
  %74 = getelementptr inbounds %struct.search_params, ptr %9, i32 0, i32 10
  store i8 0, ptr %74, align 1, !tbaa !26
  %75 = getelementptr inbounds %struct.search_params, ptr %9, i32 0, i32 11
  store ptr null, ptr %75, align 8, !tbaa !27
  %76 = getelementptr inbounds %struct.search_params, ptr %9, i32 0, i32 12
  store ptr null, ptr %76, align 8, !tbaa !28
  %77 = getelementptr inbounds %struct.search_params, ptr %9, i32 0, i32 13
  store i64 -1, ptr %77, align 8, !tbaa !29
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %78 = load ptr, ptr %2, align 8, !tbaa !9
  %79 = call i64 @boyer_moore_search(ptr noundef %9, ptr noundef %78, i64 noundef 102400, ptr noundef null)
  store i64 %79, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %80 = call i64 @clock() #5
  store i64 %80, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %81 = load i64, ptr %11, align 8, !tbaa !5
  %82 = load i64, ptr %8, align 8, !tbaa !5
  %83 = sub nsw i64 %81, %82
  %84 = sitofp i64 %83 to double
  %85 = fdiv double %84, 1.000000e+06
  store double %85, ptr %12, align 8, !tbaa !30
  br label %86

86:                                               ; preds = %50
  %87 = load i64, ptr %10, align 8, !tbaa !5
  %88 = load i64, ptr %4, align 8, !tbaa !5
  %89 = icmp eq i64 %87, %88
  br i1 %89, label %90, label %94

90:                                               ; preds = %86
  %91 = load i32, ptr @tests_passed, align 4, !tbaa !32
  %92 = add nsw i32 %91, 1
  store i32 %92, ptr @tests_passed, align 4, !tbaa !32
  %93 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, ptr noundef @.str.68)
  br label %99

94:                                               ; preds = %86
  %95 = load i32, ptr @tests_failed, align 4, !tbaa !32
  %96 = add nsw i32 %95, 1
  store i32 %96, ptr @tests_failed, align 4, !tbaa !32
  %97 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, ptr noundef @.str.68)
  %98 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, ptr noundef @.str.8, i32 noundef 398)
  br label %99

99:                                               ; preds = %94, %90
  br label %100

100:                                              ; preds = %99
  br label %101

101:                                              ; preds = %100
  call void @llvm.lifetime.start.p0(i64 64, ptr %13) #5
  %102 = load ptr, ptr %6, align 8, !tbaa !9
  call void @create_regex(ptr dead_on_unwind writable sret(%struct.re_pattern_buffer) align 8 %13, ptr noundef %102, i1 noundef zeroext true)
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %103 = call i64 @clock() #5
  store i64 %103, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 72, ptr %15) #5
  %104 = getelementptr inbounds %struct.search_params, ptr %15, i32 0, i32 0
  %105 = load ptr, ptr %6, align 8, !tbaa !9
  store ptr %105, ptr %104, align 8, !tbaa !14
  %106 = getelementptr inbounds %struct.search_params, ptr %15, i32 0, i32 1
  %107 = load i64, ptr %7, align 8, !tbaa !5
  store i64 %107, ptr %106, align 8, !tbaa !17
  %108 = getelementptr inbounds %struct.search_params, ptr %15, i32 0, i32 2
  store ptr %6, ptr %108, align 8, !tbaa !18
  %109 = getelementptr inbounds %struct.search_params, ptr %15, i32 0, i32 3
  store ptr %7, ptr %109, align 8, !tbaa !19
  %110 = getelementptr inbounds %struct.search_params, ptr %15, i32 0, i32 4
  store i64 1, ptr %110, align 8, !tbaa !20
  %111 = getelementptr inbounds %struct.search_params, ptr %15, i32 0, i32 5
  store i8 1, ptr %111, align 8, !tbaa !21
  %112 = getelementptr inbounds %struct.search_params, ptr %15, i32 0, i32 6
  store i8 1, ptr %112, align 1, !tbaa !22
  %113 = getelementptr inbounds %struct.search_params, ptr %15, i32 0, i32 7
  store i8 0, ptr %113, align 2, !tbaa !23
  %114 = getelementptr inbounds %struct.search_params, ptr %15, i32 0, i32 8
  store i8 1, ptr %114, align 1, !tbaa !24
  %115 = getelementptr inbounds %struct.search_params, ptr %15, i32 0, i32 9
  store i8 0, ptr %115, align 4, !tbaa !25
  %116 = getelementptr inbounds %struct.search_params, ptr %15, i32 0, i32 10
  store i8 0, ptr %116, align 1, !tbaa !26
  %117 = getelementptr inbounds %struct.search_params, ptr %15, i32 0, i32 11
  store ptr %13, ptr %117, align 8, !tbaa !27
  %118 = getelementptr inbounds %struct.search_params, ptr %15, i32 0, i32 12
  store ptr null, ptr %118, align 8, !tbaa !28
  %119 = getelementptr inbounds %struct.search_params, ptr %15, i32 0, i32 13
  store i64 -1, ptr %119, align 8, !tbaa !29
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %120 = load ptr, ptr %2, align 8, !tbaa !9
  %121 = call i64 @regex_search(ptr noundef %15, ptr noundef %120, i64 noundef 102400, ptr noundef null)
  store i64 %121, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %122 = call i64 @clock() #5
  store i64 %122, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  %123 = load i64, ptr %17, align 8, !tbaa !5
  %124 = load i64, ptr %14, align 8, !tbaa !5
  %125 = sub nsw i64 %123, %124
  %126 = sitofp i64 %125 to double
  %127 = fdiv double %126, 1.000000e+06
  store double %127, ptr %18, align 8, !tbaa !30
  br label %128

128:                                              ; preds = %101
  %129 = load i64, ptr %16, align 8, !tbaa !5
  %130 = load i64, ptr %4, align 8, !tbaa !5
  %131 = icmp eq i64 %129, %130
  br i1 %131, label %132, label %136

132:                                              ; preds = %128
  %133 = load i32, ptr @tests_passed, align 4, !tbaa !32
  %134 = add nsw i32 %133, 1
  store i32 %134, ptr @tests_passed, align 4, !tbaa !32
  %135 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, ptr noundef @.str.69)
  br label %141

136:                                              ; preds = %128
  %137 = load i32, ptr @tests_failed, align 4, !tbaa !32
  %138 = add nsw i32 %137, 1
  store i32 %138, ptr @tests_failed, align 4, !tbaa !32
  %139 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, ptr noundef @.str.69)
  %140 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, ptr noundef @.str.8, i32 noundef 422)
  br label %141

141:                                              ; preds = %136, %132
  br label %142

142:                                              ; preds = %141
  br label %143

143:                                              ; preds = %142
  %144 = load i64, ptr %10, align 8, !tbaa !5
  %145 = load double, ptr %12, align 8, !tbaa !30
  %146 = call i32 (ptr, ...) @printf(ptr noundef @.str.70, i64 noundef %144, double noundef %145)
  %147 = load i64, ptr %16, align 8, !tbaa !5
  %148 = load double, ptr %18, align 8, !tbaa !30
  %149 = call i32 (ptr, ...) @printf(ptr noundef @.str.71, i64 noundef %147, double noundef %148)
  %150 = load double, ptr %12, align 8, !tbaa !30
  %151 = fcmp ogt double %150, 1.000000e-09
  br i1 %151, label %152, label %160

152:                                              ; preds = %143
  %153 = load double, ptr %18, align 8, !tbaa !30
  %154 = fcmp oge double %153, 0.000000e+00
  br i1 %154, label %155, label %160

155:                                              ; preds = %152
  %156 = load double, ptr %18, align 8, !tbaa !30
  %157 = load double, ptr %12, align 8, !tbaa !30
  %158 = fdiv double %156, %157
  %159 = call i32 (ptr, ...) @printf(ptr noundef @.str.72, double noundef %158)
  br label %179

160:                                              ; preds = %152, %143
  %161 = load double, ptr %18, align 8, !tbaa !30
  %162 = fcmp olt double %161, 1.000000e-09
  br i1 %162, label %163, label %168

163:                                              ; preds = %160
  %164 = load double, ptr %12, align 8, !tbaa !30
  %165 = fcmp olt double %164, 1.000000e-09
  br i1 %165, label %166, label %168

166:                                              ; preds = %163
  %167 = call i32 (ptr, ...) @printf(ptr noundef @.str.73)
  br label %178

168:                                              ; preds = %163, %160
  %169 = load double, ptr %12, align 8, !tbaa !30
  %170 = fcmp olt double %169, 1.000000e-09
  br i1 %170, label %171, label %173

171:                                              ; preds = %168
  %172 = call i32 (ptr, ...) @printf(ptr noundef @.str.74)
  br label %177

173:                                              ; preds = %168
  %174 = load double, ptr %18, align 8, !tbaa !30
  %175 = load double, ptr %12, align 8, !tbaa !30
  %176 = call i32 (ptr, ...) @printf(ptr noundef @.str.75, double noundef %174, double noundef %175)
  br label %177

177:                                              ; preds = %173, %171
  br label %178

178:                                              ; preds = %177, %166
  br label %179

179:                                              ; preds = %178, %155
  call void @regfree(ptr noundef %13)
  %180 = load ptr, ptr %2, align 8, !tbaa !9
  call void @free(ptr noundef %180) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 72, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 64, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 72, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  store i32 0, ptr %3, align 4
  br label %181

181:                                              ; preds = %179, %23
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #5
  %182 = load i32, ptr %3, align 4
  switch i32 %182, label %184 [
    i32 0, label %183
    i32 1, label %183
  ]

183:                                              ; preds = %181, %181
  ret void

184:                                              ; preds = %181
  unreachable
}

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #3

declare void @perror(ptr noundef) #0

; Function Attrs: nounwind
declare i64 @clock() #4

declare i64 @boyer_moore_search(ptr noundef, ptr noundef, i64 noundef, ptr noundef) #0

; Function Attrs: nounwind
declare void @free(ptr noundef) #4

attributes #0 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
attributes #6 = { nounwind allocsize(0) }

!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 = !{!"long", !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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!15, !10, i64 0}
!15 = !{!"search_params", !10, i64 0, !6, i64 8, !10, i64 16, !10, i64 24, !6, i64 32, !16, i64 40, !16, i64 41, !16, i64 42, !16, i64 43, !16, i64 44, !16, i64 45, !10, i64 48, !10, i64 56, !6, i64 64}
!16 = !{!"_Bool", !7, i64 0}
!17 = !{!15, !6, i64 8}
!18 = !{!15, !10, i64 16}
!19 = !{!15, !10, i64 24}
!20 = !{!15, !6, i64 32}
!21 = !{!15, !16, i64 40}
!22 = !{!15, !16, i64 41}
!23 = !{!15, !16, i64 42}
!24 = !{!15, !16, i64 43}
!25 = !{!15, !16, i64 44}
!26 = !{!15, !16, i64 45}
!27 = !{!15, !10, i64 48}
!28 = !{!15, !10, i64 56}
!29 = !{!15, !6, i64 64}
!30 = !{!31, !31, i64 0}
!31 = !{!"double", !7, i64 0}
!32 = !{!33, !33, i64 0}
!33 = !{!"int", !7, i64 0}


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

%struct.re_pattern_buffer = type { ptr, i64, i64, i64, ptr, ptr, i64, i8 }
%struct.search_params = type { ptr, i64, ptr, ptr, i64, i8, i8, i8, i8, i8, i8, ptr, ptr, i64 }

@tests_passed = external local_unnamed_addr global i32, align 4
@.str.4 = external hidden unnamed_addr constant [8 x i8], align 1
@tests_failed = external local_unnamed_addr global i32, align 4
@.str.6 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [73 x i8], align 1
@.str.63 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.64 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.65 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.66 = external hidden unnamed_addr constant [72 x i8], align 1
@.str.67 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.68 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.69 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.70 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.71 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.72 = external hidden unnamed_addr constant [67 x i8], align 1
@.str.73 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.74 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.75 = external hidden unnamed_addr constant [67 x i8], align 1

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

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

; Function Attrs: nounwind uwtable
declare hidden void @create_regex(ptr dead_on_unwind noalias writable sret(%struct.re_pattern_buffer) align 8, ptr noundef, i1 noundef zeroext) local_unnamed_addr #2

declare void @regfree(ptr noundef) local_unnamed_addr #3

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

declare i64 @regex_search(ptr noundef, ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local void @test_regex_vs_literal_performance() local_unnamed_addr #2 {
  %1 = alloca ptr, align 8
  %2 = alloca i64, align 8
  %3 = alloca %struct.search_params, align 8
  %4 = alloca %struct.re_pattern_buffer, align 8
  %5 = alloca %struct.search_params, align 8
  %6 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.63)
  %7 = tail call noalias dereferenceable_or_null(102401) ptr @malloc(i64 noundef 102401) #9
  %.not = icmp eq ptr %7, null
  br i1 %.not, label %21, label %vector.body

vector.body:                                      ; preds = %0, %vector.body
  %index = phi i64 [ %index.next, %vector.body ], [ 0, %0 ]
  %vec.phi = phi <2 x i64> [ %16, %vector.body ], [ zeroinitializer, %0 ]
  %vec.phi53 = phi <2 x i64> [ %17, %vector.body ], [ zeroinitializer, %0 ]
  %vec.ind = phi <2 x i32> [ %vec.ind.next, %vector.body ], [ <i32 1, i32 2>, %0 ]
  %step.add = add <2 x i32> %vec.ind, <i32 2, i32 2>
  %offset.idx = or disjoint i64 %index, 1
  %8 = urem <2 x i32> %vec.ind, <i32 1000, i32 1000>
  %9 = urem <2 x i32> %step.add, <i32 1000, i32 1000>
  %10 = icmp eq <2 x i32> %8, zeroinitializer
  %11 = icmp eq <2 x i32> %9, zeroinitializer
  %12 = select <2 x i1> %10, <2 x i8> <i8 98, i8 98>, <2 x i8> <i8 97, i8 97>
  %13 = select <2 x i1> %11, <2 x i8> <i8 98, i8 98>, <2 x i8> <i8 97, i8 97>
  %14 = zext <2 x i1> %10 to <2 x i64>
  %15 = zext <2 x i1> %11 to <2 x i64>
  %16 = add <2 x i64> %vec.phi, %14
  %17 = add <2 x i64> %vec.phi53, %15
  %18 = getelementptr inbounds i8, ptr %7, i64 %offset.idx
  %19 = getelementptr inbounds i8, ptr %18, i64 2
  store <2 x i8> %12, ptr %18, align 1
  store <2 x i8> %13, ptr %19, align 1
  %index.next = add nuw i64 %index, 4
  %vec.ind.next = add <2 x i32> %vec.ind, <i32 4, i32 4>
  %20 = icmp eq i64 %index.next, 102396
  br i1 %20, label %.preheader, label %vector.body, !llvm.loop !5

21:                                               ; preds = %0
  tail call void @perror(ptr noundef nonnull @.str.64) #10
  br label %104

.preheader:                                       ; preds = %vector.body
  %bin.rdx = add <2 x i64> %17, %16
  %22 = tail call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
  %23 = getelementptr inbounds i8, ptr %7, i64 102397
  store i8 97, ptr %23, align 1
  %24 = getelementptr inbounds i8, ptr %7, i64 102398
  store i8 97, ptr %24, align 1
  %25 = getelementptr inbounds i8, ptr %7, i64 102399
  store i8 97, ptr %25, align 1
  %26 = add i64 %22, 1
  store i8 98, ptr %7, align 1, !tbaa !10
  %27 = getelementptr inbounds i8, ptr %7, i64 102400
  store i8 0, ptr %27, align 1, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #11
  store ptr @.str.65, ptr %1, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #11
  store i64 1, ptr %2, align 8, !tbaa !15
  %28 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.66, i64 noundef 100, ptr noundef nonnull @.str.65)
  %29 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.67, i64 noundef %26)
  %30 = tail call i64 @clock() #11
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %3) #11
  store ptr @.str.65, ptr %3, align 8, !tbaa !17
  %31 = getelementptr inbounds i8, ptr %3, i64 8
  store i64 1, ptr %31, align 8, !tbaa !20
  %32 = getelementptr inbounds i8, ptr %3, i64 16
  store ptr %1, ptr %32, align 8, !tbaa !21
  %33 = getelementptr inbounds i8, ptr %3, i64 24
  store ptr %2, ptr %33, align 8, !tbaa !22
  %34 = getelementptr inbounds i8, ptr %3, i64 32
  store i64 1, ptr %34, align 8, !tbaa !23
  %35 = getelementptr inbounds i8, ptr %3, i64 40
  store <4 x i8> <i8 1, i8 0, i8 0, i8 1>, ptr %35, align 8, !tbaa !24
  %36 = getelementptr inbounds i8, ptr %3, i64 44
  store i8 0, ptr %36, align 4, !tbaa !25
  %37 = getelementptr inbounds i8, ptr %3, i64 45
  store i8 0, ptr %37, align 1, !tbaa !26
  %38 = getelementptr inbounds i8, ptr %3, i64 48
  %39 = getelementptr inbounds i8, ptr %3, i64 64
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %38, i8 0, i64 16, i1 false)
  store i64 -1, ptr %39, align 8, !tbaa !27
  %40 = call i64 @boyer_moore_search(ptr noundef nonnull %3, ptr noundef nonnull %7, i64 noundef 102400, ptr noundef null) #11
  %41 = call i64 @clock() #11
  %42 = sub nsw i64 %41, %30
  %43 = sitofp i64 %42 to double
  %44 = fdiv double %43, 1.000000e+06
  %45 = icmp eq i64 %40, %26
  br i1 %45, label %46, label %50

46:                                               ; preds = %.preheader
  %47 = load i32, ptr @tests_passed, align 4, !tbaa !28
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr @tests_passed, align 4, !tbaa !28
  %49 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, ptr noundef nonnull @.str.68)
  br label %55

50:                                               ; preds = %.preheader
  %51 = load i32, ptr @tests_failed, align 4, !tbaa !28
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr @tests_failed, align 4, !tbaa !28
  %53 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, ptr noundef nonnull @.str.68)
  %54 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, ptr noundef nonnull @.str.8, i32 noundef 398)
  br label %55

55:                                               ; preds = %50, %46
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %4) #11
  %56 = load ptr, ptr %1, align 8, !tbaa !13
  call void @create_regex(ptr dead_on_unwind nonnull writable sret(%struct.re_pattern_buffer) align 8 %4, ptr noundef %56, i1 noundef zeroext true)
  %57 = call i64 @clock() #11
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %5) #11
  %58 = load ptr, ptr %1, align 8, !tbaa !13
  store ptr %58, ptr %5, align 8, !tbaa !17
  %59 = getelementptr inbounds i8, ptr %5, i64 8
  %60 = load i64, ptr %2, align 8, !tbaa !15
  store i64 %60, ptr %59, align 8, !tbaa !20
  %61 = getelementptr inbounds i8, ptr %5, i64 16
  store ptr %1, ptr %61, align 8, !tbaa !21
  %62 = getelementptr inbounds i8, ptr %5, i64 24
  store ptr %2, ptr %62, align 8, !tbaa !22
  %63 = getelementptr inbounds i8, ptr %5, i64 32
  store i64 1, ptr %63, align 8, !tbaa !23
  %64 = getelementptr inbounds i8, ptr %5, i64 40
  store <4 x i8> <i8 1, i8 1, i8 0, i8 1>, ptr %64, align 8, !tbaa !24
  %65 = getelementptr inbounds i8, ptr %5, i64 44
  store i8 0, ptr %65, align 4, !tbaa !25
  %66 = getelementptr inbounds i8, ptr %5, i64 45
  store i8 0, ptr %66, align 1, !tbaa !26
  %67 = getelementptr inbounds i8, ptr %5, i64 48
  store ptr %4, ptr %67, align 8, !tbaa !30
  %68 = getelementptr inbounds i8, ptr %5, i64 56
  store ptr null, ptr %68, align 8, !tbaa !31
  %69 = getelementptr inbounds i8, ptr %5, i64 64
  store i64 -1, ptr %69, align 8, !tbaa !27
  %70 = call i64 @regex_search(ptr noundef nonnull %5, ptr noundef nonnull %7, i64 noundef 102400, ptr noundef null) #11
  %71 = call i64 @clock() #11
  %72 = sub nsw i64 %71, %57
  %73 = sitofp i64 %72 to double
  %74 = fdiv double %73, 1.000000e+06
  %75 = icmp eq i64 %70, %26
  br i1 %75, label %76, label %80

76:                                               ; preds = %55
  %77 = load i32, ptr @tests_passed, align 4, !tbaa !28
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr @tests_passed, align 4, !tbaa !28
  %79 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, ptr noundef nonnull @.str.69)
  br label %85

80:                                               ; preds = %55
  %81 = load i32, ptr @tests_failed, align 4, !tbaa !28
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr @tests_failed, align 4, !tbaa !28
  %83 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, ptr noundef nonnull @.str.69)
  %84 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, ptr noundef nonnull @.str.8, i32 noundef 422)
  br label %85

85:                                               ; preds = %80, %76
  %86 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.70, i64 noundef %40, double noundef %44)
  %87 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.71, i64 noundef %70, double noundef %74)
  %88 = fcmp ogt double %44, 1.000000e-09
  %89 = fcmp oge double %74, 0.000000e+00
  %or.cond = select i1 %88, i1 %89, i1 false
  br i1 %or.cond, label %90, label %93

90:                                               ; preds = %85
  %91 = fdiv double %74, %44
  %92 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.72, double noundef %91)
  br label %103

93:                                               ; preds = %85
  %94 = fcmp olt double %74, 1.000000e-09
  %95 = fcmp olt double %44, 1.000000e-09
  %or.cond3 = select i1 %94, i1 %95, i1 false
  br i1 %or.cond3, label %96, label %98

96:                                               ; preds = %93
  %97 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.73)
  br label %103

98:                                               ; preds = %93
  br i1 %95, label %99, label %101

99:                                               ; preds = %98
  %100 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.74)
  br label %103

101:                                              ; preds = %98
  %102 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.75, double noundef %74, double noundef %44)
  br label %103

103:                                              ; preds = %96, %101, %99, %90
  call void @regfree(ptr noundef nonnull %4) #11
  call void @free(ptr noundef nonnull %7) #11
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %5) #11
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %4) #11
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %3) #11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #11
  br label %104

104:                                              ; preds = %103, %21
  ret void
}

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4

; Function Attrs: nofree nounwind
declare void @perror(ptr nocapture noundef readonly) local_unnamed_addr #0

; Function Attrs: nounwind
declare i64 @clock() local_unnamed_addr #5

declare i64 @boyer_moore_search(ptr noundef, ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #6

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #8

attributes #0 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { 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 #6 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #9 = { nounwind allocsize(0) }
attributes #10 = { cold }
attributes #11 = { 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 = distinct !{!5, !6, !7, !8, !9}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!"llvm.loop.peeled.count", i32 1}
!8 = !{!"llvm.loop.isvectorized", i32 1}
!9 = !{!"llvm.loop.unroll.runtime.disable"}
!10 = !{!11, !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C/C++ TBAA"}
!13 = !{!14, !14, i64 0}
!14 = !{!"any pointer", !11, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"long", !11, i64 0}
!17 = !{!18, !14, i64 0}
!18 = !{!"search_params", !14, i64 0, !16, i64 8, !14, i64 16, !14, i64 24, !16, i64 32, !19, i64 40, !19, i64 41, !19, i64 42, !19, i64 43, !19, i64 44, !19, i64 45, !14, i64 48, !14, i64 56, !16, i64 64}
!19 = !{!"_Bool", !11, i64 0}
!20 = !{!18, !16, i64 8}
!21 = !{!18, !14, i64 16}
!22 = !{!18, !14, i64 24}
!23 = !{!18, !16, i64 32}
!24 = !{!19, !19, i64 0}
!25 = !{!18, !19, i64 44}
!26 = !{!18, !19, i64 45}
!27 = !{!18, !16, i64 64}
!28 = !{!29, !29, i64 0}
!29 = !{!"int", !11, i64 0}
!30 = !{!18, !14, i64 48}
!31 = !{!18, !14, i64 56}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopFullUnrollPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,MemCpyOptPass,MergedLoadStoreMotionPass,SCCPPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass