#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 get_oct(char, char, char);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
size_t start(size_t);
size_t strlen(char *);
int main() {
  char buffer[102];
  scanf("%s", buffer + 2);
  buffer[0] = buffer[1] = '0';
  size_t len = strlen(buffer + 2);
  size_t start_index = start(len % 3);
  len += 2;
  while (start_index < len) {
    printf("%c", get_oct(buffer[start_index], buffer[start_index + 1],
                         buffer[start_index + 2]));
    start_index += 3;
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rsi
add    $0x2,%rsi
lea    0xe8f(%rip),%rdi
call   1060 <scanf@plt>
movb   $0x30,-0x6f(%rbp)
movb   $0x30,-0x70(%rbp)
lea    -0x70(%rbp),%rdi
add    $0x2,%rdi
call   1030 <strlen@plt>
mov    %rax,-0x78(%rbp)
mov    -0x78(%rbp),%rax
mov    $0x3,%ecx
xor    %edx,%edx
div    %rcx
mov    %rdx,%rdi
call   1050 <start@plt>
mov    %rax,-0x80(%rbp)
mov    -0x78(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x78(%rbp)
mov    -0x80(%rbp),%rax
cmp    -0x78(%rbp),%rax
jae    1208 <main+0xb8>
mov    -0x80(%rbp),%rax
mov    -0x70(%rbp,%rax,1),%dl
mov    -0x80(%rbp),%rax
mov    -0x6f(%rbp,%rax,1),%cl
mov    -0x80(%rbp),%rax
movsbl %dl,%edi
movsbl %cl,%esi
movsbl -0x6e(%rbp,%rax,1),%edx
call   1070 <get_oct@plt>
mov    %eax,%esi
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x80(%rbp),%rax
add    $0x3,%rax
mov    %rax,-0x80(%rbp)
jmp    11b5 <main+0x65>
lea    0xdf7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x68,%rsp
lea    0x2(%rsp),%rbx
lea    0xe9d(%rip),%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
movw   $0x3030,(%rsp)
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rax,%r14
movabs $0xaaaaaaaaaaaaaaab,%rcx
aa aa aa
mul    %rcx
shr    %rdx
lea    (%rdx,%rdx,2),%rax
mov    %r14,%rdi
sub    %rax,%rdi
call   1050 <start@plt>
add    $0x2,%r14
cmp    %r14,%rax
jae    11d3 <main+0x83>
mov    %rax,%rbx
nopw   0x0(%rax,%rax,1)
movsbl (%rsp,%rbx,1),%edi
movsbl 0x1(%rsp,%rbx,1),%esi
movsbl 0x2(%rsp,%rbx,1),%edx
call   1070 <get_oct@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
add    $0x3,%rbx
cmp    %r14,%rbx
jb     11b0 <main+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [102 x i8]
%3 = alloca i64
%4 = alloca i64
store i32 0, i32* %1
%5 = getelementptr inbounds [102 x i8], [102 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds i8, i8* %5, i64 2
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [102 x i8], [102 x i8]* %2, i64 0, i64 1
store i8 48, i8* %8
%9 = getelementptr inbounds [102 x i8], [102 x i8]* %2, i64 0, i64 0
store i8 48, i8* %9
%10 = getelementptr inbounds [102 x i8], [102 x i8]* %2, i64 0, i64 0
%11 = getelementptr inbounds i8, i8* %10, i64 2
%12 = call i64 @strlen(i8* %11)
store i64 %12, i64* %3
%13 = load i64, i64* %3
%14 = urem i64 %13, 3
%15 = call i64 @start(i64 %14)
store i64 %15, i64* %4
%16 = load i64, i64* %3
%17 = add i64 %16, 2
store i64 %17, i64* %3
br label %18
18: ; preds = %22, %0
%19 = load i64, i64* %4
%20 = load i64, i64* %3
%21 = icmp ult i64 %19, %20
br i1 %21, label %22, label %38
22: ; preds = %18
%23 = load i64, i64* %4
%24 = getelementptr inbounds [102 x i8], [102 x i8]* %2, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = load i64, i64* %4
%27 = add i64 %26, 1
%28 = getelementptr inbounds [102 x i8], [102 x i8]* %2, i64 0, i64 %27
%29 = load i8, i8* %28
%30 = load i64, i64* %4
%31 = add i64 %30, 2
%32 = getelementptr inbounds [102 x i8], [102 x i8]* %2, i64 0, i64 %31
%33 = load i8, i8* %32
%34 = call i32 @get_oct(i8 signext %25, i8 signext %29, i8 signext %33)
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %34)
%36 = load i64, i64* %4
%37 = add i64 %36, 3
store i64 %37, i64* %4
br label %18
38: ; preds = %18
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [102 x i8]
%2 = getelementptr inbounds [102 x i8], [102 x i8]* %1, i64 0, i64 0
%3 = getelementptr inbounds [102 x i8], [102 x i8]* %1, i64 0, i64 2
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = getelementptr inbounds [102 x i8], [102 x i8]* %1, i64 0, i64 1
store i8 48, i8* %5
store i8 48, i8* %2
%6 = call i64 @strlen(i8* %3)
%7 = urem i64 %6, 3
%8 = call i64 @start(i64 %7)
%9 = add i64 %6, 2
%10 = icmp ult i64 %8, %9
br i1 %10, label %11, label %25
11: ; preds = %0, %11
%12 = phi i64 [ %23, %11 ], [ %8, %0 ]
%13 = getelementptr inbounds [102 x i8], [102 x i8]* %1, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = add nuw i64 %12, 1
%16 = getelementptr inbounds [102 x i8], [102 x i8]* %1, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = add i64 %12, 2
%19 = getelementptr inbounds [102 x i8], [102 x i8]* %1, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = call i32 @get_oct(i8 signext %14, i8 signext %17, i8 signext %20)
%22 = call i32 @putchar(i32 %21)
%23 = add i64 %12, 3
%24 = icmp ult i64 %23, %9
br i1 %24, label %11, label %25
25: ; preds = %11, %0
%26 = call i32 @putchar(i32 10)
ret i32 0
}