#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 */
struct lexer {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ lexer_add_to_lexeme(struct lexer *, char);
int /*<<< orphan*/ lexer_next_char(struct lexer *);
char lexer_next_peek(struct lexer *);
int /*<<< orphan*/ lexer_peek_remote_rename_syntax(struct lexer *);
int lexer_read_escaped_until(struct lexer *, char *);
int lexer_read_filename_recursive(struct lexer *lx) {
  int count = lexer_read_escaped_until(lx, "\\\"'$#\n\t \032"
                                           ":-");
  if (count < 1)
    return count;
  if (lexer_next_peek(lx) == '-' && !lexer_peek_remote_rename_syntax(lx)) {
    lexer_add_to_lexeme(lx, '-');
    lexer_next_char(lx);
    count++;
    count += lexer_read_filename_recursive(lx);
  }
  return count;
}


x86 assembly (clang, -O0):
<lexer_read_filename_recursive>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe89(%rip),%rsi
call   1070 <lexer_read_escaped_until@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jge    1194 <lexer_read_filename_recursive+0x34>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11f0 <lexer_read_filename_recursive+0x90>
mov    -0x10(%rbp),%rdi
call   1040 <lexer_next_peek@plt>
movsbl %al,%eax
cmp    $0x2d,%eax
jne    11ea <lexer_read_filename_recursive+0x8a>
mov    -0x10(%rbp),%rdi
call   1030 <lexer_peek_remote_rename_syntax@plt>
cmp    $0x0,%eax
jne    11ea <lexer_read_filename_recursive+0x8a>
mov    -0x10(%rbp),%rdi
mov    $0x2d,%esi
call   1060 <lexer_add_to_lexeme@plt>
mov    -0x10(%rbp),%rdi
call   1050 <lexer_next_char@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1080 <lexer_read_filename_recursive@plt>
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lexer_read_filename_recursive>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r15
lea    0xe9e(%rip),%rsi
call   1070 <lexer_read_escaped_until@plt>
mov    %eax,%r14d
xor    %ebx,%ebx
test   %eax,%eax
jle    11c5 <lexer_read_filename_recursive+0x75>
lea    0xe89(%rip),%r12
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1040 <lexer_next_peek@plt>
cmp    $0x2d,%al
jne    11c5 <lexer_read_filename_recursive+0x75>
mov    %r15,%rdi
call   1030 <lexer_peek_remote_rename_syntax@plt>
test   %eax,%eax
jne    11c5 <lexer_read_filename_recursive+0x75>
mov    %r15,%rdi
mov    $0x2d,%esi
call   1060 <lexer_add_to_lexeme@plt>
mov    %r15,%rdi
call   1050 <lexer_next_char@plt>
add    %r14d,%ebx
add    $0x1,%ebx
mov    %r15,%rdi
mov    %r12,%rsi
call   1070 <lexer_read_escaped_until@plt>
mov    %eax,%r14d
test   %eax,%eax
jg     1180 <lexer_read_filename_recursive+0x30>
add    %r14d,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.lexer = type { i32 }
@.str = [12 x i8] c"\\\22'$#\0A\09 \1A:-\00"
define i32 @lexer_read_filename_recursive(%struct.lexer* %0) {
%2 = alloca i32
%3 = alloca %struct.lexer*
%4 = alloca i32
store %struct.lexer* %0, %struct.lexer** %3
%5 = load %struct.lexer*, %struct.lexer** %3
%6 = call i32 @lexer_read_escaped_until(%struct.lexer* %5, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 1
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = load i32, i32* %4
store i32 %10, i32* %2
br label %33
11: ; preds = %1
%12 = load %struct.lexer*, %struct.lexer** %3
%13 = call signext i8 @lexer_next_peek(%struct.lexer* %12)
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 45
br i1 %15, label %16, label %31
16: ; preds = %11
%17 = load %struct.lexer*, %struct.lexer** %3
%18 = call i32 @lexer_peek_remote_rename_syntax(%struct.lexer* %17)
%19 = icmp ne i32 %18, 0
br i1 %19, label %31, label %20
20: ; preds = %16
%21 = load %struct.lexer*, %struct.lexer** %3
%22 = call i32 @lexer_add_to_lexeme(%struct.lexer* %21, i8 signext 45)
%23 = load %struct.lexer*, %struct.lexer** %3
%24 = call i32 @lexer_next_char(%struct.lexer* %23)
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
store i32 %26, i32* %4
%27 = load %struct.lexer*, %struct.lexer** %3
%28 = call i32 @lexer_read_filename_recursive(%struct.lexer* %27)
%29 = load i32, i32* %4
%30 = add nsw i32 %29, %28
store i32 %30, i32* %4
br label %31
31: ; preds = %20, %16, %11
%32 = load i32, i32* %4
store i32 %32, i32* %2
br label %33
33: ; preds = %31, %9
%34 = load i32, i32* %2
ret i32 %34
}

LLVM IR (-O2):
%struct.lexer = type { i32 }
@.str = [12 x i8] c"\\\22'$#\0A\09 \1A:-\00"
define i32 @lexer_read_filename_recursive(%struct.lexer* %0) {
%2 = tail call i32 @lexer_read_escaped_until(%struct.lexer* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%3 = icmp slt i32 %2, 1
br i1 %3, label %19, label %4
4: ; preds = %1, %12
%5 = phi i32 [ %17, %12 ], [ %2, %1 ]
%6 = phi i32 [ %16, %12 ], [ 0, %1 ]
%7 = tail call signext i8 @lexer_next_peek(%struct.lexer* %0)
%8 = icmp eq i8 %7, 45
br i1 %8, label %9, label %19
9: ; preds = %4
%10 = tail call i32 @lexer_peek_remote_rename_syntax(%struct.lexer* %0)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %19
12: ; preds = %9
%13 = tail call i32 @lexer_add_to_lexeme(%struct.lexer* %0, i8 signext 45)
%14 = tail call i32 @lexer_next_char(%struct.lexer* %0)
%15 = add i32 %5, %6
%16 = add i32 %15, 1
%17 = tail call i32 @lexer_read_escaped_until(%struct.lexer* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%18 = icmp slt i32 %17, 1
br i1 %18, label %19, label %4
19: ; preds = %12, %9, %4, %1
%20 = phi i32 [ 0, %1 ], [ %6, %4 ], [ %6, %9 ], [ %16, %12 ]
%21 = phi i32 [ %2, %1 ], [ %5, %4 ], [ %5, %9 ], [ %17, %12 ]
%22 = add nsw i32 %21, %20
ret i32 %22
}