; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/276 Division 1/Problem C/C.ll (Z6updatev)

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

@s = external dso_local global [1048576 x i8], align 16
@t = external dso_local global [1048576 x i8], align 16
@n = external dso_local global i32, align 4
@pos = external dso_local global [20 x [1048576 x i32]], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

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

13:                                               ; preds = %36, %0
  %14 = load i32, ptr %4, align 4, !tbaa !5
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = icmp slt i32 %14, %15
  br i1 %16, label %18, label %17

17:                                               ; preds = %13
  store i32 2, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %39

18:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %19 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %19, ptr %6, align 4, !tbaa !5
  br label %20

20:                                               ; preds = %31, %18
  %21 = load i32, ptr %6, align 4, !tbaa !5
  %22 = load i32, ptr %1, align 4, !tbaa !5
  %23 = icmp slt i32 %21, %22
  br i1 %23, label %25, label %24

24:                                               ; preds = %20
  store i32 5, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %35

25:                                               ; preds = %20
  %26 = load i32, ptr %3, align 4, !tbaa !5
  %27 = add nsw i32 %26, 1
  store i32 %27, ptr %3, align 4, !tbaa !5
  %28 = load i32, ptr %6, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [1048576 x i32], ptr @pos, i64 0, i64 %29
  store i32 %26, ptr %30, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %25
  %32 = load i32, ptr %2, align 4, !tbaa !5
  %33 = load i32, ptr %6, align 4, !tbaa !5
  %34 = add nsw i32 %33, %32
  store i32 %34, ptr %6, align 4, !tbaa !5
  br label %20, !llvm.loop !9

35:                                               ; preds = %24
  br label %36

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

39:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %40

40:                                               ; preds = %45, %39
  %41 = load i32, ptr %7, align 4, !tbaa !5
  %42 = shl i32 1, %41
  %43 = load i32, ptr @n, align 4, !tbaa !5
  %44 = icmp slt i32 %42, %43
  br i1 %44, label %45, label %48

45:                                               ; preds = %40
  %46 = load i32, ptr %7, align 4, !tbaa !5
  %47 = add nsw i32 %46, 1
  store i32 %47, ptr %7, align 4, !tbaa !5
  br label %40, !llvm.loop !12

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

49:                                               ; preds = %100, %48
  %50 = load i32, ptr %8, align 4, !tbaa !5
  %51 = load i32, ptr %7, align 4, !tbaa !5
  %52 = icmp slt i32 %50, %51
  br i1 %52, label %54, label %53

53:                                               ; preds = %49
  store i32 10, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %103

54:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %55

55:                                               ; preds = %96, %54
  %56 = load i32, ptr %9, align 4, !tbaa !5
  %57 = load i32, ptr %1, align 4, !tbaa !5
  %58 = icmp slt i32 %56, %57
  br i1 %58, label %60, label %59

59:                                               ; preds = %55
  store i32 13, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %99

60:                                               ; preds = %55
  %61 = load i32, ptr %8, align 4, !tbaa !5
  %62 = sub nsw i32 %61, 1
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [20 x [1048576 x i32]], ptr @pos, i64 0, i64 %63
  %65 = load i32, ptr %9, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [1048576 x i32], ptr %64, i64 0, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = icmp sle i32 %68, 0
  br i1 %69, label %70, label %71

70:                                               ; preds = %60
  br label %88

71:                                               ; preds = %60
  %72 = load i32, ptr %8, align 4, !tbaa !5
  %73 = sub nsw i32 %72, 1
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [20 x [1048576 x i32]], ptr @pos, i64 0, i64 %74
  %76 = load i32, ptr %8, align 4, !tbaa !5
  %77 = sub nsw i32 %76, 1
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [20 x [1048576 x i32]], ptr @pos, i64 0, i64 %78
  %80 = load i32, ptr %9, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [1048576 x i32], ptr %79, i64 0, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %84 = sub nsw i32 %83, 1
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [1048576 x i32], ptr %75, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !5
  br label %88

88:                                               ; preds = %71, %70
  %89 = phi i32 [ -1, %70 ], [ %87, %71 ]
  %90 = load i32, ptr %8, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [20 x [1048576 x i32]], ptr @pos, i64 0, i64 %91
  %93 = load i32, ptr %9, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [1048576 x i32], ptr %92, i64 0, i64 %94
  store i32 %89, ptr %95, align 4, !tbaa !5
  br label %96

96:                                               ; preds = %88
  %97 = load i32, ptr %9, align 4, !tbaa !5
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr %9, align 4, !tbaa !5
  br label %55, !llvm.loop !13

99:                                               ; preds = %59
  br label %100

100:                                              ; preds = %99
  %101 = load i32, ptr %8, align 4, !tbaa !5
  %102 = add nsw i32 %101, 1
  store i32 %102, ptr %8, align 4, !tbaa !5
  br label %49, !llvm.loop !14

103:                                              ; preds = %53
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %104

104:                                              ; preds = %117, %103
  %105 = load i32, ptr %10, align 4, !tbaa !5
  %106 = load i32, ptr @n, align 4, !tbaa !5
  %107 = icmp slt i32 %105, %106
  br i1 %107, label %109, label %108

108:                                              ; preds = %104
  store i32 16, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %120

109:                                              ; preds = %104
  %110 = load i32, ptr %10, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [1048576 x i8], ptr @s, i64 0, i64 %111
  %113 = load i8, ptr %112, align 1, !tbaa !15
  %114 = load i32, ptr %10, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [1048576 x i8], ptr @t, i64 0, i64 %115
  store i8 %113, ptr %116, align 1, !tbaa !15
  br label %117

117:                                              ; preds = %109
  %118 = load i32, ptr %10, align 4, !tbaa !5
  %119 = add nsw i32 %118, 1
  store i32 %119, ptr %10, align 4, !tbaa !5
  br label %104, !llvm.loop !16

120:                                              ; preds = %108
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %121

121:                                              ; preds = %137, %120
  %122 = load i32, ptr %11, align 4, !tbaa !5
  %123 = load i32, ptr @n, align 4, !tbaa !5
  %124 = icmp slt i32 %122, %123
  br i1 %124, label %126, label %125

125:                                              ; preds = %121
  store i32 19, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %140

126:                                              ; preds = %121
  %127 = load i32, ptr %11, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [1048576 x i8], ptr @t, i64 0, i64 %128
  %130 = load i8, ptr %129, align 1, !tbaa !15
  %131 = load i32, ptr %11, align 4, !tbaa !5
  %132 = load i32, ptr %1, align 4, !tbaa !5
  %133 = load i32, ptr %7, align 4, !tbaa !5
  %134 = call noundef i32 @_Z3getiii(i32 noundef %131, i32 noundef %132, i32 noundef %133)
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [1048576 x i8], ptr @s, i64 0, i64 %135
  store i8 %130, ptr %136, align 1, !tbaa !15
  br label %137

137:                                              ; preds = %126
  %138 = load i32, ptr %11, align 4, !tbaa !5
  %139 = add nsw i32 %138, 1
  store i32 %139, ptr %11, align 4, !tbaa !5
  br label %121, !llvm.loop !17

