; LLVM IR from Shah-Shishir/Codeforces-Solutions :: 682A. Alyona and Numbers (main)

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

@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3fixPyy(ptr noundef, i64 noundef) #0

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca [5 x i64], align 16
  %5 = alloca [5 x i64], align 16
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 40, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 40, ptr %5) #4
  br label %6

6:                                                ; preds = %9, %0
  %7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2, ptr noundef %3)
  %8 = icmp ne i32 %7, -1
  br i1 %8, label %9, label %45

9:                                                ; preds = %6
  %10 = getelementptr inbounds [5 x i64], ptr %4, i64 0, i64 0
  %11 = load i64, ptr %2, align 8, !tbaa !5
  call void @_Z3fixPyy(ptr noundef %10, i64 noundef %11)
  %12 = getelementptr inbounds [5 x i64], ptr %5, i64 0, i64 0
  %13 = load i64, ptr %3, align 8, !tbaa !5
  call void @_Z3fixPyy(ptr noundef %12, i64 noundef %13)
  %14 = getelementptr inbounds [5 x i64], ptr %4, i64 0, i64 0
  %15 = load i64, ptr %14, align 16, !tbaa !5
  %16 = getelementptr inbounds [5 x i64], ptr %5, i64 0, i64 0
  %17 = load i64, ptr %16, align 16, !tbaa !5
  %18 = mul i64 %15, %17
  %19 = getelementptr inbounds [5 x i64], ptr %4, i64 0, i64 1
  %20 = load i64, ptr %19, align 8, !tbaa !5
  %21 = getelementptr inbounds [5 x i64], ptr %5, i64 0, i64 4
  %22 = load i64, ptr %21, align 16, !tbaa !5
  %23 = mul i64 %20, %22
  %24 = add i64 %18, %23
  %25 = getelementptr inbounds [5 x i64], ptr %4, i64 0, i64 4
  %26 = load i64, ptr %25, align 16, !tbaa !5
  %27 = getelementptr inbounds [5 x i64], ptr %5, i64 0, i64 1
  %28 = load i64, ptr %27, align 8, !tbaa !5
  %29 = mul i64 %26, %28
  %30 = add i64 %24, %29
  %31 = getelementptr inbounds [5 x i64], ptr %4, i64 0, i64 3
  %32 = load i64, ptr %31, align 8, !tbaa !5
  %33 = getelementptr inbounds [5 x i64], ptr %5, i64 0, i64 2
  %34 = load i64, ptr %33, align 16, !tbaa !5
  %35 = mul i64 %32, %34
  %36 = add i64 %30, %35
  %37 = getelementptr inbounds [5 x i64], ptr %4, i64 0, i64 2
  %38 = load i64, ptr %37, align 16, !tbaa !5
  %39 = getelementptr inbounds [5 x i64], ptr %5, i64 0, i64 3
  %40 = load i64, ptr %39, align 8, !tbaa !5
  %41 = mul i64 %38, %40
  %42 = add i64 %36, %41
  store i64 %42, ptr %2, align 8, !tbaa !5
  %43 = load i64, ptr %2, align 8, !tbaa !5
  %44 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i64 noundef %43)
  br label %6, !llvm.loop !9

45:                                               ; preds = %6
  call void @llvm.lifetime.end.p0(i64 40, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #4
  ret i32 0
}

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

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3fixPyy(ptr noundef, i64 noundef) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca [5 x i64], align 16
  %4 = alloca [5 x i64], align 16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %3) #4
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %4) #4
  %5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %.not1 = icmp eq i32 %5, -1
  br i1 %.not1, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %0
  %6 = getelementptr inbounds i8, ptr %3, i64 8
  %7 = getelementptr inbounds i8, ptr %4, i64 32
  %8 = getelementptr inbounds i8, ptr %3, i64 32
  %9 = getelementptr inbounds i8, ptr %4, i64 8
  %10 = getelementptr inbounds i8, ptr %3, i64 24
  %11 = getelementptr inbounds i8, ptr %4, i64 16
  %12 = getelementptr inbounds i8, ptr %3, i64 16
  %13 = getelementptr inbounds i8, ptr %4, i64 24
  br label %14

14:                                               ; preds = %.lr.ph, %14
  %15 = load i64, ptr %1, align 8, !tbaa !5
  call void @_Z3fixPyy(ptr noundef nonnull %3, i64 noundef %15)
  %16 = load i64, ptr %2, align 8, !tbaa !5
  call void @_Z3fixPyy(ptr noundef nonnull %4, i64 noundef %16)
  %17 = load i64, ptr %3, align 16, !tbaa !5
  %18 = load i64, ptr %4, align 16, !tbaa !5
  %19 = mul i64 %18, %17
  %20 = load i64, ptr %6, align 8, !tbaa !5
  %21 = load i64, ptr %7, align 16, !tbaa !5
  %22 = mul i64 %21, %20
  %23 = add i64 %22, %19
  %24 = load i64, ptr %8, align 16, !tbaa !5
  %25 = load i64, ptr %9, align 8, !tbaa !5
  %26 = mul i64 %25, %24
  %27 = add i64 %23, %26
  %28 = load i64, ptr %10, align 8, !tbaa !5
  %29 = load i64, ptr %11, align 16, !tbaa !5
  %30 = mul i64 %29, %28
  %31 = add i64 %27, %30
  %32 = load i64, ptr %12, align 16, !tbaa !5
  %33 = load i64, ptr %13, align 8, !tbaa !5
  %34 = mul i64 %33, %32
  %35 = add i64 %31, %34
  store i64 %35, ptr %1, align 8, !tbaa !5
  %36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %35)
  %37 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %.not = icmp eq i32 %37, -1
  br i1 %.not, label %._crit_edge, label %14, !llvm.loop !9

._crit_edge:                                      ; preds = %14, %0
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #4
  ret i32 0
}

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

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass