; LLVM IR from tangjz/acm-icpc :: self_training/2015-02-16 (D)

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

%"struct.std::greater" = type { i8 }

@tot = external dso_local global i32, align 4
@prime = external dso_local global [10001 x i32], align 16
@n = external dso_local global i32, align 4
@c = external dso_local global [211 x i32], align 16
@f = external dso_local global [10001 x i32], align 16
@pre = external dso_local global [10001 x i32], align 16
@ans = external dso_local global [10001 x i32], align 16
@vis = external dso_local global [10001 x i8], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = 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
  %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 %"struct.std::greater", align 1
  %10 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  store i8 1, ptr getelementptr inbounds ([10001 x i8], ptr @vis, i64 0, i64 1), align 1, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 2, ptr %2, align 4, !tbaa !9
  br label %11

11:                                               ; preds = %78, %0
  %12 = load i32, ptr %2, align 4, !tbaa !9
  %13 = icmp slt i32 %12, 10001
  br i1 %13, label %15, label %14

14:                                               ; preds = %11
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %81

15:                                               ; preds = %11
  %16 = load i32, ptr %2, align 4, !tbaa !9
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds [10001 x i8], ptr @vis, i64 0, i64 %17
  %19 = load i8, ptr %18, align 1, !tbaa !5, !range !11, !noundef !12
  %20 = trunc i8 %19 to i1
  br i1 %20, label %39, label %21

21:                                               ; preds = %15
  %22 = load i32, ptr %2, align 4, !tbaa !9
  %23 = load i32, ptr @tot, align 4, !tbaa !9
  %24 = add nsw i32 %23, 1
  store i32 %24, ptr @tot, align 4, !tbaa !9
  %25 = sext i32 %23 to i64
  %26 = getelementptr inbounds [10001 x i32], ptr @prime, i64 0, i64 %25
  store i32 %22, ptr %26, align 4, !tbaa !9
  %27 = load i32, ptr @tot, align 4, !tbaa !9
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [10001 x i8], ptr @vis, i64 0, i64 %28
  %30 = load i8, ptr %29, align 1, !tbaa !5, !range !11, !noundef !12
  %31 = trunc i8 %30 to i1
  br i1 %31, label %38, label %32

32:                                               ; preds = %21
  %33 = load i32, ptr %2, align 4, !tbaa !9
  %34 = load i32, ptr @n, align 4, !tbaa !9
  %35 = add nsw i32 %34, 1
  store i32 %35, ptr @n, align 4, !tbaa !9
  %36 = sext i32 %34 to i64
  %37 = getelementptr inbounds [211 x i32], ptr @c, i64 0, i64 %36
  store i32 %33, ptr %37, align 4, !tbaa !9
  br label %38

38:                                               ; preds = %32, %21
  br label %39

39:                                               ; preds = %38, %15
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %40

40:                                               ; preds = %73, %39
  %41 = load i32, ptr %4, align 4, !tbaa !9
  %42 = load i32, ptr @tot, align 4, !tbaa !9
  %43 = icmp slt i32 %41, %42
  br i1 %43, label %44, label %52

44:                                               ; preds = %40
  %45 = load i32, ptr %2, align 4, !tbaa !9
  %46 = load i32, ptr %4, align 4, !tbaa !9
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [10001 x i32], ptr @prime, i64 0, i64 %47
  %49 = load i32, ptr %48, align 4, !tbaa !9
  %50 = mul nsw i32 %45, %49
  %51 = icmp slt i32 %50, 10001
  br label %52

52:                                               ; preds = %44, %40
  %53 = phi i1 [ false, %40 ], [ %51, %44 ]
  br i1 %53, label %55, label %54

54:                                               ; preds = %52
  store i32 5, ptr %3, align 4
  br label %76

55:                                               ; preds = %52
  %56 = load i32, ptr %2, align 4, !tbaa !9
  %57 = load i32, ptr %4, align 4, !tbaa !9
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [10001 x i32], ptr @prime, i64 0, i64 %58
  %60 = load i32, ptr %59, align 4, !tbaa !9
  %61 = mul nsw i32 %56, %60
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [10001 x i8], ptr @vis, i64 0, i64 %62
  store i8 1, ptr %63, align 1, !tbaa !5
  %64 = load i32, ptr %2, align 4, !tbaa !9
  %65 = load i32, ptr %4, align 4, !tbaa !9
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [10001 x i32], ptr @prime, i64 0, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !9
  %69 = srem i32 %64, %68
  %70 = icmp eq i32 %69, 0
  br i1 %70, label %71, label %72

71:                                               ; preds = %55
  store i32 5, ptr %3, align 4
  br label %76

72:                                               ; preds = %55
  br label %73

73:                                               ; preds = %72
  %74 = load i32, ptr %4, align 4, !tbaa !9
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %4, align 4, !tbaa !9
  br label %40, !llvm.loop !13

76:                                               ; preds = %71, %54
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %77

77:                                               ; preds = %76
  br label %78

78:                                               ; preds = %77
  %79 = load i32, ptr %2, align 4, !tbaa !9
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr %2, align 4, !tbaa !9
  br label %11, !llvm.loop !15

81:                                               ; preds = %14
  call void @llvm.memset.p0.i64(ptr align 16 @f, i8 63, i64 40004, i1 false)
  store i32 0, ptr @f, align 16, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 3, ptr %5, align 4, !tbaa !9
  br label %82

82:                                               ; preds = %146, %81
  %83 = load i32, ptr %5, align 4, !tbaa !9
  %84 = icmp slt i32 %83, 10001
  br i1 %84, label %86, label %85

85:                                               ; preds = %82
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %149

86:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !9
  br label %87

87:                                               ; preds = %141, %86
  %88 = load i32, ptr %6, align 4, !tbaa !9
  %89 = load i32, ptr @n, align 4, !tbaa !9
  %90 = icmp slt i32 %88, %89
  br i1 %90, label %92, label %91

91:                                               ; preds = %87
  store i32 11, ptr %3, align 4
  br label %144

92:                                               ; preds = %87
  %93 = load i32, ptr %5, align 4, !tbaa !9
  %94 = load i32, ptr %6, align 4, !tbaa !9
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [211 x i32], ptr @c, i64 0, i64 %95
  %97 = load i32, ptr %96, align 4, !tbaa !9
  %98 = icmp slt i32 %93, %97
  br i1 %98, label %99, label %100

99:                                               ; preds = %92
  store i32 11, ptr %3, align 4
  br label %144

100:                                              ; preds = %92
  %101 = load i32, ptr %5, align 4, !tbaa !9
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [10001 x i32], ptr @f, i64 0, i64 %102
  %104 = load i32, ptr %103, align 4, !tbaa !9
  %105 = load i32, ptr %5, align 4, !tbaa !9
  %106 = load i32, ptr %6, align 4, !tbaa !9
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [211 x i32], ptr @c, i64 0, i64 %107
  %109 = load i32, ptr %108, align 4, !tbaa !9
  %110 = sub nsw i32 %105, %109
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [10001 x i32], ptr @f, i64 0, i64 %111
  %113 = load i32, ptr %112, align 4, !tbaa !9
  %114 = add nsw i32 %113, 1
  %115 = icmp sgt i32 %104, %114
  br i1 %115, label %116, label %139

116:                                              ; preds = %100
  %117 = load i32, ptr %5, align 4, !tbaa !9
  %118 = load i32, ptr %6, align 4, !tbaa !9
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [211 x i32], ptr @c, i64 0, i64 %119
  %121 = load i32, ptr %120, align 4, !tbaa !9
  %122 = sub nsw i32 %117, %121
  %123 = load i32, ptr %5, align 4, !tbaa !9
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [10001 x i32], ptr @pre, i64 0, i64 %124
  store i32 %122, ptr %125, align 4, !tbaa !9
  %126 = load i32, ptr %5, align 4, !tbaa !9
  %127 = load i32, ptr %6, align 4, !tbaa !9
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [211 x i32], ptr @c, i64 0, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !9
  %131 = sub nsw i32 %126, %130
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [10001 x i32], ptr @f, i64 0, i64 %132
  %134 = load i32, ptr %133, align 4, !tbaa !9
  %135 = add nsw i32 %134, 1
  %136 = load i32, ptr %5, align 4, !tbaa !9
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [10001 x i32], ptr @f, i64 0, i64 %137
  store i32 %135, ptr %138, align 4, !tbaa !9
  br label %139

139:                                              ; preds = %116, %100
  br label %140

