#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 pow(int, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int x;
  int digit;
  scanf("%d", &x);
  int count = 0;
  int ret = 0;
  int sum = 0;
  while (x > 0) {
    digit = x % 10;
    count++;
    if (digit % 2 == count % 2) {
      ret = 1 * pow(2, count - 1);
      sum += ret;
    }
    x /= 10;
  }
  printf("%d", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    11dd <main+0xad>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    -0x1c(%rbp),%edx
cmp    %eax,%edx
jne    11ca <main+0x9a>
mov    -0x10(%rbp),%esi
sub    $0x1,%esi
mov    $0x2,%edi
call   1050 <pow@plt>
shl    $0x0,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    1164 <main+0x34>
mov    -0x18(%rbp),%esi
lea    0xe19(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xec6(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
xor    %ebp,%ebp
test   %eax,%eax
jle    11a1 <main+0x71>
mov    $0x1,%ebx
jmp    1183 <main+0x53>
cs nopw 0x0(%rax,%rax,1)
nop
movslq %eax,%rcx
imul   $0x66666667,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rax
add    %edx,%eax
mov    %eax,0x4(%rsp)
add    $0x1,%ebx
cmp    $0x9,%ecx
jle    11a1 <main+0x71>
mov    %ebx,%ecx
xor    %eax,%ecx
test   $0x1,%cl
jne    1160 <main+0x30>
lea    -0x1(%rbx),%esi
mov    $0x2,%edi
call   1050 <pow@plt>
add    %eax,%ebp
mov    0x4(%rsp),%eax
jmp    1160 <main+0x30>
lea    0xe58(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
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 = alloca i32
store i32 0, i32* %1
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
br label %8
8: ; preds = %29, %0
%9 = load i32, i32* %2
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %32
11: ; preds = %8
%12 = load i32, i32* %2
%13 = srem i32 %12, 10
store i32 %13, i32* %3
%14 = load i32, i32* %4
%15 = add nsw i32 %14, 1
store i32 %15, i32* %4
%16 = load i32, i32* %3
%17 = srem i32 %16, 2
%18 = load i32, i32* %4
%19 = srem i32 %18, 2
%20 = icmp eq i32 %17, %19
br i1 %20, label %21, label %29
21: ; preds = %11
%22 = load i32, i32* %4
%23 = sub nsw i32 %22, 1
%24 = call i32 @pow(i32 2, i32 %23)
%25 = mul nsw i32 1, %24
store i32 %25, i32* %5
%26 = load i32, i32* %5
%27 = load i32, i32* %6
%28 = add nsw i32 %27, %26
store i32 %28, i32* %6
br label %29
29: ; preds = %21, %11
%30 = load i32, i32* %2
%31 = sdiv i32 %30, 10
store i32 %31, i32* %2
br label %8
32: ; preds = %8
%33 = load i32, i32* %6
%34 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %33)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %24
6: ; preds = %0, %19
%7 = phi i32 [ %21, %19 ], [ 0, %0 ]
%8 = phi i32 [ %11, %19 ], [ 0, %0 ]
%9 = phi i32 [ %22, %19 ], [ %4, %0 ]
%10 = urem i32 %9, 10
%11 = add nuw nsw i32 %8, 1
%12 = xor i32 %11, %10
%13 = and i32 %12, 1
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %6
%16 = call i32 @pow(i32 2, i32 %8)
%17 = add nsw i32 %16, %7
%18 = load i32, i32* %1
br label %19
19: ; preds = %15, %6
%20 = phi i32 [ %18, %15 ], [ %9, %6 ]
%21 = phi i32 [ %17, %15 ], [ %7, %6 ]
%22 = sdiv i32 %20, 10
store i32 %22, i32* %1
%23 = icmp sgt i32 %20, 9
br i1 %23, label %6, label %24
24: ; preds = %19, %0
%25 = phi i32 [ 0, %0 ], [ %21, %19 ]
%26 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %25)
ret i32 0
}