program C
read*,ix,in

if (in==0)then
print*,ix
goto 30
end if
call sub(ix,in)
30 end program

subroutine sub(ix,in)
integer::na(1:in)
read*,(na(j),j=1,in)
ii=0
ij=0
do ixd=0,1000
ii=0
ij=0
 do k=1,in
  if ((ix-ixd)==(na(k)))then
  ii=1
  end if
    if ((ix+ixd)==(na(k)))then
  ij=1
  end if
  end do
  if (ii==0)then
   print*,ix-ixd
   goto 40
   end if
    if (ij==0)then
   print*,ix+ixd
   goto 40
   end if
 end do
40 end subroutine
; 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.06c8b2cf8814e650d1b4123bc3c81e05 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_1194/source.f\00"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

define void @_QQmain() local_unnamed_addr {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.06c8b2cf8814e650d1b4123bc3c81e05, i32 2)
  %4 = call i1 @_FortranAioInputInteger(ptr %3, ptr nonnull %2, i32 4)
  %5 = call i1 @_FortranAioInputInteger(ptr %3, ptr nonnull %1, i32 4)
  %6 = call i32 @_FortranAioEndIoStatement(ptr %3)
  %7 = load i32, ptr %1, align 4, !tbaa !3
  %8 = icmp eq i32 %7, 0
  br i1 %8, label %9, label %14

9:                                                ; preds = %0
  %10 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.06c8b2cf8814e650d1b4123bc3c81e05, i32 5)
  %11 = load i32, ptr %2, align 4, !tbaa !3
  %12 = call i1 @_FortranAioOutputInteger32(ptr %10, i32 %11)
  %13 = call i32 @_FortranAioEndIoStatement(ptr %10)
  br label %15

14:                                               ; preds = %0
  call void @sub_(ptr nonnull %2, ptr nonnull %1)
  br label %15

15:                                               ; preds = %9, %14
  ret void
}

define void @sub_(ptr nocapture readonly %0, ptr nocapture readonly %1) local_unnamed_addr {
  %3 = load i32, ptr %1, align 4, !tbaa !3
  %4 = tail call i32 @llvm.smax.i32(i32 %3, i32 0)
  %5 = zext i32 %4 to i64
  %6 = alloca i32, i64 %5, align 4
  %7 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.06c8b2cf8814e650d1b4123bc3c81e05, i32 13)
  %8 = load i32, ptr %1, align 4, !tbaa !3
  %9 = icmp sgt i32 %8, 0
  br i1 %9, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %2
  %10 = zext i32 %8 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %11 = phi i64 [ %16, %.lr.ph ], [ 1, %.lr.ph.preheader ]
  %sext = shl i64 %11, 32
  %12 = ashr exact i64 %sext, 32
  %13 = add nsw i64 %12, -1
  %14 = getelementptr i32, ptr %6, i64 %13
  %15 = call i1 @_FortranAioInputInteger(ptr %7, ptr %14, i32 4)
  %16 = add nuw nsw i64 %11, 1
  %exitcond.not = icmp eq i64 %11, %10
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %2
  %17 = call i32 @_FortranAioEndIoStatement(ptr %7)
  %18 = load i32, ptr %1, align 4, !tbaa !3
  %19 = icmp sgt i32 %18, 0
  br i1 %19, label %.split.us, label %.split30.us

.split.us:                                        ; preds = %._crit_edge
  %20 = zext i32 %18 to i64
  %21 = load i32, ptr %0, align 4, !tbaa !3
  %min.iters.check = icmp ult i32 %18, 8
  %n.vec = and i64 %20, 4294967288
  %ind.end = or i64 %n.vec, 1
  %cmp.n = icmp eq i64 %n.vec, %20
  br label %.lr.ph24.us

.lr.ph24.us:                                      ; preds = %39, %.split.us
  %.028.us = phi i32 [ 0, %.split.us ], [ %40, %39 ]
  %22 = sub i32 %21, %.028.us
  %23 = add i32 %21, %.028.us
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph24.us
  %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %22, i64 0
  %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  %broadcast.splatinsert47 = insertelement <4 x i32> poison, i32 %22, i64 0
  %broadcast.splat48 = shufflevector <4 x i32> %broadcast.splatinsert47, <4 x i32> poison, <4 x i32> zeroinitializer
  %broadcast.splatinsert49 = insertelement <4 x i32> poison, i32 %23, i64 0
  %broadcast.splat50 = shufflevector <4 x i32> %broadcast.splatinsert49, <4 x i32> poison, <4 x i32> zeroinitializer
  %broadcast.splatinsert51 = insertelement <4 x i32> poison, i32 %23, i64 0
  %broadcast.splat52 = shufflevector <4 x i32> %broadcast.splatinsert51, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %32, %vector.body ]
  %vec.phi43 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %33, %vector.body ]
  %vec.phi44 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %28, %vector.body ]
  %vec.phi45 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %29, %vector.body ]
  %24 = getelementptr i32, ptr %6, i64 %index
  %wide.load = load <4 x i32>, ptr %24, align 4, !tbaa !3
  %25 = getelementptr i32, ptr %24, i64 4
  %wide.load46 = load <4 x i32>, ptr %25, align 4, !tbaa !3
  %26 = icmp eq <4 x i32> %broadcast.splat, %wide.load
  %27 = icmp eq <4 x i32> %broadcast.splat48, %wide.load46
  %28 = select <4 x i1> %26, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> %vec.phi44
  %29 = select <4 x i1> %27, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> %vec.phi45
  %30 = icmp eq <4 x i32> %broadcast.splat50, %wide.load
  %31 = icmp eq <4 x i32> %broadcast.splat52, %wide.load46
  %32 = select <4 x i1> %30, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> %vec.phi
  %33 = select <4 x i1> %31, <4 x i32> <i32 1, i32 1, i32 1, i32 1>, <4 x i32> %vec.phi43
  %index.next = add nuw i64 %index, 8
  %34 = icmp eq i64 %index.next, %n.vec
  br i1 %34, label %middle.block, label %vector.body, !llvm.loop !7

middle.block:                                     ; preds = %vector.body
  %rdx.select.cmp55.not = icmp ne <4 x i32> %28, zeroinitializer
  %rdx.select.cmp5760 = icmp ne <4 x i32> %29, zeroinitializer
  %rdx.select.cmp57 = select <4 x i1> %rdx.select.cmp55.not, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %rdx.select.cmp5760
  %35 = bitcast <4 x i1> %rdx.select.cmp57 to i4
  %.not = icmp ne i4 %35, 0
  %rdx.select58 = zext i1 %.not to i32
  %rdx.select.cmp.not = icmp ne <4 x i32> %32, zeroinitializer
  %rdx.select.cmp5361 = icmp ne <4 x i32> %33, zeroinitializer
  %rdx.select.cmp53 = select <4 x i1> %rdx.select.cmp.not, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %rdx.select.cmp5361
  %36 = bitcast <4 x i1> %rdx.select.cmp53 to i4
  %.not62 = icmp ne i4 %36, 0
  %rdx.select54 = zext i1 %.not62 to i32
  br i1 %cmp.n, label %._crit_edge25.us, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %.lr.ph24.us, %middle.block
  %indvars.iv.ph = phi i64 [ 1, %.lr.ph24.us ], [ %ind.end, %middle.block ]
  %.01322.us.ph = phi i32 [ 0, %.lr.ph24.us ], [ %rdx.select54, %middle.block ]
  %.01421.us.ph = phi i32 [ 0, %.lr.ph24.us ], [ %rdx.select58, %middle.block ]
  br label %scalar.ph

37:                                               ; preds = %._crit_edge25.us
  %38 = icmp eq i32 %.1.us.lcssa, 0
  br i1 %38, label %.split32.us, label %39

39:                                               ; preds = %37
  %40 = add nuw nsw i32 %.028.us, 1
  %exitcond38.not = icmp eq i32 %40, 1001
  br i1 %exitcond38.not, label %.loopexit, label %.lr.ph24.us

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %scalar.ph ], [ %indvars.iv.ph, %scalar.ph.preheader ]
  %.01322.us = phi i32 [ %.1.us, %scalar.ph ], [ %.01322.us.ph, %scalar.ph.preheader ]
  %.01421.us = phi i32 [ %spec.select.us, %scalar.ph ], [ %.01421.us.ph, %scalar.ph.preheader ]
  %41 = add nsw i64 %indvars.iv, -1
  %42 = getelementptr i32, ptr %6, i64 %41
  %43 = load i32, ptr %42, align 4, !tbaa !3
  %44 = icmp eq i32 %22, %43
  %spec.select.us = select i1 %44, i32 1, i32 %.01421.us
  %45 = icmp eq i32 %23, %43
  %.1.us = select i1 %45, i32 1, i32 %.01322.us
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond37.not = icmp eq i64 %indvars.iv, %20
  br i1 %exitcond37.not, label %._crit_edge25.us, label %scalar.ph, !llvm.loop !10

._crit_edge25.us:                                 ; preds = %scalar.ph, %middle.block
  %spec.select.us.lcssa = phi i32 [ %rdx.select58, %middle.block ], [ %spec.select.us, %scalar.ph ]
  %.1.us.lcssa = phi i32 [ %rdx.select54, %middle.block ], [ %.1.us, %scalar.ph ]
  %46 = icmp eq i32 %spec.select.us.lcssa, 0
  br i1 %46, label %.split30.us, label %37

.split30.us:                                      ; preds = %._crit_edge25.us, %._crit_edge
  %.us-phi = phi i32 [ 0, %._crit_edge ], [ %.028.us, %._crit_edge25.us ]
  %47 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.06c8b2cf8814e650d1b4123bc3c81e05, i32 28)
  %48 = load i32, ptr %0, align 4, !tbaa !3
  %49 = sub i32 %48, %.us-phi
  %50 = call i1 @_FortranAioOutputInteger32(ptr %47, i32 %49)
  br label %.loopexit.sink.split

.split32.us:                                      ; preds = %37
  %51 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.06c8b2cf8814e650d1b4123bc3c81e05, i32 32)
  %52 = load i32, ptr %0, align 4, !tbaa !3
  %53 = add i32 %52, %.028.us
  %54 = call i1 @_FortranAioOutputInteger32(ptr %51, i32 %53)
  br label %.loopexit.sink.split

.loopexit.sink.split:                             ; preds = %.split32.us, %.split30.us
  %.sink = phi ptr [ %47, %.split30.us ], [ %51, %.split32.us ]
  %55 = call i32 @_FortranAioEndIoStatement(ptr %.sink)
  br label %.loopexit

.loopexit:                                        ; preds = %39, %.loopexit.sink.split
  ret void
}

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 @_FortranAioOutputInteger32(ptr, i32) local_unnamed_addr

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

attributes #0 = { 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 = distinct !{!7, !8, !9}
!8 = !{!"llvm.loop.isvectorized", i32 1}
!9 = !{!"llvm.loop.unroll.runtime.disable"}
!10 = distinct !{!10, !9, !8}
