; LLVM IR from tangjz/acm-icpc :: hdu (5447)

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

@tot = external dso_local global i32, align 4
@pr = external dso_local global [1000001 x i32], align 16
@d = external dso_local global [1000001 x i32], align 16
@t = external dso_local global i32, align 4
@ans1 = external dso_local global i32, align 4
@ans2 = external dso_local global i32, align 4
@v1 = external dso_local global i128, align 16
@v2 = external dso_local global i128, align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3updRinn(ptr noundef nonnull align 4 dereferenceable(4), i64 noundef, i64 noundef, i64 noundef, i64 noundef) #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
  %9 = alloca i128, align 16
  %10 = alloca i128, align 16
  %11 = alloca i128, align 16
  %12 = alloca i128, align 16
  %13 = alloca i128, align 16
  %14 = alloca i128, align 16
  %15 = alloca i128, align 16
  %16 = alloca i128, align 16
  store i32 0, ptr %1, align 4
  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 = %70, %0
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = icmp slt i32 %18, 1000001
  br i1 %19, label %21, label %20

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

21:                                               ; preds = %17
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [1000001 x i32], ptr @d, i64 0, i64 %23
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %26 = icmp ne i32 %25, 0
  br i1 %26, label %36, label %27

27:                                               ; preds = %21
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [1000001 x i32], ptr @d, i64 0, i64 %30
  store i32 %28, ptr %31, align 4, !tbaa !5
  %32 = load i32, ptr @tot, align 4, !tbaa !5
  %33 = add nsw i32 %32, 1
  store i32 %33, ptr @tot, align 4, !tbaa !5
  %34 = sext i32 %32 to i64
  %35 = getelementptr inbounds [1000001 x i32], ptr @pr, i64 0, i64 %34
  store i32 %28, ptr %35, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %27, %21
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  br label %37

37:                                               ; preds = %65, %36
  %38 = load i32, ptr %2, align 4, !tbaa !5
  %39 = load i32, ptr %4, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [1000001 x i32], ptr @pr, i64 0, i64 %40
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = mul nsw i32 %38, %42
  store i32 %43, ptr %5, align 4, !tbaa !5
  %44 = icmp slt i32 %43, 1000001
  br i1 %44, label %46, label %45

45:                                               ; preds = %37
  store i32 5, ptr %3, align 4
  br label %68

46:                                               ; preds = %37
  %47 = load i32, ptr %4, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [1000001 x i32], ptr @pr, i64 0, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = load i32, ptr %5, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [1000001 x i32], ptr @d, i64 0, i64 %52
  store i32 %50, ptr %53, align 4, !tbaa !5
  %54 = load i32, ptr %2, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [1000001 x i32], ptr @d, i64 0, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = load i32, ptr %4, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [1000001 x i32], ptr @pr, i64 0, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = icmp eq i32 %57, %61
  br i1 %62, label %63, label %64

63:                                               ; preds = %46
  store i32 5, ptr %3, align 4
  br label %68

64:                                               ; preds = %46
  br label %65

65:                                               ; preds = %64
  %66 = load i32, ptr %4, align 4, !tbaa !5
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %4, align 4, !tbaa !5
  br label %37, !llvm.loop !9

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

69:                                               ; preds = %68
  br label %70

70:                                               ; preds = %69
  %71 = load i32, ptr %2, align 4, !tbaa !5
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr %2, align 4, !tbaa !5
  br label %17, !llvm.loop !11

73:                                               ; preds = %20
  call void @_Z4readIiEvRT_(ptr noundef nonnull align 4 dereferenceable(4) @t)
  br label %74

74:                                               ; preds = %156, %73
  %75 = load i32, ptr @t, align 4, !tbaa !5
  %76 = add nsw i32 %75, -1
  store i32 %76, ptr @t, align 4, !tbaa !5
  %77 = icmp ne i32 %75, 0
  br i1 %77, label %78, label %200

78:                                               ; preds = %74
  call void @_Z4readInEvRT_(ptr noundef nonnull align 16 dereferenceable(16) @v1)
  call void @_Z4readInEvRT_(ptr noundef nonnull align 16 dereferenceable(16) @v2)
  store i32 1, ptr @ans2, align 4, !tbaa !5
  store i32 1, ptr @ans1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %79

79:                                               ; preds = %153, %78
  %80 = load i32, ptr %6, align 4, !tbaa !5
  %81 = load i32, ptr @tot, align 4, !tbaa !5
  %82 = icmp slt i32 %80, %81
  br i1 %82, label %84, label %83

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

84:                                               ; preds = %79
  %85 = load i128, ptr @v1, align 16, !tbaa !12
  %86 = load i32, ptr %6, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [1000001 x i32], ptr @pr, i64 0, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = sext i32 %89 to i128
  %91 = srem i128 %85, %90
  %92 = icmp eq i128 %91, 0
  br i1 %92, label %93, label %118

93:                                               ; preds = %84
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %94

94:                                               ; preds = %104, %93
  %95 = load i128, ptr @v1, align 16, !tbaa !12
  %96 = load i32, ptr %6, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [1000001 x i32], ptr @pr, i64 0, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = sext i32 %99 to i128
  %101 = srem i128 %95, %100
  %102 = icmp eq i128 %101, 0
  br i1 %102, label %103, label %114

103:                                              ; preds = %94
  br label %104

104:                                              ; preds = %103
  %105 = load i32, ptr %6, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [1000001 x i32], ptr @pr, i64 0, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = sext i32 %108 to i128
  %110 = load i128, ptr @v1, align 16, !tbaa !12
  %111 = sdiv i128 %110, %109
  store i128 %111, ptr @v1, align 16, !tbaa !12
  %112 = load i32, ptr %7, align 4, !tbaa !5
  %113 = add nsw i32 %112, 1
  store i32 %113, ptr %7, align 4, !tbaa !5
  br label %94, !llvm.loop !14

114:                                              ; preds = %94
  %115 = load i32, ptr %7, align 4, !tbaa !5
  %116 = load i32, ptr @ans1, align 4, !tbaa !5
  %117 = mul nsw i32 %116, %115
  store i32 %117, ptr @ans1, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %118

118:                                              ; preds = %114, %84
  %119 = load i128, ptr @v2, align 16, !tbaa !12
  %120 = load i32, ptr %6, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [1000001 x i32], ptr @pr, i64 0, i64 %121
  %123 = load i32, ptr %122, align 4, !tbaa !5
  %124 = sext i32 %123 to i128
  %125 = srem i128 %119, %124
  %126 = icmp eq i128 %125, 0
  br i1 %126, label %127, label %152

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

128:                                              ; preds = %138, %127
  %129 = load i128, ptr @v2, align 16, !tbaa !12
  %130 = load i32, ptr %6, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [1000001 x i32], ptr @pr, i64 0, i64 %131
  %133 = load i32, ptr %132, align 4, !tbaa !5
  %134 = sext i32 %133 to i128
  %135 = srem i128 %129, %134
  %136 = icmp eq i128 %135, 0
  br i1 %136, label %137, label %148

137:                                              ; preds = %128
  br label %138

138:                                              ; preds = %137
  %139 = load i32, ptr %6, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [1000001 x i32], ptr @pr, i64 0, i64 %140
  %142 = load i32, ptr %141, align 4, !tbaa !5
  %143 = sext i32 %142 to i128
  %144 = load i128, ptr @v2, align 16, !tbaa !12
  %145 = sdiv i128 %144, %143
  store i128 %145, ptr @v2, align 16, !tbaa !12
  %146 = load i32, ptr %8, align 4, !tbaa !5
  %147 = add nsw i32 %146, 1
  store i32 %147, ptr %8, align 4, !tbaa !5
  br label %128, !llvm.loop !15

148:                                              ; preds = %128
  %149 = load i32, ptr %8, align 4, !tbaa !5
  %150 = load i32, ptr @ans2, align 4, !tbaa !5
  %151 = mul nsw i32 %150, %149
  store i32 %151, ptr @ans2, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %152

152:                                              ; preds = %148, %118
  br label %153

153:                                              ; preds = %152
  %154 = load i32, ptr %6, align 4, !tbaa !5
  %155 = add nsw i32 %154, 1
  store i32 %155, ptr %6, align 4, !tbaa !5
  br label %79, !llvm.loop !16

156:                                              ; preds = %83
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #5
  %157 = load i128, ptr @v1, align 16, !tbaa !12
  %158 = load i128, ptr @v2, align 16, !tbaa !12
  store i128 %157, ptr %10, align 16, !tbaa !12
  %159 = getelementptr inbounds { i64, i64 }, ptr %10, i32 0, i32 0
  %160 = load i64, ptr %159, align 16
  %161 = getelementptr inbounds { i64, i64 }, ptr %10, i32 0, i32 1
  %162 = load i64, ptr %161, align 8
  store i128 %158, ptr %11, align 16, !tbaa !12
  %163 = getelementptr inbounds { i64, i64 }, ptr %11, i32 0, i32 0
  %164 = load i64, ptr %163, align 16
  %165 = getelementptr inbounds { i64, i64 }, ptr %11, i32 0, i32 1
  %166 = load i64, ptr %165, align 8
  %167 = call noundef { i64, i64 } @_ZSt5__gcdInET_S0_S0_(i64 noundef %160, i64 noundef %162, i64 noundef %164, i64 noundef %166)
  %168 = getelementptr inbounds { i64, i64 }, ptr %12, i32 0, i32 0
  %169 = extractvalue { i64, i64 } %167, 0
  store i64 %169, ptr %168, align 16
  %170 = getelementptr inbounds { i64, i64 }, ptr %12, i32 0, i32 1
  %171 = extractvalue { i64, i64 } %167, 1
  store i64 %171, ptr %170, align 8
  %172 = load i128, ptr %12, align 16, !tbaa !12
  store i128 %172, ptr %9, align 16, !tbaa !12
  %173 = load i128, ptr %9, align 16, !tbaa !12
  %174 = load i128, ptr @v1, align 16, !tbaa !12
  %175 = load i128, ptr %9, align 16, !tbaa !12
  %176 = sdiv i128 %174, %175
  store i128 %173, ptr %13, align 16, !tbaa !12
  %177 = getelementptr inbounds { i64, i64 }, ptr %13, i32 0, i32 0
  %178 = load i64, ptr %177, align 16
  %179 = getelementptr inbounds { i64, i64 }, ptr %13, i32 0, i32 1
  %180 = load i64, ptr %179, align 8
  store i128 %176, ptr %14, align 16, !tbaa !12
  %181 = getelementptr inbounds { i64, i64 }, ptr %14, i32 0, i32 0
  %182 = load i64, ptr %181, align 16
  %183 = getelementptr inbounds { i64, i64 }, ptr %14, i32 0, i32 1
  %184 = load i64, ptr %183, align 8
  call void @_Z3updRinn(ptr noundef nonnull align 4 dereferenceable(4) @ans1, i64 noundef %178, i64 noundef %180, i64 noundef %182, i64 noundef %184)
  %185 = load i128, ptr %9, align 16, !tbaa !12
  %186 = load i128, ptr @v2, align 16, !tbaa !12
  %187 = load i128, ptr %9, align 16, !tbaa !12
  %188 = sdiv i128 %186, %187
  store i128 %185, ptr %15, align 16, !tbaa !12
  %189 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 0
  %190 = load i64, ptr %189, align 16
  %191 = getelementptr inbounds { i64, i64 }, ptr %15, i32 0, i32 1
  %192 = load i64, ptr %191, align 8
  store i128 %188, ptr %16, align 16, !tbaa !12
  %193 = getelementptr inbounds { i64, i64 }, ptr %16, i32 0, i32 0
  %194 = load i64, ptr %193, align 16
  %195 = getelementptr inbounds { i64, i64 }, ptr %16, i32 0, i32 1
  %196 = load i64, ptr %195, align 8
  call void @_Z3updRinn(ptr noundef nonnull align 4 dereferenceable(4) @ans2, i64 noundef %190, i64 noundef %192, i64 noundef %194, i64 noundef %196)
  %197 = load i32, ptr @ans1, align 4, !tbaa !5
  %198 = load i32, ptr @ans2, align 4, !tbaa !5
  %199 = call i32 (ptr, ...) @printf(ptr noundef @.str, i32 noundef %197, i32 noundef %198)
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #5
  br label %74, !llvm.loop !17

200:                                              ; preds = %74
  ret i32 0
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4readIiEvRT_(ptr noundef nonnull align 4 dereferenceable(4)) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4readInEvRT_(ptr noundef nonnull align 16 dereferenceable(16)) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef { i64, i64 } @_ZSt5__gcdInET_S0_S0_(i64 noundef, i64 noundef, i64 noundef, i64 noundef) #1

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 = { "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 = !{!13, !13, i64 0}
!13 = !{!"__int128", !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !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"

@tot = external dso_local local_unnamed_addr global i32, align 4
@pr = external dso_local local_unnamed_addr global [1000001 x i32], align 16
@d = external dso_local local_unnamed_addr global [1000001 x i32], align 16
@t = external dso_local global i32, align 4
@ans1 = external dso_local global i32, align 4
@ans2 = external dso_local global i32, align 4
@v1 = external dso_local global i128, align 16
@v2 = external dso_local global i128, align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3updRinn(ptr noundef nonnull align 4 dereferenceable(4), i64 noundef, i64 noundef, i64 noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %tot.promoted = load i32, ptr @tot, align 4, !tbaa !5
  br label %4

1:                                                ; preds = %._crit_edge
  tail call void @_Z4readIiEvRT_(ptr noundef nonnull align 4 dereferenceable(4) @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
  %.not72 = icmp eq i32 %2, 0
  br i1 %.not72, label %._crit_edge75, label %.lr.ph74

4:                                                ; preds = %0, %._crit_edge
  %indvars.iv80 = phi i64 [ 2, %0 ], [ %indvars.iv.next81, %._crit_edge ]
  %5 = phi i32 [ %tot.promoted, %0 ], [ %13, %._crit_edge ]
  %6 = getelementptr inbounds [1000001 x i32], ptr @d, i64 0, i64 %indvars.iv80
  %7 = load i32, ptr %6, align 4, !tbaa !5
  %.not45 = icmp eq i32 %7, 0
  %8 = trunc nuw nsw i64 %indvars.iv80 to i32
  br i1 %.not45, label %9, label %._crit_edge87

9:                                                ; preds = %4
  store i32 %8, ptr %6, align 4, !tbaa !5
  %10 = add nsw i32 %5, 1
  store i32 %10, ptr @tot, align 4, !tbaa !5
  %11 = sext i32 %5 to i64
  %12 = getelementptr inbounds [1000001 x i32], ptr @pr, i64 0, i64 %11
  store i32 %8, ptr %12, align 4, !tbaa !5
  br label %._crit_edge87

._crit_edge87:                                    ; preds = %4, %9
  %13 = phi i32 [ %10, %9 ], [ %5, %4 ]
  %14 = load i32, ptr @pr, align 16, !tbaa !5
  %15 = mul nsw i32 %14, %8
  %16 = icmp slt i32 %15, 1000001
  br i1 %16, label %.lr.ph, label %._crit_edge

17:                                               ; preds = %.lr.ph
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %18 = getelementptr inbounds [1000001 x i32], ptr @pr, i64 0, i64 %indvars.iv.next
  %19 = load i32, ptr %18, align 4, !tbaa !5
  %20 = mul nsw i32 %19, %8
  %21 = icmp slt i32 %20, 1000001
  br i1 %21, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.lr.ph:                                           ; preds = %._crit_edge87, %17
  %indvars.iv = phi i64 [ %indvars.iv.next, %17 ], [ 0, %._crit_edge87 ]
  %22 = phi i32 [ %20, %17 ], [ %15, %._crit_edge87 ]
  %23 = phi i32 [ %19, %17 ], [ %14, %._crit_edge87 ]
  %24 = sext i32 %22 to i64
  %25 = getelementptr inbounds [1000001 x i32], ptr @d, i64 0, i64 %24
  store i32 %23, ptr %25, align 4, !tbaa !5
  %26 = load i32, ptr %6, align 4, !tbaa !5
  %27 = icmp eq i32 %26, %23
  br i1 %27, label %._crit_edge, label %17

._crit_edge:                                      ; preds = %17, %.lr.ph, %._crit_edge87
  %indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next81, 1000001
  br i1 %exitcond.not, label %1, label %4, !llvm.loop !11

.lr.ph74:                                         ; preds = %1, %._crit_edge71
  tail call void @_Z4readInEvRT_(ptr noundef nonnull align 16 dereferenceable(16) @v1)
  tail call void @_Z4readInEvRT_(ptr noundef nonnull align 16 dereferenceable(16) @v2)
  store i32 1, ptr @ans2, align 4, !tbaa !5
  store i32 1, ptr @ans1, align 4, !tbaa !5
  %28 = load i32, ptr @tot, align 4, !tbaa !5
  %v1.promoted58 = load i128, ptr @v1, align 16, !tbaa !12
  %v2.promoted62 = load i128, ptr @v2, align 16, !tbaa !12
  %29 = icmp sgt i32 %28, 0
  %extract.t88 = trunc i128 %v2.promoted62 to i64
  %extract90 = lshr i128 %v2.promoted62, 64
  %extract.t91 = trunc nuw i128 %extract90 to i64
  %extract.t109 = trunc i128 %v1.promoted58 to i64
  %extract112 = lshr i128 %v1.promoted58, 64
  %extract.t113 = trunc nuw i128 %extract112 to i64
  br i1 %29, label %.lr.ph70.preheader, label %._crit_edge71

.lr.ph70.preheader:                               ; preds = %.lr.ph74
  %wide.trip.count = zext nneg i32 %28 to i64
  %extract.t101 = trunc i128 %v2.promoted62 to i64
  %extract104 = lshr i128 %v2.promoted62, 64
  %extract.t105 = trunc nuw i128 %extract104 to i64
  %extract.t123 = trunc i128 %v1.promoted58 to i64
  %extract126 = lshr i128 %v1.promoted58, 64
  %extract.t127 = trunc nuw i128 %extract126 to i64
  br label %.lr.ph70

._crit_edge71:                                    ; preds = %67, %.lr.ph74
  %.off0 = phi i64 [ %extract.t88, %.lr.ph74 ], [ %.off092, %67 ]
  %.off64 = phi i64 [ %extract.t91, %.lr.ph74 ], [ %.off6495, %67 ]
  %.off0108 = phi i64 [ %extract.t109, %.lr.ph74 ], [ %.off0114, %67 ]
  %.off64110 = phi i64 [ %extract.t113, %.lr.ph74 ], [ %.off64117, %67 ]
  %30 = tail call noundef { i64, i64 } @_ZSt5__gcdInET_S0_S0_(i64 noundef %.off0108, i64 noundef %.off64110, i64 noundef %.off0, i64 noundef %.off64)
  %31 = extractvalue { i64, i64 } %30, 0
  %32 = extractvalue { i64, i64 } %30, 1
  %.sroa.28.0.insert.ext = zext i64 %32 to i128
  %.sroa.28.0.insert.shift = shl nuw i128 %.sroa.28.0.insert.ext, 64
  %.sroa.07.0.insert.ext = zext i64 %31 to i128
  %.sroa.07.0.insert.insert = or disjoint i128 %.sroa.28.0.insert.shift, %.sroa.07.0.insert.ext
  %33 = load i128, ptr @v1, align 16, !tbaa !12
  %34 = sdiv i128 %33, %.sroa.07.0.insert.insert
  %.sroa.03.0.extract.trunc = trunc i128 %34 to i64
  %.sroa.24.0.extract.shift = lshr i128 %34, 64
  %.sroa.24.0.extract.trunc = trunc nuw i128 %.sroa.24.0.extract.shift to i64
  tail call void @_Z3updRinn(ptr noundef nonnull align 4 dereferenceable(4) @ans1, i64 noundef %31, i64 noundef %32, i64 noundef %.sroa.03.0.extract.trunc, i64 noundef %.sroa.24.0.extract.trunc)
  %35 = load i128, ptr @v2, align 16, !tbaa !12
  %36 = sdiv i128 %35, %.sroa.07.0.insert.insert
  %.sroa.0.0.extract.trunc = trunc i128 %36 to i64
  %.sroa.2.0.extract.shift = lshr i128 %36, 64
  %.sroa.2.0.extract.trunc = trunc nuw i128 %.sroa.2.0.extract.shift to i64
  tail call void @_Z3updRinn(ptr noundef nonnull align 4 dereferenceable(4) @ans2, i64 noundef %31, i64 noundef %32, i64 noundef %.sroa.0.0.extract.trunc, i64 noundef %.sroa.2.0.extract.trunc)
  %37 = load i32, ptr @ans1, align 4, !tbaa !5
  %38 = load i32, ptr @ans2, align 4, !tbaa !5
  %39 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %37, i32 noundef %38)
  %40 = load i32, ptr @t, align 4, !tbaa !5
  %41 = add nsw i32 %40, -1
  store i32 %41, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %40, 0
  br i1 %.not, label %._crit_edge75, label %.lr.ph74, !llvm.loop !14

.lr.ph70:                                         ; preds = %.lr.ph70.preheader, %67
  %.off0100 = phi i64 [ %extract.t101, %.lr.ph70.preheader ], [ %.off092, %67 ]
  %.off64103 = phi i64 [ %extract.t105, %.lr.ph70.preheader ], [ %.off6495, %67 ]
  %.off0122 = phi i64 [ %extract.t123, %.lr.ph70.preheader ], [ %.off0114, %67 ]
  %.off64125 = phi i64 [ %extract.t127, %.lr.ph70.preheader ], [ %.off64117, %67 ]
  %indvars.iv83 = phi i64 [ 0, %.lr.ph70.preheader ], [ %indvars.iv.next84, %67 ]
  %.lcssa6167 = phi i128 [ %v1.promoted58, %.lr.ph70.preheader ], [ %.lcssa59, %67 ]
  %42 = phi i32 [ 1, %.lr.ph70.preheader ], [ %57, %67 ]
  %.lcssa576566 = phi i128 [ %v2.promoted62, %.lr.ph70.preheader ], [ %.lcssa5763, %67 ]
  %43 = phi i32 [ 1, %.lr.ph70.preheader ], [ %68, %67 ]
  %44 = getelementptr inbounds [1000001 x i32], ptr @pr, i64 0, i64 %indvars.iv83
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = sext i32 %45 to i128
  %47 = srem i128 %.lcssa6167, %46
  %48 = icmp eq i128 %47, 0
  br i1 %48, label %.lr.ph51, label %56

.lr.ph51:                                         ; preds = %.lr.ph70, %.lr.ph51
  %.04250 = phi i32 [ %51, %.lr.ph51 ], [ 0, %.lr.ph70 ]
  %49 = phi i128 [ %50, %.lr.ph51 ], [ %.lcssa6167, %.lr.ph70 ]
  %50 = sdiv i128 %49, %46
  %51 = add nuw nsw i32 %.04250, 1
  %52 = srem i128 %50, %46
  %53 = icmp eq i128 %52, 0
  br i1 %53, label %.lr.ph51, label %54, !llvm.loop !15

54:                                               ; preds = %.lr.ph51
  store i128 %50, ptr @v1, align 16, !tbaa !12
  %55 = mul nsw i32 %42, %51
  store i32 %55, ptr @ans1, align 4, !tbaa !5
  %extract.t115 = trunc i128 %50 to i64
  %extract118 = lshr i128 %50, 64
  %extract.t119 = trunc nuw i128 %extract118 to i64
  br label %56

56:                                               ; preds = %54, %.lr.ph70
  %.off0114 = phi i64 [ %extract.t115, %54 ], [ %.off0122, %.lr.ph70 ]
  %.off64117 = phi i64 [ %extract.t119, %54 ], [ %.off64125, %.lr.ph70 ]
  %57 = phi i32 [ %55, %54 ], [ %42, %.lr.ph70 ]
  %.lcssa59 = phi i128 [ %50, %54 ], [ %.lcssa6167, %.lr.ph70 ]
  %58 = srem i128 %.lcssa576566, %46
  %59 = icmp eq i128 %58, 0
  br i1 %59, label %.lr.ph54, label %67

.lr.ph54:                                         ; preds = %56, %.lr.ph54
  %.04353 = phi i32 [ %62, %.lr.ph54 ], [ 0, %56 ]
  %60 = phi i128 [ %61, %.lr.ph54 ], [ %.lcssa576566, %56 ]
  %61 = sdiv i128 %60, %46
  %62 = add nuw nsw i32 %.04353, 1
  %63 = srem i128 %61, %46
  %64 = icmp eq i128 %63, 0
  br i1 %64, label %.lr.ph54, label %65, !llvm.loop !16

65:                                               ; preds = %.lr.ph54
  store i128 %61, ptr @v2, align 16, !tbaa !12
  %66 = mul nsw i32 %43, %62
  store i32 %66, ptr @ans2, align 4, !tbaa !5
  %extract.t94 = trunc i128 %61 to i64
  %extract98 = lshr i128 %61, 64
  %extract.t99 = trunc nuw i128 %extract98 to i64
  br label %67

67:                                               ; preds = %56, %65
  %.off092 = phi i64 [ %.off0100, %56 ], [ %extract.t94, %65 ]
  %.off6495 = phi i64 [ %.off64103, %56 ], [ %extract.t99, %65 ]
  %68 = phi i32 [ %43, %56 ], [ %66, %65 ]
  %.lcssa5763 = phi i128 [ %.lcssa576566, %56 ], [ %61, %65 ]
  %indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1
  %exitcond86.not = icmp eq i64 %indvars.iv.next84, %wide.trip.count
  br i1 %exitcond86.not, label %._crit_edge71, label %.lr.ph70, !llvm.loop !17

._crit_edge75:                                    ; preds = %._crit_edge71, %1
  ret i32 0
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4readIiEvRT_(ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z4readInEvRT_(ptr noundef nonnull align 16 dereferenceable(16)) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef { i64, i64 } @_ZSt5__gcdInET_S0_S0_(i64 noundef, i64 noundef, i64 noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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 = { 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 #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 = { 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 = distinct !{!11, !10}
!12 = !{!13, !13, i64 0}
!13 = !{!"__int128", !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}


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