; LLVM IR from tangjz/acm-icpc :: hdu (6040)

; 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 { i8 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@b = external dso_local global [101 x i32], align 16
@ord = external dso_local global [101 x i32], align 16
@x = external dso_local global i32, align 4
@y = external dso_local global i32, align 4
@z = external dso_local global i32, align 4
@t = external dso_local global i32, align 4
@a = external dso_local global [10000001 x i32], align 16
@ans = external dso_local global [101 x i32], align 16
@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = 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 %class.anon, align 1
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  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 = %141, %0
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m, ptr noundef @x, ptr noundef @y, ptr noundef @z)
  %13 = icmp eq i32 %12, 5
  br i1 %13, label %15, label %14

14:                                               ; preds = %11
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  br label %144

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

16:                                               ; preds = %45, %15
  %17 = load i32, ptr %4, align 4, !tbaa !5
  %18 = load i32, ptr @n, align 4, !tbaa !5
  %19 = icmp slt i32 %17, %18
  br i1 %19, label %21, label %20

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

21:                                               ; preds = %16
  %22 = load i32, ptr @x, align 4, !tbaa !5
  %23 = shl i32 %22, 16
  %24 = load i32, ptr @x, align 4, !tbaa !5
  %25 = xor i32 %24, %23
  store i32 %25, ptr @x, align 4, !tbaa !5
  %26 = load i32, ptr @x, align 4, !tbaa !5
  %27 = lshr i32 %26, 5
  %28 = load i32, ptr @x, align 4, !tbaa !5
  %29 = xor i32 %28, %27
  store i32 %29, ptr @x, align 4, !tbaa !5
  %30 = load i32, ptr @x, align 4, !tbaa !5
  %31 = shl i32 %30, 1
  %32 = load i32, ptr @x, align 4, !tbaa !5
  %33 = xor i32 %32, %31
  store i32 %33, ptr @x, align 4, !tbaa !5
  %34 = load i32, ptr @x, align 4, !tbaa !5
  store i32 %34, ptr @t, align 4, !tbaa !5
  %35 = load i32, ptr @y, align 4, !tbaa !5
  store i32 %35, ptr @x, align 4, !tbaa !5
  %36 = load i32, ptr @z, align 4, !tbaa !5
  store i32 %36, ptr @y, align 4, !tbaa !5
  %37 = load i32, ptr @t, align 4, !tbaa !5
  %38 = load i32, ptr @x, align 4, !tbaa !5
  %39 = xor i32 %37, %38
  %40 = load i32, ptr @y, align 4, !tbaa !5
  %41 = xor i32 %39, %40
  store i32 %41, ptr @z, align 4, !tbaa !5
  %42 = load i32, ptr %4, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [10000001 x i32], ptr @a, i64 0, i64 %43
  store i32 %41, ptr %44, align 4, !tbaa !5
  br label %45

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

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

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

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

54:                                               ; preds = %49
  %55 = load i32, ptr %5, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds i32, ptr @b, i64 %56
  %58 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %57)
  %59 = load i32, ptr %5, align 4, !tbaa !5
  %60 = load i32, ptr %5, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [101 x i32], ptr @ord, i64 0, i64 %61
  store i32 %59, ptr %62, align 4, !tbaa !5
  br label %63

63:                                               ; preds = %54
  %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 %49, !llvm.loop !11

66:                                               ; preds = %53
  %67 = load i32, ptr @m, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds i32, ptr @ord, i64 %68
  call void @"_ZSt4sortIPiZ4mainE3$_0EvT_S2_T0_"(ptr noundef @ord, ptr noundef %69)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %70 = load i32, ptr @n, align 4, !tbaa !5
  store i32 %70, ptr %8, align 4, !tbaa !5
  br label %71

71:                                               ; preds = %112, %66
  %72 = load i32, ptr %7, align 4, !tbaa !5
  %73 = load i32, ptr @m, align 4, !tbaa !5
  %74 = icmp slt i32 %72, %73
  br i1 %74, label %76, label %75

