#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 */
typedef int /*<<< orphan*/ Src;
typedef int /*<<< orphan*/ FILE;
typedef int /*<<< orphan*/ Dst;
typedef int /*<<< orphan*/ Buf;

/* Variables and functions */
int /*<<< orphan*/ CopyFile(char *, char *, char *);
int FILENAME_MAX;
scalar_t__ ReadLine(int /*<<< orphan*/ *, char *, int);
int UnUnicodeHex(char *);
int /*<<< orphan*/ memset(char *, char, int);
int /*<<< orphan*/ strncpy(char *, char *, int);
void ProcessPairs(FILE *Fin, char *Type) {
  char Buf[10240];
  char Dst[FILENAME_MAX];
  char Src[FILENAME_MAX];
  int Space;
  int i, s, c;
  while (ReadLine(Fin, Buf, sizeof(Buf)) > 0) {
    Space = 0;
    while ((Buf[Space] != '\0') && (Buf[Space] != ' '))
      Space++;
    strncpy(Dst, Buf, Space);
    memset(Dst, '\0', sizeof(Dst));
    memset(Src, '\0', sizeof(Src));
    strncpy(Dst, Buf, Space);
    s = 0;
    for (i = Space + 1; Buf[i] != '\0'; i++) {
      if (Buf[i] != '&')
        Src[s++] = Buf[i];
      else {
        c = UnUnicodeHex(Buf + i);
        if (c >= 0) {
          Src[s++] = c;
          i += 5;
        } else
          Src[s++] = Buf[i];
      }
    }
    CopyFile(Src, Type, Dst);
  }
}


x86 assembly (clang, -O0):
<ProcessPairs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2860,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e7e(%rip),%rax
mov    (%rax),%ecx
mov    %rcx,-0x2858(%rbp)
mov    %rsp,%rdx
mov    %rdx,-0x2818(%rbp)
mov    %rcx,%rsi
add    $0xf,%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x2850(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x2820(%rbp)
mov    (%rax),%eax
mov    %rax,-0x2848(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x2840(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x2828(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x2810(%rbp),%rsi
mov    $0x2800,%edx
call   1050 <ReadLine@plt>
cmp    $0x0,%rax
jle    13f8 <ProcessPairs+0x2a8>
movl   $0x0,-0x282c(%rbp)
movslq -0x282c(%rbp),%rax
movsbl -0x2810(%rbp,%rax,1),%ecx
ff
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x2859(%rbp)
je     122e <ProcessPairs+0xde>
movslq -0x282c(%rbp),%rax
movsbl -0x2810(%rbp,%rax,1),%eax
ff
cmp    $0x20,%eax
setne  %al
mov    %al,-0x2859(%rbp)
mov    -0x2859(%rbp),%al
test   $0x1,%al
jne    1241 <ProcessPairs+0xf1>
jmp    1255 <ProcessPairs+0x105>
mov    -0x282c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x282c(%rbp)
jmp    11f3 <ProcessPairs+0xa3>
mov    -0x2850(%rbp),%rdi
lea    -0x2810(%rbp),%rsi
mov    -0x282c(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x2850(%rbp),%rdi
mov    -0x2858(%rbp),%rax
mov    %eax,%edx
xor    %esi,%esi
call   1040 <memset@plt>
mov    -0x2840(%rbp),%rdi
mov    -0x2848(%rbp),%rax
mov    %eax,%edx
xor    %esi,%esi
call   1040 <memset@plt>
mov    -0x2850(%rbp),%rdi
lea    -0x2810(%rbp),%rsi
mov    -0x282c(%rbp),%edx
call   1030 <strncpy@plt>
movl   $0x0,-0x2834(%rbp)
mov    -0x282c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2830(%rbp)
movslq -0x2830(%rbp),%rax
movsbl -0x2810(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
je     13dc <ProcessPairs+0x28c>
movslq -0x2830(%rbp),%rax
movsbl -0x2810(%rbp,%rax,1),%eax
ff
cmp    $0x26,%eax
je     132f <ProcessPairs+0x1df>
mov    -0x2840(%rbp),%rax
movslq -0x2830(%rbp),%rcx
mov    -0x2810(%rbp,%rcx,1),%dl
mov    -0x2834(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x2834(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
jmp    13c3 <ProcessPairs+0x273>
lea    -0x2810(%rbp),%rdi
movslq -0x2830(%rbp),%rax
add    %rax,%rdi
call   1060 <UnUnicodeHex@plt>
mov    %eax,-0x2838(%rbp)
cmpl   $0x0,-0x2838(%rbp)
jl     1392 <ProcessPairs+0x242>
mov    -0x2840(%rbp),%rax
mov    -0x2838(%rbp),%ecx
mov    %cl,%dl
mov    -0x2834(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x2834(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x2830(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0x2830(%rbp)
jmp    13be <ProcessPairs+0x26e>
mov    -0x2840(%rbp),%rax
movslq -0x2830(%rbp),%rcx
mov    -0x2810(%rbp,%rcx,1),%dl
mov    -0x2834(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x2834(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
jmp    13c3 <ProcessPairs+0x273>
jmp    13c8 <ProcessPairs+0x278>
mov    -0x2830(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2830(%rbp)
jmp    12ce <ProcessPairs+0x17e>
mov    -0x2850(%rbp),%rdx
mov    -0x2840(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1070 <CopyFile@plt>
jmp    11ca <ProcessPairs+0x7a>
mov    -0x2818(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ProcessPairs>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2838,%rsp
mov    %rsi,-0x60(%rbp)
mov    %rsp,-0x30(%rbp)
mov    0x2e75(%rip),%rax
mov    (%rax),%ecx
mov    %rsp,%r12
mov    %rcx,-0x50(%rbp)
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
sub    %rcx,%r12
mov    %r12,%rsp
mov    (%rax),%eax
mov    %rsp,%r14
mov    %rax,-0x48(%rbp)
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
lea    -0x2860(%rbp),%rsi
mov    %rdi,-0x58(%rbp)
mov    $0x2800,%edx
call   1050 <ReadLine@plt>
test   %rax,%rax
jle    12d0 <ProcessPairs+0x180>
xor    %r15d,%r15d
lea    -0x2860(%rbp),%rbx
mov    %r14,-0x40(%rbp)
mov    %r12,-0x38(%rbp)
testb  $0xdf,-0x2860(%rbp,%r15,1)
ff df
je     1238 <ProcessPairs+0xe8>
jmp    1229 <ProcessPairs+0xd9>
xchg   %ax,%ax
mov    -0x40(%rbp),%r14
mov    %r14,%rdi
mov    -0x60(%rbp),%rsi
mov    -0x38(%rbp),%r12
mov    %r12,%rdx
call   1070 <CopyFile@plt>
mov    -0x58(%rbp),%rdi
lea    -0x2860(%rbp),%rbx
mov    %rbx,%rsi
mov    $0x2800,%edx
call   1050 <ReadLine@plt>
mov    $0x0,%r15d
test   %rax,%rax
jle    12d0 <ProcessPairs+0x180>
testb  $0xdf,-0x2860(%rbp,%r15,1)
ff df
je     1238 <ProcessPairs+0xe8>
add    $0x1,%r15
testb  $0xdf,-0x2860(%rbp,%r15,1)
ff df
jne    1229 <ProcessPairs+0xd9>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r15d,%edx
call   1030 <strncpy@plt>
mov    %r12,%rdi
xor    %esi,%esi
mov    -0x50(%rbp),%rdx
call   1040 <memset@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    -0x48(%rbp),%rdx
call   1040 <memset@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %r15d,%edx
call   1030 <strncpy@plt>
jmp    1292 <ProcessPairs+0x142>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
test   %al,%al
je     11e0 <ProcessPairs+0x90>
mov    %al,(%r14)
add    $0x1,%r14
mov    %r12d,%r15d
movslq %r15d,%rcx
lea    0x1(%rcx),%r12
movzbl -0x285f(%rbp,%rcx,1),%eax
ff
cmp    $0x26,%al
jne    1280 <ProcessPairs+0x130>
lea    (%rcx,%rbp,1),%r13
add    $0xffffffffffffd7a1,%r13
mov    %r13,%rdi
call   1060 <UnUnicodeHex@plt>
test   %eax,%eax
js     12c9 <ProcessPairs+0x179>
mov    %al,(%r14)
add    $0x6,%r15d
add    $0x1,%r14
jmp    1292 <ProcessPairs+0x142>
movzbl 0x0(%r13),%eax
jmp    1288 <ProcessPairs+0x138>
mov    -0x30(%rbp),%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@FILENAME_MAX = global i32 0
define void @ProcessPairs(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca [10240 x i8]
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32* %0, i32** %3
store i8* %1, i8** %4
%13 = load i32, i32* @FILENAME_MAX
%14 = zext i32 %13 to i64
%15 = call i8* @llvm.stacksave()
store i8* %15, i8** %6
%16 = alloca i8, i64 %14
store i64 %14, i64* %7
%17 = load i32, i32* @FILENAME_MAX
%18 = zext i32 %17 to i64
%19 = alloca i8, i64 %18
store i64 %18, i64* %8
br label %20
20: ; preds = %112, %2
%21 = load i32*, i32** %3
%22 = getelementptr inbounds [10240 x i8], [10240 x i8]* %5, i64 0, i64 0
%23 = call i64 @ReadLine(i32* %21, i8* %22, i32 10240)
%24 = icmp sgt i64 %23, 0
br i1 %24, label %25, label %115
25: ; preds = %20
store i32 0, i32* %9
br label %26
26: ; preds = %42, %25
%27 = load i32, i32* %9
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [10240 x i8], [10240 x i8]* %5, i64 0, i64 %28
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %40
33: ; preds = %26
%34 = load i32, i32* %9
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [10240 x i8], [10240 x i8]* %5, i64 0, i64 %35
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp ne i32 %38, 32
br label %40
40: ; preds = %33, %26
%41 = phi i1 [ false, %26 ], [ %39, %33 ]
br i1 %41, label %42, label %45
42: ; preds = %40
%43 = load i32, i32* %9
%44 = add nsw i32 %43, 1
store i32 %44, i32* %9
br label %26
45: ; preds = %40
%46 = getelementptr inbounds [10240 x i8], [10240 x i8]* %5, i64 0, i64 0
%47 = load i32, i32* %9
%48 = call i32 @strncpy(i8* %16, i8* %46, i32 %47)
%49 = trunc i64 %14 to i32
%50 = call i32 @memset(i8* %16, i8 signext 0, i32 %49)
%51 = trunc i64 %18 to i32
%52 = call i32 @memset(i8* %19, i8 signext 0, i32 %51)
%53 = getelementptr inbounds [10240 x i8], [10240 x i8]* %5, i64 0, i64 0
%54 = load i32, i32* %9
%55 = call i32 @strncpy(i8* %16, i8* %53, i32 %54)
store i32 0, i32* %11
%56 = load i32, i32* %9
%57 = add nsw i32 %56, 1
store i32 %57, i32* %10
br label %58
58: ; preds = %109, %45
%59 = load i32, i32* %10
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [10240 x i8], [10240 x i8]* %5, i64 0, i64 %60
%62 = load i8, i8* %61
%63 = sext i8 %62 to i32
%64 = icmp ne i32 %63, 0
br i1 %64, label %65, label %112
65: ; preds = %58
%66 = load i32, i32* %10
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [10240 x i8], [10240 x i8]* %5, i64 0, i64 %67
%69 = load i8, i8* %68
%70 = sext i8 %69 to i32
%71 = icmp ne i32 %70, 38
br i1 %71, label %72, label %81
72: ; preds = %65
%73 = load i32, i32* %10
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds [10240 x i8], [10240 x i8]* %5, i64 0, i64 %74
%76 = load i8, i8* %75
%77 = load i32, i32* %11
%78 = add nsw i32 %77, 1
store i32 %78, i32* %11
%79 = sext i32 %77 to i64
%80 = getelementptr inbounds i8, i8* %19, i64 %79
store i8 %76, i8* %80
br label %108
81: ; preds = %65
%82 = getelementptr inbounds [10240 x i8], [10240 x i8]* %5, i64 0, i64 0
%83 = load i32, i32* %10
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds i8, i8* %82, i64 %84
%86 = call i32 @UnUnicodeHex(i8* %85)
store i32 %86, i32* %12
%87 = load i32, i32* %12
%88 = icmp sge i32 %87, 0
br i1 %88, label %89, label %98
89: ; preds = %81
%90 = load i32, i32* %12
%91 = trunc i32 %90 to i8
%92 = load i32, i32* %11
%93 = add nsw i32 %92, 1
store i32 %93, i32* %11
%94 = sext i32 %92 to i64
%95 = getelementptr inbounds i8, i8* %19, i64 %94
store i8 %91, i8* %95
%96 = load i32, i32* %10
%97 = add nsw i32 %96, 5
store i32 %97, i32* %10
br label %107
98: ; preds = %81
%99 = load i32, i32* %10
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds [10240 x i8], [10240 x i8]* %5, i64 0, i64 %100
%102 = load i8, i8* %101
%103 = load i32, i32* %11
%104 = add nsw i32 %103, 1
store i32 %104, i32* %11
%105 = sext i32 %103 to i64
%106 = getelementptr inbounds i8, i8* %19, i64 %105
store i8 %102, i8* %106
br label %107
107: ; preds = %98, %89
br label %108
108: ; preds = %107, %72
br label %109
109: ; preds = %108
%110 = load i32, i32* %10
%111 = add nsw i32 %110, 1
store i32 %111, i32* %10
br label %58
112: ; preds = %58
%113 = load i8*, i8** %4
%114 = call i32 @CopyFile(i8* %19, i8* %113, i8* %16)
br label %20
115: ; preds = %20
%116 = load i8*, i8** %6
ret void
}

LLVM IR (-O2):
@FILENAME_MAX = global i32 0
define void @ProcessPairs(i32* %0, i8* %1) {
%3 = alloca [10240 x i8]
%4 = getelementptr inbounds [10240 x i8], [10240 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* @FILENAME_MAX
%6 = zext i32 %5 to i64
%7 = tail call i8* @llvm.stacksave()
%8 = alloca i8, i64 %6
%9 = load i32, i32* @FILENAME_MAX
%10 = zext i32 %9 to i64
%11 = alloca i8, i64 %10
%12 = call i64 @ReadLine(i32* %0, i8* %4, i32 10240)
%13 = icmp sgt i64 %12, 0
br i1 %13, label %14, label %54
14: ; preds = %2, %20
%15 = phi i64 [ %21, %20 ], [ 0, %2 ]
%16 = getelementptr inbounds [10240 x i8], [10240 x i8]* %3, i64 0, i64 %15
%17 = load i8, i8* %16
switch i8 %17, label %18 [
i8 0, label %22
i8 32, label %22
]
18: ; preds = %14
%19 = add nuw i64 %15, 1
br label %20
20: ; preds = %18, %50
%21 = phi i64 [ %19, %18 ], [ 0, %50 ]
br label %14
22: ; preds = %14, %14
%23 = trunc i64 %15 to i32
%24 = call i32 @strncpy(i8* %8, i8* %4, i32 %23)
%25 = call i32 @memset(i8* %8, i8 signext 0, i32 %5)
%26 = call i32 @memset(i8* %11, i8 signext 0, i32 %9)
%27 = call i32 @strncpy(i8* %8, i8* %4, i32 %23)
br label %28
28: ; preds = %47, %22
%29 = phi i64 [ %49, %47 ], [ 0, %22 ]
%30 = phi i32 [ %48, %47 ], [ %23, %22 ]
%31 = add nsw i32 %30, 1
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [10240 x i8], [10240 x i8]* %3, i64 0, i64 %32
%34 = load i8, i8* %33
switch i8 %34, label %35 [
i8 0, label %50
i8 38, label %37
]
35: ; preds = %28
%36 = getelementptr inbounds i8, i8* %11, i64 %29
store i8 %34, i8* %36
br label %47
37: ; preds = %28
%38 = call i32 @UnUnicodeHex(i8* %33)
%39 = icmp sgt i32 %38, -1
br i1 %39, label %40, label %44
40: ; preds = %37
%41 = trunc i32 %38 to i8
%42 = getelementptr inbounds i8, i8* %11, i64 %29
store i8 %41, i8* %42
%43 = add nsw i32 %30, 6
br label %47
44: ; preds = %37
%45 = load i8, i8* %33
%46 = getelementptr inbounds i8, i8* %11, i64 %29
store i8 %45, i8* %46
br label %47
47: ; preds = %35, %44, %40
%48 = phi i32 [ %31, %35 ], [ %43, %40 ], [ %31, %44 ]
%49 = add nuw i64 %29, 1
br label %28
50: ; preds = %28
%51 = call i32 @CopyFile(i8* %11, i8* %1, i8* %8)
%52 = call i64 @ReadLine(i32* %0, i8* %4, i32 10240)
%53 = icmp sgt i64 %52, 0
br i1 %53, label %20, label %54
54: ; preds = %50, %2
ret void
}