; LLVM IR from tangjz/acm-icpc :: codeforces/complete (1091F)

; 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
@a = external dso_local global [1000001 x i64], align 16
@c = external dso_local global [3 x i64], align 16
@ans = external dso_local global i64, align 8
@s = external dso_local global [1000001 x i8], align 16
@v = external dso_local global [3 x i8], align 1
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [7 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 i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %9

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

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

14:                                               ; preds = %9
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds i64, ptr @a, i64 %16
  %18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %17)
  br label %19

19:                                               ; preds = %14
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = add nsw i32 %20, 1
  store i32 %21, ptr %2, align 4, !tbaa !5
  br label %9, !llvm.loop !9

22:                                               ; preds = %13
  %23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef @s)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %145, %22
  %25 = load i32, ptr %3, align 4, !tbaa !5
  %26 = load i32, ptr @n, align 4, !tbaa !5
  %27 = icmp slt i32 %25, %26
  br i1 %27, label %29, label %28

28:                                               ; preds = %24
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %148

29:                                               ; preds = %24
  %30 = load i32, ptr %3, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [1000001 x i8], ptr @s, i64 0, i64 %31
  %33 = load i8, ptr %32, align 1, !tbaa !11
  %34 = sext i8 %33 to i32
  %35 = icmp eq i32 %34, 87
  br i1 %35, label %36, label %50

36:                                               ; preds = %29
  %37 = load i32, ptr %3, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [1000001 x i64], ptr @a, i64 0, i64 %38
  %40 = load i64, ptr %39, align 8, !tbaa !12
  %41 = mul nsw i64 %40, 2
  %42 = load i64, ptr @ans, align 8, !tbaa !12
  %43 = add nsw i64 %42, %41
  store i64 %43, ptr @ans, align 8, !tbaa !12
  %44 = load i32, ptr %3, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [1000001 x i64], ptr @a, i64 0, i64 %45
  %47 = load i64, ptr %46, align 8, !tbaa !12
  %48 = load i64, ptr getelementptr inbounds ([3 x i64], ptr @c, i64 0, i64 1), align 8, !tbaa !12
  %49 = add nsw i64 %48, %47
  store i64 %49, ptr getelementptr inbounds ([3 x i64], ptr @c, i64 0, i64 1), align 8, !tbaa !12
  store i8 1, ptr getelementptr inbounds ([3 x i8], ptr @v, i64 0, i64 1), align 1, !tbaa !14
  br label %144

50:                                               ; preds = %29
  %51 = load i32, ptr %3, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [1000001 x i8], ptr @s, i64 0, i64 %52
  %54 = load i8, ptr %53, align 1, !tbaa !11
  %55 = sext i8 %54 to i32
  %56 = icmp eq i32 %55, 71
  br i1 %56, label %57, label %84

57:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %58 = load i32, ptr %3, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [1000001 x i64], ptr @a, i64 0, i64 %59
  %61 = load i64, ptr %60, align 8, !tbaa !12
  store i64 %61, ptr %4, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %62 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) getelementptr inbounds ([3 x i64], ptr @c, i64 0, i64 1))
  %63 = load i64, ptr %62, align 8, !tbaa !12
  store i64 %63, ptr %5, align 8, !tbaa !12
  %64 = load i64, ptr %5, align 8, !tbaa !12
  %65 = mul nsw i64 %64, 2
  %66 = load i64, ptr @ans, align 8, !tbaa !12
  %67 = add nsw i64 %66, %65
  store i64 %67, ptr @ans, align 8, !tbaa !12
  %68 = load i64, ptr %5, align 8, !tbaa !12
  %69 = load i64, ptr %4, align 8, !tbaa !12
  %70 = sub nsw i64 %69, %68
  store i64 %70, ptr %4, align 8, !tbaa !12
  %71 = load i64, ptr %5, align 8, !tbaa !12
  %72 = load i64, ptr getelementptr inbounds ([3 x i64], ptr @c, i64 0, i64 1), align 8, !tbaa !12
  %73 = sub nsw i64 %72, %71
  store i64 %73, ptr getelementptr inbounds ([3 x i64], ptr @c, i64 0, i64 1), align 8, !tbaa !12
  %74 = load i64, ptr %5, align 8, !tbaa !12
  %75 = load i64, ptr @c, align 16, !tbaa !12
  %76 = add nsw i64 %75, %74
  store i64 %76, ptr @c, align 16, !tbaa !12
  %77 = load i64, ptr %4, align 8, !tbaa !12
  %78 = mul nsw i64 %77, 3
  %79 = load i64, ptr @ans, align 8, !tbaa !12
  %80 = add nsw i64 %79, %78
  store i64 %80, ptr @ans, align 8, !tbaa !12
  %81 = load i64, ptr %4, align 8, !tbaa !12
  %82 = load i64, ptr getelementptr inbounds ([3 x i64], ptr @c, i64 0, i64 2), align 16, !tbaa !12
  %83 = add nsw i64 %82, %81
  store i64 %83, ptr getelementptr inbounds ([3 x i64], ptr @c, i64 0, i64 2), align 16, !tbaa !12
  store i8 1, ptr getelementptr inbounds ([3 x i8], ptr @v, i64 0, i64 2), align 1, !tbaa !14
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  br label %143

