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

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

@a = external dso_local global i32, align 4
@b = external dso_local global i32, align 4
@c = external dso_local global i32, align 4
@x1 = external dso_local global i32, align 4
@x2 = external dso_local global i32, align 4
@y1 = external dso_local global i32, align 4
@y2 = external dso_local global i32, align 4
@x = external dso_local global i32, align 4
@y = external dso_local global i32, align 4
@r = external dso_local global i32, align 4
@tl = external dso_local global i64, align 8
@tr = external dso_local global i64, align 8
@.str = external hidden unnamed_addr constant [15 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 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 nounwind uwtable
declare dso_local void @_Z5checkxxi(i64 noundef, i64 noundef, i32 noundef) #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
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  br label %12

12:                                               ; preds = %202, %0
  %13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @a, ptr noundef @b, ptr noundef @c, ptr noundef @x1, ptr noundef @x2, ptr noundef @y1, ptr noundef @y2)
  %14 = icmp eq i32 %13, 7
  br i1 %14, label %15, label %203

15:                                               ; preds = %12
  %16 = load i32, ptr @a, align 4, !tbaa !5
  %17 = icmp slt i32 %16, 0
  br i1 %17, label %18, label %25

18:                                               ; preds = %15
  %19 = load i32, ptr @a, align 4, !tbaa !5
  %20 = sub nsw i32 0, %19
  store i32 %20, ptr @a, align 4, !tbaa !5
  %21 = load i32, ptr @x1, align 4, !tbaa !5
  %22 = sub nsw i32 0, %21
  store i32 %22, ptr @x1, align 4, !tbaa !5
  %23 = load i32, ptr @x2, align 4, !tbaa !5
  %24 = sub nsw i32 0, %23
  store i32 %24, ptr @x2, align 4, !tbaa !5
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) @x1, ptr noundef nonnull align 4 dereferenceable(4) @x2) #6
  br label %25

25:                                               ; preds = %18, %15
  %26 = load i32, ptr @b, align 4, !tbaa !5
  %27 = icmp slt i32 %26, 0
  br i1 %27, label %28, label %35

28:                                               ; preds = %25
  %29 = load i32, ptr @b, align 4, !tbaa !5
  %30 = sub nsw i32 0, %29
  store i32 %30, ptr @b, align 4, !tbaa !5
  %31 = load i32, ptr @y1, align 4, !tbaa !5
  %32 = sub nsw i32 0, %31
  store i32 %32, ptr @y1, align 4, !tbaa !5
  %33 = load i32, ptr @y2, align 4, !tbaa !5
  %34 = sub nsw i32 0, %33
  store i32 %34, ptr @y2, align 4, !tbaa !5
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) @y1, ptr noundef nonnull align 4 dereferenceable(4) @y2) #6
  br label %35

35:                                               ; preds = %28, %25
  %36 = load i32, ptr @a, align 4, !tbaa !5
  %37 = icmp ne i32 %36, 0
  br i1 %37, label %64, label %38

38:                                               ; preds = %35
  %39 = load i32, ptr @b, align 4, !tbaa !5
  %40 = icmp ne i32 %39, 0
  br i1 %40, label %64, label %41

41:                                               ; preds = %38
  %42 = load i32, ptr @c, align 4, !tbaa !5
  %43 = icmp ne i32 %42, 0
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  br i1 %43, label %44, label %45

44:                                               ; preds = %41
  br label %61

45:                                               ; preds = %41
  %46 = load i32, ptr @x2, align 4, !tbaa !5
  %47 = load i32, ptr @x1, align 4, !tbaa !5
  %48 = sub nsw i32 %46, %47
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %2, align 4, !tbaa !5
  store i32 0, ptr %3, align 4, !tbaa !5
  %50 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = load i32, ptr @y2, align 4, !tbaa !5
  %54 = load i32, ptr @y1, align 4, !tbaa !5
  %55 = sub nsw i32 %53, %54
  %56 = add nsw i32 %55, 1
  store i32 %56, ptr %4, align 4, !tbaa !5
  store i32 0, ptr %5, align 4, !tbaa !5
  %57 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = mul nsw i64 %52, %59
  br label %61

61:                                               ; preds = %45, %44
  %62 = phi i64 [ 0, %44 ], [ %60, %45 ]
  %63 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i64 noundef %62)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %202

64:                                               ; preds = %38, %35
  %65 = load i32, ptr @a, align 4, !tbaa !5
  %66 = icmp ne i32 %65, 0
  br i1 %66, label %97, label %67

67:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %68 = load i32, ptr @x2, align 4, !tbaa !5
  %69 = load i32, ptr @x1, align 4, !tbaa !5
  %70 = sub nsw i32 %68, %69
  %71 = add nsw i32 %70, 1
  store i32 %71, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !5
  %72 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = load i32, ptr @c, align 4, !tbaa !5
  %75 = load i32, ptr @b, align 4, !tbaa !5
  %76 = srem i32 %74, %75
  %77 = icmp eq i32 %76, 0
  br i1 %77, label %78, label %92

78:                                               ; preds = %67
  %79 = load i32, ptr @y1, align 4, !tbaa !5
  %80 = load i32, ptr @c, align 4, !tbaa !5
  %81 = sub nsw i32 0, %80
  %82 = load i32, ptr @b, align 4, !tbaa !5
  %83 = sdiv i32 %81, %82
  %84 = icmp sle i32 %79, %83
  br i1 %84, label %85, label %92

85:                                               ; preds = %78
  %86 = load i32, ptr @c, align 4, !tbaa !5
  %87 = sub nsw i32 0, %86
  %88 = load i32, ptr @b, align 4, !tbaa !5
  %89 = sdiv i32 %87, %88
  %90 = load i32, ptr @y2, align 4, !tbaa !5
  %91 = icmp sle i32 %89, %90
  br label %92

92:                                               ; preds = %85, %78, %67
  %93 = phi i1 [ false, %78 ], [ false, %67 ], [ %91, %85 ]
  %94 = zext i1 %93 to i32
  %95 = mul nsw i32 %73, %94
  %96 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %95)
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %201

97:                                               ; preds = %64
  %98 = load i32, ptr @b, align 4, !tbaa !5
  %99 = icmp ne i32 %98, 0
  br i1 %99, label %130, label %100

100:                                              ; preds = %97
  %101 = load i32, ptr @c, align 4, !tbaa !5
  %102 = load i32, ptr @a, align 4, !tbaa !5
  %103 = srem i32 %101, %102
  %104 = icmp eq i32 %103, 0
  br i1 %104, label %105, label %119

105:                                              ; preds = %100
  %106 = load i32, ptr @x1, align 4, !tbaa !5
  %107 = load i32, ptr @c, align 4, !tbaa !5
  %108 = sub nsw i32 0, %107
  %109 = load i32, ptr @a, align 4, !tbaa !5
  %110 = sdiv i32 %108, %109
  %111 = icmp sle i32 %106, %110
  br i1 %111, label %112, label %119

112:                                              ; preds = %105
  %113 = load i32, ptr @c, align 4, !tbaa !5
  %114 = sub nsw i32 0, %113
  %115 = load i32, ptr @a, align 4, !tbaa !5
  %116 = sdiv i32 %114, %115
  %117 = load i32, ptr @x2, align 4, !tbaa !5
  %118 = icmp sle i32 %116, %117
  br label %119

119:                                              ; preds = %112, %105, %100
  %120 = phi i1 [ false, %105 ], [ false, %100 ], [ %118, %112 ]
  %121 = zext i1 %120 to i32
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %122 = load i32, ptr @y2, align 4, !tbaa !5
  %123 = load i32, ptr @y1, align 4, !tbaa !5
  %124 = sub nsw i32 %122, %123
  %125 = add nsw i32 %124, 1
  store i32 %125, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  %126 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %127 = load i32, ptr %126, align 4, !tbaa !5
  %128 = mul nsw i32 %121, %127
  %129 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %128)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %200

130:                                              ; preds = %97
  %131 = load i32, ptr @a, align 4, !tbaa !5
  %132 = load i32, ptr @b, align 4, !tbaa !5
  %133 = call noundef i32 @_Z5exgcdiiRiS_(i32 noundef %131, i32 noundef %132, ptr noundef nonnull align 4 dereferenceable(4) @x, ptr noundef nonnull align 4 dereferenceable(4) @y)
  store i32 %133, ptr @r, align 4, !tbaa !5
  %134 = load i32, ptr @c, align 4, !tbaa !5
  %135 = load i32, ptr @r, align 4, !tbaa !5
  %136 = srem i32 %134, %135
  %137 = icmp ne i32 %136, 0
  br i1 %137, label %138, label %140

138:                                              ; preds = %130
  %139 = call i32 @puts(ptr noundef @.str.3)
  br label %199

140:                                              ; preds = %130
  store i64 -4557430888798830399, ptr @tl, align 8, !tbaa !9
  store i64 4557430888798830399, ptr @tr, align 8, !tbaa !9
  %141 = load i32, ptr @x1, align 4, !tbaa !5
  %142 = sext i32 %141 to i64
  %143 = load i32, ptr @x, align 4, !tbaa !5
  %144 = sext i32 %143 to i64
  %145 = load i32, ptr @c, align 4, !tbaa !5
  %146 = sub nsw i32 0, %145
  %147 = load i32, ptr @r, align 4, !tbaa !5
  %148 = sdiv i32 %146, %147
  %149 = sext i32 %148 to i64
  %150 = mul nsw i64 %144, %149
  %151 = sub nsw i64 %142, %150
  %152 = load i32, ptr @x2, align 4, !tbaa !5
  %153 = sext i32 %152 to i64
  %154 = load i32, ptr @x, align 4, !tbaa !5
  %155 = sext i32 %154 to i64
  %156 = load i32, ptr @c, align 4, !tbaa !5
  %157 = sub nsw i32 0, %156
  %158 = load i32, ptr @r, align 4, !tbaa !5
  %159 = sdiv i32 %157, %158
  %160 = sext i32 %159 to i64
  %161 = mul nsw i64 %155, %160
  %162 = sub nsw i64 %153, %161
  %163 = load i32, ptr @b, align 4, !tbaa !5
  %164 = load i32, ptr @r, align 4, !tbaa !5
  %165 = sdiv i32 %163, %164
  call void @_Z5checkxxi(i64 noundef %151, i64 noundef %162, i32 noundef %165)
  %166 = load i32, ptr @y1, align 4, !tbaa !5
  %167 = sext i32 %166 to i64
  %168 = load i32, ptr @y, align 4, !tbaa !5
  %169 = sext i32 %168 to i64
  %170 = load i32, ptr @c, align 4, !tbaa !5
  %171 = sub nsw i32 0, %170
  %172 = load i32, ptr @r, align 4, !tbaa !5
  %173 = sdiv i32 %171, %172
  %174 = sext i32 %173 to i64
  %175 = mul nsw i64 %169, %174
  %176 = sub nsw i64 %167, %175
  %177 = load i32, ptr @y2, align 4, !tbaa !5
  %178 = sext i32 %177 to i64
  %179 = load i32, ptr @y, align 4, !tbaa !5
  %180 = sext i32 %179 to i64
  %181 = load i32, ptr @c, align 4, !tbaa !5
  %182 = sub nsw i32 0, %181
  %183 = load i32, ptr @r, align 4, !tbaa !5
  %184 = sdiv i32 %182, %183
  %185 = sext i32 %184 to i64
  %186 = mul nsw i64 %180, %185
  %187 = sub nsw i64 %178, %186
  %188 = load i32, ptr @a, align 4, !tbaa !5
  %189 = sub nsw i32 0, %188
  %190 = load i32, ptr @r, align 4, !tbaa !5
  %191 = sdiv i32 %189, %190
  call void @_Z5checkxxi(i64 noundef %176, i64 noundef %187, i32 noundef %191)
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %192 = load i64, ptr @tr, align 8, !tbaa !9
  %193 = load i64, ptr @tl, align 8, !tbaa !9
  %194 = sub nsw i64 %192, %193
  %195 = add nsw i64 %194, 1
  store i64 %195, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  store i64 0, ptr %11, align 8, !tbaa !9
  %196 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %11)
  %197 = load i64, ptr %196, align 8, !tbaa !9
  %198 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i64 noundef %197)
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %199

199:                                              ; preds = %140, %138
  br label %200

200:                                              ; preds = %199, %119
  br label %201

201:                                              ; preds = %200, %92
  br label %202

202:                                              ; preds = %201, %61
  br label %12, !llvm.loop !11

203:                                              ; preds = %12
  ret i32 0
}

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #5

declare i32 @puts(ptr noundef) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { inlinehint mustprogress 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 #6 = { nounwind }

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

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


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

@a = external dso_local global i32, align 4
@b = external dso_local global i32, align 4
@c = external dso_local global i32, align 4
@x1 = external dso_local global i32, align 4
@x2 = external dso_local global i32, align 4
@y1 = external dso_local global i32, align 4
@y2 = external dso_local global i32, align 4
@x = external dso_local global i32, align 4
@y = external dso_local global i32, align 4
@r = external dso_local local_unnamed_addr global i32, align 4
@tl = external dso_local local_unnamed_addr global i64, align 8
@tr = external dso_local local_unnamed_addr global i64, align 8
@.str = external hidden unnamed_addr constant [15 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 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 nounwind uwtable
declare dso_local void @_Z5checkxxi(i64 noundef, i64 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = alloca i32, align 4
  %2 = alloca 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 i64, align 8
  %10 = alloca i64, align 8
  %11 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @a, ptr noundef nonnull @b, ptr noundef nonnull @c, ptr noundef nonnull @x1, ptr noundef nonnull @x2, ptr noundef nonnull @y1, ptr noundef nonnull @y2)
  %12 = icmp eq i32 %11, 7
  br i1 %12, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %0, %143
  %13 = load i32, ptr @a, align 4, !tbaa !5
  %14 = icmp slt i32 %13, 0
  br i1 %14, label %15, label %21

15:                                               ; preds = %.lr.ph
  %16 = sub nsw i32 0, %13
  store i32 %16, ptr @a, align 4, !tbaa !5
  %17 = load i32, ptr @x1, align 4, !tbaa !5
  %18 = sub nsw i32 0, %17
  store i32 %18, ptr @x1, align 4, !tbaa !5
  %19 = load i32, ptr @x2, align 4, !tbaa !5
  %20 = sub nsw i32 0, %19
  store i32 %20, ptr @x2, align 4, !tbaa !5
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) @x1, ptr noundef nonnull align 4 dereferenceable(4) @x2) #6
  br label %21

21:                                               ; preds = %15, %.lr.ph
  %22 = load i32, ptr @b, align 4
  %23 = icmp slt i32 %22, 0
  br i1 %23, label %24, label %30

24:                                               ; preds = %21
  %25 = sub nsw i32 0, %22
  store i32 %25, ptr @b, align 4, !tbaa !5
  %26 = load i32, ptr @y1, align 4, !tbaa !5
  %27 = sub nsw i32 0, %26
  store i32 %27, ptr @y1, align 4, !tbaa !5
  %28 = load i32, ptr @y2, align 4, !tbaa !5
  %29 = sub nsw i32 0, %28
  store i32 %29, ptr @y2, align 4, !tbaa !5
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) @y1, ptr noundef nonnull align 4 dereferenceable(4) @y2) #6
  %.pr = load i32, ptr @b, align 4
  br label %30

30:                                               ; preds = %24, %21
  %31 = phi i32 [ %.pr, %24 ], [ %22, %21 ]
  %32 = load i32, ptr @a, align 4, !tbaa !5
  %33 = icmp ne i32 %32, 0
  %34 = icmp ne i32 %31, 0
  %or.cond = select i1 %33, i1 true, i1 %34
  br i1 %or.cond, label %56, label %35

35:                                               ; preds = %30
  %36 = load i32, ptr @c, align 4, !tbaa !5
  %.not = icmp eq i32 %36, 0
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  br i1 %.not, label %37, label %53

37:                                               ; preds = %35
  %38 = load i32, ptr @x2, align 4, !tbaa !5
  %39 = load i32, ptr @x1, align 4, !tbaa !5
  %40 = add i32 %38, 1
  %41 = sub i32 %40, %39
  store i32 %41, ptr %1, align 4, !tbaa !5
  store i32 0, ptr %2, align 4, !tbaa !5
  %42 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %43 = load i32, ptr %42, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = load i32, ptr @y2, align 4, !tbaa !5
  %46 = load i32, ptr @y1, align 4, !tbaa !5
  %47 = add i32 %45, 1
  %48 = sub i32 %47, %46
  store i32 %48, ptr %3, align 4, !tbaa !5
  store i32 0, ptr %4, align 4, !tbaa !5
  %49 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = mul nsw i64 %51, %44
  br label %53

53:                                               ; preds = %35, %37
  %54 = phi i64 [ %52, %37 ], [ 0, %35 ]
  %55 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %54)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  br label %143

56:                                               ; preds = %30
  br i1 %33, label %77, label %57

57:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  %58 = load i32, ptr @x2, align 4, !tbaa !5
  %59 = load i32, ptr @x1, align 4, !tbaa !5
  %60 = add i32 %58, 1
  %61 = sub i32 %60, %59
  store i32 %61, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #6
  store i32 0, ptr %6, align 4, !tbaa !5
  %62 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = load i32, ptr @c, align 4, !tbaa !5
  %65 = load i32, ptr @b, align 4, !tbaa !5
  %66 = srem i32 %64, %65
  %67 = sdiv i32 %64, %65
  %68 = icmp eq i32 %66, 0
  br i1 %68, label %69, label %.thread

69:                                               ; preds = %57
  %70 = load i32, ptr @y1, align 4, !tbaa !5
  %71 = sub nsw i32 0, %67
  %.not7 = icmp sgt i32 %70, %71
  br i1 %.not7, label %.thread, label %72

72:                                               ; preds = %69
  %73 = load i32, ptr @y2, align 4, !tbaa !5
  %74 = icmp sge i32 %73, %71
  %cond.fr = freeze i1 %74
  %spec.select = select i1 %cond.fr, i32 %63, i32 0
  br label %.thread

.thread:                                          ; preds = %72, %57, %69
  %75 = phi i32 [ 0, %69 ], [ 0, %57 ], [ %spec.select, %72 ]
  %76 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %75)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  br label %143

77:                                               ; preds = %56
  br i1 %34, label %98, label %78

78:                                               ; preds = %77
  %79 = load i32, ptr @c, align 4, !tbaa !5
  %80 = srem i32 %79, %32
  %81 = sdiv i32 %79, %32
  %82 = icmp eq i32 %80, 0
  br i1 %82, label %83, label %89

83:                                               ; preds = %78
  %84 = load i32, ptr @x1, align 4, !tbaa !5
  %85 = sub nsw i32 0, %81
  %.not8 = icmp sgt i32 %84, %85
  br i1 %.not8, label %89, label %86

86:                                               ; preds = %83
  %87 = load i32, ptr @x2, align 4, !tbaa !5
  %88 = icmp sge i32 %87, %85
  br label %89

89:                                               ; preds = %86, %83, %78
  %90 = phi i1 [ false, %83 ], [ false, %78 ], [ %88, %86 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #6
  %91 = load i32, ptr @y2, align 4, !tbaa !5
  %92 = load i32, ptr @y1, align 4, !tbaa !5
  %93 = add i32 %91, 1
  %94 = sub i32 %93, %92
  store i32 %94, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #6
  store i32 0, ptr %8, align 4, !tbaa !5
  %95 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %cond.fr11 = freeze i1 %90
  %spec.select12 = select i1 %cond.fr11, i32 %96, i32 0
  %97 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %spec.select12)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #6
  br label %143

98:                                               ; preds = %77
  %99 = call noundef i32 @_Z5exgcdiiRiS_(i32 noundef %32, i32 noundef %31, ptr noundef nonnull align 4 dereferenceable(4) @x, ptr noundef nonnull align 4 dereferenceable(4) @y)
  store i32 %99, ptr @r, align 4, !tbaa !5
  %100 = load i32, ptr @c, align 4, !tbaa !5
  %101 = srem i32 %100, %99
  %102 = sdiv i32 %100, %99
  %.not9 = icmp eq i32 %101, 0
  br i1 %.not9, label %105, label %103

103:                                              ; preds = %98
  %104 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.3)
  br label %143

105:                                              ; preds = %98
  store i64 -4557430888798830399, ptr @tl, align 8, !tbaa !9
  store i64 4557430888798830399, ptr @tr, align 8, !tbaa !9
  %106 = load i32, ptr @x1, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = load i32, ptr @x, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = sub nsw i32 0, %102
  %111 = sext i32 %110 to i64
  %112 = mul nsw i64 %111, %109
  %113 = sub nsw i64 %107, %112
  %114 = load i32, ptr @x2, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = sub nsw i64 %115, %112
  %117 = load i32, ptr @b, align 4, !tbaa !5
  %118 = sdiv i32 %117, %99
  call void @_Z5checkxxi(i64 noundef %113, i64 noundef %116, i32 noundef %118)
  %119 = load i32, ptr @y1, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = load i32, ptr @y, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = load i32, ptr @c, align 4, !tbaa !5
  %124 = load i32, ptr @r, align 4, !tbaa !5
  %125 = sdiv i32 %123, %124
  %126 = sub nsw i32 0, %125
  %127 = sext i32 %126 to i64
  %128 = mul nsw i64 %127, %122
  %129 = sub nsw i64 %120, %128
  %130 = load i32, ptr @y2, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = sub nsw i64 %131, %128
  %133 = load i32, ptr @a, align 4, !tbaa !5
  %134 = sdiv i32 %133, %124
  %135 = sub nsw i32 0, %134
  call void @_Z5checkxxi(i64 noundef %129, i64 noundef %132, i32 noundef %135)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #6
  %136 = load i64, ptr @tr, align 8, !tbaa !9
  %137 = load i64, ptr @tl, align 8, !tbaa !9
  %138 = add i64 %136, 1
  %139 = sub i64 %138, %137
  store i64 %139, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #6
  store i64 0, ptr %10, align 8, !tbaa !9
  %140 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10)
  %141 = load i64, ptr %140, align 8, !tbaa !9
  %142 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %141)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #6
  br label %143

143:                                              ; preds = %.thread, %103, %105, %89, %53
  %144 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @a, ptr noundef nonnull @b, ptr noundef nonnull @c, ptr noundef nonnull @x1, ptr noundef nonnull @x2, ptr noundef nonnull @y1, ptr noundef nonnull @y2)
  %145 = icmp eq i32 %144, 7
  br i1 %145, label %.lr.ph, label %._crit_edge, !llvm.loop !11

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #5

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #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 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 #3 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { inlinehint mustprogress 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 #6 = { nounwind }

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

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


; Effective O3 passes: DivRemPairsPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass