integer(16) N,X,ans,i
integer(16),allocatable,dimension(:)::Y,K
read*,N,X
allocate(Y(N),K(N))
read*,Y
do i=1,N
  K(i)=abs(Y(i)-X)
end do
ans=K(1)
do i=2,N
  ans=gcd(ans,K(I))
end do
print"(i0)",ans
contains
pure function gcd(a,b)
integer(16),intent(in)::a,b
integer(16) gcd
integer(16)s,t
s=a
gcd=b

t=mod(s,gcd)
do while(t/=0)
  s=gcd
  gcd=t
  t=mod(s,gcd)
end do
end function gcd
end
; 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"

@_QFEk.0 = internal unnamed_addr global ptr null
@_QFEy.0 = internal unnamed_addr global ptr null
@_QFEy.8 = internal unnamed_addr global i64 0
@_QQcl.7d917824e002986e9ab387404bbf956a = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_5549/source.f\00"
@_QQcl.28693029 = linkonce constant [4 x i8] c"(i0)"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #0

define void @_QQmain() local_unnamed_addr {
  %1 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %2 = alloca i128, align 8
  %3 = alloca i128, align 8
  %4 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.7d917824e002986e9ab387404bbf956a, i32 3)
  %5 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %2, i32 16)
  %6 = call i1 @_FortranAioInputInteger(ptr %4, ptr nonnull %3, i32 16)
  %7 = call i32 @_FortranAioEndIoStatement(ptr %4)
  %8 = load i128, ptr %2, align 8, !tbaa !3
  %9 = trunc i128 %8 to i64
  %10 = call i64 @llvm.smax.i64(i64 %9, i64 0)
  %11 = shl i64 %10, 4
  %12 = call ptr @malloc(i64 %11)
  store ptr %12, ptr @_QFEy.0, align 8, !tbaa !7
  store i64 %10, ptr @_QFEy.8, align 8, !tbaa !7
  %13 = call ptr @malloc(i64 %11)
  store ptr %13, ptr @_QFEk.0, align 8, !tbaa !7
  %14 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.7d917824e002986e9ab387404bbf956a, i32 5)
  %.unpack = load ptr, ptr @_QFEy.0, align 8, !tbaa !7
  %.unpack226.unpack.unpack228 = load i64, ptr @_QFEy.8, align 8, !tbaa !7
  store ptr %.unpack, ptr %1, align 8, !tbaa !7
  %.fca.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 1
  store i64 16, ptr %.fca.1.gep, align 8, !tbaa !7
  %.fca.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 2
  store i32 20180515, ptr %.fca.2.gep, align 8, !tbaa !7
  %.fca.3.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 3
  store i8 1, ptr %.fca.3.gep, align 4, !tbaa !7
  %.fca.4.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 4
  store i8 11, ptr %.fca.4.gep, align 1, !tbaa !7
  %.fca.5.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 5
  store i8 0, ptr %.fca.5.gep, align 2, !tbaa !7
  %.fca.6.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 6
  store i8 0, ptr %.fca.6.gep, align 1, !tbaa !7
  %.fca.7.0.0.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 0
  store i64 1, ptr %.fca.7.0.0.gep, align 8, !tbaa !7
  %.fca.7.0.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 1
  store i64 %.unpack226.unpack.unpack228, ptr %.fca.7.0.1.gep, align 8, !tbaa !7
  %.fca.7.0.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 2
  store i64 16, ptr %.fca.7.0.2.gep, align 8, !tbaa !7
  %15 = call i1 @_FortranAioInputDescriptor(ptr %14, ptr nonnull %1)
  %16 = call i32 @_FortranAioEndIoStatement(ptr %14)
  %17 = load i128, ptr %2, align 8, !tbaa !3
  %18 = trunc i128 %17 to i64
  %19 = icmp sgt i64 %18, 0
  br i1 %19, label %.lr.ph, label %.._crit_edge_crit_edge

.._crit_edge_crit_edge:                           ; preds = %0
  %.unpack231.pre = load ptr, ptr @_QFEk.0, align 8, !tbaa !7
  br label %._crit_edge

.lr.ph:                                           ; preds = %0
  %.unpack255 = load ptr, ptr @_QFEy.0, align 8, !tbaa !7
  %.unpack267 = load ptr, ptr @_QFEk.0, align 8, !tbaa !7
  br label %20

20:                                               ; preds = %.lr.ph, %20
  %21 = phi i64 [ 1, %.lr.ph ], [ %30, %20 ]
  %22 = add i64 %21, -1
  %23 = getelementptr i128, ptr %.unpack255, i64 %22
  %24 = load i128, ptr %23, align 8, !tbaa !3
  %25 = load i128, ptr %3, align 8, !tbaa !3
  %26 = sub i128 %24, %25
  %27 = call i128 @llvm.abs.i128(i128 %26, i1 false)
  %28 = add i64 %21, -1
  %29 = getelementptr i128, ptr %.unpack267, i64 %28
  store i128 %27, ptr %29, align 8, !tbaa !3
  %30 = add nuw i64 %21, 1
  %exitcond.not = icmp eq i64 %21, %18
  br i1 %exitcond.not, label %._crit_edge.loopexit, label %20

._crit_edge.loopexit:                             ; preds = %20
  %.pre = load i128, ptr %2, align 8, !tbaa !3
  %.pre287 = trunc i128 %.pre to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.._crit_edge_crit_edge, %._crit_edge.loopexit
  %.pre-phi = phi i64 [ %18, %.._crit_edge_crit_edge ], [ %.pre287, %._crit_edge.loopexit ]
  %.unpack231 = phi ptr [ %.unpack231.pre, %.._crit_edge_crit_edge ], [ %.unpack267, %._crit_edge.loopexit ]
  %31 = load i128, ptr %.unpack231, align 8, !tbaa !3
  %32 = add i64 %.pre-phi, -1
  %33 = icmp sgt i64 %32, 0
  br i1 %33, label %.lr.ph282, label %._crit_edge283

.lr.ph282:                                        ; preds = %._crit_edge, %_QFPgcd.exit
  %34 = phi i64 [ %40, %_QFPgcd.exit ], [ 2, %._crit_edge ]
  %.0280 = phi i128 [ %.08.lcssa.i, %_QFPgcd.exit ], [ %31, %._crit_edge ]
  %35 = add i64 %34, -1
  %36 = getelementptr i128, ptr %.unpack231, i64 %35
  %37 = load i128, ptr %36, align 8, !tbaa !3
  %38 = srem i128 %.0280, %37
  %.not9.i = icmp eq i128 %38, 0
  br i1 %.not9.i, label %_QFPgcd.exit, label %.lr.ph.i

.lr.ph.i:                                         ; preds = %.lr.ph282, %.lr.ph.i
  %.011.i = phi i128 [ %39, %.lr.ph.i ], [ %38, %.lr.ph282 ]
  %.0810.i = phi i128 [ %.011.i, %.lr.ph.i ], [ %37, %.lr.ph282 ]
  %39 = srem i128 %.0810.i, %.011.i
  %.not.i = icmp eq i128 %39, 0
  br i1 %.not.i, label %_QFPgcd.exit, label %.lr.ph.i

_QFPgcd.exit:                                     ; preds = %.lr.ph.i, %.lr.ph282
  %.08.lcssa.i = phi i128 [ %37, %.lr.ph282 ], [ %.011.i, %.lr.ph.i ]
  %40 = add nuw i64 %34, 1
  %exitcond284.not = icmp eq i64 %34, %.pre-phi
  br i1 %exitcond284.not, label %._crit_edge283, label %.lr.ph282

._crit_edge283:                                   ; preds = %_QFPgcd.exit, %._crit_edge
  %.0.lcssa = phi i128 [ %31, %._crit_edge ], [ %.08.lcssa.i, %_QFPgcd.exit ]
  %41 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.7d917824e002986e9ab387404bbf956a, i32 13)
  %42 = call i1 @_FortranAioOutputInteger128(ptr %41, i128 %.0.lcssa)
  %43 = call i32 @_FortranAioEndIoStatement(ptr %41)
  ret void
}

; Function Attrs: nofree norecurse nosync nounwind memory(argmem: read)
define i128 @_QFPgcd(ptr nocapture readonly %0, ptr nocapture readonly %1) local_unnamed_addr #1 {
  %3 = load i128, ptr %0, align 8, !tbaa !3
  %4 = load i128, ptr %1, align 8, !tbaa !3
  %5 = srem i128 %3, %4
  %.not9 = icmp eq i128 %5, 0
  br i1 %.not9, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %2, %.lr.ph
  %.011 = phi i128 [ %6, %.lr.ph ], [ %5, %2 ]
  %.0810 = phi i128 [ %.011, %.lr.ph ], [ %4, %2 ]
  %6 = srem i128 %.0810, %.011
  %.not = icmp eq i128 %6, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %2
  %.08.lcssa = phi i128 [ %4, %2 ], [ %.011, %.lr.ph ]
  ret i128 %.08.lcssa
}

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 i1 @_FortranAioInputDescriptor(ptr, ptr) local_unnamed_addr

declare ptr @_FortranAioBeginExternalFormattedOutput(ptr, i64, ptr, i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputInteger128(ptr, i128) local_unnamed_addr

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i128 @llvm.abs.i128(i128, i1 immarg) #2

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #1 = { nofree norecurse nosync nounwind memory(argmem: read) }
attributes #2 = { 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"}
!7 = !{!8, !8, i64 0}
!8 = !{!"descriptor member", !5, i64 0}
