// File: /workspace/github_c_makefile_star2_O0/sisshiki1969[P]monocc/src/parse.c
// Function: parse_struct_specifier
Type *parse_struct_specifier(bool allow_undefined_tag) {
  Type *struct_ty = new_type_struct();
  // struct-or-union-specifier
  TagName *tag = NULL;
  // tag_name: Token of tag-name
  Token *tag_name = NULL;
  if (peek(TK_IDENT)) tag_name = consume();
  if (consume_if(TK_OP_BRACE)) {
    // struct-declaration-list
    if (find_tag(tag_name))
      error_at_token(tag_name, "Duplicate definition of a tag name.");
    tag = new_tag(tag_name, struct_ty);
    // struct-specifier
    MemberInfo head;
    head.next = NULL;
    MemberInfo *cursor = &head;
    int offset = 0;
    while (!consume_if(TK_CL_BRACE)) {
      // struct-declaration
      MemberInfo *ty_ident = parse_decl(false);
      Token *ident = ty_ident->ident;
      Type *type = ty_ident->type;
      if (!ident) error_at_token(token, "Missing Identifier.");
      // check duplicate member definition
      MemberInfo *ty = head.next;
      while (ty) {
        if (cmp_token(ty->ident, ident))
          error_at_token(ident, "Duplicate member.");
        ty = ty->next;
      }

      int align = alignof_type(type);
      offset = align_to(offset, align);
      ty_ident->offset = offset;
      offset += sizeof_type(type);
      cursor->next = ty_ident;
      cursor = ty_ident;
      expect(TK_SEMI);
    }
    struct_ty->member = head.next;
    if (tag) tag->type = struct_ty;
    return struct_ty;
  } else {
    if (!tag_name)
      error_at_token(token, "Expected either of a tag name  or a definition.");
    tag = find_tag(tag_name);
    if (!tag) {
      if (allow_undefined_tag) {
        struct_ty->tag_name = tag_name;
      } else
        error_at_token(tag_name, "Tag name is not defined.");
    } else {
      struct_ty = tag->type;
    }
    return struct_ty;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movb %dil, %al
andb $0x1, %al
movb %al, -0x9(%rbp)
movb $0x0, %al
callq 0xd220
movq %rax, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
xorl %edi, %edi
callq 0x77d0
testb $0x1, %al
jne 0xa11b
jmp 0xa124
callq 0x7830
movq %rax, -0x28(%rbp)
movl $0x1f, %edi
callq 0x7860
testb $0x1, %al
jne 0xa137
jmp 0xa29a
movq -0x28(%rbp), %rdi
callq 0x7ee0
cmpq $0x0, %rax
je 0xa158
movq -0x28(%rbp), %rdi
leaq 0x657d(%rip), %rsi      # 0x106ce
movb $0x0, %al
callq 0x5d20
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x7e50
movq %rax, -0x20(%rbp)
movq $0x0, -0x48(%rbp)
leaq -0x48(%rbp), %rax
movq %rax, -0x50(%rbp)
movl $0x0, -0x54(%rbp)
movl $0x20, %edi
callq 0x7860
xorb $-0x1, %al
testb $0x1, %al
jne 0xa195
jmp 0xa271
xorl %edi, %edi
callq 0x8b40
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x70(%rbp)
cmpq $0x0, -0x68(%rbp)
jne 0xa1d7
leaq 0xb052(%rip), %rax      # 0x15218
movq (%rax), %rdi
leaq 0x6522(%rip), %rsi      # 0x106f2
movb $0x0, %al
callq 0x5d20
movq -0x48(%rbp), %rax
movq %rax, -0x78(%rbp)
cmpq $0x0, -0x78(%rbp)
je 0xa21c
movq -0x78(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x68(%rbp), %rsi
callq 0x79f0
testb $0x1, %al
jne 0xa1fd
jmp 0xa20f
movq -0x68(%rbp), %rdi
leaq 0x64fe(%rip), %rsi      # 0x10706
movb $0x0, %al
callq 0x5d20
movq -0x78(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x78(%rbp)
jmp 0xa1df
movq -0x70(%rbp), %rdi
callq 0xd7b0
movl %eax, -0x7c(%rbp)
movl -0x54(%rbp), %edi
movl -0x7c(%rbp), %esi
callq 0xd6f0
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %ecx
movq -0x60(%rbp), %rax
movl %ecx, 0x18(%rax)
movq -0x70(%rbp), %rdi
callq 0xd640
addl -0x54(%rbp), %eax
movl %eax, -0x54(%rbp)
movq -0x60(%rbp), %rcx
movq -0x50(%rbp), %rax
movq %rcx, (%rax)
movq -0x60(%rbp), %rax
movq %rax, -0x50(%rbp)
movl $0x1c, %edi
callq 0x7980
jmp 0xa180
movq -0x48(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x20(%rax)
cmpq $0x0, -0x20(%rbp)
je 0xa290
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xa309
cmpq $0x0, -0x28(%rbp)
jne 0xa2b9
leaq 0xaf70(%rip), %rax      # 0x15218
movq (%rax), %rdi
leaq 0x6466(%rip), %rsi      # 0x10718
movb $0x0, %al
callq 0x5d20
movq -0x28(%rbp), %rdi
callq 0x7ee0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0xa2f5
testb $0x1, -0x9(%rbp)
je 0xa2e1
movq -0x28(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x30(%rax)
jmp 0xa2f3
movq -0x28(%rbp), %rdi
leaq 0x645c(%rip), %rsi      # 0x10748
movb $0x0, %al
callq 0x5d20
jmp 0xa301
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)