; LLVM IR from tangjz/acm-icpc :: leetcode/extra (meituan_014-小团的 AB 队)

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

%class.anon = type { ptr }

@_ZZ4mainE1a = external hidden global [40001 x i32], align 16
@_ZZ4mainE3ord = external hidden global [40001 x i32], align 16
@_ZZ4mainE3buf = external hidden global [40001 x i8], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 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 i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca %class.anon, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %3, ptr noundef %4)
  %9 = load i32, ptr %3, align 4, !tbaa !5
  %10 = load i32, ptr %4, align 4, !tbaa !5
  %11 = add nsw i32 %9, %10
  store i32 %11, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %12

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

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

17:                                               ; preds = %12
  %18 = load i32, ptr %5, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds i32, ptr @_ZZ4mainE1a, i64 %19
  %21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %20)
  %22 = load i32, ptr %5, align 4, !tbaa !5
  %23 = load i32, ptr %5, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [40001 x i32], ptr @_ZZ4mainE3ord, i64 0, i64 %24
  store i32 %22, ptr %25, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %17
  %27 = load i32, ptr %5, align 4, !tbaa !5
  %28 = add nsw i32 %27, 1
  store i32 %28, ptr %5, align 4, !tbaa !5
  br label %12, !llvm.loop !9

29:                                               ; preds = %16
  %30 = load i32, ptr %3, align 4, !tbaa !5
  %31 = load i32, ptr %4, align 4, !tbaa !5
  %32 = icmp ne i32 %30, %31
  br i1 %32, label %33, label %45

33:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %34 = load i32, ptr %3, align 4, !tbaa !5
  %35 = load i32, ptr %4, align 4, !tbaa !5
  %36 = icmp slt i32 %34, %35
  %37 = zext i1 %36 to i64
  %38 = select i1 %36, i32 -1, i32 1
  store i32 %38, ptr %6, align 4, !tbaa !5
  %39 = load i32, ptr %2, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds i32, ptr @_ZZ4mainE3ord, i64 %40
  %42 = getelementptr inbounds %class.anon, ptr %7, i32 0, i32 0
  store ptr %6, ptr %42, align 8, !tbaa !11
  %43 = getelementptr inbounds %class.anon, ptr %7, i32 0, i32 0
  %44 = load ptr, ptr %43, align 8
  call void @"_ZSt4sortIPiZ4mainE3$_0EvT_S2_T0_"(ptr noundef @_ZZ4mainE3ord, ptr noundef %41, ptr %44)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %45

45:                                               ; preds = %33, %29
  %46 = load i32, ptr %2, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [40001 x i8], ptr @_ZZ4mainE3buf, i64 0, i64 %47
  store i8 0, ptr %48, align 1, !tbaa !13
  %49 = load i32, ptr %3, align 4, !tbaa !5
  %50 = load i32, ptr %4, align 4, !tbaa !5
  %51 = icmp slt i32 %49, %50
  br i1 %51, label %52, label %79

52:                                               ; preds = %45
  br label %53

53:                                               ; preds = %57, %52
  %54 = load i32, ptr %3, align 4, !tbaa !5
  %55 = add nsw i32 %54, -1
  store i32 %55, ptr %3, align 4, !tbaa !5
  %56 = icmp ne i32 %54, 0
  br i1 %56, label %57, label %65

57:                                               ; preds = %53
  %58 = load i32, ptr %2, align 4, !tbaa !5
  %59 = add nsw i32 %58, -1
  store i32 %59, ptr %2, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [40001 x i32], ptr @_ZZ4mainE3ord, i64 0, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [40001 x i8], ptr @_ZZ4mainE3buf, i64 0, i64 %63
  store i8 65, ptr %64, align 1, !tbaa !13
  br label %53, !llvm.loop !14

65:                                               ; preds = %53
  br label %66

66:                                               ; preds = %70, %65
  %67 = load i32, ptr %4, align 4, !tbaa !5
  %68 = add nsw i32 %67, -1
  store i32 %68, ptr %4, align 4, !tbaa !5
  %69 = icmp ne i32 %67, 0
  br i1 %69, label %70, label %78

70:                                               ; preds = %66
  %71 = load i32, ptr %2, align 4, !tbaa !5
  %72 = add nsw i32 %71, -1
  store i32 %72, ptr %2, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [40001 x i32], ptr @_ZZ4mainE3ord, i64 0, i64 %73
  %75 = load i32, ptr %74, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [40001 x i8], ptr @_ZZ4mainE3buf, i64 0, i64 %76
  store i8 66, ptr %77, align 1, !tbaa !13
  br label %66, !llvm.loop !15

78:                                               ; preds = %66
  br label %106

79:                                               ; preds = %45
  br label %80

80:                                               ; preds = %84, %79
  %81 = load i32, ptr %4, align 4, !tbaa !5
  %82 = add nsw i32 %81, -1
  store i32 %82, ptr %4, align 4, !tbaa !5
  %83 = icmp ne i32 %81, 0
  br i1 %83, label %84, label %92

84:                                               ; preds = %80
  %85 = load i32, ptr %2, align 4, !tbaa !5
  %86 = add nsw i32 %85, -1
  store i32 %86, ptr %2, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [40001 x i32], ptr @_ZZ4mainE3ord, i64 0, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [40001 x i8], ptr @_ZZ4mainE3buf, i64 0, i64 %90
  store i8 66, ptr %91, align 1, !tbaa !13
  br label %80, !llvm.loop !16

92:                                               ; preds = %80
  br label %93

93:                                               ; preds = %97, %92
  %94 = load i32, ptr %3, align 4, !tbaa !5
  %95 = add nsw i32 %94, -1
  store i32 %95, ptr %3, align 4, !tbaa !5
  %96 = icmp ne i32 %94, 0
  br i1 %96, label %97, label %105

97:                                               ; preds = %93
  %98 = load i32, ptr %2, align 4, !tbaa !5
  %99 = add nsw i32 %98, -1
  store i32 %99, ptr %2, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [40001 x i32], ptr @_ZZ4mainE3ord, i64 0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [40001 x i8], ptr @_ZZ4mainE3buf, i64 0, i64 %103
  store i8 65, ptr %104, align 1, !tbaa !13
  br label %93, !llvm.loop !17

105:                                              ; preds = %93
  br label %106

106:                                              ; preds = %105, %78
  %107 = call i32 @puts(ptr noundef @_ZZ4mainE3buf)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  ret i32 0
}

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt4sortIPiZ4mainE3$_0EvT_S2_T0_"(ptr noundef, ptr noundef, ptr) #3

declare i32 @puts(ptr noundef) #2

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { inlinehint mustprogress 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!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"

@_ZZ4mainE1a = external hidden global [40001 x i32], align 16
@_ZZ4mainE3ord = external hidden global [40001 x i32], align 16
@_ZZ4mainE3buf = external hidden global [40001 x i8], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = 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
  %4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %5 = load i32, ptr %1, align 4, !tbaa !5
  %6 = load i32, ptr %2, align 4, !tbaa !5
  %7 = add nsw i32 %6, %5
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %0
  %wide.trip.count = zext nneg i32 %7 to i64
  br label %.lr.ph

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %.pre = load i32, ptr %1, align 4, !tbaa !5
  %.pre65 = load i32, ptr %2, align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %0
  %9 = phi i32 [ %.pre65, %._crit_edge.loopexit ], [ %6, %0 ]
  %10 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %5, %0 ]
  %.not = icmp eq i32 %10, %9
  br i1 %.not, label %.thread, label %16

.thread:                                          ; preds = %._crit_edge
  %.pre68 = sext i32 %7 to i64
  %11 = getelementptr inbounds [40001 x i8], ptr @_ZZ4mainE3buf, i64 0, i64 %.pre68
  store i8 0, ptr %11, align 1, !tbaa !9
  br label %.preheader22

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %12 = getelementptr inbounds i32, ptr @_ZZ4mainE1a, i64 %indvars.iv
  %13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %12)
  %14 = getelementptr inbounds [40001 x i32], ptr @_ZZ4mainE3ord, i64 0, i64 %indvars.iv
  %15 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %15, ptr %14, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge.loopexit, label %.lr.ph, !llvm.loop !10

16:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  %17 = icmp slt i32 %10, %9
  %18 = select i1 %17, i32 -1, i32 1
  store i32 %18, ptr %3, align 4, !tbaa !5
  %19 = sext i32 %7 to i64
  %20 = getelementptr inbounds i32, ptr @_ZZ4mainE3ord, i64 %19
  call void @"_ZSt4sortIPiZ4mainE3$_0EvT_S2_T0_"(ptr noundef nonnull @_ZZ4mainE3ord, ptr noundef nonnull %20, ptr nonnull %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  %.pre66 = load i32, ptr %1, align 4, !tbaa !5
  %.pre67 = load i32, ptr %2, align 4, !tbaa !5
  %21 = getelementptr inbounds [40001 x i8], ptr @_ZZ4mainE3buf, i64 0, i64 %19
  store i8 0, ptr %21, align 1, !tbaa !9
  %22 = icmp slt i32 %.pre66, %.pre67
  br i1 %22, label %.preheader19, label %.preheader22

.preheader22:                                     ; preds = %.thread, %16
  %.promoted73 = phi i32 [ %9, %.thread ], [ %.pre66, %16 ]
  %.promoted4072 = phi i32 [ %9, %.thread ], [ %.pre67, %16 ]
  %.not1424 = icmp eq i32 %.promoted4072, 0
  br i1 %.not1424, label %.preheader20, label %.lr.ph26.preheader

.lr.ph26.preheader:                               ; preds = %.preheader22
  %23 = sext i32 %5 to i64
  %24 = sext i32 %6 to i64
  %25 = add nsw i64 %23, %24
  %xtraiter80 = and i32 %.promoted4072, 3
  %lcmp.mod81.not = icmp eq i32 %xtraiter80, 0
  br i1 %lcmp.mod81.not, label %.lr.ph26.prol.loopexit, label %.lr.ph26.prol

.lr.ph26.prol:                                    ; preds = %.lr.ph26.preheader, %.lr.ph26.prol
  %indvars.iv53.prol = phi i64 [ %indvars.iv.next54.prol, %.lr.ph26.prol ], [ %25, %.lr.ph26.preheader ]
  %.in75.prol = phi i32 [ %26, %.lr.ph26.prol ], [ %.promoted4072, %.lr.ph26.preheader ]
  %prol.iter82 = phi i32 [ %prol.iter82.next, %.lr.ph26.prol ], [ 0, %.lr.ph26.preheader ]
  %26 = add nsw i32 %.in75.prol, -1
  %indvars.iv.next54.prol = add nsw i64 %indvars.iv53.prol, -1
  %27 = getelementptr inbounds [40001 x i32], ptr @_ZZ4mainE3ord, i64 0, i64 %indvars.iv.next54.prol
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [40001 x i8], ptr @_ZZ4mainE3buf, i64 0, i64 %29
  store i8 66, ptr %30, align 1, !tbaa !9
  %prol.iter82.next = add i32 %prol.iter82, 1
  %prol.iter82.cmp.not = icmp eq i32 %prol.iter82.next, %xtraiter80
  br i1 %prol.iter82.cmp.not, label %.lr.ph26.prol.loopexit, label %.lr.ph26.prol, !llvm.loop !12

.lr.ph26.prol.loopexit:                           ; preds = %.lr.ph26.prol, %.lr.ph26.preheader
  %indvars.iv.next54.lcssa.unr = phi i64 [ poison, %.lr.ph26.preheader ], [ %indvars.iv.next54.prol, %.lr.ph26.prol ]
  %indvars.iv53.unr = phi i64 [ %25, %.lr.ph26.preheader ], [ %indvars.iv.next54.prol, %.lr.ph26.prol ]
  %.in75.unr = phi i32 [ %.promoted4072, %.lr.ph26.preheader ], [ %26, %.lr.ph26.prol ]
  %31 = icmp ult i32 %.promoted4072, 4
  br i1 %31, label %.preheader20.loopexit, label %.lr.ph26

.preheader19:                                     ; preds = %16
  %.not1635 = icmp eq i32 %.pre66, 0
  br i1 %.not1635, label %.preheader, label %.lr.ph37.preheader

.lr.ph37.preheader:                               ; preds = %.preheader19
  %32 = sext i32 %5 to i64
  %33 = sext i32 %6 to i64
  %34 = add nsw i64 %32, %33
  %xtraiter = and i32 %.pre66, 3
  %lcmp.mod.not = icmp eq i32 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph37.prol.loopexit, label %.lr.ph37.prol

.lr.ph37.prol:                                    ; preds = %.lr.ph37.preheader, %.lr.ph37.prol
  %indvars.iv59.prol = phi i64 [ %indvars.iv.next60.prol, %.lr.ph37.prol ], [ %34, %.lr.ph37.preheader ]
  %.in.prol = phi i32 [ %35, %.lr.ph37.prol ], [ %.pre66, %.lr.ph37.preheader ]
  %prol.iter = phi i32 [ %prol.iter.next, %.lr.ph37.prol ], [ 0, %.lr.ph37.preheader ]
  %35 = add nsw i32 %.in.prol, -1
  %indvars.iv.next60.prol = add nsw i64 %indvars.iv59.prol, -1
  %36 = getelementptr inbounds [40001 x i32], ptr @_ZZ4mainE3ord, i64 0, i64 %indvars.iv.next60.prol
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [40001 x i8], ptr @_ZZ4mainE3buf, i64 0, i64 %38
  store i8 65, ptr %39, align 1, !tbaa !9
  %prol.iter.next = add i32 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i32 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %.lr.ph37.prol.loopexit, label %.lr.ph37.prol, !llvm.loop !14

.lr.ph37.prol.loopexit:                           ; preds = %.lr.ph37.prol, %.lr.ph37.preheader
  %indvars.iv.next60.lcssa.unr = phi i64 [ poison, %.lr.ph37.preheader ], [ %indvars.iv.next60.prol, %.lr.ph37.prol ]
  %indvars.iv59.unr = phi i64 [ %34, %.lr.ph37.preheader ], [ %indvars.iv.next60.prol, %.lr.ph37.prol ]
  %.in.unr = phi i32 [ %.pre66, %.lr.ph37.preheader ], [ %35, %.lr.ph37.prol ]
  %40 = icmp ult i32 %.pre66, 4
  br i1 %40, label %.preheader.loopexit, label %.lr.ph37

.preheader.loopexit:                              ; preds = %.lr.ph37, %.lr.ph37.prol.loopexit
  %indvars.iv.next60.lcssa = phi i64 [ %indvars.iv.next60.lcssa.unr, %.lr.ph37.prol.loopexit ], [ %indvars.iv.next60.3, %.lr.ph37 ]
  %41 = trunc nsw i64 %indvars.iv.next60.lcssa to i32
  br label %.preheader

.preheader:                                       ; preds = %.preheader.loopexit, %.preheader19
  %.0.lcssa = phi i32 [ %7, %.preheader19 ], [ %41, %.preheader.loopexit ]
  store i32 -1, ptr %1, align 4, !tbaa !5
  %.not1742 = icmp eq i32 %.pre67, 0
  br i1 %.not1742, label %.loopexit, label %.lr.ph44.preheader

.lr.ph44.preheader:                               ; preds = %.preheader
  %42 = sext i32 %.0.lcssa to i64
  %xtraiter77 = and i32 %.pre67, 3
  %lcmp.mod78.not = icmp eq i32 %xtraiter77, 0
  br i1 %lcmp.mod78.not, label %.lr.ph44.prol.loopexit, label %.lr.ph44.prol

.lr.ph44.prol:                                    ; preds = %.lr.ph44.preheader, %.lr.ph44.prol
  %indvars.iv62.prol = phi i64 [ %indvars.iv.next63.prol, %.lr.ph44.prol ], [ %42, %.lr.ph44.preheader ]
  %.in74.prol = phi i32 [ %43, %.lr.ph44.prol ], [ %.pre67, %.lr.ph44.preheader ]
  %prol.iter79 = phi i32 [ %prol.iter79.next, %.lr.ph44.prol ], [ 0, %.lr.ph44.preheader ]
  %43 = add nsw i32 %.in74.prol, -1
  %indvars.iv.next63.prol = add nsw i64 %indvars.iv62.prol, -1
  %44 = getelementptr inbounds [40001 x i32], ptr @_ZZ4mainE3ord, i64 0, i64 %indvars.iv.next63.prol
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [40001 x i8], ptr @_ZZ4mainE3buf, i64 0, i64 %46
  store i8 66, ptr %47, align 1, !tbaa !9
  %prol.iter79.next = add i32 %prol.iter79, 1
  %prol.iter79.cmp.not = icmp eq i32 %prol.iter79.next, %xtraiter77
  br i1 %prol.iter79.cmp.not, label %.lr.ph44.prol.loopexit, label %.lr.ph44.prol, !llvm.loop !15

.lr.ph44.prol.loopexit:                           ; preds = %.lr.ph44.prol, %.lr.ph44.preheader
  %indvars.iv62.unr = phi i64 [ %42, %.lr.ph44.preheader ], [ %indvars.iv.next63.prol, %.lr.ph44.prol ]
  %.in74.unr = phi i32 [ %.pre67, %.lr.ph44.preheader ], [ %43, %.lr.ph44.prol ]
  %48 = icmp ult i32 %.pre67, 4
  br i1 %48, label %.loopexit, label %.lr.ph44

.lr.ph37:                                         ; preds = %.lr.ph37.prol.loopexit, %.lr.ph37
  %indvars.iv59 = phi i64 [ %indvars.iv.next60.3, %.lr.ph37 ], [ %indvars.iv59.unr, %.lr.ph37.prol.loopexit ]
  %.in = phi i32 [ %61, %.lr.ph37 ], [ %.in.unr, %.lr.ph37.prol.loopexit ]
  %indvars.iv.next60 = add nsw i64 %indvars.iv59, -1
  %49 = getelementptr inbounds [40001 x i32], ptr @_ZZ4mainE3ord, i64 0, i64 %indvars.iv.next60
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [40001 x i8], ptr @_ZZ4mainE3buf, i64 0, i64 %51
  store i8 65, ptr %52, align 1, !tbaa !9
  %indvars.iv.next60.1 = add nsw i64 %indvars.iv59, -2
  %53 = getelementptr inbounds [40001 x i32], ptr @_ZZ4mainE3ord, i64 0, i64 %indvars.iv.next60.1
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [40001 x i8], ptr @_ZZ4mainE3buf, i64 0, i64 %55
  store i8 65, ptr %56, align 1, !tbaa !9
  %indvars.iv.next60.2 = add nsw i64 %indvars.iv59, -3
  %57 = getelementptr inbounds [40001 x i32], ptr @_ZZ4mainE3ord, i64 0, i64 %indvars.iv.next60.2
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [40001 x i8], ptr @_ZZ4mainE3buf, i64 0, i64 %59
  store i8 65, ptr %60, align 1, !tbaa !9
  %61 = add nsw i32 %.in, -4
  %indvars.iv.next60.3 = add nsw i64 %indvars.iv59, -4
  %62 = getelementptr inbounds [40001 x i32], ptr @_ZZ4mainE3ord, i64 0, i64 %indvars.iv.next60.3
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [40001 x i8], ptr @_ZZ4mainE3buf, i64 0, i64 %64
  store i8 65, ptr %65, align 1, !tbaa !9
  %.not16.3 = icmp eq i32 %61, 0
  br i1 %.not16.3, label %.preheader.loopexit, label %.lr.ph37, !llvm.loop !16

.lr.ph44:                                         ; preds = %.lr.ph44.prol.loopexit, %.lr.ph44
  %indvars.iv62 = phi i64 [ %indvars.iv.next63.3, %.lr.ph44 ], [ %indvars.iv62.unr, %.lr.ph44.prol.loopexit ]
  %.in74 = phi i32 [ %78, %.lr.ph44 ], [ %.in74.unr, %.lr.ph44.prol.loopexit ]
  %indvars.iv.next63 = add nsw i64 %indvars.iv62, -1
  %66 = getelementptr inbounds [40001 x i32], ptr @_ZZ4mainE3ord, i64 0, i64 %indvars.iv.next63
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [40001 x i8], ptr @_ZZ4mainE3buf, i64 0, i64 %68
  store i8 66, ptr %69, align 1, !tbaa !9
  %indvars.iv.next63.1 = add nsw i64 %indvars.iv62, -2
  %70 = getelementptr inbounds [40001 x i32], ptr @_ZZ4mainE3ord, i64 0, i64 %indvars.iv.next63.1
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [40001 x i8], ptr @_ZZ4mainE3buf, i64 0, i64 %72
  store i8 66, ptr %73, align 1, !tbaa !9
  %indvars.iv.next63.2 = add nsw i64 %indvars.iv62, -3
  %74 = getelementptr inbounds [40001 x i32], ptr @_ZZ4mainE3ord, i64 0, i64 %indvars.iv.next63.2
  %75 = load i32, ptr %74, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [40001 x i8], ptr @_ZZ4mainE3buf, i64 0, i64 %76
  store i8 66, ptr %77, align 1, !tbaa !9
  %78 = add nsw i32 %.in74, -4
  %indvars.iv.next63.3 = add nsw i64 %indvars.iv62, -4
  %79 = getelementptr inbounds [40001 x i32], ptr @_ZZ4mainE3ord, i64 0, i64 %indvars.iv.next63.3
  %80 = load i32, ptr %79, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [40001 x i8], ptr @_ZZ4mainE3buf, i64 0, i64 %81
  store i8 66, ptr %82, align 1, !tbaa !9
  %.not17.3 = icmp eq i32 %78, 0
  br i1 %.not17.3, label %.loopexit, label %.lr.ph44, !llvm.loop !17

.preheader20.loopexit:                            ; preds = %.lr.ph26, %.lr.ph26.prol.loopexit
  %indvars.iv.next54.lcssa = phi i64 [ %indvars.iv.next54.lcssa.unr, %.lr.ph26.prol.loopexit ], [ %indvars.iv.next54.3, %.lr.ph26 ]
  %83 = trunc nsw i64 %indvars.iv.next54.lcssa to i32
  br label %.preheader20

.preheader20:                                     ; preds = %.preheader20.loopexit, %.preheader22
  %.2.lcssa = phi i32 [ %7, %.preheader22 ], [ %83, %.preheader20.loopexit ]
  store i32 -1, ptr %2, align 4, !tbaa !5
  %.not1529 = icmp eq i32 %.promoted73, 0
  br i1 %.not1529, label %.loopexit21, label %.lr.ph31.preheader

.lr.ph31.preheader:                               ; preds = %.preheader20
  %84 = sext i32 %.2.lcssa to i64
  %xtraiter83 = and i32 %.promoted73, 3
  %lcmp.mod84.not = icmp eq i32 %xtraiter83, 0
  br i1 %lcmp.mod84.not, label %.lr.ph31.prol.loopexit, label %.lr.ph31.prol

.lr.ph31.prol:                                    ; preds = %.lr.ph31.preheader, %.lr.ph31.prol
  %indvars.iv56.prol = phi i64 [ %indvars.iv.next57.prol, %.lr.ph31.prol ], [ %84, %.lr.ph31.preheader ]
  %.in76.prol = phi i32 [ %85, %.lr.ph31.prol ], [ %.promoted73, %.lr.ph31.preheader ]
  %prol.iter85 = phi i32 [ %prol.iter85.next, %.lr.ph31.prol ], [ 0, %.lr.ph31.preheader ]
  %85 = add nsw i32 %.in76.prol, -1
  %indvars.iv.next57.prol = add nsw i64 %indvars.iv56.prol, -1
  %86 = getelementptr inbounds [40001 x i32], ptr @_ZZ4mainE3ord, i64 0, i64 %indvars.iv.next57.prol
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [40001 x i8], ptr @_ZZ4mainE3buf, i64 0, i64 %88
  store i8 65, ptr %89, align 1, !tbaa !9
  %prol.iter85.next = add i32 %prol.iter85, 1
  %prol.iter85.cmp.not = icmp eq i32 %prol.iter85.next, %xtraiter83
  br i1 %prol.iter85.cmp.not, label %.lr.ph31.prol.loopexit, label %.lr.ph31.prol, !llvm.loop !18

.lr.ph31.prol.loopexit:                           ; preds = %.lr.ph31.prol, %.lr.ph31.preheader
  %indvars.iv56.unr = phi i64 [ %84, %.lr.ph31.preheader ], [ %indvars.iv.next57.prol, %.lr.ph31.prol ]
  %.in76.unr = phi i32 [ %.promoted73, %.lr.ph31.preheader ], [ %85, %.lr.ph31.prol ]
  %90 = icmp ult i32 %.promoted73, 4
  br i1 %90, label %.loopexit21, label %.lr.ph31

.lr.ph26:                                         ; preds = %.lr.ph26.prol.loopexit, %.lr.ph26
  %indvars.iv53 = phi i64 [ %indvars.iv.next54.3, %.lr.ph26 ], [ %indvars.iv53.unr, %.lr.ph26.prol.loopexit ]
  %.in75 = phi i32 [ %103, %.lr.ph26 ], [ %.in75.unr, %.lr.ph26.prol.loopexit ]
  %indvars.iv.next54 = add nsw i64 %indvars.iv53, -1
  %91 = getelementptr inbounds [40001 x i32], ptr @_ZZ4mainE3ord, i64 0, i64 %indvars.iv.next54
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [40001 x i8], ptr @_ZZ4mainE3buf, i64 0, i64 %93
  store i8 66, ptr %94, align 1, !tbaa !9
  %indvars.iv.next54.1 = add nsw i64 %indvars.iv53, -2
  %95 = getelementptr inbounds [40001 x i32], ptr @_ZZ4mainE3ord, i64 0, i64 %indvars.iv.next54.1
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [40001 x i8], ptr @_ZZ4mainE3buf, i64 0, i64 %97
  store i8 66, ptr %98, align 1, !tbaa !9
  %indvars.iv.next54.2 = add nsw i64 %indvars.iv53, -3
  %99 = getelementptr inbounds [40001 x i32], ptr @_ZZ4mainE3ord, i64 0, i64 %indvars.iv.next54.2
  %100 = load i32, ptr %99, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [40001 x i8], ptr @_ZZ4mainE3buf, i64 0, i64 %101
  store i8 66, ptr %102, align 1, !tbaa !9
  %103 = add nsw i32 %.in75, -4
  %indvars.iv.next54.3 = add nsw i64 %indvars.iv53, -4
  %104 = getelementptr inbounds [40001 x i32], ptr @_ZZ4mainE3ord, i64 0, i64 %indvars.iv.next54.3
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [40001 x i8], ptr @_ZZ4mainE3buf, i64 0, i64 %106
  store i8 66, ptr %107, align 1, !tbaa !9
  %.not14.3 = icmp eq i32 %103, 0
  br i1 %.not14.3, label %.preheader20.loopexit, label %.lr.ph26, !llvm.loop !19

.lr.ph31:                                         ; preds = %.lr.ph31.prol.loopexit, %.lr.ph31
  %indvars.iv56 = phi i64 [ %indvars.iv.next57.3, %.lr.ph31 ], [ %indvars.iv56.unr, %.lr.ph31.prol.loopexit ]
  %.in76 = phi i32 [ %120, %.lr.ph31 ], [ %.in76.unr, %.lr.ph31.prol.loopexit ]
  %indvars.iv.next57 = add nsw i64 %indvars.iv56, -1
  %108 = getelementptr inbounds [40001 x i32], ptr @_ZZ4mainE3ord, i64 0, i64 %indvars.iv.next57
  %109 = load i32, ptr %108, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [40001 x i8], ptr @_ZZ4mainE3buf, i64 0, i64 %110
  store i8 65, ptr %111, align 1, !tbaa !9
  %indvars.iv.next57.1 = add nsw i64 %indvars.iv56, -2
  %112 = getelementptr inbounds [40001 x i32], ptr @_ZZ4mainE3ord, i64 0, i64 %indvars.iv.next57.1
  %113 = load i32, ptr %112, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [40001 x i8], ptr @_ZZ4mainE3buf, i64 0, i64 %114
  store i8 65, ptr %115, align 1, !tbaa !9
  %indvars.iv.next57.2 = add nsw i64 %indvars.iv56, -3
  %116 = getelementptr inbounds [40001 x i32], ptr @_ZZ4mainE3ord, i64 0, i64 %indvars.iv.next57.2
  %117 = load i32, ptr %116, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [40001 x i8], ptr @_ZZ4mainE3buf, i64 0, i64 %118
  store i8 65, ptr %119, align 1, !tbaa !9
  %120 = add nsw i32 %.in76, -4
  %indvars.iv.next57.3 = add nsw i64 %indvars.iv56, -4
  %121 = getelementptr inbounds [40001 x i32], ptr @_ZZ4mainE3ord, i64 0, i64 %indvars.iv.next57.3
  %122 = load i32, ptr %121, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [40001 x i8], ptr @_ZZ4mainE3buf, i64 0, i64 %123
  store i8 65, ptr %124, align 1, !tbaa !9
  %.not15.3 = icmp eq i32 %120, 0
  br i1 %.not15.3, label %.loopexit21, label %.lr.ph31, !llvm.loop !20

.loopexit:                                        ; preds = %.lr.ph44.prol.loopexit, %.lr.ph44, %.preheader
  store i32 -1, ptr %2, align 4, !tbaa !5
  br label %125

.loopexit21:                                      ; preds = %.lr.ph31.prol.loopexit, %.lr.ph31, %.preheader20
  store i32 -1, ptr %1, align 4, !tbaa !5
  br label %125

125:                                              ; preds = %.loopexit21, %.loopexit
  %126 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @_ZZ4mainE3buf)
  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 i32 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: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt4sortIPiZ4mainE3$_0EvT_S2_T0_"(ptr noundef, ptr noundef, ptr) local_unnamed_addr #3

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

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 = { 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 = { 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 #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 = distinct !{!12, !13}
!13 = !{!"llvm.loop.unroll.disable"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !11}
!17 = distinct !{!17, !11}
!18 = distinct !{!18, !13}
!19 = distinct !{!19, !11}
!20 = distinct !{!20, !11}


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