; LLVM IR from tangjz/acm-icpc :: 51nod (1355)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@n = external dso_local global i32, align 4
@x = external dso_local global i32, align 4
@cnt = external dso_local global [1000001 x i32], align 16
@fib = external dso_local global [1000001 x i32], align 16
@ans = external dso_local global i32, align 4
@vis = external dso_local global [1000001 x i8], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z7mod_powii(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
  store i32 0, ptr %1, align 4
  store i32 1, ptr getelementptr inbounds ([1000001 x i32], ptr @fib, i64 0, i64 1), align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 2, ptr %2, align 4, !tbaa !5
  br label %9

9:                                                ; preds = %40, %0
  %10 = load i32, ptr %2, align 4, !tbaa !5
  %11 = icmp slt i32 %10, 1000001
  br i1 %11, label %13, label %12

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

13:                                               ; preds = %9
  %14 = load i32, ptr %2, align 4, !tbaa !5
  %15 = sub nsw i32 %14, 1
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [1000001 x i32], ptr @fib, i64 0, i64 %16
  %18 = load i32, ptr %17, align 4, !tbaa !5
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = sub nsw i32 %19, 2
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [1000001 x i32], ptr @fib, i64 0, i64 %21
  %23 = load i32, ptr %22, align 4, !tbaa !5
  %24 = add nsw i32 %18, %23
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [1000001 x i32], ptr @fib, i64 0, i64 %26
  store i32 %24, ptr %27, align 4, !tbaa !5
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [1000001 x i32], ptr @fib, i64 0, i64 %29
  %31 = load i32, ptr %30, align 4, !tbaa !5
  %32 = icmp sge i32 %31, 1000000007
  br i1 %32, label %33, label %39

33:                                               ; preds = %13
  %34 = load i32, ptr %2, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [1000001 x i32], ptr @fib, i64 0, i64 %35
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %38 = sub nsw i32 %37, 1000000007
  store i32 %38, ptr %36, align 4, !tbaa !5
  br label %39

39:                                               ; preds = %33, %13
  br label %40

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

43:                                               ; preds = %12
  %44 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %45

45:                                               ; preds = %55, %43
  %46 = load i32, ptr %3, align 4, !tbaa !5
  %47 = load i32, ptr @n, align 4, !tbaa !5
  %48 = icmp slt i32 %46, %47
  br i1 %48, label %50, label %49

49:                                               ; preds = %45
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %58

50:                                               ; preds = %45
  %51 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @x)
  %52 = load i32, ptr @x, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [1000001 x i8], ptr @vis, i64 0, i64 %53
  store i8 1, ptr %54, align 1, !tbaa !11
  br label %55

55:                                               ; preds = %50
  %56 = load i32, ptr %3, align 4, !tbaa !5
  %57 = add nsw i32 %56, 1
  store i32 %57, ptr %3, align 4, !tbaa !5
  br label %45, !llvm.loop !13

58:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 1000000, ptr %4, align 4, !tbaa !5
  br label %59

59:                                               ; preds = %160, %58
  %60 = load i32, ptr %4, align 4, !tbaa !5
  %61 = icmp sgt i32 %60, 2
  br i1 %61, label %63, label %62

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

63:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %64 = load i32, ptr %4, align 4, !tbaa !5
  %65 = load i32, ptr %4, align 4, !tbaa !5
  %66 = add nsw i32 %64, %65
  store i32 %66, ptr %6, align 4, !tbaa !5
  br label %67

67:                                               ; preds = %96, %63
  %68 = load i32, ptr %6, align 4, !tbaa !5
  %69 = icmp slt i32 %68, 1000001
  br i1 %69, label %70, label %77

70:                                               ; preds = %67
  %71 = load i32, ptr %4, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [1000001 x i8], ptr @vis, i64 0, i64 %72
  %74 = load i8, ptr %73, align 1, !tbaa !11, !range !14, !noundef !15
  %75 = trunc i8 %74 to i1
  %76 = xor i1 %75, true
  br label %77

77:                                               ; preds = %70, %67
  %78 = phi i1 [ false, %67 ], [ %76, %70 ]
  br i1 %78, label %80, label %79

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

80:                                               ; preds = %77
  %81 = load i32, ptr %6, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [1000001 x i8], ptr @vis, i64 0, i64 %82
  %84 = load i8, ptr %83, align 1, !tbaa !11, !range !14, !noundef !15
  %85 = trunc i8 %84 to i1
  %86 = zext i1 %85 to i32
  %87 = load i32, ptr %4, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [1000001 x i8], ptr @vis, i64 0, i64 %88
  %90 = load i8, ptr %89, align 1, !tbaa !11, !range !14, !noundef !15
  %91 = trunc i8 %90 to i1
  %92 = zext i1 %91 to i32
  %93 = or i32 %92, %86
  %94 = icmp ne i32 %93, 0
  %95 = zext i1 %94 to i8
  store i8 %95, ptr %89, align 1, !tbaa !11
  br label %96

96:                                               ; preds = %80
  %97 = load i32, ptr %4, align 4, !tbaa !5
  %98 = load i32, ptr %6, align 4, !tbaa !5
  %99 = add nsw i32 %98, %97
  store i32 %99, ptr %6, align 4, !tbaa !5
  br label %67, !llvm.loop !16

100:                                              ; preds = %79
  %101 = load i32, ptr %4, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [1000001 x i8], ptr @vis, i64 0, i64 %102
  %104 = load i8, ptr %103, align 1, !tbaa !11, !range !14, !noundef !15
  %105 = trunc i8 %104 to i1
  br i1 %105, label %107, label %106

106:                                              ; preds = %100
  br label %160

107:                                              ; preds = %100
  %108 = load i32, ptr %4, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [1000001 x i32], ptr @cnt, i64 0, i64 %109
  store i32 1, ptr %110, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %111 = load i32, ptr %4, align 4, !tbaa !5
  %112 = load i32, ptr %4, align 4, !tbaa !5
  %113 = add nsw i32 %111, %112
  store i32 %113, ptr %7, align 4, !tbaa !5
  br label %114

114:                                              ; preds = %128, %107
  %115 = load i32, ptr %7, align 4, !tbaa !5
  %116 = icmp slt i32 %115, 1000001
  br i1 %116, label %118, label %117

117:                                              ; preds = %114
  store i32 14, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %132

118:                                              ; preds = %114
  %119 = load i32, ptr %7, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [1000001 x i32], ptr @cnt, i64 0, i64 %120
  %122 = load i32, ptr %121, align 4, !tbaa !5
  %123 = load i32, ptr %4, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [1000001 x i32], ptr @cnt, i64 0, i64 %124
  %126 = load i32, ptr %125, align 4, !tbaa !5
  %127 = sub nsw i32 %126, %122
  store i32 %127, ptr %125, align 4, !tbaa !5
  br label %128

128:                                              ; preds = %118
  %129 = load i32, ptr %4, align 4, !tbaa !5
  %130 = load i32, ptr %7, align 4, !tbaa !5
  %131 = add nsw i32 %130, %129
  store i32 %131, ptr %7, align 4, !tbaa !5
  br label %114, !llvm.loop !17

132:                                              ; preds = %117
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %133 = load i32, ptr %4, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [1000001 x i32], ptr @cnt, i64 0, i64 %134
  %136 = load i32, ptr %135, align 4, !tbaa !5
  %137 = srem i32 %136, 1000000006
  store i32 %137, ptr %8, align 4, !tbaa !5
  %138 = load i32, ptr %8, align 4, !tbaa !5
  %139 = icmp slt i32 %138, 0
  br i1 %139, label %140, label %143

140:                                              ; preds = %132
  %141 = load i32, ptr %8, align 4, !tbaa !5
  %142 = add nsw i32 %141, 1000000006
  store i32 %142, ptr %8, align 4, !tbaa !5
  br label %143

143:                                              ; preds = %140, %132
  %144 = load i32, ptr %8, align 4, !tbaa !5
  %145 = icmp ne i32 %144, 0
  br i1 %145, label %146, label %159

146:                                              ; preds = %143
  %147 = load i32, ptr @ans, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = load i32, ptr %4, align 4, !tbaa !5
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [1000001 x i32], ptr @fib, i64 0, i64 %150
  %152 = load i32, ptr %151, align 4, !tbaa !5
  %153 = load i32, ptr %8, align 4, !tbaa !5
  %154 = call noundef i32 @_Z7mod_powii(i32 noundef %152, i32 noundef %153)
  %155 = sext i32 %154 to i64
  %156 = mul nsw i64 %148, %155
  %157 = srem i64 %156, 1000000007
  %158 = trunc i64 %157 to i32
  store i32 %158, ptr @ans, align 4, !tbaa !5
  br label %159

159:                                              ; preds = %146, %143
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %160

160:                                              ; preds = %159, %106
  %161 = load i32, ptr %4, align 4, !tbaa !5
  %162 = add nsw i32 %161, -1
  store i32 %162, ptr %4, align 4, !tbaa !5
  br label %59, !llvm.loop !18

163:                                              ; preds = %62
  %164 = load i32, ptr @ans, align 4, !tbaa !5
  %165 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %164)
  ret i32 0
}

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

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

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


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

@n = external dso_local global i32, align 4
@x = external dso_local global i32, align 4
@cnt = external dso_local local_unnamed_addr global [1000001 x i32], align 16
@fib = external dso_local local_unnamed_addr global [1000001 x i32], align 16
@ans = external dso_local local_unnamed_addr global i32, align 4
@vis = external dso_local local_unnamed_addr global [1000001 x i8], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

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

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  store i32 1, ptr getelementptr inbounds (i8, ptr @fib, i64 4), align 4, !tbaa !5
  br label %5

1:                                                ; preds = %5
  %2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %3 = load i32, ptr @n, align 4, !tbaa !5
  %4 = icmp sgt i32 %3, 0
  br i1 %4, label %.lr.ph, label %.preheader.preheader

.preheader.preheader:                             ; preds = %.lr.ph, %1
  br label %.preheader

5:                                                ; preds = %14, %0
  %6 = phi i32 [ 1, %0 ], [ %spec.select.1, %14 ]
  %indvars.iv = phi i64 [ 2, %0 ], [ %indvars.iv.next.1, %14 ]
  %7 = add nsw i64 %indvars.iv, -2
  %8 = getelementptr inbounds [1000001 x i32], ptr @fib, i64 0, i64 %7
  %9 = load i32, ptr %8, align 8, !tbaa !5
  %10 = add nsw i32 %9, %6
  %11 = getelementptr inbounds [1000001 x i32], ptr @fib, i64 0, i64 %indvars.iv
  %12 = icmp sgt i32 %10, 1000000006
  %13 = add nsw i32 %10, -1000000007
  %spec.select = select i1 %12, i32 %13, i32 %10
  store i32 %spec.select, ptr %11, align 8, !tbaa !5
  %exitcond.not = icmp eq i64 %indvars.iv, 1000000
  br i1 %exitcond.not, label %1, label %14, !llvm.loop !9

14:                                               ; preds = %5
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %15 = add nsw i64 %indvars.iv, -1
  %16 = getelementptr inbounds [1000001 x i32], ptr @fib, i64 0, i64 %15
  %17 = load i32, ptr %16, align 4, !tbaa !5
  %18 = add nsw i32 %17, %spec.select
  %19 = getelementptr inbounds [1000001 x i32], ptr @fib, i64 0, i64 %indvars.iv.next
  %20 = icmp sgt i32 %18, 1000000006
  %21 = add nsw i32 %18, -1000000007
  %spec.select.1 = select i1 %20, i32 %21, i32 %18
  store i32 %spec.select.1, ptr %19, align 4, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  br label %5

.lr.ph:                                           ; preds = %1, %.lr.ph
  %.03743 = phi i32 [ %26, %.lr.ph ], [ 0, %1 ]
  %22 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @x)
  %23 = load i32, ptr @x, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [1000001 x i8], ptr @vis, i64 0, i64 %24
  store i8 1, ptr %25, align 1, !tbaa !11
  %26 = add nuw nsw i32 %.03743, 1
  %27 = load i32, ptr @n, align 4, !tbaa !5
  %28 = icmp slt i32 %26, %27
  br i1 %28, label %.lr.ph, label %.preheader.preheader, !llvm.loop !13

29:                                               ; preds = %66
  %30 = load i32, ptr @ans, align 4, !tbaa !5
  %31 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %30)
  ret i32 0

.preheader:                                       ; preds = %.preheader.preheader, %66
  %indvars.iv55 = phi i64 [ %indvars.iv.next56, %66 ], [ 1000000, %.preheader.preheader ]
  %indvars.iv53 = phi i64 [ %indvars.iv.next54, %66 ], [ 2000000, %.preheader.preheader ]
  %32 = icmp ult i64 %indvars.iv55, 500001
  %33 = getelementptr inbounds [1000001 x i8], ptr @vis, i64 0, i64 %indvars.iv55
  %.promoted = load i8, ptr %33, align 1, !tbaa !11
  br i1 %32, label %.lr.ph45, label %.critedge.thread

.lr.ph45:                                         ; preds = %.preheader, %40
  %indvars.iv57 = phi i64 [ %indvars.iv.next58, %40 ], [ %indvars.iv53, %.preheader ]
  %34 = phi i8 [ %43, %40 ], [ %.promoted, %.preheader ]
  %35 = trunc nuw i8 %34 to i1
  br i1 %35, label %.critedge, label %40

.critedge:                                        ; preds = %.lr.ph45, %40
  %36 = phi i8 [ %43, %40 ], [ %34, %.lr.ph45 ]
  %37 = trunc nuw i8 %36 to i1
  br i1 %37, label %45, label %66

.critedge.thread:                                 ; preds = %.preheader
  %38 = trunc nuw i8 %.promoted to i1
  br i1 %38, label %.thread, label %66

.thread:                                          ; preds = %.critedge.thread
  %39 = getelementptr inbounds [1000001 x i32], ptr @cnt, i64 0, i64 %indvars.iv55
  store i32 1, ptr %39, align 4, !tbaa !5
  br label %._crit_edge

40:                                               ; preds = %.lr.ph45
  %41 = getelementptr inbounds [1000001 x i8], ptr @vis, i64 0, i64 %indvars.iv57
  %42 = load i8, ptr %41, align 1, !tbaa !11, !range !14, !noundef !15
  %43 = or i8 %42, %34
  store i8 %43, ptr %33, align 1, !tbaa !11
  %indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, %indvars.iv55
  %44 = icmp ult i64 %indvars.iv.next58, 1000001
  br i1 %44, label %.lr.ph45, label %.critedge, !llvm.loop !16

45:                                               ; preds = %.critedge
  %46 = getelementptr inbounds [1000001 x i32], ptr @cnt, i64 0, i64 %indvars.iv55
  store i32 1, ptr %46, align 4, !tbaa !5
  br i1 %32, label %.lr.ph48, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph48, %.thread, %45
  %47 = phi i32 [ 1, %45 ], [ 1, %.thread ], [ %54, %.lr.ph48 ]
  %48 = srem i32 %47, 1000000006
  %49 = icmp slt i32 %48, 0
  %50 = add nsw i32 %48, 1000000006
  %spec.select41 = select i1 %49, i32 %50, i32 %48
  %.not = icmp eq i32 %spec.select41, 0
  br i1 %.not, label %66, label %56

.lr.ph48:                                         ; preds = %45, %.lr.ph48
  %indvars.iv59 = phi i64 [ %indvars.iv.next60, %.lr.ph48 ], [ %indvars.iv53, %45 ]
  %51 = phi i32 [ %54, %.lr.ph48 ], [ 1, %45 ]
  %52 = getelementptr inbounds [1000001 x i32], ptr @cnt, i64 0, i64 %indvars.iv59
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = sub nsw i32 %51, %53
  store i32 %54, ptr %46, align 4, !tbaa !5
  %indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, %indvars.iv55
  %55 = icmp ult i64 %indvars.iv.next60, 1000001
  br i1 %55, label %.lr.ph48, label %._crit_edge, !llvm.loop !17

56:                                               ; preds = %._crit_edge
  %57 = load i32, ptr @ans, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [1000001 x i32], ptr @fib, i64 0, i64 %indvars.iv55
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = tail call noundef i32 @_Z7mod_powii(i32 noundef %60, i32 noundef %spec.select41)
  %62 = sext i32 %61 to i64
  %63 = mul nsw i64 %62, %58
  %64 = srem i64 %63, 1000000007
  %65 = trunc nsw i64 %64 to i32
  store i32 %65, ptr @ans, align 4, !tbaa !5
  br label %66

66:                                               ; preds = %.critedge.thread, %._crit_edge, %56, %.critedge
  %indvars.iv.next56 = add nsw i64 %indvars.iv55, -1
  %67 = icmp ugt i64 %indvars.iv55, 3
  %indvars.iv.next54 = add nsw i64 %indvars.iv53, -2
  br i1 %67, label %.preheader, label %29, !llvm.loop !18
}

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

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

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress 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 #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" }

!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 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = !{i8 0, i8 2}
!15 = !{}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}


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