; LLVM IR from tangjz/acm-icpc :: TDL_training/2015-10-05 (H - Hanoi Towers - tjz)

; 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
@way = external dso_local global [6 x [2 x i32]], align 16
@A = external dso_local global i64, align 8
@B = external dso_local global i64, align 8
@tmp = external dso_local global i64, align 8
@ans = external dso_local global i64, align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3dfsi(i32 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 i32, align 4
  %3 = alloca i8, align 1
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #5
  %4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %5

5:                                                ; preds = %38, %0
  %6 = load i32, ptr %2, align 4, !tbaa !5
  %7 = icmp slt i32 %6, 6
  br i1 %7, label %8, label %41

8:                                                ; preds = %5
  %9 = call i32 @getchar()
  %10 = trunc i32 %9 to i8
  store i8 %10, ptr %3, align 1, !tbaa !9
  br label %11

11:                                               ; preds = %21, %8
  %12 = load i8, ptr %3, align 1, !tbaa !9
  %13 = sext i8 %12 to i32
  %14 = icmp slt i32 %13, 65
  br i1 %14, label %19, label %15

15:                                               ; preds = %11
  %16 = load i8, ptr %3, align 1, !tbaa !9
  %17 = sext i8 %16 to i32
  %18 = icmp sgt i32 %17, 67
  br label %19

19:                                               ; preds = %15, %11
  %20 = phi i1 [ true, %11 ], [ %18, %15 ]
  br i1 %20, label %21, label %24

21:                                               ; preds = %19
  %22 = call i32 @getchar()
  %23 = trunc i32 %22 to i8
  store i8 %23, ptr %3, align 1, !tbaa !9
  br label %11, !llvm.loop !10

24:                                               ; preds = %19
  %25 = load i8, ptr %3, align 1, !tbaa !9
  %26 = sext i8 %25 to i32
  %27 = sub nsw i32 %26, 65
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [6 x [2 x i32]], ptr @way, i64 0, i64 %29
  %31 = getelementptr inbounds [2 x i32], ptr %30, i64 0, i64 0
  store i32 %27, ptr %31, align 8, !tbaa !5
  %32 = call i32 @getchar()
  %33 = sub nsw i32 %32, 65
  %34 = load i32, ptr %2, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [6 x [2 x i32]], ptr @way, i64 0, i64 %35
  %37 = getelementptr inbounds [2 x i32], ptr %36, i64 0, i64 1
  store i32 %33, ptr %37, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %24
  %39 = load i32, ptr %2, align 4, !tbaa !5
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %2, align 4, !tbaa !5
  br label %5, !llvm.loop !12

41:                                               ; preds = %5
  %42 = load i32, ptr @n, align 4, !tbaa !5
  %43 = icmp eq i32 %42, 1
  br i1 %43, label %44, label %46

44:                                               ; preds = %41
  %45 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  br label %89

46:                                               ; preds = %41
  %47 = load i32, ptr @n, align 4, !tbaa !5
  %48 = icmp sle i32 %47, 3
  br i1 %48, label %49, label %53

49:                                               ; preds = %46
  %50 = load i32, ptr @n, align 4, !tbaa !5
  %51 = call noundef i32 @_Z3dfsi(i32 noundef %50)
  %52 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %51)
  br label %88

53:                                               ; preds = %46
  %54 = call noundef i32 @_Z3dfsi(i32 noundef 2)
  %55 = sext i32 %54 to i64
  store i64 %55, ptr @tmp, align 8, !tbaa !13
  %56 = load i64, ptr @tmp, align 8, !tbaa !13
  %57 = icmp eq i64 %56, 5
  br i1 %57, label %58, label %59

58:                                               ; preds = %53
  store i64 17, ptr @ans, align 8, !tbaa !13
  br label %62

59:                                               ; preds = %53
  %60 = call noundef i32 @_Z3dfsi(i32 noundef 3)
  %61 = sext i32 %60 to i64
  store i64 %61, ptr @ans, align 8, !tbaa !13
  br label %62

