#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*/ get_string(char *);
char *mactr(char *arg) {
  char tbl[256], from[10240], to[10240];
  register int i;
  get_string(arg);
  get_string(to);
  get_string(from);
  for (i = 0; i < 256; i++)
    tbl[i] = i;
  for (i = 0; i < 256; i++) {
    if ((from[i] == '\0') || (to[i] == '\0'))
      break;
    tbl[from[i]] = to[i];
  }
  for (i = 0; arg[i] != '\0'; i++)
    arg[i] = tbl[arg[i]];
  return (arg);
}


x86 assembly (clang, -O0):
<mactr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x5120,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <get_string@plt>
lea    -0x5110(%rbp),%rdi
call   1030 <get_string@plt>
lea    -0x2910(%rbp),%rdi
call   1030 <get_string@plt>
movl   $0x0,-0x5114(%rbp)
cmpl   $0x100,-0x5114(%rbp)
jge    1184 <mactr+0x74>
mov    -0x5114(%rbp),%eax
mov    %al,%cl
movslq -0x5114(%rbp),%rax
mov    %cl,-0x110(%rbp,%rax,1)
mov    -0x5114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5114(%rbp)
jmp    114a <mactr+0x3a>
movl   $0x0,-0x5114(%rbp)
cmpl   $0x100,-0x5114(%rbp)
jge    120c <mactr+0xfc>
movslq -0x5114(%rbp),%rax
movsbl -0x2910(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
je     11ce <mactr+0xbe>
movslq -0x5114(%rbp),%rax
movsbl -0x5110(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
jne    11d3 <mactr+0xc3>
jmp    120c <mactr+0xfc>
movslq -0x5114(%rbp),%rax
mov    -0x5110(%rbp,%rax,1),%cl
movslq -0x5114(%rbp),%rax
movsbq -0x2910(%rbp,%rax,1),%rax
ff ff
mov    %cl,-0x110(%rbp,%rax,1)
mov    -0x5114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5114(%rbp)
jmp    118e <mactr+0x7e>
movl   $0x0,-0x5114(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x5114(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1267 <mactr+0x157>
mov    -0x8(%rbp),%rax
movslq -0x5114(%rbp),%rcx
movsbq (%rax,%rcx,1),%rax
mov    -0x110(%rbp,%rax,1),%dl
mov    -0x8(%rbp),%rax
movslq -0x5114(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x5114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5114(%rbp)
jmp    1216 <mactr+0x106>
mov    -0x8(%rbp),%rax
add    $0x5120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mactr>:
push   %rbx
sub    $0x5100,%rsp
mov    %rdi,%rbx
call   1030 <get_string@plt>
lea    0x100(%rsp),%rdi
call   1030 <get_string@plt>
lea    0x2900(%rsp),%rdi
call   1030 <get_string@plt>
movaps 0xebf(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xec4(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xecc(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xed0(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xed4(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xed8(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xedc(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xee0(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0xee1(%rip),%xmm0
movaps %xmm0,0x90(%rsp)
movaps 0xee2(%rip),%xmm0
movaps %xmm0,0xa0(%rsp)
movaps 0xee3(%rip),%xmm0
movaps %xmm0,0xb0(%rsp)
movaps 0xee4(%rip),%xmm0
movaps %xmm0,0xc0(%rsp)
movaps 0xee5(%rip),%xmm0
movaps %xmm0,0xd0(%rsp)
movaps 0xee6(%rip),%xmm0
movaps %xmm0,0xe0(%rsp)
movaps 0xee7(%rip),%xmm0
movaps %xmm0,0xf0(%rsp)
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbq 0x2900(%rsp,%rax,1),%rcx
test   %rcx,%rcx
je     1266 <mactr+0x156>
movzbl 0x100(%rsp,%rax,1),%edx
test   %dl,%dl
je     1266 <mactr+0x156>
mov    %dl,(%rsp,%rcx,1)
movsbq 0x2901(%rsp,%rax,1),%rcx
test   %rcx,%rcx
je     1266 <mactr+0x156>
movzbl 0x101(%rsp,%rax,1),%edx
test   %dl,%dl
je     1266 <mactr+0x156>
mov    %dl,(%rsp,%rcx,1)
add    $0x2,%rax
cmp    $0x100,%rax
jne    1220 <mactr+0x110>
mov    (%rbx),%al
test   %al,%al
je     1286 <mactr+0x176>
lea    0x1(%rbx),%rcx
movsbq %al,%rax
movzbl (%rsp,%rax,1),%eax
mov    %al,-0x1(%rcx)
movzbl (%rcx),%eax
add    $0x1,%rcx
test   %al,%al
jne    1270 <mactr+0x160>
mov    %rbx,%rax
add    $0x5100,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @mactr(i8* returned %0) {
%2 = alloca [256 x i8]
%3 = alloca [10240 x i8]
%4 = alloca [10240 x i8]
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [10240 x i8], [10240 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [10240 x i8], [10240 x i8]* %4, i64 0, i64 0
%8 = tail call i32 @get_string(i8* %0)
%9 = call i32 @get_string(i8* %7)
%10 = call i32 @get_string(i8* %6)
%11 = bitcast [256 x i8]* %2 to <16 x i8>*
store <16 x i8> <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7, i8 8, i8 9, i8 10, i8 11, i8 12, i8 13, i8 14, i8 15>, <16 x i8>* %11
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 16
%13 = bitcast i8* %12 to <16 x i8>*
store <16 x i8> <i8 16, i8 17, i8 18, i8 19, i8 20, i8 21, i8 22, i8 23, i8 24, i8 25, i8 26, i8 27, i8 28, i8 29, i8 30, i8 31>, <16 x i8>* %13
%14 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 32
%15 = bitcast i8* %14 to <16 x i8>*
store <16 x i8> <i8 32, i8 33, i8 34, i8 35, i8 36, i8 37, i8 38, i8 39, i8 40, i8 41, i8 42, i8 43, i8 44, i8 45, i8 46, i8 47>, <16 x i8>* %15
%16 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 48
%17 = bitcast i8* %16 to <16 x i8>*
store <16 x i8> <i8 48, i8 49, i8 50, i8 51, i8 52, i8 53, i8 54, i8 55, i8 56, i8 57, i8 58, i8 59, i8 60, i8 61, i8 62, i8 63>, <16 x i8>* %17
%18 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 64
%19 = bitcast i8* %18 to <16 x i8>*
store <16 x i8> <i8 64, i8 65, i8 66, i8 67, i8 68, i8 69, i8 70, i8 71, i8 72, i8 73, i8 74, i8 75, i8 76, i8 77, i8 78, i8 79>, <16 x i8>* %19
%20 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 80
%21 = bitcast i8* %20 to <16 x i8>*
store <16 x i8> <i8 80, i8 81, i8 82, i8 83, i8 84, i8 85, i8 86, i8 87, i8 88, i8 89, i8 90, i8 91, i8 92, i8 93, i8 94, i8 95>, <16 x i8>* %21
%22 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 96
%23 = bitcast i8* %22 to <16 x i8>*
store <16 x i8> <i8 96, i8 97, i8 98, i8 99, i8 100, i8 101, i8 102, i8 103, i8 104, i8 105, i8 106, i8 107, i8 108, i8 109, i8 110, i8 111>, <16 x i8>* %23
%24 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 112
%25 = bitcast i8* %24 to <16 x i8>*
store <16 x i8> <i8 112, i8 113, i8 114, i8 115, i8 116, i8 117, i8 118, i8 119, i8 120, i8 121, i8 122, i8 123, i8 124, i8 125, i8 126, i8 127>, <16 x i8>* %25
%26 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 128
%27 = bitcast i8* %26 to <16 x i8>*
store <16 x i8> <i8 -128, i8 -127, i8 -126, i8 -125, i8 -124, i8 -123, i8 -122, i8 -121, i8 -120, i8 -119, i8 -118, i8 -117, i8 -116, i8 -115, i8 -114, i8 -113>, <16 x i8>* %27
%28 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 144
%29 = bitcast i8* %28 to <16 x i8>*
store <16 x i8> <i8 -112, i8 -111, i8 -110, i8 -109, i8 -108, i8 -107, i8 -106, i8 -105, i8 -104, i8 -103, i8 -102, i8 -101, i8 -100, i8 -99, i8 -98, i8 -97>, <16 x i8>* %29
%30 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 160
%31 = bitcast i8* %30 to <16 x i8>*
store <16 x i8> <i8 -96, i8 -95, i8 -94, i8 -93, i8 -92, i8 -91, i8 -90, i8 -89, i8 -88, i8 -87, i8 -86, i8 -85, i8 -84, i8 -83, i8 -82, i8 -81>, <16 x i8>* %31
%32 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 176
%33 = bitcast i8* %32 to <16 x i8>*
store <16 x i8> <i8 -80, i8 -79, i8 -78, i8 -77, i8 -76, i8 -75, i8 -74, i8 -73, i8 -72, i8 -71, i8 -70, i8 -69, i8 -68, i8 -67, i8 -66, i8 -65>, <16 x i8>* %33
%34 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 192
%35 = bitcast i8* %34 to <16 x i8>*
store <16 x i8> <i8 -64, i8 -63, i8 -62, i8 -61, i8 -60, i8 -59, i8 -58, i8 -57, i8 -56, i8 -55, i8 -54, i8 -53, i8 -52, i8 -51, i8 -50, i8 -49>, <16 x i8>* %35
%36 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 208
%37 = bitcast i8* %36 to <16 x i8>*
store <16 x i8> <i8 -48, i8 -47, i8 -46, i8 -45, i8 -44, i8 -43, i8 -42, i8 -41, i8 -40, i8 -39, i8 -38, i8 -37, i8 -36, i8 -35, i8 -34, i8 -33>, <16 x i8>* %37
%38 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 224
%39 = bitcast i8* %38 to <16 x i8>*
store <16 x i8> <i8 -32, i8 -31, i8 -30, i8 -29, i8 -28, i8 -27, i8 -26, i8 -25, i8 -24, i8 -23, i8 -22, i8 -21, i8 -20, i8 -19, i8 -18, i8 -17>, <16 x i8>* %39
%40 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 240
%41 = bitcast i8* %40 to <16 x i8>*
store <16 x i8> <i8 -16, i8 -15, i8 -14, i8 -13, i8 -12, i8 -11, i8 -10, i8 -9, i8 -8, i8 -7, i8 -6, i8 -5, i8 -4, i8 -3, i8 -2, i8 -1>, <16 x i8>* %41
br label %42
42: ; preds = %62, %1
%43 = phi i64 [ 0, %1 ], [ %65, %62 ]
%44 = getelementptr inbounds [10240 x i8], [10240 x i8]* %3, i64 0, i64 %43
%45 = load i8, i8* %44
%46 = icmp eq i8 %45, 0
br i1 %46, label %67, label %47
47: ; preds = %42
%48 = getelementptr inbounds [10240 x i8], [10240 x i8]* %4, i64 0, i64 %43
%49 = load i8, i8* %48
%50 = icmp eq i8 %49, 0
br i1 %50, label %67, label %51
51: ; preds = %47
%52 = sext i8 %45 to i64
%53 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 %52
store i8 %49, i8* %53
%54 = or i64 %43, 1
%55 = getelementptr inbounds [10240 x i8], [10240 x i8]* %3, i64 0, i64 %54
%56 = load i8, i8* %55
%57 = icmp eq i8 %56, 0
br i1 %57, label %67, label %58
58: ; preds = %51
%59 = getelementptr inbounds [10240 x i8], [10240 x i8]* %4, i64 0, i64 %54
%60 = load i8, i8* %59
%61 = icmp eq i8 %60, 0
br i1 %61, label %67, label %62
62: ; preds = %58
%63 = sext i8 %56 to i64
%64 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 %63
store i8 %60, i8* %64
%65 = add nuw nsw i64 %43, 2
%66 = icmp eq i64 %65, 256
br i1 %66, label %67, label %42
67: ; preds = %62, %58, %51, %42, %47
%68 = load i8, i8* %0
%69 = icmp eq i8 %68, 0
br i1 %69, label %81, label %70
70: ; preds = %67, %70
%71 = phi i64 [ %77, %70 ], [ 0, %67 ]
%72 = phi i8 [ %79, %70 ], [ %68, %67 ]
%73 = phi i8* [ %78, %70 ], [ %0, %67 ]
%74 = sext i8 %72 to i64
%75 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 %74
%76 = load i8, i8* %75
store i8 %76, i8* %73
%77 = add nuw nsw i64 %71, 1
%78 = getelementptr inbounds i8, i8* %0, i64 %77
%79 = load i8, i8* %78
%80 = icmp eq i8 %79, 0
br i1 %80, label %81, label %70
81: ; preds = %70, %67
ret i8* %0
}