// File: /workspace/github_c_makefile_star2_O0/mrkite[P]regs/docmaker/compiler.cc
// Function: Compiler::calculateSizes(Symbol*)
bool Compiler::calculateSizes(Symbol *s) {
  s->isSizing = true;
  switch (s->kind) {
    case isFunction:
      s->size = 4;
      break;
    case isAlias:
    case isRef:
      s->size = calcRefSize(s->asAlias, s);
      break;
    case isStruct:
      s->size = calcStructSize(s->asStruct, s);
      if (s->size < 0) {
        return false;
      }
      break;
    case isUnion:
      s->size = calcUnionSize(s->asStruct, s);
      if (s->size < 0) {
        return false;
      }
      break;
    case isEnum:
      if (!s->asEnum->type->isKnown) {
        refErr(s->asEnum->type, "Unknown type: '%s'\n",
               s->asEnum->type->name.c_str());
        return false;
      }
      if (!s->asEnum->type->isSized) {
        if (s->asEnum->type->isSizing) {
          defErr(s, "Recurisve type found: '%s'\n", s->name.c_str());
          return false;
        }
        if (!calculateSizes(s->asEnum->type)) {
          return false;
        }
      }
      s->size = s->asEnum->type->size;
      break;
    case isIntrinsic:
      switch (s->asIntrinsic) {
        case U8:
        case S8:
          s->size = 1;
          break;
        case U16:
        case S16:
          s->size = 2;
          break;
        case U32:
        case S32:
          s->size = 4;
          break;
        default:
          defErr(s, "Unknown intrinsic\n");
          return false;
      }
      break;
    default:
      defErr(s, "Uknown symbol type\n");
      return false;
  }
  s->isSized = true;
  s->isSizing = false;
  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movb $0x1, 0x20(%rax)
movq -0x18(%rbp), %rax
movl 0x78(%rax), %eax
movq %rax, -0x20(%rbp)
subq $0x6, %rax
ja 0xba54
movq -0x20(%rbp), %rax
leaq 0x597c(%rip), %rcx      # 0x1119c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x18(%rbp), %rax
movl $0x4, 0x24(%rax)
jmp 0xba70
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x80(%rax), %rsi
movq -0x18(%rbp), %rdx
callq 0xbb90
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x24(%rax)
jmp 0xba70
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x80(%rax), %rsi
movq -0x18(%rbp), %rdx
callq 0xbcb0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x24(%rax)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x24(%rax)
jge 0xb893
movb $0x0, -0x1(%rbp)
jmp 0xba84
jmp 0xba70
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x80(%rax), %rsi
movq -0x18(%rbp), %rdx
callq 0xbe50
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x24(%rax)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x24(%rax)
jge 0xb8cc
movb $0x0, -0x1(%rbp)
jmp 0xba84
jmp 0xba70
movq -0x18(%rbp), %rax
movq 0x80(%rax), %rax
movq (%rax), %rax
testb $0x1, 0x28(%rax)
jne 0xb92c
movq -0x18(%rbp), %rax
movq 0x80(%rax), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq 0x80(%rax), %rax
movq (%rax), %rdi
callq 0x3100
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq %rax, %rcx
leaq 0x589c(%rip), %rdx      # 0x111b8
movb $0x0, %al
callq 0xb6e0
movb $0x0, -0x1(%rbp)
jmp 0xba84
movq -0x18(%rbp), %rax
movq 0x80(%rax), %rax
movq (%rax), %rax
testb $0x1, 0x21(%rax)
jne 0xb9ad
movq -0x18(%rbp), %rax
movq 0x80(%rax), %rax
movq (%rax), %rax
testb $0x1, 0x20(%rax)
je 0xb987
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rdi
callq 0x3100
movq -0x28(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq %rax, %rcx
leaq 0x58ac(%rip), %rdx      # 0x11223
movb $0x0, %al
callq 0xba90
movb $0x0, -0x1(%rbp)
jmp 0xba84
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x80(%rax), %rax
movq (%rax), %rsi
callq 0xb7e0
testb $0x1, %al
jne 0xb9ab
movb $0x0, -0x1(%rbp)
jmp 0xba84
jmp 0xb9ad
movq -0x18(%rbp), %rax
movq 0x80(%rax), %rax
movq (%rax), %rax
movl 0x24(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x24(%rax)
jmp 0xba70
movq -0x18(%rbp), %rax
movl 0x80(%rax), %eax
movl %eax, -0x3c(%rbp)
testl %eax, %eax
je 0xba0f
jmp 0xb9dd
movl -0x3c(%rbp), %eax
subl $0x1, %eax
je 0xba1c
jmp 0xb9e7
movl -0x3c(%rbp), %eax
subl $0x2, %eax
je 0xba29
jmp 0xb9f1
movl -0x3c(%rbp), %eax
subl $0x3, %eax
je 0xba0f
jmp 0xb9fb
movl -0x3c(%rbp), %eax
subl $0x4, %eax
je 0xba1c
jmp 0xba05
movl -0x3c(%rbp), %eax
subl $0x5, %eax
je 0xba29
jmp 0xba36
movq -0x18(%rbp), %rax
movl $0x1, 0x24(%rax)
jmp 0xba52
movq -0x18(%rbp), %rax
movl $0x2, 0x24(%rax)
jmp 0xba52
movq -0x18(%rbp), %rax
movl $0x4, 0x24(%rax)
jmp 0xba52
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq 0x57fa(%rip), %rdx      # 0x1123f
movb $0x0, %al
callq 0xba90
movb $0x0, -0x1(%rbp)
jmp 0xba84
jmp 0xba70
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rsi
leaq 0x57ef(%rip), %rdx      # 0x11252
movb $0x0, %al
callq 0xba90
movb $0x0, -0x1(%rbp)
jmp 0xba84
movq -0x18(%rbp), %rax
movb $0x1, 0x21(%rax)
movq -0x18(%rbp), %rax
movb $0x0, 0x20(%rax)
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x40, %rsp
popq %rbp
retq
nop