#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 *, double);
int /*<<< orphan*/ scanf(char *, double *, double *);
int main() {
  double m = 3, n = 1, sum = 0, a, b, x, y;
  scanf("%lf %lf", &a, &b);
  while (1) {
    sum += m * n;
    if (m == a && n == b) {
      break;
    }
    x = m;
    y = n;
    m = x + y;
    n = x - y;
  }
  printf("%.0f", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xed1(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xebc(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
lea    0xeb8(%rip),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x30(%rbp),%rdx
call   1040 <scanf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jne    11b2 <main+0x92>
jp     11b2 <main+0x92>
movsd  -0x18(%rbp),%xmm0
ucomisd -0x30(%rbp),%xmm0
jne    11b2 <main+0x92>
jp     11b2 <main+0x92>
jmp    11e9 <main+0xc9>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
addsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x38(%rbp),%xmm0
subsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1165 <main+0x45>
movsd  -0x20(%rbp),%xmm0
lea    0xe23(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xee5(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1040 <scanf@plt>
movsd  0x10(%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
movsd  0xeb2(%rip),%xmm0
ucomisd %xmm0,%xmm1
jne    1162 <main+0x42>
jp     1162 <main+0x42>
ucomisd 0xeaa(%rip),%xmm2
jne    1162 <main+0x42>
jnp    11b0 <main+0x90>
movsd  0xe9e(%rip),%xmm3
movsd  0xe8e(%rip),%xmm0
movapd %xmm0,%xmm4
cs nopw 0x0(%rax,%rax,1)
movapd %xmm3,%xmm5
movapd %xmm4,%xmm3
movapd %xmm5,%xmm4
addsd  %xmm3,%xmm4
subsd  %xmm5,%xmm3
movapd %xmm4,%xmm5
mulsd  %xmm3,%xmm5
addsd  %xmm5,%xmm0
ucomisd %xmm1,%xmm4
jne    1180 <main+0x60>
jp     1180 <main+0x60>
ucomisd %xmm2,%xmm3
jne    1180 <main+0x60>
jp     1180 <main+0x60>
lea    0xe61(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%lf %lf\00"
@.str.1 = [5 x i8] c"%.0f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store i32 0, i32* %1
store double 3.000000e+00, double* %2
store double 1.000000e+00, double* %3
store double 0.000000e+00, double* %4
%9 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), double* %5, double* %6)
br label %10
10: ; preds = %0, %23
%11 = load double, double* %2
%12 = load double, double* %3
%13 = load double, double* %4
%14 = call double @llvm.fmuladd.f64(double %11, double %12, double %13)
store double %14, double* %4
%15 = load double, double* %2
%16 = load double, double* %5
%17 = fcmp oeq double %15, %16
br i1 %17, label %18, label %23
18: ; preds = %10
%19 = load double, double* %3
%20 = load double, double* %6
%21 = fcmp oeq double %19, %20
br i1 %21, label %22, label %23
22: ; preds = %18
br label %32
23: ; preds = %18, %10
%24 = load double, double* %2
store double %24, double* %7
%25 = load double, double* %3
store double %25, double* %8
%26 = load double, double* %7
%27 = load double, double* %8
%28 = fadd double %26, %27
store double %28, double* %2
%29 = load double, double* %7
%30 = load double, double* %8
%31 = fsub double %29, %30
store double %31, double* %3
br label %10
32: ; preds = %22
%33 = load double, double* %4
%34 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double %33)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"%lf %lf\00"
@.str.1 = [5 x i8] c"%.0f\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = bitcast double* %1 to i8*
%4 = bitcast double* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), double* %1, double* %2)
%6 = load double, double* %1
%7 = load double, double* %2
%8 = fcmp oeq double %6, 3.000000e+00
%9 = fcmp oeq double %7, 1.000000e+00
%10 = select i1 %8, i1 %9, i1 false
br i1 %10, label %21, label %11
11: ; preds = %0, %11
%12 = phi double [ %17, %11 ], [ 3.000000e+00, %0 ]
%13 = phi double [ %15, %11 ], [ 3.000000e+00, %0 ]
%14 = phi double [ %16, %11 ], [ 1.000000e+00, %0 ]
%15 = fadd double %14, %13
%16 = fsub double %13, %14
%17 = call double @llvm.fmuladd.f64(double %15, double %16, double %12)
%18 = fcmp oeq double %15, %6
%19 = fcmp oeq double %16, %7
%20 = select i1 %18, i1 %19, i1 false
br i1 %20, label %21, label %11
21: ; preds = %11, %0
%22 = phi double [ 3.000000e+00, %0 ], [ %17, %11 ]
%23 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double %22)
ret i32 0
}