; LLVM IR from kazunetakahashi/atcoder :: 2018/0421_ARC096 (C)

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

@A = external dso_local global i64, align 8
@B = external dso_local global i64, align 8
@C = external dso_local global i64, align 8
@X = external dso_local global i64, align 8
@Y = 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
  %2 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %3 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @A)
  %4 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(8) @B)
  %5 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 8 dereferenceable(8) @C)
  %6 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(8) @X)
  %7 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 8 dereferenceable(8) @Y)
  %8 = load i64, ptr @A, align 8, !tbaa !5
  %9 = load i64, ptr @B, align 8, !tbaa !5
  %10 = add nsw i64 %8, %9
  %11 = load i64, ptr @C, align 8, !tbaa !5
  %12 = mul nsw i64 2, %11
  %13 = icmp sle i64 %10, %12
  br i1 %13, label %14, label %24

14:                                               ; preds = %0
  %15 = load i64, ptr @A, align 8, !tbaa !5
  %16 = load i64, ptr @X, align 8, !tbaa !5
  %17 = mul nsw i64 %15, %16
  %18 = load i64, ptr @B, align 8, !tbaa !5
  %19 = load i64, ptr @Y, align 8, !tbaa !5
  %20 = mul nsw i64 %18, %19
  %21 = add nsw i64 %17, %20
  %22 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %21)
  %23 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %22, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 0, ptr %1, align 4
  br label %69

24:                                               ; preds = %0
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #5
  %25 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @X, ptr noundef nonnull align 8 dereferenceable(8) @Y)
  %26 = load i64, ptr %25, align 8, !tbaa !5
  %27 = mul nsw i64 2, %26
  store i64 %27, ptr %2, align 8, !tbaa !5
  %28 = load i64, ptr %2, align 8, !tbaa !5
  %29 = sdiv i64 %28, 2
  %30 = load i64, ptr @X, align 8, !tbaa !5
  %31 = sub nsw i64 %30, %29
  store i64 %31, ptr @X, align 8, !tbaa !5
  %32 = load i64, ptr %2, align 8, !tbaa !5
  %33 = sdiv i64 %32, 2
  %34 = load i64, ptr @Y, align 8, !tbaa !5
  %35 = sub nsw i64 %34, %33
  store i64 %35, ptr @Y, align 8, !tbaa !5
  %36 = load i64, ptr @A, align 8, !tbaa !5
  %37 = load i64, ptr @C, align 8, !tbaa !5
  %38 = mul nsw i64 2, %37
  %39 = icmp sgt i64 %36, %38
  br i1 %39, label %40, label %45

40:                                               ; preds = %24
  %41 = load i64, ptr @X, align 8, !tbaa !5
  %42 = mul nsw i64 2, %41
  %43 = load i64, ptr %2, align 8, !tbaa !5
  %44 = add nsw i64 %43, %42
  store i64 %44, ptr %2, align 8, !tbaa !5
  store i64 0, ptr @X, align 8, !tbaa !5
  br label %45

45:                                               ; preds = %40, %24
  %46 = load i64, ptr @B, align 8, !tbaa !5
  %47 = load i64, ptr @C, align 8, !tbaa !5
  %48 = mul nsw i64 2, %47
  %49 = icmp sgt i64 %46, %48
  br i1 %49, label %50, label %55

50:                                               ; preds = %45
  %51 = load i64, ptr @Y, align 8, !tbaa !5
  %52 = mul nsw i64 2, %51
  %53 = load i64, ptr %2, align 8, !tbaa !5
  %54 = add nsw i64 %53, %52
  store i64 %54, ptr %2, align 8, !tbaa !5
  store i64 0, ptr @Y, align 8, !tbaa !5
  br label %55

55:                                               ; preds = %50, %45
  %56 = load i64, ptr @A, align 8, !tbaa !5
  %57 = load i64, ptr @X, align 8, !tbaa !5
  %58 = mul nsw i64 %56, %57
  %59 = load i64, ptr @B, align 8, !tbaa !5
  %60 = load i64, ptr @Y, align 8, !tbaa !5
  %61 = mul nsw i64 %59, %60
  %62 = add nsw i64 %58, %61
  %63 = load i64, ptr @C, align 8, !tbaa !5
  %64 = load i64, ptr %2, align 8, !tbaa !5
  %65 = mul nsw i64 %63, %64
  %66 = add nsw i64 %62, %65
  %67 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %66)
  %68 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %67, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  br label %69

69:                                               ; preds = %55, %14
  %70 = load i32, ptr %1, align 4
  ret i32 %70
}

; 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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #4

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

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" }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { inlinehint 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 = { 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 = !{!"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" }

@A = external dso_local global i64, align 8
@B = external dso_local global i64, align 8
@C = external dso_local global i64, align 8
@X = external dso_local global i64, align 8
@Y = 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() 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) @A)
  %2 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 8 dereferenceable(8) @B)
  %3 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 8 dereferenceable(8) @C)
  %4 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(8) @X)
  %5 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 8 dereferenceable(8) @Y)
  %6 = load i64, ptr @A, align 8, !tbaa !5
  %7 = load i64, ptr @B, align 8, !tbaa !5
  %8 = add nsw i64 %7, %6
  %9 = load i64, ptr @C, align 8, !tbaa !5
  %10 = shl nsw i64 %9, 1
  %.not = icmp sgt i64 %8, %10
  br i1 %.not, label %17, label %11

11:                                               ; preds = %0
  %12 = load i64, ptr @X, align 8, !tbaa !5
  %13 = mul nsw i64 %12, %6
  %14 = load i64, ptr @Y, align 8, !tbaa !5
  %15 = mul nsw i64 %14, %7
  %16 = add nsw i64 %15, %13
  br label %41

17:                                               ; preds = %0
  %18 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @X, ptr noundef nonnull align 8 dereferenceable(8) @Y)
  %19 = load i64, ptr %18, align 8, !tbaa !5
  %20 = load i64, ptr @X, align 8, !tbaa !5
  %21 = sub nsw i64 %20, %19
  store i64 %21, ptr @X, align 8, !tbaa !5
  %22 = load i64, ptr @Y, align 8, !tbaa !5
  %23 = sub nsw i64 %22, %19
  store i64 %23, ptr @Y, align 8, !tbaa !5
  %24 = load i64, ptr @A, align 8, !tbaa !5
  %25 = load i64, ptr @C, align 8, !tbaa !5
  %26 = shl i64 %25, 1
  %27 = icmp sgt i64 %24, %26
  br i1 %27, label %28, label %29

28:                                               ; preds = %17
  store i64 0, ptr @X, align 8, !tbaa !5
  br label %29

29:                                               ; preds = %28, %17
  %30 = phi i64 [ 0, %28 ], [ %21, %17 ]
  %.0.in = phi i64 [ %20, %28 ], [ %19, %17 ]
  %31 = load i64, ptr @B, align 8, !tbaa !5
  %32 = icmp sgt i64 %31, %26
  br i1 %32, label %33, label %34

33:                                               ; preds = %29
  %.07 = add i64 %.0.in, %23
  store i64 0, ptr @Y, align 8, !tbaa !5
  br label %34

34:                                               ; preds = %33, %29
  %35 = phi i64 [ 0, %33 ], [ %23, %29 ]
  %.1.in = phi i64 [ %.07, %33 ], [ %.0.in, %29 ]
  %36 = mul nsw i64 %30, %24
  %37 = mul nsw i64 %35, %31
  %38 = mul i64 %26, %.1.in
  %39 = add i64 %38, %36
  %40 = add i64 %39, %37
  br label %41

41:                                               ; preds = %34, %11
  %.sink8 = phi i64 [ %40, %34 ], [ %16, %11 ]
  %42 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.sink8)
  %43 = tail 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_)
  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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3

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" }
attributes #3 = { inlinehint 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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass