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

/* Variables and functions */
int /*<<< orphan*/ cctools_list_delete(struct list *);
struct token *lexer_concat_expandable(struct lexer *, struct list *);
struct list *lexer_read_expandable_recursive(struct lexer *, char,
                                             int /*<<< orphan*/);
struct token *lexer_read_expandable(struct lexer *lx, char end_marker) {
  struct list *tokens = lexer_read_expandable_recursive(lx, end_marker, 0);
  struct token *t = lexer_concat_expandable(lx, tokens);
  cctools_list_delete(tokens);
  return t;
}


x86 assembly (clang, -O0):
<lexer_read_expandable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
xor    %edx,%edx
movsbl -0x9(%rbp),%esi
call   1040 <lexer_read_expandable_recursive@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <lexer_concat_expandable@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <cctools_list_delete@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lexer_read_expandable>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %edx,%edx
call   1040 <lexer_read_expandable_recursive@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
call   1050 <lexer_concat_expandable@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <cctools_list_delete@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.token = type { i32 }
%struct.lexer = type { i32 }
%struct.list = type { i32 }
define %struct.token* @lexer_read_expandable(%struct.lexer* %0, i8 signext %1) {
%3 = alloca %struct.lexer*
%4 = alloca i8
%5 = alloca %struct.list*
%6 = alloca %struct.token*
store %struct.lexer* %0, %struct.lexer** %3
store i8 %1, i8* %4
%7 = load %struct.lexer*, %struct.lexer** %3
%8 = load i8, i8* %4
%9 = call %struct.list* @lexer_read_expandable_recursive(%struct.lexer* %7, i8 signext %8, i32 0)
store %struct.list* %9, %struct.list** %5
%10 = load %struct.lexer*, %struct.lexer** %3
%11 = load %struct.list*, %struct.list** %5
%12 = call %struct.token* @lexer_concat_expandable(%struct.lexer* %10, %struct.list* %11)
store %struct.token* %12, %struct.token** %6
%13 = load %struct.list*, %struct.list** %5
%14 = call i32 @cctools_list_delete(%struct.list* %13)
%15 = load %struct.token*, %struct.token** %6
ret %struct.token* %15
}

LLVM IR (-O2):
%struct.token = type { i32 }
%struct.lexer = type { i32 }
%struct.list = type { i32 }
define %struct.token* @lexer_read_expandable(%struct.lexer* %0, i8 signext %1) {
%3 = tail call %struct.list* @lexer_read_expandable_recursive(%struct.lexer* %0, i8 signext %1, i32 0)
%4 = tail call %struct.token* @lexer_concat_expandable(%struct.lexer* %0, %struct.list* %3)
%5 = tail call i32 @cctools_list_delete(%struct.list* %3)
ret %struct.token* %4
}