#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 */
char gch();
int /*<<< orphan*/ match(char *);
char spechar();
quoted_char(int *value) {
  int k;
  char c;
  k = 0;
  if (!match("'"))
    return (0);
  while ((c = gch()) != '\'') {
    c = (c == '\\') ? spechar() : c;
    k = (k & 255) << 8 | (c & 255);
  }
  *value = k;
  return (1);
}


x86 assembly (clang, -O0):
<quoted_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xeb6(%rip),%rdi
call   1030 <match@plt>
cmp    $0x0,%eax
jne    1164 <quoted_char+0x34>
movl   $0x0,-0x4(%rbp)
jmp    11da <quoted_char+0xaa>
jmp    1169 <quoted_char+0x39>
mov    $0x0,%al
call   1040 <gch@plt>
mov    %al,-0x15(%rbp)
movsbl %al,%eax
cmp    $0x27,%eax
je     11ca <quoted_char+0x9a>
movsbl -0x15(%rbp),%eax
cmp    $0x5c,%eax
jne    119e <quoted_char+0x6e>
mov    $0x0,%al
call   1050 <spechar@plt>
movsbl %al,%eax
mov    %eax,-0x1c(%rbp)
jmp    11a5 <quoted_char+0x75>
movsbl -0x15(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %al,-0x15(%rbp)
mov    -0x14(%rbp),%eax
and    $0xff,%eax
shl    $0x8,%eax
movsbl -0x15(%rbp),%ecx
and    $0xff,%ecx
or     %ecx,%eax
mov    %eax,-0x14(%rbp)
jmp    1169 <quoted_char+0x39>
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quoted_char>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xec3(%rip),%rdi
call   1030 <match@plt>
test   %eax,%eax
je     117a <quoted_char+0x4a>
xor    %ebp,%ebp
jmp    1162 <quoted_char+0x32>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <spechar@plt>
shl    $0x8,%ebp
movzwl %bp,%ecx
movzbl %al,%ebp
or     %ecx,%ebp
xor    %eax,%eax
call   1040 <gch@plt>
cmp    $0x5c,%al
je     1150 <quoted_char+0x20>
cmp    $0x27,%al
jne    1157 <quoted_char+0x27>
mov    %ebp,(%rbx)
mov    $0x1,%eax
jmp    117c <quoted_char+0x4c>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"'\00"
define i32 @quoted_char(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i8
store i32* %0, i32** %3
store i32 0, i32* %4
%6 = call i32 @match(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = icmp ne i32 %6, 0
br i1 %7, label %9, label %8
8: ; preds = %1
store i32 0, i32* %2
br label %37
9: ; preds = %1
br label %10
10: ; preds = %24, %9
%11 = call signext i8 (...) @gch()
store i8 %11, i8* %5
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 39
br i1 %13, label %14, label %34
14: ; preds = %10
%15 = load i8, i8* %5
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 92
br i1 %17, label %18, label %21
18: ; preds = %14
%19 = call signext i8 (...) @spechar()
%20 = sext i8 %19 to i32
br label %24
21: ; preds = %14
%22 = load i8, i8* %5
%23 = sext i8 %22 to i32
br label %24
24: ; preds = %21, %18
%25 = phi i32 [ %20, %18 ], [ %23, %21 ]
%26 = trunc i32 %25 to i8
store i8 %26, i8* %5
%27 = load i32, i32* %4
%28 = and i32 %27, 255
%29 = shl i32 %28, 8
%30 = load i8, i8* %5
%31 = sext i8 %30 to i32
%32 = and i32 %31, 255
%33 = or i32 %29, %32
store i32 %33, i32* %4
br label %10
34: ; preds = %10
%35 = load i32, i32* %4
%36 = load i32*, i32** %3
store i32 %35, i32* %36
store i32 1, i32* %2
br label %37
37: ; preds = %34, %8
%38 = load i32, i32* %2
ret i32 %38
}

LLVM IR (-O2):
@.str = [2 x i8] c"'\00"
define i32 @quoted_char(i32* nocapture writeonly %0) {
%2 = tail call i32 @match(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %9
%5 = phi i32 [ %14, %9 ], [ 0, %1 ]
%6 = tail call signext i8 (...) @gch()
switch i8 %6, label %9 [
i8 39, label %15
i8 92, label %7
]
7: ; preds = %4
%8 = tail call signext i8 (...) @spechar()
br label %9
9: ; preds = %4, %7
%10 = phi i8 [ %8, %7 ], [ %6, %4 ]
%11 = shl nsw i32 %5, 8
%12 = and i32 %11, 65280
%13 = zext i8 %10 to i32
%14 = or i32 %12, %13
br label %4
15: ; preds = %4
store i32 %5, i32* %0
br label %16
16: ; preds = %1, %15
%17 = phi i32 [ 1, %15 ], [ 0, %1 ]
ret i32 %17
}