; LLVM IR from tangjz/acm-icpc :: self_training/2016-06-18 (F)

; 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
@m = external dso_local global i32, align 4
@tot = external dso_local global i32, align 4
@ans = external dso_local global [640064 x i32], align 16
@n = external dso_local global i64, align 8
@a = external dso_local global [10001 x i64], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@_ZZ4mainE1d = external hidden global i32, align 4
@_ZZ4mainE3seq = external hidden global [64 x i32], align 16
@.str.3 = 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 i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  br label %11

11:                                               ; preds = %160, %0
  %12 = load i32, ptr @t, align 4, !tbaa !5
  %13 = add nsw i32 %12, -1
  store i32 %13, ptr @t, align 4, !tbaa !5
  %14 = icmp ne i32 %12, 0
  br i1 %14, label %15, label %162

15:                                               ; preds = %11
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @n, ptr noundef @a, ptr noundef @m)
  %17 = load i64, ptr @a, align 16, !tbaa !9
  %18 = add nsw i64 %17, -1
  store i64 %18, ptr @a, align 16, !tbaa !9
  store i32 0, ptr @tot, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %19

19:                                               ; preds = %34, %15
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = load i32, ptr @m, align 4, !tbaa !5
  %22 = icmp sle i32 %20, %21
  br i1 %22, label %24, label %23

23:                                               ; preds = %19
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  br label %37

24:                                               ; preds = %19
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds i64, ptr @a, i64 %26
  %28 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %27)
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [10001 x i64], ptr @a, i64 0, i64 %30
  %32 = load i64, ptr %31, align 8, !tbaa !9
  %33 = add nsw i64 %32, -1
  store i64 %33, ptr %31, align 8, !tbaa !9
  br label %34

34:                                               ; preds = %24
  %35 = load i32, ptr %2, align 4, !tbaa !5
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr %2, align 4, !tbaa !5
  br label %19, !llvm.loop !11

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

38:                                               ; preds = %136, %37
  %39 = load i32, ptr %3, align 4, !tbaa !5
  %40 = load i32, ptr @m, align 4, !tbaa !5
  %41 = icmp sle i32 %39, %40
  br i1 %41, label %43, label %42

42:                                               ; preds = %38
  store i32 7, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %139

43:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %44 = load i32, ptr %3, align 4, !tbaa !5
  %45 = sub nsw i32 %44, 1
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [10001 x i64], ptr @a, i64 0, i64 %46
  %48 = load i64, ptr %47, align 8, !tbaa !9
  store i64 %48, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %49 = load i32, ptr %3, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [10001 x i64], ptr @a, i64 0, i64 %50
  %52 = load i64, ptr %51, align 8, !tbaa !9
  store i64 %52, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  store i32 0, ptr @_ZZ4mainE1d, align 4, !tbaa !5
  br label %53

53:                                               ; preds = %72, %43
  %54 = load i64, ptr %6, align 8, !tbaa !9
  %55 = load i64, ptr %5, align 8, !tbaa !9
  %56 = sub nsw i64 %54, %55
  store i64 %56, ptr %7, align 8, !tbaa !9
  %57 = load i64, ptr %7, align 8, !tbaa !9
  %58 = icmp slt i64 %57, 0
  br i1 %58, label %59, label %64

59:                                               ; preds = %53
  %60 = load i64, ptr @n, align 8, !tbaa !9
  %61 = shl i64 %60, 1
  %62 = load i64, ptr %7, align 8, !tbaa !9
  %63 = add nsw i64 %62, %61
  store i64 %63, ptr %7, align 8, !tbaa !9
  br label %64

64:                                               ; preds = %59, %53
  %65 = load i64, ptr %7, align 8, !tbaa !9
  %66 = load i32, ptr @_ZZ4mainE1d, align 4, !tbaa !5
  %67 = zext i32 %66 to i64
  %68 = shl i64 1, %67
  %69 = icmp slt i64 %65, %68
  br i1 %69, label %70, label %71

70:                                               ; preds = %64
  br label %80

71:                                               ; preds = %64
  br label %72

72:                                               ; preds = %71
  %73 = load i32, ptr @_ZZ4mainE1d, align 4, !tbaa !5
  %74 = add nsw i32 %73, 1
  store i32 %74, ptr @_ZZ4mainE1d, align 4, !tbaa !5
  %75 = load i64, ptr %5, align 8, !tbaa !9
  %76 = shl i64 %75, 1
  %77 = load i64, ptr @n, align 8, !tbaa !9
  %78 = shl i64 %77, 1
  %79 = srem i64 %76, %78
  store i64 %79, ptr %5, align 8, !tbaa !9
  br label %53, !llvm.loop !13

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

81:                                               ; preds = %87, %80
  %82 = load i32, ptr %8, align 4, !tbaa !5
  %83 = load i32, ptr @_ZZ4mainE1d, align 4, !tbaa !5
  %84 = icmp slt i32 %82, %83
  br i1 %84, label %86, label %85

85:                                               ; preds = %81
  store i32 13, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %97

86:                                               ; preds = %81
  br label %87

87:                                               ; preds = %86
  %88 = load i64, ptr %7, align 8, !tbaa !9
  %89 = and i64 %88, 1
  %90 = trunc i64 %89 to i32
  %91 = load i32, ptr %8, align 4, !tbaa !5
  %92 = add nsw i32 %91, 1
  store i32 %92, ptr %8, align 4, !tbaa !5
  %93 = sext i32 %91 to i64
  %94 = getelementptr inbounds [64 x i32], ptr @_ZZ4mainE3seq, i64 0, i64 %93
  store i32 %90, ptr %94, align 4, !tbaa !5
  %95 = load i64, ptr %7, align 8, !tbaa !9
  %96 = ashr i64 %95, 1
  store i64 %96, ptr %7, align 8, !tbaa !9
  br label %81, !llvm.loop !14

97:                                               ; preds = %85
  %98 = load i32, ptr %3, align 4, !tbaa !5
  %99 = sub nsw i32 %98, 1
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [10001 x i64], ptr @a, i64 0, i64 %100
  %102 = load i64, ptr %101, align 8, !tbaa !9
  store i64 %102, ptr %5, align 8, !tbaa !9
  br label %103

103:                                              ; preds = %107, %97
  %104 = load i32, ptr @_ZZ4mainE1d, align 4, !tbaa !5
  %105 = add nsw i32 %104, -1
  store i32 %105, ptr @_ZZ4mainE1d, align 4, !tbaa !5
  %106 = icmp ne i32 %104, 0
  br i1 %106, label %107, label %135

107:                                              ; preds = %103
  %108 = load i64, ptr %5, align 8, !tbaa !9
  %109 = load i64, ptr @n, align 8, !tbaa !9
  %110 = icmp slt i64 %108, %109
  %111 = zext i1 %110 to i32
  %112 = load i32, ptr @_ZZ4mainE1d, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [64 x i32], ptr @_ZZ4mainE3seq, i64 0, i64 %113
  %115 = load i32, ptr %114, align 4, !tbaa !5
  %116 = icmp eq i32 %115, 1
  %117 = zext i1 %116 to i32
  %118 = icmp eq i32 %111, %117
  %119 = zext i1 %118 to i32
  %120 = load i32, ptr @tot, align 4, !tbaa !5
  %121 = add nsw i32 %120, 1
  store i32 %121, ptr @tot, align 4, !tbaa !5
  %122 = sext i32 %120 to i64
  %123 = getelementptr inbounds [640064 x i32], ptr @ans, i64 0, i64 %122
  store i32 %119, ptr %123, align 4, !tbaa !5
  %124 = load i64, ptr %5, align 8, !tbaa !9
  %125 = shl i64 %124, 1
  %126 = load i32, ptr @_ZZ4mainE1d, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [64 x i32], ptr @_ZZ4mainE3seq, i64 0, i64 %127
  %129 = load i32, ptr %128, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = add nsw i64 %125, %130
  %132 = load i64, ptr @n, align 8, !tbaa !9
  %133 = shl i64 %132, 1
  %134 = srem i64 %131, %133
  store i64 %134, ptr %5, align 8, !tbaa !9
  br label %103, !llvm.loop !15

135:                                              ; preds = %103
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  br label %136

136:                                              ; preds = %135
  %137 = load i32, ptr %3, align 4, !tbaa !5
  %138 = add nsw i32 %137, 1
  store i32 %138, ptr %3, align 4, !tbaa !5
  br label %38, !llvm.loop !16

139:                                              ; preds = %42
  %140 = load i32, ptr @tot, align 4, !tbaa !5
  %141 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %140)
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %142

142:                                              ; preds = %157, %139
  %143 = load i32, ptr %9, align 4, !tbaa !5
  %144 = load i32, ptr @tot, align 4, !tbaa !5
  %145 = icmp slt i32 %143, %144
  br i1 %145, label %147, label %146

146:                                              ; preds = %142
  store i32 18, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %160

147:                                              ; preds = %142
  %148 = load i32, ptr %9, align 4, !tbaa !5
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [640064 x i32], ptr @ans, i64 0, i64 %149
  %151 = load i32, ptr %150, align 4, !tbaa !5
  %152 = icmp ne i32 %151, 0
  %153 = zext i1 %152 to i64
  %154 = select i1 %152, i8 76, i8 82
  %155 = sext i8 %154 to i32
  %156 = call i32 @putchar(i32 noundef %155)
  br label %157

157:                                              ; preds = %147
  %158 = load i32, ptr %9, align 4, !tbaa !5
  %159 = add nsw i32 %158, 1
  store i32 %159, ptr %9, align 4, !tbaa !5
  br label %142, !llvm.loop !17

160:                                              ; preds = %146
  %161 = call i32 @putchar(i32 noundef 10)
  br label %11, !llvm.loop !18

162:                                              ; preds = %11
  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

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

; Function Attrs: inlinehint mustprogress uwtable
declare i32 @putchar(i32 noundef) #3

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 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}


; 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
@m = external dso_local global i32, align 4
@tot = external dso_local local_unnamed_addr global i32, align 4
@ans = external dso_local local_unnamed_addr global [640064 x i32], align 16
@n = external dso_local global i64, align 8
@a = external dso_local global [10001 x i64], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@_ZZ4mainE1d = external hidden local_unnamed_addr global i32, align 4
@_ZZ4mainE3seq = external hidden local_unnamed_addr global [64 x i32], align 16
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nofree norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %2 = load i32, ptr @t, align 4, !tbaa !5
  %3 = add nsw i32 %2, -1
  store i32 %3, ptr @t, align 4, !tbaa !5
  %.not75 = icmp eq i32 %2, 0
  br i1 %.not75, label %._crit_edge78, label %.lr.ph77

.lr.ph77:                                         ; preds = %0, %._crit_edge74
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n, ptr noundef nonnull @a, ptr noundef nonnull @m)
  %5 = load i64, ptr @a, align 16, !tbaa !9
  %6 = add nsw i64 %5, -1
  store i64 %6, ptr @a, align 16, !tbaa !9
  store i32 0, ptr @tot, align 4, !tbaa !5
  %7 = load i32, ptr @m, align 4, !tbaa !5
  %.not3241 = icmp slt i32 %7, 1
  br i1 %.not3241, label %.preheader37._crit_edge, label %.lr.ph

.preheader37:                                     ; preds = %.lr.ph
  %.not3366 = icmp slt i32 %15, 1
  br i1 %.not3366, label %.preheader37._crit_edge, label %.lr.ph69

.preheader37._crit_edge:                          ; preds = %.lr.ph77, %.preheader37
  %.pre106 = load i32, ptr @tot, align 4, !tbaa !5
  br label %17

.lr.ph69:                                         ; preds = %.preheader37
  %tot.promoted63 = load i32, ptr @tot, align 4, !tbaa !5
  %8 = load i64, ptr @n, align 8
  %9 = shl i64 %8, 1
  %10 = add nuw i32 %15, 1
  %wide.trip.count101 = zext i32 %10 to i64
  %.pre = load i64, ptr @a, align 16, !tbaa !9
  br label %22

.lr.ph:                                           ; preds = %.lr.ph77, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %.lr.ph77 ]
  %11 = getelementptr inbounds i64, ptr @a, i64 %indvars.iv
  %12 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %11)
  %13 = load i64, ptr %11, align 8, !tbaa !9
  %14 = add nsw i64 %13, -1
  store i64 %14, ptr %11, align 8, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %15 = load i32, ptr @m, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %.not32.not = icmp slt i64 %indvars.iv, %16
  br i1 %.not32.not, label %.lr.ph, label %.preheader37, !llvm.loop !11

._crit_edge70:                                    ; preds = %.preheader
  store i32 -1, ptr @_ZZ4mainE1d, align 4, !tbaa !5
  br label %17

17:                                               ; preds = %.preheader37._crit_edge, %._crit_edge70
  %18 = phi i32 [ %.pre106, %.preheader37._crit_edge ], [ %.lcssa6064, %._crit_edge70 ]
  %19 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %18)
  %20 = load i32, ptr @tot, align 4, !tbaa !5
  %21 = icmp sgt i32 %20, 0
  br i1 %21, label %.lr.ph73, label %._crit_edge74

22:                                               ; preds = %.lr.ph69, %.preheader
  %23 = phi i64 [ %.pre, %.lr.ph69 ], [ %25, %.preheader ]
  %indvars.iv98 = phi i64 [ 1, %.lr.ph69 ], [ %indvars.iv.next99, %.preheader ]
  %.lcssa606567 = phi i32 [ %tot.promoted63, %.lr.ph69 ], [ %.lcssa6064, %.preheader ]
  %24 = getelementptr inbounds [10001 x i64], ptr @a, i64 0, i64 %indvars.iv98
  %25 = load i64, ptr %24, align 8, !tbaa !9
  %26 = sub nsw i64 %25, %23
  %27 = icmp slt i64 %26, 0
  %28 = select i1 %27, i64 %9, i64 0
  %.02543 = add nsw i64 %28, %26
  %29 = icmp slt i64 %.02543, 1
  br i1 %29, label %.preheader, label %.lr.ph45

.lr.ph53.preheader:                               ; preds = %.lr.ph45
  %wide.trip.count = and i64 %indvars.iv.next86, 4294967295
  %30 = add nsw i64 %wide.trip.count, -1
  %xtraiter = and i64 %indvars.iv.next86, 3
  %31 = icmp ult i64 %30, 3
  br i1 %31, label %.lr.ph58.preheader.unr-lcssa, label %.lr.ph53.preheader.new

.lr.ph53.preheader.new:                           ; preds = %.lr.ph53.preheader
  %unroll_iter = sub nsw i64 %wide.trip.count, %xtraiter
  br label %.lr.ph53

.lr.ph45:                                         ; preds = %22, %.lr.ph45
  %indvars.iv85 = phi i64 [ %indvars.iv.next86, %.lr.ph45 ], [ 0, %22 ]
  %.02744 = phi i64 [ %33, %.lr.ph45 ], [ %23, %22 ]
  %indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
  %32 = shl i64 %.02744, 1
  %33 = srem i64 %32, %9
  %34 = sub nsw i64 %25, %33
  %35 = icmp slt i64 %34, 0
  %36 = select i1 %35, i64 %9, i64 0
  %.025 = add nsw i64 %36, %34
  %37 = shl nuw i64 2, %indvars.iv85
  %38 = icmp slt i64 %.025, %37
  br i1 %38, label %.lr.ph53.preheader, label %.lr.ph45, !llvm.loop !13

.lr.ph58.preheader.unr-lcssa:                     ; preds = %.lr.ph53, %.lr.ph53.preheader
  %indvars.iv88.unr = phi i64 [ 0, %.lr.ph53.preheader ], [ %indvars.iv.next89.3, %.lr.ph53 ]
  %.151.unr = phi i64 [ %.025, %.lr.ph53.preheader ], [ %60, %.lr.ph53 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph58.preheader, label %.lr.ph53.epil

.lr.ph53.epil:                                    ; preds = %.lr.ph58.preheader.unr-lcssa, %.lr.ph53.epil
  %indvars.iv88.epil = phi i64 [ %indvars.iv.next89.epil, %.lr.ph53.epil ], [ %indvars.iv88.unr, %.lr.ph58.preheader.unr-lcssa ]
  %.151.epil = phi i64 [ %42, %.lr.ph53.epil ], [ %.151.unr, %.lr.ph58.preheader.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph53.epil ], [ 0, %.lr.ph58.preheader.unr-lcssa ]
  %39 = trunc i64 %.151.epil to i32
  %40 = and i32 %39, 1
  %indvars.iv.next89.epil = add nuw nsw i64 %indvars.iv88.epil, 1
  %41 = getelementptr inbounds [64 x i32], ptr @_ZZ4mainE3seq, i64 0, i64 %indvars.iv88.epil
  store i32 %40, ptr %41, align 4, !tbaa !5
  %42 = ashr i64 %.151.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %.lr.ph58.preheader, label %.lr.ph53.epil, !llvm.loop !14

.lr.ph58.preheader:                               ; preds = %.lr.ph53.epil, %.lr.ph58.preheader.unr-lcssa
  %43 = and i64 %indvars.iv.next86, 4294967295
  %44 = sext i32 %.lcssa606567 to i64
  br label %.lr.ph58

.lr.ph53:                                         ; preds = %.lr.ph53, %.lr.ph53.preheader.new
  %indvars.iv88 = phi i64 [ 0, %.lr.ph53.preheader.new ], [ %indvars.iv.next89.3, %.lr.ph53 ]
  %.151 = phi i64 [ %.025, %.lr.ph53.preheader.new ], [ %60, %.lr.ph53 ]
  %niter = phi i64 [ 0, %.lr.ph53.preheader.new ], [ %niter.next.3, %.lr.ph53 ]
  %45 = trunc i64 %.151 to i32
  %46 = and i32 %45, 1
  %indvars.iv.next89 = or disjoint i64 %indvars.iv88, 1
  %47 = getelementptr inbounds [64 x i32], ptr @_ZZ4mainE3seq, i64 0, i64 %indvars.iv88
  store i32 %46, ptr %47, align 16, !tbaa !5
  %48 = trunc i64 %.151 to i32
  %49 = lshr i32 %48, 1
  %50 = and i32 %49, 1
  %indvars.iv.next89.1 = or disjoint i64 %indvars.iv88, 2
  %51 = getelementptr inbounds [64 x i32], ptr @_ZZ4mainE3seq, i64 0, i64 %indvars.iv.next89
  store i32 %50, ptr %51, align 4, !tbaa !5
  %52 = trunc i64 %.151 to i32
  %53 = lshr i32 %52, 2
  %54 = and i32 %53, 1
  %indvars.iv.next89.2 = or disjoint i64 %indvars.iv88, 3
  %55 = getelementptr inbounds [64 x i32], ptr @_ZZ4mainE3seq, i64 0, i64 %indvars.iv.next89.1
  store i32 %54, ptr %55, align 8, !tbaa !5
  %56 = trunc i64 %.151 to i32
  %57 = lshr i32 %56, 3
  %58 = and i32 %57, 1
  %indvars.iv.next89.3 = add nuw nsw i64 %indvars.iv88, 4
  %59 = getelementptr inbounds [64 x i32], ptr @_ZZ4mainE3seq, i64 0, i64 %indvars.iv.next89.2
  store i32 %58, ptr %59, align 4, !tbaa !5
  %60 = ashr i64 %.151, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %.lr.ph58.preheader.unr-lcssa, label %.lr.ph53, !llvm.loop !16

.lr.ph58:                                         ; preds = %.lr.ph58.preheader, %.lr.ph58
  %indvars.iv93 = phi i64 [ %44, %.lr.ph58.preheader ], [ %indvars.iv.next94, %.lr.ph58 ]
  %indvars.iv91.in = phi i64 [ %43, %.lr.ph58.preheader ], [ %indvars.iv91, %.lr.ph58 ]
  %.12857 = phi i64 [ %23, %.lr.ph58.preheader ], [ %71, %.lr.ph58 ]
  %indvars.iv91 = add nsw i64 %indvars.iv91.in, -1
  %61 = icmp slt i64 %.12857, %8
  %62 = getelementptr inbounds [64 x i32], ptr @_ZZ4mainE3seq, i64 0, i64 %indvars.iv91
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = icmp ne i32 %63, 1
  %65 = xor i1 %61, %64
  %66 = zext i1 %65 to i32
  %indvars.iv.next94 = add nsw i64 %indvars.iv93, 1
  %67 = getelementptr inbounds [640064 x i32], ptr @ans, i64 0, i64 %indvars.iv93
  store i32 %66, ptr %67, align 4, !tbaa !5
  %68 = shl i64 %.12857, 1
  %69 = sext i32 %63 to i64
  %70 = add nsw i64 %68, %69
  %71 = srem i64 %70, %9
  %72 = icmp eq i64 %indvars.iv91, 0
  br i1 %72, label %._crit_edge, label %.lr.ph58, !llvm.loop !17

._crit_edge:                                      ; preds = %.lr.ph58
  %73 = trunc nsw i64 %indvars.iv.next94 to i32
  store i32 %73, ptr @tot, align 4, !tbaa !5
  br label %.preheader

.preheader:                                       ; preds = %22, %._crit_edge
  %.lcssa6064 = phi i32 [ %73, %._crit_edge ], [ %.lcssa606567, %22 ]
  %indvars.iv.next99 = add nuw nsw i64 %indvars.iv98, 1
  %exitcond102.not = icmp eq i64 %indvars.iv.next99, %wide.trip.count101
  br i1 %exitcond102.not, label %._crit_edge70, label %22, !llvm.loop !18

._crit_edge74:                                    ; preds = %.lr.ph73, %17
  %74 = tail call i32 @putchar(i32 noundef 10)
  %75 = load i32, ptr @t, align 4, !tbaa !5
  %76 = add nsw i32 %75, -1
  store i32 %76, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %75, 0
  br i1 %.not, label %._crit_edge78, label %.lr.ph77, !llvm.loop !19

.lr.ph73:                                         ; preds = %17, %.lr.ph73
  %indvars.iv103 = phi i64 [ %indvars.iv.next104, %.lr.ph73 ], [ 0, %17 ]
  %77 = getelementptr inbounds [640064 x i32], ptr @ans, i64 0, i64 %indvars.iv103
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %.not34 = icmp eq i32 %78, 0
  %79 = select i1 %.not34, i32 82, i32 76
  %80 = tail call i32 @putchar(i32 noundef %79)
  %indvars.iv.next104 = add nuw nsw i64 %indvars.iv103, 1
  %81 = load i32, ptr @tot, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = icmp slt i64 %indvars.iv.next104, %82
  br i1 %83, label %.lr.ph73, label %._crit_edge74, !llvm.loop !20

._crit_edge78:                                    ; preds = %._crit_edge74, %0
  ret i32 0
}

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

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

; Function Attrs: inlinehint mustprogress nofree nounwind uwtable
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nofree 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 = { inlinehint mustprogress nofree 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" }

!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 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.unroll.disable"}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}


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