; LLVM IR from VastoLorde95/Competitive-Programming :: CodeChef/WF/Medium Hard/LYRC (brute)

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

@node = external dso_local global [2000000 x %struct.Node], align 16
@pattern = external dso_local global [5003 x i8], align 16
@text = external dso_local global [50004 x i8], align 16
@finish = external dso_local global [5003 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [108 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [136 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [115 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z6insertv() #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 willreturn memory(read)
declare i64 @strlen(ptr noundef) #2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z20construct_transitionv() #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z7processv() #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6resultv() #3

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #4 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  %6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2)
  %7 = load i32, ptr %2, align 4, !tbaa !5
  %8 = icmp sle i32 1, %7
  br i1 %8, label %9, label %12

9:                                                ; preds = %0
  %10 = load i32, ptr %2, align 4, !tbaa !5
  %11 = icmp sle i32 %10, 500
  br label %12

12:                                               ; preds = %9, %0
  %13 = phi i1 [ false, %0 ], [ %11, %9 ]
  br i1 %13, label %14, label %15

14:                                               ; preds = %12
  br label %17

15:                                               ; preds = %12
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.3, i32 noundef 163, ptr noundef @__PRETTY_FUNCTION__.main) #8
  unreachable

16:                                               ; No predecessors!
  br label %17

17:                                               ; preds = %16, %14
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %113, %17
  %19 = load i32, ptr %4, align 4, !tbaa !5
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = icmp slt i32 %19, %20
  br i1 %21, label %22, label %116

22:                                               ; preds = %18
  %23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef @pattern)
  %24 = call i64 @strlen(ptr noundef @pattern) #9
  %25 = icmp ule i64 1, %24
  br i1 %25, label %26, label %29

26:                                               ; preds = %22
  %27 = call i64 @strlen(ptr noundef @pattern) #9
  %28 = icmp ule i64 %27, 5000
  br label %29

29:                                               ; preds = %26, %22
  %30 = phi i1 [ false, %22 ], [ %28, %26 ]
  br i1 %30, label %31, label %32

31:                                               ; preds = %29
  br label %34

32:                                               ; preds = %29
  call void @__assert_fail(ptr noundef @.str.5, ptr noundef @.str.3, i32 noundef 168, ptr noundef @__PRETTY_FUNCTION__.main) #8
  unreachable

33:                                               ; No predecessors!
  br label %34

34:                                               ; preds = %33, %31
  %35 = call i64 @strlen(ptr noundef @pattern) #9
  %36 = sub i64 %35, 1
  %37 = trunc i64 %36 to i32
  store i32 %37, ptr %5, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %105, %34
  %39 = load i32, ptr %5, align 4, !tbaa !5
  %40 = icmp sge i32 %39, 0
  br i1 %40, label %41, label %108

41:                                               ; preds = %38
  %42 = load i32, ptr %5, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [5003 x i8], ptr @pattern, i64 0, i64 %43
  %45 = load i8, ptr %44, align 1, !tbaa !9
  %46 = sext i8 %45 to i32
  %47 = icmp eq i32 %46, 45
  br i1 %47, label %92, label %48

48:                                               ; preds = %41
  %49 = load i32, ptr %5, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [5003 x i8], ptr @pattern, i64 0, i64 %50
  %52 = load i8, ptr %51, align 1, !tbaa !9
  %53 = sext i8 %52 to i32
  %54 = icmp sge i32 %53, 97
  br i1 %54, label %55, label %62

55:                                               ; preds = %48
  %56 = load i32, ptr %5, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [5003 x i8], ptr @pattern, i64 0, i64 %57
  %59 = load i8, ptr %58, align 1, !tbaa !9
  %60 = sext i8 %59 to i32
  %61 = icmp sle i32 %60, 122
  br i1 %61, label %92, label %62

62:                                               ; preds = %55, %48
  %63 = load i32, ptr %5, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [5003 x i8], ptr @pattern, i64 0, i64 %64
  %66 = load i8, ptr %65, align 1, !tbaa !9
  %67 = sext i8 %66 to i32
  %68 = icmp sge i32 %67, 65
  br i1 %68, label %69, label %76

69:                                               ; preds = %62
  %70 = load i32, ptr %5, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [5003 x i8], ptr @pattern, i64 0, i64 %71
  %73 = load i8, ptr %72, align 1, !tbaa !9
  %74 = sext i8 %73 to i32
  %75 = icmp sle i32 %74, 90
  br i1 %75, label %92, label %76

76:                                               ; preds = %69, %62
  %77 = load i32, ptr %5, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [5003 x i8], ptr @pattern, i64 0, i64 %78
  %80 = load i8, ptr %79, align 1, !tbaa !9
  %81 = sext i8 %80 to i32
  %82 = icmp sge i32 %81, 48
  br i1 %82, label %83, label %90

83:                                               ; preds = %76
  %84 = load i32, ptr %5, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [5003 x i8], ptr @pattern, i64 0, i64 %85
  %87 = load i8, ptr %86, align 1, !tbaa !9
  %88 = sext i8 %87 to i32
  %89 = icmp sle i32 %88, 57
  br label %90

90:                                               ; preds = %83, %76
  %91 = phi i1 [ false, %76 ], [ %89, %83 ]
  br label %92

92:                                               ; preds = %90, %69, %55, %41
  %93 = phi i1 [ true, %69 ], [ true, %55 ], [ true, %41 ], [ %91, %90 ]
  br i1 %93, label %94, label %95

94:                                               ; preds = %92
  br label %97

95:                                               ; preds = %92
  call void @__assert_fail(ptr noundef @.str.6, ptr noundef @.str.3, i32 noundef 171, ptr noundef @__PRETTY_FUNCTION__.main) #8
  unreachable

96:                                               ; No predecessors!
  br label %97

97:                                               ; preds = %96, %94
  %98 = load i32, ptr %5, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [5003 x i8], ptr @pattern, i64 0, i64 %99
  %101 = load i8, ptr %100, align 1, !tbaa !9
  %102 = sext i8 %101 to i32
  %103 = sub nsw i32 %102, 35
  %104 = trunc i32 %103 to i8
  store i8 %104, ptr %100, align 1, !tbaa !9
  br label %105

105:                                              ; preds = %97
  %106 = load i32, ptr %5, align 4, !tbaa !5
  %107 = add nsw i32 %106, -1
  store i32 %107, ptr %5, align 4, !tbaa !5
  br label %38, !llvm.loop !10

108:                                              ; preds = %38
  %109 = call noundef i32 @_Z6insertv()
  %110 = load i32, ptr %4, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [5003 x i32], ptr @finish, i64 0, i64 %111
  store i32 %109, ptr %112, align 4, !tbaa !5
  br label %113

113:                                              ; preds = %108
  %114 = load i32, ptr %4, align 4, !tbaa !5
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %4, align 4, !tbaa !5
  br label %18, !llvm.loop !12

116:                                              ; preds = %18
  call void @_Z20construct_transitionv()
  %117 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %3)
  %118 = load i32, ptr %3, align 4, !tbaa !5
  %119 = icmp sle i32 1, %118
  br i1 %119, label %120, label %123

120:                                              ; preds = %116
  %121 = load i32, ptr %3, align 4, !tbaa !5
  %122 = icmp sle i32 %121, 100
  br label %123

123:                                              ; preds = %120, %116
  %124 = phi i1 [ false, %116 ], [ %122, %120 ]
  br i1 %124, label %125, label %126

125:                                              ; preds = %123
  br label %128

126:                                              ; preds = %123
  call void @__assert_fail(ptr noundef @.str.7, ptr noundef @.str.3, i32 noundef 183, ptr noundef @__PRETTY_FUNCTION__.main) #8
  unreachable

127:                                              ; No predecessors!
  br label %128

128:                                              ; preds = %127, %125
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %129

129:                                              ; preds = %220, %128
  %130 = load i32, ptr %4, align 4, !tbaa !5
  %131 = load i32, ptr %3, align 4, !tbaa !5
  %132 = icmp slt i32 %130, %131
  br i1 %132, label %133, label %223

133:                                              ; preds = %129
  %134 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef @text)
  %135 = call i64 @strlen(ptr noundef @text) #9
  %136 = icmp ule i64 1, %135
  br i1 %136, label %137, label %140

137:                                              ; preds = %133
  %138 = call i64 @strlen(ptr noundef @text) #9
  %139 = icmp ule i64 %138, 50000
  br label %140

140:                                              ; preds = %137, %133
  %141 = phi i1 [ false, %133 ], [ %139, %137 ]
  br i1 %141, label %142, label %143

142:                                              ; preds = %140
  br label %145

143:                                              ; preds = %140
  call void @__assert_fail(ptr noundef @.str.8, ptr noundef @.str.3, i32 noundef 187, ptr noundef @__PRETTY_FUNCTION__.main) #8
  unreachable

144:                                              ; No predecessors!
  br label %145

145:                                              ; preds = %144, %142
  %146 = call i64 @strlen(ptr noundef @text) #9
  %147 = sub i64 %146, 1
  %148 = trunc i64 %147 to i32
  store i32 %148, ptr %5, align 4, !tbaa !5
  br label %149

149:                                              ; preds = %216, %145
  %150 = load i32, ptr %5, align 4, !tbaa !5
  %151 = icmp sge i32 %150, 0
  br i1 %151, label %152, label %219

152:                                              ; preds = %149
  %153 = load i32, ptr %5, align 4, !tbaa !5
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [50004 x i8], ptr @text, i64 0, i64 %154
  %156 = load i8, ptr %155, align 1, !tbaa !9
  %157 = sext i8 %156 to i32
  %158 = icmp eq i32 %157, 45
  br i1 %158, label %203, label %159

159:                                              ; preds = %152
  %160 = load i32, ptr %5, align 4, !tbaa !5
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds [50004 x i8], ptr @text, i64 0, i64 %161
  %163 = load i8, ptr %162, align 1, !tbaa !9
  %164 = sext i8 %163 to i32
  %165 = icmp sge i32 %164, 97
  br i1 %165, label %166, label %173

166:                                              ; preds = %159
  %167 = load i32, ptr %5, align 4, !tbaa !5
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [50004 x i8], ptr @text, i64 0, i64 %168
  %170 = load i8, ptr %169, align 1, !tbaa !9
  %171 = sext i8 %170 to i32
  %172 = icmp sle i32 %171, 122
  br i1 %172, label %203, label %173

173:                                              ; preds = %166, %159
  %174 = load i32, ptr %5, align 4, !tbaa !5
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [50004 x i8], ptr @text, i64 0, i64 %175
  %177 = load i8, ptr %176, align 1, !tbaa !9
  %178 = sext i8 %177 to i32
  %179 = icmp sge i32 %178, 65
  br i1 %179, label %180, label %187

180:                                              ; preds = %173
  %181 = load i32, ptr %5, align 4, !tbaa !5
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds [50004 x i8], ptr @text, i64 0, i64 %182
  %184 = load i8, ptr %183, align 1, !tbaa !9
  %185 = sext i8 %184 to i32
  %186 = icmp sle i32 %185, 90
  br i1 %186, label %203, label %187

187:                                              ; preds = %180, %173
  %188 = load i32, ptr %5, align 4, !tbaa !5
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds [50004 x i8], ptr @text, i64 0, i64 %189
  %191 = load i8, ptr %190, align 1, !tbaa !9
  %192 = sext i8 %191 to i32
  %193 = icmp sge i32 %192, 48
  br i1 %193, label %194, label %201

