#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 tok {
  int dummy;
};
struct node {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ addnode(struct node *, struct node *);
struct tok *lexnocomment();
struct node *newattr(char *, int /*<<< orphan*/);
struct node *newelement(char *);
struct node *parseextendedattributelist(struct tok *);
struct node *parsetype(struct tok *);
int /*<<< orphan*/ setcommentnode(struct node *);
int /*<<< orphan*/ setidentifier(struct tok *);
struct node *parsetypedef(struct tok *tok, struct node *eal) {
  struct node *ealtype;
  struct node *typenode;
  struct node *node = newelement("Typedef");
  setcommentnode(node);
  if (eal)
    addnode(node, eal);
  tok = lexnocomment();
  ealtype = parseextendedattributelist(tok);
  typenode = parsetype(tok);
  if (ealtype)
    addnode(typenode, ealtype);
  addnode(node, typenode);
  addnode(node, newattr("name", setidentifier(tok)));
  tok = lexnocomment();
  return node;
}


x86 assembly (clang, -O0):
<parsetypedef>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe69(%rip),%rdi
call   1050 <newelement@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1080 <setcommentnode@plt>
cmpq   $0x0,-0x10(%rbp)
je     11c1 <parsetypedef+0x41>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <addnode@plt>
mov    $0x0,%al
call   1040 <lexnocomment@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1070 <parseextendedattributelist@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   10a0 <parsetype@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11fe <parsetypedef+0x7e>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <addnode@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <addnode@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <setidentifier@plt>
mov    %eax,%esi
lea    0xde3(%rip),%rdi
call   1090 <newattr@plt>
mov    -0x30(%rbp),%rdi
mov    %rax,%rsi
call   1030 <addnode@plt>
mov    $0x0,%al
call   1040 <lexnocomment@plt>
mov    %rax,-0x8(%rbp)
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parsetypedef>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
lea    0xe6e(%rip),%rdi
call   1050 <newelement@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1080 <setcommentnode@plt>
test   %rbx,%rbx
je     11b2 <parsetypedef+0x32>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <addnode@plt>
xor    %eax,%eax
call   1040 <lexnocomment@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1070 <parseextendedattributelist@plt>
mov    %rax,%r12
mov    %rbx,%rdi
call   10a0 <parsetype@plt>
mov    %rax,%r15
test   %r12,%r12
je     11e2 <parsetypedef+0x62>
mov    %r15,%rdi
mov    %r12,%rsi
call   1030 <addnode@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <addnode@plt>
mov    %rbx,%rdi
call   1060 <setidentifier@plt>
lea    0xe0c(%rip),%rdi
mov    %eax,%esi
call   1090 <newattr@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1030 <addnode@plt>
xor    %eax,%eax
call   1040 <lexnocomment@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.tok = type { i32 }
%struct.node = type { i32 }
@.str = [8 x i8] c"Typedef\00"
@.str.1 = [5 x i8] c"name\00"
define %struct.node* @parsetypedef(%struct.tok* %0, %struct.node* %1) {
%3 = alloca %struct.tok*
%4 = alloca %struct.node*
%5 = alloca %struct.node*
%6 = alloca %struct.node*
%7 = alloca %struct.node*
store %struct.tok* %0, %struct.tok** %3
store %struct.node* %1, %struct.node** %4
%8 = call %struct.node* @newelement(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
store %struct.node* %8, %struct.node** %7
%9 = load %struct.node*, %struct.node** %7
%10 = call i32 @setcommentnode(%struct.node* %9)
%11 = load %struct.node*, %struct.node** %4
%12 = icmp ne %struct.node* %11, null
br i1 %12, label %13, label %17
13: ; preds = %2
%14 = load %struct.node*, %struct.node** %7
%15 = load %struct.node*, %struct.node** %4
%16 = call i32 @addnode(%struct.node* %14, %struct.node* %15)
br label %17
17: ; preds = %13, %2
%18 = call %struct.tok* (...) @lexnocomment()
store %struct.tok* %18, %struct.tok** %3
%19 = load %struct.tok*, %struct.tok** %3
%20 = call %struct.node* @parseextendedattributelist(%struct.tok* %19)
store %struct.node* %20, %struct.node** %5
%21 = load %struct.tok*, %struct.tok** %3
%22 = call %struct.node* @parsetype(%struct.tok* %21)
store %struct.node* %22, %struct.node** %6
%23 = load %struct.node*, %struct.node** %5
%24 = icmp ne %struct.node* %23, null
br i1 %24, label %25, label %29
25: ; preds = %17
%26 = load %struct.node*, %struct.node** %6
%27 = load %struct.node*, %struct.node** %5
%28 = call i32 @addnode(%struct.node* %26, %struct.node* %27)
br label %29
29: ; preds = %25, %17
%30 = load %struct.node*, %struct.node** %7
%31 = load %struct.node*, %struct.node** %6
%32 = call i32 @addnode(%struct.node* %30, %struct.node* %31)
%33 = load %struct.node*, %struct.node** %7
%34 = load %struct.tok*, %struct.tok** %3
%35 = call i32 @setidentifier(%struct.tok* %34)
%36 = call %struct.node* @newattr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %35)
%37 = call i32 @addnode(%struct.node* %33, %struct.node* %36)
%38 = call %struct.tok* (...) @lexnocomment()
store %struct.tok* %38, %struct.tok** %3
%39 = load %struct.node*, %struct.node** %7
ret %struct.node* %39
}

LLVM IR (-O2):
%struct.tok = type { i32 }
%struct.node = type { i32 }
@.str = [8 x i8] c"Typedef\00"
@.str.1 = [5 x i8] c"name\00"
define %struct.node* @parsetypedef(%struct.tok* nocapture readnone %0, %struct.node* %1) {
%3 = tail call %struct.node* @newelement(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @setcommentnode(%struct.node* %3)
%5 = icmp eq %struct.node* %1, null
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @addnode(%struct.node* %3, %struct.node* %1)
br label %8
8: ; preds = %6, %2
%9 = tail call %struct.tok* (...) @lexnocomment()
%10 = tail call %struct.node* @parseextendedattributelist(%struct.tok* %9)
%11 = tail call %struct.node* @parsetype(%struct.tok* %9)
%12 = icmp eq %struct.node* %10, null
br i1 %12, label %15, label %13
13: ; preds = %8
%14 = tail call i32 @addnode(%struct.node* %11, %struct.node* %10)
br label %15
15: ; preds = %13, %8
%16 = tail call i32 @addnode(%struct.node* %3, %struct.node* %11)
%17 = tail call i32 @setidentifier(%struct.tok* %9)
%18 = tail call %struct.node* @newattr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%19 = tail call i32 @addnode(%struct.node* %3, %struct.node* %18)
%20 = tail call %struct.tok* (...) @lexnocomment()
ret %struct.node* %3
}