; LLVM IR from tangjz/acm-icpc :: lydsy (4050)

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

@out = external dso_local global [2 x ptr], align 16
@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@x = external dso_local global [1001 x i32], align 16
@y = external dso_local global [1001 x i32], align 16
@r = external dso_local global [1001 x i32], align 16
@fa = external dso_local global [1001 x i32], align 16
@dis = external dso_local global [1001 x i32], align 16
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [11 x i8], align 1

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z4findi(i32 noundef) #1

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca 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 i32, align 4
  store i32 0, ptr %1, align 4
  %10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef @t)
  br label %11

11:                                               ; preds = %194, %0
  %12 = load i32, ptr @t, align 4, !tbaa !5
  %13 = add nsw i32 %12, -1
  store i32 %13, ptr @t, align 4, !tbaa !5
  %14 = icmp ne i32 %12, 0
  br i1 %14, label %15, label %195

15:                                               ; preds = %11
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %17

17:                                               ; preds = %40, %15
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = load i32, ptr @n, align 4, !tbaa !5
  %20 = icmp slt 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 %43

22:                                               ; preds = %17
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds i32, ptr @x, i64 %24
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds i32, ptr @y, i64 %27
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds i32, ptr @r, i64 %30
  %32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef %25, ptr noundef %28, ptr noundef %31)
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = load i32, ptr %2, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [1001 x i32], ptr @fa, i64 0, i64 %35
  store i32 %33, ptr %36, align 4, !tbaa !5
  %37 = load i32, ptr %2, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [1001 x i32], ptr @dis, i64 0, i64 %38
  store i32 0, ptr %39, align 4, !tbaa !5
  br label %40

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

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

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

48:                                               ; preds = %44
  store i32 7, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %125

49:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %50 = load i32, ptr %3, align 4, !tbaa !5
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %5, align 4, !tbaa !5
  br label %52

52:                                               ; preds = %118, %49
  %53 = load i32, ptr %5, align 4, !tbaa !5
  %54 = load i32, ptr @n, align 4, !tbaa !5
  %55 = icmp slt i32 %53, %54
  br i1 %55, label %57, label %56

56:                                               ; preds = %52
  store i32 10, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %121

57:                                               ; preds = %52
  %58 = load i32, ptr %3, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [1001 x i32], ptr @x, i64 0, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = load i32, ptr %5, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [1001 x i32], ptr @x, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = sub nsw i32 %61, %65
  %67 = call noundef i32 @_Z3sqri(i32 noundef %66)
  %68 = load i32, ptr %3, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [1001 x i32], ptr @y, i64 0, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = load i32, ptr %5, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [1001 x i32], ptr @y, i64 0, i64 %73
  %75 = load i32, ptr %74, align 4, !tbaa !5
  %76 = sub nsw i32 %71, %75
  %77 = call noundef i32 @_Z3sqri(i32 noundef %76)
  %78 = add nsw i32 %67, %77
  %79 = load i32, ptr %3, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [1001 x i32], ptr @r, i64 0, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %83 = load i32, ptr %5, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [1001 x i32], ptr @r, i64 0, i64 %84
  %86 = load i32, ptr %85, align 4, !tbaa !5
  %87 = add nsw i32 %82, %86
  %88 = call noundef i32 @_Z3sqri(i32 noundef %87)
  %89 = icmp eq i32 %78, %88
  br i1 %89, label %90, label %117

90:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %91 = load i32, ptr %3, align 4, !tbaa !5
  %92 = call noundef i32 @_Z4findi(i32 noundef %91)
  store i32 %92, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %93 = load i32, ptr %5, align 4, !tbaa !5
  %94 = call noundef i32 @_Z4findi(i32 noundef %93)
  store i32 %94, ptr %7, align 4, !tbaa !5
  %95 = load i32, ptr %6, align 4, !tbaa !5
  %96 = load i32, ptr %7, align 4, !tbaa !5
  %97 = icmp ne i32 %95, %96
  br i1 %97, label %98, label %116

98:                                               ; preds = %90
  %99 = load i32, ptr %7, align 4, !tbaa !5
  %100 = load i32, ptr %6, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [1001 x i32], ptr @fa, i64 0, i64 %101
  store i32 %99, ptr %102, align 4, !tbaa !5
  %103 = load i32, ptr %3, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [1001 x i32], ptr @dis, i64 0, i64 %104
  %106 = load i32, ptr %105, align 4, !tbaa !5
  %107 = load i32, ptr %5, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [1001 x i32], ptr @dis, i64 0, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %111 = xor i32 %106, %110
  %112 = xor i32 %111, 1
  %113 = load i32, ptr %6, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [1001 x i32], ptr @dis, i64 0, i64 %114
  store i32 %112, ptr %115, align 4, !tbaa !5
  br label %116

116:                                              ; preds = %98, %90
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %117

117:                                              ; preds = %116, %57
  br label %118

118:                                              ; preds = %117
  %119 = load i32, ptr %5, align 4, !tbaa !5
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr %5, align 4, !tbaa !5
  br label %52, !llvm.loop !11

121:                                              ; preds = %56
  br label %122

122:                                              ; preds = %121
  %123 = load i32, ptr %3, align 4, !tbaa !5
  %124 = add nsw i32 %123, 1
  store i32 %124, ptr %3, align 4, !tbaa !5
  br label %44, !llvm.loop !12

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

126:                                              ; preds = %191, %125
  %127 = load i32, ptr %8, align 4, !tbaa !5
  %128 = load i32, ptr @n, align 4, !tbaa !5
  %129 = icmp slt i32 %127, %128
  br i1 %129, label %131, label %130

130:                                              ; preds = %126
  store i32 13, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %194

131:                                              ; preds = %126
  %132 = call noundef i32 @_Z4findi(i32 noundef 0)
  %133 = load i32, ptr %8, align 4, !tbaa !5
  %134 = call noundef i32 @_Z4findi(i32 noundef %133)
  %135 = icmp eq i32 %132, %134
  br i1 %135, label %136, label %188

136:                                              ; preds = %131
  %137 = load i32, ptr @r, align 16, !tbaa !5
  %138 = load i32, ptr %8, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [1001 x i32], ptr @r, i64 0, i64 %139
  %141 = load i32, ptr %140, align 4, !tbaa !5
  %142 = srem i32 %137, %141
  %143 = icmp eq i32 %142, 0
  br i1 %143, label %144, label %161

144:                                              ; preds = %136
  %145 = load i32, ptr @r, align 16, !tbaa !5
  %146 = load i32, ptr %8, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [1001 x i32], ptr @r, i64 0, i64 %147
  %149 = load i32, ptr %148, align 4, !tbaa !5
  %150 = sdiv i32 %145, %149
  %151 = load i32, ptr %8, align 4, !tbaa !5
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [1001 x i32], ptr @dis, i64 0, i64 %152
  %154 = load i32, ptr %153, align 4, !tbaa !5
  %155 = load i32, ptr @dis, align 16, !tbaa !5
  %156 = xor i32 %154, %155
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds [2 x ptr], ptr @out, i64 0, i64 %157
  %159 = load ptr, ptr %158, align 8, !tbaa !13
  %160 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %150, ptr noundef %159)
  br label %187

161:                                              ; preds = %136
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %162 = load i32, ptr @r, align 16, !tbaa !5
  %163 = load i32, ptr %8, align 4, !tbaa !5
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds [1001 x i32], ptr @r, i64 0, i64 %164
  %166 = load i32, ptr %165, align 4, !tbaa !5
  %167 = call noundef i32 @_ZSt5__gcdIiET_S0_S0_(i32 noundef %162, i32 noundef %166)
  store i32 %167, ptr %9, align 4, !tbaa !5
  %168 = load i32, ptr @r, align 16, !tbaa !5
  %169 = load i32, ptr %9, align 4, !tbaa !5
  %170 = sdiv i32 %168, %169
  %171 = load i32, ptr %8, align 4, !tbaa !5
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds [1001 x i32], ptr @r, i64 0, i64 %172
  %174 = load i32, ptr %173, align 4, !tbaa !5
  %175 = load i32, ptr %9, align 4, !tbaa !5
  %176 = sdiv i32 %174, %175
  %177 = load i32, ptr %8, align 4, !tbaa !5
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds [1001 x i32], ptr @dis, i64 0, i64 %178
  %180 = load i32, ptr %179, align 4, !tbaa !5
  %181 = load i32, ptr @dis, align 16, !tbaa !5
  %182 = xor i32 %180, %181
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds [2 x ptr], ptr @out, i64 0, i64 %183
  %185 = load ptr, ptr %184, align 8, !tbaa !13
  %186 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %170, i32 noundef %176, ptr noundef %185)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %187

187:                                              ; preds = %161, %144
  br label %190

188:                                              ; preds = %131
  %189 = call i32 @puts(ptr noundef @.str.6)
  br label %190

190:                                              ; preds = %188, %187
  br label %191

191:                                              ; preds = %190
  %192 = load i32, ptr %8, align 4, !tbaa !5
  %193 = add nsw i32 %192, 1
  store i32 %193, ptr %8, align 4, !tbaa !5
  br label %126, !llvm.loop !15

194:                                              ; preds = %130
  br label %11, !llvm.loop !16

195:                                              ; preds = %11
  ret i32 0
}

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

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

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

declare i32 @puts(ptr noundef) #4

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

@out = external dso_local local_unnamed_addr global [2 x ptr], align 16
@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@x = external dso_local global [1001 x i32], align 16
@y = external dso_local global [1001 x i32], align 16
@r = external dso_local global [1001 x i32], align 16
@fa = external dso_local local_unnamed_addr global [1001 x i32], align 16
@dis = external dso_local local_unnamed_addr global [1001 x i32], align 16
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [11 x i8], align 1

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z4findi(i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull @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
  %.not54 = icmp eq i32 %2, 0
  br i1 %.not54, label %._crit_edge, label %.lr.ph55

.loopexit45:                                      ; preds = %102, %.lr.ph55, %.preheader46, %.preheader
  %4 = load i32, ptr @t, align 4, !tbaa !5
  %5 = add nsw i32 %4, -1
  store i32 %5, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %4, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph55, !llvm.loop !9

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

.preheader46:                                     ; preds = %.lr.ph
  %9 = icmp sgt i32 %17, 0
  br i1 %9, label %.lr.ph51, label %.loopexit45

.lr.ph:                                           ; preds = %.lr.ph55, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph55 ]
  %10 = getelementptr inbounds i32, ptr @x, i64 %indvars.iv
  %11 = getelementptr inbounds i32, ptr @y, i64 %indvars.iv
  %12 = getelementptr inbounds i32, ptr @r, i64 %indvars.iv
  %13 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %10, ptr noundef nonnull %11, ptr noundef nonnull %12)
  %14 = getelementptr inbounds [1001 x i32], ptr @fa, i64 0, i64 %indvars.iv
  %15 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %15, ptr %14, align 4, !tbaa !5
  %16 = getelementptr inbounds [1001 x i32], ptr @dis, i64 0, i64 %indvars.iv
  store i32 0, ptr %16, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %17 = load i32, ptr @n, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = icmp slt i64 %indvars.iv.next, %18
  br i1 %19, label %.lr.ph, label %.preheader46, !llvm.loop !11

.loopexit.loopexit:                               ; preds = %62
  %.pre = sext i32 %63 to i64
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit, %.lr.ph51
  %.pre-phi = phi i64 [ %.pre, %.loopexit.loopexit ], [ %24, %.lr.ph51 ]
  %20 = phi i32 [ %63, %.loopexit.loopexit ], [ %23, %.lr.ph51 ]
  %21 = icmp slt i64 %indvars.iv.next63, %.pre-phi
  %indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
  br i1 %21, label %.lr.ph51, label %.preheader, !llvm.loop !12

.preheader:                                       ; preds = %.loopexit
  %22 = icmp sgt i32 %20, 0
  br i1 %22, label %.lr.ph53, label %.loopexit45

.lr.ph51:                                         ; preds = %.preheader46, %.loopexit
  %23 = phi i32 [ %20, %.loopexit ], [ %17, %.preheader46 ]
  %indvars.iv62 = phi i64 [ %indvars.iv.next63, %.loopexit ], [ 0, %.preheader46 ]
  %indvars.iv57 = phi i64 [ %indvars.iv.next58, %.loopexit ], [ 1, %.preheader46 ]
  %indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
  %24 = sext i32 %23 to i64
  %25 = icmp slt i64 %indvars.iv.next63, %24
  br i1 %25, label %.lr.ph49, label %.loopexit

.lr.ph49:                                         ; preds = %.lr.ph51
  %26 = getelementptr inbounds [1001 x i32], ptr @x, i64 0, i64 %indvars.iv62
  %27 = getelementptr inbounds [1001 x i32], ptr @y, i64 0, i64 %indvars.iv62
  %28 = getelementptr inbounds [1001 x i32], ptr @r, i64 0, i64 %indvars.iv62
  %29 = getelementptr inbounds [1001 x i32], ptr @dis, i64 0, i64 %indvars.iv62
  %30 = trunc nuw nsw i64 %indvars.iv62 to i32
  br label %31

31:                                               ; preds = %.lr.ph49, %62
  %indvars.iv59 = phi i64 [ %indvars.iv57, %.lr.ph49 ], [ %indvars.iv.next60, %62 ]
  %32 = load i32, ptr %26, align 4, !tbaa !5
  %33 = getelementptr inbounds [1001 x i32], ptr @x, i64 0, i64 %indvars.iv59
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = sub nsw i32 %32, %34
  %36 = tail call noundef i32 @_Z3sqri(i32 noundef %35)
  %37 = load i32, ptr %27, align 4, !tbaa !5
  %38 = getelementptr inbounds [1001 x i32], ptr @y, i64 0, i64 %indvars.iv59
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = sub nsw i32 %37, %39
  %41 = tail call noundef i32 @_Z3sqri(i32 noundef %40)
  %42 = add nsw i32 %41, %36
  %43 = load i32, ptr %28, align 4, !tbaa !5
  %44 = getelementptr inbounds [1001 x i32], ptr @r, i64 0, i64 %indvars.iv59
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = add nsw i32 %45, %43
  %47 = tail call noundef i32 @_Z3sqri(i32 noundef %46)
  %48 = icmp eq i32 %42, %47
  br i1 %48, label %49, label %62

49:                                               ; preds = %31
  %50 = tail call noundef i32 @_Z4findi(i32 noundef %30)
  %51 = trunc nuw nsw i64 %indvars.iv59 to i32
  %52 = tail call noundef i32 @_Z4findi(i32 noundef %51)
  %.not44 = icmp eq i32 %50, %52
  br i1 %.not44, label %62, label %53

53:                                               ; preds = %49
  %54 = sext i32 %50 to i64
  %55 = getelementptr inbounds [1001 x i32], ptr @fa, i64 0, i64 %54
  store i32 %52, ptr %55, align 4, !tbaa !5
  %56 = load i32, ptr %29, align 4, !tbaa !5
  %57 = getelementptr inbounds [1001 x i32], ptr @dis, i64 0, i64 %indvars.iv59
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = xor i32 %56, %58
  %60 = xor i32 %59, 1
  %61 = getelementptr inbounds [1001 x i32], ptr @dis, i64 0, i64 %54
  store i32 %60, ptr %61, align 4, !tbaa !5
  br label %62

62:                                               ; preds = %49, %53, %31
  %indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
  %63 = load i32, ptr @n, align 4, !tbaa !5
  %64 = trunc nuw i64 %indvars.iv.next60 to i32
  %65 = icmp sgt i32 %63, %64
  br i1 %65, label %31, label %.loopexit.loopexit, !llvm.loop !13

.lr.ph53:                                         ; preds = %.preheader, %102
  %indvars.iv65 = phi i64 [ %indvars.iv.next66, %102 ], [ 0, %.preheader ]
  %66 = tail call noundef i32 @_Z4findi(i32 noundef 0)
  %67 = trunc nuw nsw i64 %indvars.iv65 to i32
  %68 = tail call noundef i32 @_Z4findi(i32 noundef %67)
  %69 = icmp eq i32 %66, %68
  br i1 %69, label %70, label %100

70:                                               ; preds = %.lr.ph53
  %71 = load i32, ptr @r, align 16, !tbaa !5
  %72 = getelementptr inbounds [1001 x i32], ptr @r, i64 0, i64 %indvars.iv65
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = srem i32 %71, %73
  %75 = sdiv i32 %71, %73
  %76 = icmp eq i32 %74, 0
  br i1 %76, label %77, label %86

77:                                               ; preds = %70
  %78 = getelementptr inbounds [1001 x i32], ptr @dis, i64 0, i64 %indvars.iv65
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = load i32, ptr @dis, align 16, !tbaa !5
  %81 = xor i32 %80, %79
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [2 x ptr], ptr @out, i64 0, i64 %82
  %84 = load ptr, ptr %83, align 8, !tbaa !14
  %85 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %75, ptr noundef %84)
  br label %102

86:                                               ; preds = %70
  %87 = tail call noundef i32 @_ZSt5__gcdIiET_S0_S0_(i32 noundef %71, i32 noundef %73)
  %88 = load i32, ptr @r, align 16, !tbaa !5
  %89 = sdiv i32 %88, %87
  %90 = load i32, ptr %72, align 4, !tbaa !5
  %91 = sdiv i32 %90, %87
  %92 = getelementptr inbounds [1001 x i32], ptr @dis, i64 0, i64 %indvars.iv65
  %93 = load i32, ptr %92, align 4, !tbaa !5
  %94 = load i32, ptr @dis, align 16, !tbaa !5
  %95 = xor i32 %94, %93
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [2 x ptr], ptr @out, i64 0, i64 %96
  %98 = load ptr, ptr %97, align 8, !tbaa !14
  %99 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %89, i32 noundef %91, ptr noundef %98)
  br label %102

100:                                              ; preds = %.lr.ph53
  %101 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.6)
  br label %102

102:                                              ; preds = %100, %86, %77
  %indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, 1
  %103 = load i32, ptr @n, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = icmp slt i64 %indvars.iv.next66, %104
  br i1 %105, label %.lr.ph53, label %.loopexit45, !llvm.loop !16

._crit_edge:                                      ; preds = %.loopexit45, %0
  ret i32 0
}

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

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @puts(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 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 = { 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 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = !{!15, !15, i64 0}
!15 = !{!"any pointer", !7, i64 0}
!16 = distinct !{!16, !10}


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