; LLVM IR from greensoftwarelab/Energy-Languages :: C/regex-redux/regexredux.gcc-4 (main)

; 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.string = type { ptr, i32, i32 }

@__const.main.count_Info = external hidden unnamed_addr constant [9 x ptr], align 16
@__const.main.replace_Info = external hidden unnamed_addr constant [5 x [2 x ptr]], align 16
@stdin = external global ptr, align 8
@.str.19 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [1 x i8], align 1
@pcre_free = external global ptr, align 8
@.str.21 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [11 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca [9 x ptr], align 16
  %3 = alloca [5 x [2 x ptr]], align 16
  %4 = alloca %struct.string, align 8
  %5 = alloca %struct.string, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca %struct.string, align 8
  %10 = alloca %struct.string, align 8
  %11 = alloca i32, align 4
  %12 = alloca %struct.string, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca [3 x i32], align 4
  %18 = alloca i32, align 4
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 72, ptr %2) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %2, ptr align 16 @__const.main.count_Info, i64 72, i1 false)
  call void @llvm.lifetime.start.p0(i64 80, ptr %3) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %3, ptr align 16 @__const.main.replace_Info, i64 80, i1 false)
  call void @llvm.lifetime.start.p0(i64 16, ptr %4) #7
  %21 = getelementptr inbounds %struct.string, ptr %4, i32 0, i32 0
  %22 = call noalias ptr @malloc(i64 noundef 16384) #8
  store ptr %22, ptr %21, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.string, ptr %4, i32 0, i32 1
  store i32 16384, ptr %23, align 8, !tbaa !11
  %24 = getelementptr inbounds %struct.string, ptr %4, i32 0, i32 2
  store i32 0, ptr %24, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #7
  %25 = getelementptr inbounds %struct.string, ptr %5, i32 0, i32 0
  %26 = call noalias ptr @malloc(i64 noundef 16384) #8
  store ptr %26, ptr %25, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.string, ptr %5, i32 0, i32 1
  store i32 16384, ptr %27, align 8, !tbaa !11
  %28 = getelementptr inbounds %struct.string, ptr %5, i32 0, i32 2
  store i32 0, ptr %28, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  br label %29

29:                                               ; preds = %64, %0
  %30 = getelementptr inbounds %struct.string, ptr %4, i32 0, i32 0
  %31 = load ptr, ptr %30, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.string, ptr %4, i32 0, i32 2
  %33 = load i32, ptr %32, align 4, !tbaa !12
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds i8, ptr %31, i64 %34
  %36 = getelementptr inbounds %struct.string, ptr %4, i32 0, i32 1
  %37 = load i32, ptr %36, align 8, !tbaa !11
  %38 = getelementptr inbounds %struct.string, ptr %4, i32 0, i32 2
  %39 = load i32, ptr %38, align 4, !tbaa !12
  %40 = sub nsw i32 %37, %39
  %41 = sext i32 %40 to i64
  %42 = load ptr, ptr @stdin, align 8, !tbaa !13
  %43 = call i64 @fread(ptr noundef %35, i64 noundef 1, i64 noundef %41, ptr noundef %42)
  %44 = trunc i64 %43 to i32
  store i32 %44, ptr %7, align 4, !tbaa !14
  %45 = icmp sgt i32 %44, 0
  br i1 %45, label %47, label %46

46:                                               ; preds = %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %65

47:                                               ; preds = %29
  %48 = load i32, ptr %7, align 4, !tbaa !14
  %49 = getelementptr inbounds %struct.string, ptr %4, i32 0, i32 2
  %50 = load i32, ptr %49, align 4, !tbaa !12
  %51 = add nsw i32 %50, %48
  store i32 %51, ptr %49, align 4, !tbaa !12
  %52 = getelementptr inbounds %struct.string, ptr %4, i32 0, i32 1
  %53 = load i32, ptr %52, align 8, !tbaa !11
  %54 = icmp eq i32 %51, %53
  br i1 %54, label %55, label %64

55:                                               ; preds = %47
  %56 = getelementptr inbounds %struct.string, ptr %4, i32 0, i32 0
  %57 = load ptr, ptr %56, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.string, ptr %4, i32 0, i32 1
  %59 = load i32, ptr %58, align 8, !tbaa !11
  %60 = mul nsw i32 %59, 2
  store i32 %60, ptr %58, align 8, !tbaa !11
  %61 = sext i32 %60 to i64
  %62 = call ptr @realloc(ptr noundef %57, i64 noundef %61) #9
  %63 = getelementptr inbounds %struct.string, ptr %4, i32 0, i32 0
  store ptr %62, ptr %63, align 8, !tbaa !5
  br label %64

64:                                               ; preds = %55, %47
  br label %29, !llvm.loop !15

65:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %66 = call ptr @pcre_jit_stack_alloc(i32 noundef 16384, i32 noundef 16384)
  store ptr %66, ptr %8, align 8, !tbaa !13
  %67 = load ptr, ptr %8, align 8, !tbaa !13
  call void @replace(ptr noundef @.str.19, ptr noundef @.str.20, ptr noundef %4, ptr noundef %5, ptr noundef %67)
  %68 = getelementptr inbounds %struct.string, ptr %4, i32 0, i32 0
  %69 = load ptr, ptr %68, align 8, !tbaa !5
  call void @free(ptr noundef %69) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #7
  %70 = getelementptr inbounds %struct.string, ptr %9, i32 0, i32 0
  %71 = getelementptr inbounds %struct.string, ptr %5, i32 0, i32 1
  %72 = load i32, ptr %71, align 8, !tbaa !11
  %73 = sext i32 %72 to i64
  %74 = call noalias ptr @malloc(i64 noundef %73) #8
  store ptr %74, ptr %70, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.string, ptr %9, i32 0, i32 1
  %76 = getelementptr inbounds %struct.string, ptr %5, i32 0, i32 1
  %77 = load i32, ptr %76, align 8, !tbaa !11
  store i32 %77, ptr %75, align 8, !tbaa !11
  %78 = getelementptr inbounds %struct.string, ptr %9, i32 0, i32 2
  %79 = getelementptr inbounds %struct.string, ptr %5, i32 0, i32 2
  %80 = load i32, ptr %79, align 4, !tbaa !12
  store i32 %80, ptr %78, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #7
  %81 = getelementptr inbounds %struct.string, ptr %10, i32 0, i32 0
  %82 = getelementptr inbounds %struct.string, ptr %5, i32 0, i32 1
  %83 = load i32, ptr %82, align 8, !tbaa !11
  %84 = sext i32 %83 to i64
  %85 = call noalias ptr @malloc(i64 noundef %84) #8
  store ptr %85, ptr %81, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.string, ptr %10, i32 0, i32 1
  %87 = getelementptr inbounds %struct.string, ptr %5, i32 0, i32 1
  %88 = load i32, ptr %87, align 8, !tbaa !11
  store i32 %88, ptr %86, align 8, !tbaa !11
  %89 = getelementptr inbounds %struct.string, ptr %10, i32 0, i32 2
  store i32 0, ptr %89, align 4, !tbaa !12
  %90 = getelementptr inbounds %struct.string, ptr %9, i32 0, i32 0
  %91 = load ptr, ptr %90, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.string, ptr %5, i32 0, i32 0
  %93 = load ptr, ptr %92, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.string, ptr %5, i32 0, i32 2
  %95 = load i32, ptr %94, align 4, !tbaa !12
  %96 = sext i32 %95 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %91, ptr align 1 %93, i64 %96, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 0, ptr %11, align 4, !tbaa !14
  br label %97

97:                                               ; preds = %115, %65
  %98 = load i32, ptr %11, align 4, !tbaa !14
  %99 = sext i32 %98 to i64
  %100 = icmp ult i64 %99, 5
  br i1 %100, label %102, label %101

101:                                              ; preds = %97
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %118

