#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 EOF;
int /*<<< orphan*/ contains(char const *, int);
int getchar();
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ ungetc(int, int /*<<< orphan*/);
void read_label(char *str, const char *skip) {
  int n = 0;
  int c;
  while ((c = getchar()) != EOF && !contains(skip, c)) {
    if (c == '\\') {
      c = getchar();
    }
    if (n < 63) {
      str[n] = c;
      n++;
    }
  }
  ungetc(c, stdin);
  str[n] = 0;
}


x86 assembly (clang, -O0):
<read_label>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,%ecx
mov    %ecx,-0x18(%rbp)
xor    %eax,%eax
mov    0x2e84(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0x19(%rbp)
je     117e <read_label+0x4e>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1030 <contains@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    118e <read_label+0x5e>
jmp    11ca <read_label+0x9a>
cmpl   $0x5c,-0x18(%rbp)
jne    11a2 <read_label+0x72>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x3f,-0x14(%rbp)
jge    11c5 <read_label+0x95>
mov    -0x18(%rbp),%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1147 <read_label+0x17>
mov    -0x18(%rbp),%edi
mov    0x2e14(%rip),%rax
mov    (%rax),%esi
call   1050 <ungetc@plt>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_label>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebp
mov    0x2e90(%rip),%r12
cmp    (%r12),%eax
jne    1177 <read_label+0x47>
mov    0x2e8b(%rip),%rax
mov    (%rax),%esi
mov    %ebp,%edi
call   1050 <ungetc@plt>
movslq %ebx,%rax
movb   $0x0,(%r14,%rax,1)
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ebx,%ebx
jmp    118f <read_label+0x5f>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebp
cmp    (%r12),%eax
je     1156 <read_label+0x26>
mov    %r15,%rdi
mov    %ebp,%esi
call   1030 <contains@plt>
test   %eax,%eax
jne    1156 <read_label+0x26>
cmp    $0x5c,%ebp
jne    11ab <read_label+0x7b>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebp
cmp    $0x3e,%ebx
jg     1180 <read_label+0x50>
movslq %ebx,%rax
mov    %bpl,(%r14,%rax,1)
add    $0x1,%ebx
jmp    1180 <read_label+0x50>

LLVM IR (-O0):
@EOF = global i32 0
@stdin = global i32 0
define void @read_label(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 0, i32* %5
br label %7
7: ; preds = %36, %2
%8 = call i32 (...) @getchar()
store i32 %8, i32* %6
%9 = load i32, i32* @EOF
%10 = icmp ne i32 %8, %9
br i1 %10, label %11, label %17
11: ; preds = %7
%12 = load i8*, i8** %4
%13 = load i32, i32* %6
%14 = call i32 @contains(i8* %12, i32 %13)
%15 = icmp ne i32 %14, 0
%16 = xor i1 %15, true
br label %17
17: ; preds = %11, %7
%18 = phi i1 [ false, %7 ], [ %16, %11 ]
br i1 %18, label %19, label %37
19: ; preds = %17
%20 = load i32, i32* %6
%21 = icmp eq i32 %20, 92
br i1 %21, label %22, label %24
22: ; preds = %19
%23 = call i32 (...) @getchar()
store i32 %23, i32* %6
br label %24
24: ; preds = %22, %19
%25 = load i32, i32* %5
%26 = icmp slt i32 %25, 63
br i1 %26, label %27, label %36
27: ; preds = %24
%28 = load i32, i32* %6
%29 = trunc i32 %28 to i8
%30 = load i8*, i8** %3
%31 = load i32, i32* %5
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %30, i64 %32
store i8 %29, i8* %33
%34 = load i32, i32* %5
%35 = add nsw i32 %34, 1
store i32 %35, i32* %5
br label %36
36: ; preds = %27, %24
br label %7
37: ; preds = %17
%38 = load i32, i32* %6
%39 = load i32, i32* @stdin
%40 = call i32 @ungetc(i32 %38, i32 %39)
%41 = load i8*, i8** %3
%42 = load i32, i32* %5
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8, i8* %41, i64 %43
store i8 0, i8* %44
ret void
}

LLVM IR (-O2):
@EOF = global i32 0
@stdin = global i32 0
define void @read_label(i8* nocapture writeonly %0, i8* %1) {
%3 = tail call i32 (...) @getchar()
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %28, label %6
6: ; preds = %2, %23
%7 = phi i32 [ %25, %23 ], [ %3, %2 ]
%8 = phi i32 [ %24, %23 ], [ 0, %2 ]
%9 = tail call i32 @contains(i8* %1, i32 %7)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %28
11: ; preds = %6
%12 = icmp eq i32 %7, 92
br i1 %12, label %13, label %15
13: ; preds = %11
%14 = tail call i32 (...) @getchar()
br label %15
15: ; preds = %13, %11
%16 = phi i32 [ %14, %13 ], [ %7, %11 ]
%17 = icmp slt i32 %8, 63
br i1 %17, label %18, label %23
18: ; preds = %15
%19 = trunc i32 %16 to i8
%20 = sext i32 %8 to i64
%21 = getelementptr inbounds i8, i8* %0, i64 %20
store i8 %19, i8* %21
%22 = add nsw i32 %8, 1
br label %23
23: ; preds = %18, %15
%24 = phi i32 [ %22, %18 ], [ %8, %15 ]
%25 = tail call i32 (...) @getchar()
%26 = load i32, i32* @EOF
%27 = icmp eq i32 %25, %26
br i1 %27, label %28, label %6
28: ; preds = %6, %23, %2
%29 = phi i32 [ 0, %2 ], [ %24, %23 ], [ %8, %6 ]
%30 = phi i32 [ %3, %2 ], [ %25, %23 ], [ %7, %6 ]
%31 = load i32, i32* @stdin
%32 = tail call i32 @ungetc(i32 %30, i32 %31)
%33 = sext i32 %29 to i64
%34 = getelementptr inbounds i8, i8* %0, i64 %33
store i8 0, i8* %34
ret void
}