#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*/ decode(char *, char *);
int /*<<< orphan*/ encode(char *, char *);
int /*<<< orphan*/ *gets(char *);
scalar_t__ isdigit(char);
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  char input[1000 + 1], output[1000 + 1];
  while (gets(input) != NULL) {
    if (isdigit(input[0]))
      decode(input, output);
    else
      encode(input, output);
    printf("%s\n", output);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x7e0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x3f0(%rbp),%rdi
call   1060 <gets@plt>
cmp    $0x0,%rax
je     11d1 <main+0x81>
movsbl -0x3f0(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     11a6 <main+0x56>
lea    -0x3f0(%rbp),%rdi
lea    -0x7e0(%rbp),%rsi
call   1070 <decode@plt>
jmp    11b9 <main+0x69>
lea    -0x3f0(%rbp),%rdi
lea    -0x7e0(%rbp),%rsi
call   1040 <encode@plt>
lea    -0x7e0(%rbp),%rsi
lea    0xe39(%rip),%rdi
call   1050 <printf@plt>
jmp    1162 <main+0x12>
xor    %eax,%eax
add    $0x7e0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x7e0,%rsp
mov    %rsp,%rdi
call   1060 <gets@plt>
test   %rax,%rax
je     11b8 <main+0x68>
mov    %rsp,%r14
lea    0x3f0(%rsp),%rbx
lea    0xe85(%rip),%r15
jmp    119d <main+0x4d>
nopl   (%rax)
call   1040 <encode@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
mov    %r14,%rdi
call   1060 <gets@plt>
test   %rax,%rax
je     11b8 <main+0x68>
movsbl (%rsp),%edi
call   1030 <isdigit@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
test   %rax,%rax
je     1180 <main+0x30>
call   1070 <decode@plt>
jmp    1185 <main+0x35>
xor    %eax,%eax
add    $0x7e0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1001 x i8]
%3 = alloca [1001 x i8]
store i32 0, i32* %1
br label %4
4: ; preds = %21, %0
%5 = getelementptr inbounds [1001 x i8], [1001 x i8]* %2, i64 0, i64 0
%6 = call i32* @gets(i8* %5)
%7 = icmp ne i32* %6, null
br i1 %7, label %8, label %24
8: ; preds = %4
%9 = getelementptr inbounds [1001 x i8], [1001 x i8]* %2, i64 0, i64 0
%10 = load i8, i8* %9
%11 = call i64 @isdigit(i8 signext %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %8
%14 = getelementptr inbounds [1001 x i8], [1001 x i8]* %2, i64 0, i64 0
%15 = getelementptr inbounds [1001 x i8], [1001 x i8]* %3, i64 0, i64 0
%16 = call i32 @decode(i8* %14, i8* %15)
br label %21
17: ; preds = %8
%18 = getelementptr inbounds [1001 x i8], [1001 x i8]* %2, i64 0, i64 0
%19 = getelementptr inbounds [1001 x i8], [1001 x i8]* %3, i64 0, i64 0
%20 = call i32 @encode(i8* %18, i8* %19)
br label %21
21: ; preds = %17, %13
%22 = getelementptr inbounds [1001 x i8], [1001 x i8]* %3, i64 0, i64 0
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %22)
br label %4
24: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [1001 x i8]
%2 = alloca [1001 x i8]
%3 = getelementptr inbounds [1001 x i8], [1001 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [1001 x i8], [1001 x i8]* %2, i64 0, i64 0
%5 = call i32* @gets(i8* %3)
%6 = icmp eq i32* %5, null
br i1 %6, label %19, label %7
7: ; preds = %0, %15
%8 = load i8, i8* %3
%9 = call i64 @isdigit(i8 signext %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %7
%12 = call i32 @decode(i8* %3, i8* %4)
br label %15
13: ; preds = %7
%14 = call i32 @encode(i8* %3, i8* %4)
br label %15
15: ; preds = %13, %11
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
%17 = call i32* @gets(i8* %3)
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %7
19: ; preds = %15, %0
ret i32 0
}