#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 EXIT_SUCCESS;
int encode(int, char *);
int getchar();
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ testEncode();
int main(int argc, char *argv[]) {
  testEncode();
  char permutation[26];
  scanf("%s", permutation);
  int plainCharacter = getchar();
  while (plainCharacter != -1) {
    int encodedCharacter = encode(plainCharacter, permutation);
    printf("%c", encodedCharacter);
    plainCharacter = getchar();
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <testEncode@plt>
lea    -0x30(%rbp),%rsi
lea    0xe88(%rip),%rdi
call   1070 <scanf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xffffffff,-0x34(%rbp)
je     11be <main+0x6e>
mov    -0x34(%rbp),%edi
lea    -0x30(%rbp),%rsi
call   1030 <encode@plt>
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%esi
lea    0xe59(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    %eax,-0x34(%rbp)
jmp    1187 <main+0x37>
mov    0x2e1b(%rip),%rax
mov    (%rax),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
xor    %eax,%eax
call   1050 <testEncode@plt>
lea    0xe9b(%rip),%rdi
mov    %rsp,%rsi
call   1070 <scanf@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    $0xffffffff,%eax
je     11b0 <main+0x60>
mov    %rsp,%r14
lea    0xe80(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %eax,%edi
mov    %r14,%rsi
call   1030 <encode@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    $0xffffffff,%eax
jne    1190 <main+0x40>
mov    0x2e29(%rip),%rax
mov    (%rax),%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"%c\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [26 x i8]
%4 = tail call i32 (...) @testEncode()
%5 = getelementptr inbounds [26 x i8], [26 x i8]* %3, i64 0, i64 0
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = call i32 (...) @getchar()
%8 = icmp eq i32 %7, -1
br i1 %8, label %15, label %9
9: ; preds = %2, %9
%10 = phi i32 [ %13, %9 ], [ %7, %2 ]
%11 = call i32 @encode(i32 %10, i8* %5)
%12 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = call i32 (...) @getchar()
%14 = icmp eq i32 %13, -1
br i1 %14, label %15, label %9
15: ; preds = %9, %2
%16 = load i32, i32* @EXIT_SUCCESS
ret i32 %16
}