#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 */
long _power(long, long);
long _recursiveDecimalSum(long EV_binaryNum, long EV_decimalSum,
                          long EV_recursiveDepth) {
  long EV_tempNum;
  long EV_base;
  long EV_remainder;
  if ((EV_binaryNum > 0)) {
    EV_base = 2;
    EV_tempNum = (EV_binaryNum / 10);
    EV_tempNum = (EV_tempNum * 10);
    EV_tempNum = (EV_binaryNum - EV_tempNum);
    if ((EV_tempNum == 1)) {
      EV_decimalSum = (EV_decimalSum + _power(EV_base, EV_recursiveDepth));
    }
    return _recursiveDecimalSum((EV_binaryNum / 10), EV_decimalSum,
                                (EV_recursiveDepth + 1));
  }
  return EV_decimalSum;
}


x86 assembly (clang, -O0):
<_recursiveDecimalSum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
jle    11c7 <_recursiveDecimalSum+0xa7>
movq   $0x2,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,-0x28(%rbp)
imul   $0xa,-0x28(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
sub    -0x28(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x1,-0x28(%rbp)
jne    119c <_recursiveDecimalSum+0x7c>
mov    -0x18(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <_power@plt>
mov    %rax,%rcx
mov    -0x40(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
add    $0x1,%rdx
call   1040 <_recursiveDecimalSum@plt>
mov    %rax,-0x8(%rbp)
jmp    11cf <_recursiveDecimalSum+0xaf>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_recursiveDecimalSum>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rsi,%r14
test   %rdi,%rdi
jle    1180 <_recursiveDecimalSum+0x70>
mov    %rdx,%r12
mov    %rdi,%r15
movabs $0xcccccccccccccccd,%r13
cc cc cc
jmp    114d <_recursiveDecimalSum+0x3d>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%r12
cmp    $0x9,%r15
mov    %rbx,%r15
jbe    1180 <_recursiveDecimalSum+0x70>
mov    %r15,%rax
mul    %r13
mov    %rdx,%rbx
shr    $0x3,%rbx
lea    (%rbx,%rbx,1),%rax
lea    (%rax,%rax,4),%rax
mov    %r15,%rcx
sub    %rax,%rcx
cmp    $0x1,%rcx
jne    1140 <_recursiveDecimalSum+0x30>
mov    $0x2,%edi
mov    %r12,%rsi
call   1030 <_power@plt>
add    %rax,%r14
jmp    1140 <_recursiveDecimalSum+0x30>
mov    %r14,%rax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i64 @_recursiveDecimalSum(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
store i64 %0, i64* %5
store i64 %1, i64* %6
store i64 %2, i64* %7
%11 = load i64, i64* %5
%12 = icmp sgt i64 %11, 0
br i1 %12, label %13, label %36
13: ; preds = %3
store i64 2, i64* %9
%14 = load i64, i64* %5
%15 = sdiv i64 %14, 10
store i64 %15, i64* %8
%16 = load i64, i64* %8
%17 = mul nsw i64 %16, 10
store i64 %17, i64* %8
%18 = load i64, i64* %5
%19 = load i64, i64* %8
%20 = sub nsw i64 %18, %19
store i64 %20, i64* %8
%21 = load i64, i64* %8
%22 = icmp eq i64 %21, 1
br i1 %22, label %23, label %29
23: ; preds = %13
%24 = load i64, i64* %6
%25 = load i64, i64* %9
%26 = load i64, i64* %7
%27 = call i64 @_power(i64 %25, i64 %26)
%28 = add nsw i64 %24, %27
store i64 %28, i64* %6
br label %29
29: ; preds = %23, %13
%30 = load i64, i64* %5
%31 = sdiv i64 %30, 10
%32 = load i64, i64* %6
%33 = load i64, i64* %7
%34 = add nsw i64 %33, 1
%35 = call i64 @_recursiveDecimalSum(i64 %31, i64 %32, i64 %34)
store i64 %35, i64* %4
br label %38
36: ; preds = %3
%37 = load i64, i64* %6
store i64 %37, i64* %4
br label %38
38: ; preds = %36, %29
%39 = load i64, i64* %4
ret i64 %39
}

LLVM IR (-O2):
define i64 @_recursiveDecimalSum(i64 %0, i64 %1, i64 %2) {
%4 = icmp sgt i64 %0, 0
br i1 %4, label %5, label %20
5: ; preds = %3, %16
%6 = phi i64 [ %18, %16 ], [ %2, %3 ]
%7 = phi i64 [ %17, %16 ], [ %1, %3 ]
%8 = phi i64 [ %9, %16 ], [ %0, %3 ]
%9 = udiv i64 %8, 10
%10 = mul nsw i64 %9, -10
%11 = add nsw i64 %10, %8
%12 = icmp eq i64 %11, 1
br i1 %12, label %13, label %16
13: ; preds = %5
%14 = tail call i64 @_power(i64 2, i64 %6)
%15 = add nsw i64 %14, %7
br label %16
16: ; preds = %13, %5
%17 = phi i64 [ %15, %13 ], [ %7, %5 ]
%18 = add nsw i64 %6, 1
%19 = icmp ult i64 %8, 10
br i1 %19, label %20, label %5
20: ; preds = %16, %3
%21 = phi i64 [ %1, %3 ], [ %17, %16 ]
ret i64 %21
}