; LLVM IR from tangjz/acm-icpc :: hdu (6356)

; 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
@m = external dso_local global i32, align 4
@mx = external dso_local global i32, align 4
@Log = external dso_local global [100001 x i32], align 16
@a = external dso_local global [17 x [100001 x i32]], align 16
@X = external dso_local global i32, align 4
@Y = external dso_local global i32, align 4
@Z = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1

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

12:                                               ; preds = %26, %0
  %13 = load i32, ptr %2, align 4, !tbaa !5
  %14 = icmp slt i32 %13, 100001
  br i1 %14, label %16, label %15

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

16:                                               ; preds = %12
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = ashr i32 %17, 1
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [100001 x i32], ptr @Log, i64 0, i64 %19
  %21 = load i32, ptr %20, align 4, !tbaa !5
  %22 = add nsw i32 %21, 1
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [100001 x i32], ptr @Log, i64 0, i64 %24
  store i32 %22, ptr %25, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %16
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = add nsw i32 %27, 1
  store i32 %28, ptr %2, align 4, !tbaa !5
  br label %12, !llvm.loop !9

29:                                               ; preds = %15
  %30 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  br label %31

31:                                               ; preds = %178, %29
  %32 = load i32, ptr @t, align 4, !tbaa !5
  %33 = add nsw i32 %32, -1
  store i32 %33, ptr @t, align 4, !tbaa !5
  %34 = icmp ne i32 %32, 0
  br i1 %34, label %35, label %181

35:                                               ; preds = %31
  %36 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @n, ptr noundef @m, ptr noundef @X, ptr noundef @Y, ptr noundef @Z)
  store i32 0, ptr @mx, align 4, !tbaa !5
  br label %37

37:                                               ; preds = %43, %35
  %38 = load i32, ptr @mx, align 4, !tbaa !5
  %39 = shl i32 1, %38
  %40 = load i32, ptr @n, align 4, !tbaa !5
  %41 = icmp sle i32 %39, %40
  br i1 %41, label %42, label %46

42:                                               ; preds = %37
  br label %43

43:                                               ; preds = %42
  %44 = load i32, ptr @mx, align 4, !tbaa !5
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr @mx, align 4, !tbaa !5
  br label %37, !llvm.loop !11

46:                                               ; preds = %37
  br label %47

47:                                               ; preds = %66, %46
  %48 = load i32, ptr @m, align 4, !tbaa !5
  %49 = add nsw i32 %48, -1
  store i32 %49, ptr @m, align 4, !tbaa !5
  %50 = icmp ne i32 %48, 0
  br i1 %50, label %51, label %92

51:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  %52 = call noundef i32 @_Z5rng61v()
  %53 = load i32, ptr @n, align 4, !tbaa !5
  %54 = urem i32 %52, %53
  %55 = add i32 %54, 1
  store i32 %55, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  %56 = call noundef i32 @_Z5rng61v()
  %57 = load i32, ptr @n, align 4, !tbaa !5
  %58 = urem i32 %56, %57
  %59 = add i32 %58, 1
  store i32 %59, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %60 = call noundef i32 @_Z5rng61v()
  %61 = and i32 %60, 1073741823
  store i32 %61, ptr %5, align 4, !tbaa !5
  %62 = load i32, ptr %3, align 4, !tbaa !5
  %63 = load i32, ptr %4, align 4, !tbaa !5
  %64 = icmp sgt i32 %62, %63
  br i1 %64, label %65, label %66

65:                                               ; preds = %51
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4) #5
  br label %66

66:                                               ; preds = %65, %51
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %67 = load i32, ptr %4, align 4, !tbaa !5
  %68 = load i32, ptr %3, align 4, !tbaa !5
  %69 = sub nsw i32 %67, %68
  %70 = add nsw i32 %69, 1
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [100001 x i32], ptr @Log, i64 0, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !5
  store i32 %73, ptr %6, align 4, !tbaa !5
  %74 = load i32, ptr %6, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [17 x [100001 x i32]], ptr @a, i64 0, i64 %75
  %77 = load i32, ptr %3, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [100001 x i32], ptr %76, i64 0, i64 %78
  %80 = load i32, ptr %5, align 4, !tbaa !5
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) %79, i32 noundef %80)
  %81 = load i32, ptr %6, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [17 x [100001 x i32]], ptr @a, i64 0, i64 %82
  %84 = load i32, ptr %4, align 4, !tbaa !5
  %85 = load i32, ptr %6, align 4, !tbaa !5
  %86 = shl i32 1, %85
  %87 = sub nsw i32 %84, %86
  %88 = add nsw i32 %87, 1
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [100001 x i32], ptr %83, i64 0, i64 %89
  %91 = load i32, ptr %5, align 4, !tbaa !5
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) %90, i32 noundef %91)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %47, !llvm.loop !12

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

95:                                               ; preds = %152, %92
  %96 = load i32, ptr %7, align 4, !tbaa !5
  %97 = icmp sgt i32 %96, 0
  br i1 %97, label %99, label %98

98:                                               ; preds = %95
  store i32 12, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %155

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

100:                                              ; preds = %148, %99
  %101 = load i32, ptr %9, align 4, !tbaa !5
  %102 = load i32, ptr %7, align 4, !tbaa !5
  %103 = shl i32 1, %102
  %104 = add nsw i32 %101, %103
  %105 = sub nsw i32 %104, 1
  %106 = load i32, ptr @n, align 4, !tbaa !5
  %107 = icmp sle i32 %105, %106
  br i1 %107, label %109, label %108

108:                                              ; preds = %100
  store i32 15, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %151

109:                                              ; preds = %100
  %110 = load i32, ptr %7, align 4, !tbaa !5
  %111 = sub nsw i32 %110, 1
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [17 x [100001 x i32]], ptr @a, i64 0, i64 %112
  %114 = load i32, ptr %9, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [100001 x i32], ptr %113, i64 0, i64 %115
  %117 = load i32, ptr %7, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [17 x [100001 x i32]], ptr @a, i64 0, i64 %118
  %120 = load i32, ptr %9, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [100001 x i32], ptr %119, i64 0, i64 %121
  %123 = load i32, ptr %122, align 4, !tbaa !5
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) %116, i32 noundef %123)
  %124 = load i32, ptr %7, align 4, !tbaa !5
  %125 = sub nsw i32 %124, 1
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [17 x [100001 x i32]], ptr @a, i64 0, i64 %126
  %128 = load i32, ptr %9, align 4, !tbaa !5
  %129 = load i32, ptr %7, align 4, !tbaa !5
  %130 = sub nsw i32 %129, 1
  %131 = shl i32 1, %130
  %132 = add nsw i32 %128, %131
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [100001 x i32], ptr %127, i64 0, i64 %133
  %135 = load i32, ptr %7, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [17 x [100001 x i32]], ptr @a, i64 0, i64 %136
  %138 = load i32, ptr %9, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [100001 x i32], ptr %137, i64 0, i64 %139
  %141 = load i32, ptr %140, align 4, !tbaa !5
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) %134, i32 noundef %141)
  %142 = load i32, ptr %7, align 4, !tbaa !5
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [17 x [100001 x i32]], ptr @a, i64 0, i64 %143
  %145 = load i32, ptr %9, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [100001 x i32], ptr %144, i64 0, i64 %146
  store i32 0, ptr %147, align 4, !tbaa !5
  br label %148

148:                                              ; preds = %109
  %149 = load i32, ptr %9, align 4, !tbaa !5
  %150 = add nsw i32 %149, 1
  store i32 %150, ptr %9, align 4, !tbaa !5
  br label %100, !llvm.loop !13

151:                                              ; preds = %108
  br label %152

152:                                              ; preds = %151
  %153 = load i32, ptr %7, align 4, !tbaa !5
  %154 = add nsw i32 %153, -1
  store i32 %154, ptr %7, align 4, !tbaa !5
  br label %95, !llvm.loop !14

155:                                              ; preds = %98
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  store i64 0, ptr %10, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %156

156:                                              ; preds = %175, %155
  %157 = load i32, ptr %11, align 4, !tbaa !5
  %158 = load i32, ptr @n, align 4, !tbaa !5
  %159 = icmp sle i32 %157, %158
  br i1 %159, label %161, label %160

160:                                              ; preds = %156
  store i32 18, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %178

161:                                              ; preds = %156
  %162 = load i32, ptr %11, align 4, !tbaa !5
  %163 = sext i32 %162 to i64
  %164 = load i32, ptr %11, align 4, !tbaa !5
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %165
  %167 = load i32, ptr %166, align 4, !tbaa !5
  %168 = sext i32 %167 to i64
  %169 = mul nsw i64 %163, %168
  %170 = load i64, ptr %10, align 8, !tbaa !15
  %171 = xor i64 %170, %169
  store i64 %171, ptr %10, align 8, !tbaa !15
  %172 = load i32, ptr %11, align 4, !tbaa !5
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %173
  store i32 0, ptr %174, align 4, !tbaa !5
  br label %175

175:                                              ; preds = %161
  %176 = load i32, ptr %11, align 4, !tbaa !5
  %177 = add nsw i32 %176, 1
  store i32 %177, ptr %11, align 4, !tbaa !5
  br label %156, !llvm.loop !17

178:                                              ; preds = %160
  %179 = load i64, ptr %10, align 8, !tbaa !15
  %180 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i64 noundef %179)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %31, !llvm.loop !18

181:                                              ; preds = %31
  ret i32 0
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIiENSt9enable_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)) #4

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

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

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 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 #3 = { "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 = { 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 #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 = distinct !{!14, !10}
!15 = !{!16, !16, i64 0}
!16 = !{!"long long", !7, i64 0}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !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
@m = external dso_local global i32, align 4
@mx = external dso_local local_unnamed_addr global i32, align 4
@Log = external dso_local local_unnamed_addr global [100001 x i32], align 16
@a = external dso_local global [17 x [100001 x i32]], align 16
@X = external dso_local global i32, align 4
@Y = external dso_local global i32, align 4
@Z = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z5rng61v() 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 norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  br label %7

3:                                                ; preds = %7
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %5 = load i32, ptr @t, align 4, !tbaa !5
  %6 = add nsw i32 %5, -1
  store i32 %6, ptr @t, align 4, !tbaa !5
  %.not56 = icmp eq i32 %5, 0
  br i1 %.not56, label %._crit_edge59, label %.lr.ph58

7:                                                ; preds = %7, %0
  %indvars.iv = phi i64 [ 2, %0 ], [ %indvars.iv.next.2, %7 ]
  %8 = lshr i64 %indvars.iv, 1
  %9 = and i64 %8, 2147483647
  %10 = getelementptr inbounds [100001 x i32], ptr @Log, i64 0, i64 %9
  %11 = load i32, ptr %10, align 4, !tbaa !5
  %12 = add nsw i32 %11, 1
  %13 = getelementptr inbounds [100001 x i32], ptr @Log, i64 0, i64 %indvars.iv
  store i32 %12, ptr %13, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %14 = lshr i64 %indvars.iv.next, 1
  %15 = and i64 %14, 2147483647
  %16 = getelementptr inbounds [100001 x i32], ptr @Log, i64 0, i64 %15
  %17 = load i32, ptr %16, align 4, !tbaa !5
  %18 = add nsw i32 %17, 1
  %19 = getelementptr inbounds [100001 x i32], ptr @Log, i64 0, i64 %indvars.iv.next
  store i32 %18, ptr %19, align 4, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %20 = lshr i64 %indvars.iv.next.1, 1
  %21 = and i64 %20, 2147483647
  %22 = getelementptr inbounds [100001 x i32], ptr @Log, i64 0, i64 %21
  %23 = load i32, ptr %22, align 4, !tbaa !5
  %24 = add nsw i32 %23, 1
  %25 = getelementptr inbounds [100001 x i32], ptr @Log, i64 0, i64 %indvars.iv.next.1
  store i32 %24, ptr %25, align 4, !tbaa !5
  %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
  %exitcond.not.2 = icmp eq i64 %indvars.iv.next.2, 100001
  br i1 %exitcond.not.2, label %3, label %7, !llvm.loop !9

.lr.ph58:                                         ; preds = %3, %._crit_edge55
  %26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n, ptr noundef nonnull @m, ptr noundef nonnull @X, ptr noundef nonnull @Y, ptr noundef nonnull @Z)
  %27 = load i32, ptr @n, align 4, !tbaa !5
  br label %28

28:                                               ; preds = %28, %.lr.ph58
  %storemerge = phi i32 [ 0, %.lr.ph58 ], [ %30, %28 ]
  %29 = shl nuw i32 1, %storemerge
  %.not36 = icmp sgt i32 %29, %27
  %30 = add nuw nsw i32 %storemerge, 1
  br i1 %.not36, label %.preheader42, label %28, !llvm.loop !11

.preheader42:                                     ; preds = %28
  store i32 %storemerge, ptr @mx, align 4, !tbaa !5
  %31 = load i32, ptr @m, align 4, !tbaa !5
  %32 = add nsw i32 %31, -1
  store i32 %32, ptr @m, align 4, !tbaa !5
  %.not3744 = icmp eq i32 %31, 0
  br i1 %.not3744, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader42, %47
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  %33 = call noundef i32 @_Z5rng61v()
  %34 = load i32, ptr @n, align 4, !tbaa !5
  %35 = urem i32 %33, %34
  %36 = add nuw i32 %35, 1
  store i32 %36, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  %37 = call noundef i32 @_Z5rng61v()
  %38 = load i32, ptr @n, align 4, !tbaa !5
  %39 = urem i32 %37, %38
  %40 = add nuw i32 %39, 1
  store i32 %40, ptr %2, align 4, !tbaa !5
  %41 = call noundef i32 @_Z5rng61v()
  %42 = and i32 %41, 1073741823
  %43 = load i32, ptr %1, align 4, !tbaa !5
  %44 = load i32, ptr %2, align 4, !tbaa !5
  %45 = icmp sgt i32 %43, %44
  br i1 %45, label %46, label %47

46:                                               ; preds = %.lr.ph
  call void @_ZSt4swapIiENSt9enable_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
  %.pre71 = load i32, ptr %1, align 4, !tbaa !5
  br label %47

47:                                               ; preds = %46, %.lr.ph
  %48 = phi i32 [ %.pre71, %46 ], [ %43, %.lr.ph ]
  %49 = phi i32 [ %.pre, %46 ], [ %44, %.lr.ph ]
  %50 = add i32 %49, 1
  %51 = sub i32 %50, %48
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [100001 x i32], ptr @Log, i64 0, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = sext i32 %48 to i64
  %57 = getelementptr inbounds [17 x [100001 x i32]], ptr @a, i64 0, i64 %55, i64 %56
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) %57, i32 noundef %42)
  %58 = load i32, ptr %2, align 4, !tbaa !5
  %.neg = shl nsw i32 -1, %54
  %59 = add nsw i32 %.neg, 1
  %60 = add i32 %59, %58
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [17 x [100001 x i32]], ptr @a, i64 0, i64 %55, i64 %61
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) %62, i32 noundef %42)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  %63 = load i32, ptr @m, align 4, !tbaa !5
  %64 = add nsw i32 %63, -1
  store i32 %64, ptr @m, align 4, !tbaa !5
  %.not37 = icmp eq i32 %63, 0
  br i1 %.not37, label %._crit_edge.loopexit, label %.lr.ph, !llvm.loop !12

._crit_edge.loopexit:                             ; preds = %47
  %.pre72 = load i32, ptr @mx, align 4, !tbaa !5
  %.pre74.pre = load i32, ptr @n, align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader42
  %.pre74 = phi i32 [ %.pre74.pre, %._crit_edge.loopexit ], [ %27, %.preheader42 ]
  %65 = phi i32 [ %.pre72, %._crit_edge.loopexit ], [ %storemerge, %.preheader42 ]
  %66 = icmp sgt i32 %65, 1
  br i1 %66, label %.preheader.preheader, label %.preheader41

.preheader.preheader:                             ; preds = %._crit_edge
  %67 = zext nneg i32 %65 to i64
  br label %.preheader

.loopexit:                                        ; preds = %80, %.preheader
  %68 = phi i32 [ %73, %.preheader ], [ %87, %80 ]
  %69 = icmp sgt i64 %indvars.iv64, 2
  br i1 %69, label %.preheader, label %.preheader41, !llvm.loop !13

.preheader41:                                     ; preds = %.loopexit, %._crit_edge
  %70 = phi i32 [ %.pre74, %._crit_edge ], [ %68, %.loopexit ]
  %.not3851 = icmp slt i32 %70, 1
  br i1 %.not3851, label %._crit_edge55, label %.lr.ph54.preheader

.lr.ph54.preheader:                               ; preds = %.preheader41
  %71 = zext nneg i32 %70 to i64
  %xtraiter = and i64 %71, 3
  %72 = icmp ult i32 %70, 4
  br i1 %72, label %._crit_edge55.loopexit.unr-lcssa, label %.lr.ph54.preheader.new

.lr.ph54.preheader.new:                           ; preds = %.lr.ph54.preheader
  %unroll_iter = and i64 %71, 2147483644
  br label %.lr.ph54

.preheader:                                       ; preds = %.preheader.preheader, %.loopexit
  %73 = phi i32 [ %.pre74, %.preheader.preheader ], [ %68, %.loopexit ]
  %indvars.iv64 = phi i64 [ %67, %.preheader.preheader ], [ %indvars.iv.next65, %.loopexit ]
  %indvars.iv.next65 = add nsw i64 %indvars.iv64, -1
  %74 = trunc nuw nsw i64 %indvars.iv.next65 to i32
  %75 = shl nuw i32 1, %74
  %.not3945 = icmp sgt i32 %75, %73
  br i1 %.not3945, label %.loopexit, label %.lr.ph47

.lr.ph47:                                         ; preds = %.preheader
  %76 = add nsw i64 %indvars.iv64, -2
  %77 = trunc nuw nsw i64 %76 to i32
  %78 = shl nuw i32 1, %77
  %79 = sext i32 %78 to i64
  br label %80

80:                                               ; preds = %.lr.ph47, %80
  %indvars.iv61 = phi i64 [ 1, %.lr.ph47 ], [ %indvars.iv.next62, %80 ]
  %81 = getelementptr inbounds [17 x [100001 x i32]], ptr @a, i64 0, i64 %76, i64 %indvars.iv61
  %82 = getelementptr inbounds [17 x [100001 x i32]], ptr @a, i64 0, i64 %indvars.iv.next65, i64 %indvars.iv61
  %83 = load i32, ptr %82, align 4, !tbaa !5
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) %81, i32 noundef %83)
  %84 = add nuw nsw i64 %indvars.iv61, %79
  %85 = getelementptr inbounds [17 x [100001 x i32]], ptr @a, i64 0, i64 %76, i64 %84
  %86 = load i32, ptr %82, align 4, !tbaa !5
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) %85, i32 noundef %86)
  store i32 0, ptr %82, align 4, !tbaa !5
  %indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
  %87 = load i32, ptr @n, align 4, !tbaa !5
  %88 = trunc i64 %indvars.iv61 to i32
  %89 = add i32 %75, %88
  %.not39 = icmp sgt i32 %89, %87
  br i1 %.not39, label %.loopexit, label %80, !llvm.loop !14

._crit_edge55.loopexit.unr-lcssa:                 ; preds = %.lr.ph54, %.lr.ph54.preheader
  %.lcssa81.ph = phi i64 [ poison, %.lr.ph54.preheader ], [ %117, %.lr.ph54 ]
  %indvars.iv67.unr = phi i64 [ 1, %.lr.ph54.preheader ], [ %indvars.iv.next68.3, %.lr.ph54 ]
  %.03252.unr = phi i64 [ 0, %.lr.ph54.preheader ], [ %117, %.lr.ph54 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge55, label %.lr.ph54.epil

.lr.ph54.epil:                                    ; preds = %._crit_edge55.loopexit.unr-lcssa, %.lr.ph54.epil
  %indvars.iv67.epil = phi i64 [ %indvars.iv.next68.epil, %.lr.ph54.epil ], [ %indvars.iv67.unr, %._crit_edge55.loopexit.unr-lcssa ]
  %.03252.epil = phi i64 [ %94, %.lr.ph54.epil ], [ %.03252.unr, %._crit_edge55.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph54.epil ], [ 0, %._crit_edge55.loopexit.unr-lcssa ]
  %90 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %indvars.iv67.epil
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = mul nsw i64 %indvars.iv67.epil, %92
  %94 = xor i64 %93, %.03252.epil
  store i32 0, ptr %90, align 4, !tbaa !5
  %indvars.iv.next68.epil = add nuw nsw i64 %indvars.iv67.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge55, label %.lr.ph54.epil, !llvm.loop !15

._crit_edge55:                                    ; preds = %._crit_edge55.loopexit.unr-lcssa, %.lr.ph54.epil, %.preheader41
  %.032.lcssa = phi i64 [ 0, %.preheader41 ], [ %.lcssa81.ph, %._crit_edge55.loopexit.unr-lcssa ], [ %94, %.lr.ph54.epil ]
  %95 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %.032.lcssa)
  %96 = load i32, ptr @t, align 4, !tbaa !5
  %97 = add nsw i32 %96, -1
  store i32 %97, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %96, 0
  br i1 %.not, label %._crit_edge59, label %.lr.ph58, !llvm.loop !17

.lr.ph54:                                         ; preds = %.lr.ph54, %.lr.ph54.preheader.new
  %indvars.iv67 = phi i64 [ 1, %.lr.ph54.preheader.new ], [ %indvars.iv.next68.3, %.lr.ph54 ]
  %.03252 = phi i64 [ 0, %.lr.ph54.preheader.new ], [ %117, %.lr.ph54 ]
  %niter = phi i64 [ 0, %.lr.ph54.preheader.new ], [ %niter.next.3, %.lr.ph54 ]
  %98 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %indvars.iv67
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = mul nsw i64 %indvars.iv67, %100
  %102 = xor i64 %101, %.03252
  store i32 0, ptr %98, align 4, !tbaa !5
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %103 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %indvars.iv.next68
  %104 = load i32, ptr %103, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = mul nsw i64 %indvars.iv.next68, %105
  %107 = xor i64 %106, %102
  store i32 0, ptr %103, align 4, !tbaa !5
  %indvars.iv.next68.1 = add nuw nsw i64 %indvars.iv67, 2
  %108 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %indvars.iv.next68.1
  %109 = load i32, ptr %108, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = mul nsw i64 %indvars.iv.next68.1, %110
  %112 = xor i64 %111, %107
  store i32 0, ptr %108, align 4, !tbaa !5
  %indvars.iv.next68.2 = add nuw nsw i64 %indvars.iv67, 3
  %113 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %indvars.iv.next68.2
  %114 = load i32, ptr %113, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = mul nsw i64 %indvars.iv.next68.2, %115
  %117 = xor i64 %116, %112
  store i32 0, ptr %113, align 4, !tbaa !5
  %indvars.iv.next68.3 = add nuw nsw i64 %indvars.iv67, 4
  %niter.next.3 = add nuw i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge55.loopexit.unr-lcssa, label %.lr.ph54, !llvm.loop !18

._crit_edge59:                                    ; preds = %._crit_edge55, %3
  ret i32 0
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapIiENSt9enable_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 #4

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

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

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 norecurse 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 #3 = { 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 #4 = { 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 #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 = distinct !{!14, !10}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.unroll.disable"}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}


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