program test
implicit none
integer :: a,b,c,x,y,p(3)

read(*,*) a,b,c,x,y

p(1) = b * max(y-x,0) + c * 2 * x
p(2) = a * max(x-y,0) + c * 2 * y
p(3) = a * x + b * y

write(*,*) minval(p(1:3))
 
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.27c63d60aa1de13cbf7c889b3538c840 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_6056/source.f\00"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

define void @_QQmain() local_unnamed_addr {
  %1 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca [3 x i32], align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.27c63d60aa1de13cbf7c889b3538c840, i32 5)
  %9 = call i1 @_FortranAioInputInteger(ptr %8, ptr nonnull %2, i32 4)
  %10 = call i1 @_FortranAioInputInteger(ptr %8, ptr nonnull %3, i32 4)
  %11 = call i1 @_FortranAioInputInteger(ptr %8, ptr nonnull %4, i32 4)
  %12 = call i1 @_FortranAioInputInteger(ptr %8, ptr nonnull %6, i32 4)
  %13 = call i1 @_FortranAioInputInteger(ptr %8, ptr nonnull %7, i32 4)
  %14 = call i32 @_FortranAioEndIoStatement(ptr %8)
  %15 = load i32, ptr %3, align 4, !tbaa !3
  %16 = load i32, ptr %7, align 4, !tbaa !3
  %17 = load i32, ptr %6, align 4, !tbaa !3
  %18 = sub i32 %16, %17
  %19 = call i32 @llvm.smax.i32(i32 %18, i32 0)
  %20 = mul i32 %19, %15
  %21 = load i32, ptr %4, align 4, !tbaa !3
  %22 = shl i32 %21, 1
  %23 = mul i32 %22, %17
  %24 = add i32 %20, %23
  store i32 %24, ptr %5, align 4, !tbaa !3
  %25 = load i32, ptr %2, align 4, !tbaa !3
  %26 = sub i32 %17, %16
  %27 = call i32 @llvm.smax.i32(i32 %26, i32 0)
  %28 = mul i32 %25, %27
  %29 = mul i32 %22, %16
  %30 = add i32 %28, %29
  %31 = getelementptr inbounds [3 x i32], ptr %5, i64 0, i64 1
  store i32 %30, ptr %31, align 4, !tbaa !3
  %32 = mul i32 %25, %17
  %33 = mul i32 %16, %15
  %34 = add i32 %32, %33
  %35 = getelementptr inbounds [3 x i32], ptr %5, i64 0, i64 2
  store i32 %34, ptr %35, align 4, !tbaa !3
  %36 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.27c63d60aa1de13cbf7c889b3538c840, i32 11)
  store ptr %5, 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 4, 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 9, 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 3, 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 4, ptr %.fca.7.0.2.gep, align 8, !tbaa !7
  %37 = call i32 @_FortranAMinvalInteger4(ptr nonnull %1, ptr nonnull @_QQcl.27c63d60aa1de13cbf7c889b3538c840, i32 11, i32 0, ptr null)
  %38 = call i1 @_FortranAioOutputInteger32(ptr %36, i32 %37)
  %39 = call i32 @_FortranAioEndIoStatement(ptr %36)
  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

declare i32 @_FortranAMinvalInteger4(ptr, ptr, i32, i32, ptr) 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 = !{!8, !8, i64 0}
!8 = !{!"descriptor member", !5, i64 0}
