; LLVM IR from Tunghohin/Competitive_Coding :: Daimayuan (718)

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

%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@a = external dso_local global [1000010 x i32], align 16
@n = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@spt = external dso_local global [1000010 x [29 x i32]], align 16
@A = external dso_local global i32, align 4
@B = external dso_local global i32, align 4
@C = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [11 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %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 i32, align 4
  %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 @n, ptr noundef @q, ptr noundef @A, ptr noundef @B, ptr noundef @C)
  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 = %30, %0
  %13 = load i32, ptr %2, align 4, !tbaa !5
  %14 = load i32, ptr @n, align 4, !tbaa !5
  %15 = icmp sle i32 %13, %14
  br i1 %15, label %17, label %16

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

17:                                               ; preds = %12
  %18 = call noundef i32 @_Z5rng61v()
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [1000010 x i32], ptr @a, i64 0, i64 %20
  store i32 %18, ptr %21, align 4, !tbaa !5
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [1000010 x i32], ptr @a, i64 0, i64 %23
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [1000010 x [29 x i32]], ptr @spt, i64 0, i64 %27
  %29 = getelementptr inbounds [29 x i32], ptr %28, i64 0, i64 0
  store i32 %25, ptr %29, align 4, !tbaa !5
  br label %30

30:                                               ; preds = %17
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = add nsw i32 %31, 1
  store i32 %32, ptr %2, align 4, !tbaa !5
  br label %12, !llvm.loop !9

33:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %34

34:                                               ; preds = %79, %33
  %35 = load i32, ptr %3, align 4, !tbaa !5
  %36 = icmp sle i32 %35, 20
  br i1 %36, label %38, label %37

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

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

39:                                               ; preds = %75, %38
  %40 = load i32, ptr %5, align 4, !tbaa !5
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = shl i32 1, %41
  %43 = add nsw i32 %40, %42
  %44 = sub nsw i32 %43, 1
  %45 = load i32, ptr @n, align 4, !tbaa !5
  %46 = icmp sle i32 %44, %45
  br i1 %46, label %48, label %47

47:                                               ; preds = %39
  store i32 8, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %78

48:                                               ; preds = %39
  %49 = load i32, ptr %5, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [1000010 x [29 x i32]], ptr @spt, i64 0, i64 %50
  %52 = load i32, ptr %3, align 4, !tbaa !5
  %53 = sub nsw i32 %52, 1
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [29 x i32], ptr %51, i64 0, i64 %54
  %56 = load i32, ptr %5, align 4, !tbaa !5
  %57 = load i32, ptr %3, align 4, !tbaa !5
  %58 = sub nsw i32 %57, 1
  %59 = shl i32 1, %58
  %60 = add nsw i32 %56, %59
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [1000010 x [29 x i32]], ptr @spt, i64 0, i64 %61
  %63 = load i32, ptr %3, align 4, !tbaa !5
  %64 = sub nsw i32 %63, 1
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [29 x i32], ptr %62, i64 0, i64 %65
  %67 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIjERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %55, ptr noundef nonnull align 4 dereferenceable(4) %66)
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = load i32, ptr %5, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [1000010 x [29 x i32]], ptr @spt, i64 0, i64 %70
  %72 = load i32, ptr %3, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [29 x i32], ptr %71, i64 0, i64 %73
  store i32 %68, ptr %74, align 4, !tbaa !5
  br label %75

75:                                               ; preds = %48
  %76 = load i32, ptr %5, align 4, !tbaa !5
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr %5, align 4, !tbaa !5
  br label %39, !llvm.loop !11

78:                                               ; preds = %47
  br label %79

79:                                               ; preds = %78
  %80 = load i32, ptr %3, align 4, !tbaa !5
  %81 = add nsw i32 %80, 1
  store i32 %81, ptr %3, align 4, !tbaa !5
  br label %34, !llvm.loop !12

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

83:                                               ; preds = %127, %82
  %84 = load i32, ptr %7, align 4, !tbaa !5
  %85 = load i32, ptr @q, align 4, !tbaa !5
  %86 = icmp sle i32 %84, %85
  br i1 %86, label %88, label %87

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

88:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %89 = call noundef i32 @_Z5rng61v()
  %90 = load i32, ptr @n, align 4, !tbaa !5
  %91 = urem i32 %89, %90
  %92 = add i32 %91, 1
  store i32 %92, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %93 = call noundef i32 @_Z5rng61v()
  %94 = load i32, ptr @n, align 4, !tbaa !5
  %95 = urem i32 %93, %94
  %96 = add i32 %95, 1
  store i32 %96, ptr %9, align 4, !tbaa !5
  %97 = load i32, ptr %8, align 4, !tbaa !5
  %98 = load i32, ptr %9, align 4, !tbaa !5
  %99 = icmp ugt i32 %97, %98
  br i1 %99, label %100, label %101