75:                                               ; preds = %71
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %115

76:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %77 = load i32, ptr %7, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [101 x i32], ptr @ord, i64 0, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !5
  store i32 %80, ptr %9, align 4, !tbaa !5
  %81 = load i32, ptr %9, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [101 x i32], ptr @b, i64 0, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = load i32, ptr %8, align 4, !tbaa !5
  %86 = icmp slt i32 %84, %85
  br i1 %86, label %87, label %101

87:                                               ; preds = %76
  %88 = load i32, ptr %9, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [101 x i32], ptr @b, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds i32, ptr @a, i64 %92
  %94 = load i32, ptr %8, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds i32, ptr @a, i64 %95
  call void @_ZSt11nth_elementIPjEvT_S1_S1_(ptr noundef @a, ptr noundef %93, ptr noundef %96)
  %97 = load i32, ptr %9, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [101 x i32], ptr @b, i64 0, i64 %98
  %100 = load i32, ptr %99, align 4, !tbaa !5
  store i32 %100, ptr %8, align 4, !tbaa !5
  br label %101

101:                                              ; preds = %87, %76
  %102 = load i32, ptr %9, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [101 x i32], ptr @b, i64 0, i64 %103
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [10000001 x i32], ptr @a, i64 0, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = load i32, ptr %9, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [101 x i32], ptr @ans, i64 0, i64 %110
  store i32 %108, ptr %111, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %112

112:                                              ; preds = %101
  %113 = load i32, ptr %7, align 4, !tbaa !5
  %114 = add nsw i32 %113, 1
  store i32 %114, ptr %7, align 4, !tbaa !5
  br label %71, !llvm.loop !12

115:                                              ; preds = %75
  %116 = load i32, ptr %2, align 4, !tbaa !5
  %117 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %116)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %118

118:                                              ; preds = %137, %115
  %119 = load i32, ptr %10, align 4, !tbaa !5
  %120 = load i32, ptr @m, align 4, !tbaa !5
  %121 = icmp slt i32 %119, %120
  br i1 %121, label %123, label %122

122:                                              ; preds = %118
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %140

123:                                              ; preds = %118
  %124 = load i32, ptr %10, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [101 x i32], ptr @ans, i64 0, i64 %125
  %127 = load i32, ptr %126, align 4, !tbaa !5
  %128 = load i32, ptr %10, align 4, !tbaa !5
  %129 = load i32, ptr @m, align 4, !tbaa !5
  %130 = sub nsw i32 %129, 1
  %131 = icmp eq i32 %128, %130
  %132 = zext i1 %131 to i64
  %133 = getelementptr inbounds [3 x i8], ptr @.str.4, i64 0, i64 %132
  %134 = load i8, ptr %133, align 1, !tbaa !13
  %135 = sext i8 %134 to i32
  %136 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %127, i32 noundef %135)
  br label %137

137:                                              ; preds = %123
  %138 = load i32, ptr %10, align 4, !tbaa !5
  %139 = add nsw i32 %138, 1
  store i32 %139, ptr %10, align 4, !tbaa !5
  br label %118, !llvm.loop !14

140:                                              ; preds = %122
  br label %141

141:                                              ; preds = %140
  %142 = load i32, ptr %2, align 4, !tbaa !5
  %143 = add nsw i32 %142, 1
  store i32 %143, ptr %2, align 4, !tbaa !5
  br label %11, !llvm.loop !15

144:                                              ; preds = %14
  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) #3

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

declare i32 @printf(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 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !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"

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@b = external dso_local global [101 x i32], align 16
@ord = external dso_local global [101 x i32], align 16
@x = external dso_local global i32, align 4
@y = external dso_local global i32, align 4
@z = external dso_local global i32, align 4
@t = external dso_local local_unnamed_addr global i32, align 4
@a = external dso_local global [10000001 x i32], align 16
@ans = external dso_local local_unnamed_addr global [101 x i32], align 16
@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = 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 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m, ptr noundef nonnull @x, ptr noundef nonnull @y, ptr noundef nonnull @z)
  %2 = icmp eq i32 %1, 5
  br i1 %2, label %.preheader32, label %._crit_edge50

.preheader32:                                     ; preds = %0, %._crit_edge48
  %.02449 = phi i32 [ %73, %._crit_edge48 ], [ 1, %0 ]
  %3 = load i32, ptr @n, align 4, !tbaa !5
  %4 = icmp sgt i32 %3, 0
  br i1 %4, label %.lr.ph.preheader, label %.preheader

.lr.ph.preheader:                                 ; preds = %.preheader32
  %z.promoted = load i32, ptr @z, align 4, !tbaa !5
  %y.promoted = load i32, ptr @y, align 4, !tbaa !5
  %x.promoted = load i32, ptr @x, align 4, !tbaa !5
  %wide.trip.count = zext nneg i32 %3 to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %5 = icmp eq i32 %3, 1
  br i1 %5, label %..preheader_crit_edge.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i64 %wide.trip.count, 2147483646
  br label %.lr.ph

._crit_edge50:                                    ; preds = %._crit_edge48, %0
  ret i32 0

..preheader_crit_edge.unr-lcssa:                  ; preds = %.lr.ph, %.lr.ph.preheader
  %.lcssa77.ph = phi i32 [ poison, %.lr.ph.preheader ], [ %19, %.lr.ph ]
  %.lcssa76.ph = phi i32 [ poison, %.lr.ph.preheader ], [ %27, %.lr.ph ]
  %.lcssa75.ph = phi i32 [ poison, %.lr.ph.preheader ], [ %34, %.lr.ph ]
  %.lcssa.ph = phi i32 [ poison, %.lr.ph.preheader ], [ %35, %.lr.ph ]
  %indvars.iv.unr = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next.1, %.lr.ph ]
  %.unr = phi i32 [ %x.promoted, %.lr.ph.preheader ], [ %19, %.lr.ph ]
  %.unr79 = phi i32 [ %y.promoted, %.lr.ph.preheader ], [ %27, %.lr.ph ]
  %.unr80 = phi i32 [ %z.promoted, %.lr.ph.preheader ], [ %35, %.lr.ph ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %..preheader_crit_edge, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %..preheader_crit_edge.unr-lcssa
  %6 = shl i32 %.unr, 16
  %7 = xor i32 %6, %.unr
  %8 = lshr i32 %7, 5
  %9 = xor i32 %8, %7
  %10 = shl i32 %9, 1
  %11 = xor i32 %10, %9
  %12 = xor i32 %.unr80, %.unr79
  %13 = xor i32 %12, %11
  %14 = getelementptr inbounds [10000001 x i32], ptr @a, i64 0, i64 %indvars.iv.unr
  store i32 %13, ptr %14, align 4, !tbaa !5
  br label %..preheader_crit_edge

..preheader_crit_edge:                            ; preds = %..preheader_crit_edge.unr-lcssa, %.lr.ph.epil
  %.lcssa77 = phi i32 [ %.lcssa77.ph, %..preheader_crit_edge.unr-lcssa ], [ %.unr79, %.lr.ph.epil ]
  %.lcssa76 = phi i32 [ %.lcssa76.ph, %..preheader_crit_edge.unr-lcssa ], [ %.unr80, %.lr.ph.epil ]
  %.lcssa75 = phi i32 [ %.lcssa75.ph, %..preheader_crit_edge.unr-lcssa ], [ %11, %.lr.ph.epil ]
  %.lcssa = phi i32 [ %.lcssa.ph, %..preheader_crit_edge.unr-lcssa ], [ %13, %.lr.ph.epil ]
  store i32 %.lcssa77, ptr @x, align 4, !tbaa !5
  store i32 %.lcssa75, ptr @t, align 4, !tbaa !5
  store i32 %.lcssa76, ptr @y, align 4, !tbaa !5
  store i32 %.lcssa, ptr @z, align 4, !tbaa !5
  br label %.preheader

.preheader:                                       ; preds = %..preheader_crit_edge, %.preheader32
  %15 = load i32, ptr @m, align 4, !tbaa !5
  %16 = icmp sgt i32 %15, 0
  br i1 %16, label %.lr.ph39, label %.preheader.._crit_edge_crit_edge

.preheader.._crit_edge_crit_edge:                 ; preds = %.preheader
  %.pre66 = sext i32 %15 to i64
  br label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader.new ], [ %indvars.iv.next.1, %.lr.ph ]
  %17 = phi i32 [ %x.promoted, %.lr.ph.preheader.new ], [ %19, %.lr.ph ]
  %18 = phi i32 [ %y.promoted, %.lr.ph.preheader.new ], [ %27, %.lr.ph ]
  %19 = phi i32 [ %z.promoted, %.lr.ph.preheader.new ], [ %35, %.lr.ph ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.1, %.lr.ph ]
  %20 = shl i32 %17, 16
  %21 = xor i32 %20, %17
  %22 = lshr i32 %21, 5
  %23 = xor i32 %22, %21
  %24 = shl i32 %23, 1
  %25 = xor i32 %24, %23
  %26 = xor i32 %18, %25
  %27 = xor i32 %26, %19
  %28 = getelementptr inbounds [10000001 x i32], ptr @a, i64 0, i64 %indvars.iv
  store i32 %27, ptr %28, align 8, !tbaa !5
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %29 = shl i32 %18, 16
  %30 = xor i32 %29, %18
  %31 = lshr i32 %30, 5
  %32 = xor i32 %31, %30
  %33 = shl i32 %32, 1
  %34 = xor i32 %33, %32
  %35 = xor i32 %26, %34
  %36 = getelementptr inbounds [10000001 x i32], ptr @a, i64 0, i64 %indvars.iv.next
  store i32 %35, ptr %36, align 4, !tbaa !5
  %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 %..preheader_crit_edge.unr-lcssa, label %.lr.ph, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph39, %.preheader.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre66, %.preheader.._crit_edge_crit_edge ], [ %46, %.lr.ph39 ]
  %37 = getelementptr inbounds i32, ptr @ord, i64 %.pre-phi
  tail call void @"_ZSt4sortIPiZ4mainE3$_0EvT_S2_T0_"(ptr noundef nonnull @ord, ptr noundef nonnull %37)
  %38 = load i32, ptr @m, align 4, !tbaa !5
  %39 = icmp sgt i32 %38, 0
  br i1 %39, label %.lr.ph43.preheader, label %._crit_edge44

.lr.ph43.preheader:                               ; preds = %._crit_edge
  %40 = load i32, ptr @n, align 4, !tbaa !5
  br label %.lr.ph43

.lr.ph39:                                         ; preds = %.preheader, %.lr.ph39
  %indvars.iv57 = phi i64 [ %indvars.iv.next58, %.lr.ph39 ], [ 0, %.preheader ]
  %41 = getelementptr inbounds i32, ptr @b, i64 %indvars.iv57
  %42 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %41)
  %43 = getelementptr inbounds [101 x i32], ptr @ord, i64 0, i64 %indvars.iv57
  %44 = trunc nuw nsw i64 %indvars.iv57 to i32
  store i32 %44, ptr %43, align 4, !tbaa !5
  %indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
  %45 = load i32, ptr @m, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = icmp slt i64 %indvars.iv.next58, %46
  br i1 %47, label %.lr.ph39, label %._crit_edge, !llvm.loop !11

._crit_edge44:                                    ; preds = %64, %._crit_edge
  %48 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.02449)
  %49 = load i32, ptr @m, align 4, !tbaa !5
  %50 = icmp sgt i32 %49, 0
  br i1 %50, label %.lr.ph47, label %._crit_edge48

.lr.ph43:                                         ; preds = %.lr.ph43.preheader, %64
  %51 = phi i32 [ %38, %.lr.ph43.preheader ], [ %65, %64 ]
  %indvars.iv60 = phi i64 [ 0, %.lr.ph43.preheader ], [ %indvars.iv.next61, %64 ]
  %.02541 = phi i32 [ %40, %.lr.ph43.preheader ], [ %.1, %64 ]
  %52 = getelementptr inbounds [101 x i32], ptr @ord, i64 0, i64 %indvars.iv60
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [101 x i32], ptr @b, i64 0, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = icmp slt i32 %56, %.02541
  br i1 %57, label %58, label %64

58:                                               ; preds = %.lr.ph43
  %59 = sext i32 %56 to i64
  %60 = getelementptr inbounds i32, ptr @a, i64 %59
  %61 = sext i32 %.02541 to i64
  %62 = getelementptr inbounds i32, ptr @a, i64 %61
  tail call void @_ZSt11nth_elementIPjEvT_S1_S1_(ptr noundef nonnull @a, ptr noundef nonnull %60, ptr noundef nonnull %62)
  %63 = load i32, ptr %55, align 4, !tbaa !5
  %.pre = load i32, ptr @m, align 4, !tbaa !5
  br label %64

64:                                               ; preds = %58, %.lr.ph43
  %65 = phi i32 [ %.pre, %58 ], [ %51, %.lr.ph43 ]
  %66 = phi i32 [ %63, %58 ], [ %56, %.lr.ph43 ]
  %.1 = phi i32 [ %63, %58 ], [ %.02541, %.lr.ph43 ]
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [10000001 x i32], ptr @a, i64 0, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %70 = getelementptr inbounds [101 x i32], ptr @ans, i64 0, i64 %54
  store i32 %69, ptr %70, align 4, !tbaa !5
  %indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1
  %71 = sext i32 %65 to i64
  %72 = icmp slt i64 %indvars.iv.next61, %71
  br i1 %72, label %.lr.ph43, label %._crit_edge44, !llvm.loop !12

._crit_edge48:                                    ; preds = %.lr.ph47, %._crit_edge44
  %73 = add nuw nsw i32 %.02449, 1
  %74 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m, ptr noundef nonnull @x, ptr noundef nonnull @y, ptr noundef nonnull @z)
  %75 = icmp eq i32 %74, 5
  br i1 %75, label %.preheader32, label %._crit_edge50, !llvm.loop !13

.lr.ph47:                                         ; preds = %._crit_edge44, %.lr.ph47
  %indvars.iv63 = phi i64 [ %indvars.iv.next64, %.lr.ph47 ], [ 0, %._crit_edge44 ]
  %76 = phi i32 [ %87, %.lr.ph47 ], [ %49, %._crit_edge44 ]
  %77 = getelementptr inbounds [101 x i32], ptr @ans, i64 0, i64 %indvars.iv63
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = add nsw i32 %76, -1
  %80 = zext i32 %79 to i64
  %81 = icmp eq i64 %indvars.iv63, %80
  %82 = zext i1 %81 to i64
  %83 = getelementptr inbounds [3 x i8], ptr @.str.4, i64 0, i64 %82
  %84 = load i8, ptr %83, align 1, !tbaa !14
  %85 = sext i8 %84 to i32
  %86 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %78, i32 noundef %85)
  %indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
  %87 = load i32, ptr @m, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = icmp slt i64 %indvars.iv.next64, %88
  br i1 %89, label %.lr.ph47, label %._crit_edge48, !llvm.loop !15
}

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

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 = !{!7, !7, i64 0}
!15 = distinct !{!15, !10}


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