; LLVM IR from manishbisht/Competitive-Programming :: Codeforces/Codeforces Round #352 (Div. 2) (Summer Camp)

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

@n = external dso_local global i64, align 8
@temp = 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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %2 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @n)
  %3 = load i64, ptr @n, align 8, !tbaa !5
  %4 = icmp slt i64 %3, 10
  br i1 %4, label %5, label %12

5:                                                ; preds = %0
  %6 = load i64, ptr @n, align 8, !tbaa !5
  %7 = icmp sgt i64 %6, 0
  br i1 %7, label %8, label %12

8:                                                ; preds = %5
  %9 = load i64, ptr @n, align 8, !tbaa !5
  %10 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %9)
  %11 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %78

12:                                               ; preds = %5, %0
  %13 = load i64, ptr @n, align 8, !tbaa !5
  %14 = icmp sgt i64 %13, 9
  br i1 %14, label %15, label %41

15:                                               ; preds = %12
  %16 = load i64, ptr @n, align 8, !tbaa !5
  %17 = icmp slt i64 %16, 190
  br i1 %17, label %18, label %41

18:                                               ; preds = %15
  %19 = load i64, ptr @n, align 8, !tbaa !5
  %20 = sub nsw i64 %19, 9
  store i64 %20, ptr @n, align 8, !tbaa !5
  %21 = load i64, ptr @n, align 8, !tbaa !5
  %22 = srem i64 %21, 2
  store i64 %22, ptr @temp, align 8, !tbaa !5
  %23 = load i64, ptr @n, align 8, !tbaa !5
  %24 = sdiv i64 %23, 2
  %25 = add nsw i64 9, %24
  store i64 %25, ptr @n, align 8, !tbaa !5
  %26 = load i64, ptr @temp, align 8, !tbaa !5
  %27 = icmp eq i64 %26, 0
  br i1 %27, label %28, label %33

28:                                               ; preds = %18
  %29 = load i64, ptr @n, align 8, !tbaa !5
  %30 = srem i64 %29, 10
  %31 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %30)
  %32 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %31, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %40

33:                                               ; preds = %18
  %34 = load i64, ptr @n, align 8, !tbaa !5
  %35 = add nsw i64 %34, 1
  store i64 %35, ptr @n, align 8, !tbaa !5
  %36 = load i64, ptr @n, align 8, !tbaa !5
  %37 = sdiv i64 %36, 10
  %38 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %37)
  %39 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %38, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %40

40:                                               ; preds = %33, %28
  br label %77

41:                                               ; preds = %15, %12
  %42 = load i64, ptr @n, align 8, !tbaa !5
  %43 = sub nsw i64 %42, 189
  store i64 %43, ptr @n, align 8, !tbaa !5
  %44 = load i64, ptr @n, align 8, !tbaa !5
  %45 = srem i64 %44, 3
  store i64 %45, ptr @temp, align 8, !tbaa !5
  %46 = load i64, ptr @n, align 8, !tbaa !5
  %47 = sdiv i64 %46, 3
  %48 = add nsw i64 99, %47
  store i64 %48, ptr @n, align 8, !tbaa !5
  %49 = load i64, ptr @temp, align 8, !tbaa !5
  %50 = icmp eq i64 %49, 0
  br i1 %50, label %51, label %56

51:                                               ; preds = %41
  %52 = load i64, ptr @n, align 8, !tbaa !5
  %53 = srem i64 %52, 10
  %54 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %53)
  %55 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %54, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %76

56:                                               ; preds = %41
  %57 = load i64, ptr @temp, align 8, !tbaa !5
  %58 = icmp eq i64 %57, 1
  br i1 %58, label %59, label %66

59:                                               ; preds = %56
  %60 = load i64, ptr @n, align 8, !tbaa !5
  %61 = add nsw i64 %60, 1
  store i64 %61, ptr @n, align 8, !tbaa !5
  %62 = load i64, ptr @n, align 8, !tbaa !5
  %63 = sdiv i64 %62, 100
  %64 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %63)
  %65 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %64, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %75

66:                                               ; preds = %56
  %67 = load i64, ptr @n, align 8, !tbaa !5
  %68 = add nsw i64 %67, 1
  store i64 %68, ptr @n, align 8, !tbaa !5
  %69 = load i64, ptr @n, align 8, !tbaa !5
  %70 = sdiv i64 %69, 10
  store i64 %70, ptr @n, align 8, !tbaa !5
  %71 = load i64, ptr @n, align 8, !tbaa !5
  %72 = srem i64 %71, 10
  %73 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %72)
  %74 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %73, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %75

75:                                               ; preds = %66, %59
  br label %76

76:                                               ; preds = %75, %51
  br label %77

77:                                               ; preds = %76, %40
  br label %78

78:                                               ; preds = %77, %8
  ret i32 0
}

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

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

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 = { 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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


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

@n = external dso_local global i64, align 8
@temp = 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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = 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) @n)
  %2 = load i64, ptr @n, align 8
  %3 = add i64 %2, -1
  %or.cond = icmp ult i64 %3, 9
  br i1 %or.cond, label %31, label %4

4:                                                ; preds = %0
  %5 = add i64 %2, -10
  %or.cond3 = icmp ult i64 %5, 180
  br i1 %or.cond3, label %6, label %17

6:                                                ; preds = %4
  %7 = add nsw i64 %2, -9
  %8 = and i64 %7, 1
  store i64 %8, ptr @temp, align 8, !tbaa !5
  %9 = lshr i64 %7, 1
  %10 = add nuw nsw i64 %9, 9
  store i64 %10, ptr @n, align 8, !tbaa !5
  %11 = icmp eq i64 %8, 0
  br i1 %11, label %12, label %14

12:                                               ; preds = %6
  %.lhs.trunc5 = trunc nuw i64 %10 to i8
  %13 = urem i8 %.lhs.trunc5, 10
  %.zext6 = zext nneg i8 %13 to i64
  br label %31

14:                                               ; preds = %6
  %15 = add nuw nsw i64 %9, 10
  store i64 %15, ptr @n, align 8, !tbaa !5
  %.lhs.trunc7 = trunc nuw i64 %15 to i8
  %16 = udiv i8 %.lhs.trunc7, 10
  %.zext8 = zext nneg i8 %16 to i64
  br label %31

17:                                               ; preds = %4
  %18 = add nsw i64 %2, -189
  %19 = srem i64 %18, 3
  store i64 %19, ptr @temp, align 8, !tbaa !5
  %20 = sdiv i64 %18, 3
  %21 = add nsw i64 %20, 99
  store i64 %21, ptr @n, align 8, !tbaa !5
  switch i64 %19, label %27 [
    i64 0, label %22
    i64 1, label %24
  ]

22:                                               ; preds = %17
  %23 = srem i64 %21, 10
  br label %31

24:                                               ; preds = %17
  %25 = add nsw i64 %20, 100
  store i64 %25, ptr @n, align 8, !tbaa !5
  %26 = sdiv i64 %25, 100
  br label %31

27:                                               ; preds = %17
  %28 = add nsw i64 %20, 100
  %29 = sdiv i64 %28, 10
  store i64 %29, ptr @n, align 8, !tbaa !5
  %30 = srem i64 %29, 10
  br label %31

31:                                               ; preds = %0, %14, %12, %24, %27, %22
  %.zext8.sink = phi i64 [ %.zext8, %14 ], [ %.zext6, %12 ], [ %26, %24 ], [ %30, %27 ], [ %23, %22 ], [ %2, %0 ]
  %32 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.zext8.sink)
  %33 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %32, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0
}

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

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

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 = { 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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass