; LLVM IR from tangjz/acm-icpc :: codeforces/gym (100917D)

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

@n = external dso_local global i32, align 4
@w = external dso_local global i32, align 4
@Log = external dso_local global [100001 x i32], align 16
@st = external dso_local global [17 x [100001 x i32]], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; 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
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @w)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 2, ptr %2, align 4, !tbaa !5
  br label %14

14:                                               ; preds = %29, %0
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = load i32, ptr @n, align 4, !tbaa !5
  %17 = icmp sle i32 %15, %16
  br i1 %17, label %19, label %18

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

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

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

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

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

37:                                               ; preds = %33
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %46

38:                                               ; preds = %33
  %39 = load i32, ptr %3, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds i32, ptr @st, i64 %40
  %42 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %41)
  br label %43

43:                                               ; preds = %38
  %44 = load i32, ptr %3, align 4, !tbaa !5
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr %3, align 4, !tbaa !5
  br label %33, !llvm.loop !11

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

47:                                               ; preds = %96, %46
  %48 = load i32, ptr %4, align 4, !tbaa !5
  %49 = load i32, ptr @n, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [100001 x i32], ptr @Log, i64 0, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = icmp sle i32 %48, %52
  br i1 %53, label %55, label %54

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

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

56:                                               ; preds = %92, %55
  %57 = load i32, ptr %6, align 4, !tbaa !5
  %58 = load i32, ptr %4, align 4, !tbaa !5
  %59 = shl i32 1, %58
  %60 = add nsw i32 %57, %59
  %61 = sub nsw i32 %60, 1
  %62 = load i32, ptr @n, align 4, !tbaa !5
  %63 = icmp sle i32 %61, %62
  br i1 %63, label %65, label %64

64:                                               ; preds = %56
  store i32 11, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %95

65:                                               ; preds = %56
  %66 = load i32, ptr %4, align 4, !tbaa !5
  %67 = sub nsw i32 %66, 1
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [17 x [100001 x i32]], ptr @st, i64 0, i64 %68
  %70 = load i32, ptr %6, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [100001 x i32], ptr %69, i64 0, i64 %71
  %73 = load i32, ptr %4, align 4, !tbaa !5
  %74 = sub nsw i32 %73, 1
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [17 x [100001 x i32]], ptr @st, i64 0, i64 %75
  %77 = load i32, ptr %6, align 4, !tbaa !5
  %78 = load i32, ptr %4, align 4, !tbaa !5
  %79 = sub nsw i32 %78, 1
  %80 = shl i32 1, %79
  %81 = add nsw i32 %77, %80
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [100001 x i32], ptr %76, i64 0, i64 %82
  %84 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %72, ptr noundef nonnull align 4 dereferenceable(4) %83)
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = load i32, ptr %4, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [17 x [100001 x i32]], ptr @st, i64 0, i64 %87
  %89 = load i32, ptr %6, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [100001 x i32], ptr %88, i64 0, i64 %90
  store i32 %85, ptr %91, align 4, !tbaa !5
  br label %92

92:                                               ; preds = %65
  %93 = load i32, ptr %6, align 4, !tbaa !5
  %94 = add nsw i32 %93, 1
  store i32 %94, ptr %6, align 4, !tbaa !5
  br label %56, !llvm.loop !12

95:                                               ; preds = %64
  br label %96

96:                                               ; preds = %95
  %97 = load i32, ptr %4, align 4, !tbaa !5
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr %4, align 4, !tbaa !5
  br label %47, !llvm.loop !13

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

100:                                              ; preds = %170, %99
  %101 = load i32, ptr %7, align 4, !tbaa !5
  %102 = load i32, ptr @n, align 4, !tbaa !5
  %103 = icmp sle i32 %101, %102
  br i1 %103, label %105, label %104

104:                                              ; preds = %100
  store i32 14, ptr %5, align 4
  br label %173

105:                                              ; preds = %100
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 1, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %106 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %106, ptr %10, align 4, !tbaa !5
  br label %107

107:                                              ; preds = %150, %105
  %108 = load i32, ptr %9, align 4, !tbaa !5
  %109 = load i32, ptr @n, align 4, !tbaa !5
  %110 = icmp sle i32 %108, %109
  br i1 %110, label %111, label %115

111:                                              ; preds = %107
  %112 = load i32, ptr %8, align 4, !tbaa !5
  %113 = load i32, ptr @w, align 4, !tbaa !5
  %114 = icmp sle i32 %112, %113
  br label %115

115:                                              ; preds = %111, %107
  %116 = phi i1 [ false, %107 ], [ %114, %111 ]
  br i1 %116, label %118, label %117

117:                                              ; preds = %115
  store i32 17, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %159

118:                                              ; preds = %115
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %119 = load i32, ptr %10, align 4, !tbaa !5
  %120 = load i32, ptr %9, align 4, !tbaa !5
  %121 = sub nsw i32 %119, %120
  %122 = add nsw i32 %121, 1
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [100001 x i32], ptr @Log, i64 0, i64 %123
  %125 = load i32, ptr %124, align 4, !tbaa !5
  store i32 %125, ptr %11, align 4, !tbaa !5
  %126 = load i32, ptr %11, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [17 x [100001 x i32]], ptr @st, i64 0, i64 %127
  %129 = load i32, ptr %9, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [100001 x i32], ptr %128, i64 0, i64 %130
  %132 = load i32, ptr %11, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [17 x [100001 x i32]], ptr @st, i64 0, i64 %133
  %135 = load i32, ptr %10, align 4, !tbaa !5
  %136 = load i32, ptr %11, align 4, !tbaa !5
  %137 = shl i32 1, %136
  %138 = sub nsw i32 %135, %137
  %139 = add nsw i32 %138, 1
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [100001 x i32], ptr %134, i64 0, i64 %140
  %142 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %131, ptr noundef nonnull align 4 dereferenceable(4) %141)
  %143 = load i32, ptr %142, align 4, !tbaa !5
  %144 = load i32, ptr %9, align 4, !tbaa !5
  %145 = icmp sgt i32 %144, 1
  %146 = zext i1 %145 to i32
  %147 = add nsw i32 %143, %146
  %148 = load i32, ptr %8, align 4, !tbaa !5
  %149 = add nsw i32 %148, %147
  store i32 %149, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %150

150:                                              ; preds = %118
  %151 = load i32, ptr %10, align 4, !tbaa !5
  %152 = add nsw i32 %151, 1
  store i32 %152, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %153 = load i32, ptr %9, align 4, !tbaa !5
  %154 = load i32, ptr %7, align 4, !tbaa !5
  %155 = add nsw i32 %153, %154
  %156 = sub nsw i32 %155, 1
  store i32 %156, ptr %12, align 4, !tbaa !5
  %157 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %158 = load i32, ptr %157, align 4, !tbaa !5
  store i32 %158, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %107, !llvm.loop !14

159:                                              ; preds = %117
  %160 = load i32, ptr %8, align 4, !tbaa !5
  %161 = load i32, ptr @w, align 4, !tbaa !5
  %162 = icmp sle i32 %160, %161
  br i1 %162, label %163, label %166

163:                                              ; preds = %159
  %164 = load i32, ptr %7, align 4, !tbaa !5
  %165 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %164)
  store i32 14, ptr %5, align 4
  br label %167

166:                                              ; preds = %159
  store i32 0, ptr %5, align 4
  br label %167

167:                                              ; preds = %166, %163
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  %168 = load i32, ptr %5, align 4
  switch i32 %168, label %173 [
    i32 0, label %169
  ]

169:                                              ; preds = %167
  br label %170

170:                                              ; preds = %169
  %171 = load i32, ptr %7, align 4, !tbaa !5
  %172 = add nsw i32 %171, 1
  store i32 %172, ptr %7, align 4, !tbaa !5
  br label %100, !llvm.loop !15

173:                                              ; preds = %167, %104
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %174

174:                                              ; preds = %173
  ret i32 0
}

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: 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 @_ZSt3maxIiERKT_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 noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

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

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 = { 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, !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"

@n = external dso_local global i32, align 4
@w = external dso_local global i32, align 4
@Log = external dso_local local_unnamed_addr global [100001 x i32], align 16
@st = external dso_local global [17 x [100001 x i32]], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

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

.lr.ph.preheader:                                 ; preds = %0
  %4 = add nuw i32 %3, 1
  %wide.trip.count = zext i32 %4 to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %5 = icmp eq i32 %4, 3
  br i1 %5, label %.preheader54.loopexit.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %6 = and i64 %wide.trip.count, 4294967294
  %7 = add nsw i64 %6, -4
  br label %.lr.ph

.preheader54.loopexit.unr-lcssa:                  ; preds = %.lr.ph, %.lr.ph.preheader
  %indvars.iv.unr = phi i64 [ 2, %.lr.ph.preheader ], [ %indvars.iv.next.1, %.lr.ph ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader54, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %.preheader54.loopexit.unr-lcssa
  %8 = lshr i64 %indvars.iv.unr, 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.unr
  store i32 %12, ptr %13, align 4, !tbaa !5
  br label %.preheader54

.preheader54:                                     ; preds = %.lr.ph.epil, %.preheader54.loopexit.unr-lcssa, %0
  %.not4758 = icmp slt i32 %3, 1
  br i1 %.not4758, label %.preheader54..preheader53_crit_edge, label %.lr.ph60

.preheader54..preheader53_crit_edge:              ; preds = %.preheader54
  %.pre85 = sext i32 %3 to i64
  br label %.preheader53

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %indvars.iv = phi i64 [ 2, %.lr.ph.preheader.new ], [ %indvars.iv.next.1, %.lr.ph ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.1, %.lr.ph ]
  %14 = lshr exact i64 %indvars.iv, 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
  store i32 %18, ptr %19, align 8, !tbaa !5
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %20 = lshr exact i64 %indvars.iv, 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
  store i32 %24, ptr %25, align 4, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter, %7
  br i1 %niter.ncmp.1, label %.preheader54.loopexit.unr-lcssa, label %.lr.ph, !llvm.loop !9

.preheader53:                                     ; preds = %.lr.ph60, %.preheader54..preheader53_crit_edge
  %.pre-phi = phi i64 [ %.pre85, %.preheader54..preheader53_crit_edge ], [ %32, %.lr.ph60 ]
  %26 = phi i32 [ %3, %.preheader54..preheader53_crit_edge ], [ %31, %.lr.ph60 ]
  %27 = getelementptr inbounds [100001 x i32], ptr @Log, i64 0, i64 %.pre-phi
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %.not4864 = icmp slt i32 %28, 1
  br i1 %.not4864, label %.preheader51, label %.preheader52

.lr.ph60:                                         ; preds = %.preheader54, %.lr.ph60
  %indvars.iv76 = phi i64 [ %indvars.iv.next77, %.lr.ph60 ], [ 1, %.preheader54 ]
  %29 = getelementptr inbounds i32, ptr @st, i64 %indvars.iv76
  %30 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %29)
  %indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1
  %31 = load i32, ptr @n, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %.not47.not = icmp slt i64 %indvars.iv76, %32
  br i1 %.not47.not, label %.lr.ph60, label %.preheader53, !llvm.loop !11

.preheader52:                                     ; preds = %.preheader53, %._crit_edge
  %33 = phi i32 [ %41, %._crit_edge ], [ %26, %.preheader53 ]
  %indvars.iv82 = phi i64 [ %indvars.iv.next83, %._crit_edge ], [ 1, %.preheader53 ]
  %34 = trunc nuw nsw i64 %indvars.iv82 to i32
  %35 = shl nuw i32 1, %34
  %.not5061 = icmp sgt i32 %35, %33
  br i1 %.not5061, label %._crit_edge, label %.lr.ph63

.lr.ph63:                                         ; preds = %.preheader52
  %36 = add nsw i64 %indvars.iv82, -1
  %37 = trunc nuw nsw i64 %36 to i32
  %38 = shl nuw i32 1, %37
  %39 = sext i32 %38 to i64
  br label %46

.preheader51:                                     ; preds = %._crit_edge, %.preheader53
  %40 = phi i32 [ %26, %.preheader53 ], [ %41, %._crit_edge ]
  %.not4971 = icmp slt i32 %40, 1
  br i1 %.not4971, label %.loopexit, label %.preheader.preheader

.preheader.preheader:                             ; preds = %.preheader51
  %.pre = load i32, ptr @w, align 4
  br label %.preheader

._crit_edge:                                      ; preds = %46, %.preheader52
  %41 = phi i32 [ %33, %.preheader52 ], [ %53, %46 ]
  %indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [100001 x i32], ptr @Log, i64 0, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %.not48.not = icmp slt i64 %indvars.iv82, %45
  br i1 %.not48.not, label %.preheader52, label %.preheader51, !llvm.loop !12

46:                                               ; preds = %.lr.ph63, %46
  %indvars.iv79 = phi i64 [ 1, %.lr.ph63 ], [ %indvars.iv.next80, %46 ]
  %47 = getelementptr inbounds [17 x [100001 x i32]], ptr @st, i64 0, i64 %36, i64 %indvars.iv79
  %48 = add nuw nsw i64 %indvars.iv79, %39
  %49 = getelementptr inbounds [17 x [100001 x i32]], ptr @st, i64 0, i64 %36, i64 %48
  %50 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %47, ptr noundef nonnull align 4 dereferenceable(4) %49)
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = getelementptr inbounds [17 x [100001 x i32]], ptr @st, i64 0, i64 %indvars.iv82, i64 %indvars.iv79
  store i32 %51, ptr %52, align 4, !tbaa !5
  %indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
  %53 = load i32, ptr @n, align 4, !tbaa !5
  %54 = trunc i64 %indvars.iv79 to i32
  %55 = add i32 %35, %54
  %.not50 = icmp sgt i32 %55, %53
  br i1 %.not50, label %._crit_edge, label %46, !llvm.loop !13

.preheader:                                       ; preds = %.preheader.preheader, %.critedge
  %56 = phi i32 [ %61, %.critedge ], [ %40, %.preheader.preheader ]
  %57 = phi i32 [ %62, %.critedge ], [ %.pre, %.preheader.preheader ]
  %.04272 = phi i32 [ %90, %.critedge ], [ 1, %.preheader.preheader ]
  %58 = icmp sgt i32 %56, 0
  %59 = icmp sgt i32 %57, -1
  %60 = select i1 %58, i1 %59, i1 false
  br i1 %60, label %.lr.ph69, label %._crit_edge70

._crit_edge70:                                    ; preds = %.lr.ph69, %.preheader
  %61 = phi i32 [ %56, %.preheader ], [ %83, %.lr.ph69 ]
  %62 = phi i32 [ %57, %.preheader ], [ %85, %.lr.ph69 ]
  %.lcssa = phi i1 [ %59, %.preheader ], [ %86, %.lr.ph69 ]
  br i1 %.lcssa, label %88, label %.critedge

.lr.ph69:                                         ; preds = %.preheader, %.lr.ph69
  %.03968 = phi i32 [ %82, %.lr.ph69 ], [ %.04272, %.preheader ]
  %.04067 = phi i32 [ %70, %.lr.ph69 ], [ 1, %.preheader ]
  %.04166 = phi i32 [ %79, %.lr.ph69 ], [ 0, %.preheader ]
  %reass.sub = sub i32 %.03968, %.04067
  %63 = add i32 %reass.sub, 1
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [100001 x i32], ptr @Log, i64 0, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = sext i32 %.04067 to i64
  %69 = getelementptr inbounds [17 x [100001 x i32]], ptr @st, i64 0, i64 %67, i64 %68
  %.neg = shl nsw i32 -1, %66
  %70 = add i32 %.03968, 1
  %71 = add i32 %70, %.neg
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [17 x [100001 x i32]], ptr @st, i64 0, i64 %67, i64 %72
  %74 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %69, ptr noundef nonnull align 4 dereferenceable(4) %73)
  %75 = load i32, ptr %74, align 4, !tbaa !5
  %76 = icmp sgt i32 %.04067, 1
  %77 = zext i1 %76 to i32
  %78 = add i32 %.04166, %77
  %79 = add i32 %78, %75
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  %80 = add i32 %.03968, %.04272
  store i32 %80, ptr %1, align 4, !tbaa !5
  %81 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %82 = load i32, ptr %81, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  %83 = load i32, ptr @n, align 4, !tbaa !5
  %84 = icmp slt i32 %.03968, %83
  %85 = load i32, ptr @w, align 4
  %86 = icmp sle i32 %79, %85
  %87 = select i1 %84, i1 %86, i1 false
  br i1 %87, label %.lr.ph69, label %._crit_edge70, !llvm.loop !14

88:                                               ; preds = %._crit_edge70
  %89 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.04272)
  br label %.loopexit

.critedge:                                        ; preds = %._crit_edge70
  %90 = add nuw nsw i32 %.04272, 1
  %.not49.not = icmp slt i32 %.04272, %61
  br i1 %.not49.not, label %.preheader, label %.loopexit, !llvm.loop !15

.loopexit:                                        ; preds = %.critedge, %.preheader51, %88
  ret i32 0
}

; 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: 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 @_ZSt3maxIiERKT_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 noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

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

attributes #0 = { 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 #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 = { 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, !10}


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