; LLVM IR from hao14293/2021-Postgraduate-408 :: PAT/PAT-A/CPP (1089 Insert or Merge (25 分))

; 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.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [15 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = 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 ptr, align 8
  %4 = alloca ptr, align 8
  %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
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  %11 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #8
  %12 = load i32, ptr %2, align 4, !tbaa !5
  %13 = sext i32 %12 to i64
  %14 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %13, i64 4)
  %15 = extractvalue { i64, i1 } %14, 1
  %16 = extractvalue { i64, i1 } %14, 0
  %17 = select i1 %15, i64 -1, i64 %16
  %18 = call noalias noundef nonnull ptr @_Znam(i64 noundef %17) #9
  store ptr %18, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #8
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %20, i64 4)
  %22 = extractvalue { i64, i1 } %21, 1
  %23 = extractvalue { i64, i1 } %21, 0
  %24 = select i1 %22, i64 -1, i64 %23
  %25 = call noalias noundef nonnull ptr @_Znam(i64 noundef %24) #9
  store ptr %25, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %37, %0
  %27 = load i32, ptr %5, align 4, !tbaa !5
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = icmp slt i32 %27, %28
  br i1 %29, label %31, label %30

30:                                               ; preds = %26
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  br label %40

31:                                               ; preds = %26
  %32 = load ptr, ptr %3, align 8, !tbaa !9
  %33 = load i32, ptr %5, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds i32, ptr %32, i64 %34
  %36 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %35)
  br label %37

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

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

41:                                               ; preds = %52, %40
  %42 = load i32, ptr %6, align 4, !tbaa !5
  %43 = load i32, ptr %2, align 4, !tbaa !5
  %44 = icmp slt i32 %42, %43
  br i1 %44, label %46, label %45

45:                                               ; preds = %41
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  br label %55

46:                                               ; preds = %41
  %47 = load ptr, ptr %4, align 8, !tbaa !9
  %48 = load i32, ptr %6, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds i32, ptr %47, i64 %49
  %51 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %50)
  br label %52

52:                                               ; preds = %46
  %53 = load i32, ptr %6, align 4, !tbaa !5
  %54 = add nsw i32 %53, 1
  store i32 %54, ptr %6, align 4, !tbaa !5
  br label %41, !llvm.loop !13

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

56:                                               ; preds = %77, %55
  %57 = load i32, ptr %7, align 4, !tbaa !5
  %58 = load i32, ptr %2, align 4, !tbaa !5
  %59 = sub nsw i32 %58, 1
  %60 = icmp slt i32 %57, %59
  br i1 %60, label %61, label %74

61:                                               ; preds = %56
  %62 = load ptr, ptr %4, align 8, !tbaa !9
  %63 = load i32, ptr %7, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds i32, ptr %62, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = load ptr, ptr %4, align 8, !tbaa !9
  %68 = load i32, ptr %7, align 4, !tbaa !5
  %69 = add nsw i32 %68, 1
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds i32, ptr %67, i64 %70
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = icmp sle i32 %66, %72
  br label %74

74:                                               ; preds = %61, %56
  %75 = phi i1 [ false, %56 ], [ %73, %61 ]
  br i1 %75, label %76, label %80

76:                                               ; preds = %74
  br label %77

77:                                               ; preds = %76
  %78 = load i32, ptr %7, align 4, !tbaa !5
  %79 = add nsw i32 %78, 1
  store i32 %79, ptr %7, align 4, !tbaa !5
  br label %56, !llvm.loop !14

80:                                               ; preds = %74
  %81 = load i32, ptr %7, align 4, !tbaa !5
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %8, align 4, !tbaa !5
  br label %83

83:                                               ; preds = %102, %80
  %84 = load ptr, ptr %3, align 8, !tbaa !9
  %85 = load i32, ptr %8, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds i32, ptr %84, i64 %86
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %89 = load ptr, ptr %4, align 8, !tbaa !9
  %90 = load i32, ptr %8, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds i32, ptr %89, i64 %91
  %93 = load i32, ptr %92, align 4, !tbaa !5
  %94 = icmp eq i32 %88, %93
  br i1 %94, label %95, label %99

95:                                               ; preds = %83
  %96 = load i32, ptr %8, align 4, !tbaa !5
  %97 = load i32, ptr %2, align 4, !tbaa !5
  %98 = icmp slt i32 %96, %97
  br label %99

99:                                               ; preds = %95, %83
  %100 = phi i1 [ false, %83 ], [ %98, %95 ]
  br i1 %100, label %101, label %105

101:                                              ; preds = %99
  br label %102

102:                                              ; preds = %101
  %103 = load i32, ptr %8, align 4, !tbaa !5
  %104 = add nsw i32 %103, 1
  store i32 %104, ptr %8, align 4, !tbaa !5
  br label %83, !llvm.loop !15

105:                                              ; preds = %99
  %106 = load i32, ptr %8, align 4, !tbaa !5
  %107 = load i32, ptr %2, align 4, !tbaa !5
  %108 = icmp eq i32 %106, %107
  br i1 %108, label %109, label %118

109:                                              ; preds = %105
  %110 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  %111 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %110, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %112 = load ptr, ptr %3, align 8, !tbaa !9
  %113 = load ptr, ptr %3, align 8, !tbaa !9
  %114 = load i32, ptr %7, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds i32, ptr %113, i64 %115
  %117 = getelementptr inbounds i32, ptr %116, i64 2
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef %112, ptr noundef %117)
  br label %186

118:                                              ; preds = %105
  %119 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.1)
  %120 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %119, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  store i32 1, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %121

121:                                              ; preds = %172, %118
  %122 = load i32, ptr %10, align 4, !tbaa !5
  %123 = icmp ne i32 %122, 0
  br i1 %123, label %124, label %185

124:                                              ; preds = %121
  store i32 0, ptr %10, align 4, !tbaa !5
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %125

125:                                              ; preds = %143, %124
  %126 = load i32, ptr %7, align 4, !tbaa !5
  %127 = load i32, ptr %2, align 4, !tbaa !5
  %128 = icmp slt i32 %126, %127
  br i1 %128, label %129, label %146

129:                                              ; preds = %125
  %130 = load ptr, ptr %3, align 8, !tbaa !9
  %131 = load i32, ptr %7, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds i32, ptr %130, i64 %132
  %134 = load i32, ptr %133, align 4, !tbaa !5
  %135 = load ptr, ptr %4, align 8, !tbaa !9
  %136 = load i32, ptr %7, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds i32, ptr %135, i64 %137
  %139 = load i32, ptr %138, align 4, !tbaa !5
  %140 = icmp ne i32 %134, %139
  br i1 %140, label %141, label %142

141:                                              ; preds = %129
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %142

142:                                              ; preds = %141, %129
  br label %143

143:                                              ; preds = %142
  %144 = load i32, ptr %7, align 4, !tbaa !5
  %145 = add nsw i32 %144, 1
  store i32 %145, ptr %7, align 4, !tbaa !5
  br label %125, !llvm.loop !16

146:                                              ; preds = %125
  %147 = load i32, ptr %9, align 4, !tbaa !5
  %148 = mul nsw i32 %147, 2
  store i32 %148, ptr %9, align 4, !tbaa !5
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %149

149:                                              ; preds = %169, %146
  %150 = load i32, ptr %7, align 4, !tbaa !5
  %151 = load i32, ptr %2, align 4, !tbaa !5
  %152 = load i32, ptr %9, align 4, !tbaa !5
  %153 = sdiv i32 %151, %152
  %154 = icmp slt i32 %150, %153
  br i1 %154, label %155, label %172

155:                                              ; preds = %149
  %156 = load ptr, ptr %3, align 8, !tbaa !9
  %157 = load i32, ptr %7, align 4, !tbaa !5
  %158 = load i32, ptr %9, align 4, !tbaa !5
  %159 = mul nsw i32 %157, %158
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds i32, ptr %156, i64 %160
  %162 = load ptr, ptr %3, align 8, !tbaa !9
  %163 = load i32, ptr %7, align 4, !tbaa !5
  %164 = add nsw i32 %163, 1
  %165 = load i32, ptr %9, align 4, !tbaa !5
  %166 = mul nsw i32 %164, %165
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds i32, ptr %162, i64 %167
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef %161, ptr noundef %168)
  br label %169

169:                                              ; preds = %155
  %170 = load i32, ptr %7, align 4, !tbaa !5
  %171 = add nsw i32 %170, 1
  store i32 %171, ptr %7, align 4, !tbaa !5
  br label %149, !llvm.loop !17

172:                                              ; preds = %149
  %173 = load ptr, ptr %3, align 8, !tbaa !9
  %174 = load i32, ptr %2, align 4, !tbaa !5
  %175 = load i32, ptr %9, align 4, !tbaa !5
  %176 = sdiv i32 %174, %175
  %177 = load i32, ptr %9, align 4, !tbaa !5
  %178 = mul nsw i32 %176, %177
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds i32, ptr %173, i64 %179
  %181 = load ptr, ptr %3, align 8, !tbaa !9
  %182 = load i32, ptr %2, align 4, !tbaa !5
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds i32, ptr %181, i64 %183
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef %180, ptr noundef %184)
  br label %121, !llvm.loop !18

185:                                              ; preds = %121
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  br label %186

186:                                              ; preds = %185, %109
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %187

187:                                              ; preds = %203, %186
  %188 = load i32, ptr %8, align 4, !tbaa !5
  %189 = load i32, ptr %2, align 4, !tbaa !5
  %190 = icmp slt i32 %188, %189
  br i1 %190, label %191, label %206

191:                                              ; preds = %187
  %192 = load i32, ptr %8, align 4, !tbaa !5
  %193 = icmp ne i32 %192, 0
  br i1 %193, label %194, label %196

194:                                              ; preds = %191
  %195 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  br label %196

196:                                              ; preds = %194, %191
  %197 = load ptr, ptr %3, align 8, !tbaa !9
  %198 = load i32, ptr %8, align 4, !tbaa !5
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds i32, ptr %197, i64 %199
  %201 = load i32, ptr %200, align 4, !tbaa !5
  %202 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %201)
  br label %203

203:                                              ; preds = %196
  %204 = load i32, ptr %8, align 4, !tbaa !5
  %205 = add nsw i32 %204, 1
  store i32 %205, ptr %8, align 4, !tbaa !5
  br label %187, !llvm.loop !19

206:                                              ; preds = %187
  %207 = load ptr, ptr %3, align 8, !tbaa !9
  %208 = icmp eq ptr %207, null
  br i1 %208, label %210, label %209

209:                                              ; preds = %206
  call void @_ZdaPv(ptr noundef %207) #10
  br label %210

210:                                              ; preds = %209, %206
  %211 = load ptr, ptr %4, align 8, !tbaa !9
  %212 = icmp eq ptr %211, null
  br i1 %212, label %214, label %213

213:                                              ; preds = %210
  call void @_ZdaPv(ptr noundef %211) #10
  br label %214

214:                                              ; preds = %213, %210
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  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 noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64) #3

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) #4

; 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 noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #5

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #6 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #5

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

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

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) #7

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nobuiltin allocsize(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 #5 = { 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 #6 = { 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 #7 = { nobuiltin 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 #8 = { nounwind }
attributes #9 = { builtin allocsize(0) }
attributes #10 = { builtin 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 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}


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

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [15 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = 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
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #9
  %2 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %3 = load i32, ptr %1, align 4
  %4 = sext i32 %3 to i64
  %5 = icmp slt i32 %3, 0
  %6 = shl nsw i64 %4, 2
  %7 = select i1 %5, i64 -1, i64 %6
  %8 = call noalias noundef nonnull ptr @_Znam(i64 noundef %7) #10
  %9 = call noalias noundef nonnull ptr @_Znam(i64 noundef %7) #10
  %10 = icmp sgt i32 %3, 0
  br i1 %10, label %.lr.ph, label %.preheader64

.preheader65:                                     ; preds = %.lr.ph
  %11 = icmp sgt i32 %14, 0
  br i1 %11, label %.lr.ph70, label %.preheader64

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %12 = getelementptr inbounds i32, ptr %8, i64 %indvars.iv
  %13 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %12)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %14 = load i32, ptr %1, align 4
  %15 = sext i32 %14 to i64
  %16 = icmp slt i64 %indvars.iv.next, %15
  br i1 %16, label %.lr.ph, label %.preheader65, !llvm.loop !5

.preheader64:                                     ; preds = %.lr.ph70, %0, %.preheader65
  %.lcssa67 = phi i32 [ %14, %.preheader65 ], [ %3, %0 ], [ %20, %.lr.ph70 ]
  %17 = call i32 @llvm.smax.i32(i32 %.lcssa67, i32 1)
  %smax = add nsw i32 %17, -1
  %wide.trip.count = zext nneg i32 %smax to i64
  br label %23

.lr.ph70:                                         ; preds = %.preheader65, %.lr.ph70
  %indvars.iv90 = phi i64 [ %indvars.iv.next91, %.lr.ph70 ], [ 0, %.preheader65 ]
  %18 = getelementptr inbounds i32, ptr %9, i64 %indvars.iv90
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %18)
  %indvars.iv.next91 = add nuw nsw i64 %indvars.iv90, 1
  %20 = load i32, ptr %1, align 4
  %21 = sext i32 %20 to i64
  %22 = icmp slt i64 %indvars.iv.next91, %21
  br i1 %22, label %.lr.ph70, label %.preheader64, !llvm.loop !7

23:                                               ; preds = %.preheader64, %24
  %indvars.iv93 = phi i64 [ 0, %.preheader64 ], [ %indvars.iv.next94, %24 ]
  %exitcond.not = icmp eq i64 %indvars.iv93, %wide.trip.count
  br i1 %exitcond.not, label %.critedge, label %24

24:                                               ; preds = %23
  %25 = getelementptr inbounds i32, ptr %9, i64 %indvars.iv93
  %26 = load i32, ptr %25, align 4, !tbaa !8
  %indvars.iv.next94 = add nuw nsw i64 %indvars.iv93, 1
  %27 = getelementptr inbounds i32, ptr %9, i64 %indvars.iv.next94
  %28 = load i32, ptr %27, align 4, !tbaa !8
  %.not = icmp sgt i32 %26, %28
  br i1 %.not, label %..critedge_crit_edge, label %23, !llvm.loop !12

..critedge_crit_edge:                             ; preds = %24
  %.pre111 = and i64 %indvars.iv93, 4294967295
  br label %.critedge

.critedge:                                        ; preds = %23, %..critedge_crit_edge
  %.pre-phi = phi i64 [ %.pre111, %..critedge_crit_edge ], [ %wide.trip.count, %23 ]
  %29 = sext i32 %.lcssa67 to i64
  br label %30

30:                                               ; preds = %30, %.critedge
  %indvars.iv96 = phi i64 [ %indvars.iv.next97, %30 ], [ %.pre-phi, %.critedge ]
  %indvars.iv.next97 = add nuw nsw i64 %indvars.iv96, 1
  %31 = getelementptr inbounds i32, ptr %8, i64 %indvars.iv.next97
  %32 = load i32, ptr %31, align 4, !tbaa !8
  %33 = getelementptr inbounds i32, ptr %9, i64 %indvars.iv.next97
  %34 = load i32, ptr %33, align 4, !tbaa !8
  %35 = icmp eq i32 %32, %34
  %36 = icmp slt i64 %indvars.iv.next97, %29
  %37 = and i1 %36, %35
  br i1 %37, label %30, label %38, !llvm.loop !13

38:                                               ; preds = %30
  %39 = trunc nuw nsw i64 %indvars.iv.next97 to i32
  %40 = icmp eq i32 %.lcssa67, %39
  br i1 %40, label %41, label %46

41:                                               ; preds = %38
  %42 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str)
  %43 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %42, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %44 = getelementptr inbounds i32, ptr %8, i64 %.pre-phi
  %45 = getelementptr inbounds i8, ptr %44, i64 8
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull %8, ptr noundef nonnull %45)
  br label %.loopexit

46:                                               ; preds = %38
  %47 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.1)
  %48 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %47, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %.preheader

.preheader:                                       ; preds = %46, %._crit_edge78
  %.05281 = phi i32 [ 1, %46 ], [ %65, %._crit_edge78 ]
  %49 = load i32, ptr %1, align 4, !tbaa !8
  %50 = icmp sgt i32 %49, 0
  br i1 %50, label %.lr.ph73.preheader, label %._crit_edge

.lr.ph73.preheader:                               ; preds = %.preheader
  %wide.trip.count102 = zext nneg i32 %49 to i64
  %min.iters.check = icmp ult i32 %49, 8
  br i1 %min.iters.check, label %.lr.ph73.preheader127, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph73.preheader
  %n.vec = and i64 %wide.trip.count102, 2147483640
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <4 x i1> [ zeroinitializer, %vector.ph ], [ %57, %vector.body ]
  %vec.phi122 = phi <4 x i1> [ zeroinitializer, %vector.ph ], [ %58, %vector.body ]
  %51 = getelementptr inbounds i32, ptr %8, i64 %index
  %52 = getelementptr inbounds i8, ptr %51, i64 16
  %wide.load = load <4 x i32>, ptr %51, align 4, !tbaa !8
  %wide.load123 = load <4 x i32>, ptr %52, align 4, !tbaa !8
  %53 = getelementptr inbounds i32, ptr %9, i64 %index
  %54 = getelementptr inbounds i8, ptr %53, i64 16
  %wide.load124 = load <4 x i32>, ptr %53, align 4, !tbaa !8
  %wide.load125 = load <4 x i32>, ptr %54, align 4, !tbaa !8
  %55 = icmp ne <4 x i32> %wide.load, %wide.load124
  %56 = icmp ne <4 x i32> %wide.load123, %wide.load125
  %57 = or <4 x i1> %vec.phi, %55
  %58 = or <4 x i1> %vec.phi122, %56
  %index.next = add nuw i64 %index, 8
  %59 = icmp eq i64 %index.next, %n.vec
  br i1 %59, label %middle.block, label %vector.body, !llvm.loop !14

middle.block:                                     ; preds = %vector.body
  %bin.rdx = or <4 x i1> %58, %57
  %bin.rdx.fr = freeze <4 x i1> %bin.rdx
  %60 = bitcast <4 x i1> %bin.rdx.fr to i4
  %.not126 = icmp ne i4 %60, 0
  %rdx.select = zext i1 %.not126 to i32
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count102
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph73.preheader127

.lr.ph73.preheader127:                            ; preds = %middle.block, %.lr.ph73.preheader
  %indvars.iv99.ph = phi i64 [ 0, %.lr.ph73.preheader ], [ %n.vec, %middle.block ]
  %.172.ph = phi i32 [ 0, %.lr.ph73.preheader ], [ %rdx.select, %middle.block ]
  br label %.lr.ph73

.lr.ph73:                                         ; preds = %.lr.ph73.preheader127, %.lr.ph73
  %indvars.iv99 = phi i64 [ %indvars.iv.next100, %.lr.ph73 ], [ %indvars.iv99.ph, %.lr.ph73.preheader127 ]
  %.172 = phi i32 [ %spec.select, %.lr.ph73 ], [ %.172.ph, %.lr.ph73.preheader127 ]
  %61 = getelementptr inbounds i32, ptr %8, i64 %indvars.iv99
  %62 = load i32, ptr %61, align 4, !tbaa !8
  %63 = getelementptr inbounds i32, ptr %9, i64 %indvars.iv99
  %64 = load i32, ptr %63, align 4, !tbaa !8
  %.not62 = icmp eq i32 %62, %64
  %spec.select = select i1 %.not62, i32 %.172, i32 1
  %indvars.iv.next100 = add nuw nsw i64 %indvars.iv99, 1
  %exitcond103.not = icmp eq i64 %indvars.iv.next100, %wide.trip.count102
  br i1 %exitcond103.not, label %._crit_edge, label %.lr.ph73, !llvm.loop !17

._crit_edge:                                      ; preds = %.lr.ph73, %middle.block, %.preheader
  %.1.lcssa = phi i32 [ 0, %.preheader ], [ %rdx.select, %middle.block ], [ %spec.select, %.lr.ph73 ]
  %65 = shl nsw i32 %.05281, 1
  %66 = sdiv i32 %49, %65
  %67 = icmp sgt i32 %66, 0
  br i1 %67, label %.lr.ph77.preheader, label %._crit_edge78

.lr.ph77.preheader:                               ; preds = %._crit_edge
  %68 = sext i32 %65 to i64
  br label %.lr.ph77

.lr.ph77:                                         ; preds = %.lr.ph77.preheader, %.lr.ph77
  %indvars.iv104 = phi i64 [ 0, %.lr.ph77.preheader ], [ %indvars.iv.next105, %.lr.ph77 ]
  %69 = mul nsw i64 %indvars.iv104, %68
  %70 = getelementptr inbounds i32, ptr %8, i64 %69
  %indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1
  %71 = mul nsw i64 %indvars.iv.next105, %68
  %72 = getelementptr inbounds i32, ptr %8, i64 %71
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull %70, ptr noundef nonnull %72)
  %73 = load i32, ptr %1, align 4, !tbaa !8
  %74 = sdiv i32 %73, %65
  %75 = sext i32 %74 to i64
  %76 = icmp slt i64 %indvars.iv.next105, %75
  br i1 %76, label %.lr.ph77, label %._crit_edge78, !llvm.loop !18

._crit_edge78:                                    ; preds = %.lr.ph77, %._crit_edge
  %.lcssa66 = phi i32 [ %49, %._crit_edge ], [ %73, %.lr.ph77 ]
  %.lcssa = phi i32 [ %66, %._crit_edge ], [ %74, %.lr.ph77 ]
  %77 = mul nsw i32 %.lcssa, %65
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds i32, ptr %8, i64 %78
  %80 = sext i32 %.lcssa66 to i64
  %81 = getelementptr inbounds i32, ptr %8, i64 %80
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull %79, ptr noundef nonnull %81)
  %.not61 = icmp eq i32 %.1.lcssa, 0
  br i1 %.not61, label %.loopexit, label %.preheader, !llvm.loop !19

.loopexit:                                        ; preds = %._crit_edge78, %41
  %82 = load i32, ptr %1, align 4, !tbaa !8
  %83 = icmp sgt i32 %82, 0
  br i1 %83, label %.lr.ph84.preheader._crit_edge, label %._crit_edge85

.lr.ph84.preheader._crit_edge:                    ; preds = %.loopexit
  %.pre = load i32, ptr %8, align 4, !tbaa !8
  %84 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %.pre)
  %85 = load i32, ptr %1, align 4, !tbaa !8
  %86 = icmp sgt i32 %85, 1
  br i1 %86, label %.lr.ph84.peel.next, label %._crit_edge85

.lr.ph84.peel.next:                               ; preds = %.lr.ph84.preheader._crit_edge, %.lr.ph84.peel.next
  %indvars.iv107 = phi i64 [ %indvars.iv.next108, %.lr.ph84.peel.next ], [ 1, %.lr.ph84.preheader._crit_edge ]
  %87 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  %88 = getelementptr inbounds i32, ptr %8, i64 %indvars.iv107
  %89 = load i32, ptr %88, align 4, !tbaa !8
  %90 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %89)
  %indvars.iv.next108 = add nuw nsw i64 %indvars.iv107, 1
  %91 = load i32, ptr %1, align 4, !tbaa !8
  %92 = sext i32 %91 to i64
  %93 = icmp slt i64 %indvars.iv.next108, %92
  br i1 %93, label %.lr.ph84.peel.next, label %._crit_edge85, !llvm.loop !20

._crit_edge85:                                    ; preds = %.lr.ph84.peel.next, %.lr.ph84.preheader._crit_edge, %.loopexit
  call void @_ZdaPv(ptr noundef nonnull %8) #11
  call void @_ZdaPv(ptr noundef nonnull %9) #11
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #9
  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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) local_unnamed_addr #3

; 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 noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #4

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

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

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) local_unnamed_addr #7

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #8

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 = { "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 = { nobuiltin allocsize(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 = { 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 #5 = { 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 #6 = { 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 #7 = { nobuiltin 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 #8 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #9 = { nounwind }
attributes #10 = { builtin allocsize(0) }
attributes #11 = { builtin 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = distinct !{!12, !6}
!13 = distinct !{!13, !6}
!14 = distinct !{!14, !6, !15, !16}
!15 = !{!"llvm.loop.isvectorized", i32 1}
!16 = !{!"llvm.loop.unroll.runtime.disable"}
!17 = distinct !{!17, !6, !16, !15}
!18 = distinct !{!18, !6}
!19 = distinct !{!19, !6}
!20 = distinct !{!20, !6, !21}
!21 = !{!"llvm.loop.peeled.count", i32 1}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalDCEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopFullUnrollPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass