#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*/ error(char *);
int /*<<< orphan*/ insert8(char);
int Xasc(int modifier, char *label, char *mnemo, char *oper) {
  register char *s;
  register char r;
  register char delimiter;
  s = oper;
  delimiter = *s;
  if (delimiter != '\'' && delimiter != '\"') {
    error("Bad operand syntax");
  }
  while ((r = *++s) != delimiter) {
    if (r == '\\') {
      switch (*++s) {
      case 't':
        r = '\t';
        break;
      case 'n':
        r = '\n';
        break;
      case 'r':
        r = '\r';
        break;
      case '0':
        r = 0;
        break;
      case '\'':
      case '\"':
      case '\\':
        r = *s;
        break;
      default:
        error("Bad \\X character");
      }
    }
    insert8(r);
  }
  if (*++s) {
    error("syntax error");
  }
  return 0;
}


x86 assembly (clang, -O0):
<Xasc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x2a(%rbp)
movsbl -0x2a(%rbp),%eax
cmp    $0x27,%eax
je     116e <Xasc+0x4e>
movsbl -0x2a(%rbp),%eax
cmp    $0x22,%eax
je     116e <Xasc+0x4e>
lea    0xe97(%rip),%rdi
call   1040 <error@plt>
jmp    1173 <Xasc+0x53>
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
mov    0x1(%rax),%al
mov    %al,-0x29(%rbp)
movsbl %al,%eax
movsbl -0x2a(%rbp),%ecx
cmp    %ecx,%eax
je     127f <Xasc+0x15f>
movsbl -0x29(%rbp),%eax
cmp    $0x5c,%eax
jne    1271 <Xasc+0x151>
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
movsbl 0x1(%rax),%eax
mov    %eax,-0x30(%rbp)
sub    $0x22,%eax
je     1252 <Xasc+0x132>
jmp    11c8 <Xasc+0xa8>
mov    -0x30(%rbp),%eax
sub    $0x27,%eax
je     1252 <Xasc+0x132>
jmp    11d9 <Xasc+0xb9>
mov    -0x30(%rbp),%eax
sub    $0x30,%eax
je     1249 <Xasc+0x129>
jmp    11ea <Xasc+0xca>
mov    -0x30(%rbp),%eax
sub    $0x5c,%eax
je     1252 <Xasc+0x132>
jmp    11fb <Xasc+0xdb>
mov    -0x30(%rbp),%eax
sub    $0x6e,%eax
je     1237 <Xasc+0x117>
jmp    120c <Xasc+0xec>
mov    -0x30(%rbp),%eax
sub    $0x72,%eax
je     1240 <Xasc+0x120>
jmp    121d <Xasc+0xfd>
mov    -0x30(%rbp),%eax
sub    $0x74,%eax
jne    1260 <Xasc+0x140>
jmp    122e <Xasc+0x10e>
movb   $0x9,-0x29(%rbp)
jmp    126c <Xasc+0x14c>
movb   $0xa,-0x29(%rbp)
jmp    126c <Xasc+0x14c>
movb   $0xd,-0x29(%rbp)
jmp    126c <Xasc+0x14c>
movb   $0x0,-0x29(%rbp)
jmp    126c <Xasc+0x14c>
mov    -0x28(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x29(%rbp)
jmp    126c <Xasc+0x14c>
lea    0xdac(%rip),%rdi
call   1040 <error@plt>
jmp    1271 <Xasc+0x151>
movsbl -0x29(%rbp),%edi
call   1030 <insert8@plt>
jmp    1173 <Xasc+0x53>
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
cmpb   $0x0,0x1(%rax)
je     12a4 <Xasc+0x184>
lea    0xd85(%rip),%rdi
call   1040 <error@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Xasc>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rcx,%rbx
mov    (%rcx),%r12b
cmp    $0x22,%r12b
je     1146 <Xasc+0x26>
cmp    $0x27,%r12b
je     1146 <Xasc+0x26>
lea    0xf23(%rip),%rdi
call   1040 <error@plt>
mov    0x1(%rbx),%al
cmp    %r12b,%al
jne    116e <Xasc+0x4e>
mov    %rbx,%rbp
cmpb   $0x0,0x2(%rbp)
je     1163 <Xasc+0x43>
lea    0xf2a(%rip),%rdi
call   1040 <error@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x1(%rbx),%rcx
lea    0xefe(%rip),%r14
lea    0xe80(%rip),%r15
jmp    11a8 <Xasc+0x88>
mov    %ecx,%eax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <insert8@plt>
lea    0x1(%rbp),%rcx
movzbl 0x1(%rbp),%eax
mov    %rbp,%rbx
cmp    %r12b,%al
je     1151 <Xasc+0x31>
mov    %rcx,%rbp
cmp    $0x5c,%al
jne    1190 <Xasc+0x70>
movzbl 0x2(%rbx),%ecx
mov    %rbx,%rbp
add    $0x2,%rbp
movsbl %cl,%edx
cmp    $0x5b,%edx
jle    11e0 <Xasc+0xc0>
add    $0xffffffa4,%edx
cmp    $0x18,%edx
ja     11f7 <Xasc+0xd7>
mov    $0x9,%al
movslq (%r15,%rdx,4),%rdx
add    %r15,%rdx
jmp    *%rdx
mov    $0xa,%al
jmp    1190 <Xasc+0x70>
nopl   0x0(%rax)
cmp    $0x22,%edx
je     1182 <Xasc+0x62>
cmp    $0x27,%edx
je     1182 <Xasc+0x62>
cmp    $0x30,%edx
jne    11f7 <Xasc+0xd7>
xor    %eax,%eax
jmp    1190 <Xasc+0x70>
mov    $0xd,%al
jmp    1190 <Xasc+0x70>
mov    %r14,%rdi
call   1040 <error@plt>
mov    $0x5c,%al
jmp    1190 <Xasc+0x70>

LLVM IR (-O0):
@.str = [19 x i8] c"Bad operand syntax\00"
@.str.1 = [17 x i8] c"Bad \\X character\00"
@.str.2 = [13 x i8] c"syntax error\00"
define i32 @Xasc(i32 %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8
%11 = alloca i8
store i32 %0, i32* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%12 = load i8*, i8** %8
store i8* %12, i8** %9
%13 = load i8*, i8** %9
%14 = load i8, i8* %13
store i8 %14, i8* %11
%15 = load i8, i8* %11
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %16, 39
br i1 %17, label %18, label %24
18: ; preds = %4
%19 = load i8, i8* %11
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %20, 34
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = call i32 @error(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %24
24: ; preds = %22, %18, %4
br label %25
25: ; preds = %52, %24
%26 = load i8*, i8** %9
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %9
%28 = load i8, i8* %27
store i8 %28, i8* %10
%29 = sext i8 %28 to i32
%30 = load i8, i8* %11
%31 = sext i8 %30 to i32
%32 = icmp ne i32 %29, %31
br i1 %32, label %33, label %55
33: ; preds = %25
%34 = load i8, i8* %10
%35 = sext i8 %34 to i32
%36 = icmp eq i32 %35, 92
br i1 %36, label %37, label %52
37: ; preds = %33
%38 = load i8*, i8** %9
%39 = getelementptr inbounds i8, i8* %38, i32 1
store i8* %39, i8** %9
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
switch i32 %41, label %49 [
i32 116, label %42
i32 110, label %43
i32 114, label %44
i32 48, label %45
i32 39, label %46
i32 34, label %46
i32 92, label %46
]
42: ; preds = %37
store i8 9, i8* %10
br label %51
43: ; preds = %37
store i8 10, i8* %10
br label %51
44: ; preds = %37
store i8 13, i8* %10
br label %51
45: ; preds = %37
store i8 0, i8* %10
br label %51
46: ; preds = %37, %37, %37
%47 = load i8*, i8** %9
%48 = load i8, i8* %47
store i8 %48, i8* %10
br label %51
49: ; preds = %37
%50 = call i32 @error(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %51
51: ; preds = %49, %46, %45, %44, %43, %42
br label %52
52: ; preds = %51, %33
%53 = load i8, i8* %10
%54 = call i32 @insert8(i8 signext %53)
br label %25
55: ; preds = %25
%56 = load i8*, i8** %9
%57 = getelementptr inbounds i8, i8* %56, i32 1
store i8* %57, i8** %9
%58 = load i8, i8* %57
%59 = icmp ne i8 %58, 0
br i1 %59, label %60, label %62
60: ; preds = %55
%61 = call i32 @error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
br label %62
62: ; preds = %60, %55
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"Bad operand syntax\00"
@.str.1 = [17 x i8] c"Bad \\X character\00"
@.str.2 = [13 x i8] c"syntax error\00"
define i32 @Xasc(i32 %0, i8* nocapture readnone %1, i8* nocapture readnone %2, i8* nocapture %3) {
%5 = load i8, i8* %3
switch i8 %5, label %6 [
i8 39, label %8
i8 34, label %8
]
6: ; preds = %4
%7 = tail call i32 @error(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %4, %4, %6
%9 = getelementptr inbounds i8, i8* %3, i64 1
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, %5
br i1 %11, label %34, label %12
12: ; preds = %8, %27
%13 = phi i8 [ %32, %27 ], [ %10, %8 ]
%14 = phi i8* [ %31, %27 ], [ %9, %8 ]
%15 = phi i8* [ %29, %27 ], [ %3, %8 ]
%16 = icmp eq i8 %13, 92
br i1 %16, label %17, label %27
17: ; preds = %12
%18 = getelementptr inbounds i8, i8* %15, i64 2
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
switch i32 %20, label %25 [
i32 116, label %27
i32 110, label %21
i32 114, label %22
i32 48, label %23
i32 39, label %24
i32 34, label %24
i32 92, label %24
]
21: ; preds = %17
br label %27
22: ; preds = %17
br label %27
23: ; preds = %17
br label %27
24: ; preds = %17, %17, %17
br label %27
25: ; preds = %17
%26 = tail call i32 @error(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %27
27: ; preds = %17, %21, %22, %23, %24, %25, %12
%28 = phi i8 [ 92, %25 ], [ %19, %24 ], [ 0, %23 ], [ 13, %22 ], [ 10, %21 ], [ %13, %12 ], [ 9, %17 ]
%29 = phi i8* [ %18, %25 ], [ %18, %24 ], [ %18, %23 ], [ %18, %22 ], [ %18, %21 ], [ %14, %12 ], [ %18, %17 ]
%30 = tail call i32 @insert8(i8 signext %28)
%31 = getelementptr inbounds i8, i8* %29, i64 1
%32 = load i8, i8* %31
%33 = icmp eq i8 %32, %5
br i1 %33, label %34, label %12
34: ; preds = %27, %8
%35 = phi i8* [ %3, %8 ], [ %29, %27 ]
%36 = getelementptr inbounds i8, i8* %35, i64 2
%37 = load i8, i8* %36
%38 = icmp eq i8 %37, 0
br i1 %38, label %41, label %39
39: ; preds = %34
%40 = tail call i32 @error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
br label %41
41: ; preds = %39, %34
ret i32 0
}