62:                                               ; preds = %59, %58
  %63 = load i64, ptr @ans, align 8, !tbaa !13
  %64 = load i64, ptr @tmp, align 8, !tbaa !13
  %65 = sub nsw i64 %63, %64
  %66 = load i64, ptr @tmp, align 8, !tbaa !13
  %67 = sub nsw i64 %66, 1
  %68 = sdiv i64 %65, %67
  store i64 %68, ptr @A, align 8, !tbaa !13
  %69 = load i64, ptr @tmp, align 8, !tbaa !13
  %70 = load i64, ptr @A, align 8, !tbaa !13
  %71 = sub nsw i64 %69, %70
  store i64 %71, ptr @B, align 8, !tbaa !13
  store i32 4, ptr %2, align 4, !tbaa !5
  br label %72

72:                                               ; preds = %82, %62
  %73 = load i32, ptr %2, align 4, !tbaa !5
  %74 = load i32, ptr @n, align 4, !tbaa !5
  %75 = icmp sle i32 %73, %74
  br i1 %75, label %76, label %85

76:                                               ; preds = %72
  %77 = load i64, ptr @A, align 8, !tbaa !13
  %78 = load i64, ptr @ans, align 8, !tbaa !13
  %79 = mul nsw i64 %77, %78
  %80 = load i64, ptr @B, align 8, !tbaa !13
  %81 = add nsw i64 %79, %80
  store i64 %81, ptr @ans, align 8, !tbaa !13
  br label %82

82:                                               ; preds = %76
  %83 = load i32, ptr %2, align 4, !tbaa !5
  %84 = add nsw i32 %83, 1
  store i32 %84, ptr %2, align 4, !tbaa !5
  br label %72, !llvm.loop !15

85:                                               ; preds = %72
  %86 = load i64, ptr @ans, align 8, !tbaa !13
  %87 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i64 noundef %86)
  br label %88

88:                                               ; preds = %85, %49
  br label %89

89:                                               ; preds = %88, %44
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  ret i32 0
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare i32 @getchar() #4

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


