; LLVM IR from tangjz/acm-icpc :: lydsy (4195)

; 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
@x = external dso_local global [100001 x i32], align 16
@y = external dso_local global [100001 x i32], align 16
@e = external dso_local global [100001 x i32], align 16
@tot = external dso_local global i32, align 4
@que = external dso_local global [200002 x i32], align 16
@fa = external dso_local global [200002 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = 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 i8, align 1
  %7 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  br label %9

9:                                                ; preds = %182, %0
  %10 = load i32, ptr @t, align 4, !tbaa !5
  %11 = add nsw i32 %10, -1
  store i32 %11, ptr @t, align 4, !tbaa !5
  %12 = icmp ne i32 %10, 0
  br i1 %12, label %13, label %188

13:                                               ; preds = %9
  store i32 0, ptr @tot, align 4, !tbaa !5
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %15

15:                                               ; preds = %47, %13
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = load i32, ptr @n, align 4, !tbaa !5
  %18 = icmp slt i32 %16, %17
  br i1 %18, label %20, label %19

19:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %50

20:                                               ; preds = %15
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds i32, ptr @x, i64 %22
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds i32, ptr @y, i64 %25
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds i32, ptr @e, i64 %28
  %30 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %23, ptr noundef %26, ptr noundef %29)
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [100001 x i32], ptr @x, i64 0, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = load i32, ptr @tot, align 4, !tbaa !5
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr @tot, align 4, !tbaa !5
  %37 = sext i32 %35 to i64
  %38 = getelementptr inbounds [200002 x i32], ptr @que, i64 0, i64 %37
  store i32 %34, ptr %38, align 4, !tbaa !5
  %39 = load i32, ptr %2, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [100001 x i32], ptr @y, i64 0, i64 %40
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = load i32, ptr @tot, align 4, !tbaa !5
  %44 = add nsw i32 %43, 1
  store i32 %44, ptr @tot, align 4, !tbaa !5
  %45 = sext i32 %43 to i64
  %46 = getelementptr inbounds [200002 x i32], ptr @que, i64 0, i64 %45
  store i32 %42, ptr %46, align 4, !tbaa !5
  br label %47

47:                                               ; preds = %20
  %48 = load i32, ptr %2, align 4, !tbaa !5
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %2, align 4, !tbaa !5
  br label %15, !llvm.loop !9

50:                                               ; preds = %19
  %51 = load i32, ptr @tot, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds i32, ptr @que, i64 %52
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef @que, ptr noundef %53)
  %54 = load i32, ptr @tot, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds i32, ptr @que, i64 %55
  %57 = call noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef @que, ptr noundef %56)
  %58 = ptrtoint ptr %57 to i64
  %59 = sub i64 %58, ptrtoint (ptr @que to i64)
  %60 = sdiv exact i64 %59, 4
  %61 = trunc i64 %60 to i32
  store i32 %61, ptr @tot, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %62

62:                                               ; preds = %96, %50
  %63 = load i32, ptr %3, align 4, !tbaa !5
  %64 = load i32, ptr @n, align 4, !tbaa !5
  %65 = icmp slt i32 %63, %64
  br i1 %65, label %67, label %66

66:                                               ; preds = %62
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %99

67:                                               ; preds = %62
  %68 = load i32, ptr @tot, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds i32, ptr @que, i64 %69
  %71 = load i32, ptr %3, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [100001 x i32], ptr @x, i64 0, i64 %72
  %74 = call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef @que, ptr noundef %70, ptr noundef nonnull align 4 dereferenceable(4) %73)
  %75 = ptrtoint ptr %74 to i64
  %76 = sub i64 %75, ptrtoint (ptr @que to i64)
  %77 = sdiv exact i64 %76, 4
  %78 = trunc i64 %77 to i32
  %79 = load i32, ptr %3, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [100001 x i32], ptr @x, i64 0, i64 %80
  store i32 %78, ptr %81, align 4, !tbaa !5
  %82 = load i32, ptr @tot, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds i32, ptr @que, i64 %83
  %85 = load i32, ptr %3, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [100001 x i32], ptr @y, i64 0, i64 %86
  %88 = call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef @que, ptr noundef %84, ptr noundef nonnull align 4 dereferenceable(4) %87)
  %89 = ptrtoint ptr %88 to i64
  %90 = sub i64 %89, ptrtoint (ptr @que to i64)
  %91 = sdiv exact i64 %90, 4
  %92 = trunc i64 %91 to i32
  %93 = load i32, ptr %3, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [100001 x i32], ptr @y, i64 0, i64 %94
  store i32 %92, ptr %95, align 4, !tbaa !5
  br label %96

96:                                               ; preds = %67
  %97 = load i32, ptr %3, align 4, !tbaa !5
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr %3, align 4, !tbaa !5
  br label %62, !llvm.loop !11

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

100:                                              ; preds = %110, %99
  %101 = load i32, ptr %4, align 4, !tbaa !5
  %102 = load i32, ptr @tot, align 4, !tbaa !5
  %103 = icmp slt i32 %101, %102
  br i1 %103, label %105, label %104

104:                                              ; preds = %100
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %113

105:                                              ; preds = %100
  %106 = load i32, ptr %4, align 4, !tbaa !5
  %107 = load i32, ptr %4, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [200002 x i32], ptr @fa, i64 0, i64 %108
  store i32 %106, ptr %109, align 4, !tbaa !5
  br label %110

110:                                              ; preds = %105
  %111 = load i32, ptr %4, align 4, !tbaa !5
  %112 = add nsw i32 %111, 1
  store i32 %112, ptr %4, align 4, !tbaa !5
  br label %100, !llvm.loop !12

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

114:                                              ; preds = %139, %113
  %115 = load i32, ptr %5, align 4, !tbaa !5
  %116 = load i32, ptr @n, align 4, !tbaa !5
  %117 = icmp slt i32 %115, %116
  br i1 %117, label %119, label %118

118:                                              ; preds = %114
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %142

119:                                              ; preds = %114
  %120 = load i32, ptr %5, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [100001 x i32], ptr @e, 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 %138

125:                                              ; preds = %119
  %126 = load i32, ptr %5, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [100001 x i32], ptr @y, 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 %5, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [100001 x i32], ptr @x, i64 0, i64 %132
  %134 = load i32, ptr %133, align 4, !tbaa !5
  %135 = call noundef i32 @_Z4findi(i32 noundef %134)
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [200002 x i32], ptr @fa, i64 0, i64 %136
  store i32 %130, ptr %137, align 4, !tbaa !5
  br label %138

138:                                              ; preds = %125, %119
  br label %139

139:                                              ; preds = %138
  %140 = load i32, ptr %5, align 4, !tbaa !5
  %141 = add nsw i32 %140, 1
  store i32 %141, ptr %5, align 4, !tbaa !5
  br label %114, !llvm.loop !13

142:                                              ; preds = %118
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #5
  store i8 1, ptr %6, align 1, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %143

143:                                              ; preds = %179, %142
  %144 = load i32, ptr %7, align 4, !tbaa !5
  %145 = load i32, ptr @n, align 4, !tbaa !5
  %146 = icmp slt i32 %144, %145
  br i1 %146, label %147, label %150

147:                                              ; preds = %143
  %148 = load i8, ptr %6, align 1, !tbaa !14, !range !16, !noundef !17
  %149 = trunc i8 %148 to i1
  br label %150

150:                                              ; preds = %147, %143
  %151 = phi i1 [ false, %143 ], [ %149, %147 ]
  br i1 %151, label %153, label %152

152:                                              ; preds = %150
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %182

153:                                              ; preds = %150
  %154 = load i32, ptr %7, align 4, !tbaa !5
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [100001 x i32], ptr @e, i64 0, i64 %155
  %157 = load i32, ptr %156, align 4, !tbaa !5
  %158 = icmp ne i32 %157, 0
  br i1 %158, label %178, label %159

159:                                              ; preds = %153
  %160 = load i32, ptr %7, align 4, !tbaa !5
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds [100001 x i32], ptr @x, i64 0, i64 %161
  %163 = load i32, ptr %162, align 4, !tbaa !5
  %164 = call noundef i32 @_Z4findi(i32 noundef %163)
  %165 = load i32, ptr %7, align 4, !tbaa !5
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds [100001 x i32], ptr @y, i64 0, i64 %166
  %168 = load i32, ptr %167, align 4, !tbaa !5
  %169 = call noundef i32 @_Z4findi(i32 noundef %168)
  %170 = icmp ne i32 %164, %169
  %171 = zext i1 %170 to i32
  %172 = load i8, ptr %6, align 1, !tbaa !14, !range !16, !noundef !17
  %173 = trunc i8 %172 to i1
  %174 = zext i1 %173 to i32
  %175 = and i32 %174, %171
  %176 = icmp ne i32 %175, 0
  %177 = zext i1 %176 to i8
  store i8 %177, ptr %6, align 1, !tbaa !14
  br label %178

178:                                              ; preds = %159, %153
  br label %179

179:                                              ; preds = %178
  %180 = load i32, ptr %7, align 4, !tbaa !5
  %181 = add nsw i32 %180, 1
  store i32 %181, ptr %7, align 4, !tbaa !5
  br label %143, !llvm.loop !18

182:                                              ; preds = %152
  %183 = load i8, ptr %6, align 1, !tbaa !14, !range !16, !noundef !17
  %184 = trunc i8 %183 to i1
  %185 = zext i1 %184 to i64
  %186 = select i1 %184, ptr @.str.2, ptr @.str.3
  %187 = call i32 @puts(ptr noundef %186)
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #5
  br label %9, !llvm.loop !19

188:                                              ; preds = %9
  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: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPiEvT_S1_(ptr noundef, ptr noundef) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef, ptr noundef) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) #4

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 = { inlinehint 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 #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 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = !{!15, !15, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !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
@x = external dso_local global [100001 x i32], align 16
@y = external dso_local global [100001 x i32], align 16
@e = external dso_local global [100001 x i32], align 16
@tot = external dso_local local_unnamed_addr global i32, align 4
@que = external dso_local global [200002 x i32], align 16
@fa = external dso_local local_unnamed_addr global [200002 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = 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 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %2 = load i32, ptr @t, align 4, !tbaa !5
  %3 = add nsw i32 %2, -1
  store i32 %3, ptr @t, align 4, !tbaa !5
  %.not51 = icmp eq i32 %2, 0
  br i1 %.not51, label %._crit_edge54, label %.lr.ph53

.lr.ph53:                                         ; preds = %0, %83
  store i32 0, ptr @tot, align 4, !tbaa !5
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %5 = load i32, ptr @n, align 4, !tbaa !5
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph, label %.lr.ph53.._crit_edge_crit_edge

.lr.ph53.._crit_edge_crit_edge:                   ; preds = %.lr.ph53
  %.pre = load i32, ptr @tot, align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph53.._crit_edge_crit_edge
  %7 = phi i32 [ %.pre, %.lr.ph53.._crit_edge_crit_edge ], [ %30, %.lr.ph ]
  %8 = sext i32 %7 to i64
  %9 = getelementptr inbounds i32, ptr @que, i64 %8
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull @que, ptr noundef nonnull %9)
  %10 = load i32, ptr @tot, align 4, !tbaa !5
  %11 = sext i32 %10 to i64
  %12 = getelementptr inbounds i32, ptr @que, i64 %11
  %13 = tail call noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef nonnull @que, ptr noundef nonnull %12)
  %14 = ptrtoint ptr %13 to i64
  %15 = sub i64 %14, ptrtoint (ptr @que to i64)
  %16 = lshr exact i64 %15, 2
  %17 = trunc i64 %16 to i32
  store i32 %17, ptr @tot, align 4, !tbaa !5
  %18 = load i32, ptr @n, align 4, !tbaa !5
  %19 = icmp sgt i32 %18, 0
  br i1 %19, label %.lr.ph42, label %.preheader38

.lr.ph:                                           ; preds = %.lr.ph53, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph53 ]
  %20 = getelementptr inbounds i32, ptr @x, i64 %indvars.iv
  %21 = getelementptr inbounds i32, ptr @y, i64 %indvars.iv
  %22 = getelementptr inbounds i32, ptr @e, i64 %indvars.iv
  %23 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %20, ptr noundef nonnull %21, ptr noundef nonnull %22)
  %24 = load i32, ptr %20, align 4, !tbaa !5
  %25 = load i32, ptr @tot, align 4, !tbaa !5
  %26 = add nsw i32 %25, 1
  %27 = sext i32 %25 to i64
  %28 = getelementptr inbounds [200002 x i32], ptr @que, i64 0, i64 %27
  store i32 %24, ptr %28, align 4, !tbaa !5
  %29 = load i32, ptr %21, align 4, !tbaa !5
  %30 = add nsw i32 %25, 2
  store i32 %30, ptr @tot, align 4, !tbaa !5
  %31 = sext i32 %26 to i64
  %32 = getelementptr inbounds [200002 x i32], ptr @que, i64 0, i64 %31
  store i32 %29, ptr %32, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %33 = load i32, ptr @n, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = icmp slt i64 %indvars.iv.next, %34
  br i1 %35, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.preheader38.loopexit:                            ; preds = %.lr.ph42
  %.pre67 = load i32, ptr @tot, align 4, !tbaa !5
  br label %.preheader38

.preheader38:                                     ; preds = %.preheader38.loopexit, %._crit_edge
  %36 = phi i32 [ %60, %.preheader38.loopexit ], [ %18, %._crit_edge ]
  %37 = phi i32 [ %.pre67, %.preheader38.loopexit ], [ %17, %._crit_edge ]
  %38 = icmp sgt i32 %37, 0
  br i1 %38, label %.lr.ph44.preheader, label %.preheader37

.lr.ph44.preheader:                               ; preds = %.preheader38
  %wide.trip.count = zext nneg i32 %37 to i64
  %min.iters.check = icmp ult i32 %37, 8
  br i1 %min.iters.check, label %.lr.ph44.preheader76, label %vector.ph

.lr.ph44.preheader76:                             ; preds = %middle.block, %.lr.ph44.preheader
  %indvars.iv59.ph = phi i64 [ 0, %.lr.ph44.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph44

vector.ph:                                        ; preds = %.lr.ph44.preheader
  %n.vec = and i64 %wide.trip.count, 2147483640
  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 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
  %39 = getelementptr inbounds [200002 x i32], ptr @fa, i64 0, i64 %index
  %40 = getelementptr inbounds i8, ptr %39, i64 16
  store <4 x i32> %vec.ind, ptr %39, align 16, !tbaa !5
  store <4 x i32> %step.add, ptr %40, align 16, !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>
  %41 = icmp eq i64 %index.next, %n.vec
  br i1 %41, label %middle.block, label %vector.body, !llvm.loop !11

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %.preheader37, label %.lr.ph44.preheader76

.lr.ph42:                                         ; preds = %._crit_edge, %.lr.ph42
  %indvars.iv56 = phi i64 [ %indvars.iv.next57, %.lr.ph42 ], [ 0, %._crit_edge ]
  %42 = load i32, ptr @tot, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds i32, ptr @que, i64 %43
  %45 = getelementptr inbounds [100001 x i32], ptr @x, i64 0, i64 %indvars.iv56
  %46 = tail call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef nonnull @que, ptr noundef nonnull %44, ptr noundef nonnull align 4 dereferenceable(4) %45)
  %47 = ptrtoint ptr %46 to i64
  %48 = sub i64 %47, ptrtoint (ptr @que to i64)
  %49 = lshr exact i64 %48, 2
  %50 = trunc i64 %49 to i32
  store i32 %50, ptr %45, align 4, !tbaa !5
  %51 = load i32, ptr @tot, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds i32, ptr @que, i64 %52
  %54 = getelementptr inbounds [100001 x i32], ptr @y, i64 0, i64 %indvars.iv56
  %55 = tail call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef nonnull @que, ptr noundef nonnull %53, ptr noundef nonnull align 4 dereferenceable(4) %54)
  %56 = ptrtoint ptr %55 to i64
  %57 = sub i64 %56, ptrtoint (ptr @que to i64)
  %58 = lshr exact i64 %57, 2
  %59 = trunc i64 %58 to i32
  store i32 %59, ptr %54, align 4, !tbaa !5
  %indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
  %60 = load i32, ptr @n, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = icmp slt i64 %indvars.iv.next57, %61
  br i1 %62, label %.lr.ph42, label %.preheader38.loopexit, !llvm.loop !14

.preheader37:                                     ; preds = %.lr.ph44, %middle.block, %.preheader38
  %63 = icmp sgt i32 %36, 0
  br i1 %63, label %.lr.ph46, label %._crit_edge50.thread

.lr.ph44:                                         ; preds = %.lr.ph44.preheader76, %.lr.ph44
  %indvars.iv59 = phi i64 [ %indvars.iv.next60, %.lr.ph44 ], [ %indvars.iv59.ph, %.lr.ph44.preheader76 ]
  %64 = getelementptr inbounds [200002 x i32], ptr @fa, i64 0, i64 %indvars.iv59
  %65 = trunc nuw nsw i64 %indvars.iv59 to i32
  store i32 %65, ptr %64, align 4, !tbaa !5
  %indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next60, %wide.trip.count
  br i1 %exitcond.not, label %.preheader37, label %.lr.ph44, !llvm.loop !15

.preheader:                                       ; preds = %79
  %66 = icmp sgt i32 %80, 0
  br i1 %66, label %.lr.ph49, label %._crit_edge50.thread

.lr.ph46:                                         ; preds = %.preheader37, %79
  %67 = phi i32 [ %80, %79 ], [ %36, %.preheader37 ]
  %indvars.iv62 = phi i64 [ %indvars.iv.next63, %79 ], [ 0, %.preheader37 ]
  %68 = getelementptr inbounds [100001 x i32], ptr @e, i64 0, i64 %indvars.iv62
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %.not36 = icmp eq i32 %69, 0
  br i1 %.not36, label %79, label %70

70:                                               ; preds = %.lr.ph46
  %71 = getelementptr inbounds [100001 x i32], ptr @y, i64 0, i64 %indvars.iv62
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = tail call noundef i32 @_Z4findi(i32 noundef %72)
  %74 = getelementptr inbounds [100001 x i32], ptr @x, i64 0, i64 %indvars.iv62
  %75 = load i32, ptr %74, align 4, !tbaa !5
  %76 = tail call noundef i32 @_Z4findi(i32 noundef %75)
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [200002 x i32], ptr @fa, i64 0, i64 %77
  store i32 %73, ptr %78, align 4, !tbaa !5
  %.pre68 = load i32, ptr @n, align 4, !tbaa !5
  br label %79

79:                                               ; preds = %.lr.ph46, %70
  %80 = phi i32 [ %67, %.lr.ph46 ], [ %.pre68, %70 ]
  %indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
  %81 = sext i32 %80 to i64
  %82 = icmp slt i64 %indvars.iv.next63, %81
  br i1 %82, label %.lr.ph46, label %.preheader, !llvm.loop !16

._crit_edge50:                                    ; preds = %99
  br i1 %.1, label %._crit_edge50.thread, label %83

._crit_edge50.thread:                             ; preds = %.preheader37, %.preheader, %._crit_edge50
  br label %83

83:                                               ; preds = %._crit_edge50, %._crit_edge50.thread
  %84 = phi ptr [ @.str.2, %._crit_edge50.thread ], [ @.str.3, %._crit_edge50 ]
  %85 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) %84)
  %86 = load i32, ptr @t, align 4, !tbaa !5
  %87 = add nsw i32 %86, -1
  store i32 %87, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %86, 0
  br i1 %.not, label %._crit_edge54, label %.lr.ph53, !llvm.loop !17

.lr.ph49:                                         ; preds = %.preheader, %99
  %88 = phi i32 [ %100, %99 ], [ %80, %.preheader ]
  %indvars.iv65 = phi i64 [ %indvars.iv.next66, %99 ], [ 0, %.preheader ]
  %89 = getelementptr inbounds [100001 x i32], ptr @e, i64 0, i64 %indvars.iv65
  %90 = load i32, ptr %89, align 4, !tbaa !5
  %.not35 = icmp eq i32 %90, 0
  br i1 %.not35, label %91, label %99

91:                                               ; preds = %.lr.ph49
  %92 = getelementptr inbounds [100001 x i32], ptr @x, i64 0, i64 %indvars.iv65
  %93 = load i32, ptr %92, align 4, !tbaa !5
  %94 = tail call noundef i32 @_Z4findi(i32 noundef %93)
  %95 = getelementptr inbounds [100001 x i32], ptr @y, i64 0, i64 %indvars.iv65
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = tail call noundef i32 @_Z4findi(i32 noundef %96)
  %98 = icmp ne i32 %94, %97
  %.pre69 = load i32, ptr @n, align 4, !tbaa !5
  br label %99

99:                                               ; preds = %.lr.ph49, %91
  %100 = phi i32 [ %88, %.lr.ph49 ], [ %.pre69, %91 ]
  %.1 = phi i1 [ true, %.lr.ph49 ], [ %98, %91 ]
  %indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, 1
  %101 = sext i32 %100 to i64
  %102 = icmp slt i64 %indvars.iv.next66, %101
  %103 = and i1 %102, %.1
  br i1 %103, label %.lr.ph49, label %._crit_edge50, !llvm.loop !18

._crit_edge54:                                    ; preds = %83, %0
  ret i32 0
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPiEvT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

; 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 = { inlinehint 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" }

!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 = distinct !{!14, !10}
!15 = distinct !{!15, !10, !13, !12}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}


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