; LLVM IR from tangjz/acm-icpc :: codeforces/gym (101206C)

; 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
@all = external dso_local global i32, align 4
@pw = external dso_local global [100001 x i32], align 16
@bits = external dso_local global [32769 x i32], align 16
@cnt = external dso_local global [32769 x i32], align 16
@f = external dso_local global [32769 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@_ZZ4mainE3buf = external hidden global [17 x i8], align 16
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [14 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsiii(i32 noundef, 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 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 i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  store i32 1, ptr @pw, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %15

15:                                               ; preds = %39, %0
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = icmp slt i32 %16, 100001
  br i1 %17, label %19, label %18

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

19:                                               ; preds = %15
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = sub nsw i32 %20, 1
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [100001 x i32], ptr @pw, i64 0, i64 %22
  %24 = load i32, ptr %23, align 4, !tbaa !5
  %25 = shl 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 @pw, i64 0, i64 %27
  store i32 %25, ptr %28, align 4, !tbaa !5
  %29 = icmp sge i32 %25, 1000000007
  br i1 %29, label %30, label %37

30:                                               ; preds = %19
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [100001 x i32], ptr @pw, i64 0, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = sub nsw i32 %34, 1000000007
  store i32 %35, ptr %33, align 4, !tbaa !5
  %36 = icmp ne i32 %35, 0
  br label %37

37:                                               ; preds = %30, %19
  %38 = phi i1 [ false, %19 ], [ %36, %30 ]
  br label %39

39:                                               ; preds = %37
  %40 = load i32, ptr %2, align 4, !tbaa !5
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr %2, align 4, !tbaa !5
  br label %15, !llvm.loop !9

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

43:                                               ; preds = %59, %42
  %44 = load i32, ptr %3, align 4, !tbaa !5
  %45 = icmp slt i32 %44, 32769
  br i1 %45, label %47, label %46

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

47:                                               ; preds = %43
  %48 = load i32, ptr %3, align 4, !tbaa !5
  %49 = ashr i32 %48, 1
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [32769 x i32], ptr @bits, i64 0, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = load i32, ptr %3, align 4, !tbaa !5
  %54 = and i32 %53, 1
  %55 = xor i32 %52, %54
  %56 = load i32, ptr %3, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [32769 x i32], ptr @bits, i64 0, i64 %57
  store i32 %55, ptr %58, align 4, !tbaa !5
  br label %59

59:                                               ; preds = %47
  %60 = load i32, ptr %3, align 4, !tbaa !5
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr %3, align 4, !tbaa !5
  br label %43, !llvm.loop !11

62:                                               ; preds = %46
  %63 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %64

64:                                               ; preds = %207, %62
  %65 = load i32, ptr %4, align 4, !tbaa !5
  %66 = load i32, ptr @t, align 4, !tbaa !5
  %67 = icmp sle i32 %65, %66
  br i1 %67, label %69, label %68

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

69:                                               ; preds = %64
  %70 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @n, ptr noundef @m)
  %71 = load i32, ptr @m, align 4, !tbaa !5
  %72 = shl i32 1, %71
  %73 = sub nsw i32 %72, 1
  store i32 %73, ptr @all, align 4, !tbaa !5
  %74 = load i32, ptr @all, align 4, !tbaa !5
  %75 = add nsw i32 %74, 1
  %76 = sext i32 %75 to i64
  %77 = mul i64 %76, 4
  call void @llvm.memset.p0.i64(ptr align 16 @cnt, i8 0, i64 %77, i1 false)
  br label %78

78:                                               ; preds = %104, %69
  %79 = load i32, ptr @n, align 4, !tbaa !5
  %80 = add nsw i32 %79, -1
  store i32 %80, ptr @n, align 4, !tbaa !5
  %81 = icmp ne i32 %79, 0
  br i1 %81, label %82, label %110

82:                                               ; preds = %78
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !5
  %83 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef @_ZZ4mainE3buf)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %84

84:                                               ; preds = %101, %82
  %85 = load i32, ptr %7, align 4, !tbaa !5
  %86 = load i32, ptr @m, align 4, !tbaa !5
  %87 = icmp slt i32 %85, %86
  br i1 %87, label %89, label %88

88:                                               ; preds = %84
  store i32 13, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %104

89:                                               ; preds = %84
  %90 = load i32, ptr %7, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [17 x i8], ptr @_ZZ4mainE3buf, i64 0, i64 %91
  %93 = load i8, ptr %92, align 1, !tbaa !12
  %94 = sext i8 %93 to i32
  %95 = icmp eq i32 %94, 89
  %96 = zext i1 %95 to i32
  %97 = load i32, ptr %7, align 4, !tbaa !5
  %98 = shl i32 %96, %97
  %99 = load i32, ptr %6, align 4, !tbaa !5
  %100 = or i32 %99, %98
  store i32 %100, ptr %6, align 4, !tbaa !5
  br label %101

101:                                              ; preds = %89
  %102 = load i32, ptr %7, align 4, !tbaa !5
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr %7, align 4, !tbaa !5
  br label %84, !llvm.loop !13

104:                                              ; preds = %88
  %105 = load i32, ptr %6, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [32769 x i32], ptr @cnt, i64 0, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = add nsw i32 %108, 1
  store i32 %109, ptr %107, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %78, !llvm.loop !14

110:                                              ; preds = %78
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %111

111:                                              ; preds = %134, %110
  %112 = load i32, ptr %9, align 4, !tbaa !5
  %113 = load i32, ptr @all, align 4, !tbaa !5
  %114 = icmp sle i32 %112, %113
  br i1 %114, label %116, label %115

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

116:                                              ; preds = %111
  %117 = load i32, ptr %9, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [32769 x i32], ptr @cnt, i64 0, i64 %118
  %120 = load i32, ptr %119, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [100001 x i32], ptr @pw, i64 0, i64 %121
  %123 = load i32, ptr %122, align 4, !tbaa !5
  %124 = sub nsw i32 %123, 1
  %125 = load i32, ptr %8, align 4, !tbaa !5
  %126 = add nsw i32 %125, %124
  store i32 %126, ptr %8, align 4, !tbaa !5
  %127 = icmp sge i32 %126, 1000000007
  br i1 %127, label %128, label %132

128:                                              ; preds = %116
  %129 = load i32, ptr %8, align 4, !tbaa !5
  %130 = sub nsw i32 %129, 1000000007
  store i32 %130, ptr %8, align 4, !tbaa !5
  %131 = icmp ne i32 %130, 0
  br label %132

132:                                              ; preds = %128, %116
  %133 = phi i1 [ false, %116 ], [ %131, %128 ]
  br label %134

134:                                              ; preds = %132
  %135 = load i32, ptr %9, align 4, !tbaa !5
  %136 = add nsw i32 %135, 1
  store i32 %136, ptr %9, align 4, !tbaa !5
  br label %111, !llvm.loop !15

137:                                              ; preds = %115
  %138 = load i32, ptr @all, align 4, !tbaa !5
  %139 = load i32, ptr %8, align 4, !tbaa !5
  call void @_Z3dfsiii(i32 noundef 1, i32 noundef %138, i32 noundef %139)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %140

140:                                              ; preds = %184, %137
  %141 = load i32, ptr %10, align 4, !tbaa !5
  %142 = load i32, ptr @all, align 4, !tbaa !5
  %143 = icmp sle i32 %141, %142
  br i1 %143, label %145, label %144

144:                                              ; preds = %140
  store i32 19, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %187

145:                                              ; preds = %140
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %146 = load i32, ptr @all, align 4, !tbaa !5
  %147 = load i32, ptr %10, align 4, !tbaa !5
  %148 = xor i32 %146, %147
  store i32 %148, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %149 = load i32, ptr %11, align 4, !tbaa !5
  store i32 %149, ptr %12, align 4, !tbaa !5
  br label %150

150:                                              ; preds = %178, %145
  %151 = load i32, ptr %12, align 4, !tbaa !5
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [32769 x i32], ptr @f, i64 0, i64 %152
  %154 = load i32, ptr %153, align 4, !tbaa !5
  %155 = load i32, ptr %12, align 4, !tbaa !5
  %156 = load i32, ptr %10, align 4, !tbaa !5
  %157 = or i32 %155, %156
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [32769 x i32], ptr @f, i64 0, i64 %158
  %160 = load i32, ptr %159, align 4, !tbaa !5
  %161 = add nsw i32 %160, %154
  store i32 %161, ptr %159, align 4, !tbaa !5
  %162 = icmp sge i32 %161, 1000000007
  br i1 %162, label %163, label %172

163:                                              ; preds = %150
  %164 = load i32, ptr %12, align 4, !tbaa !5
  %165 = load i32, ptr %10, align 4, !tbaa !5
  %166 = or i32 %164, %165
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds [32769 x i32], ptr @f, i64 0, i64 %167
  %169 = load i32, ptr %168, align 4, !tbaa !5
  %170 = sub nsw i32 %169, 1000000007
  store i32 %170, ptr %168, align 4, !tbaa !5
  %171 = icmp ne i32 %170, 0
  br label %172

172:                                              ; preds = %163, %150
  %173 = phi i1 [ false, %150 ], [ %171, %163 ]
  %174 = load i32, ptr %12, align 4, !tbaa !5
  %175 = icmp ne i32 %174, 0
  br i1 %175, label %177, label %176

176:                                              ; preds = %172
  store i32 22, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %183

177:                                              ; preds = %172
  br label %178

178:                                              ; preds = %177
  %179 = load i32, ptr %12, align 4, !tbaa !5
  %180 = sub nsw i32 %179, 1
  %181 = load i32, ptr %11, align 4, !tbaa !5
  %182 = and i32 %180, %181
  store i32 %182, ptr %12, align 4, !tbaa !5
  br label %150, !llvm.loop !16

183:                                              ; preds = %176
  br label %184

184:                                              ; preds = %183
  %185 = load i32, ptr %10, align 4, !tbaa !5
  %186 = shl i32 %185, 1
  store i32 %186, ptr %10, align 4, !tbaa !5
  br label %140, !llvm.loop !17

187:                                              ; preds = %144
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 0, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 1, ptr %14, align 4, !tbaa !5
  br label %188

188:                                              ; preds = %200, %187
  %189 = load i32, ptr %14, align 4, !tbaa !5
  %190 = load i32, ptr @all, align 4, !tbaa !5
  %191 = icmp sle i32 %189, %190
  br i1 %191, label %193, label %192

192:                                              ; preds = %188
  store i32 25, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %203

193:                                              ; preds = %188
  %194 = load i32, ptr %14, align 4, !tbaa !5
  %195 = sext i32 %194 to i64
  %196 = getelementptr inbounds [32769 x i32], ptr @f, i64 0, i64 %195
  %197 = load i32, ptr %196, align 4, !tbaa !5
  %198 = load i32, ptr %13, align 4, !tbaa !5
  %199 = xor i32 %198, %197
  store i32 %199, ptr %13, align 4, !tbaa !5
  br label %200

200:                                              ; preds = %193
  %201 = load i32, ptr %14, align 4, !tbaa !5
  %202 = add nsw i32 %201, 1
  store i32 %202, ptr %14, align 4, !tbaa !5
  br label %188, !llvm.loop !18

203:                                              ; preds = %192
  %204 = load i32, ptr %4, align 4, !tbaa !5
  %205 = load i32, ptr %13, align 4, !tbaa !5
  %206 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %204, i32 noundef %205)
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %207

207:                                              ; preds = %203
  %208 = load i32, ptr %4, align 4, !tbaa !5
  %209 = add nsw i32 %208, 1
  store i32 %209, ptr %4, align 4, !tbaa !5
  br label %64, !llvm.loop !19

210:                                              ; preds = %68
  ret i32 0
}

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!7, !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@all = external dso_local local_unnamed_addr global i32, align 4
@pw = external dso_local local_unnamed_addr global [100001 x i32], align 16
@bits = external dso_local local_unnamed_addr global [32769 x i32], align 16
@cnt = external dso_local local_unnamed_addr global [32769 x i32], align 16
@f = external dso_local local_unnamed_addr global [32769 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@_ZZ4mainE3buf = external hidden global [17 x i8], align 16
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [14 x i8], align 1

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  store i32 1, ptr @pw, align 16, !tbaa !5
  br label %1

1:                                                ; preds = %1, %0
  %2 = phi i32 [ 1, %0 ], [ %spec.select.1, %1 ]
  %indvars.iv = phi i64 [ 1, %0 ], [ %indvars.iv.next.1, %1 ]
  %3 = shl i32 %2, 1
  %4 = getelementptr inbounds [100001 x i32], ptr @pw, i64 0, i64 %indvars.iv
  %5 = icmp sgt i32 %3, 1000000006
  %6 = add nsw i32 %3, -1000000007
  %spec.select = select i1 %5, i32 %6, i32 %3
  store i32 %spec.select, ptr %4, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %7 = shl i32 %spec.select, 1
  %8 = getelementptr inbounds [100001 x i32], ptr @pw, i64 0, i64 %indvars.iv.next
  %9 = icmp sgt i32 %7, 1000000006
  %10 = add nsw i32 %7, -1000000007
  %spec.select.1 = select i1 %9, i32 %10, i32 %7
  store i32 %spec.select.1, ptr %8, align 4, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, 100001
  br i1 %exitcond.not.1, label %.preheader67, label %1, !llvm.loop !9

11:                                               ; preds = %.preheader67
  %12 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %13 = load i32, ptr @t, align 4, !tbaa !5
  %.not100 = icmp slt i32 %13, 1
  br i1 %.not100, label %._crit_edge104, label %.lr.ph103

.preheader67:                                     ; preds = %1, %.preheader67
  %indvars.iv107 = phi i64 [ %indvars.iv.next108.1, %.preheader67 ], [ 1, %1 ]
  %14 = lshr i64 %indvars.iv107, 1
  %15 = getelementptr inbounds [32769 x i32], ptr @bits, i64 0, i64 %14
  %16 = load i32, ptr %15, align 4, !tbaa !5
  %17 = xor i32 %16, 1
  %18 = getelementptr inbounds [32769 x i32], ptr @bits, i64 0, i64 %indvars.iv107
  store i32 %17, ptr %18, align 4, !tbaa !5
  %indvars.iv.next108 = add nuw nsw i64 %indvars.iv107, 1
  %19 = lshr i64 %indvars.iv.next108, 1
  %20 = getelementptr inbounds [32769 x i32], ptr @bits, i64 0, i64 %19
  %21 = load i32, ptr %20, align 4, !tbaa !5
  %22 = getelementptr inbounds [32769 x i32], ptr @bits, i64 0, i64 %indvars.iv.next108
  store i32 %21, ptr %22, align 4, !tbaa !5
  %indvars.iv.next108.1 = add nuw nsw i64 %indvars.iv107, 2
  %exitcond110.not.1 = icmp eq i64 %indvars.iv.next108.1, 32769
  br i1 %exitcond110.not.1, label %11, label %.preheader67, !llvm.loop !11

._crit_edge104:                                   ; preds = %._crit_edge98, %11
  ret i32 0

.lr.ph103:                                        ; preds = %11, %._crit_edge98
  %.050101 = phi i32 [ %123, %._crit_edge98 ], [ 1, %11 ]
  %23 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %24 = load i32, ptr @m, align 4, !tbaa !5
  %25 = shl nuw i32 1, %24
  %26 = add nsw i32 %25, -1
  store i32 %26, ptr @all, align 4, !tbaa !5
  %27 = sext i32 %25 to i64
  %28 = shl nsw i64 %27, 2
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) @cnt, i8 0, i64 %28, i1 false)
  %29 = load i32, ptr @n, align 4, !tbaa !5
  %30 = add nsw i32 %29, -1
  store i32 %30, ptr @n, align 4, !tbaa !5
  %.not5873 = icmp eq i32 %29, 0
  br i1 %.not5873, label %.preheader66, label %.lr.ph75

.preheader66.loopexit:                            ; preds = %._crit_edge
  %.pre = load i32, ptr @all, align 4, !tbaa !5
  br label %.preheader66

.preheader66:                                     ; preds = %.preheader66.loopexit, %.lr.ph103
  %31 = phi i32 [ %.pre, %.preheader66.loopexit ], [ %26, %.lr.ph103 ]
  %.not5976 = icmp slt i32 %31, 0
  br i1 %.not5976, label %._crit_edge80, label %.lr.ph79.preheader

.lr.ph79.preheader:                               ; preds = %.preheader66
  %32 = add nuw i32 %31, 1
  %wide.trip.count118 = zext i32 %32 to i64
  %xtraiter = and i64 %wide.trip.count118, 1
  %33 = icmp eq i32 %31, 0
  br i1 %33, label %._crit_edge80.loopexit.unr-lcssa, label %.lr.ph79.preheader.new

.lr.ph79.preheader.new:                           ; preds = %.lr.ph79.preheader
  %unroll_iter = and i64 %wide.trip.count118, 4294967294
  br label %.lr.ph79

.lr.ph75:                                         ; preds = %.lr.ph103, %._crit_edge
  %34 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull @_ZZ4mainE3buf)
  %35 = load i32, ptr @m, align 4, !tbaa !5
  %36 = icmp sgt i32 %35, 0
  br i1 %36, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %.lr.ph75
  %wide.trip.count = zext nneg i32 %35 to i64
  %min.iters.check131 = icmp ult i32 %35, 8
  br i1 %min.iters.check131, label %.lr.ph.preheader147, label %vector.ph132

.lr.ph.preheader147:                              ; preds = %middle.block129, %.lr.ph.preheader
  %indvars.iv111.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec134, %middle.block129 ]
  %.04971.ph = phi i32 [ 0, %.lr.ph.preheader ], [ %48, %middle.block129 ]
  br label %.lr.ph

vector.ph132:                                     ; preds = %.lr.ph.preheader
  %n.vec134 = and i64 %wide.trip.count, 2147483640
  br label %vector.body136

vector.body136:                                   ; preds = %vector.body136, %vector.ph132
  %index137 = phi i64 [ 0, %vector.ph132 ], [ %index.next143, %vector.body136 ]
  %vec.phi138 = phi <4 x i32> [ zeroinitializer, %vector.ph132 ], [ %45, %vector.body136 ]
  %vec.phi139 = phi <4 x i32> [ zeroinitializer, %vector.ph132 ], [ %46, %vector.body136 ]
  %vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph132 ], [ %vec.ind.next, %vector.body136 ]
  %step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
  %37 = getelementptr inbounds [17 x i8], ptr @_ZZ4mainE3buf, i64 0, i64 %index137
  %38 = getelementptr inbounds i8, ptr %37, i64 4
  %wide.load141 = load <4 x i8>, ptr %37, align 8, !tbaa !12
  %wide.load142 = load <4 x i8>, ptr %38, align 4, !tbaa !12
  %39 = icmp eq <4 x i8> %wide.load141, <i8 89, i8 89, i8 89, i8 89>
  %40 = icmp eq <4 x i8> %wide.load142, <i8 89, i8 89, i8 89, i8 89>
  %41 = zext <4 x i1> %39 to <4 x i32>
  %42 = zext <4 x i1> %40 to <4 x i32>
  %43 = shl nuw <4 x i32> %41, %vec.ind
  %44 = shl nuw <4 x i32> %42, %step.add
  %45 = or <4 x i32> %43, %vec.phi138
  %46 = or <4 x i32> %44, %vec.phi139
  %index.next143 = add nuw i64 %index137, 8
  %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
  %47 = icmp eq i64 %index.next143, %n.vec134
  br i1 %47, label %middle.block129, label %vector.body136, !llvm.loop !13

middle.block129:                                  ; preds = %vector.body136
  %bin.rdx144 = or <4 x i32> %46, %45
  %48 = tail call i32 @llvm.vector.reduce.or.v4i32(<4 x i32> %bin.rdx144)
  %cmp.n145 = icmp eq i64 %n.vec134, %wide.trip.count
  br i1 %cmp.n145, label %._crit_edge, label %.lr.ph.preheader147

._crit_edge:                                      ; preds = %.lr.ph, %middle.block129, %.lr.ph75
  %.049.lcssa = phi i32 [ 0, %.lr.ph75 ], [ %48, %middle.block129 ], [ %61, %.lr.ph ]
  %49 = sext i32 %.049.lcssa to i64
  %50 = getelementptr inbounds [32769 x i32], ptr @cnt, i64 0, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr %50, align 4, !tbaa !5
  %53 = load i32, ptr @n, align 4, !tbaa !5
  %54 = add nsw i32 %53, -1
  store i32 %54, ptr @n, align 4, !tbaa !5
  %.not58 = icmp eq i32 %53, 0
  br i1 %.not58, label %.preheader66.loopexit, label %.lr.ph75, !llvm.loop !16

.lr.ph:                                           ; preds = %.lr.ph.preheader147, %.lr.ph
  %indvars.iv111 = phi i64 [ %indvars.iv.next112, %.lr.ph ], [ %indvars.iv111.ph, %.lr.ph.preheader147 ]
  %.04971 = phi i32 [ %61, %.lr.ph ], [ %.04971.ph, %.lr.ph.preheader147 ]
  %55 = getelementptr inbounds [17 x i8], ptr @_ZZ4mainE3buf, i64 0, i64 %indvars.iv111
  %56 = load i8, ptr %55, align 1, !tbaa !12
  %57 = icmp eq i8 %56, 89
  %58 = zext i1 %57 to i32
  %59 = trunc nuw nsw i64 %indvars.iv111 to i32
  %60 = shl nuw i32 %58, %59
  %61 = or i32 %60, %.04971
  %indvars.iv.next112 = add nuw nsw i64 %indvars.iv111, 1
  %exitcond114.not = icmp eq i64 %indvars.iv.next112, %wide.trip.count
  br i1 %exitcond114.not, label %._crit_edge, label %.lr.ph, !llvm.loop !17

._crit_edge80.loopexit.unr-lcssa:                 ; preds = %.lr.ph79, %.lr.ph79.preheader
  %spec.select64.lcssa.ph = phi i32 [ poison, %.lr.ph79.preheader ], [ %spec.select64.1, %.lr.ph79 ]
  %indvars.iv115.unr = phi i64 [ 0, %.lr.ph79.preheader ], [ %indvars.iv.next116.1, %.lr.ph79 ]
  %.04777.unr = phi i32 [ 0, %.lr.ph79.preheader ], [ %spec.select64.1, %.lr.ph79 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge80, label %.lr.ph79.epil

.lr.ph79.epil:                                    ; preds = %._crit_edge80.loopexit.unr-lcssa
  %62 = getelementptr inbounds [32769 x i32], ptr @cnt, i64 0, i64 %indvars.iv115.unr
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [100001 x i32], ptr @pw, i64 0, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = add i32 %.04777.unr, -1
  %68 = add i32 %67, %66
  %69 = icmp sgt i32 %68, 1000000006
  %70 = add nsw i32 %68, -1000000007
  %spec.select64.epil = select i1 %69, i32 %70, i32 %68
  br label %._crit_edge80

._crit_edge80:                                    ; preds = %.lr.ph79.epil, %._crit_edge80.loopexit.unr-lcssa, %.preheader66
  %.047.lcssa = phi i32 [ 0, %.preheader66 ], [ %spec.select64.lcssa.ph, %._crit_edge80.loopexit.unr-lcssa ], [ %spec.select64.epil, %.lr.ph79.epil ]
  tail call void @_Z3dfsiii(i32 noundef 1, i32 noundef %31, i32 noundef %.047.lcssa)
  %71 = load i32, ptr @all, align 4, !tbaa !5
  %.not6089 = icmp slt i32 %71, 1
  br i1 %.not6089, label %._crit_edge98, label %.lr.ph92

.lr.ph79:                                         ; preds = %.lr.ph79, %.lr.ph79.preheader.new
  %indvars.iv115 = phi i64 [ 0, %.lr.ph79.preheader.new ], [ %indvars.iv.next116.1, %.lr.ph79 ]
  %.04777 = phi i32 [ 0, %.lr.ph79.preheader.new ], [ %spec.select64.1, %.lr.ph79 ]
  %niter = phi i64 [ 0, %.lr.ph79.preheader.new ], [ %niter.next.1, %.lr.ph79 ]
  %72 = getelementptr inbounds [32769 x i32], ptr @cnt, i64 0, i64 %indvars.iv115
  %73 = load i32, ptr %72, align 8, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [100001 x i32], ptr @pw, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = add i32 %.04777, -1
  %78 = add i32 %77, %76
  %79 = icmp sgt i32 %78, 1000000006
  %80 = add nsw i32 %78, -1000000007
  %spec.select64 = select i1 %79, i32 %80, i32 %78
  %indvars.iv.next116 = or disjoint i64 %indvars.iv115, 1
  %81 = getelementptr inbounds [32769 x i32], ptr @cnt, i64 0, i64 %indvars.iv.next116
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [100001 x i32], ptr @pw, i64 0, i64 %83
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = add i32 %spec.select64, -1
  %87 = add i32 %86, %85
  %88 = icmp sgt i32 %87, 1000000006
  %89 = add nsw i32 %87, -1000000007
  %spec.select64.1 = select i1 %88, i32 %89, i32 %87
  %indvars.iv.next116.1 = add nuw nsw i64 %indvars.iv115, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge80.loopexit.unr-lcssa, label %.lr.ph79, !llvm.loop !18

.preheader:                                       ; preds = %._crit_edge88
  br i1 %.not6089, label %._crit_edge98, label %.lr.ph97.preheader

.lr.ph97.preheader:                               ; preds = %.preheader
  %90 = add nuw nsw i32 %71, 1
  %wide.trip.count123 = zext nneg i32 %90 to i64
  %91 = zext nneg i32 %71 to i64
  %min.iters.check = icmp ult i32 %71, 8
  br i1 %min.iters.check, label %.lr.ph97.preheader148, label %vector.ph

.lr.ph97.preheader148:                            ; preds = %middle.block, %.lr.ph97.preheader
  %indvars.iv120.ph = phi i64 [ 1, %.lr.ph97.preheader ], [ %ind.end, %middle.block ]
  %.04295.ph = phi i32 [ 0, %.lr.ph97.preheader ], [ %97, %middle.block ]
  br label %.lr.ph97

vector.ph:                                        ; preds = %.lr.ph97.preheader
  %n.vec = and i64 %91, 2147483640
  %ind.end = or disjoint i64 %n.vec, 1
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %94, %vector.body ]
  %vec.phi127 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %95, %vector.body ]
  %offset.idx = or disjoint i64 %index, 1
  %92 = getelementptr inbounds [32769 x i32], ptr @f, i64 0, i64 %offset.idx
  %93 = getelementptr inbounds i8, ptr %92, i64 16
  %wide.load = load <4 x i32>, ptr %92, align 4, !tbaa !5
  %wide.load128 = load <4 x i32>, ptr %93, align 4, !tbaa !5
  %94 = xor <4 x i32> %wide.load, %vec.phi
  %95 = xor <4 x i32> %wide.load128, %vec.phi127
  %index.next = add nuw i64 %index, 8
  %96 = icmp eq i64 %index.next, %n.vec
  br i1 %96, label %middle.block, label %vector.body, !llvm.loop !19

middle.block:                                     ; preds = %vector.body
  %bin.rdx = xor <4 x i32> %95, %94
  %97 = tail call i32 @llvm.vector.reduce.xor.v4i32(<4 x i32> %bin.rdx)
  %cmp.n = icmp eq i64 %n.vec, %91
  br i1 %cmp.n, label %._crit_edge98, label %.lr.ph97.preheader148

.lr.ph92:                                         ; preds = %._crit_edge80, %._crit_edge88
  %.04590 = phi i32 [ %109, %._crit_edge88 ], [ 1, %._crit_edge80 ]
  %98 = xor i32 %71, %.04590
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [32769 x i32], ptr @f, i64 0, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !5
  %102 = or i32 %71, %.04590
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [32769 x i32], ptr @f, i64 0, i64 %103
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = add nsw i32 %105, %101
  %107 = icmp sgt i32 %106, 1000000006
  %108 = add nsw i32 %106, -1000000007
  %spec.select6583 = select i1 %107, i32 %108, i32 %106
  store i32 %spec.select6583, ptr %104, align 4, !tbaa !5
  %.not6284 = icmp eq i32 %71, %.04590
  br i1 %.not6284, label %._crit_edge88, label %.lr.ph87

._crit_edge88:                                    ; preds = %.lr.ph87, %.lr.ph92
  %109 = shl i32 %.04590, 1
  %.not60 = icmp sgt i32 %109, %71
  br i1 %.not60, label %.preheader, label %.lr.ph92, !llvm.loop !20

.lr.ph87:                                         ; preds = %.lr.ph92, %.lr.ph87
  %.04385 = phi i32 [ %111, %.lr.ph87 ], [ %98, %.lr.ph92 ]
  %110 = add nsw i32 %.04385, -1
  %111 = and i32 %110, %98
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [32769 x i32], ptr @f, i64 0, i64 %112
  %114 = load i32, ptr %113, align 4, !tbaa !5
  %115 = or i32 %111, %.04590
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [32769 x i32], ptr @f, i64 0, i64 %116
  %118 = load i32, ptr %117, align 4, !tbaa !5
  %119 = add nsw i32 %118, %114
  %120 = icmp sgt i32 %119, 1000000006
  %121 = add nsw i32 %119, -1000000007
  %spec.select65 = select i1 %120, i32 %121, i32 %119
  store i32 %spec.select65, ptr %117, align 4, !tbaa !5
  %.not62 = icmp eq i32 %111, 0
  br i1 %.not62, label %._crit_edge88, label %.lr.ph87, !llvm.loop !21

._crit_edge98:                                    ; preds = %.lr.ph97, %middle.block, %._crit_edge80, %.preheader
  %.042.lcssa = phi i32 [ 0, %.preheader ], [ 0, %._crit_edge80 ], [ %97, %middle.block ], [ %127, %.lr.ph97 ]
  %122 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %.050101, i32 noundef %.042.lcssa)
  %123 = add nuw nsw i32 %.050101, 1
  %124 = load i32, ptr @t, align 4, !tbaa !5
  %.not.not = icmp slt i32 %.050101, %124
  br i1 %.not.not, label %.lr.ph103, label %._crit_edge104, !llvm.loop !22

.lr.ph97:                                         ; preds = %.lr.ph97.preheader148, %.lr.ph97
  %indvars.iv120 = phi i64 [ %indvars.iv.next121, %.lr.ph97 ], [ %indvars.iv120.ph, %.lr.ph97.preheader148 ]
  %.04295 = phi i32 [ %127, %.lr.ph97 ], [ %.04295.ph, %.lr.ph97.preheader148 ]
  %125 = getelementptr inbounds [32769 x i32], ptr @f, i64 0, i64 %indvars.iv120
  %126 = load i32, ptr %125, align 4, !tbaa !5
  %127 = xor i32 %126, %.04295
  %indvars.iv.next121 = add nuw nsw i64 %indvars.iv120, 1
  %exitcond124.not = icmp eq i64 %indvars.iv.next121, %wide.trip.count123
  br i1 %exitcond124.not, label %._crit_edge98, label %.lr.ph97, !llvm.loop !23
}

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.xor.v4i32(<4 x i32>) #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.or.v4i32(<4 x i32>) #4

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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 = !{!7, !7, i64 0}
!13 = distinct !{!13, !10, !14, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !15, !14}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10, !14, !15}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10, !15, !14}


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