; 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
@way = external dso_local local_unnamed_addr global [6 x [2 x i32]], align 16
@A = external dso_local local_unnamed_addr global i64, align 8
@B = external dso_local local_unnamed_addr global i64, align 8
@tmp = external dso_local local_unnamed_addr global i64, align 8
@ans = external dso_local local_unnamed_addr global i64, align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3dfsi(i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %2 = tail call i32 @getchar()
  %sext12 = shl i32 %2, 24
  %3 = ashr exact i32 %sext12, 24
  %4 = add nsw i32 %3, -68
  %5 = icmp ult i32 %4, -3
  br i1 %5, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %0, %.lr.ph
  %6 = tail call i32 @getchar()
  %sext = shl i32 %6, 24
  %7 = ashr exact i32 %sext, 24
  %8 = add nsw i32 %7, -68
  %9 = icmp ult i32 %8, -3
  br i1 %9, label %.lr.ph, label %._crit_edge, !llvm.loop !5

._crit_edge:                                      ; preds = %.lr.ph, %0
  %.lcssa = phi i32 [ %3, %0 ], [ %7, %.lr.ph ]
  %10 = add nsw i32 %.lcssa, -65
  store i32 %10, ptr @way, align 16, !tbaa !7
  %11 = tail call i32 @getchar()
  %12 = add nsw i32 %11, -65
  store i32 %12, ptr getelementptr inbounds (i8, ptr @way, i64 4), align 4, !tbaa !7
  %13 = tail call i32 @getchar()
  %sext12.1 = shl i32 %13, 24
  %14 = ashr exact i32 %sext12.1, 24
  %15 = add nsw i32 %14, -68
  %16 = icmp ult i32 %15, -3
  br i1 %16, label %.lr.ph.1, label %._crit_edge.1

.lr.ph.1:                                         ; preds = %._crit_edge, %.lr.ph.1
  %17 = tail call i32 @getchar()
  %sext.1 = shl i32 %17, 24
  %18 = ashr exact i32 %sext.1, 24
  %19 = add nsw i32 %18, -68
  %20 = icmp ult i32 %19, -3
  br i1 %20, label %.lr.ph.1, label %._crit_edge.1, !llvm.loop !5

._crit_edge.1:                                    ; preds = %.lr.ph.1, %._crit_edge
  %.lcssa.1 = phi i32 [ %14, %._crit_edge ], [ %18, %.lr.ph.1 ]
  %21 = add nsw i32 %.lcssa.1, -65
  store i32 %21, ptr getelementptr inbounds (i8, ptr @way, i64 8), align 8, !tbaa !7
  %22 = tail call i32 @getchar()
  %23 = add nsw i32 %22, -65
  store i32 %23, ptr getelementptr inbounds (i8, ptr @way, i64 12), align 4, !tbaa !7
  %24 = tail call i32 @getchar()
  %sext12.2 = shl i32 %24, 24
  %25 = ashr exact i32 %sext12.2, 24
  %26 = add nsw i32 %25, -68
  %27 = icmp ult i32 %26, -3
  br i1 %27, label %.lr.ph.2, label %._crit_edge.2

.lr.ph.2:                                         ; preds = %._crit_edge.1, %.lr.ph.2
  %28 = tail call i32 @getchar()
  %sext.2 = shl i32 %28, 24
  %29 = ashr exact i32 %sext.2, 24
  %30 = add nsw i32 %29, -68
  %31 = icmp ult i32 %30, -3
  br i1 %31, label %.lr.ph.2, label %._crit_edge.2, !llvm.loop !5

._crit_edge.2:                                    ; preds = %.lr.ph.2, %._crit_edge.1
  %.lcssa.2 = phi i32 [ %25, %._crit_edge.1 ], [ %29, %.lr.ph.2 ]
  %32 = add nsw i32 %.lcssa.2, -65
  store i32 %32, ptr getelementptr inbounds (i8, ptr @way, i64 16), align 16, !tbaa !7
  %33 = tail call i32 @getchar()
  %34 = add nsw i32 %33, -65
  store i32 %34, ptr getelementptr inbounds (i8, ptr @way, i64 20), align 4, !tbaa !7
  %35 = tail call i32 @getchar()
  %sext12.3 = shl i32 %35, 24
  %36 = ashr exact i32 %sext12.3, 24
  %37 = add nsw i32 %36, -68
  %38 = icmp ult i32 %37, -3
  br i1 %38, label %.lr.ph.3, label %._crit_edge.3

.lr.ph.3:                                         ; preds = %._crit_edge.2, %.lr.ph.3
  %39 = tail call i32 @getchar()
  %sext.3 = shl i32 %39, 24
  %40 = ashr exact i32 %sext.3, 24
  %41 = add nsw i32 %40, -68
  %42 = icmp ult i32 %41, -3
  br i1 %42, label %.lr.ph.3, label %._crit_edge.3, !llvm.loop !5

._crit_edge.3:                                    ; preds = %.lr.ph.3, %._crit_edge.2
  %.lcssa.3 = phi i32 [ %36, %._crit_edge.2 ], [ %40, %.lr.ph.3 ]
  %43 = add nsw i32 %.lcssa.3, -65
  store i32 %43, ptr getelementptr inbounds (i8, ptr @way, i64 24), align 8, !tbaa !7
  %44 = tail call i32 @getchar()
  %45 = add nsw i32 %44, -65
  store i32 %45, ptr getelementptr inbounds (i8, ptr @way, i64 28), align 4, !tbaa !7
  %46 = tail call i32 @getchar()
  %sext12.4 = shl i32 %46, 24
  %47 = ashr exact i32 %sext12.4, 24
  %48 = add nsw i32 %47, -68
  %49 = icmp ult i32 %48, -3
  br i1 %49, label %.lr.ph.4, label %._crit_edge.4

.lr.ph.4:                                         ; preds = %._crit_edge.3, %.lr.ph.4
  %50 = tail call i32 @getchar()
  %sext.4 = shl i32 %50, 24
  %51 = ashr exact i32 %sext.4, 24
  %52 = add nsw i32 %51, -68
  %53 = icmp ult i32 %52, -3
  br i1 %53, label %.lr.ph.4, label %._crit_edge.4, !llvm.loop !5

._crit_edge.4:                                    ; preds = %.lr.ph.4, %._crit_edge.3
  %.lcssa.4 = phi i32 [ %47, %._crit_edge.3 ], [ %51, %.lr.ph.4 ]
  %54 = add nsw i32 %.lcssa.4, -65
  store i32 %54, ptr getelementptr inbounds (i8, ptr @way, i64 32), align 16, !tbaa !7
  %55 = tail call i32 @getchar()
  %56 = add nsw i32 %55, -65
  store i32 %56, ptr getelementptr inbounds (i8, ptr @way, i64 36), align 4, !tbaa !7
  %57 = tail call i32 @getchar()
  %sext12.5 = shl i32 %57, 24
  %58 = ashr exact i32 %sext12.5, 24
  %59 = add nsw i32 %58, -68
  %60 = icmp ult i32 %59, -3
  br i1 %60, label %.lr.ph.5, label %._crit_edge.5

.lr.ph.5:                                         ; preds = %._crit_edge.4, %.lr.ph.5
  %61 = tail call i32 @getchar()
  %sext.5 = shl i32 %61, 24
  %62 = ashr exact i32 %sext.5, 24
  %63 = add nsw i32 %62, -68
  %64 = icmp ult i32 %63, -3
  br i1 %64, label %.lr.ph.5, label %._crit_edge.5, !llvm.loop !5

._crit_edge.5:                                    ; preds = %.lr.ph.5, %._crit_edge.4
  %.lcssa.5 = phi i32 [ %58, %._crit_edge.4 ], [ %62, %.lr.ph.5 ]
  %65 = add nsw i32 %.lcssa.5, -65
  store i32 %65, ptr getelementptr inbounds (i8, ptr @way, i64 40), align 8, !tbaa !7
  %66 = tail call i32 @getchar()
  %67 = add nsw i32 %66, -65
  store i32 %67, ptr getelementptr inbounds (i8, ptr @way, i64 44), align 4, !tbaa !7
  %68 = load i32, ptr @n, align 4, !tbaa !7
  %69 = icmp eq i32 %68, 1
  br i1 %69, label %70, label %72

70:                                               ; preds = %._crit_edge.5
  %71 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  br label %117

72:                                               ; preds = %._crit_edge.5
  %73 = icmp slt i32 %68, 4
  br i1 %73, label %74, label %77

74:                                               ; preds = %72
  %75 = tail call noundef i32 @_Z3dfsi(i32 noundef %68)
  %76 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %75)
  br label %117

77:                                               ; preds = %72
  %78 = tail call noundef i32 @_Z3dfsi(i32 noundef 2)
  %79 = sext i32 %78 to i64
  store i64 %79, ptr @tmp, align 8, !tbaa !11
  %80 = icmp eq i32 %78, 5
  br i1 %80, label %84, label %81

81:                                               ; preds = %77
  %82 = tail call noundef i32 @_Z3dfsi(i32 noundef 3)
  %83 = sext i32 %82 to i64
  %.pre = load i64, ptr @tmp, align 8, !tbaa !11
  br label %84

84:                                               ; preds = %77, %81
  %85 = phi i64 [ %.pre, %81 ], [ 5, %77 ]
  %storemerge = phi i64 [ %83, %81 ], [ 17, %77 ]
  store i64 %storemerge, ptr @ans, align 8, !tbaa !11
  %86 = sub nsw i64 %storemerge, %85
  %87 = add nsw i64 %85, -1
  %88 = sdiv i64 %86, %87
  store i64 %88, ptr @A, align 8, !tbaa !11
  %89 = sub nsw i64 %85, %88
  store i64 %89, ptr @B, align 8, !tbaa !11
  %90 = load i32, ptr @n, align 4, !tbaa !7
  %.not14 = icmp slt i32 %90, 4
  br i1 %.not14, label %114, label %.lr.ph17.preheader