194:                                              ; preds = %187
  %195 = load i32, ptr %5, align 4, !tbaa !5
  %196 = sext i32 %195 to i64
  %197 = getelementptr inbounds [50004 x i8], ptr @text, i64 0, i64 %196
  %198 = load i8, ptr %197, align 1, !tbaa !9
  %199 = sext i8 %198 to i32
  %200 = icmp sle i32 %199, 57
  br label %201

201:                                              ; preds = %194, %187
  %202 = phi i1 [ false, %187 ], [ %200, %194 ]
  br label %203

203:                                              ; preds = %201, %180, %166, %152
  %204 = phi i1 [ true, %180 ], [ true, %166 ], [ true, %152 ], [ %202, %201 ]
  br i1 %204, label %205, label %206

205:                                              ; preds = %203
  br label %208

206:                                              ; preds = %203
  call void @__assert_fail(ptr noundef @.str.9, ptr noundef @.str.3, i32 noundef 190, ptr noundef @__PRETTY_FUNCTION__.main) #8
  unreachable

207:                                              ; No predecessors!
  br label %208

208:                                              ; preds = %207, %205
  %209 = load i32, ptr %5, align 4, !tbaa !5
  %210 = sext i32 %209 to i64
  %211 = getelementptr inbounds [50004 x i8], ptr @text, i64 0, i64 %210
  %212 = load i8, ptr %211, align 1, !tbaa !9
  %213 = sext i8 %212 to i32
  %214 = sub nsw i32 %213, 35
  %215 = trunc i32 %214 to i8
  store i8 %215, ptr %211, align 1, !tbaa !9
  br label %216

216:                                              ; preds = %208
  %217 = load i32, ptr %5, align 4, !tbaa !5
  %218 = add nsw i32 %217, -1
  store i32 %218, ptr %5, align 4, !tbaa !5
  br label %149, !llvm.loop !13

219:                                              ; preds = %149
  call void @_Z7processv()
  br label %220

220:                                              ; preds = %219
  %221 = load i32, ptr %4, align 4, !tbaa !5
  %222 = add nsw i32 %221, 1
  store i32 %222, ptr %4, align 4, !tbaa !5
  br label %129, !llvm.loop !14

223:                                              ; preds = %129
  call void @_Z6resultv()
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %224

224:                                              ; preds = %238, %223
  %225 = load i32, ptr %4, align 4, !tbaa !5
  %226 = load i32, ptr %2, align 4, !tbaa !5
  %227 = icmp slt i32 %225, %226
  br i1 %227, label %228, label %241

228:                                              ; preds = %224
  %229 = load i32, ptr %4, align 4, !tbaa !5
  %230 = sext i32 %229 to i64
  %231 = getelementptr inbounds [5003 x i32], ptr @finish, i64 0, i64 %230
  %232 = load i32, ptr %231, align 4, !tbaa !5
  %233 = sext i32 %232 to i64
  %234 = getelementptr inbounds [2000000 x %struct.Node], ptr @node, i64 0, i64 %233
  %235 = getelementptr inbounds %struct.Node, ptr %234, i32 0, i32 4
  %236 = load i32, ptr %235, align 4, !tbaa !15
  %237 = call i32 (ptr, ...) @printf(ptr noundef @.str.10, i32 noundef %236)
  br label %238

238:                                              ; preds = %228
  %239 = load i32, ptr %4, align 4, !tbaa !5
  %240 = add nsw i32 %239, 1
  store i32 %240, ptr %4, align 4, !tbaa !5
  br label %224, !llvm.loop !17

241:                                              ; preds = %224
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  ret i32 0
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #5

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #6

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

attributes #0 = { mustprogress 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 = { nounwind willreturn memory(read) "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 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 #4 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { noreturn 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 = { noreturn nounwind }
attributes #9 = { nounwind willreturn memory(read) }

!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++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
!14 = distinct !{!14, !11}
!15 = !{!16, !6, i64 412}
!16 = !{!"_ZTS4Node", !7, i64 0, !6, i64 400, !6, i64 404, !7, i64 408, !6, i64 412, !6, i64 416}
!17 = distinct !{!17, !11}


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

@node = external dso_local local_unnamed_addr global [2000000 x %struct.Node], align 16
@pattern = external dso_local global [5003 x i8], align 16
@text = external dso_local global [50004 x i8], align 16
@finish = external dso_local local_unnamed_addr global [5003 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [108 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [136 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [115 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z6insertv() 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: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z20construct_transitionv() local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z7processv() local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6resultv() local_unnamed_addr #3

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #4 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  %3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %4 = load i32, ptr %1, align 4
  %5 = add i32 %4, -1
  %6 = icmp ult i32 %5, 500
  br i1 %6, label %.lr.ph66, label %7

7:                                                ; preds = %0
  call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, i32 noundef 163, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #8
  unreachable

.lr.ph66:                                         ; preds = %0, %._crit_edge
  %indvars.iv81 = phi i64 [ %indvars.iv.next82, %._crit_edge ], [ 0, %0 ]
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull @pattern)
  %9 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) @pattern) #9
  %10 = add i64 %9, -1
  %or.cond = icmp ult i64 %10, 5000
  br i1 %or.cond, label %.lr.ph, label %.critedge

.critedge:                                        ; preds = %.lr.ph66
  call void @__assert_fail(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.3, i32 noundef 168, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #8
  unreachable

.lr.ph:                                           ; preds = %.lr.ph66, %.critedge2
  %indvars.iv = phi i64 [ %indvars.iv.next, %.critedge2 ], [ %9, %.lr.ph66 ]
  %indvars.iv.next = add nsw i64 %indvars.iv, -1
  %11 = getelementptr inbounds [5003 x i8], ptr @pattern, i64 0, i64 %indvars.iv.next
  %12 = load i8, ptr %11, align 1, !tbaa !5
  %13 = icmp eq i8 %12, 45
  %14 = and i8 %12, -33
  %15 = add i8 %14, -65
  %16 = icmp ult i8 %15, 26
  %or.cond57 = or i1 %13, %16
  %17 = add i8 %12, -48
  %or.cond51 = icmp ult i8 %17, 10
  %or.cond58 = or i1 %or.cond51, %or.cond57
  br i1 %or.cond58, label %.critedge2, label %.critedge4

.critedge4:                                       ; preds = %.lr.ph
  call void @__assert_fail(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.3, i32 noundef 171, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #8
  unreachable

.critedge2:                                       ; preds = %.lr.ph
  %18 = add nsw i8 %12, -35
  store i8 %18, ptr %11, align 1, !tbaa !5
  %19 = icmp ugt i64 %indvars.iv, 1
  br i1 %19, label %.lr.ph, label %._crit_edge, !llvm.loop !8

._crit_edge:                                      ; preds = %.critedge2
  %20 = call noundef i32 @_Z6insertv()
  %21 = getelementptr inbounds [5003 x i32], ptr @finish, i64 0, i64 %indvars.iv81
  store i32 %20, ptr %21, align 4, !tbaa !10
  %indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
  %22 = load i32, ptr %1, align 4, !tbaa !10
  %23 = sext i32 %22 to i64
  %24 = icmp slt i64 %indvars.iv.next82, %23
  br i1 %24, label %.lr.ph66, label %._crit_edge67, !llvm.loop !12

._crit_edge67:                                    ; preds = %._crit_edge
  call void @_Z20construct_transitionv()
  %25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %2)
  %26 = load i32, ptr %2, align 4
  %27 = add i32 %26, -1
  %28 = icmp ult i32 %27, 100
  br i1 %28, label %.lr.ph74, label %29

29:                                               ; preds = %._crit_edge67
  call void @__assert_fail(ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.3, i32 noundef 183, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #8
  unreachable

.lr.ph74:                                         ; preds = %._crit_edge67, %._crit_edge72
  %.13973 = phi i32 [ %42, %._crit_edge72 ], [ 0, %._crit_edge67 ]
  %30 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull @text)
  %31 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) @text) #9
  %32 = add i64 %31, -1
  %or.cond52 = icmp ult i64 %32, 50000
  br i1 %or.cond52, label %.lr.ph71, label %.critedge6

.critedge6:                                       ; preds = %.lr.ph74
  call void @__assert_fail(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.3, i32 noundef 187, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #8
  unreachable

.lr.ph71:                                         ; preds = %.lr.ph74, %.critedge8
  %indvars.iv84 = phi i64 [ %indvars.iv.next85, %.critedge8 ], [ %31, %.lr.ph74 ]
  %indvars.iv.next85 = add nsw i64 %indvars.iv84, -1
  %33 = getelementptr inbounds [50004 x i8], ptr @text, i64 0, i64 %indvars.iv.next85
  %34 = load i8, ptr %33, align 1, !tbaa !5
  %35 = icmp eq i8 %34, 45
  %36 = and i8 %34, -33
  %37 = add i8 %36, -65
  %38 = icmp ult i8 %37, 26
  %or.cond60 = or i1 %35, %38
  %39 = add i8 %34, -48
  %or.cond55 = icmp ult i8 %39, 10
  %or.cond61 = or i1 %or.cond55, %or.cond60
  br i1 %or.cond61, label %.critedge8, label %.critedge10

.critedge10:                                      ; preds = %.lr.ph71
  call void @__assert_fail(ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.3, i32 noundef 190, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #8
  unreachable

.critedge8:                                       ; preds = %.lr.ph71
  %40 = add nsw i8 %34, -35
  store i8 %40, ptr %33, align 1, !tbaa !5
  %41 = icmp ugt i64 %indvars.iv84, 1
  br i1 %41, label %.lr.ph71, label %._crit_edge72, !llvm.loop !13

._crit_edge72:                                    ; preds = %.critedge8
  call void @_Z7processv()
  %42 = add nuw nsw i32 %.13973, 1
  %43 = load i32, ptr %2, align 4, !tbaa !10
  %44 = icmp slt i32 %42, %43
  br i1 %44, label %.lr.ph74, label %._crit_edge75, !llvm.loop !14

._crit_edge75:                                    ; preds = %._crit_edge72
  call void @_Z6resultv()
  %45 = load i32, ptr %1, align 4, !tbaa !10
  %46 = icmp sgt i32 %45, 0
  br i1 %46, label %.lr.ph78, label %._crit_edge79

.lr.ph78:                                         ; preds = %._crit_edge75, %.lr.ph78
  %indvars.iv87 = phi i64 [ %indvars.iv.next88, %.lr.ph78 ], [ 0, %._crit_edge75 ]
  %47 = getelementptr inbounds [5003 x i32], ptr @finish, i64 0, i64 %indvars.iv87
  %48 = load i32, ptr %47, align 4, !tbaa !10
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [2000000 x %struct.Node], ptr @node, i64 0, i64 %49, i32 4
  %51 = load i32, ptr %50, align 4, !tbaa !15
  %52 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10, i32 noundef %51)
  %indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 1
  %53 = load i32, ptr %1, align 4, !tbaa !10
  %54 = sext i32 %53 to i64
  %55 = icmp slt i64 %indvars.iv.next88, %54
  br i1 %55, label %.lr.ph78, label %._crit_edge79, !llvm.loop !17

._crit_edge79:                                    ; preds = %.lr.ph78, %._crit_edge75
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  ret i32 0
}

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #6

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

attributes #0 = { mustprogress 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 nofree nounwind willreturn memory(argmem: read) "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 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 #4 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 #6 = { noreturn 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 = { noreturn nounwind }
attributes #9 = { nounwind willreturn memory(read) }

!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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !6, i64 0}
!12 = distinct !{!12, !9}
!13 = distinct !{!13, !9}
!14 = distinct !{!14, !9}
!15 = !{!16, !11, i64 412}
!16 = !{!"_ZTS4Node", !6, i64 0, !11, i64 400, !11, i64 404, !6, i64 408, !11, i64 412, !11, i64 416}
!17 = distinct !{!17, !9}


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