; LLVM IR from VastoLorde95/Competitive-Programming :: Hackerrank/101 Hacks/101 Hack 2016/101 Hack May/Problem A (A)

; 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_ostream" = type { ptr, %"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_istream" = type { ptr, i64, %"class.std::basic_ios" }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@n = external dso_local global i32, align 4
@l = external dso_local global [51 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #0 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)) #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %11 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %12 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %13 = getelementptr i8, ptr %12, i64 -24
  %14 = load i64, ptr %13, align 8
  %15 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %14
  %16 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %15, ptr noundef null)
  %17 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %18 = getelementptr i8, ptr %17, i64 -24
  %19 = load i64, ptr %18, align 8
  %20 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %19
  %21 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %20, ptr noundef null)
  %22 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !8
  br label %23

23:                                               ; preds = %33, %0
  %24 = load i32, ptr %2, align 4, !tbaa !8
  %25 = load i32, ptr @n, align 4, !tbaa !8
  %26 = icmp slt i32 %24, %25
  br i1 %26, label %28, label %27

27:                                               ; preds = %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %36

28:                                               ; preds = %23
  %29 = load i32, ptr %2, align 4, !tbaa !8
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [51 x i64], ptr @l, i64 0, i64 %30
  %32 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %31)
  br label %33

33:                                               ; preds = %28
  %34 = load i32, ptr %2, align 4, !tbaa !8
  %35 = add nsw i32 %34, 1
  store i32 %35, ptr %2, align 4, !tbaa !8
  br label %23, !llvm.loop !11

36:                                               ; preds = %27
  %37 = load i32, ptr @n, align 4, !tbaa !8
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds i64, ptr @l, i64 %38
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef @l, ptr noundef %39)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 -1, ptr %3, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 -1, ptr %4, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 -1, ptr %5, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 -1, ptr %6, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !8
  br label %40

40:                                               ; preds = %188, %36
  %41 = load i32, ptr %7, align 4, !tbaa !8
  %42 = load i32, ptr @n, align 4, !tbaa !8
  %43 = icmp slt i32 %41, %42
  br i1 %43, label %45, label %44

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

45:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %46 = load i32, ptr %7, align 4, !tbaa !8
  %47 = add nsw i32 %46, 1
  store i32 %47, ptr %9, align 4, !tbaa !8
  br label %48

48:                                               ; preds = %184, %45
  %49 = load i32, ptr %9, align 4, !tbaa !8
  %50 = load i32, ptr @n, align 4, !tbaa !8
  %51 = icmp slt i32 %49, %50
  br i1 %51, label %53, label %52

52:                                               ; preds = %48
  store i32 8, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %187

53:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %54 = load i32, ptr %9, align 4, !tbaa !8
  %55 = add nsw i32 %54, 1
  store i32 %55, ptr %10, align 4, !tbaa !8
  br label %56

56:                                               ; preds = %180, %53
  %57 = load i32, ptr %10, align 4, !tbaa !8
  %58 = load i32, ptr @n, align 4, !tbaa !8
  %59 = icmp slt i32 %57, %58
  br i1 %59, label %61, label %60

60:                                               ; preds = %56
  store i32 11, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %183

61:                                               ; preds = %56
  %62 = load i32, ptr %7, align 4, !tbaa !8
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [51 x i64], ptr @l, i64 0, i64 %63
  %65 = load i64, ptr %64, align 8, !tbaa !13
  %66 = load i32, ptr %9, align 4, !tbaa !8
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [51 x i64], ptr @l, i64 0, i64 %67
  %69 = load i64, ptr %68, align 8, !tbaa !13
  %70 = add nsw i64 %65, %69
  %71 = load i32, ptr %10, align 4, !tbaa !8
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [51 x i64], ptr @l, i64 0, i64 %72
  %74 = load i64, ptr %73, align 8, !tbaa !13
  %75 = add nsw i64 %70, %74
  %76 = load i32, ptr %6, align 4, !tbaa !8
  %77 = sext i32 %76 to i64
  %78 = icmp sgt i64 %75, %77
  br i1 %78, label %79, label %110

79:                                               ; preds = %61
  %80 = load i32, ptr %7, align 4, !tbaa !8
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [51 x i64], ptr @l, i64 0, i64 %81
  %83 = load i64, ptr %82, align 8, !tbaa !13
  %84 = load i32, ptr %9, align 4, !tbaa !8
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [51 x i64], ptr @l, i64 0, i64 %85
  %87 = load i64, ptr %86, align 8, !tbaa !13
  %88 = add nsw i64 %83, %87
  %89 = load i32, ptr %10, align 4, !tbaa !8
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [51 x i64], ptr @l, i64 0, i64 %90
  %92 = load i64, ptr %91, align 8, !tbaa !13
  %93 = add nsw i64 %88, %92
  %94 = trunc i64 %93 to i32
  store i32 %94, ptr %6, align 4, !tbaa !8
  %95 = load i32, ptr %7, align 4, !tbaa !8
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [51 x i64], ptr @l, i64 0, i64 %96
  %98 = load i64, ptr %97, align 8, !tbaa !13
  %99 = trunc i64 %98 to i32
  store i32 %99, ptr %3, align 4, !tbaa !8
  %100 = load i32, ptr %9, align 4, !tbaa !8
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [51 x i64], ptr @l, i64 0, i64 %101
  %103 = load i64, ptr %102, align 8, !tbaa !13
  %104 = trunc i64 %103 to i32
  store i32 %104, ptr %4, align 4, !tbaa !8
  %105 = load i32, ptr %10, align 4, !tbaa !8
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [51 x i64], ptr @l, i64 0, i64 %106
  %108 = load i64, ptr %107, align 8, !tbaa !13
  %109 = trunc i64 %108 to i32
  store i32 %109, ptr %5, align 4, !tbaa !8
  br label %179

110:                                              ; preds = %61
  %111 = load i32, ptr %7, align 4, !tbaa !8
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [51 x i64], ptr @l, i64 0, i64 %112
  %114 = load i64, ptr %113, align 8, !tbaa !13
  %115 = load i32, ptr %9, align 4, !tbaa !8
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [51 x i64], ptr @l, i64 0, i64 %116
  %118 = load i64, ptr %117, align 8, !tbaa !13
  %119 = add nsw i64 %114, %118
  %120 = load i32, ptr %10, align 4, !tbaa !8
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [51 x i64], ptr @l, i64 0, i64 %121
  %123 = load i64, ptr %122, align 8, !tbaa !13
  %124 = add nsw i64 %119, %123
  %125 = load i32, ptr %6, align 4, !tbaa !8
  %126 = sext i32 %125 to i64
  %127 = icmp eq i64 %124, %126
  br i1 %127, label %128, label %178

128:                                              ; preds = %110
  %129 = load i32, ptr %10, align 4, !tbaa !8
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [51 x i64], ptr @l, i64 0, i64 %130
  %132 = load i64, ptr %131, align 8, !tbaa !13
  %133 = load i32, ptr %5, align 4, !tbaa !8
  %134 = sext i32 %133 to i64
  %135 = icmp sgt i64 %132, %134
  br i1 %135, label %136, label %152

136:                                              ; preds = %128
  %137 = load i32, ptr %7, align 4, !tbaa !8
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [51 x i64], ptr @l, i64 0, i64 %138
  %140 = load i64, ptr %139, align 8, !tbaa !13
  %141 = trunc i64 %140 to i32
  store i32 %141, ptr %3, align 4, !tbaa !8
  %142 = load i32, ptr %9, align 4, !tbaa !8
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [51 x i64], ptr @l, i64 0, i64 %143
  %145 = load i64, ptr %144, align 8, !tbaa !13
  %146 = trunc i64 %145 to i32
  store i32 %146, ptr %4, align 4, !tbaa !8
  %147 = load i32, ptr %10, align 4, !tbaa !8
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [51 x i64], ptr @l, i64 0, i64 %148
  %150 = load i64, ptr %149, align 8, !tbaa !13
  %151 = trunc i64 %150 to i32
  store i32 %151, ptr %5, align 4, !tbaa !8
  br label %177

152:                                              ; preds = %128
  %153 = load i32, ptr %10, align 4, !tbaa !8
  %154 = load i32, ptr %5, align 4, !tbaa !8
  %155 = icmp eq i32 %153, %154
  br i1 %155, label %156, label %176

156:                                              ; preds = %152
  %157 = load i32, ptr %7, align 4, !tbaa !8
  %158 = load i32, ptr %5, align 4, !tbaa !8
  %159 = icmp sgt i32 %157, %158
  br i1 %159, label %160, label %176

160:                                              ; preds = %156
  %161 = load i32, ptr %7, align 4, !tbaa !8
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds [51 x i64], ptr @l, i64 0, i64 %162
  %164 = load i64, ptr %163, align 8, !tbaa !13
  %165 = trunc i64 %164 to i32
  store i32 %165, ptr %3, align 4, !tbaa !8
  %166 = load i32, ptr %9, align 4, !tbaa !8
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds [51 x i64], ptr @l, i64 0, i64 %167
  %169 = load i64, ptr %168, align 8, !tbaa !13
  %170 = trunc i64 %169 to i32
  store i32 %170, ptr %4, align 4, !tbaa !8
  %171 = load i32, ptr %10, align 4, !tbaa !8
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds [51 x i64], ptr @l, i64 0, i64 %172
  %174 = load i64, ptr %173, align 8, !tbaa !13
  %175 = trunc i64 %174 to i32
  store i32 %175, ptr %5, align 4, !tbaa !8
  br label %176

176:                                              ; preds = %160, %156, %152
  br label %177

177:                                              ; preds = %176, %136
  br label %178

178:                                              ; preds = %177, %110
  br label %179

179:                                              ; preds = %178, %79
  br label %180

180:                                              ; preds = %179
  %181 = load i32, ptr %10, align 4, !tbaa !8
  %182 = add nsw i32 %181, 1
  store i32 %182, ptr %10, align 4, !tbaa !8
  br label %56, !llvm.loop !15

183:                                              ; preds = %60
  br label %184

184:                                              ; preds = %183
  %185 = load i32, ptr %9, align 4, !tbaa !8
  %186 = add nsw i32 %185, 1
  store i32 %186, ptr %9, align 4, !tbaa !8
  br label %48, !llvm.loop !16

187:                                              ; preds = %52
  br label %188

188:                                              ; preds = %187
  %189 = load i32, ptr %7, align 4, !tbaa !8
  %190 = add nsw i32 %189, 1
  store i32 %190, ptr %7, align 4, !tbaa !8
  br label %40, !llvm.loop !17

191:                                              ; preds = %44
  %192 = load i32, ptr %6, align 4, !tbaa !8
  %193 = icmp eq i32 %192, -1
  br i1 %193, label %194, label %197

194:                                              ; preds = %191
  %195 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef -1)
  %196 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %195, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %207

197:                                              ; preds = %191
  %198 = load i32, ptr %3, align 4, !tbaa !8
  %199 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %198)
  %200 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %199, i8 noundef signext 32)
  %201 = load i32, ptr %4, align 4, !tbaa !8
  %202 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %200, i32 noundef %201)
  %203 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %202, i8 noundef signext 32)
  %204 = load i32, ptr %5, align 4, !tbaa !8
  %205 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %203, i32 noundef %204)
  %206 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %205, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %207

207:                                              ; preds = %197, %194
  store i32 0, ptr %1, align 4
  store i32 1, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  %208 = load i32, ptr %1, align 4
  ret i32 %208
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #3

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #4 align 2

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) #0 align 2

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

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #3

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) #1

attributes #0 = { 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 #1 = { 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 #2 = { 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 #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"long long", !10, i64 0}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !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_ostream" = type { ptr, %"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_istream" = type { ptr, i64, %"class.std::basic_ios" }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@n = external dso_local global i32, align 4
@l = external dso_local global [51 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8

; 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 #0 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)) #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %2 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %3 = getelementptr i8, ptr %2, i64 -24
  %4 = load i64, ptr %3, align 8
  %5 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %4
  %6 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %5, ptr noundef null)
  %7 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %8 = getelementptr i8, ptr %7, i64 -24
  %9 = load i64, ptr %8, align 8
  %10 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %9
  %11 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %10, ptr noundef null)
  %12 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %13 = load i32, ptr @n, align 4, !tbaa !8
  %14 = icmp sgt i32 %13, 0
  br i1 %14, label %.lr.ph, label %.._crit_edge_crit_edge

.._crit_edge_crit_edge:                           ; preds = %0
  %.pre = sext i32 %13 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.._crit_edge_crit_edge ], [ %22, %.lr.ph ]
  %15 = getelementptr inbounds i64, ptr @l, i64 %.pre-phi
  tail call void @_ZSt4sortIPxEvT_S1_(ptr noundef nonnull @l, ptr noundef nonnull %15)
  %16 = load i32, ptr @n, align 4, !tbaa !8
  %17 = icmp sgt i32 %16, 0
  br i1 %17, label %.lr.ph94.preheader, label %._crit_edge95.thread

.lr.ph94.preheader:                               ; preds = %._crit_edge
  %18 = zext nneg i32 %16 to i64
  %wide.trip.count117 = zext nneg i32 %16 to i64
  br label %.lr.ph94

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %19 = getelementptr inbounds [51 x i64], ptr @l, i64 0, i64 %indvars.iv
  %20 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %19)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %21 = load i32, ptr @n, align 4, !tbaa !8
  %22 = sext i32 %21 to i64
  %23 = icmp slt i64 %indvars.iv.next, %22
  br i1 %23, label %.lr.ph, label %._crit_edge, !llvm.loop !11

.loopexit64:                                      ; preds = %.loopexit, %.lr.ph94
  %.154.lcssa = phi i32 [ %.05388, %.lr.ph94 ], [ %.255.lcssa, %.loopexit ]
  %.150.lcssa = phi i32 [ %.04989, %.lr.ph94 ], [ %.251.lcssa, %.loopexit ]
  %.146.lcssa = phi i32 [ %.04590, %.lr.ph94 ], [ %.247.lcssa, %.loopexit ]
  %.1.lcssa = phi i32 [ %.04491, %.lr.ph94 ], [ %.2.lcssa, %.loopexit ]
  %indvars.iv.next103 = add nuw nsw i64 %indvars.iv102, 1
  %indvars.iv.next110 = add nuw nsw i64 %indvars.iv109, 1
  %exitcond118.not = icmp eq i64 %indvars.iv.next115, %wide.trip.count117
  br i1 %exitcond118.not, label %._crit_edge95, label %.lr.ph94, !llvm.loop !13

._crit_edge95:                                    ; preds = %.loopexit64
  %24 = icmp eq i32 %.1.lcssa, -1
  br i1 %24, label %._crit_edge95.thread, label %62

.lr.ph94:                                         ; preds = %.lr.ph94.preheader, %.loopexit64
  %indvars.iv114 = phi i64 [ 0, %.lr.ph94.preheader ], [ %indvars.iv.next115, %.loopexit64 ]
  %indvars.iv109 = phi i64 [ 1, %.lr.ph94.preheader ], [ %indvars.iv.next110, %.loopexit64 ]
  %indvars.iv102 = phi i64 [ 2, %.lr.ph94.preheader ], [ %indvars.iv.next103, %.loopexit64 ]
  %.04491 = phi i32 [ -1, %.lr.ph94.preheader ], [ %.1.lcssa, %.loopexit64 ]
  %.04590 = phi i32 [ -1, %.lr.ph94.preheader ], [ %.146.lcssa, %.loopexit64 ]
  %.04989 = phi i32 [ -1, %.lr.ph94.preheader ], [ %.150.lcssa, %.loopexit64 ]
  %.05388 = phi i32 [ -1, %.lr.ph94.preheader ], [ %.154.lcssa, %.loopexit64 ]
  %indvars.iv.next115 = add nuw nsw i64 %indvars.iv114, 1
  %25 = icmp ult i64 %indvars.iv.next115, %18
  br i1 %25, label %.lr.ph83, label %.loopexit64

.lr.ph83:                                         ; preds = %.lr.ph94
  %26 = getelementptr inbounds [51 x i64], ptr @l, i64 0, i64 %indvars.iv114
  br label %27

.loopexit:                                        ; preds = %58, %27
  %.255.lcssa = phi i32 [ %.15477, %27 ], [ %.356, %58 ]
  %.251.lcssa = phi i32 [ %.15078, %27 ], [ %.352, %58 ]
  %.247.lcssa = phi i32 [ %.14679, %27 ], [ %.348, %58 ]
  %.2.lcssa = phi i32 [ %.180, %27 ], [ %.3, %58 ]
  %indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next112, %wide.trip.count117
  br i1 %exitcond.not, label %.loopexit64, label %27, !llvm.loop !14

27:                                               ; preds = %.lr.ph83, %.loopexit
  %indvars.iv111 = phi i64 [ %indvars.iv109, %.lr.ph83 ], [ %indvars.iv.next112, %.loopexit ]
  %indvars.iv104 = phi i64 [ %indvars.iv102, %.lr.ph83 ], [ %indvars.iv.next105, %.loopexit ]
  %.180 = phi i32 [ %.04491, %.lr.ph83 ], [ %.2.lcssa, %.loopexit ]
  %.14679 = phi i32 [ %.04590, %.lr.ph83 ], [ %.247.lcssa, %.loopexit ]
  %.15078 = phi i32 [ %.04989, %.lr.ph83 ], [ %.251.lcssa, %.loopexit ]
  %.15477 = phi i32 [ %.05388, %.lr.ph83 ], [ %.255.lcssa, %.loopexit ]
  %indvars.iv.next112 = add nuw nsw i64 %indvars.iv111, 1
  %28 = trunc nuw i64 %indvars.iv.next112 to i32
  %29 = icmp sgt i32 %16, %28
  br i1 %29, label %.lr.ph72, label %.loopexit

.lr.ph72:                                         ; preds = %27
  %30 = load i64, ptr %26, align 8, !tbaa !15
  %31 = getelementptr inbounds [51 x i64], ptr @l, i64 0, i64 %indvars.iv111
  %32 = load i64, ptr %31, align 8, !tbaa !15
  %33 = add nsw i64 %32, %30
  %34 = trunc i64 %30 to i32
  %35 = trunc i64 %32 to i32
  br label %36

36:                                               ; preds = %.lr.ph72, %58
  %indvars.iv106 = phi i64 [ %indvars.iv104, %.lr.ph72 ], [ %indvars.iv.next107, %58 ]
  %.269 = phi i32 [ %.180, %.lr.ph72 ], [ %.3, %58 ]
  %.24768 = phi i32 [ %.14679, %.lr.ph72 ], [ %.348, %58 ]
  %.25167 = phi i32 [ %.15078, %.lr.ph72 ], [ %.352, %58 ]
  %.25566 = phi i32 [ %.15477, %.lr.ph72 ], [ %.356, %58 ]
  %37 = getelementptr inbounds [51 x i64], ptr @l, i64 0, i64 %indvars.iv106
  %38 = load i64, ptr %37, align 8, !tbaa !15
  %39 = add nsw i64 %33, %38
  %40 = sext i32 %.269 to i64
  %41 = icmp sgt i64 %39, %40
  br i1 %41, label %42, label %45

42:                                               ; preds = %36
  %43 = trunc i64 %39 to i32
  %44 = trunc i64 %38 to i32
  br label %58

45:                                               ; preds = %36
  %46 = icmp eq i64 %39, %40
  br i1 %46, label %47, label %58

47:                                               ; preds = %45
  %48 = sext i32 %.24768 to i64
  %49 = icmp sgt i64 %38, %48
  br i1 %49, label %50, label %52

50:                                               ; preds = %47
  %51 = trunc i64 %38 to i32
  br label %58

52:                                               ; preds = %47
  %53 = zext i32 %.24768 to i64
  %54 = icmp eq i64 %indvars.iv106, %53
  %55 = icmp sgt i64 %indvars.iv114, %48
  %or.cond = and i1 %55, %54
  br i1 %or.cond, label %56, label %58

56:                                               ; preds = %52
  %57 = trunc i64 %38 to i32
  br label %58

58:                                               ; preds = %42, %50, %56, %52, %45
  %.356 = phi i32 [ %34, %42 ], [ %34, %50 ], [ %34, %56 ], [ %.25566, %52 ], [ %.25566, %45 ]
  %.352 = phi i32 [ %35, %42 ], [ %35, %50 ], [ %35, %56 ], [ %.25167, %52 ], [ %.25167, %45 ]
  %.348 = phi i32 [ %44, %42 ], [ %51, %50 ], [ %57, %56 ], [ %.24768, %52 ], [ %.24768, %45 ]
  %.3 = phi i32 [ %43, %42 ], [ %.269, %50 ], [ %.269, %56 ], [ %.269, %52 ], [ %.269, %45 ]
  %indvars.iv.next107 = add nuw nsw i64 %indvars.iv106, 1
  %59 = trunc nuw i64 %indvars.iv.next107 to i32
  %60 = icmp sgt i32 %16, %59
  br i1 %60, label %36, label %.loopexit, !llvm.loop !17

._crit_edge95.thread:                             ; preds = %._crit_edge, %._crit_edge95
  %61 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef -1)
  br label %68

62:                                               ; preds = %._crit_edge95
  %63 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.154.lcssa)
  %64 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %63, i8 noundef signext 32)
  %65 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %64, i32 noundef %.150.lcssa)
  %66 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %65, i8 noundef signext 32)
  %67 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %66, i32 noundef %.146.lcssa)
  br label %68

68:                                               ; preds = %62, %._crit_edge95.thread
  %.sink = phi ptr [ %67, %62 ], [ %61, %._crit_edge95.thread ]
  %69 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %.sink, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) local_unnamed_addr #4 align 2

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 #3

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

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) local_unnamed_addr #1

attributes #0 = { 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 #1 = { 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 #2 = { 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 #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }

!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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = !{!16, !16, i64 0}
!16 = !{!"long long", !10, i64 0}
!17 = distinct !{!17, !12}


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