.lr.ph17.preheader:                               ; preds = %84
  %91 = add nsw i32 %90, -3
  %92 = add nsw i32 %90, -4
  %xtraiter = and i32 %91, 7
  %93 = icmp ult i32 %92, 7
  br i1 %93, label %._crit_edge18.unr-lcssa, label %.lr.ph17.preheader.new

.lr.ph17.preheader.new:                           ; preds = %.lr.ph17.preheader
  %unroll_iter = and i32 %91, -8
  br label %.lr.ph17

.lr.ph17:                                         ; preds = %.lr.ph17, %.lr.ph17.preheader.new
  %94 = phi i64 [ %storemerge, %.lr.ph17.preheader.new ], [ %110, %.lr.ph17 ]
  %niter = phi i32 [ 0, %.lr.ph17.preheader.new ], [ %niter.next.7, %.lr.ph17 ]
  %95 = mul nsw i64 %94, %88
  %96 = add nsw i64 %95, %89
  %97 = mul nsw i64 %96, %88
  %98 = add nsw i64 %97, %89
  %99 = mul nsw i64 %98, %88
  %100 = add nsw i64 %99, %89
  %101 = mul nsw i64 %100, %88
  %102 = add nsw i64 %101, %89
  %103 = mul nsw i64 %102, %88
  %104 = add nsw i64 %103, %89
  %105 = mul nsw i64 %104, %88
  %106 = add nsw i64 %105, %89
  %107 = mul nsw i64 %106, %88
  %108 = add nsw i64 %107, %89
  %109 = mul nsw i64 %108, %88
  %110 = add nsw i64 %109, %89
  %niter.next.7 = add i32 %niter, 8
  %niter.ncmp.7 = icmp eq i32 %niter.next.7, %unroll_iter
  br i1 %niter.ncmp.7, label %._crit_edge18.unr-lcssa, label %.lr.ph17, !llvm.loop !13

._crit_edge18.unr-lcssa:                          ; preds = %.lr.ph17, %.lr.ph17.preheader
  %.lcssa37.ph = phi i64 [ poison, %.lr.ph17.preheader ], [ %110, %.lr.ph17 ]
  %.unr = phi i64 [ %storemerge, %.lr.ph17.preheader ], [ %110, %.lr.ph17 ]
  %lcmp.mod.not = icmp eq i32 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge18, label %.lr.ph17.epil

.lr.ph17.epil:                                    ; preds = %._crit_edge18.unr-lcssa, %.lr.ph17.epil
  %111 = phi i64 [ %113, %.lr.ph17.epil ], [ %.unr, %._crit_edge18.unr-lcssa ]
  %epil.iter = phi i32 [ %epil.iter.next, %.lr.ph17.epil ], [ 0, %._crit_edge18.unr-lcssa ]
  %112 = mul nsw i64 %111, %88
  %113 = add nsw i64 %112, %89
  %epil.iter.next = add i32 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge18, label %.lr.ph17.epil, !llvm.loop !14

._crit_edge18:                                    ; preds = %.lr.ph17.epil, %._crit_edge18.unr-lcssa
  %.lcssa37 = phi i64 [ %.lcssa37.ph, %._crit_edge18.unr-lcssa ], [ %113, %.lr.ph17.epil ]
  store i64 %.lcssa37, ptr @ans, align 8, !tbaa !11
  br label %114

114:                                              ; preds = %._crit_edge18, %84
  %115 = phi i64 [ %.lcssa37, %._crit_edge18 ], [ %storemerge, %84 ]
  %116 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %115)
  br label %117

117:                                              ; preds = %74, %114, %70
  ret i32 0
}

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

; Function Attrs: inlinehint mustprogress nofree nounwind uwtable
declare noundef i32 @getchar() local_unnamed_addr #3

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

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


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