#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*/ printf(char *, int);
scalar_t__ scanf(char *, int *, int *);
int main(void) {
  int m, n, numA, numB;
  while (scanf("%d %d", &m, &n) > 0) {
    numA = m - 1 + m * (n - 1);
    numB = n - 1 + n * (m - 1);
    printf("%d\n", ((numA < numB) ? numA : numB));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
cmp    $0x0,%rax
jle    11ac <main+0x8c>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
imul   %edx,%ecx
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
imul   %edx,%ecx
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1192 <main+0x72>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1198 <main+0x78>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe64(%rip),%rdi
call   1030 <printf@plt>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xed1(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
test   %rax,%rax
jle    119e <main+0x7e>
lea    0xebe(%rip),%r14
lea    0xeb1(%rip),%r15
lea    0x4(%rsp),%r12
mov    %rsp,%rbx
nopw   0x0(%rax,%rax,1)
mov    0x4(%rsp),%eax
lea    -0x1(%rax),%ecx
mov    (%rsp),%edx
lea    -0x1(%rdx),%esi
imul   %eax,%esi
add    %esi,%eax
add    $0xffffffff,%eax
imul   %edx,%ecx
lea    (%rdx,%rcx,1),%esi
add    $0xffffffff,%esi
cmp    %esi,%eax
cmovl  %eax,%esi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1040 <scanf@plt>
test   %rax,%rax
jg     1160 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
br label %6
6: ; preds = %31, %0
%7 = call i64 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%8 = icmp sgt i64 %7, 0
br i1 %8, label %9, label %34
9: ; preds = %6
%10 = load i32, i32* %2
%11 = sub nsw i32 %10, 1
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = sub nsw i32 %13, 1
%15 = mul nsw i32 %12, %14
%16 = add nsw i32 %11, %15
store i32 %16, i32* %4
%17 = load i32, i32* %3
%18 = sub nsw i32 %17, 1
%19 = load i32, i32* %3
%20 = load i32, i32* %2
%21 = sub nsw i32 %20, 1
%22 = mul nsw i32 %19, %21
%23 = add nsw i32 %18, %22
store i32 %23, i32* %5
%24 = load i32, i32* %4
%25 = load i32, i32* %5
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %29
27: ; preds = %9
%28 = load i32, i32* %4
br label %31
29: ; preds = %9
%30 = load i32, i32* %5
br label %31
31: ; preds = %29, %27
%32 = phi i32 [ %28, %27 ], [ %30, %29 ]
%33 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %32)
br label %6
34: ; preds = %6
ret i32 0
}

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