; LLVM IR from tangjz/acm-icpc :: codeforces/complete (819D)

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

%class.anon = type { i8 }
%class.anon.0 = type { i8 }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@tim = external dso_local global [200001 x i32], align 16
@ord = external dso_local global [200001 x i32], align 16
@ans = external dso_local global [200001 x i32], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 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

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca %class.anon, align 1
  %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 %class.anon.0, align 1
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %17

17:                                               ; preds = %42, %0
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = load i32, ptr @n, align 4, !tbaa !5
  %20 = icmp sle i32 %18, %19
  br i1 %20, label %22, label %21

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

22:                                               ; preds = %17
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds i32, ptr @tim, i64 %24
  %26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %25)
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = sub nsw i32 %27, 1
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [200001 x i32], ptr @tim, i64 0, i64 %29
  %31 = load i32, ptr %30, align 4, !tbaa !5
  %32 = load i32, ptr %2, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [200001 x i32], ptr @tim, i64 0, i64 %33
  %35 = load i32, ptr %34, align 4, !tbaa !5
  %36 = add nsw i32 %31, %35
  %37 = load i32, ptr @t, align 4, !tbaa !5
  %38 = srem i32 %36, %37
  %39 = load i32, ptr %2, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [200001 x i32], ptr @tim, i64 0, i64 %40
  store i32 %38, ptr %41, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %22
  %43 = load i32, ptr %2, align 4, !tbaa !5
  %44 = add nsw i32 %43, 1
  store i32 %44, ptr %2, align 4, !tbaa !5
  br label %17, !llvm.loop !9

45:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %46 = load i32, ptr @n, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [200001 x i32], ptr @tim, i64 0, i64 %47
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = load i32, ptr @t, align 4, !tbaa !5
  %51 = call noundef i32 @_Z5exgcdiiRiS_(i32 noundef %49, i32 noundef %50, ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  store i32 %51, ptr %5, align 4, !tbaa !5
  %52 = load i32, ptr %5, align 4, !tbaa !5
  %53 = load i32, ptr @t, align 4, !tbaa !5
  %54 = sdiv i32 %53, %52
  store i32 %54, ptr @t, align 4, !tbaa !5
  %55 = load i32, ptr %3, align 4, !tbaa !5
  %56 = icmp slt i32 %55, 0
  br i1 %56, label %57, label %62

57:                                               ; preds = %45
  %58 = load i32, ptr @t, align 4, !tbaa !5
  %59 = load i32, ptr %3, align 4, !tbaa !5
  %60 = add nsw i32 %59, %58
  store i32 %60, ptr %3, align 4, !tbaa !5
  %61 = icmp ne i32 %60, 0
  br label %62

62:                                               ; preds = %57, %45
  %63 = phi i1 [ false, %45 ], [ %61, %57 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %64

64:                                               ; preds = %83, %62
  %65 = load i32, ptr %6, align 4, !tbaa !5
  %66 = load i32, ptr @n, 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 %6) #5
  br label %86

69:                                               ; preds = %64
  %70 = load i32, ptr %6, align 4, !tbaa !5
  %71 = load i32, ptr %6, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [200001 x i32], ptr @ord, i64 0, i64 %72
  store i32 %70, ptr %73, align 4, !tbaa !5
  %74 = load i32, ptr %6, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [200001 x i32], ptr @tim, i64 0, i64 %75
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %78 = load i32, ptr %5, align 4, !tbaa !5
  %79 = srem i32 %77, %78
  %80 = load i32, ptr %6, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [200001 x i32], ptr @ans, i64 0, i64 %81
  store i32 %79, ptr %82, align 4, !tbaa !5
  br label %83

83:                                               ; preds = %69
  %84 = load i32, ptr %6, align 4, !tbaa !5
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %6, align 4, !tbaa !5
  br label %64, !llvm.loop !11

86:                                               ; preds = %68
  %87 = load i32, ptr @n, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds i32, ptr @ord, i64 %88
  %90 = getelementptr inbounds i32, ptr %89, i64 1
  call void @"_ZSt4sortIPiZ4mainE3$_0EvT_S2_T0_"(ptr noundef getelementptr inbounds (i32, ptr @ord, i64 1), ptr noundef %90)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 1, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 1, ptr %9, align 4, !tbaa !5
  br label %91

91:                                               ; preds = %213, %86
  %92 = load i32, ptr %8, align 4, !tbaa !5
  %93 = load i32, ptr @n, align 4, !tbaa !5
  %94 = icmp sle i32 %92, %93
  br i1 %94, label %96, label %95

95:                                               ; preds = %91
  store i32 8, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %215

96:                                               ; preds = %91
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %97 = load i32, ptr %8, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [200001 x i32], ptr @ord, i64 0, i64 %98
  %100 = load i32, ptr %99, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [200001 x i32], ptr @ans, i64 0, i64 %101
  %103 = load i32, ptr %102, align 4, !tbaa !5
  store i32 %103, ptr %11, align 4, !tbaa !5
  br label %104

104:                                              ; preds = %144, %96
  %105 = load i32, ptr %9, align 4, !tbaa !5
  %106 = load i32, ptr @n, align 4, !tbaa !5
  %107 = icmp sle i32 %105, %106
  br i1 %107, label %108, label %118

108:                                              ; preds = %104
  %109 = load i32, ptr %11, align 4, !tbaa !5
  %110 = load i32, ptr %9, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [200001 x i32], ptr @ord, i64 0, i64 %111
  %113 = load i32, ptr %112, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [200001 x i32], ptr @ans, i64 0, i64 %114
  %116 = load i32, ptr %115, align 4, !tbaa !5
  %117 = icmp eq i32 %109, %116
  br label %118

118:                                              ; preds = %108, %104
  %119 = phi i1 [ false, %104 ], [ %117, %108 ]
  br i1 %119, label %120, label %147

120:                                              ; preds = %118
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %121 = load i32, ptr %9, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [200001 x i32], ptr @ord, i64 0, i64 %122
  %124 = load i32, ptr %123, align 4, !tbaa !5
  store i32 %124, ptr %12, align 4, !tbaa !5
  %125 = load i32, ptr %12, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [200001 x i32], ptr @tim, i64 0, i64 %126
  %128 = load i32, ptr %127, align 4, !tbaa !5
  %129 = load i32, ptr %11, align 4, !tbaa !5
  %130 = sub nsw i32 %128, %129
  %131 = load i32, ptr %5, align 4, !tbaa !5
  %132 = sdiv i32 %130, %131
  %133 = sext i32 %132 to i64
  %134 = load i32, ptr %3, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = mul nsw i64 %133, %135
  %137 = load i32, ptr @t, align 4, !tbaa !5
  %138 = sext i32 %137 to i64
  %139 = srem i64 %136, %138
  %140 = trunc i64 %139 to i32
  %141 = load i32, ptr %12, align 4, !tbaa !5
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [200001 x i32], ptr @tim, i64 0, i64 %142
  store i32 %140, ptr %143, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %144

144:                                              ; preds = %120
  %145 = load i32, ptr %9, align 4, !tbaa !5
  %146 = add nsw i32 %145, 1
  store i32 %146, ptr %9, align 4, !tbaa !5
  br label %104, !llvm.loop !12

147:                                              ; preds = %118
  %148 = load i32, ptr %8, align 4, !tbaa !5
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds i32, ptr @ord, i64 %149
  %151 = load i32, ptr %9, align 4, !tbaa !5
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds i32, ptr @ord, i64 %152
  call void @"_ZSt4sortIPiZ4mainE3$_1EvT_S2_T0_"(ptr noundef %150, ptr noundef %153)
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %154 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %154, ptr %14, align 4, !tbaa !5
  br label %155

155:                                              ; preds = %184, %147
  %156 = load i32, ptr %14, align 4, !tbaa !5
  %157 = add nsw i32 %156, 1
  %158 = load i32, ptr %9, align 4, !tbaa !5
  %159 = icmp slt i32 %157, %158
  br i1 %159, label %161, label %160

160:                                              ; preds = %155
  store i32 14, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %187

161:                                              ; preds = %155
  %162 = load i32, ptr %14, align 4, !tbaa !5
  %163 = add nsw i32 %162, 1
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds [200001 x i32], ptr @ord, i64 0, i64 %164
  %166 = load i32, ptr %165, align 4, !tbaa !5
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds [200001 x i32], ptr @tim, i64 0, i64 %167
  %169 = load i32, ptr %168, align 4, !tbaa !5
  %170 = load i32, ptr %14, align 4, !tbaa !5
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds [200001 x i32], ptr @ord, i64 0, i64 %171
  %173 = load i32, ptr %172, align 4, !tbaa !5
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds [200001 x i32], ptr @tim, i64 0, i64 %174
  %176 = load i32, ptr %175, align 4, !tbaa !5
  %177 = sub nsw i32 %169, %176
  %178 = load i32, ptr %14, align 4, !tbaa !5
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [200001 x i32], ptr @ord, i64 0, i64 %179
  %181 = load i32, ptr %180, align 4, !tbaa !5
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds [200001 x i32], ptr @ans, i64 0, i64 %182
  store i32 %177, ptr %183, align 4, !tbaa !5
  br label %184

184:                                              ; preds = %161
  %185 = load i32, ptr %14, align 4, !tbaa !5
  %186 = add nsw i32 %185, 1
  store i32 %186, ptr %14, align 4, !tbaa !5
  br label %155, !llvm.loop !13

187:                                              ; preds = %160
  %188 = load i32, ptr %8, align 4, !tbaa !5
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds [200001 x i32], ptr @ord, i64 0, i64 %189
  %191 = load i32, ptr %190, align 4, !tbaa !5
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds [200001 x i32], ptr @tim, i64 0, i64 %192
  %194 = load i32, ptr %193, align 4, !tbaa !5
  %195 = load i32, ptr @t, align 4, !tbaa !5
  %196 = add nsw i32 %194, %195
  %197 = load i32, ptr %9, align 4, !tbaa !5
  %198 = sub nsw i32 %197, 1
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds [200001 x i32], ptr @ord, i64 0, i64 %199
  %201 = load i32, ptr %200, align 4, !tbaa !5
  %202 = sext i32 %201 to i64
  %203 = getelementptr inbounds [200001 x i32], ptr @tim, i64 0, i64 %202
  %204 = load i32, ptr %203, align 4, !tbaa !5
  %205 = sub nsw i32 %196, %204
  %206 = load i32, ptr %9, align 4, !tbaa !5
  %207 = sub nsw i32 %206, 1
  %208 = sext i32 %207 to i64
  %209 = getelementptr inbounds [200001 x i32], ptr @ord, i64 0, i64 %208
  %210 = load i32, ptr %209, align 4, !tbaa !5
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds [200001 x i32], ptr @ans, i64 0, i64 %211
  store i32 %205, ptr %212, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %213

213:                                              ; preds = %187
  %214 = load i32, ptr %9, align 4, !tbaa !5
  store i32 %214, ptr %8, align 4, !tbaa !5
  br label %91, !llvm.loop !14

215:                                              ; preds = %95
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 1, ptr %15, align 4, !tbaa !5
  br label %216

216:                                              ; preds = %234, %215
  %217 = load i32, ptr %15, align 4, !tbaa !5
  %218 = load i32, ptr @n, align 4, !tbaa !5
  %219 = icmp sle i32 %217, %218
  br i1 %219, label %221, label %220

220:                                              ; preds = %216
  store i32 17, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %237

221:                                              ; preds = %216
  %222 = load i32, ptr %15, align 4, !tbaa !5
  %223 = sext i32 %222 to i64
  %224 = getelementptr inbounds [200001 x i32], ptr @ans, i64 0, i64 %223
  %225 = load i32, ptr %224, align 4, !tbaa !5
  %226 = load i32, ptr %15, align 4, !tbaa !5
  %227 = load i32, ptr @n, align 4, !tbaa !5
  %228 = icmp eq i32 %226, %227
  %229 = zext i1 %228 to i64
  %230 = getelementptr inbounds [3 x i8], ptr @.str.3, i64 0, i64 %229
  %231 = load i8, ptr %230, align 1, !tbaa !15
  %232 = sext i8 %231 to i32
  %233 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %225, i32 noundef %232)
  br label %234

234:                                              ; preds = %221
  %235 = load i32, ptr %15, align 4, !tbaa !5
  %236 = add nsw i32 %235, 1
  store i32 %236, ptr %15, align 4, !tbaa !5
  br label %216, !llvm.loop !16

237:                                              ; preds = %220
  store i32 0, ptr %1, align 4
  store i32 1, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  %238 = load i32, ptr %1, align 4
  ret i32 %238
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt4sortIPiZ4mainE3$_0EvT_S2_T0_"(ptr noundef, ptr noundef) #4

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt4sortIPiZ4mainE3$_1EvT_S2_T0_"(ptr noundef, ptr noundef) #4

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

attributes #0 = { 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 #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 = distinct !{!14, !10}
!15 = !{!7, !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"

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@tim = external dso_local global [200001 x i32], align 16
@ord = external dso_local global [200001 x i32], align 16
@ans = external dso_local local_unnamed_addr global [200001 x i32], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z5exgcdiiRiS_(i32 noundef, i32 noundef, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) 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 i32, align 4
  %2 = alloca i32, align 4
  %3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t, ptr noundef nonnull @n)
  %4 = load i32, ptr @n, align 4, !tbaa !5
  %.not58 = icmp slt i32 %4, 1
  br i1 %.not58, label %.._crit_edge_crit_edge, label %.lr.ph

.._crit_edge_crit_edge:                           ; preds = %0
  %.pre = load i32, ptr @t, align 4, !tbaa !5
  %.pre93 = sext i32 %4 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre93, %.._crit_edge_crit_edge ], [ %23, %.lr.ph ]
  %5 = phi i32 [ %.pre, %.._crit_edge_crit_edge ], [ %20, %.lr.ph ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %6 = getelementptr inbounds [200001 x i32], ptr @tim, i64 0, i64 %.pre-phi
  %7 = load i32, ptr %6, align 4, !tbaa !5
  %8 = call noundef i32 @_Z5exgcdiiRiS_(i32 noundef %7, i32 noundef %5, ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %9 = load i32, ptr @t, align 4, !tbaa !5
  %10 = sdiv i32 %9, %8
  store i32 %10, ptr @t, align 4, !tbaa !5
  %11 = load i32, ptr %1, align 4, !tbaa !5
  %12 = icmp slt i32 %11, 0
  br i1 %12, label %24, label %26

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %13 = getelementptr inbounds i32, ptr @tim, i64 %indvars.iv
  %14 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %13)
  %15 = add nsw i64 %indvars.iv, -1
  %16 = getelementptr inbounds [200001 x i32], ptr @tim, i64 0, i64 %15
  %17 = load i32, ptr %16, align 4, !tbaa !5
  %18 = load i32, ptr %13, align 4, !tbaa !5
  %19 = add nsw i32 %18, %17
  %20 = load i32, ptr @t, align 4, !tbaa !5
  %21 = srem i32 %19, %20
  store i32 %21, ptr %13, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %22 = load i32, ptr @n, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %.not.not = icmp slt i64 %indvars.iv, %23
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !9

24:                                               ; preds = %._crit_edge
  %25 = add nsw i32 %11, %10
  store i32 %25, ptr %1, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %24, %._crit_edge
  %27 = load i32, ptr @n, align 4, !tbaa !5
  %.not5360 = icmp slt i32 %27, 1
  br i1 %.not5360, label %._crit_edge64, label %.lr.ph63.preheader

.lr.ph63.preheader:                               ; preds = %26
  %28 = zext nneg i32 %27 to i64
  %xtraiter = and i64 %28, 1
  %29 = icmp eq i32 %27, 1
  br i1 %29, label %._crit_edge64.loopexit.unr-lcssa, label %.lr.ph63.preheader.new

.lr.ph63.preheader.new:                           ; preds = %.lr.ph63.preheader
  %unroll_iter = and i64 %28, 2147483646
  br label %.lr.ph63

._crit_edge64.loopexit.unr-lcssa:                 ; preds = %.lr.ph63, %.lr.ph63.preheader
  %indvars.iv79.unr = phi i64 [ 1, %.lr.ph63.preheader ], [ %indvars.iv.next80.1, %.lr.ph63 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge64, label %.lr.ph63.epil

.lr.ph63.epil:                                    ; preds = %._crit_edge64.loopexit.unr-lcssa
  %30 = getelementptr inbounds [200001 x i32], ptr @ord, i64 0, i64 %indvars.iv79.unr
  %31 = trunc nuw nsw i64 %indvars.iv79.unr to i32
  store i32 %31, ptr %30, align 4, !tbaa !5
  %32 = getelementptr inbounds [200001 x i32], ptr @tim, i64 0, i64 %indvars.iv79.unr
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %34 = srem i32 %33, %8
  %35 = getelementptr inbounds [200001 x i32], ptr @ans, i64 0, i64 %indvars.iv79.unr
  store i32 %34, ptr %35, align 4, !tbaa !5
  br label %._crit_edge64

._crit_edge64:                                    ; preds = %.lr.ph63.epil, %._crit_edge64.loopexit.unr-lcssa, %26
  %36 = sext i32 %27 to i64
  %37 = getelementptr inbounds i32, ptr @ord, i64 %36
  %38 = getelementptr inbounds i8, ptr %37, i64 4
  call void @"_ZSt4sortIPiZ4mainE3$_0EvT_S2_T0_"(ptr noundef nonnull getelementptr inbounds (i8, ptr @ord, i64 4), ptr noundef nonnull %38)
  %39 = load i32, ptr @n, align 4, !tbaa !5
  %.not5470 = icmp slt i32 %39, 1
  br i1 %.not5470, label %._crit_edge77, label %.lr.ph73.preheader

.lr.ph73.preheader:                               ; preds = %._crit_edge64
  %.pre92 = load i32, ptr @t, align 4
  br label %.lr.ph73

.lr.ph63:                                         ; preds = %.lr.ph63, %.lr.ph63.preheader.new
  %indvars.iv79 = phi i64 [ 1, %.lr.ph63.preheader.new ], [ %indvars.iv.next80.1, %.lr.ph63 ]
  %niter = phi i64 [ 0, %.lr.ph63.preheader.new ], [ %niter.next.1, %.lr.ph63 ]
  %40 = getelementptr inbounds [200001 x i32], ptr @ord, i64 0, i64 %indvars.iv79
  %41 = trunc nuw nsw i64 %indvars.iv79 to i32
  store i32 %41, ptr %40, align 4, !tbaa !5
  %42 = getelementptr inbounds [200001 x i32], ptr @tim, i64 0, i64 %indvars.iv79
  %43 = load i32, ptr %42, align 4, !tbaa !5
  %44 = srem i32 %43, %8
  %45 = getelementptr inbounds [200001 x i32], ptr @ans, i64 0, i64 %indvars.iv79
  store i32 %44, ptr %45, align 4, !tbaa !5
  %indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
  %46 = getelementptr inbounds [200001 x i32], ptr @ord, i64 0, i64 %indvars.iv.next80
  %47 = trunc nuw nsw i64 %indvars.iv.next80 to i32
  store i32 %47, ptr %46, align 4, !tbaa !5
  %48 = getelementptr inbounds [200001 x i32], ptr @tim, i64 0, i64 %indvars.iv.next80
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = srem i32 %49, %8
  %51 = getelementptr inbounds [200001 x i32], ptr @ans, i64 0, i64 %indvars.iv.next80
  store i32 %50, ptr %51, align 4, !tbaa !5
  %indvars.iv.next80.1 = add nuw nsw i64 %indvars.iv79, 2
  %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_edge64.loopexit.unr-lcssa, label %.lr.ph63, !llvm.loop !11

.preheader:                                       ; preds = %._crit_edge69
  %.not5574 = icmp slt i32 %119, 1
  br i1 %.not5574, label %._crit_edge77, label %.lr.ph76

.lr.ph73:                                         ; preds = %.lr.ph73.preheader, %._crit_edge69
  %52 = phi i32 [ %108, %._crit_edge69 ], [ %.pre92, %.lr.ph73.preheader ]
  %53 = phi i32 [ %119, %._crit_edge69 ], [ %39, %.lr.ph73.preheader ]
  %.04571 = phi i32 [ %.1.lcssa, %._crit_edge69 ], [ 1, %.lr.ph73.preheader ]
  %54 = sext i32 %.04571 to i64
  %55 = getelementptr inbounds [200001 x i32], ptr @ord, i64 0, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [200001 x i32], ptr @ans, i64 0, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = load i32, ptr %1, align 4
  %61 = sext i32 %60 to i64
  %62 = sext i32 %52 to i64
  %63 = sext i32 %53 to i64
  %smax = call i32 @llvm.smax.i32(i32 %.04571, i32 %53)
  %64 = add i32 %smax, 1
  br label %65

65:                                               ; preds = %.lr.ph73, %72
  %indvars.iv82 = phi i64 [ %54, %.lr.ph73 ], [ %indvars.iv.next83, %72 ]
  %66 = getelementptr inbounds [200001 x i32], ptr @ord, i64 0, i64 %indvars.iv82
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [200001 x i32], ptr @ans, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = icmp eq i32 %59, %70
  br i1 %71, label %72, label %.critedge.split.loop.exit97

72:                                               ; preds = %65
  %73 = getelementptr inbounds [200001 x i32], ptr @tim, i64 0, i64 %68
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = sub nsw i32 %74, %59
  %76 = sdiv i32 %75, %8
  %77 = sext i32 %76 to i64
  %78 = mul nsw i64 %61, %77
  %79 = srem i64 %78, %62
  %80 = trunc nsw i64 %79 to i32
  store i32 %80, ptr %73, align 4, !tbaa !5
  %indvars.iv.next83 = add nsw i64 %indvars.iv82, 1
  %.not56.not = icmp slt i64 %indvars.iv82, %63
  br i1 %.not56.not, label %65, label %.critedge, !llvm.loop !12

.critedge.split.loop.exit97:                      ; preds = %65
  %81 = trunc nsw i64 %indvars.iv82 to i32
  br label %.critedge

.critedge:                                        ; preds = %72, %.critedge.split.loop.exit97
  %.1.lcssa = phi i32 [ %81, %.critedge.split.loop.exit97 ], [ %64, %72 ]
  %82 = sext i32 %.1.lcssa to i64
  %83 = getelementptr inbounds i32, ptr @ord, i64 %82
  call void @"_ZSt4sortIPiZ4mainE3$_1EvT_S2_T0_"(ptr noundef nonnull %55, ptr noundef nonnull %83)
  %84 = add nsw i32 %.04571, 1
  %85 = icmp slt i32 %84, %.1.lcssa
  br i1 %85, label %.lr.ph68.preheader, label %._crit_edge69

.lr.ph68.preheader:                               ; preds = %.critedge
  %86 = sext i32 %84 to i64
  %87 = add i32 %.1.lcssa, -2
  %88 = sub i32 %.04571, %.1.lcssa
  %89 = and i32 %88, 1
  %lcmp.mod106.not.not = icmp eq i32 %89, 0
  br i1 %lcmp.mod106.not.not, label %.lr.ph68.prol, label %.lr.ph68.prol.loopexit

.lr.ph68.prol:                                    ; preds = %.lr.ph68.preheader
  %90 = getelementptr inbounds [200001 x i32], ptr @ord, i64 0, i64 %86
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [200001 x i32], ptr @tim, i64 0, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !5
  %95 = sext i32 %.04571 to i64
  %96 = getelementptr inbounds [200001 x i32], ptr @ord, i64 0, i64 %95
  %97 = load i32, ptr %96, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [200001 x i32], ptr @tim, i64 0, i64 %98
  %100 = load i32, ptr %99, align 4, !tbaa !5
  %101 = sub nsw i32 %94, %100
  %102 = getelementptr inbounds [200001 x i32], ptr @ans, i64 0, i64 %98
  store i32 %101, ptr %102, align 4, !tbaa !5
  %indvars.iv.next86.prol = add nsw i64 %86, 1
  br label %.lr.ph68.prol.loopexit

.lr.ph68.prol.loopexit:                           ; preds = %.lr.ph68.prol, %.lr.ph68.preheader
  %indvars.iv85.unr = phi i64 [ %86, %.lr.ph68.preheader ], [ %indvars.iv.next86.prol, %.lr.ph68.prol ]
  %.04367.unr = phi i32 [ %.04571, %.lr.ph68.preheader ], [ %84, %.lr.ph68.prol ]
  %103 = icmp eq i32 %87, %.04571
  br i1 %103, label %._crit_edge69, label %.lr.ph68

._crit_edge69:                                    ; preds = %.lr.ph68.prol.loopexit, %.lr.ph68, %.critedge
  %104 = load i32, ptr %55, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [200001 x i32], ptr @tim, i64 0, i64 %105
  %107 = load i32, ptr %106, align 4, !tbaa !5
  %108 = load i32, ptr @t, align 4
  %109 = add nsw i32 %108, %107
  %110 = add nsw i32 %.1.lcssa, -1
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [200001 x i32], ptr @ord, i64 0, i64 %111
  %113 = load i32, ptr %112, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [200001 x i32], ptr @tim, i64 0, i64 %114
  %116 = load i32, ptr %115, align 4, !tbaa !5
  %117 = sub i32 %109, %116
  %118 = getelementptr inbounds [200001 x i32], ptr @ans, i64 0, i64 %114
  store i32 %117, ptr %118, align 4, !tbaa !5
  %119 = load i32, ptr @n, align 4, !tbaa !5
  %.not54 = icmp sgt i32 %.1.lcssa, %119
  br i1 %.not54, label %.preheader, label %.lr.ph73, !llvm.loop !13

.lr.ph68:                                         ; preds = %.lr.ph68.prol.loopexit, %.lr.ph68
  %indvars.iv85 = phi i64 [ %indvars.iv.next86.1, %.lr.ph68 ], [ %indvars.iv85.unr, %.lr.ph68.prol.loopexit ]
  %.04367 = phi i32 [ %146, %.lr.ph68 ], [ %.04367.unr, %.lr.ph68.prol.loopexit ]
  %120 = getelementptr inbounds [200001 x i32], ptr @ord, i64 0, i64 %indvars.iv85
  %121 = load i32, ptr %120, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [200001 x i32], ptr @tim, i64 0, i64 %122
  %124 = load i32, ptr %123, align 4, !tbaa !5
  %125 = sext i32 %.04367 to i64
  %126 = getelementptr inbounds [200001 x i32], ptr @ord, i64 0, i64 %125
  %127 = load i32, ptr %126, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [200001 x i32], ptr @tim, i64 0, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !5
  %131 = sub nsw i32 %124, %130
  %132 = getelementptr inbounds [200001 x i32], ptr @ans, i64 0, i64 %128
  store i32 %131, ptr %132, align 4, !tbaa !5
  %indvars.iv.next86 = add nsw i64 %indvars.iv85, 1
  %133 = getelementptr inbounds [200001 x i32], ptr @ord, i64 0, i64 %indvars.iv.next86
  %134 = load i32, ptr %133, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [200001 x i32], ptr @tim, i64 0, i64 %135
  %137 = load i32, ptr %136, align 4, !tbaa !5
  %sext = shl i64 %indvars.iv85, 32
  %138 = ashr exact i64 %sext, 32
  %139 = getelementptr inbounds [200001 x i32], ptr @ord, i64 0, i64 %138
  %140 = load i32, ptr %139, align 4, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [200001 x i32], ptr @tim, i64 0, i64 %141
  %143 = load i32, ptr %142, align 4, !tbaa !5
  %144 = sub nsw i32 %137, %143
  %145 = getelementptr inbounds [200001 x i32], ptr @ans, i64 0, i64 %141
  store i32 %144, ptr %145, align 4, !tbaa !5
  %indvars.iv.next86.1 = add nsw i64 %indvars.iv85, 2
  %146 = trunc nsw i64 %indvars.iv.next86 to i32
  %lftr.wideiv.1 = trunc i64 %indvars.iv.next86.1 to i32
  %exitcond88.not.1 = icmp eq i32 %.1.lcssa, %lftr.wideiv.1
  br i1 %exitcond88.not.1, label %._crit_edge69, label %.lr.ph68, !llvm.loop !14

._crit_edge77:                                    ; preds = %.lr.ph76, %._crit_edge64, %.preheader
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  ret i32 0

.lr.ph76:                                         ; preds = %.preheader, %.lr.ph76
  %indvars.iv89 = phi i64 [ %indvars.iv.next90, %.lr.ph76 ], [ 1, %.preheader ]
  %147 = phi i32 [ %157, %.lr.ph76 ], [ %119, %.preheader ]
  %148 = getelementptr inbounds [200001 x i32], ptr @ans, i64 0, i64 %indvars.iv89
  %149 = load i32, ptr %148, align 4, !tbaa !5
  %150 = zext i32 %147 to i64
  %151 = icmp eq i64 %indvars.iv89, %150
  %152 = zext i1 %151 to i64
  %153 = getelementptr inbounds [3 x i8], ptr @.str.3, i64 0, i64 %152
  %154 = load i8, ptr %153, align 1, !tbaa !15
  %155 = sext i8 %154 to i32
  %156 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %149, i32 noundef %155)
  %indvars.iv.next90 = add nuw nsw i64 %indvars.iv89, 1
  %157 = load i32, ptr @n, align 4, !tbaa !5
  %158 = sext i32 %157 to i64
  %.not55.not = icmp slt i64 %indvars.iv89, %158
  br i1 %.not55.not, label %.lr.ph76, label %._crit_edge77, !llvm.loop !16
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt4sortIPiZ4mainE3$_0EvT_S2_T0_"(ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt4sortIPiZ4mainE3$_1EvT_S2_T0_"(ptr noundef, 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 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 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = !{!7, !7, i64 0}
!16 = distinct !{!16, !10}


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