; LLVM IR from KSkun/OI-Templates :: string (suffix_automaton)

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

%struct.SuffixAutomaton = type { i32, i32, [2000010 x [26 x i32]], [2000010 x i32], [2000010 x i32], [2000010 x i32] }

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

11:                                               ; preds = %25, %0
  %12 = load i32, ptr %2, align 4, !tbaa !5
  %13 = sext i32 %12 to i64
  %14 = getelementptr inbounds [1000005 x i8], ptr @s, i64 0, i64 %13
  %15 = load i8, ptr %14, align 1, !tbaa !9
  %16 = icmp ne i8 %15, 0
  br i1 %16, label %18, label %17

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

18:                                               ; preds = %11
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [1000005 x i8], ptr @s, i64 0, i64 %20
  %22 = load i8, ptr %21, align 1, !tbaa !9
  %23 = sext i8 %22 to i32
  %24 = sub nsw i32 %23, 97
  call void @_ZN15SuffixAutomaton6extendEi(ptr noundef nonnull align 4 dereferenceable(232001168) @sam, i32 noundef %24)
  br label %25

25:                                               ; preds = %18
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = add nsw i32 %26, 1
  store i32 %27, ptr %2, align 4, !tbaa !5
  br label %11, !llvm.loop !10

28:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  store i64 0, ptr %3, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %43, %28
  %30 = load i32, ptr %4, align 4, !tbaa !5
  %31 = load i32, ptr getelementptr inbounds (%struct.SuffixAutomaton, ptr @sam, i32 0, i32 1), align 4, !tbaa !14
  %32 = icmp sle i32 %30, %31
  br i1 %32, label %34, label %33

33:                                               ; preds = %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %46

34:                                               ; preds = %29
  %35 = load i32, ptr %4, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [2000010 x i32], ptr getelementptr inbounds (%struct.SuffixAutomaton, ptr @sam, i32 0, i32 4), i64 0, i64 %36
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [2000010 x i32], ptr @c, i64 0, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %40, align 4, !tbaa !5
  br label %43

43:                                               ; preds = %34
  %44 = load i32, ptr %4, align 4, !tbaa !5
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr %4, align 4, !tbaa !5
  br label %29, !llvm.loop !16

46:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %47

47:                                               ; preds = %63, %46
  %48 = load i32, ptr %5, align 4, !tbaa !5
  %49 = load i32, ptr getelementptr inbounds (%struct.SuffixAutomaton, ptr @sam, i32 0, i32 1), align 4, !tbaa !14
  %50 = icmp sle i32 %48, %49
  br i1 %50, label %52, label %51

51:                                               ; preds = %47
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %66

52:                                               ; preds = %47
  %53 = load i32, ptr %5, align 4, !tbaa !5
  %54 = sub nsw i32 %53, 1
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [2000010 x i32], ptr @c, i64 0, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = load i32, ptr %5, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [2000010 x i32], ptr @c, i64 0, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = add nsw i32 %61, %57
  store i32 %62, ptr %60, align 4, !tbaa !5
  br label %63

63:                                               ; preds = %52
  %64 = load i32, ptr %5, align 4, !tbaa !5
  %65 = add nsw i32 %64, 1
  store i32 %65, ptr %5, align 4, !tbaa !5
  br label %47, !llvm.loop !17

66:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %67

67:                                               ; preds = %84, %66
  %68 = load i32, ptr %6, align 4, !tbaa !5
  %69 = load i32, ptr getelementptr inbounds (%struct.SuffixAutomaton, ptr @sam, i32 0, i32 1), align 4, !tbaa !14
  %70 = icmp sle i32 %68, %69
  br i1 %70, label %72, label %71

71:                                               ; preds = %67
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %87

72:                                               ; preds = %67
  %73 = load i32, ptr %6, align 4, !tbaa !5
  %74 = load i32, ptr %6, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [2000010 x i32], ptr getelementptr inbounds (%struct.SuffixAutomaton, ptr @sam, i32 0, i32 4), i64 0, i64 %75
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [2000010 x i32], ptr @c, i64 0, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !5
  %81 = add nsw i32 %80, -1
  store i32 %81, ptr %79, align 4, !tbaa !5
  %82 = sext i32 %80 to i64
  %83 = getelementptr inbounds [2000010 x i32], ptr @a, i64 0, i64 %82
  store i32 %73, ptr %83, align 4, !tbaa !5
  br label %84

84:                                               ; preds = %72
  %85 = load i32, ptr %6, align 4, !tbaa !5
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %6, align 4, !tbaa !5
  br label %67, !llvm.loop !18

87:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %88 = load i32, ptr getelementptr inbounds (%struct.SuffixAutomaton, ptr @sam, i32 0, i32 1), align 4, !tbaa !14
  store i32 %88, ptr %7, align 4, !tbaa !5
  br label %89

89:                                               ; preds = %131, %87
  %90 = load i32, ptr %7, align 4, !tbaa !5
  %91 = icmp ne i32 %90, 0
  br i1 %91, label %93, label %92

92:                                               ; preds = %89
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %134

93:                                               ; preds = %89
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %94 = load i32, ptr %7, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [2000010 x i32], ptr @a, i64 0, i64 %95
  %97 = load i32, ptr %96, align 4, !tbaa !5
  store i32 %97, ptr %8, align 4, !tbaa !5
  %98 = load i32, ptr %8, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [2000010 x i32], ptr getelementptr inbounds (%struct.SuffixAutomaton, ptr @sam, i32 0, i32 5), i64 0, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !5
  %102 = load i32, ptr %8, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [2000010 x i32], ptr getelementptr inbounds (%struct.SuffixAutomaton, ptr @sam, i32 0, i32 3), i64 0, i64 %103
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [2000010 x i32], ptr getelementptr inbounds (%struct.SuffixAutomaton, ptr @sam, i32 0, i32 5), i64 0, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = add nsw i32 %108, %101
  store i32 %109, ptr %107, align 4, !tbaa !5
  %110 = load i32, ptr %8, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [2000010 x i32], ptr getelementptr inbounds (%struct.SuffixAutomaton, ptr @sam, i32 0, i32 5), i64 0, i64 %111
  %113 = load i32, ptr %112, align 4, !tbaa !5
  %114 = icmp sgt i32 %113, 1
  br i1 %114, label %115, label %130

115:                                              ; preds = %93
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %116 = load i32, ptr %8, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [2000010 x i32], ptr getelementptr inbounds (%struct.SuffixAutomaton, ptr @sam, i32 0, i32 5), i64 0, i64 %117
  %119 = load i32, ptr %118, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = mul nsw i64 1, %120
  %122 = load i32, ptr %8, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [2000010 x i32], ptr getelementptr inbounds (%struct.SuffixAutomaton, ptr @sam, i32 0, i32 4), i64 0, i64 %123
  %125 = load i32, ptr %124, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = mul nsw i64 %121, %126
  store i64 %127, ptr %9, align 8, !tbaa !12
  %128 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %9)
  %129 = load i64, ptr %128, align 8, !tbaa !12
  store i64 %129, ptr %3, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  br label %130

130:                                              ; preds = %115, %93
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %131

131:                                              ; preds = %130
  %132 = load i32, ptr %7, align 4, !tbaa !5
  %133 = add nsw i32 %132, -1
  store i32 %133, ptr %7, align 4, !tbaa !5
  br label %89, !llvm.loop !19

134:                                              ; preds = %92
  %135 = load i64, ptr %3, align 8, !tbaa !12
  %136 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i64 noundef %135)
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  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 void @_ZN15SuffixAutomaton6extendEi(ptr noundef nonnull align 4 dereferenceable(232001168), i32 noundef) #3 align 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 @_ZSt3maxIxERKT_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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!13, !13, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = !{!15, !6, i64 4}
!15 = !{!"_ZTS15SuffixAutomaton", !6, i64 0, !6, i64 4, !7, i64 8, !7, i64 208001048, !7, i64 216001088, !7, i64 224001128}
!16 = distinct !{!16, !11}
!17 = distinct !{!17, !11}
!18 = distinct !{!18, !11}
!19 = distinct !{!19, !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"

%struct.SuffixAutomaton = type { i32, i32, [2000010 x [26 x i32]], [2000010 x i32], [2000010 x i32], [2000010 x i32] }

@sam = external dso_local global %struct.SuffixAutomaton, align 4
@s = external dso_local global [1000005 x i8], align 16
@a = external dso_local local_unnamed_addr global [2000010 x i32], align 16
@c = external dso_local local_unnamed_addr global [2000010 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 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 getelementptr inbounds (i8, ptr @s, i64 1))
  %4 = load i8, ptr getelementptr inbounds (i8, ptr @s, i64 1), align 1, !tbaa !5
  %.not34 = icmp eq i8 %4, 0
  br i1 %.not34, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %0
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #4
  store i64 0, ptr %1, align 8, !tbaa !8
  %5 = load i32, ptr getelementptr inbounds (i8, ptr @sam, i64 4), align 4, !tbaa !10
  %.not2836 = icmp slt i32 %5, 1
  br i1 %.not2836, label %.preheader, label %.lr.ph39.preheader

.lr.ph39.preheader:                               ; preds = %._crit_edge
  %6 = zext nneg i32 %5 to i64
  %xtraiter = and i64 %6, 3
  %7 = icmp ult i32 %5, 4
  br i1 %7, label %.preheader33.unr-lcssa, label %.lr.ph39.preheader.new

.lr.ph39.preheader.new:                           ; preds = %.lr.ph39.preheader
  %unroll_iter = and i64 %6, 2147483644
  br label %.lr.ph39

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %8 = phi i8 [ %12, %.lr.ph ], [ %4, %0 ]
  %9 = sext i8 %8 to i32
  %10 = add nsw i32 %9, -97
  tail call void @_ZN15SuffixAutomaton6extendEi(ptr noundef nonnull align 4 dereferenceable(232001168) @sam, i32 noundef %10)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %11 = getelementptr inbounds [1000005 x i8], ptr @s, i64 0, i64 %indvars.iv.next
  %12 = load i8, ptr %11, align 1, !tbaa !5
  %.not = icmp eq i8 %12, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !13

.preheader33.unr-lcssa:                           ; preds = %.lr.ph39, %.lr.ph39.preheader
  %indvars.iv50.unr = phi i64 [ 1, %.lr.ph39.preheader ], [ %indvars.iv.next51.3, %.lr.ph39 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader33, label %.lr.ph39.epil

.lr.ph39.epil:                                    ; preds = %.preheader33.unr-lcssa, %.lr.ph39.epil
  %indvars.iv50.epil = phi i64 [ %indvars.iv.next51.epil, %.lr.ph39.epil ], [ %indvars.iv50.unr, %.preheader33.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph39.epil ], [ 0, %.preheader33.unr-lcssa ]
  %13 = getelementptr inbounds [2000010 x i32], ptr getelementptr inbounds (i8, ptr @sam, i64 216001088), i64 0, i64 %indvars.iv50.epil
  %14 = load i32, ptr %13, align 4, !tbaa !15
  %15 = sext i32 %14 to i64
  %16 = getelementptr inbounds [2000010 x i32], ptr @c, i64 0, i64 %15
  %17 = load i32, ptr %16, align 4, !tbaa !15
  %18 = add nsw i32 %17, 1
  store i32 %18, ptr %16, align 4, !tbaa !15
  %indvars.iv.next51.epil = add nuw nsw i64 %indvars.iv50.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %.preheader33, label %.lr.ph39.epil, !llvm.loop !16

.preheader33:                                     ; preds = %.lr.ph39.epil, %.preheader33.unr-lcssa
  br i1 %.not2836, label %.preheader, label %.lr.ph42.preheader

.lr.ph42.preheader:                               ; preds = %.preheader33
  %.pre = load i32, ptr @c, align 16, !tbaa !15
  %xtraiter66 = and i64 %6, 3
  %19 = icmp ult i32 %5, 4
  br i1 %19, label %.preheader32.unr-lcssa, label %.lr.ph42.preheader.new

.lr.ph42.preheader.new:                           ; preds = %.lr.ph42.preheader
  %unroll_iter69 = and i64 %6, 2147483644
  br label %.lr.ph42

.lr.ph39:                                         ; preds = %.lr.ph39, %.lr.ph39.preheader.new
  %indvars.iv50 = phi i64 [ 1, %.lr.ph39.preheader.new ], [ %indvars.iv.next51.3, %.lr.ph39 ]
  %niter = phi i64 [ 0, %.lr.ph39.preheader.new ], [ %niter.next.3, %.lr.ph39 ]
  %20 = getelementptr inbounds [2000010 x i32], ptr getelementptr inbounds (i8, ptr @sam, i64 216001088), i64 0, i64 %indvars.iv50
  %21 = load i32, ptr %20, align 4, !tbaa !15
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [2000010 x i32], ptr @c, i64 0, i64 %22
  %24 = load i32, ptr %23, align 4, !tbaa !15
  %25 = add nsw i32 %24, 1
  store i32 %25, ptr %23, align 4, !tbaa !15
  %indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1
  %26 = getelementptr inbounds [2000010 x i32], ptr getelementptr inbounds (i8, ptr @sam, i64 216001088), i64 0, i64 %indvars.iv.next51
  %27 = load i32, ptr %26, align 4, !tbaa !15
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [2000010 x i32], ptr @c, i64 0, i64 %28
  %30 = load i32, ptr %29, align 4, !tbaa !15
  %31 = add nsw i32 %30, 1
  store i32 %31, ptr %29, align 4, !tbaa !15
  %indvars.iv.next51.1 = add nuw nsw i64 %indvars.iv50, 2
  %32 = getelementptr inbounds [2000010 x i32], ptr getelementptr inbounds (i8, ptr @sam, i64 216001088), i64 0, i64 %indvars.iv.next51.1
  %33 = load i32, ptr %32, align 4, !tbaa !15
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [2000010 x i32], ptr @c, i64 0, i64 %34
  %36 = load i32, ptr %35, align 4, !tbaa !15
  %37 = add nsw i32 %36, 1
  store i32 %37, ptr %35, align 4, !tbaa !15
  %indvars.iv.next51.2 = add nuw nsw i64 %indvars.iv50, 3
  %38 = getelementptr inbounds [2000010 x i32], ptr getelementptr inbounds (i8, ptr @sam, i64 216001088), i64 0, i64 %indvars.iv.next51.2
  %39 = load i32, ptr %38, align 4, !tbaa !15
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [2000010 x i32], ptr @c, i64 0, i64 %40
  %42 = load i32, ptr %41, align 4, !tbaa !15
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %41, align 4, !tbaa !15
  %indvars.iv.next51.3 = add nuw nsw i64 %indvars.iv50, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %.preheader33.unr-lcssa, label %.lr.ph39, !llvm.loop !18

.preheader32.unr-lcssa:                           ; preds = %.lr.ph42, %.lr.ph42.preheader
  %.unr = phi i32 [ %.pre, %.lr.ph42.preheader ], [ %61, %.lr.ph42 ]
  %indvars.iv53.unr = phi i64 [ 1, %.lr.ph42.preheader ], [ %indvars.iv.next54.3, %.lr.ph42 ]
  %lcmp.mod68.not = icmp eq i64 %xtraiter66, 0
  br i1 %lcmp.mod68.not, label %.preheader32, label %.lr.ph42.epil

.lr.ph42.epil:                                    ; preds = %.preheader32.unr-lcssa, %.lr.ph42.epil
  %44 = phi i32 [ %47, %.lr.ph42.epil ], [ %.unr, %.preheader32.unr-lcssa ]
  %indvars.iv53.epil = phi i64 [ %indvars.iv.next54.epil, %.lr.ph42.epil ], [ %indvars.iv53.unr, %.preheader32.unr-lcssa ]
  %epil.iter67 = phi i64 [ %epil.iter67.next, %.lr.ph42.epil ], [ 0, %.preheader32.unr-lcssa ]
  %45 = getelementptr inbounds [2000010 x i32], ptr @c, i64 0, i64 %indvars.iv53.epil
  %46 = load i32, ptr %45, align 4, !tbaa !15
  %47 = add nsw i32 %46, %44
  store i32 %47, ptr %45, align 4, !tbaa !15
  %indvars.iv.next54.epil = add nuw nsw i64 %indvars.iv53.epil, 1
  %epil.iter67.next = add i64 %epil.iter67, 1
  %epil.iter67.cmp.not = icmp eq i64 %epil.iter67.next, %xtraiter66
  br i1 %epil.iter67.cmp.not, label %.preheader32, label %.lr.ph42.epil, !llvm.loop !19

.preheader32:                                     ; preds = %.lr.ph42.epil, %.preheader32.unr-lcssa
  br i1 %.not2836, label %.preheader, label %.lr.ph45.preheader

.lr.ph45.preheader:                               ; preds = %.preheader32
  %xtraiter71 = and i64 %6, 1
  %48 = icmp eq i32 %5, 1
  br i1 %48, label %.preheader.loopexit.unr-lcssa, label %.lr.ph45.preheader.new

.lr.ph45.preheader.new:                           ; preds = %.lr.ph45.preheader
  %unroll_iter74 = and i64 %6, 2147483646
  br label %.lr.ph45

.lr.ph42:                                         ; preds = %.lr.ph42, %.lr.ph42.preheader.new
  %49 = phi i32 [ %.pre, %.lr.ph42.preheader.new ], [ %61, %.lr.ph42 ]
  %indvars.iv53 = phi i64 [ 1, %.lr.ph42.preheader.new ], [ %indvars.iv.next54.3, %.lr.ph42 ]
  %niter70 = phi i64 [ 0, %.lr.ph42.preheader.new ], [ %niter70.next.3, %.lr.ph42 ]
  %50 = getelementptr inbounds [2000010 x i32], ptr @c, i64 0, i64 %indvars.iv53
  %51 = load i32, ptr %50, align 4, !tbaa !15
  %52 = add nsw i32 %51, %49
  store i32 %52, ptr %50, align 4, !tbaa !15
  %indvars.iv.next54 = add nuw nsw i64 %indvars.iv53, 1
  %53 = getelementptr inbounds [2000010 x i32], ptr @c, i64 0, i64 %indvars.iv.next54
  %54 = load i32, ptr %53, align 4, !tbaa !15
  %55 = add nsw i32 %54, %52
  store i32 %55, ptr %53, align 4, !tbaa !15
  %indvars.iv.next54.1 = add nuw nsw i64 %indvars.iv53, 2
  %56 = getelementptr inbounds [2000010 x i32], ptr @c, i64 0, i64 %indvars.iv.next54.1
  %57 = load i32, ptr %56, align 4, !tbaa !15
  %58 = add nsw i32 %57, %55
  store i32 %58, ptr %56, align 4, !tbaa !15
  %indvars.iv.next54.2 = add nuw nsw i64 %indvars.iv53, 3
  %59 = getelementptr inbounds [2000010 x i32], ptr @c, i64 0, i64 %indvars.iv.next54.2
  %60 = load i32, ptr %59, align 4, !tbaa !15
  %61 = add nsw i32 %60, %58
  store i32 %61, ptr %59, align 4, !tbaa !15
  %indvars.iv.next54.3 = add nuw nsw i64 %indvars.iv53, 4
  %niter70.next.3 = add i64 %niter70, 4
  %niter70.ncmp.3 = icmp eq i64 %niter70.next.3, %unroll_iter69
  br i1 %niter70.ncmp.3, label %.preheader32.unr-lcssa, label %.lr.ph42, !llvm.loop !20

.preheader.loopexit.unr-lcssa:                    ; preds = %.lr.ph45, %.lr.ph45.preheader
  %indvars.iv58.unr = phi i64 [ 1, %.lr.ph45.preheader ], [ %indvars.iv.next59.1, %.lr.ph45 ]
  %lcmp.mod73.not = icmp eq i64 %xtraiter71, 0
  br i1 %lcmp.mod73.not, label %.preheader, label %.lr.ph45.epil

.lr.ph45.epil:                                    ; preds = %.preheader.loopexit.unr-lcssa
  %62 = getelementptr inbounds [2000010 x i32], ptr getelementptr inbounds (i8, ptr @sam, i64 216001088), i64 0, i64 %indvars.iv58.unr
  %63 = load i32, ptr %62, align 4, !tbaa !15
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [2000010 x i32], ptr @c, i64 0, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !15
  %67 = add nsw i32 %66, -1
  store i32 %67, ptr %65, align 4, !tbaa !15
  %68 = sext i32 %66 to i64
  %69 = getelementptr inbounds [2000010 x i32], ptr @a, i64 0, i64 %68
  %70 = trunc nuw nsw i64 %indvars.iv58.unr to i32
  store i32 %70, ptr %69, align 4, !tbaa !15
  br label %.preheader

.preheader:                                       ; preds = %.lr.ph45.epil, %.preheader.loopexit.unr-lcssa, %._crit_edge, %.preheader33, %.preheader32
  %.not3146 = icmp eq i32 %5, 0
  br i1 %.not3146, label %._crit_edge49, label %.lr.ph48.preheader

.lr.ph48.preheader:                               ; preds = %.preheader
  %71 = sext i32 %5 to i64
  br label %.lr.ph48

.lr.ph45:                                         ; preds = %.lr.ph45, %.lr.ph45.preheader.new
  %indvars.iv58 = phi i64 [ 1, %.lr.ph45.preheader.new ], [ %indvars.iv.next59.1, %.lr.ph45 ]
  %niter75 = phi i64 [ 0, %.lr.ph45.preheader.new ], [ %niter75.next.1, %.lr.ph45 ]
  %72 = getelementptr inbounds [2000010 x i32], ptr getelementptr inbounds (i8, ptr @sam, i64 216001088), i64 0, i64 %indvars.iv58
  %73 = load i32, ptr %72, align 4, !tbaa !15
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [2000010 x i32], ptr @c, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !15
  %77 = add nsw i32 %76, -1
  store i32 %77, ptr %75, align 4, !tbaa !15
  %78 = sext i32 %76 to i64
  %79 = getelementptr inbounds [2000010 x i32], ptr @a, i64 0, i64 %78
  %80 = trunc nuw nsw i64 %indvars.iv58 to i32
  store i32 %80, ptr %79, align 4, !tbaa !15
  %indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
  %81 = getelementptr inbounds [2000010 x i32], ptr getelementptr inbounds (i8, ptr @sam, i64 216001088), i64 0, i64 %indvars.iv.next59
  %82 = load i32, ptr %81, align 4, !tbaa !15
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [2000010 x i32], ptr @c, i64 0, i64 %83
  %85 = load i32, ptr %84, align 4, !tbaa !15
  %86 = add nsw i32 %85, -1
  store i32 %86, ptr %84, align 4, !tbaa !15
  %87 = sext i32 %85 to i64
  %88 = getelementptr inbounds [2000010 x i32], ptr @a, i64 0, i64 %87
  %89 = trunc nuw nsw i64 %indvars.iv.next59 to i32
  store i32 %89, ptr %88, align 4, !tbaa !15
  %indvars.iv.next59.1 = add nuw nsw i64 %indvars.iv58, 2
  %niter75.next.1 = add i64 %niter75, 2
  %niter75.ncmp.1 = icmp eq i64 %niter75.next.1, %unroll_iter74
  br i1 %niter75.ncmp.1, label %.preheader.loopexit.unr-lcssa, label %.lr.ph45, !llvm.loop !21

._crit_edge49:                                    ; preds = %114, %.preheader
  %90 = phi i64 [ 0, %.preheader ], [ %115, %114 ]
  %91 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %90)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #4
  ret i32 0

.lr.ph48:                                         ; preds = %.lr.ph48.preheader, %114
  %92 = phi i64 [ 0, %.lr.ph48.preheader ], [ %115, %114 ]
  %indvars.iv63 = phi i64 [ %71, %.lr.ph48.preheader ], [ %indvars.iv.next64, %114 ]
  %93 = getelementptr inbounds [2000010 x i32], ptr @a, i64 0, i64 %indvars.iv63
  %94 = load i32, ptr %93, align 4, !tbaa !15
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [2000010 x i32], ptr getelementptr inbounds (i8, ptr @sam, i64 224001128), i64 0, i64 %95
  %97 = load i32, ptr %96, align 4, !tbaa !15
  %98 = getelementptr inbounds [2000010 x i32], ptr getelementptr inbounds (i8, ptr @sam, i64 208001048), i64 0, i64 %95
  %99 = load i32, ptr %98, align 4, !tbaa !15
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [2000010 x i32], ptr getelementptr inbounds (i8, ptr @sam, i64 224001128), i64 0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !15
  %103 = add nsw i32 %102, %97
  store i32 %103, ptr %101, align 4, !tbaa !15
  %104 = load i32, ptr %96, align 4, !tbaa !15
  %105 = icmp sgt i32 %104, 1
  br i1 %105, label %106, label %114

106:                                              ; preds = %.lr.ph48
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #4
  %107 = zext nneg i32 %104 to i64
  %108 = getelementptr inbounds [2000010 x i32], ptr getelementptr inbounds (i8, ptr @sam, i64 216001088), i64 0, i64 %95
  %109 = load i32, ptr %108, align 4, !tbaa !15
  %110 = sext i32 %109 to i64
  %111 = mul nsw i64 %110, %107
  store i64 %111, ptr %2, align 8, !tbaa !8
  %112 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %113 = load i64, ptr %112, align 8, !tbaa !8
  store i64 %113, ptr %1, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  br label %114

114:                                              ; preds = %106, %.lr.ph48
  %115 = phi i64 [ %113, %106 ], [ %92, %.lr.ph48 ]
  %indvars.iv.next64 = add nsw i64 %indvars.iv63, -1
  %.not31 = icmp eq i64 %indvars.iv.next64, 0
  br i1 %.not31, label %._crit_edge49, label %.lr.ph48, !llvm.loop !22
}

; 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: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN15SuffixAutomaton6extendEi(ptr noundef nonnull align 4 dereferenceable(232001168), i32 noundef) local_unnamed_addr #3 align 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 @_ZSt3maxIxERKT_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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long long", !6, i64 0}
!10 = !{!11, !12, i64 4}
!11 = !{!"_ZTS15SuffixAutomaton", !12, i64 0, !12, i64 4, !6, i64 8, !6, i64 208001048, !6, i64 216001088, !6, i64 224001128}
!12 = !{!"int", !6, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!12, !12, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.unroll.disable"}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !17}
!20 = distinct !{!20, !14}
!21 = distinct !{!21, !14}
!22 = distinct !{!22, !14}


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