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

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

@n = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@val = external dso_local global [131072 x i32], align 16
@tot = external dso_local global i32, align 4
@pre = external dso_local global [131072 x i32], align 16
@in = external dso_local global [131072 x i32], align 16
@out = external dso_local global [131072 x i32], align 16
@seg = external dso_local global [262144 x i32], align 16
@rt = external dso_local global i32, align 4
@e = external dso_local global [131072 x %struct.Edge], align 16
@.str = external hidden unnamed_addr constant [5 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 [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3minii(i32 noundef, i32 noundef) #0

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

; Function Attrs: 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 @_Z3updiiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z3queiiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsi(i32 noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3lcaii(i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3lccii(i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %struct.Edge, align 4
  %5 = alloca i32, align 4
  %6 = alloca [2 x i8], align 1
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @q)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %10

10:                                               ; preds = %41, %0
  %11 = load i32, ptr %2, align 4, !tbaa !5
  %12 = load i32, ptr @n, align 4, !tbaa !5
  %13 = icmp sle i32 %11, %12
  br i1 %13, label %15, label %14

14:                                               ; preds = %10
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %44

15:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds i32, ptr @val, i64 %17
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %3, ptr noundef %18)
  %20 = load i32, ptr %3, align 4, !tbaa !5
  %21 = icmp ne i32 %20, 0
  br i1 %21, label %24, label %22

22:                                               ; preds = %15
  %23 = load i32, ptr %2, align 4, !tbaa !5
  store i32 %23, ptr @rt, align 4, !tbaa !5
  br label %40

24:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  %25 = getelementptr inbounds %struct.Edge, ptr %4, i32 0, i32 0
  %26 = load i32, ptr %3, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [131072 x i32], ptr @pre, i64 0, i64 %27
  %29 = load i32, ptr %28, align 4, !tbaa !5
  store i32 %29, ptr %25, align 4, !tbaa !9
  %30 = getelementptr inbounds %struct.Edge, ptr %4, i32 0, i32 1
  %31 = load i32, ptr %2, align 4, !tbaa !5
  store i32 %31, ptr %30, align 4, !tbaa !11
  %32 = load i32, ptr @tot, align 4, !tbaa !5
  %33 = add nsw i32 %32, 1
  store i32 %33, ptr @tot, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [131072 x %struct.Edge], ptr @e, i64 0, i64 %34
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %35, ptr align 4 %4, i64 8, i1 false), !tbaa.struct !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  %36 = load i32, ptr @tot, align 4, !tbaa !5
  %37 = load i32, ptr %3, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [131072 x i32], ptr @pre, i64 0, i64 %38
  store i32 %36, ptr %39, align 4, !tbaa !5
  br label %40

40:                                               ; preds = %24, %22
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %41

41:                                               ; preds = %40
  %42 = load i32, ptr %2, align 4, !tbaa !5
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %2, align 4, !tbaa !5
  br label %10, !llvm.loop !13

44:                                               ; preds = %14
  store i32 0, ptr @tot, align 4, !tbaa !5
  %45 = load i32, ptr @rt, align 4, !tbaa !5
  call void @_Z3dfsi(i32 noundef %45)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %46

46:                                               ; preds = %142, %44
  %47 = load i32, ptr %5, align 4, !tbaa !5
  %48 = load i32, ptr @q, align 4, !tbaa !5
  %49 = icmp sle i32 %47, %48
  br i1 %49, label %51, label %50

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

51:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 2, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %52 = getelementptr inbounds [2 x i8], ptr %6, i64 0, i64 0
  %53 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %52, ptr noundef %7)
  %54 = getelementptr inbounds [2 x i8], ptr %6, i64 0, i64 0
  %55 = load i8, ptr %54, align 1, !tbaa !15
  %56 = sext i8 %55 to i32
  %57 = icmp eq i32 %56, 86
  br i1 %57, label %58, label %66

58:                                               ; preds = %51
  %59 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %8)
  %60 = load i32, ptr @n, align 4, !tbaa !5
  %61 = load i32, ptr %7, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [131072 x i32], ptr @in, i64 0, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = load i32, ptr %8, align 4, !tbaa !5
  call void @_Z3updiiiii(i32 noundef 1, i32 noundef 1, i32 noundef %60, i32 noundef %64, i32 noundef %65)
  br label %141

66:                                               ; preds = %51
  %67 = getelementptr inbounds [2 x i8], ptr %6, i64 0, i64 0
  %68 = load i8, ptr %67, align 1, !tbaa !15
  %69 = sext i8 %68 to i32
  %70 = icmp eq i32 %69, 69
  br i1 %70, label %71, label %73

71:                                               ; preds = %66
  %72 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %72, ptr @rt, align 4, !tbaa !5
  br label %140

73:                                               ; preds = %66
  %74 = load i32, ptr @rt, align 4, !tbaa !5
  %75 = load i32, ptr %7, align 4, !tbaa !5
  %76 = icmp eq i32 %74, %75
  br i1 %76, label %77, label %80

77:                                               ; preds = %73
  %78 = load i32, ptr getelementptr inbounds ([262144 x i32], ptr @seg, i64 0, i64 1), align 4, !tbaa !5
  %79 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %78)
  br label %139

80:                                               ; preds = %73
  %81 = load i32, ptr %7, align 4, !tbaa !5
  %82 = load i32, ptr @rt, align 4, !tbaa !5
  %83 = call noundef i32 @_Z3lcaii(i32 noundef %81, i32 noundef %82)
  %84 = load i32, ptr %7, align 4, !tbaa !5
  %85 = icmp ne i32 %83, %84
  br i1 %85, label %86, label %98

86:                                               ; preds = %80
  %87 = load i32, ptr @n, align 4, !tbaa !5
  %88 = load i32, ptr %7, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [131072 x i32], ptr @in, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = load i32, ptr %7, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [131072 x i32], ptr @out, i64 0, i64 %93
  %95 = load i32, ptr %94, align 4, !tbaa !5
  %96 = call noundef i32 @_Z3queiiiii(i32 noundef 1, i32 noundef 1, i32 noundef %87, i32 noundef %91, i32 noundef %95)
  %97 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %96)
  br label %138

98:                                               ; preds = %80
  %99 = load i32, ptr %7, align 4, !tbaa !5
  %100 = load i32, ptr @rt, align 4, !tbaa !5
  %101 = call noundef i32 @_Z3lccii(i32 noundef %99, i32 noundef %100)
  store i32 %101, ptr %8, align 4, !tbaa !5
  %102 = load i32, ptr %8, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [131072 x i32], ptr @in, i64 0, i64 %103
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = icmp sgt i32 %105, 1
  br i1 %106, label %107, label %115

107:                                              ; preds = %98
  %108 = load i32, ptr @n, align 4, !tbaa !5
  %109 = load i32, ptr %8, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [131072 x i32], ptr @in, i64 0, i64 %110
  %112 = load i32, ptr %111, align 4, !tbaa !5
  %113 = sub nsw i32 %112, 1
  %114 = call noundef i32 @_Z3queiiiii(i32 noundef 1, i32 noundef 1, i32 noundef %108, i32 noundef 1, i32 noundef %113)
  br label %116

115:                                              ; preds = %98
  br label %116

116:                                              ; preds = %115, %107
  %117 = phi i32 [ %114, %107 ], [ 1061109567, %115 ]
  %118 = load i32, ptr %8, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [131072 x i32], ptr @out, i64 0, i64 %119
  %121 = load i32, ptr %120, align 4, !tbaa !5
  %122 = load i32, ptr @n, align 4, !tbaa !5
  %123 = icmp slt i32 %121, %122
  br i1 %123, label %124, label %133

124:                                              ; preds = %116
  %125 = load i32, ptr @n, align 4, !tbaa !5
  %126 = load i32, ptr %8, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [131072 x i32], ptr @out, i64 0, i64 %127
  %129 = load i32, ptr %128, align 4, !tbaa !5
  %130 = add nsw i32 %129, 1
  %131 = load i32, ptr @n, align 4, !tbaa !5
  %132 = call noundef i32 @_Z3queiiiii(i32 noundef 1, i32 noundef 1, i32 noundef %125, i32 noundef %130, i32 noundef %131)
  br label %134

133:                                              ; preds = %116
  br label %134

134:                                              ; preds = %133, %124
  %135 = phi i32 [ %132, %124 ], [ 1061109567, %133 ]
  %136 = call noundef i32 @_Z3minii(i32 noundef %117, i32 noundef %135)
  %137 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %136)
  br label %138

138:                                              ; preds = %134, %86
  br label %139

139:                                              ; preds = %138, %77
  br label %140

140:                                              ; preds = %139, %71
  br label %141

141:                                              ; preds = %140, %58
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 2, ptr %6) #6
  br label %142

142:                                              ; preds = %141
  %143 = load i32, ptr %5, align 4, !tbaa !5
  %144 = add nsw i32 %143, 1
  store i32 %144, ptr %5, align 4, !tbaa !5
  br label %46, !llvm.loop !16

145:                                              ; preds = %50
  ret i32 0
}

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

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

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 = { 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 #3 = { 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 #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 = !{!10, !6, i64 0}
!10 = !{!"_ZTS4Edge", !6, i64 0, !6, i64 4}
!11 = !{!10, !6, i64 4}
!12 = !{i64 0, i64 4, !5, i64 4, i64 4, !5}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!7, !7, i64 0}
!16 = distinct !{!16, !14}


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

@n = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@val = external dso_local global [131072 x i32], align 16
@tot = external dso_local local_unnamed_addr global i32, align 4
@pre = external dso_local local_unnamed_addr global [131072 x i32], align 16
@in = external dso_local local_unnamed_addr global [131072 x i32], align 16
@out = external dso_local local_unnamed_addr global [131072 x i32], align 16
@seg = external dso_local local_unnamed_addr global [262144 x i32], align 16
@rt = external dso_local local_unnamed_addr global i32, align 4
@e = external dso_local local_unnamed_addr global [131072 x %struct.Edge], align 16
@.str = external hidden unnamed_addr constant [5 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 [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3minii(i32 noundef, i32 noundef) 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 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 @_Z3updiiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z3queiiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsi(i32 noundef) local_unnamed_addr #2

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

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

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

._crit_edge:                                      ; preds = %23, %0
  store i32 0, ptr @tot, align 4, !tbaa !5
  %7 = load i32, ptr @rt, align 4, !tbaa !5
  call void @_Z3dfsi(i32 noundef %7)
  %8 = load i32, ptr @q, align 4, !tbaa !5
  %.not1621 = icmp slt i32 %8, 1
  br i1 %.not1621, label %._crit_edge25, label %.lr.ph24

.lr.ph:                                           ; preds = %0, %23
  %indvars.iv = phi i64 [ %indvars.iv.next, %23 ], [ 1, %0 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  %9 = getelementptr inbounds i32, ptr @val, i64 %indvars.iv
  %10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %9)
  %11 = load i32, ptr %1, align 4, !tbaa !5
  %.not18 = icmp eq i32 %11, 0
  br i1 %.not18, label %12, label %14

12:                                               ; preds = %.lr.ph
  %13 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %13, ptr @rt, align 4, !tbaa !5
  br label %23

14:                                               ; preds = %.lr.ph
  %15 = sext i32 %11 to i64
  %16 = getelementptr inbounds [131072 x i32], ptr @pre, i64 0, i64 %15
  %17 = load i32, ptr %16, align 4, !tbaa !5
  %18 = load i32, ptr @tot, align 4, !tbaa !5
  %19 = add nsw i32 %18, 1
  store i32 %19, ptr @tot, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [131072 x %struct.Edge], ptr @e, i64 0, i64 %20
  store i32 %17, ptr %21, align 8, !tbaa !5
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %21, i64 4
  %22 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %22, ptr %.sroa.4.0..sroa_idx, align 4, !tbaa !5
  store i32 %19, ptr %16, align 4, !tbaa !5
  br label %23

23:                                               ; preds = %14, %12
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %24 = load i32, ptr @n, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %.not.not = icmp slt i64 %indvars.iv, %25
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge25:                                    ; preds = %81, %._crit_edge
  ret i32 0

.lr.ph24:                                         ; preds = %._crit_edge, %81
  %.022 = phi i32 [ %82, %81 ], [ 1, %._crit_edge ]
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  %26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %27 = load i8, ptr %2, align 1, !tbaa !11
  switch i8 %27, label %38 [
    i8 86, label %28
    i8 69, label %36
  ]

28:                                               ; preds = %.lr.ph24
  %29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %4)
  %30 = load i32, ptr @n, align 4, !tbaa !5
  %31 = load i32, ptr %3, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [131072 x i32], ptr @in, i64 0, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = load i32, ptr %4, align 4, !tbaa !5
  call void @_Z3updiiiii(i32 noundef 1, i32 noundef 1, i32 noundef %30, i32 noundef %34, i32 noundef %35)
  br label %81

36:                                               ; preds = %.lr.ph24
  %37 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %37, ptr @rt, align 4, !tbaa !5
  br label %81

38:                                               ; preds = %.lr.ph24
  %39 = load i32, ptr @rt, align 4, !tbaa !5
  %40 = load i32, ptr %3, align 4, !tbaa !5
  %41 = icmp eq i32 %39, %40
  br i1 %41, label %42, label %45

42:                                               ; preds = %38
  %43 = load i32, ptr getelementptr inbounds (i8, ptr @seg, i64 4), align 4, !tbaa !5
  %44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %43)
  br label %81

45:                                               ; preds = %38
  %46 = call noundef i32 @_Z3lcaii(i32 noundef %40, i32 noundef %39)
  %47 = load i32, ptr %3, align 4, !tbaa !5
  %.not17 = icmp eq i32 %46, %47
  br i1 %.not17, label %57, label %48

48:                                               ; preds = %45
  %49 = load i32, ptr @n, align 4, !tbaa !5
  %50 = sext i32 %47 to i64
  %51 = getelementptr inbounds [131072 x i32], ptr @in, i64 0, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = getelementptr inbounds [131072 x i32], ptr @out, i64 0, i64 %50
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = call noundef i32 @_Z3queiiiii(i32 noundef 1, i32 noundef 1, i32 noundef %49, i32 noundef %52, i32 noundef %54)
  %56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %55)
  br label %81

57:                                               ; preds = %45
  %58 = load i32, ptr @rt, align 4, !tbaa !5
  %59 = call noundef i32 @_Z3lccii(i32 noundef %46, i32 noundef %58)
  store i32 %59, ptr %4, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [131072 x i32], ptr @in, i64 0, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = icmp sgt i32 %62, 1
  br i1 %63, label %64, label %68

64:                                               ; preds = %57
  %65 = load i32, ptr @n, align 4, !tbaa !5
  %66 = add nsw i32 %62, -1
  %67 = call noundef i32 @_Z3queiiiii(i32 noundef 1, i32 noundef 1, i32 noundef %65, i32 noundef 1, i32 noundef %66)
  %.pre = load i32, ptr %4, align 4, !tbaa !5
  %.pre27 = sext i32 %.pre to i64
  br label %68

68:                                               ; preds = %57, %64
  %.pre-phi = phi i64 [ %60, %57 ], [ %.pre27, %64 ]
  %69 = phi i32 [ 1061109567, %57 ], [ %67, %64 ]
  %70 = getelementptr inbounds [131072 x i32], ptr @out, i64 0, i64 %.pre-phi
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = load i32, ptr @n, align 4, !tbaa !5
  %73 = icmp slt i32 %71, %72
  br i1 %73, label %74, label %77

74:                                               ; preds = %68
  %75 = add nsw i32 %71, 1
  %76 = call noundef i32 @_Z3queiiiii(i32 noundef 1, i32 noundef 1, i32 noundef %72, i32 noundef %75, i32 noundef %72)
  br label %77

77:                                               ; preds = %68, %74
  %78 = phi i32 [ %76, %74 ], [ 1061109567, %68 ]
  %79 = call noundef i32 @_Z3minii(i32 noundef %69, i32 noundef %78)
  %80 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %79)
  br label %81

81:                                               ; preds = %36, %48, %77, %42, %28
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %2) #5
  %82 = add nuw nsw i32 %.022, 1
  %83 = load i32, ptr @q, align 4, !tbaa !5
  %.not16.not = icmp slt i32 %.022, %83
  br i1 %.not16.not, label %.lr.ph24, label %._crit_edge25, !llvm.loop !12
}

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

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

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 uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 = distinct !{!12, !10}


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass