; LLVM IR from tangjz/acm-icpc :: codeforces/complete (938A)

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

@len = external dso_local global i32, align 4
@buf = external dso_local global [101 x i8], align 16
@.str = external hidden unnamed_addr constant [6 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
  store i32 0, ptr %1, align 4
  %3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @buf)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %4

4:                                                ; preds = %37, %0
  %5 = load i32, ptr %2, align 4, !tbaa !5
  %6 = sext i32 %5 to i64
  %7 = getelementptr inbounds [101 x i8], ptr @buf, i64 0, i64 %6
  %8 = load i8, ptr %7, align 1, !tbaa !9
  %9 = icmp ne i8 %8, 0
  br i1 %9, label %11, label %10

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

11:                                               ; preds = %4
  %12 = load i32, ptr @len, align 4, !tbaa !5
  %13 = icmp ne i32 %12, 0
  br i1 %13, label %14, label %27

14:                                               ; preds = %11
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [101 x i8], ptr @buf, i64 0, i64 %16
  %18 = load i8, ptr %17, align 1, !tbaa !9
  %19 = call noundef zeroext i1 @_Z7isVowelc(i8 noundef signext %18)
  br i1 %19, label %20, label %27

20:                                               ; preds = %14
  %21 = load i32, ptr @len, align 4, !tbaa !5
  %22 = sub nsw i32 %21, 1
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [101 x i8], ptr @buf, i64 0, i64 %23
  %25 = load i8, ptr %24, align 1, !tbaa !9
  %26 = call noundef zeroext i1 @_Z7isVowelc(i8 noundef signext %25)
  br i1 %26, label %36, label %27

27:                                               ; preds = %20, %14, %11
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [101 x i8], ptr @buf, i64 0, i64 %29
  %31 = load i8, ptr %30, align 1, !tbaa !9
  %32 = load i32, ptr @len, align 4, !tbaa !5
  %33 = add nsw i32 %32, 1
  store i32 %33, ptr @len, align 4, !tbaa !5
  %34 = sext i32 %32 to i64
  %35 = getelementptr inbounds [101 x i8], ptr @buf, i64 0, i64 %34
  store i8 %31, ptr %35, align 1, !tbaa !9
  br label %36

36:                                               ; preds = %27, %20
  br label %37

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

40:                                               ; preds = %10
  %41 = load i32, ptr @len, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [101 x i8], ptr @buf, i64 0, i64 %42
  store i8 0, ptr %43, align 1, !tbaa !9
  %44 = call i32 @puts(ptr noundef @buf)
  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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z7isVowelc(i8 noundef signext) #3

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

declare i32 @puts(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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"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"

@len = external dso_local local_unnamed_addr global i32, align 4
@buf = external dso_local global [101 x i8], align 16
@.str = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @buf)
  %2 = load i8, ptr @buf, align 16, !tbaa !5
  %.not6 = icmp eq i8 %2, 0
  %.pre10 = load i32, ptr @len, align 4, !tbaa !8
  br i1 %.not6, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %24, %0
  %3 = phi i32 [ %.pre10, %0 ], [ %25, %24 ]
  %4 = sext i32 %3 to i64
  %5 = getelementptr inbounds [101 x i8], ptr @buf, i64 0, i64 %4
  store i8 0, ptr %5, align 1, !tbaa !5
  %6 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @buf)
  ret i32 0

.lr.ph:                                           ; preds = %0, %24
  %7 = phi i32 [ %25, %24 ], [ %.pre10, %0 ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %24 ], [ 0, %0 ]
  %8 = phi i8 [ %27, %24 ], [ %2, %0 ]
  %9 = phi ptr [ %26, %24 ], [ @buf, %0 ]
  %.not5 = icmp eq i32 %7, 0
  br i1 %.not5, label %18, label %10

10:                                               ; preds = %.lr.ph
  %11 = tail call noundef zeroext i1 @_Z7isVowelc(i8 noundef signext %8)
  %.pre9 = load i32, ptr @len, align 4, !tbaa !8
  br i1 %11, label %12, label %18

12:                                               ; preds = %10
  %13 = add nsw i32 %.pre9, -1
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds [101 x i8], ptr @buf, i64 0, i64 %14
  %16 = load i8, ptr %15, align 1, !tbaa !5
  %17 = tail call noundef zeroext i1 @_Z7isVowelc(i8 noundef signext %16)
  %.pre = load i32, ptr @len, align 4, !tbaa !8
  br i1 %17, label %24, label %18

18:                                               ; preds = %12, %10, %.lr.ph
  %19 = phi i32 [ %.pre, %12 ], [ %.pre9, %10 ], [ 0, %.lr.ph ]
  %20 = load i8, ptr %9, align 1, !tbaa !5
  %21 = add nsw i32 %19, 1
  store i32 %21, ptr @len, align 4, !tbaa !8
  %22 = sext i32 %19 to i64
  %23 = getelementptr inbounds [101 x i8], ptr @buf, i64 0, i64 %22
  store i8 %20, ptr %23, align 1, !tbaa !5
  br label %24

24:                                               ; preds = %12, %18
  %25 = phi i32 [ %.pre, %12 ], [ %21, %18 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %26 = getelementptr inbounds [101 x i8], ptr @buf, i64 0, i64 %indvars.iv.next
  %27 = load i8, ptr %26, align 1, !tbaa !5
  %.not = icmp eq i8 %27, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !10
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z7isVowelc(i8 noundef signext) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @puts(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 = { 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" }

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


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