#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void asc2c(FILE *file_in, FILE *file_out, int cmpr) {
  char buf[100];
  char prev;
  int bpos;
  while (fgets(buf, 100, file_in) != NULL) {
    bpos = 0;
    while (buf[bpos]) {
      switch (buf[bpos]) {
      case 13:
      case ' ':
      case 10:
      case '\t':
        if (cmpr) {
          if (prev != ' ' && prev != '>')
            fprintf(file_out, " ");
          prev = ' ';
        } else {
          switch (buf[bpos]) {
          case ' ':
            fprintf(file_out, " ");
            break;
          case '\t':
            fprintf(file_out, "	");
            break;
          case 10:
            fprintf(file_out, "\\n\\\n");
            break;
          }
        }
        break;
      case '\\':
        fprintf(file_out, "\\\\");
        prev = buf[bpos];
        break;
      case '\"':
        fprintf(file_out, "\\\"");
        prev = buf[bpos];
        break;
      default:
        fprintf(file_out, "%c", buf[bpos]);
        prev = buf[bpos];
        break;
      }
      bpos++;
    }
  }
}


x86 assembly (clang, -O0):
<asc2c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x64,%esi
call   1030 <fgets@plt>
cmp    $0x0,%rax
je     1353 <asc2c+0x233>
movl   $0x0,-0x88(%rbp)
movslq -0x88(%rbp),%rax
cmpb   $0x0,-0x80(%rbp,%rax,1)
je     134e <asc2c+0x22e>
movslq -0x88(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%eax
mov    %eax,-0x8c(%rbp)
add    $0xfffffff7,%eax
sub    $0x2,%eax
jb     11e1 <asc2c+0xc1>
jmp    1191 <asc2c+0x71>
mov    -0x8c(%rbp),%eax
sub    $0xd,%eax
je     11e1 <asc2c+0xc1>
jmp    11a5 <asc2c+0x85>
mov    -0x8c(%rbp),%eax
sub    $0x20,%eax
je     11e1 <asc2c+0xc1>
jmp    11b9 <asc2c+0x99>
mov    -0x8c(%rbp),%eax
sub    $0x22,%eax
je     12e3 <asc2c+0x1c3>
jmp    11cd <asc2c+0xad>
mov    -0x8c(%rbp),%eax
sub    $0x5c,%eax
je     12bb <asc2c+0x19b>
jmp    130b <asc2c+0x1eb>
cmpl   $0x0,-0x14(%rbp)
je     1229 <asc2c+0x109>
movsbl -0x81(%rbp),%eax
cmp    $0x20,%eax
je     121d <asc2c+0xfd>
movsbl -0x81(%rbp),%eax
cmp    $0x3e,%eax
je     121d <asc2c+0xfd>
mov    -0x10(%rbp),%rdi
lea    0xdea(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movb   $0x20,-0x81(%rbp)
jmp    12b6 <asc2c+0x196>
movslq -0x88(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%eax
mov    %eax,-0x90(%rbp)
sub    $0x9,%eax
je     1288 <asc2c+0x168>
jmp    1249 <asc2c+0x129>
mov    -0x90(%rbp),%eax
sub    $0xa,%eax
je     129f <asc2c+0x17f>
jmp    125d <asc2c+0x13d>
mov    -0x90(%rbp),%eax
sub    $0x20,%eax
jne    12b1 <asc2c+0x191>
jmp    1271 <asc2c+0x151>
mov    -0x10(%rbp),%rdi
lea    0xd84(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    12b1 <asc2c+0x191>
mov    -0x10(%rbp),%rdi
lea    0xd6f(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    12b1 <asc2c+0x191>
mov    -0x10(%rbp),%rdi
lea    0xd5a(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    12b6 <asc2c+0x196>
jmp    133a <asc2c+0x21a>
mov    -0x10(%rbp),%rdi
lea    0xd43(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movslq -0x88(%rbp),%rax
mov    -0x80(%rbp,%rax,1),%al
mov    %al,-0x81(%rbp)
jmp    133a <asc2c+0x21a>
mov    -0x10(%rbp),%rdi
lea    0xd1e(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movslq -0x88(%rbp),%rax
mov    -0x80(%rbp,%rax,1),%al
mov    %al,-0x81(%rbp)
jmp    133a <asc2c+0x21a>
mov    -0x10(%rbp),%rdi
movslq -0x88(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%edx
lea    0xced(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movslq -0x88(%rbp),%rax
mov    -0x80(%rbp,%rax,1),%al
mov    %al,-0x81(%rbp)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
jmp    115c <asc2c+0x3c>
jmp    1136 <asc2c+0x16>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<asc2c>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %edx,%ebp
mov    %rsi,%rbx
mov    %rdi,%rdx
lea    0x10(%rsp),%rdi
mov    $0x64,%esi
mov    %rdx,0x8(%rsp)
call   1040 <fgets@plt>
test   %rax,%rax
je     128c <asc2c+0x15c>
movabs $0x100002600,%r15
jmp    1193 <asc2c+0x63>
nop
mov    %r12d,%r13d
lea    0x10(%rsp),%rdi
mov    $0x64,%esi
mov    0x8(%rsp),%rdx
call   1040 <fgets@plt>
mov    %r13d,%r12d
test   %rax,%rax
je     128c <asc2c+0x15c>
mov    0x10(%rsp),%al
test   %al,%al
je     1170 <asc2c+0x40>
lea    0x10(%rsp),%r14
jmp    11be <asc2c+0x8e>
mov    %rbx,%rsi
call   1030 <fputc@plt>
movzbl (%r14),%r13d
movzbl 0x1(%r14),%eax
add    $0x1,%r14
mov    %r13d,%r12d
test   %al,%al
je     1173 <asc2c+0x43>
movsbl %al,%edi
cmp    $0x22,%edi
ja     1210 <asc2c+0xe0>
bt     %rdi,%r15
jae    11f0 <asc2c+0xc0>
test   %ebp,%ebp
je     1240 <asc2c+0x110>
mov    $0x20,%r13b
cmp    $0x20,%r12b
je     11ae <asc2c+0x7e>
cmp    $0x3e,%r12b
je     11ae <asc2c+0x7e>
mov    $0x20,%edi
mov    %rbx,%rsi
call   1030 <fputc@plt>
jmp    11ae <asc2c+0x7e>
xchg   %ax,%ax
cmp    $0x22,%rdi
jne    1210 <asc2c+0xe0>
mov    $0x2,%esi
mov    $0x1,%edx
lea    0xe01(%rip),%rdi
jmp    1226 <asc2c+0xf6>
nopl   0x0(%rax)
cmp    $0x5c,%edi
jne    11a2 <asc2c+0x72>
mov    $0x2,%esi
mov    $0x1,%edx
lea    0xddf(%rip),%rdi
mov    %rbx,%rcx
call   1050 <fwrite@plt>
jmp    11aa <asc2c+0x7a>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    $0x9,%edi
je     1256 <asc2c+0x126>
cmp    $0xa,%edi
je     126b <asc2c+0x13b>
cmp    $0x20,%edi
jne    1284 <asc2c+0x154>
mov    $0x20,%edi
jmp    125b <asc2c+0x12b>
mov    $0x9,%edi
mov    %rbx,%rsi
call   1030 <fputc@plt>
mov    %r12d,%r13d
jmp    11ae <asc2c+0x7e>
mov    $0x4,%esi
mov    $0x1,%edx
lea    0xd84(%rip),%rdi
mov    %rbx,%rcx
call   1050 <fwrite@plt>
mov    %r12d,%r13d
jmp    11ae <asc2c+0x7e>
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str.2 = [5 x i8] c"\\n\\\0A\00"
@.str.3 = [3 x i8] c"\\\\\00"
@.str.4 = [3 x i8] c"\\\22\00"
define void @asc2c(i32* nocapture %0, i32* nocapture %1, i32 %2) {
%4 = alloca [100 x i8]
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%6 = call i32* @fgets(i8* %5, i32 100, i32* %0)
%7 = icmp eq i32* %6, null
br i1 %7, label %50, label %8
8: ; preds = %3
%9 = icmp eq i32 %2, 0
br label %14
10: ; preds = %44, %14
%11 = phi i8 [ %15, %14 ], [ %45, %44 ]
%12 = call i32* @fgets(i8* %5, i32 100, i32* %0)
%13 = icmp eq i32* %12, null
br i1 %13, label %50, label %14
14: ; preds = %8, %10
%15 = phi i8 [ undef, %8 ], [ %11, %10 ]
%16 = load i8, i8* %5
%17 = icmp eq i8 %16, 0
br i1 %17, label %10, label %18
18: ; preds = %14, %44
%19 = phi i64 [ %46, %44 ], [ 0, %14 ]
%20 = phi i8 [ %48, %44 ], [ %16, %14 ]
%21 = phi i8* [ %47, %44 ], [ %5, %14 ]
%22 = phi i8 [ %45, %44 ], [ %15, %14 ]
%23 = sext i8 %20 to i32
switch i32 %23, label %41 [
i32 13, label %24
i32 32, label %24
i32 10, label %24
i32 9, label %24
i32 92, label %35
i32 34, label %38
]
24: ; preds = %18, %18, %18, %18
br i1 %9, label %28, label %25
25: ; preds = %24
switch i8 %22, label %26 [
i8 62, label %44
i8 32, label %44
]
26: ; preds = %25
%27 = call i32 @fputc(i32 32, i32* %1)
br label %44
28: ; preds = %24
switch i32 %23, label %44 [
i32 32, label %29
i32 9, label %31
i32 10, label %33
]
29: ; preds = %28
%30 = call i32 @fputc(i32 32, i32* %1)
br label %44
31: ; preds = %28
%32 = call i32 @fputc(i32 9, i32* %1)
br label %44
33: ; preds = %28
%34 = call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i64 4, i64 1, i32* %1)
br label %44
35: ; preds = %18
%36 = call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i64 2, i64 1, i32* %1)
%37 = load i8, i8* %21
br label %44
38: ; preds = %18
%39 = call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i64 2, i64 1, i32* %1)
%40 = load i8, i8* %21
br label %44
41: ; preds = %18
%42 = call i32 @fputc(i32 %23, i32* %1)
%43 = load i8, i8* %21
br label %44
44: ; preds = %26, %25, %25, %28, %33, %31, %29, %41, %38, %35
%45 = phi i8 [ %43, %41 ], [ %40, %38 ], [ %37, %35 ], [ %22, %28 ], [ %22, %33 ], [ %22, %31 ], [ %22, %29 ], [ 32, %25 ], [ 32, %25 ], [ 32, %26 ]
%46 = add nuw i64 %19, 1
%47 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 %46
%48 = load i8, i8* %47
%49 = icmp eq i8 %48, 0
br i1 %49, label %10, label %18
50: ; preds = %10, %3
ret void
}