; LLVM IR from tangjz/acm-icpc :: usaco/Training/Chapter 2 Bigger challenges (prefix)

; 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
@len = external dso_local global i32, align 4
@seq = external dso_local global [201 x i64], align 16
@str = external dso_local global [200002 x i8], align 16
@f = external dso_local global [200002 x i8], align 16
@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.6 = 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 i64, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %9 = load ptr, ptr @stdin, align 8, !tbaa !5
  %10 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.1, ptr noundef %9)
  %11 = load ptr, ptr @stdout, align 8, !tbaa !5
  %12 = call ptr @freopen(ptr noundef @.str.2, ptr noundef @.str.3, ptr noundef %11)
  br label %13

13:                                               ; preds = %44, %0
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef @str)
  %15 = icmp eq i32 %14, 1
  br i1 %15, label %16, label %19

16:                                               ; preds = %13
  %17 = call i32 @strcmp(ptr noundef @str, ptr noundef @.str.5) #5
  %18 = icmp ne i32 %17, 0
  br label %19

19:                                               ; preds = %16, %13
  %20 = phi i1 [ false, %13 ], [ %18, %16 ]
  br i1 %20, label %21, label %50

21:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #6
  store i64 0, ptr %2, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 0, ptr %3, align 4, !tbaa !11
  br label %22

22:                                               ; preds = %41, %21
  %23 = load i32, ptr %3, align 4, !tbaa !11
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [200002 x i8], ptr @str, i64 0, i64 %24
  %26 = load i8, ptr %25, align 1, !tbaa !13
  %27 = icmp ne i8 %26, 0
  br i1 %27, label %29, label %28

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

29:                                               ; preds = %22
  %30 = load i64, ptr %2, align 8, !tbaa !9
  %31 = shl i64 %30, 5
  %32 = load i32, ptr %3, align 4, !tbaa !11
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [200002 x i8], ptr @str, i64 0, i64 %33
  %35 = load i8, ptr %34, align 1, !tbaa !13
  %36 = sext i8 %35 to i32
  %37 = sub nsw i32 %36, 65
  %38 = add nsw i32 %37, 1
  %39 = sext i32 %38 to i64
  %40 = or i64 %31, %39
  store i64 %40, ptr %2, align 8, !tbaa !9
  br label %41

41:                                               ; preds = %29
  %42 = load i32, ptr %3, align 4, !tbaa !11
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %3, align 4, !tbaa !11
  br label %22, !llvm.loop !14

44:                                               ; preds = %28
  %45 = load i64, ptr %2, align 8, !tbaa !9
  %46 = load i32, ptr @n, align 4, !tbaa !11
  %47 = add nsw i32 %46, 1
  store i32 %47, ptr @n, align 4, !tbaa !11
  %48 = sext i32 %46 to i64
  %49 = getelementptr inbounds [201 x i64], ptr @seq, i64 0, i64 %48
  store i64 %45, ptr %49, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  br label %13, !llvm.loop !16

50:                                               ; preds = %19
  %51 = load i32, ptr @n, align 4, !tbaa !11
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds i64, ptr @seq, i64 %52
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef @seq, ptr noundef %53)
  br label %54

54:                                               ; preds = %60, %50
  %55 = load i32, ptr @len, align 4, !tbaa !11
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds i8, ptr getelementptr inbounds (i8, ptr @str, i64 1), i64 %56
  %58 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef %57)
  %59 = icmp ne i32 %58, -1
  br i1 %59, label %60, label %69

60:                                               ; preds = %54
  %61 = load i32, ptr @len, align 4, !tbaa !11
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds i8, ptr getelementptr inbounds (i8, ptr @str, i64 1), i64 %62
  %64 = call i64 @strlen(ptr noundef %63) #5
  %65 = load i32, ptr @len, align 4, !tbaa !11
  %66 = sext i32 %65 to i64
  %67 = add i64 %66, %64
  %68 = trunc i64 %67 to i32
  store i32 %68, ptr @len, align 4, !tbaa !11
  br label %54, !llvm.loop !17

69:                                               ; preds = %54
  store i8 1, ptr @f, align 16, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 1, ptr %4, align 4, !tbaa !11
  br label %70

70:                                               ; preds = %130, %69
  %71 = load i32, ptr %4, align 4, !tbaa !11
  %72 = load i32, ptr @len, align 4, !tbaa !11
  %73 = icmp sle i32 %71, %72
  br i1 %73, label %75, label %74

74:                                               ; preds = %70
  store i32 9, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %133

75:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  store i64 0, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 1, ptr %7, align 4, !tbaa !11
  br label %76

76:                                               ; preds = %125, %75
  %77 = load i32, ptr %7, align 4, !tbaa !11
  %78 = icmp slt i32 %77, 11
  br i1 %78, label %79, label %83

79:                                               ; preds = %76
  %80 = load i32, ptr %7, align 4, !tbaa !11
  %81 = load i32, ptr %4, align 4, !tbaa !11
  %82 = icmp sle i32 %80, %81
  br label %83

83:                                               ; preds = %79, %76
  %84 = phi i1 [ false, %76 ], [ %82, %79 ]
  br i1 %84, label %86, label %85

85:                                               ; preds = %83
  store i32 12, ptr %5, align 4
  br label %128

86:                                               ; preds = %83
  %87 = load i32, ptr %4, align 4, !tbaa !11
  %88 = load i32, ptr %7, align 4, !tbaa !11
  %89 = sub nsw i32 %88, 1
  %90 = sub nsw i32 %87, %89
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [200002 x i8], ptr @str, i64 0, i64 %91
  %93 = load i8, ptr %92, align 1, !tbaa !13
  %94 = sext i8 %93 to i32
  %95 = sub nsw i32 %94, 65
  %96 = add nsw i32 %95, 1
  %97 = sext i32 %96 to i64
  %98 = load i32, ptr %7, align 4, !tbaa !11
  %99 = sub nsw i32 %98, 1
  %100 = mul nsw i32 5, %99
  %101 = zext i32 %100 to i64
  %102 = shl i64 %97, %101
  %103 = load i64, ptr %6, align 8, !tbaa !9
  %104 = or i64 %103, %102
  store i64 %104, ptr %6, align 8, !tbaa !9
  %105 = load i32, ptr %4, align 4, !tbaa !11
  %106 = load i32, ptr %7, align 4, !tbaa !11
  %107 = sub nsw i32 %105, %106
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [200002 x i8], ptr @f, i64 0, i64 %108
  %110 = load i8, ptr %109, align 1, !tbaa !18, !range !20, !noundef !21
  %111 = trunc i8 %110 to i1
  br i1 %111, label %112, label %124

112:                                              ; preds = %86
  %113 = load i32, ptr @n, align 4, !tbaa !11
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds i64, ptr @seq, i64 %114
  %116 = call noundef ptr @_ZSt11lower_boundIPxxET_S1_S1_RKT0_(ptr noundef @seq, ptr noundef %115, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %117 = load i64, ptr %116, align 8, !tbaa !9
  %118 = load i64, ptr %6, align 8, !tbaa !9
  %119 = icmp eq i64 %117, %118
  br i1 %119, label %120, label %124

120:                                              ; preds = %112
  %121 = load i32, ptr %4, align 4, !tbaa !11
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [200002 x i8], ptr @f, i64 0, i64 %122
  store i8 1, ptr %123, align 1, !tbaa !18
  store i32 12, ptr %5, align 4
  br label %128

124:                                              ; preds = %112, %86
  br label %125

125:                                              ; preds = %124
  %126 = load i32, ptr %7, align 4, !tbaa !11
  %127 = add nsw i32 %126, 1
  store i32 %127, ptr %7, align 4, !tbaa !11
  br label %76, !llvm.loop !22

128:                                              ; preds = %120, %85
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %129

129:                                              ; preds = %128
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  br label %130

130:                                              ; preds = %129
  %131 = load i32, ptr %4, align 4, !tbaa !11
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr %4, align 4, !tbaa !11
  br label %70, !llvm.loop !23

133:                                              ; preds = %74
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %134 = load i32, ptr @len, align 4, !tbaa !11
  store i32 %134, ptr %8, align 4, !tbaa !11
  br label %135

135:                                              ; preds = %149, %133
  %136 = load i32, ptr %8, align 4, !tbaa !11
  %137 = icmp sge i32 %136, 0
  br i1 %137, label %139, label %138

138:                                              ; preds = %135
  store i32 15, ptr %5, align 4
  br label %152

139:                                              ; preds = %135
  %140 = load i32, ptr %8, align 4, !tbaa !11
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [200002 x i8], ptr @f, i64 0, i64 %141
  %143 = load i8, ptr %142, align 1, !tbaa !18, !range !20, !noundef !21
  %144 = trunc i8 %143 to i1
  br i1 %144, label %145, label %148

145:                                              ; preds = %139
  %146 = load i32, ptr %8, align 4, !tbaa !11
  %147 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, i32 noundef %146)
  store i32 15, ptr %5, align 4
  br label %152

148:                                              ; preds = %139
  br label %149

149:                                              ; preds = %148
  %150 = load i32, ptr %8, align 4, !tbaa !11
  %151 = add nsw i32 %150, -1
  store i32 %151, ptr %8, align 4, !tbaa !11
  br label %135, !llvm.loop !24

152:                                              ; preds = %145, %138
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %153

153:                                              ; preds = %152
  ret i32 0
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) #1

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

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPxEvT_S1_(ptr noundef, ptr noundef) #4

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #2

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

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 = { nounwind willreturn memory(read) "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 willreturn memory(read) }
attributes #6 = { 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 = !{!"any pointer", !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 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = distinct !{!17, !15}
!18 = !{!19, !19, i64 0}
!19 = !{!"bool", !7, i64 0}
!20 = !{i8 0, i8 2}
!21 = !{}
!22 = distinct !{!22, !15}
!23 = distinct !{!23, !15}
!24 = distinct !{!24, !15}


; 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 local_unnamed_addr global i32, align 4
@len = external dso_local local_unnamed_addr global i32, align 4
@seq = external dso_local global [201 x i64], align 16
@str = external dso_local global [200002 x i8], align 16
@f = external dso_local local_unnamed_addr global [200002 x i8], align 16
@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i64, align 8
  %2 = load ptr, ptr @stdin, align 8, !tbaa !5
  %3 = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef %2)
  %4 = load ptr, ptr @stdout, align 8, !tbaa !5
  %5 = tail call ptr @freopen(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, ptr noundef %4)
  %6 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull @str)
  %7 = icmp eq i32 %6, 1
  br i1 %7, label %.lr.ph37, label %.critedge

.lr.ph37:                                         ; preds = %0, %._crit_edge
  %8 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) @str, ptr noundef nonnull dereferenceable(1) @.str.5) #7
  %.not = icmp eq i32 %8, 0
  br i1 %.not, label %.critedge, label %.preheader31

.preheader31:                                     ; preds = %.lr.ph37
  %9 = load i8, ptr @str, align 16, !tbaa !9
  %.not2933 = icmp eq i8 %9, 0
  br i1 %.not2933, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %.preheader31
  %.024.lcssa = phi i64 [ 0, %.preheader31 ], [ %20, %.lr.ph ]
  %10 = load i32, ptr @n, align 4, !tbaa !10
  %11 = add nsw i32 %10, 1
  store i32 %11, ptr @n, align 4, !tbaa !10
  %12 = sext i32 %10 to i64
  %13 = getelementptr inbounds [201 x i64], ptr @seq, i64 0, i64 %12
  store i64 %.024.lcssa, ptr %13, align 8, !tbaa !12
  %14 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull @str)
  %15 = icmp eq i32 %14, 1
  br i1 %15, label %.lr.ph37, label %.critedge, !llvm.loop !14

.lr.ph:                                           ; preds = %.preheader31, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.preheader31 ]
  %16 = phi i8 [ %22, %.lr.ph ], [ %9, %.preheader31 ]
  %.02434 = phi i64 [ %20, %.lr.ph ], [ 0, %.preheader31 ]
  %17 = shl i64 %.02434, 5
  %18 = sext i8 %16 to i64
  %19 = add nsw i64 %18, -64
  %20 = or i64 %19, %17
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %21 = getelementptr inbounds [200002 x i8], ptr @str, i64 0, i64 %indvars.iv.next
  %22 = load i8, ptr %21, align 1, !tbaa !9
  %.not29 = icmp eq i8 %22, 0
  br i1 %.not29, label %._crit_edge, label %.lr.ph, !llvm.loop !16

.critedge:                                        ; preds = %.lr.ph37, %._crit_edge, %0
  %23 = load i32, ptr @n, align 4, !tbaa !10
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds i64, ptr @seq, i64 %24
  tail call void @_ZSt4sortIPxEvT_S1_(ptr noundef nonnull @seq, ptr noundef nonnull %25)
  %26 = load i32, ptr @len, align 4, !tbaa !10
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds i8, ptr getelementptr inbounds (i8, ptr @str, i64 1), i64 %27
  %29 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %28)
  %.not2739 = icmp eq i32 %29, -1
  br i1 %.not2739, label %._crit_edge41, label %.lr.ph40

.lr.ph40:                                         ; preds = %.critedge, %.lr.ph40
  %30 = load i32, ptr @len, align 4, !tbaa !10
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds i8, ptr getelementptr inbounds (i8, ptr @str, i64 1), i64 %31
  %33 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %32) #7
  %34 = trunc i64 %33 to i32
  %35 = add i32 %30, %34
  store i32 %35, ptr @len, align 4, !tbaa !10
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds i8, ptr getelementptr inbounds (i8, ptr @str, i64 1), i64 %36
  %38 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %37)
  %.not27 = icmp eq i32 %38, -1
  br i1 %.not27, label %._crit_edge41, label %.lr.ph40, !llvm.loop !17

._crit_edge41:                                    ; preds = %.lr.ph40, %.critedge
  store i8 1, ptr @f, align 16, !tbaa !18
  %39 = load i32, ptr @len, align 4, !tbaa !10
  %.not2843 = icmp slt i32 %39, 1
  br i1 %.not2843, label %.preheader, label %.lr.ph46

.preheader:                                       ; preds = %.loopexit30, %._crit_edge41
  %.lcssa = phi i32 [ %39, %._crit_edge41 ], [ %70, %.loopexit30 ]
  %40 = icmp sgt i32 %.lcssa, -1
  br i1 %40, label %.lr.ph49.preheader, label %.loopexit

.lr.ph49.preheader:                               ; preds = %.preheader
  %41 = zext nneg i32 %.lcssa to i64
  br label %.lr.ph49

.lr.ph46:                                         ; preds = %._crit_edge41, %.loopexit30
  %indvars.iv58 = phi i64 [ %indvars.iv.next59, %.loopexit30 ], [ 1, %._crit_edge41 ]
  %indvars.iv56 = phi i32 [ %indvars.iv.next57, %.loopexit30 ], [ 0, %._crit_edge41 ]
  %umin = call i32 @llvm.umin.i32(i32 %indvars.iv56, i32 9)
  %42 = add nuw nsw i32 %umin, 2
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #8
  %wide.trip.count = zext nneg i32 %42 to i64
  br label %43

43:                                               ; preds = %.lr.ph46, %68
  %44 = phi i64 [ 0, %.lr.ph46 ], [ %69, %68 ]
  %indvars.iv53 = phi i64 [ 1, %.lr.ph46 ], [ %indvars.iv.next54, %68 ]
  %45 = add nsw i64 %indvars.iv53, -1
  %46 = sub nsw i64 %indvars.iv58, %45
  %47 = getelementptr inbounds [200002 x i8], ptr @str, i64 0, i64 %46
  %48 = load i8, ptr %47, align 1, !tbaa !9
  %49 = sext i8 %48 to i64
  %50 = add nsw i64 %49, -64
  %51 = mul nuw nsw i64 %45, 5
  %52 = shl i64 %50, %51
  %53 = or i64 %52, %44
  store i64 %53, ptr %1, align 8, !tbaa !12
  %54 = sub nsw i64 %indvars.iv58, %indvars.iv53
  %55 = getelementptr inbounds [200002 x i8], ptr @f, i64 0, i64 %54
  %56 = load i8, ptr %55, align 1, !tbaa !18, !range !20, !noundef !21
  %57 = trunc nuw i8 %56 to i1
  br i1 %57, label %58, label %68

58:                                               ; preds = %43
  %59 = load i32, ptr @n, align 4, !tbaa !10
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds i64, ptr @seq, i64 %60
  %62 = call noundef ptr @_ZSt11lower_boundIPxxET_S1_S1_RKT0_(ptr noundef nonnull @seq, ptr noundef nonnull %61, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %63 = load i64, ptr %62, align 8, !tbaa !12
  %64 = load i64, ptr %1, align 8, !tbaa !12
  %65 = icmp eq i64 %63, %64
  br i1 %65, label %66, label %68

66:                                               ; preds = %58
  %67 = getelementptr inbounds [200002 x i8], ptr @f, i64 0, i64 %indvars.iv58
  store i8 1, ptr %67, align 1, !tbaa !18
  br label %.loopexit30

68:                                               ; preds = %43, %58
  %69 = phi i64 [ %53, %43 ], [ %64, %58 ]
  %indvars.iv.next54 = add nuw nsw i64 %indvars.iv53, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next54, %wide.trip.count
  br i1 %exitcond.not, label %.loopexit30, label %43, !llvm.loop !22

.loopexit30:                                      ; preds = %68, %66
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #8
  %indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
  %70 = load i32, ptr @len, align 4, !tbaa !10
  %71 = sext i32 %70 to i64
  %.not28.not = icmp slt i64 %indvars.iv58, %71
  %indvars.iv.next57 = add nuw nsw i32 %indvars.iv56, 1
  br i1 %.not28.not, label %.lr.ph46, label %.preheader, !llvm.loop !23

.lr.ph49:                                         ; preds = %.lr.ph49.preheader, %78
  %indvars.iv61 = phi i64 [ %41, %.lr.ph49.preheader ], [ %indvars.iv.next62, %78 ]
  %72 = getelementptr inbounds [200002 x i8], ptr @f, i64 0, i64 %indvars.iv61
  %73 = load i8, ptr %72, align 1, !tbaa !18, !range !20, !noundef !21
  %74 = trunc nuw i8 %73 to i1
  br i1 %74, label %75, label %78

75:                                               ; preds = %.lr.ph49
  %76 = trunc nuw nsw i64 %indvars.iv61 to i32
  %77 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %76)
  br label %.loopexit

78:                                               ; preds = %.lr.ph49
  %indvars.iv.next62 = add nsw i64 %indvars.iv61, -1
  %79 = icmp sgt i64 %indvars.iv61, 0
  br i1 %79, label %.lr.ph49, label %.loopexit, !llvm.loop !24

.loopexit:                                        ; preds = %78, %.preheader, %75
  ret i32 0
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #3

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPxEvT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #5

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11lower_boundIPxxET_S1_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umin.i32(i32, i32) #6

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 = { 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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind willreturn memory(read) }
attributes #8 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = distinct !{!17, !15}
!18 = !{!19, !19, i64 0}
!19 = !{!"bool", !7, i64 0}
!20 = !{i8 0, i8 2}
!21 = !{}
!22 = distinct !{!22, !15}
!23 = distinct !{!23, !15}
!24 = distinct !{!24, !15}


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