#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 *, char);
int /*<<< orphan*/ scanf(char *, char *);
int strlen(char *);
int main(void) {
  char Binaries[1000000];
  int len;
  int index;
  int firstNum = 0;
  scanf("%s", Binaries);
  len = strlen(Binaries);
  if (len % 3 > 0) {
    for (index = 0; index < len % 3; index++) {
      if (index == 1)
        firstNum *= 2;
      firstNum += Binaries[index] - '0';
    }
    printf("%d", firstNum);
  }
  for (index = len % 3; index < len; index += 3) {
    printf("%d", (Binaries[index] - '0') * 4 + (Binaries[index + 1] - '0') * 2 +
                     (Binaries[index + 2] - '0'));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf4260,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xf425c(%rbp)
lea    -0xf4250(%rbp),%rsi
lea    0xea6(%rip),%rdi
call   1050 <scanf@plt>
lea    -0xf4250(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xf4254(%rbp)
mov    -0xf4254(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jle    121d <main+0xed>
movl   $0x0,-0xf4258(%rbp)
mov    -0xf4258(%rbp),%eax
mov    %eax,-0xf4260(%rbp)
mov    -0xf4254(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    -0xf4260(%rbp),%eax
cmp    %edx,%eax
jge    1208 <main+0xd8>
cmpl   $0x1,-0xf4258(%rbp)
jne    11d6 <main+0xa6>
mov    -0xf425c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xf425c(%rbp)
movslq -0xf4258(%rbp),%rax
movsbl -0xf4250(%rbp,%rax,1),%eax
ff
sub    $0x30,%eax
add    -0xf425c(%rbp),%eax
mov    %eax,-0xf425c(%rbp)
mov    -0xf4258(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xf4258(%rbp)
jmp    1192 <main+0x62>
mov    -0xf425c(%rbp),%eax
lea    0xdee(%rip),%rdi
movsbl %al,%esi
call   1040 <printf@plt>
mov    -0xf4254(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %edx,-0xf4258(%rbp)
mov    -0xf4258(%rbp),%eax
cmp    -0xf4254(%rbp),%eax
jge    12b0 <main+0x180>
movslq -0xf4258(%rbp),%rax
movsbl -0xf4250(%rbp,%rax,1),%eax
ff
sub    $0x30,%eax
shl    $0x2,%eax
mov    -0xf4258(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsbl -0xf4250(%rbp,%rcx,1),%ecx
ff
sub    $0x30,%ecx
shl    $0x1,%ecx
add    %ecx,%eax
mov    -0xf4258(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsbl -0xf4250(%rbp,%rcx,1),%ecx
ff
sub    $0x30,%ecx
add    %ecx,%eax
lea    0xd6f(%rip),%rdi
movsbl %al,%esi
call   1040 <printf@plt>
mov    -0xf4258(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0xf4258(%rbp)
jmp    1231 <main+0x101>
xor    %eax,%eax
add    $0xf4260,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0xf4240,%rsp
lea    0xebe(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %eax,%r14d
movslq %eax,%rbx
imul   $0x55555556,%rbx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
add    %ecx,%eax
lea    (%rax,%rax,2),%eax
mov    %ebx,%ebp
sub    %eax,%ebp
test   %ebp,%ebp
jle    11af <main+0x7f>
movsbl (%rsp),%eax
add    $0xffffffd0,%eax
cmp    $0x1,%ebp
je     11a0 <main+0x70>
movsbl 0x1(%rsp),%ecx
lea    (%rcx,%rax,2),%eax
add    $0xffffffd0,%eax
cmp    $0x2,%ebp
je     11a0 <main+0x70>
movsbl 0x2(%rsp),%ecx
add    %ecx,%eax
add    $0xffffffd0,%eax
movsbl %al,%esi
lea    0xe59(%rip),%rdi
call   1040 <printf@plt>
cmp    %r14d,%ebp
jge    11eb <main+0xbb>
movslq %ebp,%rbp
lea    0xe45(%rip),%r14
xchg   %ax,%ax
movzbl (%rsp,%rbp,1),%eax
movzbl 0x1(%rsp,%rbp,1),%ecx
shl    $0x2,%al
add    %cl,%cl
add    %al,%cl
add    0x2(%rsp,%rbp,1),%cl
add    $0xb0,%cl
movsbl %cl,%esi
mov    %r14,%rdi
call   1040 <printf@plt>
add    $0x3,%rbp
cmp    %rbx,%rbp
jl     11c0 <main+0x90>
xor    %eax,%eax
add    $0xf4240,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1000000 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
%6 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %2, i64 0, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %2, i64 0, i64 0
%9 = call i32 @strlen(i8* %8)
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = srem i32 %10, 3
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %41
13: ; preds = %0
store i32 0, i32* %4
br label %14
14: ; preds = %34, %13
%15 = load i32, i32* %4
%16 = load i32, i32* %3
%17 = srem i32 %16, 3
%18 = icmp slt i32 %15, %17
br i1 %18, label %19, label %37
19: ; preds = %14
%20 = load i32, i32* %4
%21 = icmp eq i32 %20, 1
br i1 %21, label %22, label %25
22: ; preds = %19
%23 = load i32, i32* %5
%24 = mul nsw i32 %23, 2
store i32 %24, i32* %5
br label %25
25: ; preds = %22, %19
%26 = load i32, i32* %4
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %2, i64 0, i64 %27
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = sub nsw i32 %30, 48
%32 = load i32, i32* %5
%33 = add nsw i32 %32, %31
store i32 %33, i32* %5
br label %34
34: ; preds = %25
%35 = load i32, i32* %4
%36 = add nsw i32 %35, 1
store i32 %36, i32* %4
br label %14
37: ; preds = %14
%38 = load i32, i32* %5
%39 = trunc i32 %38 to i8
%40 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 signext %39)
br label %41
41: ; preds = %37, %0
%42 = load i32, i32* %3
%43 = srem i32 %42, 3
store i32 %43, i32* %4
br label %44
44: ; preds = %75, %41
%45 = load i32, i32* %4
%46 = load i32, i32* %3
%47 = icmp slt i32 %45, %46
br i1 %47, label %48, label %78
48: ; preds = %44
%49 = load i32, i32* %4
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %2, i64 0, i64 %50
%52 = load i8, i8* %51
%53 = sext i8 %52 to i32
%54 = sub nsw i32 %53, 48
%55 = mul nsw i32 %54, 4
%56 = load i32, i32* %4
%57 = add nsw i32 %56, 1
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %2, i64 0, i64 %58
%60 = load i8, i8* %59
%61 = sext i8 %60 to i32
%62 = sub nsw i32 %61, 48
%63 = mul nsw i32 %62, 2
%64 = add nsw i32 %55, %63
%65 = load i32, i32* %4
%66 = add nsw i32 %65, 2
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %2, i64 0, i64 %67
%69 = load i8, i8* %68
%70 = sext i8 %69 to i32
%71 = sub nsw i32 %70, 48
%72 = add nsw i32 %64, %71
%73 = trunc i32 %72 to i8
%74 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 signext %73)
br label %75
75: ; preds = %48
%76 = load i32, i32* %4
%77 = add nsw i32 %76, 3
store i32 %77, i32* %4
br label %44
78: ; preds = %44
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [1000000 x i8]
%2 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @strlen(i8* %2)
%5 = srem i32 %4, 3
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %31
7: ; preds = %0
%8 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %1, i64 0, i64 0
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = add nsw i32 %10, -48
%12 = icmp eq i32 %5, 1
br i1 %12, label %27, label %13
13: ; preds = %7
%14 = shl nsw i32 %11, 1
%15 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %1, i64 0, i64 1
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = add nsw i32 %14, -48
%19 = add nsw i32 %18, %17
%20 = icmp eq i32 %5, 2
br i1 %20, label %27, label %21
21: ; preds = %13
%22 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %1, i64 0, i64 2
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = add nsw i32 %19, -48
%26 = add nsw i32 %25, %24
br label %27
27: ; preds = %21, %13, %7
%28 = phi i32 [ %11, %7 ], [ %19, %13 ], [ %26, %21 ]
%29 = trunc i32 %28 to i8
%30 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 signext %29)
br label %31
31: ; preds = %27, %0
%32 = icmp slt i32 %5, %4
br i1 %32, label %33, label %54
33: ; preds = %31
%34 = sext i32 %5 to i64
%35 = sext i32 %4 to i64
br label %36
36: ; preds = %33, %36
%37 = phi i64 [ %34, %33 ], [ %52, %36 ]
%38 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %1, i64 0, i64 %37
%39 = load i8, i8* %38
%40 = shl i8 %39, 2
%41 = add nsw i64 %37, 1
%42 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %1, i64 0, i64 %41
%43 = load i8, i8* %42
%44 = shl i8 %43, 1
%45 = add nsw i64 %37, 2
%46 = getelementptr inbounds [1000000 x i8], [1000000 x i8]* %1, i64 0, i64 %45
%47 = load i8, i8* %46
%48 = add i8 %40, -80
%49 = add i8 %48, %44
%50 = add i8 %49, %47
%51 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 signext %50)
%52 = add i64 %37, 3
%53 = icmp slt i64 %52, %35
br i1 %53, label %36, label %54
54: ; preds = %36, %31
ret i32 0
}