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

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

@color = external dso_local global ptr, align 8
@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@cnt = external dso_local global [2 x i32], align 4
@seq = external dso_local global [100001 x [2 x i32]], align 16
@sum = external dso_local global [2 x i32], align 4
@ans = external dso_local global i32, align 4
@.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 [4 x i8], align 1

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

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

16:                                               ; preds = %12
  %17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @n)
  store i32 0, ptr getelementptr inbounds ([2 x i32], ptr @cnt, i64 0, i64 1), align 4, !tbaa !5
  store i32 0, ptr @cnt, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %18

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

22:                                               ; preds = %18
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  br label %52

23:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 2, ptr %5) #4
  %24 = getelementptr inbounds [2 x i8], ptr %5, i64 0, i64 0
  %25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %4, ptr noundef %24)
  %26 = getelementptr inbounds [2 x i8], ptr %5, i64 0, i64 0
  %27 = load i8, ptr %26, align 1, !tbaa !9
  %28 = sext i8 %27 to i32
  %29 = load ptr, ptr @color, align 8, !tbaa !10
  %30 = getelementptr inbounds i8, ptr %29, i64 1
  %31 = load i8, ptr %30, align 1, !tbaa !9
  %32 = sext i8 %31 to i32
  %33 = icmp eq i32 %28, %32
  %34 = zext i1 %33 to i32
  %35 = load i32, ptr %2, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [100001 x [2 x i32]], ptr @seq, i64 0, i64 %36
  %38 = getelementptr inbounds [2 x i32], ptr %37, i64 0, i64 0
  store i32 %34, ptr %38, align 8, !tbaa !5
  store i32 %34, ptr %3, align 4, !tbaa !5
  %39 = load i32, ptr %4, align 4, !tbaa !5
  %40 = load i32, ptr %2, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [100001 x [2 x i32]], ptr @seq, i64 0, i64 %41
  %43 = getelementptr inbounds [2 x i32], ptr %42, i64 0, i64 1
  store i32 %39, ptr %43, align 4, !tbaa !5
  %44 = load i32, ptr %3, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [2 x i32], ptr @cnt, i64 0, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = add nsw i32 %47, %39
  store i32 %48, ptr %46, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 2, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %49

49:                                               ; preds = %23
  %50 = load i32, ptr %2, align 4, !tbaa !5
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %2, align 4, !tbaa !5
  br label %18, !llvm.loop !12

52:                                               ; preds = %22
  %53 = load i32, ptr @cnt, align 4, !tbaa !5
  %54 = icmp ne i32 %53, 0
  br i1 %54, label %55, label %58

55:                                               ; preds = %52
  %56 = load i32, ptr getelementptr inbounds ([2 x i32], ptr @cnt, i64 0, i64 1), align 4, !tbaa !5
  %57 = icmp ne i32 %56, 0
  br i1 %57, label %63, label %58

58:                                               ; preds = %55, %52
  %59 = load i32, ptr @cnt, align 4, !tbaa !5
  %60 = load i32, ptr getelementptr inbounds ([2 x i32], ptr @cnt, i64 0, i64 1), align 4, !tbaa !5
  %61 = add nsw i32 %59, %60
  %62 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %61)
  br label %12, !llvm.loop !14

63:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %64 = load i32, ptr @cnt, align 4, !tbaa !5
  %65 = load i32, ptr getelementptr inbounds ([2 x i32], ptr @cnt, i64 0, i64 1), align 4, !tbaa !5
  %66 = call noundef i32 @_ZSt5__gcdIiET_S0_S0_(i32 noundef %64, i32 noundef %65)
  store i32 %66, ptr %6, align 4, !tbaa !5
  %67 = load i32, ptr %6, align 4, !tbaa !5
  %68 = load i32, ptr @cnt, align 4, !tbaa !5
  %69 = sdiv i32 %68, %67
  store i32 %69, ptr @cnt, align 4, !tbaa !5
  %70 = load i32, ptr %6, align 4, !tbaa !5
  %71 = load i32, ptr getelementptr inbounds ([2 x i32], ptr @cnt, i64 0, i64 1), align 4, !tbaa !5
  %72 = sdiv i32 %71, %70
  store i32 %72, ptr getelementptr inbounds ([2 x i32], ptr @cnt, i64 0, i64 1), align 4, !tbaa !5
  store i32 0, ptr getelementptr inbounds ([2 x i32], ptr @sum, i64 0, i64 1), align 4, !tbaa !5
  store i32 0, ptr @sum, align 4, !tbaa !5
  store i32 0, ptr @ans, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %73