100:                                              ; preds = %88
  call void @_ZSt4swapIjENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %9) #5
  br label %101

101:                                              ; preds = %100, %88
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %102 = load i32, ptr %9, align 4, !tbaa !5
  %103 = load i32, ptr %8, align 4, !tbaa !5
  %104 = sub i32 %102, %103
  %105 = add i32 %104, 1
  %106 = call noundef i32 @_ZSt4__lgj(i32 noundef %105)
  store i32 %106, ptr %10, align 4, !tbaa !5
  %107 = load i32, ptr %8, align 4, !tbaa !5
  %108 = zext i32 %107 to i64
  %109 = getelementptr inbounds [1000010 x [29 x i32]], ptr @spt, i64 0, i64 %108
  %110 = load i32, ptr %10, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [29 x i32], ptr %109, i64 0, i64 %111
  %113 = load i32, ptr %9, align 4, !tbaa !5
  %114 = load i32, ptr %10, align 4, !tbaa !5
  %115 = shl i32 1, %114
  %116 = sub i32 %113, %115
  %117 = add i32 %116, 1
  %118 = zext i32 %117 to i64
  %119 = getelementptr inbounds [1000010 x [29 x i32]], ptr @spt, i64 0, i64 %118
  %120 = load i32, ptr %10, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [29 x i32], ptr %119, i64 0, i64 %121
  %123 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIjERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %112, ptr noundef nonnull align 4 dereferenceable(4) %122)
  %124 = load i32, ptr %123, align 4, !tbaa !5
  %125 = load i32, ptr %6, align 4, !tbaa !5
  %126 = xor i32 %125, %124
  store i32 %126, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %127

127:                                              ; preds = %101
  %128 = load i32, ptr %7, align 4, !tbaa !5
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr %7, align 4, !tbaa !5
  br label %83, !llvm.loop !13

130:                                              ; preds = %87
  %131 = load i32, ptr %6, align 4, !tbaa !5
  %132 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEj(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %131)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  %133 = load i32, ptr %1, align 4
  ret i32 %133
}

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z5rng61v() #3

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZSt4__lgj(i32 noundef) #3

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEj(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #4 align 2

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


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

%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@a = external dso_local local_unnamed_addr global [1000010 x i32], align 16
@n = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@spt = external dso_local global [1000010 x [29 x i32]], align 16
@A = external dso_local global i32, align 4
@B = external dso_local global i32, align 4
@C = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [11 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @q, ptr noundef nonnull @A, ptr noundef nonnull @B, ptr noundef nonnull @C)
  %4 = load i32, ptr @n, align 4, !tbaa !5
  %.not34 = icmp slt i32 %4, 1
  br i1 %.not34, label %.preheader32.preheader, label %.lr.ph

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %5 = tail call noundef i32 @_Z5rng61v()
  %6 = getelementptr inbounds [1000010 x i32], ptr @a, i64 0, i64 %indvars.iv
  store i32 %5, ptr %6, align 4, !tbaa !5
  %7 = getelementptr inbounds [1000010 x [29 x i32]], ptr @spt, i64 0, i64 %indvars.iv
  store i32 %5, ptr %7, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %8 = load i32, ptr @n, align 4, !tbaa !5
  %9 = sext i32 %8 to i64
  %.not.not = icmp slt i64 %indvars.iv, %9
  br i1 %.not.not, label %.lr.ph, label %.preheader32.preheader, !llvm.loop !9

.preheader32.preheader:                           ; preds = %.lr.ph, %0
  %.ph = phi i32 [ %4, %0 ], [ %8, %.lr.ph ]
  br label %.preheader32

.preheader32:                                     ; preds = %.preheader32.preheader, %._crit_edge
  %10 = phi i32 [ %18, %._crit_edge ], [ %.ph, %.preheader32.preheader ]
  %indvars.iv49 = phi i64 [ %indvars.iv.next50, %._crit_edge ], [ 1, %.preheader32.preheader ]
  %11 = trunc nuw nsw i64 %indvars.iv49 to i32
  %12 = shl nuw nsw i32 1, %11
  %.not3036 = icmp sgt i32 %12, %10
  br i1 %.not3036, label %._crit_edge, label %.lr.ph38

.lr.ph38:                                         ; preds = %.preheader32
  %13 = add nsw i64 %indvars.iv49, -1
  %14 = trunc nuw nsw i64 %13 to i32
  %15 = shl nuw nsw i32 1, %14
  %16 = zext nneg i32 %15 to i64
  br label %19

.preheader:                                       ; preds = %._crit_edge
  %17 = load i32, ptr @q, align 4, !tbaa !5
  %.not2940 = icmp slt i32 %17, 1
  br i1 %.not2940, label %._crit_edge44, label %.lr.ph43

._crit_edge:                                      ; preds = %19, %.preheader32
  %18 = phi i32 [ %10, %.preheader32 ], [ %26, %19 ]
  %indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next50, 21
  br i1 %exitcond.not, label %.preheader, label %.preheader32, !llvm.loop !11

19:                                               ; preds = %.lr.ph38, %19
  %indvars.iv46 = phi i64 [ 1, %.lr.ph38 ], [ %indvars.iv.next47, %19 ]
  %20 = getelementptr inbounds [1000010 x [29 x i32]], ptr @spt, i64 0, i64 %indvars.iv46, i64 %13
  %21 = add nuw nsw i64 %indvars.iv46, %16
  %22 = getelementptr inbounds [1000010 x [29 x i32]], ptr @spt, i64 0, i64 %21, i64 %13
  %23 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIjERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %20, ptr noundef nonnull align 4 dereferenceable(4) %22)
  %24 = load i32, ptr %23, align 4, !tbaa !5
  %25 = getelementptr inbounds [1000010 x [29 x i32]], ptr @spt, i64 0, i64 %indvars.iv46, i64 %indvars.iv49
  store i32 %24, ptr %25, align 4, !tbaa !5
  %indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1
  %26 = load i32, ptr @n, align 4, !tbaa !5
  %27 = trunc i64 %indvars.iv46 to i32
  %28 = add i32 %12, %27
  %.not30 = icmp sgt i32 %28, %26
  br i1 %.not30, label %._crit_edge, label %19, !llvm.loop !12

._crit_edge44:                                    ; preds = %41, %.preheader
  %.026.lcssa = phi i32 [ 0, %.preheader ], [ %58, %41 ]
  %29 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEj(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.026.lcssa)
  ret i32 0

.lr.ph43:                                         ; preds = %.preheader, %41
  %.02542 = phi i32 [ %59, %41 ], [ 1, %.preheader ]
  %.02641 = phi i32 [ %58, %41 ], [ 0, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  %30 = call noundef i32 @_Z5rng61v()
  %31 = load i32, ptr @n, align 4, !tbaa !5
  %32 = urem i32 %30, %31
  %33 = add nuw i32 %32, 1
  store i32 %33, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  %34 = call noundef i32 @_Z5rng61v()
  %35 = load i32, ptr @n, align 4, !tbaa !5
  %36 = urem i32 %34, %35
  %37 = add nuw i32 %36, 1
  store i32 %37, ptr %2, align 4, !tbaa !5
  %38 = load i32, ptr %1, align 4, !tbaa !5
  %39 = icmp ugt i32 %38, %37
  br i1 %39, label %40, label %41

40:                                               ; preds = %.lr.ph43
  call void @_ZSt4swapIjENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2) #5
  %.pre = load i32, ptr %2, align 4, !tbaa !5
  %.pre52 = load i32, ptr %1, align 4, !tbaa !5
  br label %41

41:                                               ; preds = %40, %.lr.ph43
  %42 = phi i32 [ %.pre52, %40 ], [ %38, %.lr.ph43 ]
  %43 = phi i32 [ %.pre, %40 ], [ %37, %.lr.ph43 ]
  %44 = add i32 %43, 1
  %45 = sub i32 %44, %42
  %46 = call noundef i32 @_ZSt4__lgj(i32 noundef %45)
  %47 = load i32, ptr %1, align 4, !tbaa !5
  %48 = zext i32 %47 to i64
  %49 = sext i32 %46 to i64
  %50 = getelementptr inbounds [1000010 x [29 x i32]], ptr @spt, i64 0, i64 %48, i64 %49
  %51 = load i32, ptr %2, align 4, !tbaa !5
  %.neg = shl nsw i32 -1, %46
  %52 = add nsw i32 %.neg, 1
  %53 = add i32 %52, %51
  %54 = zext i32 %53 to i64
  %55 = getelementptr inbounds [1000010 x [29 x i32]], ptr @spt, i64 0, i64 %54, i64 %49
  %56 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIjERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %50, ptr noundef nonnull align 4 dereferenceable(4) %55)
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = xor i32 %57, %.02641
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  %59 = add nuw nsw i32 %.02542, 1
  %60 = load i32, ptr @q, align 4, !tbaa !5
  %.not29.not = icmp slt i32 %.02542, %60
  br i1 %.not29.not, label %.lr.ph43, label %._crit_edge44, !llvm.loop !13
}

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z5rng61v() local_unnamed_addr #3

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZSt4__lgj(i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEj(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #4 align 2

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


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