; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/129 Division 1/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_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" }

@l = external dso_local global i64, align 8
@r = external dso_local global i64, align 8
@pows = external dso_local global [20 x i64], align 16
@res = external dso_local global i64, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3lenx(i64 noundef) #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z5firstx(i64 noundef) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z6secondx(i64 noundef) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z2upx(i64 noundef) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z3lowx(i64 noundef) #0

; 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
  store i32 0, ptr %1, align 4
  %10 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %11 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %12 = getelementptr i8, ptr %11, i64 -24
  %13 = load i64, ptr %12, align 8
  %14 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %13
  %15 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %14, ptr noundef null)
  %16 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %17 = getelementptr i8, ptr %16, i64 -24
  %18 = load i64, ptr %17, align 8
  %19 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %18
  %20 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %19, ptr noundef null)
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @l)
  %22 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %21, ptr noundef nonnull align 8 dereferenceable(8) @r)
  store i64 1, ptr @pows, align 16, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 1, ptr %2, align 4, !tbaa !11
  br label %23

23:                                               ; preds = %37, %0
  %24 = load i32, ptr %2, align 4, !tbaa !11
  %25 = icmp slt i32 %24, 20
  br i1 %25, label %27, label %26

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

27:                                               ; preds = %23
  %28 = load i32, ptr %2, align 4, !tbaa !11
  %29 = sub nsw i32 %28, 1
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [20 x i64], ptr @pows, i64 0, i64 %30
  %32 = load i64, ptr %31, align 8, !tbaa !8
  %33 = mul nsw i64 %32, 10
  %34 = load i32, ptr %2, align 4, !tbaa !11
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [20 x i64], ptr @pows, i64 0, i64 %35
  store i64 %33, ptr %36, align 8, !tbaa !8
  br label %37

37:                                               ; preds = %27
  %38 = load i32, ptr %2, align 4, !tbaa !11
  %39 = add nsw i32 %38, 1
  store i32 %39, ptr %2, align 4, !tbaa !11
  br label %23, !llvm.loop !13

40:                                               ; preds = %26
  %41 = load i64, ptr @l, align 8, !tbaa !8
  %42 = call noundef i64 @_Z5firstx(i64 noundef %41)
  store i64 %42, ptr @l, align 8, !tbaa !8
  %43 = load i64, ptr @l, align 8, !tbaa !8
  %44 = load i64, ptr @r, align 8, !tbaa !8
  %45 = icmp sgt i64 %43, %44
  br i1 %45, label %46, label %48

46:                                               ; preds = %40
  %47 = call i32 @puts(ptr noundef @.str)
  store i32 0, ptr %1, align 4
  br label %196

48:                                               ; preds = %40
  %49 = load i64, ptr @r, align 8, !tbaa !8
  %50 = call noundef i64 @_Z6secondx(i64 noundef %49)
  store i64 %50, ptr @r, align 8, !tbaa !8
  %51 = load i64, ptr @l, align 8, !tbaa !8
  %52 = load i64, ptr @r, align 8, !tbaa !8
  %53 = icmp eq i64 %51, %52
  br i1 %53, label %54, label %56

54:                                               ; preds = %48
  %55 = call i32 @puts(ptr noundef @.str.2)
  store i32 0, ptr %1, align 4
  br label %196

56:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  %57 = load i64, ptr @l, align 8, !tbaa !8
  %58 = call noundef i32 @_Z3lenx(i64 noundef %57)
  store i32 %58, ptr %3, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  %59 = load i64, ptr @r, align 8, !tbaa !8
  %60 = call noundef i32 @_Z3lenx(i64 noundef %59)
  store i32 %60, ptr %4, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %61 = load i64, ptr @l, align 8, !tbaa !8
  %62 = load i32, ptr %3, align 4, !tbaa !11
  %63 = sub nsw i32 %62, 1
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [20 x i64], ptr @pows, i64 0, i64 %64
  %66 = load i64, ptr %65, align 8, !tbaa !8
  %67 = sdiv i64 %61, %66
  %68 = trunc i64 %67 to i32
  store i32 %68, ptr %5, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %69 = load i64, ptr @l, align 8, !tbaa !8
  %70 = srem i64 %69, 10
  %71 = trunc i64 %70 to i32
  store i32 %71, ptr %6, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %72 = load i64, ptr @r, align 8, !tbaa !8
  %73 = load i32, ptr %4, align 4, !tbaa !11
  %74 = sub nsw i32 %73, 1
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [20 x i64], ptr @pows, i64 0, i64 %75
  %77 = load i64, ptr %76, align 8, !tbaa !8
  %78 = sdiv i64 %72, %77
  %79 = trunc i64 %78 to i32
  store i32 %79, ptr %7, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %80 = load i64, ptr @r, align 8, !tbaa !8
  %81 = srem i64 %80, 10
  %82 = trunc i64 %81 to i32
  store i32 %82, ptr %8, align 4, !tbaa !11
  %83 = load i32, ptr %3, align 4, !tbaa !11
  %84 = load i32, ptr %4, align 4, !tbaa !11
  %85 = icmp eq i32 %83, %84
  br i1 %85, label %86, label %96

86:                                               ; preds = %56
  %87 = load i32, ptr %3, align 4, !tbaa !11
  %88 = icmp eq i32 %87, 1
  br i1 %88, label %89, label %96

89:                                               ; preds = %86
  %90 = load i64, ptr @r, align 8, !tbaa !8
  %91 = load i64, ptr @l, align 8, !tbaa !8
  %92 = sub nsw i64 %90, %91
  %93 = add nsw i64 %92, 1
  %94 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %93)
  %95 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %94, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %9, align 4
  br label %195

96:                                               ; preds = %86, %56
  %97 = load i32, ptr %3, align 4, !tbaa !11
  %98 = load i32, ptr %4, align 4, !tbaa !11
  %99 = icmp eq i32 %97, %98
  br i1 %99, label %100, label %125

100:                                              ; preds = %96
  %101 = load i32, ptr %5, align 4, !tbaa !11
  %102 = load i32, ptr %7, align 4, !tbaa !11
  %103 = icmp eq i32 %101, %102
  br i1 %103, label %104, label %125

104:                                              ; preds = %100
  %105 = load i64, ptr @r, align 8, !tbaa !8
  %106 = load i32, ptr %4, align 4, !tbaa !11
  %107 = sub nsw i32 %106, 1
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [20 x i64], ptr @pows, i64 0, i64 %108
  %110 = load i64, ptr %109, align 8, !tbaa !8
  %111 = srem i64 %105, %110
  %112 = sdiv i64 %111, 10
  %113 = load i64, ptr @l, align 8, !tbaa !8
  %114 = load i32, ptr %3, align 4, !tbaa !11
  %115 = sub nsw i32 %114, 1
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [20 x i64], ptr @pows, i64 0, i64 %116
  %118 = load i64, ptr %117, align 8, !tbaa !8
  %119 = srem i64 %113, %118
  %120 = sdiv i64 %119, 10
  %121 = sub nsw i64 %112, %120
  %122 = add nsw i64 %121, 1
  %123 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %122)
  %124 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %123, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %9, align 4
  br label %195

125:                                              ; preds = %100, %96
  %126 = load i32, ptr %3, align 4, !tbaa !11
  %127 = icmp sgt i32 %126, 2
  br i1 %127, label %128, label %145

128:                                              ; preds = %125
  %129 = load i32, ptr %3, align 4, !tbaa !11
  %130 = sub nsw i32 %129, 2
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [20 x i64], ptr @pows, i64 0, i64 %131
  %133 = load i64, ptr %132, align 8, !tbaa !8
  %134 = load i64, ptr @l, align 8, !tbaa !8
  %135 = load i32, ptr %3, align 4, !tbaa !11
  %136 = sub nsw i32 %135, 1
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [20 x i64], ptr @pows, i64 0, i64 %137
  %139 = load i64, ptr %138, align 8, !tbaa !8
  %140 = srem i64 %134, %139
  %141 = sdiv i64 %140, 10
  %142 = sub nsw i64 %133, %141
  %143 = load i64, ptr @res, align 8, !tbaa !8
  %144 = add nsw i64 %143, %142
  store i64 %144, ptr @res, align 8, !tbaa !8
  br label %148

145:                                              ; preds = %125
  %146 = load i64, ptr @res, align 8, !tbaa !8
  %147 = add nsw i64 %146, 1
  store i64 %147, ptr @res, align 8, !tbaa !8
  br label %148

148:                                              ; preds = %145, %128
  %149 = load i32, ptr %4, align 4, !tbaa !11
  %150 = icmp sgt i32 %149, 1
  br i1 %150, label %151, label %163

151:                                              ; preds = %148
  %152 = load i64, ptr @r, align 8, !tbaa !8
  %153 = load i32, ptr %4, align 4, !tbaa !11
  %154 = sub nsw i32 %153, 1
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [20 x i64], ptr @pows, i64 0, i64 %155
  %157 = load i64, ptr %156, align 8, !tbaa !8
  %158 = srem i64 %152, %157
  %159 = sdiv i64 %158, 10
  %160 = add nsw i64 %159, 1
  %161 = load i64, ptr @res, align 8, !tbaa !8
  %162 = add nsw i64 %161, %160
  store i64 %162, ptr @res, align 8, !tbaa !8
  br label %163

163:                                              ; preds = %151, %148
  %164 = load i64, ptr @l, align 8, !tbaa !8
  %165 = call noundef i64 @_Z2upx(i64 noundef %164)
  store i64 %165, ptr @l, align 8, !tbaa !8
  %166 = load i64, ptr @r, align 8, !tbaa !8
  %167 = call noundef i64 @_Z3lowx(i64 noundef %166)
  store i64 %167, ptr @r, align 8, !tbaa !8
  br label %168

168:                                              ; preds = %188, %163
  %169 = load i64, ptr @l, align 8, !tbaa !8
  %170 = load i64, ptr @r, align 8, !tbaa !8
  %171 = icmp slt i64 %169, %170
  br i1 %171, label %172, label %191

172:                                              ; preds = %168
  %173 = load i64, ptr @l, align 8, !tbaa !8
  %174 = call noundef i32 @_Z3lenx(i64 noundef %173)
  store i32 %174, ptr %3, align 4, !tbaa !11
  %175 = load i32, ptr %3, align 4, !tbaa !11
  %176 = icmp sgt i32 %175, 1
  br i1 %176, label %177, label %185

177:                                              ; preds = %172
  %178 = load i32, ptr %3, align 4, !tbaa !11
  %179 = sub nsw i32 %178, 2
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds [20 x i64], ptr @pows, i64 0, i64 %180
  %182 = load i64, ptr %181, align 8, !tbaa !8
  %183 = load i64, ptr @res, align 8, !tbaa !8
  %184 = add nsw i64 %183, %182
  store i64 %184, ptr @res, align 8, !tbaa !8
  br label %188

185:                                              ; preds = %172
  %186 = load i64, ptr @res, align 8, !tbaa !8
  %187 = add nsw i64 %186, 1
  store i64 %187, ptr @res, align 8, !tbaa !8
  br label %188

188:                                              ; preds = %185, %177
  %189 = load i64, ptr @l, align 8, !tbaa !8
  %190 = call noundef i64 @_Z2upx(i64 noundef %189)
  store i64 %190, ptr @l, align 8, !tbaa !8
  br label %168, !llvm.loop !15

191:                                              ; preds = %168
  %192 = load i64, ptr @res, align 8, !tbaa !8
  %193 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %192)
  %194 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %193, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %9, align 4
  br label %195

195:                                              ; preds = %191, %104, %89
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  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
  br label %196

196:                                              ; preds = %195, %54, %46
  %197 = load i32, ptr %1, align 4
  ret i32 %197
}

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) #0 align 2

; 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)) #4 align 2

declare i32 @puts(ptr noundef) #3

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

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 = { 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 = { 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 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


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

@l = external dso_local global i64, align 8
@r = external dso_local global i64, align 8
@pows = external dso_local local_unnamed_addr global [20 x i64], align 16
@res = external dso_local local_unnamed_addr global i64, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3lenx(i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z5firstx(i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z6secondx(i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z2upx(i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z3lowx(i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %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 @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @l)
  %13 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 8 dereferenceable(8) @r)
  store i64 1, ptr @pows, align 16, !tbaa !8
  store i64 10, ptr getelementptr inbounds (i8, ptr @pows, i64 8), align 8, !tbaa !8
  store i64 100, ptr getelementptr inbounds (i8, ptr @pows, i64 16), align 16, !tbaa !8
  store i64 1000, ptr getelementptr inbounds (i8, ptr @pows, i64 24), align 8, !tbaa !8
  store i64 10000, ptr getelementptr inbounds (i8, ptr @pows, i64 32), align 16, !tbaa !8
  store i64 100000, ptr getelementptr inbounds (i8, ptr @pows, i64 40), align 8, !tbaa !8
  store i64 1000000, ptr getelementptr inbounds (i8, ptr @pows, i64 48), align 16, !tbaa !8
  store i64 10000000, ptr getelementptr inbounds (i8, ptr @pows, i64 56), align 8, !tbaa !8
  store i64 100000000, ptr getelementptr inbounds (i8, ptr @pows, i64 64), align 16, !tbaa !8
  store i64 1000000000, ptr getelementptr inbounds (i8, ptr @pows, i64 72), align 8, !tbaa !8
  store i64 10000000000, ptr getelementptr inbounds (i8, ptr @pows, i64 80), align 16, !tbaa !8
  store i64 100000000000, ptr getelementptr inbounds (i8, ptr @pows, i64 88), align 8, !tbaa !8
  store i64 1000000000000, ptr getelementptr inbounds (i8, ptr @pows, i64 96), align 16, !tbaa !8
  store i64 10000000000000, ptr getelementptr inbounds (i8, ptr @pows, i64 104), align 8, !tbaa !8
  store i64 100000000000000, ptr getelementptr inbounds (i8, ptr @pows, i64 112), align 16, !tbaa !8
  store i64 1000000000000000, ptr getelementptr inbounds (i8, ptr @pows, i64 120), align 8, !tbaa !8
  store i64 10000000000000000, ptr getelementptr inbounds (i8, ptr @pows, i64 128), align 16, !tbaa !8
  store i64 100000000000000000, ptr getelementptr inbounds (i8, ptr @pows, i64 136), align 8, !tbaa !8
  store i64 1000000000000000000, ptr getelementptr inbounds (i8, ptr @pows, i64 144), align 16, !tbaa !8
  store i64 -8446744073709551616, ptr getelementptr inbounds (i8, ptr @pows, i64 152), align 8, !tbaa !8
  %14 = load i64, ptr @l, align 8, !tbaa !8
  %15 = tail call noundef i64 @_Z5firstx(i64 noundef %14)
  store i64 %15, ptr @l, align 8, !tbaa !8
  %16 = load i64, ptr @r, align 8, !tbaa !8
  %17 = icmp sgt i64 %15, %16
  br i1 %17, label %18, label %20

18:                                               ; preds = %0
  %19 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str)
  br label %105

20:                                               ; preds = %0
  %21 = tail call noundef i64 @_Z6secondx(i64 noundef %16)
  store i64 %21, ptr @r, align 8, !tbaa !8
  %22 = load i64, ptr @l, align 8, !tbaa !8
  %23 = icmp eq i64 %22, %21
  br i1 %23, label %24, label %26

24:                                               ; preds = %20
  %25 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %105

26:                                               ; preds = %20
  %27 = tail call noundef i32 @_Z3lenx(i64 noundef %22)
  %28 = load i64, ptr @r, align 8, !tbaa !8
  %29 = tail call noundef i32 @_Z3lenx(i64 noundef %28)
  %30 = load i64, ptr @l, align 8, !tbaa !8
  %31 = add nsw i32 %27, -1
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [20 x i64], ptr @pows, i64 0, i64 %32
  %34 = load i64, ptr %33, align 8, !tbaa !8
  %35 = load i64, ptr @r, align 8, !tbaa !8
  %36 = add nsw i32 %29, -1
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [20 x i64], ptr @pows, i64 0, i64 %37
  %39 = load i64, ptr %38, align 8, !tbaa !8
  %40 = icmp eq i32 %27, %29
  %41 = icmp eq i32 %27, 1
  %or.cond = and i1 %41, %40
  br i1 %or.cond, label %42, label %46

42:                                               ; preds = %26
  %reass.sub = sub i64 %35, %30
  %43 = add i64 %reass.sub, 1
  %44 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %43)
  %45 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %44, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %105

46:                                               ; preds = %26
  %47 = sdiv i64 %35, %39
  %48 = srem i64 %35, %39
  %49 = trunc i64 %47 to i32
  %50 = sdiv i64 %30, %34
  %51 = srem i64 %30, %34
  %52 = trunc i64 %50 to i32
  %53 = icmp eq i32 %52, %49
  %or.cond31 = select i1 %40, i1 %53, i1 false
  br i1 %or.cond31, label %54, label %62

54:                                               ; preds = %46
  %55 = srem i64 %35, %39
  %56 = sdiv i64 %55, 10
  %57 = srem i64 %30, %34
  %.neg30 = sdiv i64 %57, -10
  %58 = add nsw i64 %56, 1
  %59 = add nsw i64 %58, %.neg30
  %60 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %59)
  %61 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %60, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %105

62:                                               ; preds = %46
  %63 = icmp sgt i32 %27, 2
  br i1 %63, label %64, label %72

64:                                               ; preds = %62
  %65 = add nsw i32 %27, -2
  %66 = zext nneg i32 %65 to i64
  %67 = getelementptr inbounds [20 x i64], ptr @pows, i64 0, i64 %66
  %68 = load i64, ptr %67, align 8, !tbaa !8
  %.neg = sdiv i64 %51, -10
  %69 = add i64 %.neg, %68
  %70 = load i64, ptr @res, align 8, !tbaa !8
  %71 = add nsw i64 %69, %70
  br label %75

72:                                               ; preds = %62
  %73 = load i64, ptr @res, align 8, !tbaa !8
  %74 = add nsw i64 %73, 1
  br label %75

75:                                               ; preds = %72, %64
  %storemerge = phi i64 [ %74, %72 ], [ %71, %64 ]
  %76 = icmp sgt i32 %29, 1
  br i1 %76, label %77, label %81

77:                                               ; preds = %75
  %78 = sdiv i64 %48, 10
  %79 = add i64 %storemerge, 1
  %80 = add i64 %79, %78
  br label %81

81:                                               ; preds = %77, %75
  %storemerge32 = phi i64 [ %80, %77 ], [ %storemerge, %75 ]
  store i64 %storemerge32, ptr @res, align 8, !tbaa !8
  %82 = tail call noundef i64 @_Z2upx(i64 noundef %30)
  store i64 %82, ptr @l, align 8, !tbaa !8
  %83 = load i64, ptr @r, align 8, !tbaa !8
  %84 = tail call noundef i64 @_Z3lowx(i64 noundef %83)
  store i64 %84, ptr @r, align 8, !tbaa !8
  %85 = load i64, ptr @l, align 8, !tbaa !8
  %86 = icmp slt i64 %85, %84
  br i1 %86, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %81, %95
  %87 = phi i64 [ %99, %95 ], [ %85, %81 ]
  %88 = tail call noundef i32 @_Z3lenx(i64 noundef %87)
  %89 = icmp sgt i32 %88, 1
  br i1 %89, label %90, label %95

90:                                               ; preds = %.lr.ph
  %91 = add nsw i32 %88, -2
  %92 = zext nneg i32 %91 to i64
  %93 = getelementptr inbounds [20 x i64], ptr @pows, i64 0, i64 %92
  %94 = load i64, ptr %93, align 8, !tbaa !8
  br label %95

95:                                               ; preds = %.lr.ph, %90
  %.sink36 = phi i64 [ %94, %90 ], [ 1, %.lr.ph ]
  %96 = load i64, ptr @res, align 8, !tbaa !8
  %97 = add nsw i64 %96, %.sink36
  store i64 %97, ptr @res, align 8, !tbaa !8
  %98 = load i64, ptr @l, align 8, !tbaa !8
  %99 = tail call noundef i64 @_Z2upx(i64 noundef %98)
  store i64 %99, ptr @l, align 8, !tbaa !8
  %100 = load i64, ptr @r, align 8, !tbaa !8
  %101 = icmp slt i64 %99, %100
  br i1 %101, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge:                                      ; preds = %95, %81
  %102 = load i64, ptr @res, align 8, !tbaa !8
  %103 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %102)
  %104 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %103, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %105

105:                                              ; preds = %42, %54, %._crit_edge, %24, %18
  ret i32 0
}

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

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

; 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 #3 align 2

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

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

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

attributes #0 = { 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 #1 = { 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 #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 = { 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 = { 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 #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" }

!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 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: DivRemPairsPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass