program kadai
implicit none
    integer(8)  ::  a,b
    integer(8)  ::  max
    integer(8)  ::  p
    integer(8)  ::  i
    real(8)  ::sq_re
    integer(8)  ::  sq_in

    read(*,*) a,b
    max=gcd(a,b)

    sq_re=sqrt(real(max,8))
    sq_in=sq_re*1

    p=0
    do i=1,sq_in
        if (mod(max,i)==0) then
            p=p+1

            if (i>1) then
                do while(mod(max,i)==0)
                    max=max/i
                end do
            end if
        end if
    end do

    if(max/=1) then
        p=p+1
    end if

    write(*,*) p


stop
contains

function gcd(a,b) result(ret)
    implicit none
    integer(8),intent(in)  ::  a,b
    integer(8)  ::  l,m,n
    integer(8)  ::  ret
    m=a
    n=b
    do
        l=mod(m,n)
        if (l==0) then
            exit
        end if
        m=n
        n=l
    end do
    ret=n
    return
end function gcd

end program kadai
; ModuleID = 'FIRModule'
source_filename = "FIRModule"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

@_QQcl.e45751f3245c3b53247fe5e9d3b6654e = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_3200/source.f\00"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

; Function Attrs: noreturn
define void @_QQmain() local_unnamed_addr #0 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.e45751f3245c3b53247fe5e9d3b6654e, i32 10)
  %4 = call i1 @_FortranAioInputInteger(ptr %3, ptr nonnull %1, i32 8)
  %5 = call i1 @_FortranAioInputInteger(ptr %3, ptr nonnull %2, i32 8)
  %6 = call i32 @_FortranAioEndIoStatement(ptr %3)
  %7 = load i64, ptr %1, align 8, !tbaa !3
  %8 = load i64, ptr %2, align 8, !tbaa !3
  br label %9

9:                                                ; preds = %9, %0
  %.07.i = phi i64 [ %8, %0 ], [ %10, %9 ]
  %.0.i = phi i64 [ %7, %0 ], [ %.07.i, %9 ]
  %10 = srem i64 %.0.i, %.07.i
  %11 = icmp eq i64 %10, 0
  br i1 %11, label %_QFPgcd.exit, label %9

_QFPgcd.exit:                                     ; preds = %9
  %12 = sitofp i64 %.07.i to double
  %13 = call contract double @llvm.sqrt.f64(double %12)
  %14 = fptosi double %13 to i64
  %15 = icmp sgt i64 %14, 0
  br i1 %15, label %.lr.ph26, label %._crit_edge

.lr.ph26:                                         ; preds = %_QFPgcd.exit, %.loopexit
  %.01624 = phi i64 [ %24, %.loopexit ], [ 1, %_QFPgcd.exit ]
  %.01723 = phi i64 [ %.1, %.loopexit ], [ 0, %_QFPgcd.exit ]
  %.01822 = phi i64 [ %.220, %.loopexit ], [ %.07.i, %_QFPgcd.exit ]
  %16 = srem i64 %.01822, %.01624
  %17 = icmp eq i64 %16, 0
  br i1 %17, label %18, label %.loopexit

18:                                               ; preds = %.lr.ph26
  %19 = add i64 %.01723, 1
  %20 = icmp sgt i64 %.01624, 1
  br i1 %20, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %18, %.lr.ph
  %.11921 = phi i64 [ %21, %.lr.ph ], [ %.01822, %18 ]
  %21 = sdiv i64 %.11921, %.01624
  %22 = srem i64 %21, %.01624
  %23 = icmp eq i64 %22, 0
  br i1 %23, label %.lr.ph, label %.loopexit

.loopexit:                                        ; preds = %.lr.ph, %18, %.lr.ph26
  %.220 = phi i64 [ %.01822, %18 ], [ %.01822, %.lr.ph26 ], [ %21, %.lr.ph ]
  %.1 = phi i64 [ %19, %18 ], [ %.01723, %.lr.ph26 ], [ %19, %.lr.ph ]
  %24 = add nuw i64 %.01624, 1
  %exitcond.not = icmp eq i64 %.01624, %14
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph26

._crit_edge:                                      ; preds = %.loopexit, %_QFPgcd.exit
  %.018.lcssa = phi i64 [ %.07.i, %_QFPgcd.exit ], [ %.220, %.loopexit ]
  %.017.lcssa = phi i64 [ 0, %_QFPgcd.exit ], [ %.1, %.loopexit ]
  %.not = icmp ne i64 %.018.lcssa, 1
  %25 = zext i1 %.not to i64
  %spec.select = add i64 %.017.lcssa, %25
  %26 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.e45751f3245c3b53247fe5e9d3b6654e, i32 33)
  %27 = call i1 @_FortranAioOutputInteger64(ptr %26, i64 %spec.select)
  %28 = call i32 @_FortranAioEndIoStatement(ptr %26)
  %29 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable
}

; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read)
define i64 @_QFPgcd(ptr nocapture readonly %0, ptr nocapture readonly %1) local_unnamed_addr #1 {
  %3 = load i64, ptr %0, align 8, !tbaa !3
  %4 = load i64, ptr %1, align 8, !tbaa !3
  br label %5

5:                                                ; preds = %5, %2
  %.07 = phi i64 [ %4, %2 ], [ %6, %5 ]
  %.0 = phi i64 [ %3, %2 ], [ %.07, %5 ]
  %6 = srem i64 %.0, %.07
  %7 = icmp eq i64 %6, 0
  br i1 %7, label %8, label %5

8:                                                ; preds = %5
  ret i64 %.07
}

declare ptr @_FortranAioBeginExternalListInput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioInputInteger(ptr, ptr, i32) local_unnamed_addr

declare i32 @_FortranAioEndIoStatement(ptr) local_unnamed_addr

declare ptr @_FortranAioBeginExternalListOutput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputInteger64(ptr, i64) local_unnamed_addr

declare {} @_FortranAStopStatement(i32, i1, i1) local_unnamed_addr

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.sqrt.f64(double) #2

attributes #0 = { noreturn }
attributes #1 = { nofree norecurse nosync nounwind memory(argmem: read) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!llvm.module.flags = !{!0, !1, !2}

!0 = !{i32 2, !"Debug Info Version", i32 3}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{!4, !4, i64 0}
!4 = !{!"any data access", !5, i64 0}
!5 = !{!"any access", !6, i64 0}
!6 = !{!"Flang Type TBAA Root"}
