; LLVM IR from tangjz/acm-icpc :: uvalive (6910)

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

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@p = external dso_local global [20010 x i32], align 16
@typ = external dso_local global [5010 x i32], align 16
@x = external dso_local global [5010 x i32], align 16
@y = external dso_local global [5010 x i32], align 16
@fa = external dso_local global [20010 x i32], align 16
@ans = external dso_local global [5010 x i32], align 16
@vis = external dso_local global [20010 x i8], align 16
@used = external dso_local global [5010 x i8], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z4findi(i32 noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #1 {
  %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
  %6 = alloca [10 x i8], align 1
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %12

12:                                               ; preds = %232, %0
  %13 = load i32, ptr %2, align 4, !tbaa !5
  %14 = load i32, ptr @t, align 4, !tbaa !5
  %15 = icmp sle i32 %13, %14
  br i1 %15, label %17, label %16

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

17:                                               ; preds = %12
  %18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @n, ptr noundef @q)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %19

19:                                               ; preds = %29, %17
  %20 = load i32, ptr %4, align 4, !tbaa !5
  %21 = load i32, ptr @n, align 4, !tbaa !5
  %22 = icmp sle i32 %20, %21
  br i1 %22, label %24, label %23

23:                                               ; preds = %19
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %32

24:                                               ; preds = %19
  %25 = load i32, ptr %4, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds i32, ptr @p, i64 %26
  %28 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %27)
  br label %29

29:                                               ; preds = %24
  %30 = load i32, ptr %4, align 4, !tbaa !5
  %31 = add nsw i32 %30, 1
  store i32 %31, ptr %4, align 4, !tbaa !5
  br label %19, !llvm.loop !9

32:                                               ; preds = %23
  call void @llvm.memset.p0.i64(ptr align 16 @vis, i8 0, i64 20010, i1 false)
  call void @llvm.memset.p0.i64(ptr align 16 @used, i8 0, i64 5010, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %33

33:                                               ; preds = %90, %32
  %34 = load i32, ptr %5, align 4, !tbaa !5
  %35 = load i32, ptr @q, align 4, !tbaa !5
  %36 = icmp sle i32 %34, %35
  br i1 %36, label %38, label %37

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

38:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 10, ptr %6) #5
  %39 = getelementptr inbounds [10 x i8], ptr %6, i64 0, i64 0
  %40 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %39)
  %41 = getelementptr inbounds [10 x i8], ptr %6, i64 0, i64 0
  %42 = load i8, ptr %41, align 1, !tbaa !11
  %43 = sext i8 %42 to i32
  %44 = icmp eq i32 %43, 67
  %45 = zext i1 %44 to i32
  %46 = load i32, ptr %5, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [5010 x i32], ptr @typ, i64 0, i64 %47
  store i32 %45, ptr %48, align 4, !tbaa !5
  %49 = load i32, ptr %5, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [5010 x i32], ptr @typ, i64 0, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = icmp eq i32 %52, 1
  br i1 %53, label %54, label %78

54:                                               ; preds = %38
  %55 = load i32, ptr %5, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds i32, ptr @x, i64 %56
  %58 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %57)
  %59 = load i32, ptr %5, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [5010 x i32], ptr @x, i64 0, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [20010 x i8], ptr @vis, i64 0, i64 %63
  %65 = load i8, ptr %64, align 1, !tbaa !12, !range !14, !noundef !15
  %66 = trunc i8 %65 to i1
  br i1 %66, label %77, label %67

67:                                               ; preds = %54
  %68 = load i32, ptr %5, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [5010 x i8], ptr @used, i64 0, i64 %69
  store i8 1, ptr %70, align 1, !tbaa !12
  %71 = load i32, ptr %5, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [5010 x i32], ptr @x, i64 0, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [20010 x i8], ptr @vis, i64 0, i64 %75
  store i8 1, ptr %76, align 1, !tbaa !12
  br label %77

77:                                               ; preds = %67, %54
  br label %89

78:                                               ; preds = %38
  %79 = load i32, ptr %5, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds i32, ptr @x, i64 %80
  %82 = load i32, ptr %5, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds i32, ptr @y, i64 %83
  %85 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %81, ptr noundef %84)
  %86 = load i32, ptr %5, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [5010 x i8], ptr @used, i64 0, i64 %87
  store i8 1, ptr %88, align 1, !tbaa !12
  br label %89

89:                                               ; preds = %78, %77
  call void @llvm.lifetime.end.p0(i64 10, ptr %6) #5
  br label %90

90:                                               ; preds = %89
  %91 = load i32, ptr %5, align 4, !tbaa !5
  %92 = add nsw i32 %91, 1
  store i32 %92, ptr %5, align 4, !tbaa !5
  br label %33, !llvm.loop !16

93:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %94

94:                                               ; preds = %104, %93
  %95 = load i32, ptr %7, align 4, !tbaa !5
  %96 = load i32, ptr @n, align 4, !tbaa !5
  %97 = icmp sle i32 %95, %96
  br i1 %97, label %99, label %98

98:                                               ; preds = %94
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %107

99:                                               ; preds = %94
  %100 = load i32, ptr %7, align 4, !tbaa !5
  %101 = load i32, ptr %7, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [20010 x i32], ptr @fa, i64 0, i64 %102
  store i32 %100, ptr %103, align 4, !tbaa !5
  br label %104

104:                                              ; preds = %99
  %105 = load i32, ptr %7, align 4, !tbaa !5
  %106 = add nsw i32 %105, 1
  store i32 %106, ptr %7, align 4, !tbaa !5
  br label %94, !llvm.loop !17

107:                                              ; preds = %98
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %108

108:                                              ; preds = %136, %107
  %109 = load i32, ptr %8, align 4, !tbaa !5
  %110 = load i32, ptr @n, align 4, !tbaa !5
  %111 = icmp sle i32 %109, %110
  br i1 %111, label %113, label %112

112:                                              ; preds = %108
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %139

113:                                              ; preds = %108
  %114 = load i32, ptr %8, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [20010 x i8], ptr @vis, i64 0, i64 %115
  %117 = load i8, ptr %116, align 1, !tbaa !12, !range !14, !noundef !15
  %118 = trunc i8 %117 to i1
  br i1 %118, label %135, label %119

119:                                              ; preds = %113
  %120 = load i32, ptr %8, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [20010 x i32], ptr @p, i64 0, i64 %121
  %123 = load i32, ptr %122, align 4, !tbaa !5
  %124 = icmp ne i32 %123, 0
  br i1 %124, label %125, label %135

125:                                              ; preds = %119
  %126 = load i32, ptr %8, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [20010 x i32], ptr @p, i64 0, i64 %127
  %129 = load i32, ptr %128, align 4, !tbaa !5
  %130 = call noundef i32 @_Z4findi(i32 noundef %129)
  %131 = load i32, ptr %8, align 4, !tbaa !5
  %132 = call noundef i32 @_Z4findi(i32 noundef %131)
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [20010 x i32], ptr @fa, i64 0, i64 %133
  store i32 %130, ptr %134, align 4, !tbaa !5
  br label %135

135:                                              ; preds = %125, %119, %113
  br label %136

136:                                              ; preds = %135
  %137 = load i32, ptr %8, align 4, !tbaa !5
  %138 = add nsw i32 %137, 1
  store i32 %138, ptr %8, align 4, !tbaa !5
  br label %108, !llvm.loop !18

139:                                              ; preds = %112
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %140 = load i32, ptr @q, align 4, !tbaa !5
  store i32 %140, ptr %9, align 4, !tbaa !5
  br label %141

141:                                              ; preds = %201, %139
  %142 = load i32, ptr %9, align 4, !tbaa !5
  %143 = icmp sge i32 %142, 1
  br i1 %143, label %145, label %144

144:                                              ; preds = %141
  store i32 17, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %204

145:                                              ; preds = %141
  %146 = load i32, ptr %9, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [5010 x i8], ptr @used, i64 0, i64 %147
  %149 = load i8, ptr %148, align 1, !tbaa !12, !range !14, !noundef !15
  %150 = trunc i8 %149 to i1
  br i1 %150, label %152, label %151

151:                                              ; preds = %145
  br label %201

152:                                              ; preds = %145
  %153 = load i32, ptr %9, align 4, !tbaa !5
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [5010 x i32], ptr @typ, i64 0, i64 %154
  %156 = load i32, ptr %155, align 4, !tbaa !5
  %157 = icmp ne i32 %156, 0
  br i1 %157, label %174, label %158

158:                                              ; preds = %152
  %159 = load i32, ptr %9, align 4, !tbaa !5
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [5010 x i32], ptr @x, i64 0, i64 %160
  %162 = load i32, ptr %161, align 4, !tbaa !5
  %163 = call noundef i32 @_Z4findi(i32 noundef %162)
  %164 = load i32, ptr %9, align 4, !tbaa !5
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [5010 x i32], ptr @y, i64 0, i64 %165
  %167 = load i32, ptr %166, align 4, !tbaa !5
  %168 = call noundef i32 @_Z4findi(i32 noundef %167)
  %169 = icmp eq i32 %163, %168
  %170 = zext i1 %169 to i32
  %171 = load i32, ptr %9, align 4, !tbaa !5
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds [5010 x i32], ptr @ans, i64 0, i64 %172
  store i32 %170, ptr %173, align 4, !tbaa !5
  br label %200

174:                                              ; preds = %152
  %175 = load i32, ptr %9, align 4, !tbaa !5
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds [5010 x i32], ptr @x, i64 0, i64 %176
  %178 = load i32, ptr %177, align 4, !tbaa !5
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [20010 x i32], ptr @p, i64 0, i64 %179
  %181 = load i32, ptr %180, align 4, !tbaa !5
  %182 = icmp ne i32 %181, 0
  br i1 %182, label %183, label %199

183:                                              ; preds = %174
  %184 = load i32, ptr %9, align 4, !tbaa !5
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds [5010 x i32], ptr @x, i64 0, i64 %185
  %187 = load i32, ptr %186, align 4, !tbaa !5
  %188 = sext i32 %187 to i64
  %189 = getelementptr inbounds [20010 x i32], ptr @p, i64 0, i64 %188
  %190 = load i32, ptr %189, align 4, !tbaa !5
  %191 = call noundef i32 @_Z4findi(i32 noundef %190)
  %192 = load i32, ptr %9, align 4, !tbaa !5
  %193 = sext i32 %192 to i64
  %194 = getelementptr inbounds [5010 x i32], ptr @x, i64 0, i64 %193
  %195 = load i32, ptr %194, align 4, !tbaa !5
  %196 = call noundef i32 @_Z4findi(i32 noundef %195)
  %197 = sext i32 %196 to i64
  %198 = getelementptr inbounds [20010 x i32], ptr @fa, i64 0, i64 %197
  store i32 %191, ptr %198, align 4, !tbaa !5
  br label %199

199:                                              ; preds = %183, %174
  br label %200

200:                                              ; preds = %199, %158
  br label %201

201:                                              ; preds = %200, %151
  %202 = load i32, ptr %9, align 4, !tbaa !5
  %203 = add nsw i32 %202, -1
  store i32 %203, ptr %9, align 4, !tbaa !5
  br label %141, !llvm.loop !19

204:                                              ; preds = %144
  %205 = load i32, ptr %2, align 4, !tbaa !5
  %206 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %205)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %207

207:                                              ; preds = %228, %204
  %208 = load i32, ptr %10, align 4, !tbaa !5
  %209 = load i32, ptr @q, align 4, !tbaa !5
  %210 = icmp sle i32 %208, %209
  br i1 %210, label %212, label %211

211:                                              ; preds = %207
  store i32 20, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %231

212:                                              ; preds = %207
  %213 = load i32, ptr %10, align 4, !tbaa !5
  %214 = sext i32 %213 to i64
  %215 = getelementptr inbounds [5010 x i32], ptr @typ, i64 0, i64 %214
  %216 = load i32, ptr %215, align 4, !tbaa !5
  %217 = icmp ne i32 %216, 0
  br i1 %217, label %227, label %218

218:                                              ; preds = %212
  %219 = load i32, ptr %10, align 4, !tbaa !5
  %220 = sext i32 %219 to i64
  %221 = getelementptr inbounds [5010 x i32], ptr @ans, i64 0, i64 %220
  %222 = load i32, ptr %221, align 4, !tbaa !5
  %223 = icmp ne i32 %222, 0
  %224 = zext i1 %223 to i64
  %225 = select i1 %223, ptr @.str.4, ptr @.str.5
  %226 = call i32 @puts(ptr noundef %225)
  br label %227

227:                                              ; preds = %218, %212
  br label %228

228:                                              ; preds = %227
  %229 = load i32, ptr %10, align 4, !tbaa !5
  %230 = add nsw i32 %229, 1
  store i32 %230, ptr %10, align 4, !tbaa !5
  br label %207, !llvm.loop !20

231:                                              ; preds = %211
  br label %232

232:                                              ; preds = %231
  %233 = load i32, ptr %2, align 4, !tbaa !5
  %234 = add nsw i32 %233, 1
  store i32 %234, ptr %2, align 4, !tbaa !5
  br label %12, !llvm.loop !21

235:                                              ; preds = %16
  ret i32 0
}

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

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

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

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

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

declare i32 @puts(ptr noundef) #2

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

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

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


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

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@p = external dso_local global [20010 x i32], align 16
@typ = external dso_local local_unnamed_addr global [5010 x i32], align 16
@x = external dso_local global [5010 x i32], align 16
@y = external dso_local global [5010 x i32], align 16
@fa = external dso_local local_unnamed_addr global [20010 x i32], align 16
@ans = external dso_local local_unnamed_addr global [5010 x i32], align 16
@vis = external dso_local local_unnamed_addr global [20010 x i8], align 16
@used = external dso_local local_unnamed_addr global [5010 x i8], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z4findi(i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = alloca [10 x i8], align 1
  %2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %3 = load i32, ptr @t, align 4, !tbaa !5
  %.not82 = icmp slt i32 %3, 1
  br i1 %.not82, label %._crit_edge86, label %.lr.ph85

._crit_edge86:                                    ; preds = %._crit_edge81, %0
  ret i32 0

.lr.ph85:                                         ; preds = %0, %._crit_edge81
  %.04683 = phi i32 [ %92, %._crit_edge81 ], [ 1, %0 ]
  %4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n, ptr noundef nonnull @q)
  %5 = load i32, ptr @n, align 4, !tbaa !5
  %.not4960 = icmp slt i32 %5, 1
  br i1 %.not4960, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph85
  %6 = phi i32 [ %5, %.lr.ph85 ], [ %10, %.lr.ph ]
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(20010) @vis, i8 0, i64 20010, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(5010) @used, i8 0, i64 5010, i1 false)
  %7 = load i32, ptr @q, align 4, !tbaa !5
  %.not5062 = icmp slt i32 %7, 1
  br i1 %.not5062, label %.preheader59, label %.lr.ph65

.lr.ph:                                           ; preds = %.lr.ph85, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %.lr.ph85 ]
  %8 = getelementptr inbounds i32, ptr @p, i64 %indvars.iv
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %8)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %10 = load i32, ptr @n, align 4, !tbaa !5
  %11 = sext i32 %10 to i64
  %.not49.not = icmp slt i64 %indvars.iv, %11
  br i1 %.not49.not, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.preheader59.loopexit:                            ; preds = %38
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  br label %.preheader59

.preheader59:                                     ; preds = %.preheader59.loopexit, %._crit_edge
  %12 = phi i32 [ %39, %.preheader59.loopexit ], [ %7, %._crit_edge ]
  %13 = phi i32 [ %.pre, %.preheader59.loopexit ], [ %6, %._crit_edge ]
  %.not5166 = icmp slt i32 %13, 1
  br i1 %.not5166, label %._crit_edge72, label %.lr.ph68.preheader

.lr.ph68.preheader:                               ; preds = %.preheader59
  %14 = add nuw i32 %13, 1
  %wide.trip.count = zext i32 %14 to i64
  %15 = zext nneg i32 %13 to i64
  %min.iters.check = icmp ult i32 %13, 8
  br i1 %min.iters.check, label %.lr.ph68.preheader109, label %vector.ph

.lr.ph68.preheader109:                            ; preds = %middle.block, %.lr.ph68.preheader
  %indvars.iv91.ph = phi i64 [ 1, %.lr.ph68.preheader ], [ %ind.end, %middle.block ]
  br label %.lr.ph68

vector.ph:                                        ; preds = %.lr.ph68.preheader
  %n.vec = and i64 %15, 2147483640
  %ind.end = or disjoint i64 %n.vec, 1
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
  %offset.idx = or disjoint i64 %index, 1
  %16 = getelementptr inbounds [20010 x i32], ptr @fa, i64 0, i64 %offset.idx
  %17 = getelementptr inbounds i8, ptr %16, i64 16
  store <4 x i32> %vec.ind, ptr %16, align 4, !tbaa !5
  store <4 x i32> %step.add, ptr %17, align 4, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
  %18 = icmp eq i64 %index.next, %n.vec
  br i1 %18, label %middle.block, label %vector.body, !llvm.loop !11

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %15
  br i1 %cmp.n, label %.preheader, label %.lr.ph68.preheader109

.lr.ph65:                                         ; preds = %._crit_edge, %38
  %indvars.iv88 = phi i64 [ %indvars.iv.next89, %38 ], [ 1, %._crit_edge ]
  call void @llvm.lifetime.start.p0(i64 10, ptr nonnull %1) #5
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %1)
  %20 = load i8, ptr %1, align 1, !tbaa !14
  %21 = icmp eq i8 %20, 67
  %22 = zext i1 %21 to i32
  %23 = getelementptr inbounds [5010 x i32], ptr @typ, i64 0, i64 %indvars.iv88
  store i32 %22, ptr %23, align 4, !tbaa !5
  %24 = getelementptr inbounds i32, ptr @x, i64 %indvars.iv88
  br i1 %21, label %25, label %34

25:                                               ; preds = %.lr.ph65
  %26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %24)
  %27 = load i32, ptr %24, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [20010 x i8], ptr @vis, i64 0, i64 %28
  %30 = load i8, ptr %29, align 1, !tbaa !15, !range !17, !noundef !18
  %31 = trunc nuw i8 %30 to i1
  br i1 %31, label %38, label %32

32:                                               ; preds = %25
  %33 = getelementptr inbounds [5010 x i8], ptr @used, i64 0, i64 %indvars.iv88
  store i8 1, ptr %33, align 1, !tbaa !15
  br label %.sink.split

34:                                               ; preds = %.lr.ph65
  %35 = getelementptr inbounds i32, ptr @y, i64 %indvars.iv88
  %36 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %24, ptr noundef nonnull %35)
  %37 = getelementptr inbounds [5010 x i8], ptr @used, i64 0, i64 %indvars.iv88
  br label %.sink.split

.sink.split:                                      ; preds = %34, %32
  %.sink = phi ptr [ %29, %32 ], [ %37, %34 ]
  store i8 1, ptr %.sink, align 1, !tbaa !15
  br label %38

38:                                               ; preds = %.sink.split, %25
  call void @llvm.lifetime.end.p0(i64 10, ptr nonnull %1) #5
  %indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
  %39 = load i32, ptr @q, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %.not50.not = icmp slt i64 %indvars.iv88, %40
  br i1 %.not50.not, label %.lr.ph65, label %.preheader59.loopexit, !llvm.loop !19

.preheader:                                       ; preds = %.lr.ph68, %middle.block
  br i1 %.not5166, label %._crit_edge72, label %.lr.ph71

.lr.ph68:                                         ; preds = %.lr.ph68.preheader109, %.lr.ph68
  %indvars.iv91 = phi i64 [ %indvars.iv.next92, %.lr.ph68 ], [ %indvars.iv91.ph, %.lr.ph68.preheader109 ]
  %41 = getelementptr inbounds [20010 x i32], ptr @fa, i64 0, i64 %indvars.iv91
  %42 = trunc nuw nsw i64 %indvars.iv91 to i32
  store i32 %42, ptr %41, align 4, !tbaa !5
  %indvars.iv.next92 = add nuw nsw i64 %indvars.iv91, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next92, %wide.trip.count
  br i1 %exitcond.not, label %.preheader, label %.lr.ph68, !llvm.loop !20

._crit_edge72.loopexit:                           ; preds = %59
  %.pre104 = load i32, ptr @q, align 4, !tbaa !5
  br label %._crit_edge72

._crit_edge72:                                    ; preds = %.preheader59, %._crit_edge72.loopexit, %.preheader
  %43 = phi i32 [ %.pre104, %._crit_edge72.loopexit ], [ %12, %.preheader ], [ %12, %.preheader59 ]
  %44 = icmp sgt i32 %43, 0
  br i1 %44, label %.lr.ph75.preheader, label %._crit_edge76

.lr.ph75.preheader:                               ; preds = %._crit_edge72
  %45 = zext nneg i32 %43 to i64
  br label %.lr.ph75

.lr.ph71:                                         ; preds = %.preheader, %59
  %46 = phi i32 [ %60, %59 ], [ %13, %.preheader ]
  %indvars.iv94 = phi i64 [ %indvars.iv.next95, %59 ], [ 1, %.preheader ]
  %47 = getelementptr inbounds [20010 x i8], ptr @vis, i64 0, i64 %indvars.iv94
  %48 = load i8, ptr %47, align 1, !tbaa !15, !range !17, !noundef !18
  %49 = trunc nuw i8 %48 to i1
  br i1 %49, label %59, label %50

50:                                               ; preds = %.lr.ph71
  %51 = getelementptr inbounds [20010 x i32], ptr @p, i64 0, i64 %indvars.iv94
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %.not58 = icmp eq i32 %52, 0
  br i1 %.not58, label %59, label %53

53:                                               ; preds = %50
  %54 = call noundef i32 @_Z4findi(i32 noundef %52)
  %55 = trunc nuw nsw i64 %indvars.iv94 to i32
  %56 = call noundef i32 @_Z4findi(i32 noundef %55)
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [20010 x i32], ptr @fa, i64 0, i64 %57
  store i32 %54, ptr %58, align 4, !tbaa !5
  %.pre103 = load i32, ptr @n, align 4, !tbaa !5
  br label %59

59:                                               ; preds = %.lr.ph71, %50, %53
  %60 = phi i32 [ %46, %.lr.ph71 ], [ %46, %50 ], [ %.pre103, %53 ]
  %indvars.iv.next95 = add nuw nsw i64 %indvars.iv94, 1
  %61 = sext i32 %60 to i64
  %.not52.not = icmp slt i64 %indvars.iv94, %61
  br i1 %.not52.not, label %.lr.ph71, label %._crit_edge72.loopexit, !llvm.loop !21

._crit_edge76:                                    ; preds = %90, %._crit_edge72
  %62 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %.04683)
  %63 = load i32, ptr @q, align 4, !tbaa !5
  %.not5377 = icmp slt i32 %63, 1
  br i1 %.not5377, label %._crit_edge81, label %.lr.ph80

.lr.ph75:                                         ; preds = %.lr.ph75.preheader, %90
  %indvars.iv97 = phi i64 [ %45, %.lr.ph75.preheader ], [ %indvars.iv.next98, %90 ]
  %64 = getelementptr inbounds [5010 x i8], ptr @used, i64 0, i64 %indvars.iv97
  %65 = load i8, ptr %64, align 1, !tbaa !15, !range !17, !noundef !18
  %66 = trunc nuw i8 %65 to i1
  br i1 %66, label %67, label %90

67:                                               ; preds = %.lr.ph75
  %68 = getelementptr inbounds [5010 x i32], ptr @typ, i64 0, i64 %indvars.iv97
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %.not56 = icmp eq i32 %69, 0
  %70 = getelementptr inbounds [5010 x i32], ptr @x, i64 0, i64 %indvars.iv97
  %71 = load i32, ptr %70, align 4, !tbaa !5
  br i1 %.not56, label %72, label %80

72:                                               ; preds = %67
  %73 = call noundef i32 @_Z4findi(i32 noundef %71)
  %74 = getelementptr inbounds [5010 x i32], ptr @y, i64 0, i64 %indvars.iv97
  %75 = load i32, ptr %74, align 4, !tbaa !5
  %76 = call noundef i32 @_Z4findi(i32 noundef %75)
  %77 = icmp eq i32 %73, %76
  %78 = zext i1 %77 to i32
  %79 = getelementptr inbounds [5010 x i32], ptr @ans, i64 0, i64 %indvars.iv97
  store i32 %78, ptr %79, align 4, !tbaa !5
  br label %90

80:                                               ; preds = %67
  %81 = sext i32 %71 to i64
  %82 = getelementptr inbounds [20010 x i32], ptr @p, i64 0, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %.not57 = icmp eq i32 %83, 0
  br i1 %.not57, label %90, label %84

84:                                               ; preds = %80
  %85 = call noundef i32 @_Z4findi(i32 noundef %83)
  %86 = load i32, ptr %70, align 4, !tbaa !5
  %87 = call noundef i32 @_Z4findi(i32 noundef %86)
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [20010 x i32], ptr @fa, i64 0, i64 %88
  store i32 %85, ptr %89, align 4, !tbaa !5
  br label %90

90:                                               ; preds = %72, %84, %80, %.lr.ph75
  %indvars.iv.next98 = add nsw i64 %indvars.iv97, -1
  %91 = icmp sgt i64 %indvars.iv97, 1
  br i1 %91, label %.lr.ph75, label %._crit_edge76, !llvm.loop !22

._crit_edge81:                                    ; preds = %102, %._crit_edge76
  %92 = add nuw nsw i32 %.04683, 1
  %93 = load i32, ptr @t, align 4, !tbaa !5
  %.not.not = icmp slt i32 %.04683, %93
  br i1 %.not.not, label %.lr.ph85, label %._crit_edge86, !llvm.loop !23

.lr.ph80:                                         ; preds = %._crit_edge76, %102
  %94 = phi i32 [ %103, %102 ], [ %63, %._crit_edge76 ]
  %indvars.iv100 = phi i64 [ %indvars.iv.next101, %102 ], [ 1, %._crit_edge76 ]
  %95 = getelementptr inbounds [5010 x i32], ptr @typ, i64 0, i64 %indvars.iv100
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %.not54 = icmp eq i32 %96, 0
  br i1 %.not54, label %97, label %102

97:                                               ; preds = %.lr.ph80
  %98 = getelementptr inbounds [5010 x i32], ptr @ans, i64 0, i64 %indvars.iv100
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %.not55 = icmp eq i32 %99, 0
  %100 = select i1 %.not55, ptr @.str.5, ptr @.str.4
  %101 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %100)
  %.pre105 = load i32, ptr @q, align 4, !tbaa !5
  br label %102

102:                                              ; preds = %.lr.ph80, %97
  %103 = phi i32 [ %94, %.lr.ph80 ], [ %.pre105, %97 ]
  %indvars.iv.next101 = add nuw nsw i64 %indvars.iv100, 1
  %104 = sext i32 %103 to i64
  %.not53.not = icmp slt i64 %indvars.iv100, %104
  br i1 %.not53.not, label %.lr.ph80, label %._crit_edge81, !llvm.loop !24
}

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

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

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

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2

attributes #0 = { 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 #1 = { 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 #2 = { 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }

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

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


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,SROAPass,SimplifyCFGPass,TailCallElimPass