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

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

@op = external dso_local global [3 x i8], align 1
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@dt = external dso_local global i32, align 4
@x = external dso_local global i32, align 4
@a = external dso_local global [17 x [100001 x i32]], align 16
@ans = external dso_local global i64, align 8
@.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 [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 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 ptr, align 8
  %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 @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %14

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

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

19:                                               ; preds = %14
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @x)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %21

21:                                               ; preds = %35, %19
  %22 = load i32, ptr %4, align 4, !tbaa !5
  %23 = icmp sle i32 %22, 16
  br i1 %23, label %25, label %24

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

25:                                               ; preds = %21
  %26 = load i32, ptr @x, align 4, !tbaa !5
  %27 = load i32, ptr %5, align 4, !tbaa !5
  %28 = and i32 %26, %27
  %29 = load i32, ptr %4, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [17 x [100001 x i32]], ptr @a, i64 0, i64 %30
  %32 = load i32, ptr %2, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [100001 x i32], ptr %31, i64 0, i64 %33
  store i32 %28, ptr %34, align 4, !tbaa !5
  br label %35

35:                                               ; preds = %25
  %36 = load i32, ptr %4, align 4, !tbaa !5
  %37 = add nsw i32 %36, 1
  store i32 %37, ptr %4, align 4, !tbaa !5
  %38 = shl i32 1, %37
  %39 = load i32, ptr %5, align 4, !tbaa !5
  %40 = or i32 %39, %38
  store i32 %40, ptr %5, align 4, !tbaa !5
  br label %21, !llvm.loop !9

41:                                               ; preds = %24
  br label %42

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

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

46:                                               ; preds = %62, %45
  %47 = load i32, ptr %6, align 4, !tbaa !5
  %48 = icmp slt i32 %47, 16
  br i1 %48, label %50, label %49

49:                                               ; preds = %46
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %65

50:                                               ; preds = %46
  %51 = load i32, ptr %6, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [17 x [100001 x i32]], ptr @a, i64 0, i64 %52
  %54 = getelementptr inbounds [100001 x i32], ptr %53, i64 0, i64 0
  %55 = load i32, ptr %6, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [17 x [100001 x i32]], ptr @a, i64 0, i64 %56
  %58 = getelementptr inbounds [100001 x i32], ptr %57, i64 0, i64 0
  %59 = load i32, ptr @n, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds i32, ptr %58, i64 %60
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef %54, ptr noundef %61)
  br label %62

62:                                               ; preds = %50
  %63 = load i32, ptr %6, align 4, !tbaa !5
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %6, align 4, !tbaa !5
  br label %46, !llvm.loop !12

65:                                               ; preds = %49
  br label %66

66:                                               ; preds = %133, %65
  %67 = load i32, ptr @m, align 4, !tbaa !5
  %68 = add nsw i32 %67, -1
  store i32 %68, ptr @m, align 4, !tbaa !5
  %69 = icmp ne i32 %67, 0
  br i1 %69, label %70, label %134

70:                                               ; preds = %66
  %71 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef @op, ptr noundef @x)
  %72 = load i8, ptr @op, align 1, !tbaa !13
  %73 = sext i8 %72 to i32
  %74 = icmp eq i32 %73, 65
  br i1 %74, label %75, label %80

75:                                               ; preds = %70
  %76 = load i32, ptr @dt, align 4, !tbaa !5
  %77 = load i32, ptr @x, align 4, !tbaa !5
  %78 = add nsw i32 %76, %77
  %79 = and i32 %78, 65535
  store i32 %79, ptr @dt, align 4, !tbaa !5
  br label %133

80:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %81 = load i32, ptr @x, 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 = getelementptr inbounds [100001 x i32], ptr %83, i64 0, i64 0
  store ptr %84, ptr %7, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %85 = load i32, ptr @x, align 4, !tbaa !5
  %86 = add nsw i32 %85, 1
  %87 = shl i32 1, %86
  %88 = sub nsw i32 %87, 1
  store i32 %88, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %89 = load i32, ptr @x, align 4, !tbaa !5
  %90 = shl i32 1, %89
  %91 = load i32, ptr @dt, align 4, !tbaa !5
  %92 = sub nsw i32 %90, %91
  %93 = load i32, ptr %8, align 4, !tbaa !5
  %94 = and i32 %92, %93
  store i32 %94, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %95 = load i32, ptr %8, align 4, !tbaa !5
  %96 = load i32, ptr @dt, align 4, !tbaa !5
  %97 = sub nsw i32 %95, %96
  %98 = load i32, ptr %8, align 4, !tbaa !5
  %99 = and i32 %97, %98
  store i32 %99, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %100 = load ptr, ptr %7, align 8, !tbaa !14
  %101 = load ptr, ptr %7, align 8, !tbaa !14
  %102 = load i32, ptr @n, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds i32, ptr %101, i64 %103
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  %105 = load i32, ptr %10, align 4, !tbaa !5
  %106 = add nsw i32 %105, 1
  store i32 %106, ptr %12, align 4, !tbaa !5
  %107 = call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef %100, ptr noundef %104, ptr noundef nonnull align 4 dereferenceable(4) %12)
  %108 = load ptr, ptr %7, align 8, !tbaa !14
  %109 = load ptr, ptr %7, align 8, !tbaa !14
  %110 = load i32, ptr @n, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds i32, ptr %109, i64 %111
  %113 = call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef %108, ptr noundef %112, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %114 = ptrtoint ptr %107 to i64
  %115 = ptrtoint ptr %113 to i64
  %116 = sub i64 %114, %115
  %117 = sdiv exact i64 %116, 4
  %118 = trunc i64 %117 to i32
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  store i32 %118, ptr %11, align 4, !tbaa !5
  %119 = load i32, ptr %9, align 4, !tbaa !5
  %120 = load i32, ptr %10, align 4, !tbaa !5
  %121 = icmp sgt i32 %119, %120
  br i1 %121, label %122, label %126

122:                                              ; preds = %80
  %123 = load i32, ptr @n, align 4, !tbaa !5
  %124 = load i32, ptr %11, align 4, !tbaa !5
  %125 = add nsw i32 %123, %124
  br label %128

126:                                              ; preds = %80
  %127 = load i32, ptr %11, align 4, !tbaa !5
  br label %128

128:                                              ; preds = %126, %122
  %129 = phi i32 [ %125, %122 ], [ %127, %126 ]
  %130 = sext i32 %129 to i64
  %131 = load i64, ptr @ans, align 8, !tbaa !16
  %132 = add nsw i64 %131, %130
  store i64 %132, ptr @ans, align 8, !tbaa !16
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  br label %133

133:                                              ; preds = %128, %75
  br label %66, !llvm.loop !18

134:                                              ; preds = %66
  %135 = load i64, ptr @ans, align 8, !tbaa !16
  %136 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i64 noundef %135)
  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 uwtable
declare dso_local void @_ZSt4sortIPiEvT_S1_(ptr noundef, ptr noundef) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef, ptr noundef, 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 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 = !{!7, !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"any pointer", !7, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"long long", !7, i64 0}
!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"

@op = external dso_local global [3 x i8], align 1
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@dt = external dso_local local_unnamed_addr global i32, align 4
@x = external dso_local global i32, align 4
@a = external dso_local global [17 x [100001 x i32]], align 16
@ans = external dso_local local_unnamed_addr global i64, align 8
@.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 [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1

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

..preheader25_crit_edge:                          ; preds = %0
  %.pre = sext i32 %4 to i64
  br label %.preheader25

.preheader25:                                     ; preds = %.lr.ph, %..preheader25_crit_edge
  %.pre-phi = phi i64 [ %.pre, %..preheader25_crit_edge ], [ %91, %.lr.ph ]
  %6 = getelementptr inbounds i32, ptr @a, i64 %.pre-phi
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull @a, ptr noundef nonnull %6)
  %7 = load i32, ptr @n, align 4, !tbaa !5
  %8 = sext i32 %7 to i64
  %9 = getelementptr inbounds i32, ptr getelementptr inbounds (i8, ptr @a, i64 400004), i64 %8
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @a, i64 400004), ptr noundef nonnull %9)
  %10 = load i32, ptr @n, align 4, !tbaa !5
  %11 = sext i32 %10 to i64
  %12 = getelementptr inbounds i32, ptr getelementptr inbounds (i8, ptr @a, i64 800008), i64 %11
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @a, i64 800008), ptr noundef nonnull %12)
  %13 = load i32, ptr @n, align 4, !tbaa !5
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds i32, ptr getelementptr inbounds (i8, ptr @a, i64 1200012), i64 %14
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @a, i64 1200012), ptr noundef nonnull %15)
  %16 = load i32, ptr @n, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds i32, ptr getelementptr inbounds (i8, ptr @a, i64 1600016), i64 %17
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @a, i64 1600016), ptr noundef nonnull %18)
  %19 = load i32, ptr @n, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds i32, ptr getelementptr inbounds (i8, ptr @a, i64 2000020), i64 %20
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @a, i64 2000020), ptr noundef nonnull %21)
  %22 = load i32, ptr @n, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds i32, ptr getelementptr inbounds (i8, ptr @a, i64 2400024), i64 %23
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @a, i64 2400024), ptr noundef nonnull %24)
  %25 = load i32, ptr @n, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds i32, ptr getelementptr inbounds (i8, ptr @a, i64 2800028), i64 %26
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @a, i64 2800028), ptr noundef nonnull %27)
  %28 = load i32, ptr @n, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds i32, ptr getelementptr inbounds (i8, ptr @a, i64 3200032), i64 %29
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @a, i64 3200032), ptr noundef nonnull %30)
  %31 = load i32, ptr @n, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds i32, ptr getelementptr inbounds (i8, ptr @a, i64 3600036), i64 %32
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @a, i64 3600036), ptr noundef nonnull %33)
  %34 = load i32, ptr @n, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds i32, ptr getelementptr inbounds (i8, ptr @a, i64 4000040), i64 %35
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @a, i64 4000040), ptr noundef nonnull %36)
  %37 = load i32, ptr @n, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds i32, ptr getelementptr inbounds (i8, ptr @a, i64 4400044), i64 %38
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @a, i64 4400044), ptr noundef nonnull %39)
  %40 = load i32, ptr @n, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds i32, ptr getelementptr inbounds (i8, ptr @a, i64 4800048), i64 %41
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @a, i64 4800048), ptr noundef nonnull %42)
  %43 = load i32, ptr @n, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds i32, ptr getelementptr inbounds (i8, ptr @a, i64 5200052), i64 %44
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @a, i64 5200052), ptr noundef nonnull %45)
  %46 = load i32, ptr @n, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds i32, ptr getelementptr inbounds (i8, ptr @a, i64 5600056), i64 %47
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @a, i64 5600056), ptr noundef nonnull %48)
  %49 = load i32, ptr @n, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds i32, ptr getelementptr inbounds (i8, ptr @a, i64 6000060), i64 %50
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @a, i64 6000060), ptr noundef nonnull %51)
  %52 = load i32, ptr @m, align 4, !tbaa !5
  %53 = add nsw i32 %52, -1
  store i32 %53, ptr @m, align 4, !tbaa !5
  %.not30 = icmp eq i32 %52, 0
  br i1 %.not30, label %._crit_edge, label %.lr.ph31

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %54 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @x)
  %55 = load i32, ptr @x, align 4, !tbaa !5
  %56 = and i32 %55, 1
  %57 = getelementptr inbounds [17 x [100001 x i32]], ptr @a, i64 0, i64 0, i64 %indvars.iv
  store i32 %56, ptr %57, align 4, !tbaa !5
  %58 = and i32 %55, 3
  %59 = getelementptr inbounds [17 x [100001 x i32]], ptr @a, i64 0, i64 1, i64 %indvars.iv
  store i32 %58, ptr %59, align 4, !tbaa !5
  %60 = and i32 %55, 7
  %61 = getelementptr inbounds [17 x [100001 x i32]], ptr @a, i64 0, i64 2, i64 %indvars.iv
  store i32 %60, ptr %61, align 4, !tbaa !5
  %62 = and i32 %55, 15
  %63 = getelementptr inbounds [17 x [100001 x i32]], ptr @a, i64 0, i64 3, i64 %indvars.iv
  store i32 %62, ptr %63, align 4, !tbaa !5
  %64 = and i32 %55, 31
  %65 = getelementptr inbounds [17 x [100001 x i32]], ptr @a, i64 0, i64 4, i64 %indvars.iv
  store i32 %64, ptr %65, align 4, !tbaa !5
  %66 = and i32 %55, 63
  %67 = getelementptr inbounds [17 x [100001 x i32]], ptr @a, i64 0, i64 5, i64 %indvars.iv
  store i32 %66, ptr %67, align 4, !tbaa !5
  %68 = and i32 %55, 127
  %69 = getelementptr inbounds [17 x [100001 x i32]], ptr @a, i64 0, i64 6, i64 %indvars.iv
  store i32 %68, ptr %69, align 4, !tbaa !5
  %70 = and i32 %55, 255
  %71 = getelementptr inbounds [17 x [100001 x i32]], ptr @a, i64 0, i64 7, i64 %indvars.iv
  store i32 %70, ptr %71, align 4, !tbaa !5
  %72 = and i32 %55, 511
  %73 = getelementptr inbounds [17 x [100001 x i32]], ptr @a, i64 0, i64 8, i64 %indvars.iv
  store i32 %72, ptr %73, align 4, !tbaa !5
  %74 = and i32 %55, 1023
  %75 = getelementptr inbounds [17 x [100001 x i32]], ptr @a, i64 0, i64 9, i64 %indvars.iv
  store i32 %74, ptr %75, align 4, !tbaa !5
  %76 = and i32 %55, 2047
  %77 = getelementptr inbounds [17 x [100001 x i32]], ptr @a, i64 0, i64 10, i64 %indvars.iv
  store i32 %76, ptr %77, align 4, !tbaa !5
  %78 = and i32 %55, 4095
  %79 = getelementptr inbounds [17 x [100001 x i32]], ptr @a, i64 0, i64 11, i64 %indvars.iv
  store i32 %78, ptr %79, align 4, !tbaa !5
  %80 = and i32 %55, 8191
  %81 = getelementptr inbounds [17 x [100001 x i32]], ptr @a, i64 0, i64 12, i64 %indvars.iv
  store i32 %80, ptr %81, align 4, !tbaa !5
  %82 = and i32 %55, 16383
  %83 = getelementptr inbounds [17 x [100001 x i32]], ptr @a, i64 0, i64 13, i64 %indvars.iv
  store i32 %82, ptr %83, align 4, !tbaa !5
  %84 = and i32 %55, 32767
  %85 = getelementptr inbounds [17 x [100001 x i32]], ptr @a, i64 0, i64 14, i64 %indvars.iv
  store i32 %84, ptr %85, align 4, !tbaa !5
  %86 = and i32 %55, 65535
  %87 = getelementptr inbounds [17 x [100001 x i32]], ptr @a, i64 0, i64 15, i64 %indvars.iv
  store i32 %86, ptr %87, align 4, !tbaa !5
  %88 = and i32 %55, 131071
  %89 = getelementptr inbounds [17 x [100001 x i32]], ptr @a, i64 0, i64 16, i64 %indvars.iv
  store i32 %88, ptr %89, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %90 = load i32, ptr @n, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = icmp slt i64 %indvars.iv.next, %91
  br i1 %92, label %.lr.ph, label %.preheader25, !llvm.loop !9

.lr.ph31:                                         ; preds = %.preheader25, %135
  %93 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull @op, ptr noundef nonnull @x)
  %94 = load i8, ptr @op, align 1, !tbaa !11
  %95 = icmp eq i8 %94, 65
  br i1 %95, label %96, label %101

96:                                               ; preds = %.lr.ph31
  %97 = load i32, ptr @dt, align 4, !tbaa !5
  %98 = load i32, ptr @x, align 4, !tbaa !5
  %99 = add nsw i32 %98, %97
  %100 = and i32 %99, 65535
  store i32 %100, ptr @dt, align 4, !tbaa !5
  br label %135

101:                                              ; preds = %.lr.ph31
  %102 = load i32, ptr @x, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [17 x [100001 x i32]], ptr @a, i64 0, i64 %103
  %105 = add nsw i32 %102, 1
  %notmask = shl nsw i32 -1, %105
  %106 = xor i32 %notmask, -1
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  %107 = shl nuw i32 1, %102
  %108 = load i32, ptr @dt, align 4, !tbaa !5
  %109 = sub nsw i32 %107, %108
  %110 = and i32 %109, %106
  store i32 %110, ptr %1, align 4, !tbaa !5
  %111 = sub nsw i32 %106, %108
  %112 = and i32 %111, %106
  %113 = load i32, ptr @n, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds i32, ptr %104, i64 %114
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  %116 = add nuw nsw i32 %112, 1
  store i32 %116, ptr %2, align 4, !tbaa !5
  %117 = call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef nonnull %104, ptr noundef nonnull %115, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %118 = load i32, ptr @n, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds i32, ptr %104, i64 %119
  %121 = call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef nonnull %104, ptr noundef nonnull %120, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %122 = ptrtoint ptr %117 to i64
  %123 = ptrtoint ptr %121 to i64
  %124 = sub i64 %122, %123
  %125 = lshr exact i64 %124, 2
  %126 = trunc i64 %125 to i32
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  %127 = load i32, ptr %1, align 4, !tbaa !5
  %128 = icmp sgt i32 %127, %112
  %129 = load i32, ptr @n, align 4
  %130 = select i1 %128, i32 %129, i32 0
  %131 = add nsw i32 %130, %126
  %132 = sext i32 %131 to i64
  %133 = load i64, ptr @ans, align 8, !tbaa !12
  %134 = add nsw i64 %133, %132
  store i64 %134, ptr @ans, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  br label %135

135:                                              ; preds = %101, %96
  %136 = load i32, ptr @m, align 4, !tbaa !5
  %137 = add nsw i32 %136, -1
  store i32 %137, ptr @m, align 4, !tbaa !5
  %.not = icmp eq i32 %136, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph31, !llvm.loop !14

._crit_edge:                                      ; preds = %135, %.preheader25
  %138 = load i64, ptr @ans, align 8, !tbaa !12
  %139 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %138)
  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 uwtable
declare dso_local void @_ZSt4sortIPiEvT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef, ptr noundef, 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 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 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 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = distinct !{!14, !10}


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