140:                                              ; preds = %125
  %141 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, ptr noundef @s)
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #4
  ret void
}

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

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 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 = { 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 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = !{!7, !7, i64 0}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !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"

@s = external dso_local global [1048576 x i8], align 16
@t = external dso_local local_unnamed_addr global [1048576 x i8], align 16
@n = external dso_local local_unnamed_addr global i32, align 4
@pos = external dso_local local_unnamed_addr global [20 x [1048576 x i32]], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z6updatev() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  %3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %4 = load i32, ptr %2, align 4, !tbaa !5
  %5 = icmp sgt i32 %4, 0
  br i1 %5, label %.preheader42.lr.ph, label %.preheader41

.preheader42.lr.ph:                               ; preds = %0
  %6 = load i32, ptr %1, align 4, !tbaa !5
  %7 = zext nneg i32 %4 to i64
  %xtraiter = and i64 %7, 1
  %8 = icmp eq i32 %4, 1
  br i1 %8, label %.preheader41.loopexit.unr-lcssa, label %.preheader42.lr.ph.new

.preheader42.lr.ph.new:                           ; preds = %.preheader42.lr.ph
  %unroll_iter = and i64 %7, 2147483646
  br label %.preheader42

.preheader42:                                     ; preds = %._crit_edge.1, %.preheader42.lr.ph.new
  %indvars.iv = phi i64 [ 0, %.preheader42.lr.ph.new ], [ %indvars.iv.next.1, %._crit_edge.1 ]
  %.03645 = phi i32 [ 0, %.preheader42.lr.ph.new ], [ %.1.lcssa.1, %._crit_edge.1 ]
  %niter = phi i64 [ 0, %.preheader42.lr.ph.new ], [ %niter.next.1, %._crit_edge.1 ]
  %indvars60 = trunc i64 %indvars.iv to i32
  %9 = icmp sgt i32 %6, %indvars60
  br i1 %9, label %.lr.ph, label %._crit_edge

.preheader41.loopexit.unr-lcssa:                  ; preds = %._crit_edge.1, %.preheader42.lr.ph
  %indvars.iv.unr = phi i64 [ 0, %.preheader42.lr.ph ], [ %indvars.iv.next.1, %._crit_edge.1 ]
  %.03645.unr = phi i32 [ 0, %.preheader42.lr.ph ], [ %.1.lcssa.1, %._crit_edge.1 ]
  %lcmp.mod.not = icmp ne i64 %xtraiter, 0
  %indvars60.epil = trunc i64 %indvars.iv.unr to i32
  %10 = icmp sgt i32 %6, %indvars60.epil
  %or.cond = select i1 %lcmp.mod.not, i1 %10, i1 false
  br i1 %or.cond, label %.lr.ph.epil, label %.preheader41

.lr.ph.epil:                                      ; preds = %.preheader41.loopexit.unr-lcssa, %.lr.ph.epil
  %indvars.iv57.epil = phi i64 [ %indvars.iv.next58.epil, %.lr.ph.epil ], [ %indvars.iv.unr, %.preheader41.loopexit.unr-lcssa ]
  %.143.epil = phi i32 [ %11, %.lr.ph.epil ], [ %.03645.unr, %.preheader41.loopexit.unr-lcssa ]
  %11 = add nsw i32 %.143.epil, 1
  %12 = getelementptr inbounds [1048576 x i32], ptr @pos, i64 0, i64 %indvars.iv57.epil
  store i32 %.143.epil, ptr %12, align 4, !tbaa !5
  %indvars.iv.next58.epil = add nuw nsw i64 %indvars.iv57.epil, %7
  %13 = trunc nuw i64 %indvars.iv.next58.epil to i32
  %14 = icmp sgt i32 %6, %13
  br i1 %14, label %.lr.ph.epil, label %.preheader41, !llvm.loop !9

.preheader41:                                     ; preds = %.preheader41.loopexit.unr-lcssa, %.lr.ph.epil, %0
  %15 = load i32, ptr @n, align 4, !tbaa !5
  br label %25

._crit_edge:                                      ; preds = %.lr.ph, %.preheader42
  %.1.lcssa = phi i32 [ %.03645, %.preheader42 ], [ %21, %.lr.ph ]
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %indvars60.1 = trunc i64 %indvars.iv.next to i32
  %16 = icmp sgt i32 %6, %indvars60.1
  br i1 %16, label %.lr.ph.1, label %._crit_edge.1

.lr.ph.1:                                         ; preds = %._crit_edge, %.lr.ph.1
  %indvars.iv57.1 = phi i64 [ %indvars.iv.next58.1, %.lr.ph.1 ], [ %indvars.iv.next, %._crit_edge ]
  %.143.1 = phi i32 [ %17, %.lr.ph.1 ], [ %.1.lcssa, %._crit_edge ]
  %17 = add nsw i32 %.143.1, 1
  %18 = getelementptr inbounds [1048576 x i32], ptr @pos, i64 0, i64 %indvars.iv57.1
  store i32 %.143.1, ptr %18, align 4, !tbaa !5
  %indvars.iv.next58.1 = add nuw nsw i64 %indvars.iv57.1, %7
  %19 = trunc nuw i64 %indvars.iv.next58.1 to i32
  %20 = icmp sgt i32 %6, %19
  br i1 %20, label %.lr.ph.1, label %._crit_edge.1, !llvm.loop !9

._crit_edge.1:                                    ; preds = %.lr.ph.1, %._crit_edge
  %.1.lcssa.1 = phi i32 [ %.1.lcssa, %._crit_edge ], [ %17, %.lr.ph.1 ]
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %.preheader41.loopexit.unr-lcssa, label %.preheader42, !llvm.loop !11

.lr.ph:                                           ; preds = %.preheader42, %.lr.ph
  %indvars.iv57 = phi i64 [ %indvars.iv.next58, %.lr.ph ], [ %indvars.iv, %.preheader42 ]
  %.143 = phi i32 [ %21, %.lr.ph ], [ %.03645, %.preheader42 ]
  %21 = add nsw i32 %.143, 1
  %22 = getelementptr inbounds [1048576 x i32], ptr @pos, i64 0, i64 %indvars.iv57
  store i32 %.143, ptr %22, align 4, !tbaa !5
  %indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, %7
  %23 = trunc nuw i64 %indvars.iv.next58 to i32
  %24 = icmp sgt i32 %6, %23
  br i1 %24, label %.lr.ph, label %._crit_edge, !llvm.loop !9

25:                                               ; preds = %25, %.preheader41
  %.033 = phi i32 [ %28, %25 ], [ 0, %.preheader41 ]
  %26 = shl nuw i32 1, %.033
  %27 = icmp slt i32 %26, %15
  %28 = add nuw nsw i32 %.033, 1
  br i1 %27, label %25, label %.preheader40, !llvm.loop !12

.preheader40:                                     ; preds = %25
  %29 = icmp ugt i32 %.033, 1
  br i1 %29, label %.preheader39.lr.ph, label %.preheader38

.preheader39.lr.ph:                               ; preds = %.preheader40
  %30 = load i32, ptr %1, align 4, !tbaa !5
  %31 = icmp sgt i32 %30, 0
  br i1 %31, label %.preheader39.us.preheader, label %.preheader38

.preheader39.us.preheader:                        ; preds = %.preheader39.lr.ph
  %wide.trip.count70 = zext nneg i32 %.033 to i64
  %wide.trip.count64 = zext nneg i32 %30 to i64
  %xtraiter78 = and i64 %wide.trip.count64, 1
  %32 = icmp eq i32 %30, 1
  %unroll_iter80 = and i64 %wide.trip.count64, 2147483646
  %lcmp.mod79.not = icmp eq i64 %xtraiter78, 0
  br label %.preheader39.us

.preheader39.us:                                  ; preds = %.preheader39.us.preheader, %._crit_edge49.us
  %indvars.iv66 = phi i64 [ 1, %.preheader39.us.preheader ], [ %indvars.iv.next67, %._crit_edge49.us ]
  %33 = add nsw i64 %indvars.iv66, -1
  br i1 %32, label %._crit_edge49.us.unr-lcssa, label %.preheader39.us.new

.preheader39.us.new:                              ; preds = %.preheader39.us, %53
  %indvars.iv61 = phi i64 [ %indvars.iv.next62.1, %53 ], [ 0, %.preheader39.us ]
  %niter81 = phi i64 [ %niter81.next.1, %53 ], [ 0, %.preheader39.us ]
  %34 = getelementptr inbounds [20 x [1048576 x i32]], ptr @pos, i64 0, i64 %33, i64 %indvars.iv61
  %35 = load i32, ptr %34, align 8, !tbaa !5
  %36 = icmp slt i32 %35, 1
  br i1 %36, label %42, label %37

37:                                               ; preds = %.preheader39.us.new
  %38 = add nsw i32 %35, -1
  %39 = zext nneg i32 %38 to i64
  %40 = getelementptr inbounds [20 x [1048576 x i32]], ptr @pos, i64 0, i64 %33, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %37, %.preheader39.us.new
  %43 = phi i32 [ %41, %37 ], [ -1, %.preheader39.us.new ]
  %44 = getelementptr inbounds [20 x [1048576 x i32]], ptr @pos, i64 0, i64 %indvars.iv66, i64 %indvars.iv61
  store i32 %43, ptr %44, align 8, !tbaa !5
  %indvars.iv.next62 = or disjoint i64 %indvars.iv61, 1
  %45 = getelementptr inbounds [20 x [1048576 x i32]], ptr @pos, i64 0, i64 %33, i64 %indvars.iv.next62
  %46 = load i32, ptr %45, align 4, !tbaa !5
  %47 = icmp slt i32 %46, 1
  br i1 %47, label %53, label %48

48:                                               ; preds = %42
  %49 = add nsw i32 %46, -1
  %50 = zext nneg i32 %49 to i64
  %51 = getelementptr inbounds [20 x [1048576 x i32]], ptr @pos, i64 0, i64 %33, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !5
  br label %53

53:                                               ; preds = %48, %42
  %54 = phi i32 [ %52, %48 ], [ -1, %42 ]
  %55 = getelementptr inbounds [20 x [1048576 x i32]], ptr @pos, i64 0, i64 %indvars.iv66, i64 %indvars.iv.next62
  store i32 %54, ptr %55, align 4, !tbaa !5
  %indvars.iv.next62.1 = add nuw nsw i64 %indvars.iv61, 2
  %niter81.next.1 = add i64 %niter81, 2
  %niter81.ncmp.1 = icmp eq i64 %niter81.next.1, %unroll_iter80
  br i1 %niter81.ncmp.1, label %._crit_edge49.us.unr-lcssa, label %.preheader39.us.new, !llvm.loop !13

._crit_edge49.us.unr-lcssa:                       ; preds = %53, %.preheader39.us
  %indvars.iv61.unr = phi i64 [ 0, %.preheader39.us ], [ %indvars.iv.next62.1, %53 ]
  br i1 %lcmp.mod79.not, label %._crit_edge49.us, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge49.us.unr-lcssa
  %56 = getelementptr inbounds [20 x [1048576 x i32]], ptr @pos, i64 0, i64 %33, i64 %indvars.iv61.unr
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = icmp slt i32 %57, 1
  br i1 %58, label %._crit_edge49.us.epilog-lcssa, label %59

59:                                               ; preds = %.epil.preheader
  %60 = add nsw i32 %57, -1
  %61 = zext nneg i32 %60 to i64
  %62 = getelementptr inbounds [20 x [1048576 x i32]], ptr @pos, i64 0, i64 %33, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !5
  br label %._crit_edge49.us.epilog-lcssa

._crit_edge49.us.epilog-lcssa:                    ; preds = %59, %.epil.preheader
  %64 = phi i32 [ %63, %59 ], [ -1, %.epil.preheader ]
  %65 = getelementptr inbounds [20 x [1048576 x i32]], ptr @pos, i64 0, i64 %indvars.iv66, i64 %indvars.iv61.unr
  store i32 %64, ptr %65, align 4, !tbaa !5
  br label %._crit_edge49.us

._crit_edge49.us:                                 ; preds = %._crit_edge49.us.unr-lcssa, %._crit_edge49.us.epilog-lcssa
  %indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
  %exitcond71.not = icmp eq i64 %indvars.iv.next67, %wide.trip.count70
  br i1 %exitcond71.not, label %.preheader38, label %.preheader39.us, !llvm.loop !14

.preheader38:                                     ; preds = %._crit_edge49.us, %.preheader39.lr.ph, %.preheader40
  %66 = icmp sgt i32 %15, 0
  br i1 %66, label %.lr.ph54.preheader, label %._crit_edge55

.lr.ph54.preheader:                               ; preds = %.preheader38
  %67 = zext nneg i32 %15 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 16 @t, ptr nonnull align 16 @s, i64 %67, i1 false), !tbaa !15
  br label %.lr.ph54

._crit_edge55:                                    ; preds = %.lr.ph54, %.preheader38
  %68 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull @s)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  ret void

.lr.ph54:                                         ; preds = %.lr.ph54.preheader, %.lr.ph54
  %indvars.iv75 = phi i64 [ 0, %.lr.ph54.preheader ], [ %indvars.iv.next76, %.lr.ph54 ]
  %69 = getelementptr inbounds [1048576 x i8], ptr @t, i64 0, i64 %indvars.iv75
  %70 = load i8, ptr %69, align 1, !tbaa !15
  %71 = load i32, ptr %1, align 4, !tbaa !5
  %72 = trunc nuw nsw i64 %indvars.iv75 to i32
  %73 = call noundef i32 @_Z3getiii(i32 noundef %72, i32 noundef %71, i32 noundef %.033)
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [1048576 x i8], ptr @s, i64 0, i64 %74
  store i8 %70, ptr %75, align 1, !tbaa !15
  %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
  %76 = load i32, ptr @n, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = icmp slt i64 %indvars.iv.next76, %77
  br i1 %78, label %.lr.ph54, label %._crit_edge55, !llvm.loop !16
}

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = !{!7, !7, i64 0}
!16 = distinct !{!16, !10}


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