; LLVM IR from tangjz/acm-icpc :: usaco/Training/Chapter 2 Bigger challenges (fracdec)

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

@n = external dso_local global i32, align 4
@d = external dso_local global i32, align 4
@tot = external dso_local global i32, align 4
@seq = external dso_local global [100002 x i32], align 16
@idx = external dso_local global [100002 x i32], align 16
@cnt = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 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
  store i32 0, ptr %1, align 4
  %4 = load ptr, ptr @stdin, align 8, !tbaa !5
  %5 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.1, ptr noundef %4)
  %6 = load ptr, ptr @stdout, align 8, !tbaa !5
  %7 = call ptr @freopen(ptr noundef @.str.2, ptr noundef @.str.3, ptr noundef %6)
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef @n, ptr noundef @d)
  %9 = load i32, ptr @n, align 4, !tbaa !9
  %10 = load i32, ptr @d, align 4, !tbaa !9
  %11 = sdiv i32 %9, %10
  %12 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %11)
  %13 = load i32, ptr @cnt, align 4, !tbaa !9
  %14 = add nsw i32 %13, %12
  store i32 %14, ptr @cnt, align 4, !tbaa !9
  %15 = load i32, ptr @d, align 4, !tbaa !9
  %16 = load i32, ptr @n, align 4, !tbaa !9
  %17 = srem i32 %16, %15
  store i32 %17, ptr @n, align 4, !tbaa !9
  %18 = load i32, ptr @tot, align 4, !tbaa !9
  %19 = add nsw i32 %18, 1
  store i32 %19, ptr @tot, align 4, !tbaa !9
  %20 = load i32, ptr @n, align 4, !tbaa !9
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [100002 x i32], ptr @idx, i64 0, i64 %21
  store i32 %19, ptr %22, align 4, !tbaa !9
  br label %23

23:                                               ; preds = %132, %0
  %24 = load i32, ptr @n, align 4, !tbaa !9
  %25 = mul nsw i32 %24, 10
  store i32 %25, ptr @n, align 4, !tbaa !9
  %26 = load i32, ptr @n, align 4, !tbaa !9
  %27 = load i32, ptr @d, align 4, !tbaa !9
  %28 = sdiv i32 %26, %27
  %29 = load i32, ptr @tot, align 4, !tbaa !9
  %30 = add nsw i32 %29, 1
  store i32 %30, ptr @tot, align 4, !tbaa !9
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [100002 x i32], ptr @seq, i64 0, i64 %31
  store i32 %28, ptr %32, align 4, !tbaa !9
  %33 = load i32, ptr @d, align 4, !tbaa !9
  %34 = load i32, ptr @n, align 4, !tbaa !9
  %35 = srem i32 %34, %33
  store i32 %35, ptr @n, align 4, !tbaa !9
  %36 = load i32, ptr @n, align 4, !tbaa !9
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [100002 x i32], ptr @idx, i64 0, i64 %37
  %39 = load i32, ptr %38, align 4, !tbaa !9
  %40 = icmp ne i32 %39, 0
  br i1 %40, label %41, label %132

41:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 2, ptr %2, align 4, !tbaa !9
  br label %42

42:                                               ; preds = %63, %41
  %43 = load i32, ptr %2, align 4, !tbaa !9
  %44 = load i32, ptr @n, align 4, !tbaa !9
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [100002 x i32], ptr @idx, i64 0, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !9
  %48 = icmp sle i32 %43, %47
  br i1 %48, label %50, label %49

49:                                               ; preds = %42
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  br label %66

50:                                               ; preds = %42
  %51 = load i32, ptr %2, align 4, !tbaa !9
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [100002 x i32], ptr @seq, i64 0, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !9
  %55 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, i32 noundef %54)
  %56 = load i32, ptr @cnt, align 4, !tbaa !9
  %57 = add nsw i32 %56, %55
  store i32 %57, ptr @cnt, align 4, !tbaa !9
  %58 = load i32, ptr @cnt, align 4, !tbaa !9
  %59 = icmp eq i32 %58, 76
  br i1 %59, label %60, label %62

60:                                               ; preds = %50
  %61 = call i32 @putchar(i32 noundef 10)
  store i32 0, ptr @cnt, align 4, !tbaa !9
  br label %62

62:                                               ; preds = %60, %50
  br label %63

63:                                               ; preds = %62
  %64 = load i32, ptr %2, align 4, !tbaa !9
  %65 = add nsw i32 %64, 1
  store i32 %65, ptr %2, align 4, !tbaa !9
  br label %42, !llvm.loop !11

66:                                               ; preds = %49
  %67 = load i32, ptr @n, align 4, !tbaa !9
  %68 = icmp ne i32 %67, 0
  br i1 %68, label %69, label %111

69:                                               ; preds = %66
  %70 = call i32 @putchar(i32 noundef 40)
  %71 = load i32, ptr @cnt, align 4, !tbaa !9
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr @cnt, align 4, !tbaa !9
  %73 = icmp eq i32 %72, 76
  br i1 %73, label %74, label %76

74:                                               ; preds = %69
  %75 = call i32 @putchar(i32 noundef 10)
  store i32 0, ptr @cnt, align 4, !tbaa !9
  br label %76

76:                                               ; preds = %74, %69
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  %77 = load i32, ptr @n, align 4, !tbaa !9
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [100002 x i32], ptr @idx, i64 0, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !9
  %81 = add nsw i32 %80, 1
  store i32 %81, ptr %3, align 4, !tbaa !9
  br label %82

82:                                               ; preds = %100, %76
  %83 = load i32, ptr %3, align 4, !tbaa !9
  %84 = load i32, ptr @tot, align 4, !tbaa !9
  %85 = icmp sle i32 %83, %84
  br i1 %85, label %87, label %86

86:                                               ; preds = %82
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %103

87:                                               ; preds = %82
  %88 = load i32, ptr %3, align 4, !tbaa !9
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [100002 x i32], ptr @seq, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !9
  %92 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, i32 noundef %91)
  %93 = load i32, ptr @cnt, align 4, !tbaa !9
  %94 = add nsw i32 %93, %92
  store i32 %94, ptr @cnt, align 4, !tbaa !9
  %95 = load i32, ptr @cnt, align 4, !tbaa !9
  %96 = icmp eq i32 %95, 76
  br i1 %96, label %97, label %99

97:                                               ; preds = %87
  %98 = call i32 @putchar(i32 noundef 10)
  store i32 0, ptr @cnt, align 4, !tbaa !9
  br label %99

99:                                               ; preds = %97, %87
  br label %100

100:                                              ; preds = %99
  %101 = load i32, ptr %3, align 4, !tbaa !9
  %102 = add nsw i32 %101, 1
  store i32 %102, ptr %3, align 4, !tbaa !9
  br label %82, !llvm.loop !13

103:                                              ; preds = %86
  %104 = call i32 @putchar(i32 noundef 41)
  %105 = load i32, ptr @cnt, align 4, !tbaa !9
  %106 = add nsw i32 %105, 1
  store i32 %106, ptr @cnt, align 4, !tbaa !9
  %107 = icmp eq i32 %106, 76
  br i1 %107, label %108, label %110

108:                                              ; preds = %103
  %109 = call i32 @putchar(i32 noundef 10)
  store i32 0, ptr @cnt, align 4, !tbaa !9
  br label %110

110:                                              ; preds = %108, %103
  br label %126

111:                                              ; preds = %66
  %112 = load i32, ptr @n, align 4, !tbaa !9
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [100002 x i32], ptr @idx, i64 0, i64 %113
  %115 = load i32, ptr %114, align 4, !tbaa !9
  %116 = icmp eq i32 %115, 1
  br i1 %116, label %117, label %125

117:                                              ; preds = %111
  %118 = call i32 @putchar(i32 noundef 48)
  %119 = load i32, ptr @cnt, align 4, !tbaa !9
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr @cnt, align 4, !tbaa !9
  %121 = icmp eq i32 %120, 76
  br i1 %121, label %122, label %124

122:                                              ; preds = %117
  %123 = call i32 @putchar(i32 noundef 10)
  store i32 0, ptr @cnt, align 4, !tbaa !9
  br label %124

124:                                              ; preds = %122, %117
  br label %125

125:                                              ; preds = %124, %111
  br label %126

126:                                              ; preds = %125, %110
  %127 = load i32, ptr @cnt, align 4, !tbaa !9
  %128 = icmp ne i32 %127, 0
  br i1 %128, label %129, label %131

129:                                              ; preds = %126
  %130 = call i32 @putchar(i32 noundef 10)
  br label %131

131:                                              ; preds = %129, %126
  br label %137

132:                                              ; preds = %23
  %133 = load i32, ptr @tot, align 4, !tbaa !9
  %134 = load i32, ptr @n, align 4, !tbaa !9
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [100002 x i32], ptr @idx, i64 0, i64 %135
  store i32 %133, ptr %136, align 4, !tbaa !9
  br label %23, !llvm.loop !14

137:                                              ; preds = %131
  ret i32 0
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) #1

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

declare i32 @printf(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: inlinehint mustprogress uwtable
declare i32 @putchar(i32 noundef) #3

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

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 = { 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 #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}


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

@n = external dso_local global i32, align 4
@d = external dso_local global i32, align 4
@tot = external dso_local local_unnamed_addr global i32, align 4
@seq = external dso_local local_unnamed_addr global [100002 x i32], align 16
@idx = external dso_local local_unnamed_addr global [100002 x i32], align 16
@cnt = external dso_local local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = load ptr, ptr @stdin, align 8, !tbaa !5
  %2 = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef %1)
  %3 = load ptr, ptr @stdout, align 8, !tbaa !5
  %4 = tail call ptr @freopen(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, ptr noundef %3)
  %5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull @n, ptr noundef nonnull @d)
  %6 = load i32, ptr @n, align 4, !tbaa !9
  %7 = load i32, ptr @d, align 4, !tbaa !9
  %8 = sdiv i32 %6, %7
  %9 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %8)
  %10 = load i32, ptr @cnt, align 4, !tbaa !9
  %11 = add nsw i32 %10, %9
  store i32 %11, ptr @cnt, align 4, !tbaa !9
  %12 = load i32, ptr @d, align 4, !tbaa !9
  %13 = load i32, ptr @n, align 4, !tbaa !9
  %14 = srem i32 %13, %12
  %15 = load i32, ptr @tot, align 4, !tbaa !9
  %16 = add i32 %15, 1
  %17 = sext i32 %14 to i64
  %18 = getelementptr inbounds [100002 x i32], ptr @idx, i64 0, i64 %17
  store i32 %16, ptr %18, align 4, !tbaa !9
  %19 = sext i32 %16 to i64
  %20 = mul nsw i32 %14, 10
  %21 = sdiv i32 %20, %12
  %indvars.iv.next45 = add nsw i64 %19, 1
  %22 = getelementptr inbounds [100002 x i32], ptr @seq, i64 0, i64 %indvars.iv.next45
  store i32 %21, ptr %22, align 4, !tbaa !9
  %23 = srem i32 %20, %12
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [100002 x i32], ptr @idx, i64 0, i64 %24
  %26 = load i32, ptr %25, align 4, !tbaa !9
  %.not46 = icmp eq i32 %26, 0
  br i1 %.not46, label %.lr.ph49, label %.preheader

.preheader:                                       ; preds = %.lr.ph49, %0
  %indvars.iv.next.lcssa = phi i64 [ %indvars.iv.next45, %0 ], [ %indvars.iv.next, %.lr.ph49 ]
  %.lcssa44 = phi i32 [ %23, %0 ], [ %90, %.lr.ph49 ]
  %.lcssa43 = phi i32 [ %26, %0 ], [ %93, %.lr.ph49 ]
  %27 = trunc nsw i64 %indvars.iv.next.lcssa to i32
  store i32 %.lcssa44, ptr @n, align 4, !tbaa !9
  store i32 %27, ptr @tot, align 4, !tbaa !9
  %.not818 = icmp slt i32 %.lcssa43, 2
  br i1 %.not818, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %36, %.preheader
  %.pr12 = phi i32 [ %11, %.preheader ], [ %.pr1238, %36 ]
  %.lcssa14 = phi i32 [ %.lcssa44, %.preheader ], [ %.pr, %36 ]
  %.lcssa = phi i32 [ %.lcssa43, %.preheader ], [ %39, %36 ]
  %.not9 = icmp eq i32 %.lcssa14, 0
  br i1 %.not9, label %72, label %41

.lr.ph:                                           ; preds = %.preheader, %36
  %indvars.iv31 = phi i64 [ %indvars.iv.next32, %36 ], [ 2, %.preheader ]
  %28 = getelementptr inbounds [100002 x i32], ptr @seq, i64 0, i64 %indvars.iv31
  %29 = load i32, ptr %28, align 4, !tbaa !9
  %30 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %29)
  %31 = load i32, ptr @cnt, align 4, !tbaa !9
  %32 = add nsw i32 %31, %30
  store i32 %32, ptr @cnt, align 4, !tbaa !9
  %33 = icmp eq i32 %32, 76
  br i1 %33, label %34, label %36

34:                                               ; preds = %.lr.ph
  %35 = tail call i32 @putchar(i32 noundef 10)
  store i32 0, ptr @cnt, align 4, !tbaa !9
  br label %36

36:                                               ; preds = %.lr.ph, %34
  %.pr1238 = phi i32 [ %32, %.lr.ph ], [ 0, %34 ]
  %indvars.iv.next32 = add nuw nsw i64 %indvars.iv31, 1
  %.pr = load i32, ptr @n, align 4, !tbaa !9
  %37 = sext i32 %.pr to i64
  %38 = getelementptr inbounds [100002 x i32], ptr @idx, i64 0, i64 %37
  %39 = load i32, ptr %38, align 4, !tbaa !9
  %40 = sext i32 %39 to i64
  %.not8.not = icmp slt i64 %indvars.iv31, %40
  br i1 %.not8.not, label %.lr.ph, label %._crit_edge, !llvm.loop !11

41:                                               ; preds = %._crit_edge
  %42 = tail call i32 @putchar(i32 noundef 40)
  %43 = load i32, ptr @cnt, align 4, !tbaa !9
  %44 = add nsw i32 %43, 1
  store i32 %44, ptr @cnt, align 4, !tbaa !9
  %45 = icmp eq i32 %44, 76
  br i1 %45, label %46, label %48

46:                                               ; preds = %41
  %47 = tail call i32 @putchar(i32 noundef 10)
  store i32 0, ptr @cnt, align 4, !tbaa !9
  br label %48

48:                                               ; preds = %46, %41
  %49 = load i32, ptr @n, align 4, !tbaa !9
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [100002 x i32], ptr @idx, i64 0, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !9
  %53 = load i32, ptr @tot, align 4, !tbaa !9
  %.not10.not22 = icmp slt i32 %52, %53
  br i1 %.not10.not22, label %.lr.ph25.preheader, label %._crit_edge26

.lr.ph25.preheader:                               ; preds = %48
  %54 = sext i32 %52 to i64
  br label %.lr.ph25

._crit_edge26:                                    ; preds = %67, %48
  %55 = tail call i32 @putchar(i32 noundef 41)
  %56 = load i32, ptr @cnt, align 4, !tbaa !9
  %57 = add nsw i32 %56, 1
  store i32 %57, ptr @cnt, align 4, !tbaa !9
  %58 = icmp eq i32 %57, 76
  br i1 %58, label %70, label %thread-pre-split

.lr.ph25:                                         ; preds = %.lr.ph25.preheader, %67
  %indvars.iv34 = phi i64 [ %54, %.lr.ph25.preheader ], [ %indvars.iv.next35, %67 ]
  %indvars.iv.next35 = add nsw i64 %indvars.iv34, 1
  %59 = getelementptr inbounds [100002 x i32], ptr @seq, i64 0, i64 %indvars.iv.next35
  %60 = load i32, ptr %59, align 4, !tbaa !9
  %61 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %60)
  %62 = load i32, ptr @cnt, align 4, !tbaa !9
  %63 = add nsw i32 %62, %61
  store i32 %63, ptr @cnt, align 4, !tbaa !9
  %64 = icmp eq i32 %63, 76
  br i1 %64, label %65, label %67

65:                                               ; preds = %.lr.ph25
  %66 = tail call i32 @putchar(i32 noundef 10)
  store i32 0, ptr @cnt, align 4, !tbaa !9
  br label %67

67:                                               ; preds = %.lr.ph25, %65
  %68 = load i32, ptr @tot, align 4, !tbaa !9
  %69 = sext i32 %68 to i64
  %.not10.not = icmp slt i64 %indvars.iv.next35, %69
  br i1 %.not10.not, label %.lr.ph25, label %._crit_edge26, !llvm.loop !13

70:                                               ; preds = %._crit_edge26
  %71 = tail call i32 @putchar(i32 noundef 10)
  store i32 0, ptr @cnt, align 4, !tbaa !9
  br label %.thread

72:                                               ; preds = %._crit_edge
  %73 = icmp eq i32 %.lcssa, 1
  br i1 %73, label %74, label %thread-pre-split

74:                                               ; preds = %72
  %75 = tail call i32 @putchar(i32 noundef 48)
  %76 = load i32, ptr @cnt, align 4, !tbaa !9
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr @cnt, align 4, !tbaa !9
  %78 = icmp eq i32 %77, 76
  br i1 %78, label %79, label %thread-pre-split

79:                                               ; preds = %74
  %80 = tail call i32 @putchar(i32 noundef 10)
  store i32 0, ptr @cnt, align 4, !tbaa !9
  br label %.thread

thread-pre-split:                                 ; preds = %72, %74, %._crit_edge26
  %81 = phi i32 [ %77, %74 ], [ %57, %._crit_edge26 ], [ %.pr12, %72 ]
  %.not11 = icmp eq i32 %81, 0
  br i1 %.not11, label %.thread, label %82

82:                                               ; preds = %thread-pre-split
  %83 = tail call i32 @putchar(i32 noundef 10)
  br label %.thread

.lr.ph49:                                         ; preds = %0, %.lr.ph49
  %84 = phi ptr [ %92, %.lr.ph49 ], [ %25, %0 ]
  %85 = phi i32 [ %90, %.lr.ph49 ], [ %23, %0 ]
  %indvars.iv.next47 = phi i64 [ %indvars.iv.next, %.lr.ph49 ], [ %indvars.iv.next45, %0 ]
  %86 = trunc nsw i64 %indvars.iv.next47 to i32
  store i32 %86, ptr %84, align 4, !tbaa !9
  %87 = mul nsw i32 %85, 10
  %88 = sdiv i32 %87, %12
  %indvars.iv.next = add nsw i64 %indvars.iv.next47, 1
  %89 = getelementptr inbounds [100002 x i32], ptr @seq, i64 0, i64 %indvars.iv.next
  store i32 %88, ptr %89, align 4, !tbaa !9
  %90 = srem i32 %87, %12
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [100002 x i32], ptr @idx, i64 0, i64 %91
  %93 = load i32, ptr %92, align 4, !tbaa !9
  %.not = icmp eq i32 %93, 0
  br i1 %.not, label %.lr.ph49, label %.preheader, !llvm.loop !14

.thread:                                          ; preds = %70, %79, %thread-pre-split, %82
  ret i32 0
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

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

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

; Function Attrs: inlinehint mustprogress nofree nounwind uwtable
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #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 = { 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 #3 = { inlinehint mustprogress nofree 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" }

!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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}


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