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

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

@sei = external dso_local global [131072 x i32], align 16
@A = external dso_local global [131072 x i32], align 16
@B = external dso_local global [131072 x i32], align 16
@M = external dso_local global [131072 x i32], align 16
@C = external dso_local global [131072 x i32], align 16
@w = external dso_local global [131072 x i32], align 16
@inv2 = external dso_local global [18 x i32], align 16
@.str = external hidden unnamed_addr constant [13 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 i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  store i32 1, ptr @w, align 16, !tbaa !5
  %16 = call noundef i32 @_Z7mod_powii(i32 noundef 3, i32 noundef 800)
  store i32 %16, ptr getelementptr inbounds ([131072 x i32], ptr @w, i64 0, i64 1), align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 2, ptr %2, align 4, !tbaa !5
  br label %17

17:                                               ; preds = %36, %0
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = icmp slt i32 %18, 131072
  br i1 %19, label %21, label %20

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

21:                                               ; preds = %17
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = sub nsw i32 %22, 1
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [131072 x i32], ptr @w, i64 0, i64 %24
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = load i32, ptr getelementptr inbounds ([131072 x i32], ptr @w, i64 0, i64 1), align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = mul nsw i64 %27, %29
  %31 = srem i64 %30, 104857601
  %32 = trunc i64 %31 to i32
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [131072 x i32], ptr @w, i64 0, i64 %34
  store i32 %32, ptr %35, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %21
  %37 = load i32, ptr %2, align 4, !tbaa !5
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr %2, align 4, !tbaa !5
  br label %17, !llvm.loop !9

39:                                               ; preds = %20
  store i32 1, ptr @inv2, align 16, !tbaa !5
  store i32 52428801, ptr getelementptr inbounds ([18 x i32], ptr @inv2, i64 0, i64 1), align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 2, ptr %3, align 4, !tbaa !5
  br label %40

40:                                               ; preds = %59, %39
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = icmp sle i32 %41, 17
  br i1 %42, label %44, label %43

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

44:                                               ; preds = %40
  %45 = load i32, ptr %3, align 4, !tbaa !5
  %46 = sub nsw i32 %45, 1
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [18 x i32], ptr @inv2, i64 0, i64 %47
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = load i32, ptr getelementptr inbounds ([18 x i32], ptr @inv2, i64 0, i64 1), align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = mul nsw i64 %50, %52
  %54 = srem i64 %53, 104857601
  %55 = trunc i64 %54 to i32
  %56 = load i32, ptr %3, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [18 x i32], ptr @inv2, i64 0, i64 %57
  store i32 %55, ptr %58, align 4, !tbaa !5
  br label %59

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

62:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 2, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %63 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %6, ptr noundef %4, ptr noundef %7, ptr noundef %8, ptr noundef %9)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %64

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

68:                                               ; preds = %64
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %99

69:                                               ; preds = %64
  %70 = load i32, ptr %7, align 4, !tbaa !5
  %71 = icmp sgt i32 %70, 23333
  br i1 %71, label %72, label %73

72:                                               ; preds = %69
  br label %85

73:                                               ; preds = %69
  %74 = load i32, ptr %7, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [131072 x i32], ptr @sei, i64 0, i64 %75
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %76, align 4, !tbaa !5
  %79 = load i32, ptr %5, align 4, !tbaa !5
  %80 = load i32, ptr %7, align 4, !tbaa !5
  %81 = icmp slt i32 %79, %80
  br i1 %81, label %82, label %84

82:                                               ; preds = %73
  %83 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %83, ptr %5, align 4, !tbaa !5
  br label %84

84:                                               ; preds = %82, %73
  br label %85

85:                                               ; preds = %84, %72
  %86 = load i32, ptr %10, align 4, !tbaa !5
  %87 = add nsw i32 %86, 1
  store i32 %87, ptr %10, align 4, !tbaa !5
  %88 = load i32, ptr %7, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = load i32, ptr %8, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = mul nsw i64 %89, %91
  %93 = load i32, ptr %9, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = add nsw i64 %92, %94
  %96 = srem i64 %95, 23333
  %97 = add nsw i64 %96, 1
  %98 = trunc i64 %97 to i32
  store i32 %98, ptr %7, align 4, !tbaa !5
  br label %64, !llvm.loop !12

99:                                               ; preds = %68
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  %100 = load i32, ptr %5, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [131072 x i32], ptr @M, i64 0, i64 %101
  store i32 1, ptr %102, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %103

103:                                              ; preds = %130, %99
  %104 = load i32, ptr %11, align 4, !tbaa !5
  %105 = load i32, ptr %5, align 4, !tbaa !5
  %106 = icmp slt i32 %104, %105
  br i1 %106, label %108, label %107

107:                                              ; preds = %103
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %133

108:                                              ; preds = %103
  %109 = load i32, ptr %5, align 4, !tbaa !5
  %110 = load i32, ptr %11, align 4, !tbaa !5
  %111 = sub nsw i32 %109, %110
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [131072 x i32], ptr @sei, i64 0, i64 %112
  %114 = load i32, ptr %113, align 4, !tbaa !5
  %115 = icmp ne i32 %114, 0
  br i1 %115, label %116, label %124

116:                                              ; preds = %108
  %117 = load i32, ptr %5, align 4, !tbaa !5
  %118 = load i32, ptr %11, align 4, !tbaa !5
  %119 = sub nsw i32 %117, %118
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [131072 x i32], ptr @sei, i64 0, i64 %120
  %122 = load i32, ptr %121, align 4, !tbaa !5
  %123 = sub nsw i32 104857601, %122
  br label %125

124:                                              ; preds = %108
  br label %125

125:                                              ; preds = %124, %116
  %126 = phi i32 [ %123, %116 ], [ 0, %124 ]
  %127 = load i32, ptr %11, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [131072 x i32], ptr @M, i64 0, i64 %128
  store i32 %126, ptr %129, align 4, !tbaa !5
  br label %130

130:                                              ; preds = %125
  %131 = load i32, ptr %11, align 4, !tbaa !5
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr %11, align 4, !tbaa !5
  br label %103, !llvm.loop !13

133:                                              ; preds = %107
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 1, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 2, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %134 = load i32, ptr %5, align 4, !tbaa !5
  %135 = add nsw i32 %134, 1
  store i32 %135, ptr %14, align 4, !tbaa !5
  store i32 1, ptr @A, align 16, !tbaa !5
  store i32 1, ptr getelementptr inbounds ([131072 x i32], ptr @B, i64 0, i64 1), align 4, !tbaa !5
  %136 = load i32, ptr %5, align 4, !tbaa !5
  %137 = sub nsw i32 %136, 1
  %138 = sext i32 %137 to i64
  %139 = load i64, ptr %4, align 8, !tbaa !14
  %140 = add nsw i64 %139, %138
  store i64 %140, ptr %4, align 8, !tbaa !14
  br label %141

141:                                              ; preds = %162, %133
  %142 = load i64, ptr %4, align 8, !tbaa !14
  %143 = icmp sgt i64 %142, 0
  br i1 %143, label %144, label %163

144:                                              ; preds = %141
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %145 = load i64, ptr %4, align 8, !tbaa !14
  %146 = and i64 %145, 1
  %147 = icmp ne i64 %146, 0
  br i1 %147, label %148, label %153

148:                                              ; preds = %144
  %149 = load i32, ptr %12, align 4, !tbaa !5
  %150 = load i32, ptr %13, align 4, !tbaa !5
  call void @_Z8poly_muliPiiS_RiS_(i32 noundef %149, ptr noundef @A, i32 noundef %150, ptr noundef @B, ptr noundef nonnull align 4 dereferenceable(4) %15, ptr noundef @C)
  %151 = load i32, ptr %15, align 4, !tbaa !5
  %152 = load i32, ptr %14, align 4, !tbaa !5
  call void @_Z8poly_modiPiiS_RiS_(i32 noundef %151, ptr noundef @C, i32 noundef %152, ptr noundef @M, ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef @A)
  br label %153

153:                                              ; preds = %148, %144
  %154 = load i64, ptr %4, align 8, !tbaa !14
  %155 = ashr i64 %154, 1
  store i64 %155, ptr %4, align 8, !tbaa !14
  %156 = icmp ne i64 %155, 0
  br i1 %156, label %157, label %162

157:                                              ; preds = %153
  %158 = load i32, ptr %13, align 4, !tbaa !5
  %159 = load i32, ptr %13, align 4, !tbaa !5
  call void @_Z8poly_muliPiiS_RiS_(i32 noundef %158, ptr noundef @B, i32 noundef %159, ptr noundef @B, ptr noundef nonnull align 4 dereferenceable(4) %15, ptr noundef @C)
  %160 = load i32, ptr %15, align 4, !tbaa !5
  %161 = load i32, ptr %14, align 4, !tbaa !5
  call void @_Z8poly_modiPiiS_RiS_(i32 noundef %160, ptr noundef @C, i32 noundef %161, ptr noundef @M, ptr noundef nonnull align 4 dereferenceable(4) %13, ptr noundef @B)
  br label %162

162:                                              ; preds = %157, %153
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %141, !llvm.loop !16

163:                                              ; preds = %141
  %164 = load i32, ptr %12, align 4, !tbaa !5
  %165 = load i32, ptr %5, align 4, !tbaa !5
  %166 = icmp eq i32 %164, %165
  br i1 %166, label %167, label %173

167:                                              ; preds = %163
  %168 = load i32, ptr %5, align 4, !tbaa !5
  %169 = sub nsw i32 %168, 1
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds [131072 x i32], ptr @A, i64 0, i64 %170
  %172 = load i32, ptr %171, align 4, !tbaa !5
  br label %174

173:                                              ; preds = %163
  br label %174

174:                                              ; preds = %173, %167
  %175 = phi i32 [ %172, %167 ], [ 0, %173 ]
  %176 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %175)
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  ret i32 0
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z8poly_muliPiiS_RiS_(i32 noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z8poly_modiPiiS_RiS_(i32 noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef) #4

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 = { 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 #5 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = !{!15, !15, i64 0}
!15 = !{!"long long", !7, i64 0}
!16 = distinct !{!16, !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"

@sei = external dso_local local_unnamed_addr global [131072 x i32], align 16
@A = external dso_local global [131072 x i32], align 16
@B = external dso_local global [131072 x i32], align 16
@M = external dso_local global [131072 x i32], align 16
@C = external dso_local global [131072 x i32], align 16
@w = external dso_local local_unnamed_addr global [131072 x i32], align 16
@inv2 = external dso_local local_unnamed_addr global [18 x i32], align 16
@.str = external hidden unnamed_addr constant [13 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 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 norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca i64, align 8
  %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 1, ptr @w, align 16, !tbaa !5
  %9 = tail call noundef i32 @_Z7mod_powii(i32 noundef 3, i32 noundef 800)
  store i32 %9, ptr getelementptr inbounds (i8, ptr @w, i64 4), align 4, !tbaa !5
  br label %13

10:                                               ; preds = %13
  store <4 x i32> <i32 1, i32 52428801, i32 78643201, i32 91750401>, ptr @inv2, align 16, !tbaa !5
  store <4 x i32> <i32 98304001, i32 101580801, i32 103219201, i32 104038401>, ptr getelementptr inbounds (i8, ptr @inv2, i64 16), align 16, !tbaa !5
  store <4 x i32> <i32 104448001, i32 104652801, i32 104755201, i32 104806401>, ptr getelementptr inbounds (i8, ptr @inv2, i64 32), align 16, !tbaa !5
  store <4 x i32> <i32 104832001, i32 104844801, i32 104851201, i32 104854401>, ptr getelementptr inbounds (i8, ptr @inv2, i64 48), align 16, !tbaa !5
  store i32 104856001, ptr getelementptr inbounds (i8, ptr @inv2, i64 64), align 16, !tbaa !5
  store i32 104856801, ptr getelementptr inbounds (i8, ptr @inv2, i64 68), align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %2, ptr noundef nonnull %1, ptr noundef nonnull %3, ptr noundef nonnull %4, ptr noundef nonnull %5)
  %12 = load i32, ptr %2, align 4, !tbaa !5
  %.not39 = icmp slt i32 %12, 1
  br i1 %.not39, label %.lr.ph44.preheader, label %.lr.ph

13:                                               ; preds = %13, %0
  %14 = phi i32 [ %9, %0 ], [ %26, %13 ]
  %indvars.iv = phi i64 [ 2, %0 ], [ %indvars.iv.next.1, %13 ]
  %15 = sext i32 %14 to i64
  %16 = load i32, ptr getelementptr inbounds (i8, ptr @w, i64 4), align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = mul nsw i64 %17, %15
  %19 = srem i64 %18, 104857601
  %20 = trunc nsw i64 %19 to i32
  %21 = getelementptr inbounds [131072 x i32], ptr @w, i64 0, i64 %indvars.iv
  store i32 %20, ptr %21, align 8, !tbaa !5
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %22 = load i32, ptr getelementptr inbounds (i8, ptr @w, i64 4), align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = mul nsw i64 %19, %23
  %25 = srem i64 %24, 104857601
  %26 = trunc nsw i64 %25 to i32
  %27 = getelementptr inbounds [131072 x i32], ptr @w, i64 0, i64 %indvars.iv.next
  store i32 %26, ptr %27, align 4, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %exitcond.not.1 = icmp eq i64 %indvars.iv.next.1, 131072
  br i1 %exitcond.not.1, label %10, label %13, !llvm.loop !9

.lr.ph:                                           ; preds = %10
  %.promoted = load i32, ptr %3, align 4, !tbaa !5
  %28 = load i32, ptr %4, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = load i32, ptr %5, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  br label %48

.lr.ph44.preheader:                               ; preds = %56, %10
  %.028.lcssa = phi i32 [ 2, %10 ], [ %.1, %56 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  %32 = zext nneg i32 %.028.lcssa to i64
  %33 = getelementptr inbounds [131072 x i32], ptr @M, i64 0, i64 %32
  store i32 1, ptr %33, align 4, !tbaa !5
  %34 = zext nneg i32 %.028.lcssa to i64
  %min.iters.check = icmp ult i32 %.028.lcssa, 8
  br i1 %min.iters.check, label %.lr.ph44.preheader65, label %vector.ph

.lr.ph44.preheader65:                             ; preds = %middle.block, %.lr.ph44.preheader
  %indvars.iv55.ph = phi i64 [ 0, %.lr.ph44.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph44

vector.ph:                                        ; preds = %.lr.ph44.preheader
  %n.vec = and i64 %32, 2147483640
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %35 = sub nsw i64 %34, %index
  %36 = getelementptr inbounds [131072 x i32], ptr @sei, i64 0, i64 %35
  %37 = getelementptr inbounds i8, ptr %36, i64 -12
  %38 = getelementptr inbounds i8, ptr %36, i64 -28
  %wide.load = load <4 x i32>, ptr %37, align 4, !tbaa !5
  %reverse = shufflevector <4 x i32> %wide.load, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
  %wide.load63 = load <4 x i32>, ptr %38, align 4, !tbaa !5
  %reverse64 = shufflevector <4 x i32> %wide.load63, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
  %39 = icmp eq <4 x i32> %reverse, zeroinitializer
  %40 = icmp eq <4 x i32> %reverse64, zeroinitializer
  %41 = sub nsw <4 x i32> <i32 104857601, i32 104857601, i32 104857601, i32 104857601>, %reverse
  %42 = sub nsw <4 x i32> <i32 104857601, i32 104857601, i32 104857601, i32 104857601>, %reverse64
  %43 = select <4 x i1> %39, <4 x i32> zeroinitializer, <4 x i32> %41
  %44 = select <4 x i1> %40, <4 x i32> zeroinitializer, <4 x i32> %42
  %45 = getelementptr inbounds [131072 x i32], ptr @M, i64 0, i64 %index
  %46 = getelementptr inbounds i8, ptr %45, i64 16
  store <4 x i32> %43, ptr %45, align 16, !tbaa !5
  store <4 x i32> %44, ptr %46, align 16, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %47 = icmp eq i64 %index.next, %n.vec
  br i1 %47, label %middle.block, label %vector.body, !llvm.loop !11

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %32
  br i1 %cmp.n, label %._crit_edge45, label %.lr.ph44.preheader65

48:                                               ; preds = %.lr.ph, %56
  %.02741 = phi i32 [ 1, %.lr.ph ], [ %57, %56 ]
  %.02840 = phi i32 [ 2, %.lr.ph ], [ %.1, %56 ]
  %49 = phi i32 [ %.promoted, %.lr.ph ], [ %62, %56 ]
  %50 = icmp sgt i32 %49, 23333
  br i1 %50, label %._crit_edge61, label %51

._crit_edge61:                                    ; preds = %48
  %.pre62 = zext nneg i32 %49 to i64
  br label %56

51:                                               ; preds = %48
  %52 = sext i32 %49 to i64
  %53 = getelementptr inbounds [131072 x i32], ptr @sei, i64 0, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = add nsw i32 %54, 1
  store i32 %55, ptr %53, align 4, !tbaa !5
  %spec.select = call i32 @llvm.smax.i32(i32 %.02840, i32 %49)
  br label %56

56:                                               ; preds = %._crit_edge61, %51
  %.pre-phi = phi i64 [ %.pre62, %._crit_edge61 ], [ %52, %51 ]
  %.1 = phi i32 [ %.02840, %._crit_edge61 ], [ %spec.select, %51 ]
  %57 = add nuw i32 %.02741, 1
  %58 = mul nsw i64 %.pre-phi, %29
  %59 = add nsw i64 %58, %31
  %60 = srem i64 %59, 23333
  %61 = trunc nsw i64 %60 to i32
  %62 = add nsw i32 %61, 1
  %exitcond54.not = icmp eq i32 %.02741, %12
  br i1 %exitcond54.not, label %.lr.ph44.preheader, label %48, !llvm.loop !14

._crit_edge45:                                    ; preds = %.lr.ph44, %middle.block
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #6
  store i32 1, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #6
  store i32 2, ptr %7, align 4, !tbaa !5
  %63 = add nuw nsw i32 %.028.lcssa, 1
  store i32 1, ptr @A, align 16, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @B, i64 4), align 4, !tbaa !5
  %64 = add nsw i32 %.028.lcssa, -1
  %65 = zext nneg i32 %64 to i64
  %66 = load i64, ptr %1, align 8, !tbaa !15
  %67 = add nsw i64 %66, %65
  store i64 %67, ptr %1, align 8, !tbaa !15
  %68 = icmp sgt i64 %67, 0
  br i1 %68, label %.lr.ph47, label %._crit_edge48

.lr.ph44:                                         ; preds = %.lr.ph44.preheader65, %.lr.ph44
  %indvars.iv55 = phi i64 [ %indvars.iv.next56, %.lr.ph44 ], [ %indvars.iv55.ph, %.lr.ph44.preheader65 ]
  %69 = sub nsw i64 %34, %indvars.iv55
  %70 = getelementptr inbounds [131072 x i32], ptr @sei, i64 0, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %.not35 = icmp eq i32 %71, 0
  %72 = sub nsw i32 104857601, %71
  %spec.select36 = select i1 %.not35, i32 0, i32 %72
  %73 = getelementptr inbounds [131072 x i32], ptr @M, i64 0, i64 %indvars.iv55
  store i32 %spec.select36, ptr %73, align 4, !tbaa !5
  %indvars.iv.next56 = add nuw nsw i64 %indvars.iv55, 1
  %exitcond58.not = icmp eq i64 %indvars.iv.next56, %32
  br i1 %exitcond58.not, label %._crit_edge45, label %.lr.ph44, !llvm.loop !17

.lr.ph47:                                         ; preds = %._crit_edge45, %86
  %74 = phi i64 [ %.pr, %86 ], [ %67, %._crit_edge45 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #6
  %75 = and i64 %74, 1
  %.not33 = icmp eq i64 %75, 0
  br i1 %.not33, label %80, label %76

76:                                               ; preds = %.lr.ph47
  %77 = load i32, ptr %6, align 4, !tbaa !5
  %78 = load i32, ptr %7, align 4, !tbaa !5
  call void @_Z8poly_muliPiiS_RiS_(i32 noundef %77, ptr noundef nonnull @A, i32 noundef %78, ptr noundef nonnull @B, ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull @C)
  %79 = load i32, ptr %8, align 4, !tbaa !5
  call void @_Z8poly_modiPiiS_RiS_(i32 noundef %79, ptr noundef nonnull @C, i32 noundef %63, ptr noundef nonnull @M, ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull @A)
  %.pre = load i64, ptr %1, align 8, !tbaa !15
  br label %80

80:                                               ; preds = %76, %.lr.ph47
  %81 = phi i64 [ %.pre, %76 ], [ %74, %.lr.ph47 ]
  %82 = ashr i64 %81, 1
  store i64 %82, ptr %1, align 8, !tbaa !15
  %.not34 = icmp ult i64 %81, 2
  br i1 %.not34, label %86, label %83

83:                                               ; preds = %80
  %84 = load i32, ptr %7, align 4, !tbaa !5
  call void @_Z8poly_muliPiiS_RiS_(i32 noundef %84, ptr noundef nonnull @B, i32 noundef %84, ptr noundef nonnull @B, ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull @C)
  %85 = load i32, ptr %8, align 4, !tbaa !5
  call void @_Z8poly_modiPiiS_RiS_(i32 noundef %85, ptr noundef nonnull @C, i32 noundef %63, ptr noundef nonnull @M, ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull @B)
  %.pr.pre = load i64, ptr %1, align 8, !tbaa !15
  br label %86

86:                                               ; preds = %83, %80
  %.pr = phi i64 [ %.pr.pre, %83 ], [ %82, %80 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #6
  %87 = icmp sgt i64 %.pr, 0
  br i1 %87, label %.lr.ph47, label %._crit_edge48.loopexit, !llvm.loop !18

._crit_edge48.loopexit:                           ; preds = %86
  %.pre60 = load i32, ptr %6, align 4, !tbaa !5
  br label %._crit_edge48

._crit_edge48:                                    ; preds = %._crit_edge48.loopexit, %._crit_edge45
  %88 = phi i32 [ %.pre60, %._crit_edge48.loopexit ], [ 1, %._crit_edge45 ]
  %89 = icmp eq i32 %88, %.028.lcssa
  br i1 %89, label %90, label %93

90:                                               ; preds = %._crit_edge48
  %91 = getelementptr inbounds [131072 x i32], ptr @A, i64 0, i64 %65
  %92 = load i32, ptr %91, align 4, !tbaa !5
  br label %93

93:                                               ; preds = %._crit_edge48, %90
  %94 = phi i32 [ %92, %90 ], [ 0, %._crit_edge48 ]
  %95 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %94)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  ret i32 0
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z8poly_muliPiiS_RiS_(i32 noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z8poly_modiPiiS_RiS_(i32 noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef) local_unnamed_addr #4

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5

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 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 = { 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 #4 = { 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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10, !12, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10}
!15 = !{!16, !16, i64 0}
!16 = !{!"long long", !7, i64 0}
!17 = distinct !{!17, !10, !13, !12}
!18 = distinct !{!18, !10}


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