102:                                              ; preds = %97
  %103 = load i32, ptr %11, align 4, !tbaa !14
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [5 x [2 x ptr]], ptr %3, i64 0, i64 %104
  %106 = getelementptr inbounds [2 x ptr], ptr %105, i64 0, i64 0
  %107 = load ptr, ptr %106, align 16, !tbaa !13
  %108 = load i32, ptr %11, align 4, !tbaa !14
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [5 x [2 x ptr]], ptr %3, i64 0, i64 %109
  %111 = getelementptr inbounds [2 x ptr], ptr %110, i64 0, i64 1
  %112 = load ptr, ptr %111, align 8, !tbaa !13
  %113 = load ptr, ptr %8, align 8, !tbaa !13
  call void @replace(ptr noundef %107, ptr noundef %112, ptr noundef %9, ptr noundef %10, ptr noundef %113)
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %12, ptr align 8 %9, i64 16, i1 false), !tbaa.struct !17
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %9, ptr align 8 %10, i64 16, i1 false), !tbaa.struct !17
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %10, ptr align 8 %12, i64 16, i1 false), !tbaa.struct !17
  %114 = getelementptr inbounds %struct.string, ptr %10, i32 0, i32 2
  store i32 0, ptr %114, align 4, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #7
  br label %115

115:                                              ; preds = %102
  %116 = load i32, ptr %11, align 4, !tbaa !14
  %117 = add nsw i32 %116, 1
  store i32 %117, ptr %11, align 4, !tbaa !14
  br label %97, !llvm.loop !18

118:                                              ; preds = %101
  %119 = getelementptr inbounds %struct.string, ptr %9, i32 0, i32 2
  %120 = load i32, ptr %119, align 4, !tbaa !12
  store i32 %120, ptr %6, align 4, !tbaa !14
  %121 = getelementptr inbounds %struct.string, ptr %9, i32 0, i32 0
  %122 = load ptr, ptr %121, align 8, !tbaa !5
  call void @free(ptr noundef %122) #7
  %123 = getelementptr inbounds %struct.string, ptr %10, i32 0, i32 0
  %124 = load ptr, ptr %123, align 8, !tbaa !5
  call void @free(ptr noundef %124) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 0, ptr %13, align 4, !tbaa !14
  br label %125

125:                                              ; preds = %165, %118
  %126 = load i32, ptr %13, align 4, !tbaa !14
  %127 = sext i32 %126 to i64
  %128 = icmp ult i64 %127, 9
  br i1 %128, label %130, label %129

129:                                              ; preds = %125
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %168

130:                                              ; preds = %125
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  store i32 0, ptr %16, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 12, ptr %17) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  store i32 0, ptr %18, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  %131 = load i32, ptr %13, align 4, !tbaa !14
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [9 x ptr], ptr %2, i64 0, i64 %132
  %134 = load ptr, ptr %133, align 8, !tbaa !13
  %135 = call ptr @pcre_compile(ptr noundef %134, i32 noundef 0, ptr noundef %14, ptr noundef %15, ptr noundef null)
  store ptr %135, ptr %19, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  %136 = load ptr, ptr %19, align 8, !tbaa !13
  %137 = call ptr @pcre_study(ptr noundef %136, i32 noundef 1, ptr noundef %14)
  store ptr %137, ptr %20, align 8, !tbaa !13
  br label %138

138:                                              ; preds = %150, %130
  %139 = load ptr, ptr %19, align 8, !tbaa !13
  %140 = load ptr, ptr %20, align 8, !tbaa !13
  %141 = getelementptr inbounds %struct.string, ptr %5, i32 0, i32 0
  %142 = load ptr, ptr %141, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.string, ptr %5, i32 0, i32 2
  %144 = load i32, ptr %143, align 4, !tbaa !12
  %145 = load i32, ptr %16, align 4, !tbaa !14
  %146 = getelementptr inbounds [3 x i32], ptr %17, i64 0, i64 0
  %147 = load ptr, ptr %8, align 8, !tbaa !13
  %148 = call i32 @pcre_jit_exec(ptr noundef %139, ptr noundef %140, ptr noundef %142, i32 noundef %144, i32 noundef %145, i32 noundef 0, ptr noundef %146, i32 noundef 3, ptr noundef %147)
  %149 = icmp sge i32 %148, 0
  br i1 %149, label %150, label %155

150:                                              ; preds = %138
  %151 = load i32, ptr %18, align 4, !tbaa !14
  %152 = add nsw i32 %151, 1
  store i32 %152, ptr %18, align 4, !tbaa !14
  %153 = getelementptr inbounds [3 x i32], ptr %17, i64 0, i64 1
  %154 = load i32, ptr %153, align 4, !tbaa !14
  store i32 %154, ptr %16, align 4, !tbaa !14
  br label %138, !llvm.loop !19

155:                                              ; preds = %138
  %156 = load ptr, ptr %20, align 8, !tbaa !13
  call void @pcre_free_study(ptr noundef %156)
  %157 = load ptr, ptr @pcre_free, align 8, !tbaa !13
  %158 = load ptr, ptr %19, align 8, !tbaa !13
  call void %157(ptr noundef %158)
  %159 = load i32, ptr %13, align 4, !tbaa !14
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [9 x ptr], ptr %2, i64 0, i64 %160
  %162 = load ptr, ptr %161, align 8, !tbaa !13
  %163 = load i32, ptr %18, align 4, !tbaa !14
  %164 = call i32 (ptr, ...) @printf(ptr noundef @.str.21, ptr noundef %162, i32 noundef %163)
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  br label %165

165:                                              ; preds = %155
  %166 = load i32, ptr %13, align 4, !tbaa !14
  %167 = add nsw i32 %166, 1
  store i32 %167, ptr %13, align 4, !tbaa !14
  br label %125, !llvm.loop !20

168:                                              ; preds = %129
  %169 = load ptr, ptr %8, align 8, !tbaa !13
  call void @pcre_jit_stack_free(ptr noundef %169)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  %170 = getelementptr inbounds %struct.string, ptr %5, i32 0, i32 0
  %171 = load ptr, ptr %170, align 8, !tbaa !5
  call void @free(ptr noundef %171) #7
  %172 = getelementptr inbounds %struct.string, ptr %4, i32 0, i32 2
  %173 = load i32, ptr %172, align 4, !tbaa !12
  %174 = getelementptr inbounds %struct.string, ptr %5, i32 0, i32 2
  %175 = load i32, ptr %174, align 4, !tbaa !12
  %176 = load i32, ptr %6, align 4, !tbaa !14
  %177 = call i32 (ptr, ...) @printf(ptr noundef @.str.22, i32 noundef %173, i32 noundef %175, i32 noundef %176)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 80, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 72, ptr %2) #7
  ret i32 0
}

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

; 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) #2

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

declare i64 @fread(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #4

; Function Attrs: nounwind allocsize(1)
declare ptr @realloc(ptr noundef, i64 noundef) #5

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

declare ptr @pcre_jit_stack_alloc(i32 noundef, i32 noundef) #4

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

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

declare ptr @pcre_compile(ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) #4

declare ptr @pcre_study(ptr noundef, i32 noundef, ptr noundef) #4

declare i32 @pcre_jit_exec(ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef) #4

declare void @pcre_free_study(ptr noundef) #4

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"", !7, i64 0, !10, i64 8, !10, i64 12}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !10, i64 8}
!12 = !{!6, !10, i64 12}
!13 = !{!7, !7, i64 0}
!14 = !{!10, !10, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{i64 0, i64 8, !13, i64 8, i64 4, !14, i64 12, i64 4, !14}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !16}
!20 = distinct !{!20, !16}


; 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.string = type { ptr, i32, i32 }

@__const.main.count_Info = external hidden unnamed_addr constant [9 x ptr], align 16
@__const.main.replace_Info = external hidden unnamed_addr constant [5 x [2 x ptr]], align 16
@stdin = external local_unnamed_addr global ptr, align 8
@.str.19 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [1 x i8], align 1
@pcre_free = external local_unnamed_addr global ptr, align 8
@.str.21 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [11 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca %struct.string, align 8
  %2 = alloca %struct.string, align 8
  %3 = alloca %struct.string, align 8
  %4 = alloca %struct.string, align 8
  %5 = alloca %struct.string, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca [3 x i32], align 4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %1) #8
  %9 = tail call noalias dereferenceable_or_null(16384) ptr @malloc(i64 noundef 16384) #9
  %10 = getelementptr inbounds i8, ptr %1, i64 8
  %11 = getelementptr inbounds i8, ptr %1, i64 12
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #8
  %12 = tail call noalias dereferenceable_or_null(16384) ptr @malloc(i64 noundef 16384) #9
  store ptr %12, ptr %2, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %2, i64 8
  store i32 16384, ptr %13, align 8, !tbaa !11
  %14 = getelementptr inbounds i8, ptr %2, i64 12
  store i32 0, ptr %14, align 4, !tbaa !12
  %15 = load ptr, ptr @stdin, align 8, !tbaa !13
  %16 = tail call i64 @fread(ptr noundef %9, i64 noundef 1, i64 noundef 16384, ptr noundef %15)
  %17 = trunc i64 %16 to i32
  %18 = icmp sgt i32 %17, 0
  br i1 %18, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %56, %0
  %.lcssa31 = phi i32 [ 16384, %0 ], [ %57, %56 ]
  %.lcssa29 = phi i32 [ 0, %0 ], [ %50, %56 ]
  %.lcssa = phi ptr [ %9, %0 ], [ %58, %56 ]
  store ptr %.lcssa, ptr %1, align 8, !tbaa !5
  store i32 %.lcssa29, ptr %11, align 4, !tbaa !12
  store i32 %.lcssa31, ptr %10, align 8, !tbaa !11
  %19 = tail call ptr @pcre_jit_stack_alloc(i32 noundef 16384, i32 noundef 16384) #8
  call void @replace(ptr noundef nonnull @.str.19, ptr noundef nonnull @.str.20, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef %19)
  %20 = load ptr, ptr %1, align 8, !tbaa !5
  call void @free(ptr noundef %20) #8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #8
  %21 = load i32, ptr %13, align 8, !tbaa !11
  %22 = sext i32 %21 to i64
  %23 = call noalias ptr @malloc(i64 noundef %22) #9
  store ptr %23, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %3, i64 8
  store i32 %21, ptr %24, align 8, !tbaa !11
  %25 = getelementptr inbounds i8, ptr %3, i64 12
  %26 = load i32, ptr %14, align 4, !tbaa !12
  store i32 %26, ptr %25, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #8
  %27 = call noalias ptr @malloc(i64 noundef %22) #9
  store ptr %27, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds i8, ptr %4, i64 8
  store i32 %21, ptr %28, align 8, !tbaa !11
  %29 = getelementptr inbounds i8, ptr %4, i64 12
  store i32 0, ptr %29, align 4, !tbaa !12
  %30 = load ptr, ptr %2, align 8, !tbaa !5
  %31 = sext i32 %26 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %23, ptr align 1 %30, i64 %31, i1 false)
  %32 = load ptr, ptr @__const.main.replace_Info, align 16, !tbaa !13
  %33 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.main.replace_Info, i64 8), align 8, !tbaa !13
  call void @replace(ptr noundef %32, ptr noundef %33, ptr noundef nonnull %3, ptr noundef nonnull %4, ptr noundef %19)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(16) %3, i64 16, i1 false), !tbaa.struct !14
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(16) %4, i64 16, i1 false), !tbaa.struct !14
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 8 dereferenceable(16) %5, i64 16, i1 false), !tbaa.struct !14
  store i32 0, ptr %29, align 4, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5)
  %34 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.main.replace_Info, i64 16), align 16, !tbaa !13
  %35 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.main.replace_Info, i64 24), align 8, !tbaa !13
  call void @replace(ptr noundef %34, ptr noundef %35, ptr noundef nonnull %3, ptr noundef nonnull %4, ptr noundef %19)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(16) %3, i64 16, i1 false), !tbaa.struct !14
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(16) %4, i64 16, i1 false), !tbaa.struct !14
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 8 dereferenceable(16) %5, i64 16, i1 false), !tbaa.struct !14
  store i32 0, ptr %29, align 4, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5)
  %36 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.main.replace_Info, i64 32), align 16, !tbaa !13
  %37 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.main.replace_Info, i64 40), align 8, !tbaa !13
  call void @replace(ptr noundef %36, ptr noundef %37, ptr noundef nonnull %3, ptr noundef nonnull %4, ptr noundef %19)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(16) %3, i64 16, i1 false), !tbaa.struct !14
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(16) %4, i64 16, i1 false), !tbaa.struct !14
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 8 dereferenceable(16) %5, i64 16, i1 false), !tbaa.struct !14
  store i32 0, ptr %29, align 4, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5)
  %38 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.main.replace_Info, i64 48), align 16, !tbaa !13
  %39 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.main.replace_Info, i64 56), align 8, !tbaa !13
  call void @replace(ptr noundef %38, ptr noundef %39, ptr noundef nonnull %3, ptr noundef nonnull %4, ptr noundef %19)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(16) %3, i64 16, i1 false), !tbaa.struct !14
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(16) %4, i64 16, i1 false), !tbaa.struct !14
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 8 dereferenceable(16) %5, i64 16, i1 false), !tbaa.struct !14
  store i32 0, ptr %29, align 4, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5)
  %40 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.main.replace_Info, i64 64), align 16, !tbaa !13
  %41 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.main.replace_Info, i64 72), align 8, !tbaa !13
  call void @replace(ptr noundef %40, ptr noundef %41, ptr noundef nonnull %3, ptr noundef nonnull %4, ptr noundef %19)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(16) %3, i64 16, i1 false), !tbaa.struct !14
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(16) %4, i64 16, i1 false), !tbaa.struct !14
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 8 dereferenceable(16) %5, i64 16, i1 false), !tbaa.struct !14
  store i32 0, ptr %29, align 4, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5)
  %42 = load i32, ptr %25, align 4, !tbaa !12
  %43 = load ptr, ptr %3, align 8, !tbaa !5
  call void @free(ptr noundef %43) #8
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  call void @free(ptr noundef %44) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #8
  %45 = getelementptr inbounds i8, ptr %8, i64 4
  br label %72

