#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 *, float, ...);
int /*<<< orphan*/ scanf(char *, float *, float *);
int main() {
  int n = 1, temp = 0;
  float n1 = 0.0, n2 = 0.0;
  float total = 0.0;
  scanf("%f %f", &n1, &n2);
  while (n) {
    temp = n1;
    if ((temp % 2) == 1) {
      if (0) {
        printf("soma-> %f : %f\n", total, n2);
      }
      total += n2;
    }
    n1 = temp / 2;
    n2 = n2 * 2;
    if (0) {
      printf("%d = %f : %f\n", temp, n1, n2);
    }
    if (temp == 1) {
      n = 0;
    }
  }
  printf("\n Total: %f\n", total);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
lea    0xea8(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
je     11da <main+0xba>
cvttss2si -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    119e <main+0x7e>
movss  -0x14(%rbp),%xmm0
addss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xe46(%rip),%xmm0
mulss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    11d5 <main+0xb5>
movl   $0x0,-0x8(%rbp)
jmp    1169 <main+0x49>
movss  -0x18(%rbp),%xmm0
lea    0xe24(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x0,0x4(%rsp)
movl   $0x0,(%rsp)
lea    0xecd(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
movss  0x4(%rsp),%xmm3
xorps  %xmm0,%xmm0
movss  (%rsp),%xmm1
movss  0xea6(%rip),%xmm2
jmp    1176 <main+0x56>
nopl   0x0(%rax)
sar    %ecx
xorps  %xmm3,%xmm3
cvtsi2ss %ecx,%xmm3
addss  %xmm4,%xmm0
addss  %xmm1,%xmm1
cmp    $0x1,%eax
je     1197 <main+0x77>
cvttss2si %xmm3,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
mov    %ecx,%edx
and    $0xfffffffe,%edx
mov    %eax,%esi
sub    %edx,%esi
movaps %xmm1,%xmm4
cmp    $0x1,%esi
je     1160 <main+0x40>
movaps %xmm2,%xmm4
jmp    1160 <main+0x40>
movss  %xmm3,0x4(%rsp)
movss  %xmm1,(%rsp)
lea    0xe61(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%f %f\00"
@.str.1 = [13 x i8] c"\0A Total: %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
%5 = alloca float
%6 = alloca float
store i32 0, i32* %1
store i32 1, i32* %2
store i32 0, i32* %3
store float 0.000000e+00, float* %4
store float 0.000000e+00, float* %5
store float 0.000000e+00, float* %6
%7 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), float* %4, float* %5)
br label %8
8: ; preds = %30, %0
%9 = load i32, i32* %2
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %31
11: ; preds = %8
%12 = load float, float* %4
%13 = fptosi float %12 to i32
store i32 %13, i32* %3
%14 = load i32, i32* %3
%15 = srem i32 %14, 2
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %21
17: ; preds = %11
%18 = load float, float* %5
%19 = load float, float* %6
%20 = fadd float %19, %18
store float %20, float* %6
br label %21
21: ; preds = %17, %11
%22 = load i32, i32* %3
%23 = sdiv i32 %22, 2
%24 = sitofp i32 %23 to float
store float %24, float* %4
%25 = load float, float* %5
%26 = fmul float %25, 2.000000e+00
store float %26, float* %5
%27 = load i32, i32* %3
%28 = icmp eq i32 %27, 1
br i1 %28, label %29, label %30
29: ; preds = %21
store i32 0, i32* %2
br label %30
30: ; preds = %29, %21
br label %8
31: ; preds = %8
%32 = load float, float* %6
%33 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), float %32)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%f %f\00"
@.str.1 = [13 x i8] c"\0A Total: %f\0A\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = bitcast float* %1 to i8*
store float 0.000000e+00, float* %1
%4 = bitcast float* %2 to i8*
store float 0.000000e+00, float* %2
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), float* %1, float* %2)
%6 = load float, float* %1
%7 = load float, float* %2
br label %8
8: ; preds = %0, %8
%9 = phi float [ 0.000000e+00, %0 ], [ %16, %8 ]
%10 = phi float [ %6, %0 ], [ %18, %8 ]
%11 = phi float [ %7, %0 ], [ %19, %8 ]
%12 = fptosi float %10 to i32
%13 = srem i32 %12, 2
%14 = icmp eq i32 %13, 1
%15 = select i1 %14, float %11, float -0.000000e+00
%16 = fadd float %9, %15
%17 = sdiv i32 %12, 2
%18 = sitofp i32 %17 to float
%19 = fmul float %11, 2.000000e+00
%20 = icmp eq i32 %12, 1
br i1 %20, label %21, label %8
21: ; preds = %8
store float %18, float* %1
store float %19, float* %2
%22 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), float %16)
ret i32 0
}