#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*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
char *gets(char *);
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  char mapsto[256];
  char mapping[128];
  char line[128];
  char *s, *mapp;
  int nextmapch;
  int i;
  for (;;) {
    for (i = 0; i < 256; i++)
      mapsto[i] = 0;
    nextmapch = 'A';
    mapp = mapping;
    s = gets(line);
    if (s == NULL)
      break;
    for (;;) {
      if (mapsto[*s] != 0) {
        *mapp++ = mapsto[*s];
      } else {
        *mapp++ = nextmapch;
        mapsto[*s] = nextmapch++;
      }
      s += 1;
      if (*s == '\0')
        break;
    }
    *mapp = '\0';
    fprintf(stdout, "%s=%s\n", mapping, line);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x230,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x228(%rbp)
cmpl   $0x100,-0x228(%rbp)
jge    1176 <main+0x56>
movslq -0x228(%rbp),%rax
movb   $0x0,-0x110(%rbp,%rax,1)
mov    -0x228(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x228(%rbp)
jmp    1143 <main+0x23>
movl   $0x41,-0x224(%rbp)
lea    -0x190(%rbp),%rax
mov    %rax,-0x220(%rbp)
lea    -0x210(%rbp),%rdi
call   1040 <gets@plt>
mov    %rax,-0x218(%rbp)
cmpq   $0x0,-0x218(%rbp)
jne    11b4 <main+0x94>
jmp    12a8 <main+0x188>
jmp    11b9 <main+0x99>
mov    -0x218(%rbp),%rax
movsbq (%rax),%rax
movsbl -0x110(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
je     1203 <main+0xe3>
mov    -0x218(%rbp),%rax
movsbq (%rax),%rax
mov    -0x110(%rbp,%rax,1),%cl
mov    -0x220(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x220(%rbp)
mov    %cl,(%rax)
jmp    1247 <main+0x127>
mov    -0x224(%rbp),%eax
mov    %al,%cl
mov    -0x220(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x220(%rbp)
mov    %cl,(%rax)
mov    -0x224(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x224(%rbp)
mov    %al,%cl
mov    -0x218(%rbp),%rax
movsbq (%rax),%rax
mov    %cl,-0x110(%rbp,%rax,1)
mov    -0x218(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x218(%rbp)
mov    -0x218(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1271 <main+0x151>
jmp    1276 <main+0x156>
jmp    11b9 <main+0x99>
mov    -0x220(%rbp),%rax
movb   $0x0,(%rax)
mov    0x2d59(%rip),%rax
mov    (%rax),%edi
lea    -0x190(%rbp),%rdx
lea    -0x210(%rbp),%rcx
lea    0xd62(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1139 <main+0x19>
mov    -0x4(%rbp),%eax
add    $0x230,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x200,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xf0(%rsp)
lea    0x180(%rsp),%rdi
call   1040 <gets@plt>
test   %rax,%rax
je     12b8 <main+0x198>
mov    0x2e29(%rip),%r12
lea    0xe42(%rip),%r14
lea    0x100(%rsp),%r15
lea    0x180(%rsp),%r13
jmp    1271 <main+0x151>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movb   $0x0,0x100(%rsp,%rdx,1)
mov    (%r12),%edi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %r13,%rcx
call   1030 <fprintf@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xf0(%rsp)
mov    %r13,%rdi
call   1040 <gets@plt>
test   %rax,%rax
je     12b8 <main+0x198>
mov    (%rax),%bl
mov    $0x41,%ecx
xor    %edx,%edx
jmp    12a3 <main+0x183>
nopl   0x0(%rax)
mov    %cl,0x100(%rsp,%rdx,1)
movsbq (%rax,%rdx,1),%rsi
mov    %cl,(%rsp,%rsi,1)
add    $0x1,%ecx
movzbl 0x1(%rax,%rdx,1),%ebx
add    $0x1,%rdx
test   %bl,%bl
je     11e0 <main+0xc0>
movsbq %bl,%rsi
movzbl (%rsp,%rsi,1),%ebx
test   %bl,%bl
je     1280 <main+0x160>
mov    %bl,0x100(%rsp,%rdx,1)
jmp    1292 <main+0x172>
xor    %eax,%eax
add    $0x200,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@stdout = global i32 0
@.str = [7 x i8] c"%s=%s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = alloca [128 x i8]
%6 = alloca [128 x i8]
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%9 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%10 = call i8* @gets(i8* %9)
%11 = icmp eq i8* %10, null
br i1 %11, label %42, label %12
12: ; preds = %2, %37
%13 = phi i8* [ %40, %37 ], [ %10, %2 ]
%14 = load i8, i8* %13
br label %15
15: ; preds = %12, %31
%16 = phi i8 [ %35, %31 ], [ %14, %12 ]
%17 = phi i8* [ %34, %31 ], [ %13, %12 ]
%18 = phi i8* [ %33, %31 ], [ %8, %12 ]
%19 = phi i32 [ %32, %31 ], [ 65, %12 ]
%20 = sext i8 %16 to i64
%21 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %20
%22 = load i8, i8* %21
%23 = icmp eq i8 %22, 0
br i1 %23, label %25, label %24
24: ; preds = %15
store i8 %22, i8* %18
br label %31
25: ; preds = %15
%26 = trunc i32 %19 to i8
store i8 %26, i8* %18
%27 = add nsw i32 %19, 1
%28 = load i8, i8* %17
%29 = sext i8 %28 to i64
%30 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %29
store i8 %26, i8* %30
br label %31
31: ; preds = %25, %24
%32 = phi i32 [ %19, %24 ], [ %27, %25 ]
%33 = getelementptr inbounds i8, i8* %18, i64 1
%34 = getelementptr inbounds i8, i8* %17, i64 1
%35 = load i8, i8* %34
%36 = icmp eq i8 %35, 0
br i1 %36, label %37, label %15
37: ; preds = %31
store i8 0, i8* %33
%38 = load i32, i32* @stdout
%39 = call i32 @fprintf(i32 %38, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %9)
%40 = call i8* @gets(i8* %9)
%41 = icmp eq i8* %40, null
br i1 %41, label %42, label %12
42: ; preds = %37, %2
ret i32 0
}