; LLVM IR from tangjz/acm-icpc :: lydsy (5300)

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

@t = external dso_local global i32, align 4
@a = external dso_local global [11 x i32], align 16
@ord = external dso_local global [11 x i32], align 16
@len = external dso_local global i32, align 4
@buf = external dso_local global [11 x [30115 x i8]], align 16
@num = external dso_local global [1673 x i64], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [8 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 i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  store i32 0, ptr %1, align 4
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %15

15:                                               ; preds = %68, %0
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = load i32, ptr @t, align 4, !tbaa !5
  %18 = icmp sle i32 %16, %17
  br i1 %18, label %20, label %19

19:                                               ; preds = %15
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %71

20:                                               ; preds = %15
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds i32, ptr @a, i64 %22
  %24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %23)
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [11 x i32], ptr @ord, i64 0, i64 %27
  store i32 %25, ptr %28, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %63, %20
  %30 = load i32, ptr %4, align 4, !tbaa !5
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = icmp slt i32 %30, %31
  br i1 %32, label %34, label %33

33:                                               ; preds = %29
  store i32 5, ptr %3, align 4
  br label %66

34:                                               ; preds = %29
  %35 = load i32, ptr %4, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [11 x i32], ptr @ord, i64 0, i64 %36
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [11 x i32], ptr @a, i64 0, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = load i32, ptr %2, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [11 x i32], ptr @ord, i64 0, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [11 x i32], ptr @a, i64 0, i64 %46
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = icmp sgt i32 %41, %48
  br i1 %49, label %50, label %62

50:                                               ; preds = %34
  %51 = load i32, ptr %4, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds i32, ptr @ord, i64 %52
  %54 = load i32, ptr %2, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds i32, ptr @ord, i64 %55
  %57 = load i32, ptr %2, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds i32, ptr @ord, i64 %58
  %60 = getelementptr inbounds i32, ptr %59, i64 1
  %61 = call noundef ptr @_ZNSt3_V26rotateIPiEET_S2_S2_S2_(ptr noundef %53, ptr noundef %56, ptr noundef %60)
  store i32 5, ptr %3, align 4
  br label %66

62:                                               ; preds = %34
  br label %63

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

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

67:                                               ; preds = %66
  br label %68

68:                                               ; preds = %67
  %69 = load i32, ptr %2, align 4, !tbaa !5
  %70 = add nsw i32 %69, 1
  store i32 %70, ptr %2, align 4, !tbaa !5
  br label %15, !llvm.loop !11

71:                                               ; preds = %19
  store i32 1, ptr @len, align 4, !tbaa !5
  store i64 2, ptr @num, align 16, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %72

72:                                               ; preds = %188, %71
  %73 = load i32, ptr %5, align 4, !tbaa !5
  %74 = load i32, ptr @t, align 4, !tbaa !5
  %75 = icmp sle i32 %73, %74
  br i1 %75, label %77, label %76

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

77:                                               ; preds = %72
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %78 = load i32, ptr %5, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [11 x i32], ptr @ord, i64 0, i64 %79
  %81 = load i32, ptr %80, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [11 x i32], ptr @a, i64 0, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = load i32, ptr %5, align 4, !tbaa !5
  %86 = sub nsw i32 %85, 1
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [11 x i32], ptr @ord, i64 0, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [11 x i32], ptr @a, i64 0, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = sub nsw i32 %84, %92
  store i32 %93, ptr %6, align 4, !tbaa !5
  br label %94

94:                                               ; preds = %151, %77
  %95 = load i32, ptr %6, align 4, !tbaa !5
  %96 = add nsw i32 %95, -1
  store i32 %96, ptr %6, align 4, !tbaa !5
  %97 = icmp ne i32 %95, 0
  br i1 %97, label %99, label %98

98:                                               ; preds = %94
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %152

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

100:                                              ; preds = %111, %99
  %101 = load i32, ptr %7, align 4, !tbaa !5
  %102 = load i32, ptr @len, align 4, !tbaa !5
  %103 = icmp slt i32 %101, %102
  br i1 %103, label %105, label %104

104:                                              ; preds = %100
  store i32 13, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %114

105:                                              ; preds = %100
  %106 = load i32, ptr %7, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [1673 x i64], ptr @num, i64 0, i64 %107
  %109 = load i64, ptr %108, align 8, !tbaa !12
  %110 = shl i64 %109, 1
  store i64 %110, ptr %108, align 8, !tbaa !12
  br label %111

111:                                              ; preds = %105
  %112 = load i32, ptr %7, align 4, !tbaa !5
  %113 = add nsw i32 %112, 1
  store i32 %113, ptr %7, align 4, !tbaa !5
  br label %100, !llvm.loop !14

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

115:                                              ; preds = %139, %114
  %116 = load i32, ptr %8, align 4, !tbaa !5
  %117 = load i32, ptr @len, align 4, !tbaa !5
  %118 = icmp slt i32 %116, %117
  br i1 %118, label %120, label %119

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

120:                                              ; preds = %115
  %121 = load i32, ptr %8, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [1673 x i64], ptr @num, i64 0, i64 %122
  %124 = load i64, ptr %123, align 8, !tbaa !12
  %125 = icmp sge i64 %124, 1000000000000000000
  br i1 %125, label %126, label %138

126:                                              ; preds = %120
  %127 = load i32, ptr %8, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [1673 x i64], ptr @num, i64 0, i64 %128
  %130 = load i64, ptr %129, align 8, !tbaa !12
  %131 = sub nsw i64 %130, 1000000000000000000
  store i64 %131, ptr %129, align 8, !tbaa !12
  %132 = load i32, ptr %8, align 4, !tbaa !5
  %133 = add nsw i32 %132, 1
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [1673 x i64], ptr @num, i64 0, i64 %134
  %136 = load i64, ptr %135, align 8, !tbaa !12
  %137 = add nsw i64 %136, 1
  store i64 %137, ptr %135, align 8, !tbaa !12
  br label %138

138:                                              ; preds = %126, %120
  br label %139

139:                                              ; preds = %138
  %140 = load i32, ptr %8, align 4, !tbaa !5
  %141 = add nsw i32 %140, 1
  store i32 %141, ptr %8, align 4, !tbaa !5
  br label %115, !llvm.loop !15

142:                                              ; preds = %119
  %143 = load i32, ptr @len, align 4, !tbaa !5
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [1673 x i64], ptr @num, i64 0, i64 %144
  %146 = load i64, ptr %145, align 8, !tbaa !12
  %147 = icmp ne i64 %146, 0
  br i1 %147, label %148, label %151

148:                                              ; preds = %142
  %149 = load i32, ptr @len, align 4, !tbaa !5
  %150 = add nsw i32 %149, 1
  store i32 %150, ptr @len, align 4, !tbaa !5
  br label %151

151:                                              ; preds = %148, %142
  br label %94, !llvm.loop !16

152:                                              ; preds = %98
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  store i64 0, ptr %9, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %153 = load i32, ptr %5, align 4, !tbaa !5
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [11 x i32], ptr @ord, i64 0, i64 %154
  %156 = load i32, ptr %155, align 4, !tbaa !5
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds [11 x [30115 x i8]], ptr @buf, i64 0, i64 %157
  %159 = getelementptr inbounds [30115 x i8], ptr %158, i64 0, i64 0
  store ptr %159, ptr %10, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %160 = load i32, ptr @len, align 4, !tbaa !5
  %161 = sub nsw i32 %160, 1
  store i32 %161, ptr %11, align 4, !tbaa !5
  br label %162

162:                                              ; preds = %183, %152
  %163 = load i32, ptr %11, align 4, !tbaa !5
  %164 = icmp sge i32 %163, 0
  br i1 %164, label %166, label %165

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

166:                                              ; preds = %162
  %167 = load i64, ptr %9, align 8, !tbaa !12
  %168 = mul nsw i64 %167, 1000000000000000000
  %169 = load i32, ptr %11, align 4, !tbaa !5
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds [1673 x i64], ptr @num, i64 0, i64 %170
  %172 = load i64, ptr %171, align 8, !tbaa !12
  %173 = add nsw i64 %168, %172
  store i64 %173, ptr %9, align 8, !tbaa !12
  %174 = load ptr, ptr %10, align 8, !tbaa !17
  %175 = load i64, ptr %9, align 8, !tbaa !12
  %176 = sdiv i64 %175, 3
  %177 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %174, ptr noundef @.str.1, i64 noundef %176) #5
  %178 = load ptr, ptr %10, align 8, !tbaa !17
  %179 = sext i32 %177 to i64
  %180 = getelementptr inbounds i8, ptr %178, i64 %179
  store ptr %180, ptr %10, align 8, !tbaa !17
  %181 = load i64, ptr %9, align 8, !tbaa !12
  %182 = srem i64 %181, 3
  store i64 %182, ptr %9, align 8, !tbaa !12
  br label %183

183:                                              ; preds = %166
  %184 = load i32, ptr %11, align 4, !tbaa !5
  %185 = add nsw i32 %184, -1
  store i32 %185, ptr %11, align 4, !tbaa !5
  br label %162, !llvm.loop !19

186:                                              ; preds = %165
  %187 = load ptr, ptr %10, align 8, !tbaa !17
  store i8 0, ptr %187, align 1, !tbaa !20
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %188

188:                                              ; preds = %186
  %189 = load i32, ptr %5, align 4, !tbaa !5
  %190 = add nsw i32 %189, 1
  store i32 %190, ptr %5, align 4, !tbaa !5
  br label %72, !llvm.loop !21

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

192:                                              ; preds = %214, %191
  %193 = load i32, ptr %12, align 4, !tbaa !5
  %194 = load i32, ptr @t, align 4, !tbaa !5
  %195 = icmp sle i32 %193, %194
  br i1 %195, label %197, label %196

196:                                              ; preds = %192
  store i32 22, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %217

197:                                              ; preds = %192
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %198 = load i32, ptr %12, align 4, !tbaa !5
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds [11 x [30115 x i8]], ptr @buf, i64 0, i64 %199
  %201 = getelementptr inbounds [30115 x i8], ptr %200, i64 0, i64 0
  store ptr %201, ptr %13, align 8, !tbaa !17
  br label %202

202:                                              ; preds = %208, %197
  %203 = load ptr, ptr %13, align 8, !tbaa !17
  %204 = load i8, ptr %203, align 1, !tbaa !20
  %205 = sext i8 %204 to i32
  %206 = icmp eq i32 %205, 48
  br i1 %206, label %207, label %211

207:                                              ; preds = %202
  br label %208

208:                                              ; preds = %207
  %209 = load ptr, ptr %13, align 8, !tbaa !17
  %210 = getelementptr inbounds i8, ptr %209, i32 1
  store ptr %210, ptr %13, align 8, !tbaa !17
  br label %202, !llvm.loop !22

211:                                              ; preds = %202
  %212 = load ptr, ptr %13, align 8, !tbaa !17
  %213 = call i32 @puts(ptr noundef %212)
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %214

214:                                              ; preds = %211
  %215 = load i32, ptr %12, align 4, !tbaa !5
  %216 = add nsw i32 %215, 1
  store i32 %216, ptr %12, align 4, !tbaa !5
  br label %192, !llvm.loop !23

217:                                              ; preds = %196
  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 uwtable
declare dso_local noundef ptr @_ZNSt3_V26rotateIPiEET_S2_S2_S2_(ptr noundef, ptr noundef, ptr noundef) #3

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

; Function Attrs: nounwind
declare i32 @sprintf(ptr noundef, ptr noundef, ...) #4

declare i32 @puts(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 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 "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }

!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 = !{!13, !13, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = !{!18, !18, i64 0}
!18 = !{!"any pointer", !7, i64 0}
!19 = distinct !{!19, !10}
!20 = !{!7, !7, i64 0}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !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"

@t = external dso_local global i32, align 4
@a = external dso_local global [11 x i32], align 16
@ord = external dso_local global [11 x i32], align 16
@len = external dso_local local_unnamed_addr global i32, align 4
@buf = external dso_local global [11 x [30115 x i8]], align 16
@num = external dso_local local_unnamed_addr global [1673 x i64], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [8 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 @t)
  %2 = load i32, ptr @t, align 4, !tbaa !5
  %.not61 = icmp slt i32 %2, 1
  br i1 %.not61, label %._crit_edge.thread, label %.lr.ph64

._crit_edge.thread:                               ; preds = %0
  store i32 1, ptr @len, align 4, !tbaa !5
  store i64 2, ptr @num, align 16, !tbaa !9
  br label %._crit_edge85

._crit_edge:                                      ; preds = %.loopexit
  store i32 1, ptr @len, align 4, !tbaa !5
  store i64 2, ptr @num, align 16, !tbaa !9
  %.not5378 = icmp slt i32 %21, 1
  br i1 %.not5378, label %._crit_edge85, label %.lr.ph81

.lr.ph64:                                         ; preds = %0, %.loopexit
  %indvars.iv89 = phi i64 [ %indvars.iv.next90, %.loopexit ], [ 1, %0 ]
  %3 = getelementptr inbounds i32, ptr @a, i64 %indvars.iv89
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %3)
  %5 = getelementptr inbounds [11 x i32], ptr @ord, i64 0, i64 %indvars.iv89
  %6 = trunc nuw nsw i64 %indvars.iv89 to i32
  store i32 %6, ptr %5, align 4, !tbaa !5
  %7 = icmp ugt i64 %indvars.iv89, 1
  br i1 %7, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %.lr.ph64
  %8 = load i32, ptr %3, align 4, !tbaa !5
  br label %10

9:                                                ; preds = %10
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %indvars.iv89
  br i1 %exitcond.not, label %.loopexit, label %10, !llvm.loop !11

10:                                               ; preds = %.lr.ph, %9
  %indvars.iv = phi i64 [ 1, %.lr.ph ], [ %indvars.iv.next, %9 ]
  %11 = getelementptr inbounds [11 x i32], ptr @ord, i64 0, i64 %indvars.iv
  %12 = load i32, ptr %11, align 4, !tbaa !5
  %13 = sext i32 %12 to i64
  %14 = getelementptr inbounds [11 x i32], ptr @a, i64 0, i64 %13
  %15 = load i32, ptr %14, align 4, !tbaa !5
  %16 = icmp sgt i32 %15, %8
  br i1 %16, label %17, label %9

17:                                               ; preds = %10
  %18 = getelementptr inbounds [11 x i32], ptr @ord, i64 0, i64 %indvars.iv
  %19 = getelementptr inbounds i8, ptr %5, i64 4
  %20 = tail call noundef ptr @_ZNSt3_V26rotateIPiEET_S2_S2_S2_(ptr noundef nonnull %18, ptr noundef nonnull %5, ptr noundef nonnull %19)
  br label %.loopexit

.loopexit:                                        ; preds = %9, %.lr.ph64, %17
  %indvars.iv.next90 = add nuw nsw i64 %indvars.iv89, 1
  %21 = load i32, ptr @t, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %.not.not = icmp slt i64 %indvars.iv89, %22
  br i1 %.not.not, label %.lr.ph64, label %._crit_edge, !llvm.loop !13

.preheader:                                       ; preds = %._crit_edge77
  %23 = icmp slt i32 %71, 1
  br i1 %23, label %._crit_edge85, label %.lr.ph84

.lr.ph81:                                         ; preds = %._crit_edge, %._crit_edge77
  %24 = phi i32 [ %71, %._crit_edge77 ], [ %21, %._crit_edge ]
  %indvars.iv104 = phi i64 [ %indvars.iv.next105, %._crit_edge77 ], [ 1, %._crit_edge ]
  %25 = getelementptr inbounds [11 x i32], ptr @ord, i64 0, i64 %indvars.iv104
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [11 x i32], ptr @a, i64 0, i64 %27
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %30 = add nsw i64 %indvars.iv104, -1
  %31 = getelementptr inbounds [11 x i32], ptr @ord, i64 0, i64 %30
  %32 = load i32, ptr %31, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [11 x i32], ptr @a, i64 0, i64 %33
  %35 = load i32, ptr %34, align 4, !tbaa !5
  %len.promoted = load i32, ptr @len, align 4, !tbaa !5
  %.not5570 = icmp eq i32 %29, %35
  br i1 %.not5570, label %._crit_edge71, label %.preheader58.preheader

.preheader58.preheader:                           ; preds = %.lr.ph81
  %36 = xor i32 %35, -1
  %37 = add i32 %29, %36
  br label %.preheader58

.preheader58:                                     ; preds = %.preheader58.preheader, %68
  %38 = phi i32 [ %70, %68 ], [ %37, %.preheader58.preheader ]
  %39 = phi i32 [ %69, %68 ], [ %len.promoted, %.preheader58.preheader ]
  %40 = icmp sgt i32 %39, 0
  br i1 %40, label %.lr.ph66.preheader, label %._crit_edge69

.lr.ph66.preheader:                               ; preds = %.preheader58
  %wide.trip.count = zext nneg i32 %39 to i64
  %min.iters.check = icmp ult i32 %39, 4
  br i1 %min.iters.check, label %.lr.ph66.preheader123, label %vector.ph

.lr.ph66.preheader123:                            ; preds = %middle.block, %.lr.ph66.preheader
  %indvars.iv92.ph = phi i64 [ 0, %.lr.ph66.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph66

vector.ph:                                        ; preds = %.lr.ph66.preheader
  %n.vec = and i64 %wide.trip.count, 2147483644
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %41 = getelementptr inbounds [1673 x i64], ptr @num, i64 0, i64 %index
  %42 = getelementptr inbounds i8, ptr %41, i64 16
  %wide.load = load <2 x i64>, ptr %41, align 16, !tbaa !9
  %wide.load122 = load <2 x i64>, ptr %42, align 16, !tbaa !9
  %43 = shl <2 x i64> %wide.load, <i64 1, i64 1>
  %44 = shl <2 x i64> %wide.load122, <i64 1, i64 1>
  store <2 x i64> %43, ptr %41, align 16, !tbaa !9
  store <2 x i64> %44, ptr %42, align 16, !tbaa !9
  %index.next = add nuw i64 %index, 4
  %45 = icmp eq i64 %index.next, %n.vec
  br i1 %45, label %middle.block, label %vector.body, !llvm.loop !14

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %.preheader57, label %.lr.ph66.preheader123

._crit_edge71:                                    ; preds = %68, %.lr.ph81
  %46 = phi i32 [ %len.promoted, %.lr.ph81 ], [ %69, %68 ]
  %47 = getelementptr inbounds [11 x [30115 x i8]], ptr @buf, i64 0, i64 %27
  %48 = icmp sgt i32 %46, 0
  br i1 %48, label %.lr.ph76.preheader, label %._crit_edge77

.lr.ph76.preheader:                               ; preds = %._crit_edge71
  %49 = zext nneg i32 %46 to i64
  br label %.lr.ph76

.preheader57:                                     ; preds = %.lr.ph66, %middle.block
  br i1 %40, label %.lr.ph68.preheader, label %._crit_edge69

.lr.ph68.preheader:                               ; preds = %.preheader57
  %wide.trip.count99 = zext nneg i32 %39 to i64
  br label %.lr.ph68

.lr.ph66:                                         ; preds = %.lr.ph66.preheader123, %.lr.ph66
  %indvars.iv92 = phi i64 [ %indvars.iv.next93, %.lr.ph66 ], [ %indvars.iv92.ph, %.lr.ph66.preheader123 ]
  %50 = getelementptr inbounds [1673 x i64], ptr @num, i64 0, i64 %indvars.iv92
  %51 = load i64, ptr %50, align 8, !tbaa !9
  %52 = shl i64 %51, 1
  store i64 %52, ptr %50, align 8, !tbaa !9
  %indvars.iv.next93 = add nuw nsw i64 %indvars.iv92, 1
  %exitcond95.not = icmp eq i64 %indvars.iv.next93, %wide.trip.count
  br i1 %exitcond95.not, label %.preheader57, label %.lr.ph66, !llvm.loop !17

._crit_edge69:                                    ; preds = %65, %.preheader58, %.preheader57
  %53 = sext i32 %39 to i64
  %54 = getelementptr inbounds [1673 x i64], ptr @num, i64 0, i64 %53
  %55 = load i64, ptr %54, align 8, !tbaa !9
  %.not56 = icmp eq i64 %55, 0
  br i1 %.not56, label %68, label %66

.lr.ph68:                                         ; preds = %.lr.ph68.preheader, %65
  %indvars.iv96 = phi i64 [ 0, %.lr.ph68.preheader ], [ %indvars.iv.next97.pre-phi, %65 ]
  %56 = getelementptr inbounds [1673 x i64], ptr @num, i64 0, i64 %indvars.iv96
  %57 = load i64, ptr %56, align 8, !tbaa !9
  %58 = icmp sgt i64 %57, 999999999999999999
  br i1 %58, label %59, label %.lr.ph68._crit_edge

.lr.ph68._crit_edge:                              ; preds = %.lr.ph68
  %.pre110 = add nuw nsw i64 %indvars.iv96, 1
  br label %65

59:                                               ; preds = %.lr.ph68
  %60 = add nsw i64 %57, -1000000000000000000
  store i64 %60, ptr %56, align 8, !tbaa !9
  %61 = add nuw nsw i64 %indvars.iv96, 1
  %62 = getelementptr inbounds [1673 x i64], ptr @num, i64 0, i64 %61
  %63 = load i64, ptr %62, align 8, !tbaa !9
  %64 = add nsw i64 %63, 1
  store i64 %64, ptr %62, align 8, !tbaa !9
  br label %65

65:                                               ; preds = %.lr.ph68._crit_edge, %59
  %indvars.iv.next97.pre-phi = phi i64 [ %.pre110, %.lr.ph68._crit_edge ], [ %61, %59 ]
  %exitcond100.not = icmp eq i64 %indvars.iv.next97.pre-phi, %wide.trip.count99
  br i1 %exitcond100.not, label %._crit_edge69, label %.lr.ph68, !llvm.loop !18

66:                                               ; preds = %._crit_edge69
  %67 = add nsw i32 %39, 1
  store i32 %67, ptr @len, align 4, !tbaa !5
  br label %68

68:                                               ; preds = %66, %._crit_edge69
  %69 = phi i32 [ %67, %66 ], [ %39, %._crit_edge69 ]
  %70 = add nsw i32 %38, -1
  %.not55 = icmp eq i32 %38, 0
  br i1 %.not55, label %._crit_edge71, label %.preheader58, !llvm.loop !19

._crit_edge77.loopexit:                           ; preds = %.lr.ph76
  %.pre = load i32, ptr @t, align 4, !tbaa !5
  br label %._crit_edge77

._crit_edge77:                                    ; preds = %._crit_edge77.loopexit, %._crit_edge71
  %71 = phi i32 [ %24, %._crit_edge71 ], [ %.pre, %._crit_edge77.loopexit ]
  %.043.lcssa = phi ptr [ %47, %._crit_edge71 ], [ %80, %._crit_edge77.loopexit ]
  store i8 0, ptr %.043.lcssa, align 1, !tbaa !20
  %indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1
  %72 = sext i32 %71 to i64
  %.not53.not = icmp slt i64 %indvars.iv104, %72
  br i1 %.not53.not, label %.lr.ph81, label %.preheader, !llvm.loop !21

.lr.ph76:                                         ; preds = %.lr.ph76.preheader, %.lr.ph76
  %indvars.iv101 = phi i64 [ %49, %.lr.ph76.preheader ], [ %indvars.iv.next102, %.lr.ph76 ]
  %.04373 = phi ptr [ %47, %.lr.ph76.preheader ], [ %80, %.lr.ph76 ]
  %.04472 = phi i64 [ 0, %.lr.ph76.preheader ], [ %81, %.lr.ph76 ]
  %indvars.iv.next102 = add nsw i64 %indvars.iv101, -1
  %73 = mul nsw i64 %.04472, 1000000000000000000
  %74 = getelementptr inbounds [1673 x i64], ptr @num, i64 0, i64 %indvars.iv.next102
  %75 = load i64, ptr %74, align 8, !tbaa !9
  %76 = add nsw i64 %75, %73
  %77 = sdiv i64 %76, 3
  %78 = tail call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %.04373, ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %77) #3
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds i8, ptr %.04373, i64 %79
  %81 = srem i64 %76, 3
  %82 = icmp ugt i64 %indvars.iv101, 1
  br i1 %82, label %.lr.ph76, label %._crit_edge77.loopexit, !llvm.loop !22

._crit_edge85:                                    ; preds = %88, %._crit_edge.thread, %._crit_edge, %.preheader
  ret i32 0

.lr.ph84:                                         ; preds = %.preheader, %88
  %indvars.iv107 = phi i64 [ %indvars.iv.next108, %88 ], [ 1, %.preheader ]
  %83 = getelementptr inbounds [11 x [30115 x i8]], ptr @buf, i64 0, i64 %indvars.iv107
  br label %84

84:                                               ; preds = %84, %.lr.ph84
  %.0 = phi ptr [ %83, %.lr.ph84 ], [ %87, %84 ]
  %85 = load i8, ptr %.0, align 1, !tbaa !20
  %86 = icmp eq i8 %85, 48
  %87 = getelementptr inbounds i8, ptr %.0, i64 1
  br i1 %86, label %84, label %88, !llvm.loop !23

88:                                               ; preds = %84
  %89 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) %.0)
  %indvars.iv.next108 = add nuw nsw i64 %indvars.iv107, 1
  %90 = load i32, ptr @t, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %.not54.not = icmp slt i64 %indvars.iv107, %91
  br i1 %.not54.not, label %.lr.ph84, label %._crit_edge85, !llvm.loop !24
}

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

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @puts(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" }
attributes #3 = { 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 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12, !15, !16}
!15 = !{!"llvm.loop.isvectorized", i32 1}
!16 = !{!"llvm.loop.unroll.runtime.disable"}
!17 = distinct !{!17, !12, !16, !15}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = !{!7, !7, i64 0}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}
!23 = distinct !{!23, !12}
!24 = distinct !{!24, !12}


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