#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 strlen(char *);
void FMfilter(char *destination, char *source) {
  int i = 0;
  int j = 0;
  for (i = 0; i <= strlen(source); i++) {
    switch (source[i]) {
    case '\t':
      destination[j] = '\\';
      j++;
      destination[j] = 't';
      j++;
      break;
    case '>':
      destination[j] = '\\';
      j++;
      destination[j] = '>';
      j++;
      break;
    case '\'':
      destination[j] = '\\';
      j++;
      destination[j] = '\'';
      j++;
      break;
    case '`':
      destination[j] = '\\';
      j++;
      destination[j] = '`';
      j++;
      break;
    case '\\':
      destination[j] = '\\';
      j++;
      destination[j] = '\\';
      j++;
      break;
    default:
      destination[j] = source[i];
      j++;
      break;
    }
  }
  return;
}


x86 assembly (clang, -O0):
<FMfilter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
cmp    %ecx,%eax
jg     12cf <FMfilter+0x1bf>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x20(%rbp)
sub    $0x9,%eax
je     11b2 <FMfilter+0xa2>
jmp    116e <FMfilter+0x5e>
mov    -0x20(%rbp),%eax
sub    $0x27,%eax
je     1210 <FMfilter+0x100>
jmp    117f <FMfilter+0x6f>
mov    -0x20(%rbp),%eax
sub    $0x3e,%eax
je     11e1 <FMfilter+0xd1>
jmp    1190 <FMfilter+0x80>
mov    -0x20(%rbp),%eax
sub    $0x5c,%eax
je     126e <FMfilter+0x15e>
jmp    11a1 <FMfilter+0x91>
mov    -0x20(%rbp),%eax
sub    $0x60,%eax
je     123f <FMfilter+0x12f>
jmp    129d <FMfilter+0x18d>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0x5c,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0x74,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    12bc <FMfilter+0x1ac>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0x5c,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0x3e,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    12bc <FMfilter+0x1ac>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0x5c,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0x27,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    12bc <FMfilter+0x1ac>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0x5c,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0x60,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    12bc <FMfilter+0x1ac>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0x5c,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0x5c,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    12bc <FMfilter+0x1ac>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    12c1 <FMfilter+0x1b1>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1135 <FMfilter+0x25>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FMfilter>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
js     11b6 <FMfilter+0xa6>
xor    %ebx,%ebx
mov    $0xffffffffffffffff,%r12
jmp    116d <FMfilter+0x5d>
mov    $0x5c,%dl
nopl   0x0(%rax,%rax,1)
mov    %ebx,%eax
movb   $0x5c,(%r14,%rax,1)
lea    0x1(%rbx),%edi
mov    $0x2,%eax
mov    %edx,%ecx
movslq %edi,%rdx
mov    %cl,(%r14,%rdx,1)
add    %eax,%ebx
mov    %r15,%rdi
call   1030 <strlen@plt>
cltq
add    $0x1,%r12
cmp    %rax,%r12
jge    11b6 <FMfilter+0xa6>
movzbl 0x1(%r15,%r12,1),%ecx
movsbl %cl,%esi
mov    $0x1,%eax
cmp    $0x3d,%esi
jle    11a0 <FMfilter+0x90>
cmp    $0x60,%esi
je     11b2 <FMfilter+0xa2>
cmp    $0x5c,%esi
je     1139 <FMfilter+0x29>
mov    %ebx,%edi
cmp    $0x3e,%esi
jne    1151 <FMfilter+0x41>
mov    $0x3e,%dl
jmp    1140 <FMfilter+0x30>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x74,%dl
cmp    $0x9,%esi
je     1140 <FMfilter+0x30>
mov    %ebx,%edi
cmp    $0x27,%esi
jne    1151 <FMfilter+0x41>
mov    $0x27,%dl
jmp    1140 <FMfilter+0x30>
mov    $0x60,%dl
jmp    1140 <FMfilter+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @FMfilter(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %5
br label %7
7: ; preds = %97, %2
%8 = load i32, i32* %5
%9 = load i8*, i8** %4
%10 = call i32 @strlen(i8* %9)
%11 = icmp sle i32 %8, %10
br i1 %11, label %12, label %100
12: ; preds = %7
%13 = load i8*, i8** %4
%14 = load i32, i32* %5
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
switch i32 %18, label %84 [
i32 9, label %19
i32 62, label %32
i32 39, label %45
i32 96, label %58
i32 92, label %71
]
19: ; preds = %12
%20 = load i8*, i8** %3
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
store i8 92, i8* %23
%24 = load i32, i32* %6
%25 = add nsw i32 %24, 1
store i32 %25, i32* %6
%26 = load i8*, i8** %3
%27 = load i32, i32* %6
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %26, i64 %28
store i8 116, i8* %29
%30 = load i32, i32* %6
%31 = add nsw i32 %30, 1
store i32 %31, i32* %6
br label %96
32: ; preds = %12
%33 = load i8*, i8** %3
%34 = load i32, i32* %6
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %33, i64 %35
store i8 92, i8* %36
%37 = load i32, i32* %6
%38 = add nsw i32 %37, 1
store i32 %38, i32* %6
%39 = load i8*, i8** %3
%40 = load i32, i32* %6
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8, i8* %39, i64 %41
store i8 62, i8* %42
%43 = load i32, i32* %6
%44 = add nsw i32 %43, 1
store i32 %44, i32* %6
br label %96
45: ; preds = %12
%46 = load i8*, i8** %3
%47 = load i32, i32* %6
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %46, i64 %48
store i8 92, i8* %49
%50 = load i32, i32* %6
%51 = add nsw i32 %50, 1
store i32 %51, i32* %6
%52 = load i8*, i8** %3
%53 = load i32, i32* %6
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i8, i8* %52, i64 %54
store i8 39, i8* %55
%56 = load i32, i32* %6
%57 = add nsw i32 %56, 1
store i32 %57, i32* %6
br label %96
58: ; preds = %12
%59 = load i8*, i8** %3
%60 = load i32, i32* %6
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i8, i8* %59, i64 %61
store i8 92, i8* %62
%63 = load i32, i32* %6
%64 = add nsw i32 %63, 1
store i32 %64, i32* %6
%65 = load i8*, i8** %3
%66 = load i32, i32* %6
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds i8, i8* %65, i64 %67
store i8 96, i8* %68
%69 = load i32, i32* %6
%70 = add nsw i32 %69, 1
store i32 %70, i32* %6
br label %96
71: ; preds = %12
%72 = load i8*, i8** %3
%73 = load i32, i32* %6
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds i8, i8* %72, i64 %74
store i8 92, i8* %75
%76 = load i32, i32* %6
%77 = add nsw i32 %76, 1
store i32 %77, i32* %6
%78 = load i8*, i8** %3
%79 = load i32, i32* %6
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds i8, i8* %78, i64 %80
store i8 92, i8* %81
%82 = load i32, i32* %6
%83 = add nsw i32 %82, 1
store i32 %83, i32* %6
br label %96
84: ; preds = %12
%85 = load i8*, i8** %4
%86 = load i32, i32* %5
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds i8, i8* %85, i64 %87
%89 = load i8, i8* %88
%90 = load i8*, i8** %3
%91 = load i32, i32* %6
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds i8, i8* %90, i64 %92
store i8 %89, i8* %93
%94 = load i32, i32* %6
%95 = add nsw i32 %94, 1
store i32 %95, i32* %6
br label %96
96: ; preds = %84, %71, %58, %45, %32, %19
br label %97
97: ; preds = %96
%98 = load i32, i32* %5
%99 = add nsw i32 %98, 1
store i32 %99, i32* %5
br label %7
100: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @FMfilter(i8* nocapture writeonly %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = icmp slt i32 %3, 0
br i1 %4, label %31, label %5
5: ; preds = %2, %20
%6 = phi i64 [ %27, %20 ], [ 0, %2 ]
%7 = phi i32 [ %26, %20 ], [ 0, %2 ]
%8 = getelementptr inbounds i8, i8* %1, i64 %6
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
switch i32 %10, label %20 [
i32 9, label %15
i32 62, label %11
i32 39, label %12
i32 96, label %13
i32 92, label %14
]
11: ; preds = %5
br label %15
12: ; preds = %5
br label %15
13: ; preds = %5
br label %15
14: ; preds = %5
br label %15
15: ; preds = %5, %14, %13, %12, %11
%16 = phi i8 [ 92, %14 ], [ 96, %13 ], [ 39, %12 ], [ 62, %11 ], [ 116, %5 ]
%17 = zext i32 %7 to i64
%18 = getelementptr inbounds i8, i8* %0, i64 %17
store i8 92, i8* %18
%19 = add nuw nsw i32 %7, 1
br label %20
20: ; preds = %15, %5
%21 = phi i32 [ %7, %5 ], [ %19, %15 ]
%22 = phi i8 [ %9, %5 ], [ %16, %15 ]
%23 = phi i32 [ 1, %5 ], [ 2, %15 ]
%24 = sext i32 %21 to i64
%25 = getelementptr inbounds i8, i8* %0, i64 %24
store i8 %22, i8* %25
%26 = add nuw nsw i32 %7, %23
%27 = add nuw nsw i64 %6, 1
%28 = tail call i32 @strlen(i8* %1)
%29 = sext i32 %28 to i64
%30 = icmp slt i64 %6, %29
br i1 %30, label %5, label %31
31: ; preds = %20, %2
ret void
}