73:                                               ; preds = %172, %63
  %74 = load i32, ptr %7, align 4, !tbaa !5
  %75 = load i32, ptr @n, align 4, !tbaa !5
  %76 = icmp sle i32 %74, %75
  br i1 %76, label %78, label %77

77:                                               ; preds = %73
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %175

78:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %79 = load i32, ptr %7, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [100001 x [2 x i32]], ptr @seq, i64 0, i64 %80
  %82 = getelementptr inbounds [2 x i32], ptr %81, i64 0, i64 0
  %83 = load i32, ptr %82, align 8, !tbaa !5
  store i32 %83, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %84 = load i32, ptr %7, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [100001 x [2 x i32]], ptr @seq, i64 0, i64 %85
  %87 = getelementptr inbounds [2 x i32], ptr %86, i64 0, i64 1
  %88 = load i32, ptr %87, align 4, !tbaa !5
  store i32 %88, ptr %9, align 4, !tbaa !5
  %89 = load i32, ptr %8, align 4, !tbaa !5
  %90 = icmp ne i32 %89, 0
  %91 = xor i1 %90, true
  %92 = zext i1 %91 to i64
  %93 = getelementptr inbounds [2 x i32], ptr @sum, i64 0, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !5
  %95 = icmp ne i32 %94, 0
  br i1 %95, label %96, label %165

96:                                               ; preds = %78
  %97 = load i32, ptr %8, align 4, !tbaa !5
  %98 = icmp ne i32 %97, 0
  %99 = xor i1 %98, true
  %100 = zext i1 %99 to i64
  %101 = getelementptr inbounds [2 x i32], ptr @sum, i64 0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = load i32, ptr %8, align 4, !tbaa !5
  %104 = icmp ne i32 %103, 0
  %105 = xor i1 %104, true
  %106 = zext i1 %105 to i64
  %107 = getelementptr inbounds [2 x i32], ptr @cnt, i64 0, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = srem i32 %102, %108
  %110 = icmp eq i32 %109, 0
  br i1 %110, label %111, label %165

111:                                              ; preds = %96
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %112 = load i32, ptr %8, align 4, !tbaa !5
  %113 = icmp ne i32 %112, 0
  %114 = xor i1 %113, true
  %115 = zext i1 %114 to i64
  %116 = getelementptr inbounds [2 x i32], ptr @sum, i64 0, i64 %115
  %117 = load i32, ptr %116, align 4, !tbaa !5
  %118 = load i32, ptr %8, align 4, !tbaa !5
  %119 = icmp ne i32 %118, 0
  %120 = xor i1 %119, true
  %121 = zext i1 %120 to i64
  %122 = getelementptr inbounds [2 x i32], ptr @cnt, i64 0, i64 %121
  %123 = load i32, ptr %122, align 4, !tbaa !5
  %124 = sdiv i32 %117, %123
  %125 = load i32, ptr %8, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [2 x i32], ptr @cnt, i64 0, i64 %126
  %128 = load i32, ptr %127, align 4, !tbaa !5
  %129 = mul nsw i32 %124, %128
  %130 = sext i32 %129 to i64
  store i64 %130, ptr %10, align 8, !tbaa !15
  %131 = load i32, ptr %8, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [2 x i32], ptr @sum, i64 0, i64 %132
  %134 = load i32, ptr %133, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = load i64, ptr %10, align 8, !tbaa !15
  %137 = icmp slt i64 %135, %136
  br i1 %137, label %138, label %164

138:                                              ; preds = %111
  %139 = load i64, ptr %10, align 8, !tbaa !15
  %140 = load i32, ptr %8, align 4, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [2 x i32], ptr @sum, i64 0, i64 %141
  %143 = load i32, ptr %142, align 4, !tbaa !5
  %144 = load i32, ptr %9, align 4, !tbaa !5
  %145 = add nsw i32 %143, %144
  %146 = sext i32 %145 to i64
  %147 = icmp sle i64 %139, %146
  br i1 %147, label %148, label %164

148:                                              ; preds = %138
  %149 = load i32, ptr @ans, align 4, !tbaa !5
  %150 = add nsw i32 %149, 1
  store i32 %150, ptr @ans, align 4, !tbaa !5
  %151 = load i32, ptr %8, align 4, !tbaa !5
  %152 = icmp ne i32 %151, 0
  %153 = xor i1 %152, true
  %154 = zext i1 %153 to i64
  %155 = getelementptr inbounds [2 x i32], ptr @sum, i64 0, i64 %154
  store i32 0, ptr %155, align 4, !tbaa !5
  %156 = load i64, ptr %10, align 8, !tbaa !15
  %157 = load i32, ptr %8, align 4, !tbaa !5
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [2 x i32], ptr @sum, i64 0, i64 %158
  %160 = load i32, ptr %159, align 4, !tbaa !5
  %161 = sext i32 %160 to i64
  %162 = sub nsw i64 %161, %156
  %163 = trunc i64 %162 to i32
  store i32 %163, ptr %159, align 4, !tbaa !5
  br label %164

164:                                              ; preds = %148, %138, %111
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  br label %165

165:                                              ; preds = %164, %96, %78
  %166 = load i32, ptr %9, align 4, !tbaa !5
  %167 = load i32, ptr %8, align 4, !tbaa !5
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [2 x i32], ptr @sum, i64 0, i64 %168
  %170 = load i32, ptr %169, align 4, !tbaa !5
  %171 = add nsw i32 %170, %166
  store i32 %171, ptr %169, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %172

172:                                              ; preds = %165
  %173 = load i32, ptr %7, align 4, !tbaa !5
  %174 = add nsw i32 %173, 1
  store i32 %174, ptr %7, align 4, !tbaa !5
  br label %73, !llvm.loop !17

175:                                              ; preds = %77
  %176 = load i32, ptr @sum, align 4, !tbaa !5
  %177 = icmp ne i32 %176, 0
  br i1 %177, label %178, label %184

178:                                              ; preds = %175
  %179 = load i32, ptr getelementptr inbounds ([2 x i32], ptr @sum, i64 0, i64 1), align 4, !tbaa !5
  %180 = icmp ne i32 %179, 0
  br i1 %180, label %181, label %184

181:                                              ; preds = %178
  %182 = load i32, ptr @ans, align 4, !tbaa !5
  %183 = add nsw i32 %182, 1
  store i32 %183, ptr @ans, align 4, !tbaa !5
  br label %184

184:                                              ; preds = %181, %178, %175
  %185 = load i32, ptr @ans, align 4, !tbaa !5
  %186 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %185)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %12, !llvm.loop !14

187:                                              ; preds = %12
  ret i32 0
}

declare i32 @__isoc99_scanf(ptr 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

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

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

attributes #0 = { 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 #1 = { "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 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 #4 = { 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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = !{!16, !16, i64 0}
!16 = !{!"long long", !7, i64 0}
!17 = distinct !{!17, !13}


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

@color = external dso_local local_unnamed_addr global ptr, align 8
@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@cnt = external dso_local local_unnamed_addr global [2 x i32], align 4
@seq = external dso_local local_unnamed_addr global [100001 x [2 x i32]], align 16
@sum = external dso_local local_unnamed_addr global [2 x i32], align 4
@ans = external dso_local local_unnamed_addr global i32, align 4
@.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 [4 x i8], align 1

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca [2 x i8], align 1
  %3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @t)
  %4 = load i32, ptr @t, align 4, !tbaa !5
  %5 = add nsw i32 %4, -1
  store i32 %5, ptr @t, align 4, !tbaa !5
  %.not48 = icmp eq i32 %4, 0
  br i1 %.not48, label %._crit_edge51, label %.lr.ph50

.lr.ph50:                                         ; preds = %0, %.backedge
  %6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n)
  store i32 0, ptr getelementptr inbounds (i8, ptr @cnt, i64 4), align 4, !tbaa !5
  store i32 0, ptr @cnt, align 4, !tbaa !5
  %7 = load i32, ptr @n, align 4, !tbaa !5
  %.not3541 = icmp slt i32 %7, 1
  br i1 %.not3541, label %._crit_edge.thread, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph
  %.pre = load i32, ptr @cnt, align 4, !tbaa !5
  %.pre56 = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 4), align 4
  %8 = icmp ne i32 %.pre, 0
  %9 = icmp ne i32 %.pre56, 0
  %or.cond = select i1 %8, i1 %9, i1 false
  br i1 %or.cond, label %32, label %._crit_edge.thread

.lr.ph:                                           ; preds = %.lr.ph50, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %.lr.ph50 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %2) #4
  %10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %11 = load i8, ptr %2, align 1, !tbaa !9
  %12 = load ptr, ptr @color, align 8, !tbaa !10
  %13 = getelementptr inbounds i8, ptr %12, i64 1
  %14 = load i8, ptr %13, align 1, !tbaa !9
  %15 = icmp eq i8 %11, %14
  %16 = zext i1 %15 to i32
  %17 = getelementptr inbounds [100001 x [2 x i32]], ptr @seq, i64 0, i64 %indvars.iv
  store i32 %16, ptr %17, align 8, !tbaa !5
  %18 = load i32, ptr %1, align 4, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %17, i64 4
  store i32 %18, ptr %19, align 4, !tbaa !5
  %20 = zext i1 %15 to i64
  %21 = getelementptr inbounds [2 x i32], ptr @cnt, i64 0, i64 %20
  %22 = load i32, ptr %21, align 4, !tbaa !5
  %23 = add nsw i32 %22, %18
  store i32 %23, ptr %21, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %24 = load i32, ptr @n, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %.not35.not = icmp slt i64 %indvars.iv, %25
  br i1 %.not35.not, label %.lr.ph, label %._crit_edge, !llvm.loop !12

._crit_edge.thread:                               ; preds = %.lr.ph50, %._crit_edge
  %26 = phi i32 [ %.pre, %._crit_edge ], [ 0, %.lr.ph50 ]
  %27 = phi i32 [ %.pre56, %._crit_edge ], [ 0, %.lr.ph50 ]
  %28 = add nsw i32 %27, %26
  br label %.backedge

.backedge:                                        ; preds = %._crit_edge47, %75, %32, %._crit_edge.thread
  %.sink = phi i32 [ %28, %._crit_edge.thread ], [ %76, %75 ], [ %70, %._crit_edge47 ], [ 0, %32 ]
  %29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %.sink)
  %30 = load i32, ptr @t, align 4, !tbaa !5
  %31 = add nsw i32 %30, -1
  store i32 %31, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %30, 0
  br i1 %.not, label %._crit_edge51, label %.lr.ph50, !llvm.loop !14

32:                                               ; preds = %._crit_edge
  %33 = call noundef i32 @_ZSt5__gcdIiET_S0_S0_(i32 noundef %.pre, i32 noundef %.pre56)
  %34 = load i32, ptr @cnt, align 4, !tbaa !5
  %35 = sdiv i32 %34, %33
  store i32 %35, ptr @cnt, align 4, !tbaa !5
  %36 = load i32, ptr getelementptr inbounds (i8, ptr @cnt, i64 4), align 4, !tbaa !5
  %37 = sdiv i32 %36, %33
  store i32 %37, ptr getelementptr inbounds (i8, ptr @cnt, i64 4), align 4, !tbaa !5
  store i32 0, ptr getelementptr inbounds (i8, ptr @sum, i64 4), align 4, !tbaa !5
  store i32 0, ptr @sum, align 4, !tbaa !5
  store i32 0, ptr @ans, align 4, !tbaa !5
  %38 = load i32, ptr @n, align 4, !tbaa !5
  %.not3643 = icmp slt i32 %38, 1
  br i1 %.not3643, label %.backedge, label %.lr.ph46.preheader

.lr.ph46.preheader:                               ; preds = %32
  %39 = add nuw i32 %38, 1
  %wide.trip.count = zext i32 %39 to i64
  br label %.lr.ph46

._crit_edge47:                                    ; preds = %69
  %.pre57 = load i32, ptr @sum, align 4, !tbaa !5
  %.pre58 = load i32, ptr getelementptr inbounds (i8, ptr @sum, i64 4), align 4
  %40 = icmp ne i32 %.pre57, 0
  %41 = icmp ne i32 %.pre58, 0
  %or.cond3 = select i1 %40, i1 %41, i1 false
  br i1 %or.cond3, label %75, label %.backedge

.lr.ph46:                                         ; preds = %.lr.ph46.preheader, %69
  %indvars.iv53 = phi i64 [ 1, %.lr.ph46.preheader ], [ %indvars.iv.next54, %69 ]
  %42 = phi i32 [ 0, %.lr.ph46.preheader ], [ %70, %69 ]
  %43 = getelementptr inbounds [100001 x [2 x i32]], ptr @seq, i64 0, i64 %indvars.iv53
  %44 = load i32, ptr %43, align 8, !tbaa !5
  %45 = getelementptr inbounds i8, ptr %43, i64 4
  %46 = load i32, ptr %45, align 4, !tbaa !5
  %.not37 = icmp eq i32 %44, 0
  %47 = zext i1 %.not37 to i64
  %48 = getelementptr inbounds [2 x i32], ptr @sum, i64 0, i64 %47
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %.not38 = icmp eq i32 %49, 0
  br i1 %.not38, label %69, label %50

50:                                               ; preds = %.lr.ph46
  %51 = getelementptr inbounds [2 x i32], ptr @cnt, i64 0, i64 %47
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = srem i32 %49, %52
  %54 = sdiv i32 %49, %52
  %55 = icmp eq i32 %53, 0
  br i1 %55, label %56, label %69

56:                                               ; preds = %50
  %57 = sext i32 %44 to i64
  %58 = getelementptr inbounds [2 x i32], ptr @cnt, i64 0, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = mul nsw i32 %59, %54
  %61 = getelementptr inbounds [2 x i32], ptr @sum, i64 0, i64 %57
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = icmp sge i32 %62, %60
  %64 = add nsw i32 %62, %46
  %.not39 = icmp sgt i32 %60, %64
  %or.cond40 = select i1 %63, i1 true, i1 %.not39
  br i1 %or.cond40, label %69, label %65

65:                                               ; preds = %56
  %66 = add nsw i32 %42, 1
  store i32 %66, ptr @ans, align 4, !tbaa !5
  store i32 0, ptr %48, align 4, !tbaa !5
  %67 = load i32, ptr %61, align 4, !tbaa !5
  %68 = sub i32 %67, %60
  store i32 %68, ptr %61, align 4, !tbaa !5
  br label %69

69:                                               ; preds = %56, %65, %50, %.lr.ph46
  %70 = phi i32 [ %42, %56 ], [ %66, %65 ], [ %42, %50 ], [ %42, %.lr.ph46 ]
  %71 = sext i32 %44 to i64
  %72 = getelementptr inbounds [2 x i32], ptr @sum, i64 0, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = add nsw i32 %73, %46
  store i32 %74, ptr %72, align 4, !tbaa !5
  %indvars.iv.next54 = add nuw nsw i64 %indvars.iv53, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next54, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge47, label %.lr.ph46, !llvm.loop !15

75:                                               ; preds = %._crit_edge47
  %76 = add nsw i32 %70, 1
  store i32 %76, ptr @ans, align 4, !tbaa !5
  br label %.backedge

._crit_edge51:                                    ; preds = %.backedge, %0
  ret i32 0
}

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

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

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

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

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

attributes #0 = { mustprogress norecurse 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 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}


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