  implicit none

  integer::a,b,c,x
  integer::count
  integer::i,j,k
  
  read(*,*)a
  read(*,*)b
  read(*,*)c
  read(*,*)x

  count=0
  do i=0,a
     do j=0,b
        do k=0,c
           if(x==i*500+j*100+k*50)count=count+1
        end do
     end do
  end do

  write(*,*)count
  
end program
; 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.a4dfeb77c6cab2abca8a6c896dc828b7 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_6315/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 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.a4dfeb77c6cab2abca8a6c896dc828b7, i32 7)
  %6 = call i1 @_FortranAioInputInteger(ptr %5, ptr nonnull %1, i32 4)
  %7 = call i32 @_FortranAioEndIoStatement(ptr %5)
  %8 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.a4dfeb77c6cab2abca8a6c896dc828b7, i32 8)
  %9 = call i1 @_FortranAioInputInteger(ptr %8, ptr nonnull %2, i32 4)
  %10 = call i32 @_FortranAioEndIoStatement(ptr %8)
  %11 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.a4dfeb77c6cab2abca8a6c896dc828b7, i32 9)
  %12 = call i1 @_FortranAioInputInteger(ptr %11, ptr nonnull %3, i32 4)
  %13 = call i32 @_FortranAioEndIoStatement(ptr %11)
  %14 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.a4dfeb77c6cab2abca8a6c896dc828b7, i32 10)
  %15 = call i1 @_FortranAioInputInteger(ptr %14, ptr nonnull %4, i32 4)
  %16 = call i32 @_FortranAioEndIoStatement(ptr %14)
  %17 = load i32, ptr %1, align 4, !tbaa !3
  %18 = icmp sgt i32 %17, -1
  br i1 %18, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %0
  %19 = load i32, ptr %2, align 4, !tbaa !3
  %20 = sext i32 %19 to i64
  %21 = add nsw i64 %20, 1
  %22 = icmp sgt i32 %19, -1
  %23 = load i32, ptr %3, align 4
  %24 = sext i32 %23 to i64
  %25 = add nsw i64 %24, 1
  %26 = load i32, ptr %4, align 4
  %27 = icmp sgt i32 %23, -1
  %or.cond = select i1 %22, i1 %27, i1 false
  br i1 %or.cond, label %.lr.ph14.us.us.preheader, label %._crit_edge

.lr.ph14.us.us.preheader:                         ; preds = %.lr.ph
  %28 = sext i32 %17 to i64
  %29 = add nsw i64 %28, 1
  %30 = add nsw i64 %24, 2
  %smin = call i64 @llvm.smin.i64(i64 %25, i64 1)
  %31 = sub i64 %30, %smin
  %min.iters.check = icmp ult i64 %31, 8
  %n.vec = and i64 %31, -8
  %ind.end = sub i64 %25, %n.vec
  %ind.end24 = trunc i64 %n.vec to i32
  %broadcast.splatinsert30 = insertelement <4 x i32> poison, i32 %26, i64 0
  %broadcast.splat31 = shufflevector <4 x i32> %broadcast.splatinsert30, <4 x i32> poison, <4 x i32> zeroinitializer
  %broadcast.splatinsert32 = insertelement <4 x i32> poison, i32 %26, i64 0
  %broadcast.splat33 = shufflevector <4 x i32> %broadcast.splatinsert32, <4 x i32> poison, <4 x i32> zeroinitializer
  %cmp.n = icmp eq i64 %31, %n.vec
  br label %.lr.ph14.us.us

.lr.ph14.us.us:                                   ; preds = %.lr.ph14.us.us.preheader, %._crit_edge15.split.us.us.us
  %32 = phi i64 [ %67, %._crit_edge15.split.us.us.us ], [ %29, %.lr.ph14.us.us.preheader ]
  %33 = phi i32 [ %66, %._crit_edge15.split.us.us.us ], [ 0, %.lr.ph14.us.us.preheader ]
  %.017.us.us = phi i32 [ %spec.select.us.us.us.lcssa, %._crit_edge15.split.us.us.us ], [ 0, %.lr.ph14.us.us.preheader ]
  %34 = mul i32 %33, 500
  br label %.lr.ph.us.us.us

.lr.ph.us.us.us:                                  ; preds = %._crit_edge.us.us.us, %.lr.ph14.us.us
  %35 = phi i64 [ %21, %.lr.ph14.us.us ], [ %64, %._crit_edge.us.us.us ]
  %36 = phi i32 [ 0, %.lr.ph14.us.us ], [ %63, %._crit_edge.us.us.us ]
  %.112.us.us.us = phi i32 [ %.017.us.us, %.lr.ph14.us.us ], [ %spec.select.us.us.us.lcssa, %._crit_edge.us.us.us ]
  %37 = mul i32 %36, 100
  %38 = add i32 %37, %34
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph.us.us.us
  %39 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %.112.us.us.us, i64 0
  %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %38, i64 0
  %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  %.scalar = add i32 %38, 200
  %40 = insertelement <4 x i32> poison, i32 %.scalar, i64 0
  %41 = shufflevector <4 x i32> %40, <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.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ %39, %vector.ph ], [ %50, %vector.body ]
  %vec.phi27 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %51, %vector.body ]
  %42 = mul <4 x i32> %vec.ind, <i32 50, i32 50, i32 50, i32 50>
  %43 = mul <4 x i32> %vec.ind, <i32 50, i32 50, i32 50, i32 50>
  %44 = add <4 x i32> %broadcast.splat, %42
  %45 = add <4 x i32> %41, %43
  %46 = icmp eq <4 x i32> %broadcast.splat31, %44
  %47 = icmp eq <4 x i32> %broadcast.splat33, %45
  %48 = zext <4 x i1> %46 to <4 x i32>
  %49 = zext <4 x i1> %47 to <4 x i32>
  %50 = add <4 x i32> %vec.phi, %48
  %51 = add <4 x i32> %vec.phi27, %49
  %index.next = add nuw i64 %index, 8
  %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
  %52 = icmp eq i64 %index.next, %n.vec
  br i1 %52, label %middle.block, label %vector.body, !llvm.loop !7

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <4 x i32> %51, %50
  %53 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  br i1 %cmp.n, label %._crit_edge.us.us.us, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %.lr.ph.us.us.us, %middle.block
  %.ph = phi i64 [ %25, %.lr.ph.us.us.us ], [ %ind.end, %middle.block ]
  %.ph34 = phi i32 [ 0, %.lr.ph.us.us.us ], [ %ind.end24, %middle.block ]
  %.211.us.us.us.ph = phi i32 [ %.112.us.us.us, %.lr.ph.us.us.us ], [ %53, %middle.block ]
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %54 = phi i64 [ %61, %scalar.ph ], [ %.ph, %scalar.ph.preheader ]
  %55 = phi i32 [ %60, %scalar.ph ], [ %.ph34, %scalar.ph.preheader ]
  %.211.us.us.us = phi i32 [ %spec.select.us.us.us, %scalar.ph ], [ %.211.us.us.us.ph, %scalar.ph.preheader ]
  %56 = mul i32 %55, 50
  %57 = add i32 %38, %56
  %58 = icmp eq i32 %26, %57
  %59 = zext i1 %58 to i32
  %spec.select.us.us.us = add i32 %.211.us.us.us, %59
  %60 = add nuw i32 %55, 1
  %61 = add nsw i64 %54, -1
  %62 = icmp sgt i64 %54, 1
  br i1 %62, label %scalar.ph, label %._crit_edge.us.us.us, !llvm.loop !10

._crit_edge.us.us.us:                             ; preds = %scalar.ph, %middle.block
  %spec.select.us.us.us.lcssa = phi i32 [ %53, %middle.block ], [ %spec.select.us.us.us, %scalar.ph ]
  %63 = add nuw i32 %36, 1
  %64 = add nsw i64 %35, -1
  %65 = icmp sgt i64 %35, 1
  br i1 %65, label %.lr.ph.us.us.us, label %._crit_edge15.split.us.us.us

._crit_edge15.split.us.us.us:                     ; preds = %._crit_edge.us.us.us
  %66 = add nuw i32 %33, 1
  %67 = add nsw i64 %32, -1
  %68 = icmp sgt i64 %32, 1
  br i1 %68, label %.lr.ph14.us.us, label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge15.split.us.us.us, %.lr.ph, %0
  %.0.lcssa = phi i32 [ 0, %0 ], [ 0, %.lr.ph ], [ %spec.select.us.us.us.lcssa, %._crit_edge15.split.us.us.us ]
  %69 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.a4dfeb77c6cab2abca8a6c896dc828b7, i32 21)
  %70 = call i1 @_FortranAioOutputInteger32(ptr %69, i32 %.0.lcssa)
  %71 = call i32 @_FortranAioEndIoStatement(ptr %69)
  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 i64 @llvm.smin.i64(i64, i64) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #1

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { nocallback nofree nosync nounwind 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}