84:                                               ; preds = %50
  %85 = load i32, ptr %3, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [1000001 x i64], ptr @a, i64 0, i64 %86
  %88 = load i64, ptr %87, align 8, !tbaa !12
  %89 = load i64, ptr @ans, align 8, !tbaa !12
  %90 = add nsw i64 %89, %88
  store i64 %90, ptr @ans, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %91 = load i32, ptr %3, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [1000001 x i64], ptr @a, i64 0, i64 %92
  %94 = load i64, ptr %93, align 8, !tbaa !12
  store i64 %94, ptr %6, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %95 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) getelementptr inbounds ([3 x i64], ptr @c, i64 0, i64 1))
  %96 = load i64, ptr %95, align 8, !tbaa !12
  store i64 %96, ptr %7, align 8, !tbaa !12
  %97 = load i64, ptr %7, align 8, !tbaa !12
  %98 = load i64, ptr @ans, align 8, !tbaa !12
  %99 = add nsw i64 %98, %97
  store i64 %99, ptr @ans, align 8, !tbaa !12
  %100 = load i64, ptr %7, align 8, !tbaa !12
  %101 = load i64, ptr %6, align 8, !tbaa !12
  %102 = sub nsw i64 %101, %100
  store i64 %102, ptr %6, align 8, !tbaa !12
  %103 = load i64, ptr %7, align 8, !tbaa !12
  %104 = load i64, ptr getelementptr inbounds ([3 x i64], ptr @c, i64 0, i64 1), align 8, !tbaa !12
  %105 = sub nsw i64 %104, %103
  store i64 %105, ptr getelementptr inbounds ([3 x i64], ptr @c, i64 0, i64 1), align 8, !tbaa !12
  %106 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) @c)
  %107 = load i64, ptr %106, align 8, !tbaa !12
  store i64 %107, ptr %7, align 8, !tbaa !12
  %108 = load i64, ptr %7, align 8, !tbaa !12
  %109 = mul nsw i64 %108, 2
  %110 = load i64, ptr @ans, align 8, !tbaa !12
  %111 = add nsw i64 %110, %109
  store i64 %111, ptr @ans, align 8, !tbaa !12
  %112 = load i64, ptr %7, align 8, !tbaa !12
  %113 = load i64, ptr %6, align 8, !tbaa !12
  %114 = sub nsw i64 %113, %112
  store i64 %114, ptr %6, align 8, !tbaa !12
  %115 = load i64, ptr %7, align 8, !tbaa !12
  %116 = load i64, ptr @c, align 16, !tbaa !12
  %117 = sub nsw i64 %116, %115
  store i64 %117, ptr @c, align 16, !tbaa !12
  %118 = load i64, ptr %7, align 8, !tbaa !12
  %119 = load i64, ptr getelementptr inbounds ([3 x i64], ptr @c, i64 0, i64 2), align 16, !tbaa !12
  %120 = add nsw i64 %119, %118
  store i64 %120, ptr getelementptr inbounds ([3 x i64], ptr @c, i64 0, i64 2), align 16, !tbaa !12
  %121 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) getelementptr inbounds ([3 x i64], ptr @c, i64 0, i64 2))
  %122 = load i64, ptr %121, align 8, !tbaa !12
  store i64 %122, ptr %7, align 8, !tbaa !12
  %123 = load i64, ptr %7, align 8, !tbaa !12
  %124 = mul nsw i64 %123, 2
  %125 = load i64, ptr @ans, align 8, !tbaa !12
  %126 = add nsw i64 %125, %124
  store i64 %126, ptr @ans, align 8, !tbaa !12
  %127 = load i64, ptr %7, align 8, !tbaa !12
  %128 = load i64, ptr %6, align 8, !tbaa !12
  %129 = sub nsw i64 %128, %127
  store i64 %129, ptr %6, align 8, !tbaa !12
  %130 = load i64, ptr %7, align 8, !tbaa !12
  %131 = load i64, ptr getelementptr inbounds ([3 x i64], ptr @c, i64 0, i64 2), align 16, !tbaa !12
  %132 = sub nsw i64 %131, %130
  store i64 %132, ptr getelementptr inbounds ([3 x i64], ptr @c, i64 0, i64 2), align 16, !tbaa !12
  %133 = load i8, ptr getelementptr inbounds ([3 x i8], ptr @v, i64 0, i64 1), align 1, !tbaa !14, !range !16, !noundef !17
  %134 = trunc i8 %133 to i1
  %135 = zext i1 %134 to i64
  %136 = select i1 %134, i32 3, i32 5
  %137 = sext i32 %136 to i64
  store i64 %137, ptr %7, align 8, !tbaa !12
  %138 = load i64, ptr %6, align 8, !tbaa !12
  %139 = load i64, ptr %7, align 8, !tbaa !12
  %140 = mul nsw i64 %138, %139
  %141 = load i64, ptr @ans, align 8, !tbaa !12
  %142 = add nsw i64 %141, %140
  store i64 %142, ptr @ans, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  br label %143

143:                                              ; preds = %84, %57
  br label %144

144:                                              ; preds = %143, %36
  br label %145

145:                                              ; preds = %144
  %146 = load i32, ptr %3, align 4, !tbaa !5
  %147 = add nsw i32 %146, 1
  store i32 %147, ptr %3, align 4, !tbaa !5
  br label %24, !llvm.loop !18

148:                                              ; preds = %28
  %149 = load i64, ptr @ans, align 8, !tbaa !12
  %150 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i64 noundef %149)
  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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #3

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

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 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = distinct !{!18, !10}


; 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
@a = external dso_local global [1000001 x i64], align 16
@c = external dso_local global [3 x i64], align 16
@ans = external dso_local local_unnamed_addr global i64, align 8
@s = external dso_local global [1000001 x i8], align 16
@v = external dso_local local_unnamed_addr global [3 x i8], align 1
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %4 = load i32, ptr @n, align 4, !tbaa !5
  %5 = icmp sgt i32 %4, 0
  br i1 %5, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  %6 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull @s)
  %7 = load i32, ptr @n, align 4, !tbaa !5
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %.lr.ph32, label %._crit_edge.._crit_edge33_crit_edge

._crit_edge.._crit_edge33_crit_edge:              ; preds = %._crit_edge
  %.pre = load i64, ptr @ans, align 8, !tbaa !9
  br label %._crit_edge33

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %9 = getelementptr inbounds i64, ptr @a, i64 %indvars.iv
  %10 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %9)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %11 = load i32, ptr @n, align 4, !tbaa !5
  %12 = sext i32 %11 to i64
  %13 = icmp slt i64 %indvars.iv.next, %12
  br i1 %13, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge33:                                    ; preds = %82, %._crit_edge.._crit_edge33_crit_edge
  %14 = phi i64 [ %.pre, %._crit_edge.._crit_edge33_crit_edge ], [ %83, %82 ]
  %15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %14)
  ret i32 0

.lr.ph32:                                         ; preds = %._crit_edge, %82
  %indvars.iv35 = phi i64 [ %indvars.iv.next36, %82 ], [ 0, %._crit_edge ]
  %16 = getelementptr inbounds [1000001 x i8], ptr @s, i64 0, i64 %indvars.iv35
  %17 = load i8, ptr %16, align 1, !tbaa !13
  switch i8 %17, label %44 [
    i8 87, label %18
    i8 71, label %26
  ]

18:                                               ; preds = %.lr.ph32
  %19 = getelementptr inbounds [1000001 x i64], ptr @a, i64 0, i64 %indvars.iv35
  %20 = load i64, ptr %19, align 8, !tbaa !9
  %21 = shl nsw i64 %20, 1
  %22 = load i64, ptr @ans, align 8, !tbaa !9
  %23 = add nsw i64 %22, %21
  store i64 %23, ptr @ans, align 8, !tbaa !9
  %24 = load i64, ptr getelementptr inbounds (i8, ptr @c, i64 8), align 8, !tbaa !9
  %25 = add nsw i64 %24, %20
  store i64 %25, ptr getelementptr inbounds (i8, ptr @c, i64 8), align 8, !tbaa !9
  store i8 1, ptr getelementptr inbounds (i8, ptr @v, i64 1), align 1, !tbaa !14
  br label %82

26:                                               ; preds = %.lr.ph32
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #4
  %27 = getelementptr inbounds [1000001 x i64], ptr @a, i64 0, i64 %indvars.iv35
  %28 = load i64, ptr %27, align 8, !tbaa !9
  store i64 %28, ptr %1, align 8, !tbaa !9
  %29 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) getelementptr inbounds (i8, ptr @c, i64 8))
  %30 = load i64, ptr %29, align 8, !tbaa !9
  %31 = shl nsw i64 %30, 1
  %32 = load i64, ptr @ans, align 8, !tbaa !9
  %33 = add nsw i64 %32, %31
  %34 = load i64, ptr %1, align 8, !tbaa !9
  %35 = sub nsw i64 %34, %30
  %36 = load i64, ptr getelementptr inbounds (i8, ptr @c, i64 8), align 8, !tbaa !9
  %37 = sub nsw i64 %36, %30
  store i64 %37, ptr getelementptr inbounds (i8, ptr @c, i64 8), align 8, !tbaa !9
  %38 = load i64, ptr @c, align 16, !tbaa !9
  %39 = add nsw i64 %38, %30
  store i64 %39, ptr @c, align 16, !tbaa !9
  %40 = mul nsw i64 %35, 3
  %41 = add nsw i64 %40, %33
  store i64 %41, ptr @ans, align 8, !tbaa !9
  %42 = load i64, ptr getelementptr inbounds (i8, ptr @c, i64 16), align 16, !tbaa !9
  %43 = add nsw i64 %42, %35
  store i64 %43, ptr getelementptr inbounds (i8, ptr @c, i64 16), align 16, !tbaa !9
  store i8 1, ptr getelementptr inbounds (i8, ptr @v, i64 2), align 1, !tbaa !14
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #4
  br label %82

44:                                               ; preds = %.lr.ph32
  %45 = getelementptr inbounds [1000001 x i64], ptr @a, i64 0, i64 %indvars.iv35
  %46 = load i64, ptr %45, align 8, !tbaa !9
  %47 = load i64, ptr @ans, align 8, !tbaa !9
  %48 = add nsw i64 %47, %46
  store i64 %48, ptr @ans, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #4
  store i64 %46, ptr %2, align 8, !tbaa !9
  %49 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) getelementptr inbounds (i8, ptr @c, i64 8))
  %50 = load i64, ptr %49, align 8, !tbaa !9
  %51 = load i64, ptr @ans, align 8, !tbaa !9
  %52 = add nsw i64 %51, %50
  store i64 %52, ptr @ans, align 8, !tbaa !9
  %53 = load i64, ptr %2, align 8, !tbaa !9
  %54 = sub nsw i64 %53, %50
  store i64 %54, ptr %2, align 8, !tbaa !9
  %55 = load i64, ptr getelementptr inbounds (i8, ptr @c, i64 8), align 8, !tbaa !9
  %56 = sub nsw i64 %55, %50
  store i64 %56, ptr getelementptr inbounds (i8, ptr @c, i64 8), align 8, !tbaa !9
  %57 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) @c)
  %58 = load i64, ptr %57, align 8, !tbaa !9
  %59 = shl nsw i64 %58, 1
  %60 = load i64, ptr @ans, align 8, !tbaa !9
  %61 = add nsw i64 %60, %59
  store i64 %61, ptr @ans, align 8, !tbaa !9
  %62 = load i64, ptr %2, align 8, !tbaa !9
  %63 = sub nsw i64 %62, %58
  store i64 %63, ptr %2, align 8, !tbaa !9
  %64 = load i64, ptr @c, align 16, !tbaa !9
  %65 = sub nsw i64 %64, %58
  store i64 %65, ptr @c, align 16, !tbaa !9
  %66 = load i64, ptr getelementptr inbounds (i8, ptr @c, i64 16), align 16, !tbaa !9
  %67 = add nsw i64 %66, %58
  store i64 %67, ptr getelementptr inbounds (i8, ptr @c, i64 16), align 16, !tbaa !9
  %68 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) getelementptr inbounds (i8, ptr @c, i64 16))
  %69 = load i64, ptr %68, align 8, !tbaa !9
  %70 = shl nsw i64 %69, 1
  %71 = load i64, ptr @ans, align 8, !tbaa !9
  %72 = add nsw i64 %71, %70
  %73 = load i64, ptr %2, align 8, !tbaa !9
  %74 = sub nsw i64 %73, %69
  %75 = load i64, ptr getelementptr inbounds (i8, ptr @c, i64 16), align 16, !tbaa !9
  %76 = sub nsw i64 %75, %69
  store i64 %76, ptr getelementptr inbounds (i8, ptr @c, i64 16), align 16, !tbaa !9
  %77 = load i8, ptr getelementptr inbounds (i8, ptr @v, i64 1), align 1, !tbaa !14, !range !16, !noundef !17
  %78 = trunc nuw i8 %77 to i1
  %79 = select i1 %78, i64 3, i64 5
  %80 = mul nsw i64 %79, %74
  %81 = add nsw i64 %80, %72
  store i64 %81, ptr @ans, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  br label %82

82:                                               ; preds = %18, %44, %26
  %83 = phi i64 [ %23, %18 ], [ %81, %44 ], [ %41, %26 ]
  %indvars.iv.next36 = add nuw nsw i64 %indvars.iv35, 1
  %84 = load i32, ptr @n, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = icmp slt i64 %indvars.iv.next36, %85
  br i1 %86, label %.lr.ph32, label %._crit_edge33, !llvm.loop !18
}

; 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3

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

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 = { inlinehint 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 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = distinct !{!18, !12}


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