; LLVM IR from VastoLorde95/Competitive-Programming :: CodeChef/WF/Easy Medium/ANKGAME (brute)

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

@fact = external dso_local global [100010 x i64], align 16
@invfact = external dso_local global [100010 x i64], 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
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z4absox(i64 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 uwtable
declare dso_local void @_Z3facv() #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca [100010 x i64], align 16
  %7 = alloca [100010 x i64], align 16
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  %11 = alloca i32, align 4
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 800080, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 800080, ptr %7) #6
  call void @_Z3facv()
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2)
  br label %17

17:                                               ; preds = %171, %169, %0
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = add nsw i32 %18, -1
  store i32 %19, ptr %2, align 4, !tbaa !5
  %20 = icmp ne i32 %18, 0
  br i1 %20, label %21, label %172

21:                                               ; preds = %17
  %22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %3)
  store i64 0, ptr %4, align 8, !tbaa !9
  br label %23

23:                                               ; preds = %31, %21
  %24 = load i64, ptr %4, align 8, !tbaa !9
  %25 = load i64, ptr %3, align 8, !tbaa !9
  %26 = icmp slt i64 %24, %25
  br i1 %26, label %27, label %34

27:                                               ; preds = %23
  %28 = load i64, ptr %4, align 8, !tbaa !9
  %29 = getelementptr inbounds [100010 x i64], ptr %7, i64 0, i64 %28
  %30 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %29)
  br label %31

31:                                               ; preds = %27
  %32 = load i64, ptr %4, align 8, !tbaa !9
  %33 = add nsw i64 %32, 1
  store i64 %33, ptr %4, align 8, !tbaa !9
  br label %23, !llvm.loop !11

34:                                               ; preds = %23
  %35 = getelementptr inbounds [100010 x i64], ptr %7, i64 0, i64 0
  %36 = getelementptr inbounds [100010 x i64], ptr %7, i64 0, i64 0
  %37 = load i64, ptr %3, align 8, !tbaa !9
  %38 = getelementptr inbounds i64, ptr %36, i64 %37
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef %35, ptr noundef %38)
  %39 = getelementptr inbounds [100010 x i64], ptr %6, i64 0, i64 0
  store i64 1, ptr %39, align 16, !tbaa !9
  store i64 0, ptr %5, align 8, !tbaa !9
  store i64 0, ptr %4, align 8, !tbaa !9
  br label %40

40:                                               ; preds = %65, %34
  %41 = load i64, ptr %4, align 8, !tbaa !9
  %42 = load i64, ptr %3, align 8, !tbaa !9
  %43 = sub nsw i64 %42, 1
  %44 = icmp slt i64 %41, %43
  br i1 %44, label %45, label %68

45:                                               ; preds = %40
  %46 = load i64, ptr %4, align 8, !tbaa !9
  %47 = getelementptr inbounds [100010 x i64], ptr %7, i64 0, i64 %46
  %48 = load i64, ptr %47, align 8, !tbaa !13
  %49 = load i64, ptr %4, align 8, !tbaa !9
  %50 = add nsw i64 %49, 1
  %51 = getelementptr inbounds [100010 x i64], ptr %7, i64 0, i64 %50
  %52 = load i64, ptr %51, align 8, !tbaa !13
  %53 = icmp eq i64 %48, %52
  br i1 %53, label %54, label %59

54:                                               ; preds = %45
  %55 = load i64, ptr %5, align 8, !tbaa !9
  %56 = getelementptr inbounds [100010 x i64], ptr %6, i64 0, i64 %55
  %57 = load i64, ptr %56, align 8, !tbaa !9
  %58 = add nsw i64 %57, 1
  store i64 %58, ptr %56, align 8, !tbaa !9
  br label %64

59:                                               ; preds = %45
  %60 = load i64, ptr %5, align 8, !tbaa !9
  %61 = add nsw i64 %60, 1
  store i64 %61, ptr %5, align 8, !tbaa !9
  %62 = load i64, ptr %5, align 8, !tbaa !9
  %63 = getelementptr inbounds [100010 x i64], ptr %6, i64 0, i64 %62
  store i64 1, ptr %63, align 8, !tbaa !9
  br label %64

64:                                               ; preds = %59, %54
  br label %65

65:                                               ; preds = %64
  %66 = load i64, ptr %4, align 8, !tbaa !9
  %67 = add nsw i64 %66, 1
  store i64 %67, ptr %4, align 8, !tbaa !9
  br label %40, !llvm.loop !15

68:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %69 = load i64, ptr %5, align 8, !tbaa !9
  %70 = add nsw i64 %69, 1
  store i64 %70, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  store i64 0, ptr %10, align 8, !tbaa !9
  %71 = getelementptr inbounds [100010 x i64], ptr %7, i64 0, i64 0
  %72 = load i64, ptr %71, align 16, !tbaa !13
  %73 = icmp eq i64 %72, 1
  br i1 %73, label %74, label %77

74:                                               ; preds = %68
  store i32 1, ptr %9, align 4, !tbaa !5
  %75 = getelementptr inbounds [100010 x i64], ptr %6, i64 0, i64 0
  %76 = load i64, ptr %75, align 16, !tbaa !9
  store i64 %76, ptr %10, align 8, !tbaa !9
  br label %78

77:                                               ; preds = %68
  store i64 0, ptr %10, align 8, !tbaa !9
  br label %78

78:                                               ; preds = %77, %74
  %79 = load i64, ptr %10, align 8, !tbaa !9
  %80 = load i64, ptr %3, align 8, !tbaa !9
  %81 = icmp eq i64 %79, %80
  br i1 %81, label %82, label %91

82:                                               ; preds = %78
  %83 = load i64, ptr %3, align 8, !tbaa !9
  %84 = srem i64 %83, 2
  %85 = icmp eq i64 %84, 0
  br i1 %85, label %86, label %88

86:                                               ; preds = %82
  %87 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  br label %90

88:                                               ; preds = %82
  %89 = call i32 (ptr, ...) @printf(ptr noundef @.str.4)
  br label %90

90:                                               ; preds = %88, %86
  store i32 2, ptr %11, align 4
  br label %169, !llvm.loop !16

91:                                               ; preds = %78
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  store i64 1, ptr %12, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  store i64 0, ptr %13, align 8, !tbaa !13
  %92 = load i32, ptr %9, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  store i64 %93, ptr %4, align 8, !tbaa !9
  br label %94

94:                                               ; preds = %107, %91
  %95 = load i64, ptr %4, align 8, !tbaa !9
  %96 = load i64, ptr %8, align 8, !tbaa !9
  %97 = icmp slt i64 %95, %96
  br i1 %97, label %98, label %110

98:                                               ; preds = %94
  %99 = load i64, ptr %12, align 8, !tbaa !13
  %100 = load i64, ptr %4, align 8, !tbaa !9
  %101 = getelementptr inbounds [100010 x i64], ptr %6, i64 0, i64 %100
  %102 = load i64, ptr %101, align 8, !tbaa !9
  %103 = getelementptr inbounds [100010 x i64], ptr @invfact, i64 0, i64 %102
  %104 = load i64, ptr %103, align 8, !tbaa !9
  %105 = mul nsw i64 %99, %104
  %106 = srem i64 %105, 1000000007
  store i64 %106, ptr %12, align 8, !tbaa !13
  br label %107

107:                                              ; preds = %98
  %108 = load i64, ptr %4, align 8, !tbaa !9
  %109 = add nsw i64 %108, 1
  store i64 %109, ptr %4, align 8, !tbaa !9
  br label %94, !llvm.loop !17

110:                                              ; preds = %94
  store i64 0, ptr %4, align 8, !tbaa !9
  br label %111

111:                                              ; preds = %163, %110
  %112 = load i64, ptr %4, align 8, !tbaa !9
  %113 = load i64, ptr %10, align 8, !tbaa !9
  %114 = icmp sle i64 %112, %113
  br i1 %114, label %115, label %166

115:                                              ; preds = %111
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %116 = load i64, ptr %10, align 8, !tbaa !9
  %117 = load i64, ptr %4, align 8, !tbaa !9
  %118 = sub nsw i64 %116, %117
  store i64 %118, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %119 = load i64, ptr %3, align 8, !tbaa !9
  %120 = load i64, ptr %4, align 8, !tbaa !9
  %121 = sub nsw i64 %119, %120
  store i64 %121, ptr %15, align 8, !tbaa !9
  %122 = load i64, ptr %14, align 8, !tbaa !9
  %123 = icmp eq i64 %122, 0
  br i1 %123, label %124, label %135

124:                                              ; preds = %115
  %125 = load i64, ptr %15, align 8, !tbaa !9
  %126 = getelementptr inbounds [100010 x i64], ptr @fact, i64 0, i64 %125
  %127 = load i64, ptr %126, align 8, !tbaa !9
  %128 = load i64, ptr %12, align 8, !tbaa !13
  %129 = mul nsw i64 %127, %128
  %130 = srem i64 %129, 1000000007
  %131 = load i64, ptr %13, align 8, !tbaa !13
  %132 = add nsw i64 %131, %130
  store i64 %132, ptr %13, align 8, !tbaa !13
  %133 = load i64, ptr %13, align 8, !tbaa !13
  %134 = srem i64 %133, 1000000007
  store i64 %134, ptr %13, align 8, !tbaa !13
  store i32 15, ptr %11, align 4
  br label %160

135:                                              ; preds = %115
  %136 = load i64, ptr %15, align 8, !tbaa !9
  %137 = getelementptr inbounds [100010 x i64], ptr @fact, i64 0, i64 %136
  %138 = load i64, ptr %137, align 8, !tbaa !9
  %139 = load i64, ptr %14, align 8, !tbaa !9
  %140 = getelementptr inbounds [100010 x i64], ptr @invfact, i64 0, i64 %139
  %141 = load i64, ptr %140, align 8, !tbaa !9
  %142 = mul nsw i64 %138, %141
  %143 = load i64, ptr %15, align 8, !tbaa !9
  %144 = sub nsw i64 %143, 1
  %145 = getelementptr inbounds [100010 x i64], ptr @fact, i64 0, i64 %144
  %146 = load i64, ptr %145, align 8, !tbaa !9
  %147 = load i64, ptr %14, align 8, !tbaa !9
  %148 = sub nsw i64 %147, 1
  %149 = getelementptr inbounds [100010 x i64], ptr @invfact, i64 0, i64 %148
  %150 = load i64, ptr %149, align 8, !tbaa !9
  %151 = mul nsw i64 %146, %150
  %152 = sub nsw i64 %142, %151
  %153 = call noundef i64 @_Z4absox(i64 noundef %152)
  %154 = load i64, ptr %12, align 8, !tbaa !13
  %155 = mul nsw i64 %153, %154
  %156 = load i64, ptr %13, align 8, !tbaa !13
  %157 = add nsw i64 %156, %155
  store i64 %157, ptr %13, align 8, !tbaa !13
  %158 = load i64, ptr %13, align 8, !tbaa !13
  %159 = srem i64 %158, 1000000007
  store i64 %159, ptr %13, align 8, !tbaa !13
  store i32 0, ptr %11, align 4
  br label %160

160:                                              ; preds = %135, %124
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  %161 = load i32, ptr %11, align 4
  switch i32 %161, label %174 [
    i32 0, label %162
    i32 15, label %163
  ]

162:                                              ; preds = %160
  br label %163

163:                                              ; preds = %162, %160
  %164 = load i64, ptr %4, align 8, !tbaa !9
  %165 = add nsw i64 %164, 2
  store i64 %165, ptr %4, align 8, !tbaa !9
  br label %111, !llvm.loop !18

166:                                              ; preds = %111
  %167 = load i64, ptr %13, align 8, !tbaa !13
  %168 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i64 noundef %167)
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  store i32 0, ptr %11, align 4
  br label %169

169:                                              ; preds = %166, %90
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  %170 = load i32, ptr %11, align 4
  switch i32 %170, label %174 [
    i32 0, label %171
    i32 2, label %17
  ]

171:                                              ; preds = %169
  br label %17, !llvm.loop !16

172:                                              ; preds = %17
  store i32 0, ptr %1, align 4
  store i32 1, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 800080, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 800080, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  %173 = load i32, ptr %1, align 4
  ret i32 %173

174:                                              ; preds = %169, %160
  unreachable
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPxEvT_S1_(ptr noundef, ptr noundef) #5

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

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 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 = { 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 #4 = { "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 #5 = { 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 #6 = { 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", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"long long", !7, i64 0}
!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"

@fact = external dso_local local_unnamed_addr global [100010 x i64], align 16
@invfact = external dso_local local_unnamed_addr global [100010 x i64], 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
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z4absox(i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3facv() local_unnamed_addr #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca [100010 x i64], align 16
  %4 = alloca [100010 x i64], align 16
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 800080, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 800080, ptr nonnull %4) #6
  tail call void @_Z3facv()
  %5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %6 = load i32, ptr %1, align 4, !tbaa !5
  %7 = add nsw i32 %6, -1
  store i32 %7, ptr %1, align 4, !tbaa !5
  %.not71 = icmp eq i32 %6, 0
  br i1 %.not71, label %._crit_edge74, label %.lr.ph73

.lr.ph73:                                         ; preds = %0, %117
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %2)
  %9 = load i64, ptr %2, align 8, !tbaa !9
  %10 = icmp sgt i64 %9, 0
  br i1 %10, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph73, %.lr.ph
  %.052 = phi i64 [ %13, %.lr.ph ], [ 0, %.lr.ph73 ]
  %11 = getelementptr inbounds [100010 x i64], ptr %4, i64 0, i64 %.052
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %11)
  %13 = add nuw nsw i64 %.052, 1
  %14 = load i64, ptr %2, align 8, !tbaa !9
  %15 = icmp slt i64 %13, %14
  br i1 %15, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph73
  %.lcssa = phi i64 [ %9, %.lr.ph73 ], [ %14, %.lr.ph ]
  %16 = getelementptr inbounds i64, ptr %4, i64 %.lcssa
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef nonnull %4, ptr noundef nonnull %16)
  store i64 1, ptr %3, align 16, !tbaa !9
  %17 = load i64, ptr %2, align 8, !tbaa !9
  %18 = icmp sgt i64 %17, 1
  %.pre = load i64, ptr %4, align 16, !tbaa !13
  br i1 %18, label %.lr.ph56.preheader, label %._crit_edge57

.lr.ph56.preheader:                               ; preds = %._crit_edge
  %19 = add nsw i64 %17, -1
  %xtraiter = and i64 %19, 1
  %20 = icmp eq i64 %17, 2
  br i1 %20, label %._crit_edge57.loopexit.unr-lcssa, label %.lr.ph56.preheader.new

.lr.ph56.preheader.new:                           ; preds = %.lr.ph56.preheader
  %unroll_iter = and i64 %19, -2
  br label %.lr.ph56

.lr.ph56:                                         ; preds = %44, %.lr.ph56.preheader.new
  %21 = phi i64 [ %.pre, %.lr.ph56.preheader.new ], [ %35, %44 ]
  %.154 = phi i64 [ 0, %.lr.ph56.preheader.new ], [ %33, %44 ]
  %.04353 = phi i64 [ 0, %.lr.ph56.preheader.new ], [ %.144.1, %44 ]
  %niter = phi i64 [ 0, %.lr.ph56.preheader.new ], [ %niter.next.1, %44 ]
  %22 = or disjoint i64 %.154, 1
  %23 = getelementptr inbounds [100010 x i64], ptr %4, i64 0, i64 %22
  %24 = load i64, ptr %23, align 8, !tbaa !13
  %25 = icmp eq i64 %21, %24
  br i1 %25, label %26, label %30

26:                                               ; preds = %.lr.ph56
  %27 = getelementptr inbounds [100010 x i64], ptr %3, i64 0, i64 %.04353
  %28 = load i64, ptr %27, align 8, !tbaa !9
  %29 = add nsw i64 %28, 1
  store i64 %29, ptr %27, align 8, !tbaa !9
  br label %.lr.ph56.1

30:                                               ; preds = %.lr.ph56
  %31 = add nsw i64 %.04353, 1
  %32 = getelementptr inbounds [100010 x i64], ptr %3, i64 0, i64 %31
  store i64 1, ptr %32, align 8, !tbaa !9
  br label %.lr.ph56.1

.lr.ph56.1:                                       ; preds = %26, %30
  %.144 = phi i64 [ %.04353, %26 ], [ %31, %30 ]
  %33 = add nuw nsw i64 %.154, 2
  %34 = getelementptr inbounds [100010 x i64], ptr %4, i64 0, i64 %33
  %35 = load i64, ptr %34, align 16, !tbaa !13
  %36 = icmp eq i64 %24, %35
  br i1 %36, label %40, label %37

37:                                               ; preds = %.lr.ph56.1
  %38 = add nsw i64 %.144, 1
  %39 = getelementptr inbounds [100010 x i64], ptr %3, i64 0, i64 %38
  store i64 1, ptr %39, align 8, !tbaa !9
  br label %44

40:                                               ; preds = %.lr.ph56.1
  %41 = getelementptr inbounds [100010 x i64], ptr %3, i64 0, i64 %.144
  %42 = load i64, ptr %41, align 8, !tbaa !9
  %43 = add nsw i64 %42, 1
  store i64 %43, ptr %41, align 8, !tbaa !9
  br label %44

44:                                               ; preds = %40, %37
  %.144.1 = phi i64 [ %.144, %40 ], [ %38, %37 ]
  %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_edge57.loopexit.unr-lcssa, label %.lr.ph56, !llvm.loop !15

._crit_edge57.loopexit.unr-lcssa:                 ; preds = %44, %.lr.ph56.preheader
  %.144.lcssa.ph = phi i64 [ poison, %.lr.ph56.preheader ], [ %.144.1, %44 ]
  %.unr = phi i64 [ %.pre, %.lr.ph56.preheader ], [ %35, %44 ]
  %.154.unr = phi i64 [ 0, %.lr.ph56.preheader ], [ %33, %44 ]
  %.04353.unr = phi i64 [ 0, %.lr.ph56.preheader ], [ %.144.1, %44 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge57.loopexit, label %.lr.ph56.epil

.lr.ph56.epil:                                    ; preds = %._crit_edge57.loopexit.unr-lcssa
  %45 = add nuw nsw i64 %.154.unr, 1
  %46 = getelementptr inbounds [100010 x i64], ptr %4, i64 0, i64 %45
  %47 = load i64, ptr %46, align 8, !tbaa !13
  %48 = icmp eq i64 %.unr, %47
  br i1 %48, label %52, label %49

49:                                               ; preds = %.lr.ph56.epil
  %50 = add nsw i64 %.04353.unr, 1
  %51 = getelementptr inbounds [100010 x i64], ptr %3, i64 0, i64 %50
  store i64 1, ptr %51, align 8, !tbaa !9
  br label %._crit_edge57.loopexit

52:                                               ; preds = %.lr.ph56.epil
  %53 = getelementptr inbounds [100010 x i64], ptr %3, i64 0, i64 %.04353.unr
  %54 = load i64, ptr %53, align 8, !tbaa !9
  %55 = add nsw i64 %54, 1
  store i64 %55, ptr %53, align 8, !tbaa !9
  br label %._crit_edge57.loopexit

._crit_edge57.loopexit:                           ; preds = %49, %52, %._crit_edge57.loopexit.unr-lcssa
  %.144.lcssa = phi i64 [ %.144.lcssa.ph, %._crit_edge57.loopexit.unr-lcssa ], [ %.04353.unr, %52 ], [ %50, %49 ]
  %.pre79 = load i64, ptr %3, align 16
  br label %._crit_edge57

._crit_edge57:                                    ; preds = %._crit_edge, %._crit_edge57.loopexit
  %56 = phi i64 [ %.pre79, %._crit_edge57.loopexit ], [ 1, %._crit_edge ]
  %.043.lcssa = phi i64 [ %.144.lcssa, %._crit_edge57.loopexit ], [ 0, %._crit_edge ]
  %57 = icmp eq i64 %.pre, 1
  %.041 = select i1 %57, i64 %56, i64 0
  %58 = icmp eq i64 %.041, %17
  br i1 %58, label %62, label %.preheader50

.preheader50:                                     ; preds = %._crit_edge57
  %.042 = zext i1 %57 to i64
  %.not4860 = icmp slt i64 %.043.lcssa, %.042
  br i1 %.not4860, label %.preheader, label %.lr.ph63.preheader

.lr.ph63.preheader:                               ; preds = %.preheader50
  %59 = add i64 %.043.lcssa, 1
  %60 = sub i64 %59, %.042
  %xtraiter87 = and i64 %60, 1
  %61 = icmp eq i64 %.043.lcssa, %.042
  br i1 %61, label %.preheader.loopexit.unr-lcssa, label %.lr.ph63.preheader.new

.lr.ph63.preheader.new:                           ; preds = %.lr.ph63.preheader
  %unroll_iter90 = and i64 %60, -2
  br label %.lr.ph63

62:                                               ; preds = %._crit_edge57
  %63 = and i64 %17, 1
  %64 = icmp eq i64 %63, 0
  br i1 %64, label %65, label %67

65:                                               ; preds = %62
  %66 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  br label %117, !llvm.loop !16

67:                                               ; preds = %62
  %68 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
  br label %117, !llvm.loop !16

.preheader.loopexit.unr-lcssa:                    ; preds = %.lr.ph63, %.lr.ph63.preheader
  %.lcssa85.ph = phi i64 [ poison, %.lr.ph63.preheader ], [ %87, %.lr.ph63 ]
  %.262.unr = phi i64 [ %.042, %.lr.ph63.preheader ], [ %88, %.lr.ph63 ]
  %.04061.unr = phi i64 [ 1, %.lr.ph63.preheader ], [ %87, %.lr.ph63 ]
  %lcmp.mod88.not = icmp eq i64 %xtraiter87, 0
  br i1 %lcmp.mod88.not, label %.preheader, label %.lr.ph63.epil

.lr.ph63.epil:                                    ; preds = %.preheader.loopexit.unr-lcssa
  %69 = getelementptr inbounds [100010 x i64], ptr %3, i64 0, i64 %.262.unr
  %70 = load i64, ptr %69, align 8, !tbaa !9
  %71 = getelementptr inbounds [100010 x i64], ptr @invfact, i64 0, i64 %70
  %72 = load i64, ptr %71, align 8, !tbaa !9
  %73 = mul nsw i64 %72, %.04061.unr
  %74 = srem i64 %73, 1000000007
  br label %.preheader

.preheader:                                       ; preds = %.lr.ph63.epil, %.preheader.loopexit.unr-lcssa, %.preheader50
  %.040.lcssa = phi i64 [ 1, %.preheader50 ], [ %.lcssa85.ph, %.preheader.loopexit.unr-lcssa ], [ %74, %.lr.ph63.epil ]
  %.not4965 = icmp slt i64 %.041, 0
  br i1 %.not4965, label %._crit_edge69, label %.lr.ph68

.lr.ph63:                                         ; preds = %.lr.ph63, %.lr.ph63.preheader.new
  %.262 = phi i64 [ %.042, %.lr.ph63.preheader.new ], [ %88, %.lr.ph63 ]
  %.04061 = phi i64 [ 1, %.lr.ph63.preheader.new ], [ %87, %.lr.ph63 ]
  %niter91 = phi i64 [ 0, %.lr.ph63.preheader.new ], [ %niter91.next.1, %.lr.ph63 ]
  %75 = getelementptr inbounds [100010 x i64], ptr %3, i64 0, i64 %.262
  %76 = load i64, ptr %75, align 8, !tbaa !9
  %77 = getelementptr inbounds [100010 x i64], ptr @invfact, i64 0, i64 %76
  %78 = load i64, ptr %77, align 8, !tbaa !9
  %79 = mul nsw i64 %78, %.04061
  %80 = srem i64 %79, 1000000007
  %81 = add nuw i64 %.262, 1
  %82 = getelementptr inbounds [100010 x i64], ptr %3, i64 0, i64 %81
  %83 = load i64, ptr %82, align 8, !tbaa !9
  %84 = getelementptr inbounds [100010 x i64], ptr @invfact, i64 0, i64 %83
  %85 = load i64, ptr %84, align 8, !tbaa !9
  %86 = mul nsw i64 %85, %80
  %87 = srem i64 %86, 1000000007
  %88 = add nuw i64 %.262, 2
  %niter91.next.1 = add i64 %niter91, 2
  %niter91.ncmp.1 = icmp eq i64 %niter91.next.1, %unroll_iter90
  br i1 %niter91.ncmp.1, label %.preheader.loopexit.unr-lcssa, label %.lr.ph63, !llvm.loop !17

.lr.ph68:                                         ; preds = %.preheader, %114
  %.367 = phi i64 [ %115, %114 ], [ 0, %.preheader ]
  %.03866 = phi i64 [ %.139, %114 ], [ 0, %.preheader ]
  %89 = load i64, ptr %2, align 8, !tbaa !9
  %90 = sub nsw i64 %89, %.367
  %91 = icmp eq i64 %.041, %.367
  br i1 %91, label %92, label %97

92:                                               ; preds = %.lr.ph68
  %93 = getelementptr inbounds [100010 x i64], ptr @fact, i64 0, i64 %90
  %94 = load i64, ptr %93, align 8, !tbaa !9
  %95 = mul nsw i64 %94, %.040.lcssa
  %96 = srem i64 %95, 1000000007
  br label %114

97:                                               ; preds = %.lr.ph68
  %98 = sub nsw i64 %.041, %.367
  %99 = getelementptr inbounds [100010 x i64], ptr @fact, i64 0, i64 %90
  %100 = load i64, ptr %99, align 8, !tbaa !9
  %101 = getelementptr inbounds [100010 x i64], ptr @invfact, i64 0, i64 %98
  %102 = load i64, ptr %101, align 8, !tbaa !9
  %103 = mul nsw i64 %102, %100
  %104 = add nsw i64 %90, -1
  %105 = getelementptr inbounds [100010 x i64], ptr @fact, i64 0, i64 %104
  %106 = load i64, ptr %105, align 8, !tbaa !9
  %107 = add nsw i64 %98, -1
  %108 = getelementptr inbounds [100010 x i64], ptr @invfact, i64 0, i64 %107
  %109 = load i64, ptr %108, align 8, !tbaa !9
  %110 = mul nsw i64 %109, %106
  %111 = sub nsw i64 %103, %110
  %112 = call noundef i64 @_Z4absox(i64 noundef %111)
  %113 = mul nsw i64 %112, %.040.lcssa
  br label %114

114:                                              ; preds = %97, %92
  %.pn = phi i64 [ %96, %92 ], [ %113, %97 ]
  %.139.in = add nsw i64 %.pn, %.03866
  %.139 = srem i64 %.139.in, 1000000007
  %115 = add nuw nsw i64 %.367, 2
  %.not49 = icmp sgt i64 %115, %.041
  br i1 %.not49, label %._crit_edge69, label %.lr.ph68, !llvm.loop !18

._crit_edge69:                                    ; preds = %114, %.preheader
  %.038.lcssa = phi i64 [ 0, %.preheader ], [ %.139, %114 ]
  %116 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i64 noundef %.038.lcssa)
  br label %117

117:                                              ; preds = %65, %67, %._crit_edge69
  %118 = load i32, ptr %1, align 4, !tbaa !5
  %119 = add nsw i32 %118, -1
  store i32 %119, ptr %1, align 4, !tbaa !5
  %.not = icmp eq i32 %118, 0
  br i1 %.not, label %._crit_edge74, label %.lr.ph73

._crit_edge74:                                    ; preds = %117, %0
  call void @llvm.lifetime.end.p0(i64 800080, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 800080, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  ret i32 0
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPxEvT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #5

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

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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { 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 #5 = { 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 #6 = { 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", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"long long", !7, i64 0}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}


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