.lr.ph:                                           ; preds = %0, %56
  %46 = phi i32 [ %65, %56 ], [ %17, %0 ]
  %47 = phi ptr [ %58, %56 ], [ %9, %0 ]
  %48 = phi i32 [ %50, %56 ], [ 0, %0 ]
  %49 = phi i32 [ %57, %56 ], [ 16384, %0 ]
  %50 = add nuw nsw i32 %48, %46
  %51 = icmp eq i32 %50, %49
  br i1 %51, label %52, label %56

52:                                               ; preds = %.lr.ph
  %53 = shl nsw i32 %49, 1
  %54 = sext i32 %53 to i64
  %55 = tail call ptr @realloc(ptr noundef %47, i64 noundef %54) #10
  br label %56

56:                                               ; preds = %52, %.lr.ph
  %57 = phi i32 [ %53, %52 ], [ %49, %.lr.ph ]
  %58 = phi ptr [ %55, %52 ], [ %47, %.lr.ph ]
  %59 = zext nneg i32 %50 to i64
  %60 = getelementptr inbounds i8, ptr %58, i64 %59
  %61 = sub nsw i32 %57, %50
  %62 = sext i32 %61 to i64
  %63 = load ptr, ptr @stdin, align 8, !tbaa !13
  %64 = tail call i64 @fread(ptr noundef nonnull %60, i64 noundef 1, i64 noundef %62, ptr noundef %63)
  %65 = trunc i64 %64 to i32
  %66 = icmp sgt i32 %65, 0
  br i1 %66, label %.lr.ph, label %._crit_edge, !llvm.loop !16

67:                                               ; preds = %._crit_edge38
  call void @pcre_jit_stack_free(ptr noundef %19) #8
  %68 = load ptr, ptr %2, align 8, !tbaa !5
  call void @free(ptr noundef %68) #8
  %69 = load i32, ptr %11, align 4, !tbaa !12
  %70 = load i32, ptr %14, align 4, !tbaa !12
  %71 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.22, i32 noundef %69, i32 noundef %70, i32 noundef %42)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %1) #8
  ret i32 0

72:                                               ; preds = %._crit_edge, %._crit_edge38
  %indvars.iv = phi i64 [ 0, %._crit_edge ], [ %indvars.iv.next, %._crit_edge38 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #8
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %8) #8
  %73 = getelementptr inbounds [9 x ptr], ptr @__const.main.count_Info, i64 0, i64 %indvars.iv
  %74 = load ptr, ptr %73, align 8, !tbaa !13
  %75 = call ptr @pcre_compile(ptr noundef %74, i32 noundef 0, ptr noundef nonnull %6, ptr noundef nonnull %7, ptr noundef null) #8
  %76 = call ptr @pcre_study(ptr noundef %75, i32 noundef 1, ptr noundef nonnull %6) #8
  %77 = load ptr, ptr %2, align 8, !tbaa !5
  %78 = load i32, ptr %14, align 4, !tbaa !12
  %79 = call i32 @pcre_jit_exec(ptr noundef %75, ptr noundef %76, ptr noundef %77, i32 noundef %78, i32 noundef 0, i32 noundef 0, ptr noundef nonnull %8, i32 noundef 3, ptr noundef %19) #8
  %80 = icmp sgt i32 %79, -1
  br i1 %80, label %.lr.ph37, label %._crit_edge38

.lr.ph37:                                         ; preds = %72, %.lr.ph37
  %.02235 = phi i32 [ %81, %.lr.ph37 ], [ 0, %72 ]
  %81 = add nuw nsw i32 %.02235, 1
  %82 = load i32, ptr %45, align 4, !tbaa !15
  %83 = load ptr, ptr %2, align 8, !tbaa !5
  %84 = load i32, ptr %14, align 4, !tbaa !12
  %85 = call i32 @pcre_jit_exec(ptr noundef %75, ptr noundef %76, ptr noundef %83, i32 noundef %84, i32 noundef %82, i32 noundef 0, ptr noundef nonnull %8, i32 noundef 3, ptr noundef %19) #8
  %86 = icmp sgt i32 %85, -1
  br i1 %86, label %.lr.ph37, label %._crit_edge38, !llvm.loop !18

._crit_edge38:                                    ; preds = %.lr.ph37, %72
  %.022.lcssa = phi i32 [ 0, %72 ], [ %81, %.lr.ph37 ]
  call void @pcre_free_study(ptr noundef %76) #8
  %87 = load ptr, ptr @pcre_free, align 8, !tbaa !13
  call void %87(ptr noundef %75) #8
  %88 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.21, ptr noundef %74, i32 noundef %.022.lcssa)
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %8) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #8
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 9
  br i1 %exitcond.not, label %67, label %72, !llvm.loop !19
}

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

; 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) #2

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

; Function Attrs: nofree nounwind
declare noundef i64 @fread(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias noundef ptr @realloc(ptr allocptr nocapture noundef, i64 noundef) local_unnamed_addr #5

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

declare ptr @pcre_jit_stack_alloc(i32 noundef, i32 noundef) local_unnamed_addr #6

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

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

declare ptr @pcre_compile(ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #6

declare ptr @pcre_study(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #6

declare i32 @pcre_jit_exec(ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #6

declare void @pcre_free_study(ptr noundef) local_unnamed_addr #6

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

declare void @pcre_jit_stack_free(ptr noundef) local_unnamed_addr #6

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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 #5 = { mustprogress nounwind willreturn allockind("realloc") allocsize(1) 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 #6 = { "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 = { 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 #8 = { nounwind }
attributes #9 = { nounwind allocsize(0) }
attributes #10 = { nounwind allocsize(1) }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"", !7, i64 0, !10, i64 8, !10, i64 12}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !10, i64 8}
!12 = !{!6, !10, i64 12}
!13 = !{!7, !7, i64 0}
!14 = !{i64 0, i64 8, !13, i64 8, i64 4, !15, i64 12, i64 4, !15}
!15 = !{!10, !10, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}
!19 = distinct !{!19, !17}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass