#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 */
char getc(int /*<<< orphan*/ *);
scalar_t__ isspace(char);
char peek(int /*<<< orphan*/ *);
int get_escape_char(FILE *in, char *p) {
  char c;
  c = getc(in);
  switch (c) {
  case 'a':
    *p = '\a';
    return 0;
  case 'b':
    *p = '\b';
    return 0;
  case 't':
    *p = '\t';
    return 0;
  case 'n':
    *p = '\n';
    return 0;
  case 'v':
    *p = '\v';
    return 0;
  case 'f':
    *p = '\f';
    return 0;
  case 'r':
    *p = '\r';
    return 0;
  case '"':
    *p = '"';
    return 0;
  case '\\':
    *p = '\\';
    return 0;
  }
  if (isspace(c)) {
    while (c != '\n') {
      c = getc(in);
      if (!isspace(c)) {
        break;
      }
    }
    if (c == '\n') {
      while (isspace(c = peek(in)) && c != '\n') {
        getc(in);
      }
      *p = '\0';
    } else {
      return -1;
    }
  } else {
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<get_escape_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <getc@plt>
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
add    $0xffffffde,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x54,%eax
ja     1221 <get_escape_char+0xf1>
mov    -0x28(%rbp),%rax
lea    0xe93(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x18(%rbp),%rax
movb   $0x7,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1302 <get_escape_char+0x1d2>
mov    -0x18(%rbp),%rax
movb   $0x8,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1302 <get_escape_char+0x1d2>
mov    -0x18(%rbp),%rax
movb   $0x9,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1302 <get_escape_char+0x1d2>
mov    -0x18(%rbp),%rax
movb   $0xa,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1302 <get_escape_char+0x1d2>
mov    -0x18(%rbp),%rax
movb   $0xb,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1302 <get_escape_char+0x1d2>
mov    -0x18(%rbp),%rax
movb   $0xc,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1302 <get_escape_char+0x1d2>
mov    -0x18(%rbp),%rax
movb   $0xd,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1302 <get_escape_char+0x1d2>
mov    -0x18(%rbp),%rax
movb   $0x22,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1302 <get_escape_char+0x1d2>
mov    -0x18(%rbp),%rax
movb   $0x5c,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1302 <get_escape_char+0x1d2>
movsbl -0x19(%rbp),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
je     12ef <get_escape_char+0x1bf>
jmp    1239 <get_escape_char+0x109>
movsbl -0x19(%rbp),%eax
cmp    $0xa,%eax
je     126f <get_escape_char+0x13f>
mov    -0x10(%rbp),%rdi
call   1050 <getc@plt>
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
jne    126a <get_escape_char+0x13a>
jmp    126f <get_escape_char+0x13f>
jmp    1239 <get_escape_char+0x109>
movsbl -0x19(%rbp),%eax
cmp    $0xa,%eax
jne    12de <get_escape_char+0x1ae>
jmp    1281 <get_escape_char+0x151>
mov    -0x10(%rbp),%rdi
call   1030 <peek@plt>
mov    %al,-0x19(%rbp)
movsbl %al,%edi
call   1040 <isspace@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x29(%rbp)
je     12b4 <get_escape_char+0x184>
movsbl -0x19(%rbp),%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
test   $0x1,%al
jne    12c4 <get_escape_char+0x194>
jmp    12d2 <get_escape_char+0x1a2>
mov    -0x10(%rbp),%rdi
call   1050 <getc@plt>
jmp    1281 <get_escape_char+0x151>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
jmp    12ea <get_escape_char+0x1ba>
movl   $0xffffffff,-0x4(%rbp)
jmp    1302 <get_escape_char+0x1d2>
jmp    12fb <get_escape_char+0x1cb>
movl   $0xffffffff,-0x4(%rbp)
jmp    1302 <get_escape_char+0x1d2>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_escape_char>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r12
call   1050 <getc@plt>
mov    %eax,%ebx
movsbl %al,%edi
lea    -0x22(%rdi),%eax
cmp    $0x54,%eax
ja     1169 <get_escape_char+0x39>
mov    $0x7,%cl
lea    0xea7(%rip),%rdx
movslq (%rdx,%rax,4),%rax
add    %rdx,%rax
jmp    *%rax
mov    $0x22,%cl
jmp    1202 <get_escape_char+0xd2>
call   1040 <isspace@plt>
mov    $0xffffffff,%r15d
test   %rax,%rax
je     1208 <get_escape_char+0xd8>
cmp    $0xa,%bl
je     11c0 <get_escape_char+0x90>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r12,%rdi
call   1050 <getc@plt>
mov    %eax,%ebx
movsbl %al,%ebp
mov    %ebp,%edi
call   1040 <isspace@plt>
cmp    $0xa,%bpl
je     11af <get_escape_char+0x7f>
test   %rax,%rax
jne    1190 <get_escape_char+0x60>
cmp    $0xa,%bl
jne    1208 <get_escape_char+0xd8>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r12,%rdi
call   1030 <peek@plt>
movsbl %al,%ebx
mov    %ebx,%edi
call   1040 <isspace@plt>
xor    %ecx,%ecx
cmp    $0xa,%bl
je     1202 <get_escape_char+0xd2>
test   %rax,%rax
je     1202 <get_escape_char+0xd2>
mov    %r12,%rdi
call   1050 <getc@plt>
jmp    11c0 <get_escape_char+0x90>
mov    $0x5c,%cl
jmp    1202 <get_escape_char+0xd2>
mov    $0x8,%cl
jmp    1202 <get_escape_char+0xd2>
mov    $0xc,%cl
jmp    1202 <get_escape_char+0xd2>
mov    $0xa,%cl
jmp    1202 <get_escape_char+0xd2>
mov    $0xd,%cl
jmp    1202 <get_escape_char+0xd2>
mov    $0x9,%cl
jmp    1202 <get_escape_char+0xd2>
mov    $0xb,%cl
mov    %cl,(%r14)
xor    %r15d,%r15d
mov    %r15d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @get_escape_char(i32* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i8
store i32* %0, i32** %4
store i8* %1, i8** %5
%7 = load i32*, i32** %4
%8 = call signext i8 @getc(i32* %7)
store i8 %8, i8* %6
%9 = load i8, i8* %6
%10 = sext i8 %9 to i32
switch i32 %10, label %29 [
i32 97, label %11
i32 98, label %13
i32 116, label %15
i32 110, label %17
i32 118, label %19
i32 102, label %21
i32 114, label %23
i32 34, label %25
i32 92, label %27
]
11: ; preds = %2
%12 = load i8*, i8** %5
store i8 7, i8* %12
store i32 0, i32* %3
br label %71
13: ; preds = %2
%14 = load i8*, i8** %5
store i8 8, i8* %14
store i32 0, i32* %3
br label %71
15: ; preds = %2
%16 = load i8*, i8** %5
store i8 9, i8* %16
store i32 0, i32* %3
br label %71
17: ; preds = %2
%18 = load i8*, i8** %5
store i8 10, i8* %18
store i32 0, i32* %3
br label %71
19: ; preds = %2
%20 = load i8*, i8** %5
store i8 11, i8* %20
store i32 0, i32* %3
br label %71
21: ; preds = %2
%22 = load i8*, i8** %5
store i8 12, i8* %22
store i32 0, i32* %3
br label %71
23: ; preds = %2
%24 = load i8*, i8** %5
store i8 13, i8* %24
store i32 0, i32* %3
br label %71
25: ; preds = %2
%26 = load i8*, i8** %5
store i8 34, i8* %26
store i32 0, i32* %3
br label %71
27: ; preds = %2
%28 = load i8*, i8** %5
store i8 92, i8* %28
store i32 0, i32* %3
br label %71
29: ; preds = %2
%30 = load i8, i8* %6
%31 = call i64 @isspace(i8 signext %30)
%32 = icmp ne i64 %31, 0
br i1 %32, label %33, label %69
33: ; preds = %29
br label %34
34: ; preds = %45, %33
%35 = load i8, i8* %6
%36 = sext i8 %35 to i32
%37 = icmp ne i32 %36, 10
br i1 %37, label %38, label %46
38: ; preds = %34
%39 = load i32*, i32** %4
%40 = call signext i8 @getc(i32* %39)
store i8 %40, i8* %6
%41 = load i8, i8* %6
%42 = call i64 @isspace(i8 signext %41)
%43 = icmp ne i64 %42, 0
br i1 %43, label %45, label %44
44: ; preds = %38
br label %46
45: ; preds = %38
br label %34
46: ; preds = %44, %34
%47 = load i8, i8* %6
%48 = sext i8 %47 to i32
%49 = icmp eq i32 %48, 10
br i1 %49, label %50, label %67
50: ; preds = %46
br label %51
51: ; preds = %62, %50
%52 = load i32*, i32** %4
%53 = call signext i8 @peek(i32* %52)
store i8 %53, i8* %6
%54 = call i64 @isspace(i8 signext %53)
%55 = icmp ne i64 %54, 0
br i1 %55, label %56, label %60
56: ; preds = %51
%57 = load i8, i8* %6
%58 = sext i8 %57 to i32
%59 = icmp ne i32 %58, 10
br label %60
60: ; preds = %56, %51
%61 = phi i1 [ false, %51 ], [ %59, %56 ]
br i1 %61, label %62, label %65
62: ; preds = %60
%63 = load i32*, i32** %4
%64 = call signext i8 @getc(i32* %63)
br label %51
65: ; preds = %60
%66 = load i8*, i8** %5
store i8 0, i8* %66
br label %68
67: ; preds = %46
store i32 -1, i32* %3
br label %71
68: ; preds = %65
br label %70
69: ; preds = %29
store i32 -1, i32* %3
br label %71
70: ; preds = %68
store i32 0, i32* %3
br label %71
71: ; preds = %70, %69, %67, %27, %25, %23, %21, %19, %17, %15, %13, %11
%72 = load i32, i32* %3
ret i32 %72
}

LLVM IR (-O2):
define i32 @get_escape_char(i32* %0, i8* nocapture writeonly %1) {
%3 = tail call signext i8 @getc(i32* %0)
%4 = sext i8 %3 to i32
switch i32 %4, label %13 [
i32 97, label %39
i32 98, label %5
i32 116, label %6
i32 110, label %7
i32 118, label %8
i32 102, label %9
i32 114, label %10
i32 34, label %11
i32 92, label %12
]
5: ; preds = %2
br label %39
6: ; preds = %2
br label %39
7: ; preds = %2
br label %39
8: ; preds = %2
br label %39
9: ; preds = %2
br label %39
10: ; preds = %2
br label %39
11: ; preds = %2
br label %39
12: ; preds = %2
br label %39
13: ; preds = %2
%14 = tail call i64 @isspace(i8 signext %3)
%15 = icmp eq i64 %14, 0
br i1 %15, label %41, label %16
16: ; preds = %13
%17 = icmp eq i8 %3, 10
br i1 %17, label %26, label %18
18: ; preds = %16, %18
%19 = tail call signext i8 @getc(i32* %0)
%20 = tail call i64 @isspace(i8 signext %19)
%21 = icmp ne i64 %20, 0
%22 = icmp ne i8 %19, 10
%23 = and i1 %22, %21
br i1 %23, label %18, label %24
24: ; preds = %18
%25 = icmp eq i8 %19, 10
br i1 %25, label %26, label %41
26: ; preds = %16, %24
%27 = tail call signext i8 @peek(i32* %0)
%28 = tail call i64 @isspace(i8 signext %27)
%29 = icmp ne i64 %28, 0
%30 = icmp ne i8 %27, 10
%31 = and i1 %30, %29
br i1 %31, label %32, label %39
32: ; preds = %26, %32
%33 = tail call signext i8 @getc(i32* %0)
%34 = tail call signext i8 @peek(i32* %0)
%35 = tail call i64 @isspace(i8 signext %34)
%36 = icmp ne i64 %35, 0
%37 = icmp ne i8 %34, 10
%38 = and i1 %37, %36
br i1 %38, label %32, label %39
39: ; preds = %32, %26, %2, %5, %6, %7, %8, %9, %10, %11, %12
%40 = phi i8 [ 92, %12 ], [ 34, %11 ], [ 13, %10 ], [ 12, %9 ], [ 11, %8 ], [ 10, %7 ], [ 9, %6 ], [ 8, %5 ], [ 7, %2 ], [ 0, %26 ], [ 0, %32 ]
store i8 %40, i8* %1
br label %41
41: ; preds = %39, %13, %24
%42 = phi i32 [ -1, %24 ], [ -1, %13 ], [ 0, %39 ]
ret i32 %42
}