; LLVM IR from DionysiosB/CodeForces :: 0001-0099 (80A-PanoramixsPrediction)

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

@__const.main.primes = external hidden unnamed_addr constant [15 x i32], align 16
@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = 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 [15 x i32], align 16
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i8, align 1
  %7 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 15, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 60, ptr %3) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %3, ptr align 16 @__const.main.primes, i64 60, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %4, ptr noundef %5)
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #4
  store i8 0, ptr %6, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %9

9:                                                ; preds = %30, %0
  %10 = load i32, ptr %7, align 4, !tbaa !5
  %11 = icmp slt i32 %10, 14
  br i1 %11, label %13, label %12

12:                                               ; preds = %9
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %33

13:                                               ; preds = %9
  %14 = load i32, ptr %4, align 4, !tbaa !5
  %15 = load i32, ptr %7, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [15 x i32], ptr %3, i64 0, i64 %16
  %18 = load i32, ptr %17, align 4, !tbaa !5
  %19 = icmp eq i32 %14, %18
  br i1 %19, label %20, label %29

20:                                               ; preds = %13
  %21 = load i32, ptr %5, align 4, !tbaa !5
  %22 = load i32, ptr %7, align 4, !tbaa !5
  %23 = add nsw i32 %22, 1
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [15 x i32], ptr %3, i64 0, i64 %24
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %27 = icmp eq i32 %21, %26
  br i1 %27, label %28, label %29

28:                                               ; preds = %20
  store i8 1, ptr %6, align 1, !tbaa !9
  br label %29

29:                                               ; preds = %28, %20, %13
  br label %30

30:                                               ; preds = %29
  %31 = load i32, ptr %7, align 4, !tbaa !5
  %32 = add nsw i32 %31, 1
  store i32 %32, ptr %7, align 4, !tbaa !5
  br label %9, !llvm.loop !11

33:                                               ; preds = %12
  %34 = load i8, ptr %6, align 1, !tbaa !9, !range !13, !noundef !14
  %35 = trunc i8 %34 to i1
  br i1 %35, label %36, label %38

36:                                               ; preds = %33
  %37 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  br label %40

38:                                               ; preds = %33
  %39 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  br label %40

40:                                               ; preds = %38, %36
  %41 = phi i32 [ %37, %36 ], [ %39, %38 ]
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 60, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

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

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

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: readwrite) }
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 = { 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 = !{!"bool", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{i8 0, i8 2}
!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"

@__const.main.primes = external hidden unnamed_addr constant [15 x i32], align 16
@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nofree norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #3
  %3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %4 = load i32, ptr %1, align 4, !tbaa !5
  %5 = load i32, ptr %2, align 4
  %6 = load i32, ptr @__const.main.primes, align 16, !tbaa !5
  %7 = icmp eq i32 %4, %6
  %.pre = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.primes, i64 4), align 4, !tbaa !5
  %8 = icmp eq i32 %5, %.pre
  %spec.select = select i1 %7, i1 %8, i1 false
  %9 = icmp eq i32 %4, %.pre
  %.pre8 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.primes, i64 8), align 8, !tbaa !5
  br i1 %9, label %10, label %12

10:                                               ; preds = %0
  %11 = icmp eq i32 %5, %.pre8
  %spec.select.1 = select i1 %11, i1 true, i1 %spec.select
  br label %12

12:                                               ; preds = %10, %0
  %.1.1 = phi i1 [ %spec.select, %0 ], [ %spec.select.1, %10 ]
  %13 = icmp eq i32 %4, %.pre8
  %.pre9 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.primes, i64 12), align 4, !tbaa !5
  br i1 %13, label %14, label %16

14:                                               ; preds = %12
  %15 = icmp eq i32 %5, %.pre9
  %spec.select.2 = select i1 %15, i1 true, i1 %.1.1
  br label %16

16:                                               ; preds = %14, %12
  %.1.2 = phi i1 [ %.1.1, %12 ], [ %spec.select.2, %14 ]
  %17 = icmp eq i32 %4, %.pre9
  %.pre10 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.primes, i64 16), align 16, !tbaa !5
  br i1 %17, label %18, label %20

18:                                               ; preds = %16
  %19 = icmp eq i32 %5, %.pre10
  %spec.select.3 = select i1 %19, i1 true, i1 %.1.2
  br label %20

20:                                               ; preds = %18, %16
  %.1.3 = phi i1 [ %.1.2, %16 ], [ %spec.select.3, %18 ]
  %21 = icmp eq i32 %4, %.pre10
  %.pre11 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.primes, i64 20), align 4, !tbaa !5
  br i1 %21, label %22, label %24

22:                                               ; preds = %20
  %23 = icmp eq i32 %5, %.pre11
  %spec.select.4 = select i1 %23, i1 true, i1 %.1.3
  br label %24

24:                                               ; preds = %22, %20
  %.1.4 = phi i1 [ %.1.3, %20 ], [ %spec.select.4, %22 ]
  %25 = icmp eq i32 %4, %.pre11
  %.pre12 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.primes, i64 24), align 8, !tbaa !5
  br i1 %25, label %26, label %28

26:                                               ; preds = %24
  %27 = icmp eq i32 %5, %.pre12
  %spec.select.5 = select i1 %27, i1 true, i1 %.1.4
  br label %28

28:                                               ; preds = %26, %24
  %.1.5 = phi i1 [ %.1.4, %24 ], [ %spec.select.5, %26 ]
  %29 = icmp eq i32 %4, %.pre12
  %.pre13 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.primes, i64 28), align 4, !tbaa !5
  br i1 %29, label %30, label %32

30:                                               ; preds = %28
  %31 = icmp eq i32 %5, %.pre13
  %spec.select.6 = select i1 %31, i1 true, i1 %.1.5
  br label %32

32:                                               ; preds = %30, %28
  %.1.6 = phi i1 [ %.1.5, %28 ], [ %spec.select.6, %30 ]
  %33 = icmp eq i32 %4, %.pre13
  %.pre14 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.primes, i64 32), align 16, !tbaa !5
  br i1 %33, label %34, label %36

34:                                               ; preds = %32
  %35 = icmp eq i32 %5, %.pre14
  %spec.select.7 = select i1 %35, i1 true, i1 %.1.6
  br label %36

36:                                               ; preds = %34, %32
  %.1.7 = phi i1 [ %.1.6, %32 ], [ %spec.select.7, %34 ]
  %37 = icmp eq i32 %4, %.pre14
  %.pre15 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.primes, i64 36), align 4, !tbaa !5
  br i1 %37, label %38, label %40

38:                                               ; preds = %36
  %39 = icmp eq i32 %5, %.pre15
  %spec.select.8 = select i1 %39, i1 true, i1 %.1.7
  br label %40

40:                                               ; preds = %38, %36
  %.1.8 = phi i1 [ %.1.7, %36 ], [ %spec.select.8, %38 ]
  %41 = icmp eq i32 %4, %.pre15
  %.pre16 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.primes, i64 40), align 8, !tbaa !5
  br i1 %41, label %42, label %44

42:                                               ; preds = %40
  %43 = icmp eq i32 %5, %.pre16
  %spec.select.9 = select i1 %43, i1 true, i1 %.1.8
  br label %44

44:                                               ; preds = %42, %40
  %.1.9 = phi i1 [ %.1.8, %40 ], [ %spec.select.9, %42 ]
  %45 = icmp eq i32 %4, %.pre16
  %.pre17 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.primes, i64 44), align 4, !tbaa !5
  br i1 %45, label %46, label %48

46:                                               ; preds = %44
  %47 = icmp eq i32 %5, %.pre17
  %spec.select.10 = select i1 %47, i1 true, i1 %.1.9
  br label %48

48:                                               ; preds = %46, %44
  %.1.10 = phi i1 [ %.1.9, %44 ], [ %spec.select.10, %46 ]
  %49 = icmp eq i32 %4, %.pre17
  %.pre18 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.primes, i64 48), align 16, !tbaa !5
  br i1 %49, label %50, label %52

50:                                               ; preds = %48
  %51 = icmp eq i32 %5, %.pre18
  %spec.select.11 = select i1 %51, i1 true, i1 %.1.10
  br label %52

52:                                               ; preds = %50, %48
  %.1.11 = phi i1 [ %.1.10, %48 ], [ %spec.select.11, %50 ]
  %53 = icmp eq i32 %4, %.pre18
  %.pre19 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.primes, i64 52), align 4, !tbaa !5
  br i1 %53, label %54, label %56

54:                                               ; preds = %52
  %55 = icmp eq i32 %5, %.pre19
  %spec.select.12 = select i1 %55, i1 true, i1 %.1.11
  br label %56

56:                                               ; preds = %54, %52
  %.1.12 = phi i1 [ %.1.11, %52 ], [ %spec.select.12, %54 ]
  %57 = icmp eq i32 %4, %.pre19
  br i1 %57, label %58, label %61

58:                                               ; preds = %56
  %59 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.primes, i64 56), align 8, !tbaa !5
  %60 = icmp eq i32 %5, %59
  %spec.select.13 = select i1 %60, i1 true, i1 %.1.12
  br i1 %spec.select.13, label %63, label %62

61:                                               ; preds = %56
  br i1 %.1.12, label %63, label %62

62:                                               ; preds = %58, %61
  br label %63

63:                                               ; preds = %61, %58, %62
  %.str.2.sink = phi ptr [ @.str.2, %62 ], [ @.str.1, %58 ], [ @.str.1, %61 ]
  %64 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #3
  ret i32 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: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

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

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

attributes #0 = { mustprogress nofree 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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"}


; Effective O3 passes: AggressiveInstCombinePass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass