#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ read_input(int, int, int, int, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n, m, p, q, nn;
  scanf("%d", &n);
  scanf("%d", &m);
  scanf("%d", &p);
  scanf("%d", &q);
  nn = m * p + q * (m + p);
  read_input(n, m, p, q, nn);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xed1(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1030 <scanf@plt>
lea    0xec1(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <scanf@plt>
lea    0xeb1(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1030 <scanf@plt>
lea    0xea1(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <scanf@plt>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    -0x10(%rbp),%ecx
mov    -0x8(%rbp),%edx
add    -0xc(%rbp),%edx
imul   %edx,%ecx
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
call   1040 <read_input@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <scanf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <scanf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1030 <scanf@plt>
mov    0x8(%rsp),%esi
mov    0x4(%rsp),%edx
mov    %edx,%eax
imul   %esi,%eax
mov    (%rsp),%ecx
lea    (%rdx,%rsi,1),%r8d
imul   %ecx,%r8d
add    %eax,%r8d
mov    0xc(%rsp),%edi
call   1040 <read_input@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = mul nsw i32 %10, %11
%13 = load i32, i32* %4
%14 = load i32, i32* %2
%15 = load i32, i32* %3
%16 = add nsw i32 %14, %15
%17 = mul nsw i32 %13, %16
%18 = add nsw i32 %12, %17
store i32 %18, i32* %5
%19 = load i32, i32* %1
%20 = load i32, i32* %2
%21 = load i32, i32* %3
%22 = load i32, i32* %4
%23 = load i32, i32* %5
%24 = call i32 @read_input(i32 %19, i32 %20, i32 %21, i32 %22, i32 %23)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = mul nsw i32 %14, %13
%16 = load i32, i32* %4
%17 = add nsw i32 %14, %13
%18 = mul nsw i32 %16, %17
%19 = add nsw i32 %18, %15
%20 = load i32, i32* %1
%21 = call i32 @read_input(i32 %20, i32 %13, i32 %14, i32 %16, i32 %19)
ret i32 0
}