140:                                              ; preds = %139
  br label %141

141:                                              ; preds = %140
  %142 = load i32, ptr %6, align 4, !tbaa !9
  %143 = add nsw i32 %142, 1
  store i32 %143, ptr %6, align 4, !tbaa !9
  br label %87, !llvm.loop !16

144:                                              ; preds = %99, %91
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %145

145:                                              ; preds = %144
  br label %146

146:                                              ; preds = %145
  %147 = load i32, ptr %5, align 4, !tbaa !9
  %148 = add nsw i32 %147, 1
  store i32 %148, ptr %5, align 4, !tbaa !9
  br label %82, !llvm.loop !17

149:                                              ; preds = %85
  store i32 1061109567, ptr @f, align 16, !tbaa !9
  br label %150

150:                                              ; preds = %224, %159, %149
  %151 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  %152 = icmp ne i32 %151, -1
  br i1 %152, label %153, label %225

153:                                              ; preds = %150
  %154 = load i32, ptr @n, align 4, !tbaa !9
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [10001 x i32], ptr @f, i64 0, i64 %155
  %157 = load i32, ptr %156, align 4, !tbaa !9
  %158 = icmp eq i32 %157, 1061109567
  br i1 %158, label %159, label %161

159:                                              ; preds = %153
  %160 = call i32 @puts(ptr noundef @.str.1)
  br label %150, !llvm.loop !18

161:                                              ; preds = %153
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %162 = load i32, ptr @n, align 4, !tbaa !9
  store i32 %162, ptr %8, align 4, !tbaa !9
  br label %163

163:                                              ; preds = %177, %161
  %164 = load i32, ptr %8, align 4, !tbaa !9
  %165 = icmp sgt i32 %164, 0
  br i1 %165, label %167, label %166

166:                                              ; preds = %163
  store i32 16, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %184

167:                                              ; preds = %163
  %168 = load i32, ptr %8, align 4, !tbaa !9
  %169 = load i32, ptr %8, align 4, !tbaa !9
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds [10001 x i32], ptr @pre, i64 0, i64 %170
  %172 = load i32, ptr %171, align 4, !tbaa !9
  %173 = sub nsw i32 %168, %172
  %174 = load i32, ptr %7, align 4, !tbaa !9
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [10001 x i32], ptr @ans, i64 0, i64 %175
  store i32 %173, ptr %176, align 4, !tbaa !9
  br label %177

177:                                              ; preds = %167
  %178 = load i32, ptr %7, align 4, !tbaa !9
  %179 = add nsw i32 %178, 1
  store i32 %179, ptr %7, align 4, !tbaa !9
  %180 = load i32, ptr %8, align 4, !tbaa !9
  %181 = sext i32 %180 to i64
  %182 = getelementptr inbounds [10001 x i32], ptr @pre, i64 0, i64 %181
  %183 = load i32, ptr %182, align 4, !tbaa !9
  store i32 %183, ptr %8, align 4, !tbaa !9
  br label %163, !llvm.loop !19

184:                                              ; preds = %166
  %185 = load i32, ptr @n, align 4, !tbaa !9
  %186 = sext i32 %185 to i64
  %187 = getelementptr inbounds [10001 x i32], ptr @f, i64 0, i64 %186
  %188 = load i32, ptr %187, align 4, !tbaa !9
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds i32, ptr @ans, i64 %189
  call void @_ZSt4sortIPiSt7greaterIiEEvT_S3_T0_(ptr noundef @ans, ptr noundef %190)
  %191 = load i32, ptr @n, align 4, !tbaa !9
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds [10001 x i32], ptr @f, i64 0, i64 %192
  %194 = load i32, ptr %193, align 4, !tbaa !9
  %195 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %194)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %196

196:                                              ; preds = %221, %184
  %197 = load i32, ptr %10, align 4, !tbaa !9
  %198 = load i32, ptr @n, align 4, !tbaa !9
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds [10001 x i32], ptr @f, i64 0, i64 %199
  %201 = load i32, ptr %200, align 4, !tbaa !9
  %202 = icmp slt i32 %197, %201
  br i1 %202, label %204, label %203

203:                                              ; preds = %196
  store i32 19, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %224

204:                                              ; preds = %196
  %205 = load i32, ptr %10, align 4, !tbaa !9
  %206 = sext i32 %205 to i64
  %207 = getelementptr inbounds [10001 x i32], ptr @ans, i64 0, i64 %206
  %208 = load i32, ptr %207, align 4, !tbaa !9
  %209 = load i32, ptr %10, align 4, !tbaa !9
  %210 = load i32, ptr @n, align 4, !tbaa !9
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds [10001 x i32], ptr @f, i64 0, i64 %211
  %213 = load i32, ptr %212, align 4, !tbaa !9
  %214 = sub nsw i32 %213, 1
  %215 = icmp eq i32 %209, %214
  %216 = zext i1 %215 to i64
  %217 = getelementptr inbounds [3 x i8], ptr @.str.4, i64 0, i64 %216
  %218 = load i8, ptr %217, align 1, !tbaa !20
  %219 = sext i8 %218 to i32
  %220 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %208, i32 noundef %219)
  br label %221

221:                                              ; preds = %204
  %222 = load i32, ptr %10, align 4, !tbaa !9
  %223 = add nsw i32 %222, 1
  store i32 %223, ptr %10, align 4, !tbaa !9
  br label %196, !llvm.loop !21

224:                                              ; preds = %203
  br label %150, !llvm.loop !18

225:                                              ; preds = %150
  ret i32 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: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

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

declare i32 @puts(ptr noundef) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPiSt7greaterIiEEvT_S3_T0_(ptr noundef, ptr noundef) #4

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

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

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


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

@tot = external dso_local local_unnamed_addr global i32, align 4
@prime = external dso_local local_unnamed_addr global [10001 x i32], align 16
@n = external dso_local global i32, align 4
@c = external dso_local local_unnamed_addr global [211 x i32], align 16
@f = external dso_local local_unnamed_addr global [10001 x i32], align 16
@pre = external dso_local local_unnamed_addr global [10001 x i32], align 16
@ans = external dso_local global [10001 x i32], align 16
@vis = external dso_local local_unnamed_addr global [10001 x i8], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = 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 {
  store i8 1, ptr getelementptr inbounds (i8, ptr @vis, i64 1), align 1, !tbaa !5
  %tot.promoted = load i32, ptr @tot, align 4, !tbaa !9
  %n.promoted = load i32, ptr @n, align 4, !tbaa !9
  br label %21

1:                                                ; preds = %.critedge
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(40004) @f, i8 63, i64 40004, i1 false)
  store i32 0, ptr @f, align 16, !tbaa !9
  %2 = icmp sgt i32 %41, 0
  br i1 %2, label %.preheader47.us.preheader, label %.split57.us

.preheader47.us.preheader:                        ; preds = %1
  %wide.trip.count = zext nneg i32 %41 to i64
  br label %.preheader47.us

.preheader47.us:                                  ; preds = %.preheader47.us.preheader, %._crit_edge.us
  %indvars.iv77 = phi i64 [ 3, %.preheader47.us.preheader ], [ %indvars.iv.next78, %._crit_edge.us ]
  %3 = getelementptr inbounds [10001 x i32], ptr @f, i64 0, i64 %indvars.iv77
  %4 = getelementptr inbounds [10001 x i32], ptr @pre, i64 0, i64 %indvars.iv77
  %5 = trunc nuw nsw i64 %indvars.iv77 to i32
  br label %6

6:                                                ; preds = %.preheader47.us, %20
  %indvars.iv73 = phi i64 [ 0, %.preheader47.us ], [ %indvars.iv.next74, %20 ]
  %7 = getelementptr inbounds [211 x i32], ptr @c, i64 0, i64 %indvars.iv73
  %8 = load i32, ptr %7, align 4, !tbaa !9
  %9 = sext i32 %8 to i64
  %10 = icmp slt i64 %indvars.iv77, %9
  br i1 %10, label %._crit_edge.us, label %11

11:                                               ; preds = %6
  %12 = load i32, ptr %3, align 4, !tbaa !9
  %13 = sub nsw i32 %5, %8
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds [10001 x i32], ptr @f, i64 0, i64 %14
  %16 = load i32, ptr %15, align 4, !tbaa !9
  %17 = add nsw i32 %16, 1
  %18 = icmp sgt i32 %12, %17
  br i1 %18, label %19, label %20

19:                                               ; preds = %11
  store i32 %13, ptr %4, align 4, !tbaa !9
  store i32 %17, ptr %3, align 4, !tbaa !9
  br label %20

20:                                               ; preds = %19, %11
  %indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1
  %exitcond76.not = icmp eq i64 %indvars.iv.next74, %wide.trip.count
  br i1 %exitcond76.not, label %._crit_edge.us, label %6, !llvm.loop !11

._crit_edge.us:                                   ; preds = %20, %6
  %indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
  %exitcond80.not = icmp eq i64 %indvars.iv.next78, 10001
  br i1 %exitcond80.not, label %.split57.us, label %.preheader47.us, !llvm.loop !13

21:                                               ; preds = %0, %.critedge
  %indvars.iv70 = phi i64 [ 2, %0 ], [ %indvars.iv.next71, %.critedge ]
  %22 = phi i32 [ %tot.promoted, %0 ], [ %42, %.critedge ]
  %23 = phi i32 [ %n.promoted, %0 ], [ %41, %.critedge ]
  %24 = getelementptr inbounds [10001 x i8], ptr @vis, i64 0, i64 %indvars.iv70
  %25 = load i8, ptr %24, align 1, !tbaa !5, !range !14, !noundef !15
  %26 = trunc nuw i8 %25 to i1
  br i1 %26, label %40, label %27

27:                                               ; preds = %21
  %28 = add nsw i32 %22, 1
  store i32 %28, ptr @tot, align 4, !tbaa !9
  %29 = sext i32 %22 to i64
  %30 = getelementptr inbounds [10001 x i32], ptr @prime, i64 0, i64 %29
  %31 = trunc nuw nsw i64 %indvars.iv70 to i32
  store i32 %31, ptr %30, align 4, !tbaa !9
  %32 = sext i32 %28 to i64
  %33 = getelementptr inbounds [10001 x i8], ptr @vis, i64 0, i64 %32
  %34 = load i8, ptr %33, align 1, !tbaa !5, !range !14, !noundef !15
  %35 = trunc nuw i8 %34 to i1
  br i1 %35, label %40, label %36

36:                                               ; preds = %27
  %37 = add nsw i32 %23, 1
  store i32 %37, ptr @n, align 4, !tbaa !9
  %38 = sext i32 %23 to i64
  %39 = getelementptr inbounds [211 x i32], ptr @c, i64 0, i64 %38
  store i32 %31, ptr %39, align 4, !tbaa !9
  br label %40

40:                                               ; preds = %27, %36, %21
  %41 = phi i32 [ %23, %27 ], [ %37, %36 ], [ %23, %21 ]
  %42 = phi i32 [ %28, %27 ], [ %28, %36 ], [ %22, %21 ]
  %43 = icmp sgt i32 %42, 0
  br i1 %43, label %.lr.ph.preheader, label %.critedge

.lr.ph.preheader:                                 ; preds = %40
  %44 = zext nneg i32 %42 to i64
  %45 = trunc nuw nsw i64 %indvars.iv70 to i32
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %50
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %50 ]
  %46 = getelementptr inbounds [10001 x i32], ptr @prime, i64 0, i64 %indvars.iv
  %47 = load i32, ptr %46, align 4, !tbaa !9
  %48 = mul nsw i32 %47, %45
  %49 = icmp slt i32 %48, 10001
  br i1 %49, label %50, label %.critedge

50:                                               ; preds = %.lr.ph
  %51 = sext i32 %48 to i64
  %52 = getelementptr inbounds [10001 x i8], ptr @vis, i64 0, i64 %51
  store i8 1, ptr %52, align 1, !tbaa !5
  %53 = srem i32 %45, %47
  %54 = icmp ne i32 %53, 0
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %55 = icmp ult i64 %indvars.iv.next, %44
  %or.cond = select i1 %54, i1 %55, i1 false
  br i1 %or.cond, label %.lr.ph, label %.critedge, !llvm.loop !16

.critedge:                                        ; preds = %.lr.ph, %50, %40
  %indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next71, 10001
  br i1 %exitcond.not, label %1, label %21, !llvm.loop !17

.split57.us:                                      ; preds = %._crit_edge.us, %1
  store i32 1061109567, ptr @f, align 16, !tbaa !9
  %56 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %.not64 = icmp eq i32 %56, -1
  br i1 %.not64, label %._crit_edge67, label %.lr.ph66

.lr.ph66:                                         ; preds = %.split57.us, %.backedge
  %57 = load i32, ptr @n, align 4, !tbaa !9
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [10001 x i32], ptr @f, i64 0, i64 %58
  %60 = load i32, ptr %59, align 4, !tbaa !9
  %61 = icmp eq i32 %60, 1061109567
  br i1 %61, label %63, label %.preheader

.preheader:                                       ; preds = %.lr.ph66
  %62 = icmp sgt i32 %57, 0
  br i1 %62, label %.lr.ph60, label %._crit_edge

63:                                               ; preds = %.lr.ph66
  %64 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
  br label %.backedge

.backedge:                                        ; preds = %.lr.ph63, %._crit_edge, %63
  %65 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %.not = icmp eq i32 %65, -1
  br i1 %.not, label %._crit_edge67, label %.lr.ph66, !llvm.loop !18

._crit_edge:                                      ; preds = %.lr.ph60, %.preheader
  %66 = sext i32 %60 to i64
  %67 = getelementptr inbounds i32, ptr @ans, i64 %66
  tail call void @_ZSt4sortIPiSt7greaterIiEEvT_S3_T0_(ptr noundef nonnull @ans, ptr noundef nonnull %67)
  %68 = load i32, ptr @n, align 4, !tbaa !9
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [10001 x i32], ptr @f, i64 0, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !9
  %72 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %71)
  %73 = load i32, ptr @n, align 4, !tbaa !9
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [10001 x i32], ptr @f, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !9
  %77 = icmp sgt i32 %76, 0
  br i1 %77, label %.lr.ph63, label %.backedge, !llvm.loop !18

.lr.ph60:                                         ; preds = %.preheader, %.lr.ph60
  %indvars.iv81 = phi i64 [ %indvars.iv.next82, %.lr.ph60 ], [ 0, %.preheader ]
  %.03859 = phi i32 [ %80, %.lr.ph60 ], [ %57, %.preheader ]
  %78 = zext nneg i32 %.03859 to i64
  %79 = getelementptr inbounds [10001 x i32], ptr @pre, i64 0, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !9
  %81 = sub nsw i32 %.03859, %80
  %82 = getelementptr inbounds [10001 x i32], ptr @ans, i64 0, i64 %indvars.iv81
  store i32 %81, ptr %82, align 4, !tbaa !9
  %indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
  %83 = icmp sgt i32 %80, 0
  br i1 %83, label %.lr.ph60, label %._crit_edge, !llvm.loop !19

.lr.ph63:                                         ; preds = %._crit_edge, %.lr.ph63
  %indvars.iv84 = phi i64 [ %indvars.iv.next85, %.lr.ph63 ], [ 0, %._crit_edge ]
  %84 = phi i32 [ %98, %.lr.ph63 ], [ %76, %._crit_edge ]
  %85 = getelementptr inbounds [10001 x i32], ptr @ans, i64 0, i64 %indvars.iv84
  %86 = load i32, ptr %85, align 4, !tbaa !9
  %87 = add nsw i32 %84, -1
  %88 = zext i32 %87 to i64
  %89 = icmp eq i64 %indvars.iv84, %88
  %90 = zext i1 %89 to i64
  %91 = getelementptr inbounds [3 x i8], ptr @.str.4, i64 0, i64 %90
  %92 = load i8, ptr %91, align 1, !tbaa !20
  %93 = sext i8 %92 to i32
  %94 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %86, i32 noundef %93)
  %indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1
  %95 = load i32, ptr @n, align 4, !tbaa !9
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [10001 x i32], ptr @f, i64 0, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !9
  %99 = sext i32 %98 to i64
  %100 = icmp slt i64 %indvars.iv.next85, %99
  br i1 %100, label %.lr.ph63, label %.backedge, !llvm.loop !21

._crit_edge67:                                    ; preds = %.backedge, %.split57.us
  ret i32 0
}

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 @puts(ptr nocapture noundef readonly) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPiSt7greaterIiEEvT_S3_T0_(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 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 = !{!"bool", !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 = !{i8 0, i8 2}
!15 = !{}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = !{!7, !7, i64 0}
!21 = distinct !{!21, !12}


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