// File: /workspace/github_c_makefile_star2_O1/hikalium[P]compilium/ast.c
// Function: PrintASTNodeSub
static void PrintASTNodeSub(struct Node *n, int depth) {
  if (!n) {
    fprintf(stderr, "(null)");
    return;
  }
  if (IsToken(n)) {
    PrintTokenBrief(n);
    return;
  }
  if (n->type == kASTList) {
    fprintf(stderr, "[");
    if (GetSizeOfList(n) == 0) {
      fprintf(stderr, "]");
      return;
    }
    for (int i = 0; i < GetSizeOfList(n); i++) {
      fprintf(stderr, "%s\n", i ? "," : "");
      PrintPadding(depth + 1);
      PrintASTNodeSub(GetNodeAt(n, i), depth + 1);
    }
    fprintf(stderr, "\n");
    PrintPadding(depth);
    fprintf(stderr, "]");
    return;
  } else if (n->type == kASTStructSpec) {
    fprintf(stderr, "StructSpec: ");
    PrintASTNodeSub(n->struct_member_dict, depth);
    return;
  } else if (n->type == kASTKeyValue) {
    fprintf(stderr, "%s: ", n->key);
    PrintASTNodeSub(n->value, depth);
    return;
  } else if (n->type == kNodeStructMember) {
    fprintf(stderr, "Member +%d: ", n->struct_member_ent_ofs);
    PrintASTNodeSub(n->struct_member_ent_type, depth);
    return;
  } else if (n->type == kNodeMacroReplacement) {
    fprintf(stderr, "MacroReplacement<args: ");
    PrintASTNodeSub(n->arg_expr_list, depth);
    fprintf(stderr, ", rep: ");
    PrintTokenSequence(n->value);
    fprintf(stderr, ">");
    return;
  } else if (n->type == kTypeBase) {
    PrintTokenStrToFile(n->op, stderr);
    return;
  } else if (n->type == kTypeLValue) {
    fprintf(stderr, "lvalue<");
    PrintASTNodeSub(n->right, depth);
    fprintf(stderr, ">");
    return;
  } else if (n->type == kTypePointer) {
    fprintf(stderr, "pointer_of<");
    PrintASTNodeSub(n->right, depth);
    fprintf(stderr, ">");
    return;
  } else if (n->type == kTypeFunction) {
    fprintf(stderr, "function<returns: ");
    PrintASTNodeSub(n->left, depth);
    fprintf(stderr, ", args: ");
    PrintASTNodeSub(n->right, depth);
    fprintf(stderr, ">");
    return;
  } else if (n->type == kTypeStruct) {
    fprintf(stderr, "struct<tag: ");
    PrintASTNodeSub(n->tag, depth);
    if (!n->type_struct_spec) {
      fprintf(stderr, ", incomplete");
    }
    fprintf(stderr, ">");
    return;
  } else if (n->type == kTypeArray) {
    fprintf(stderr, "array_of<");
    PrintASTNodeSub(n->type_array_type_of, depth);
    fprintf(stderr, ">[");
    PrintASTNodeSub(n->type_array_index_decl, depth);
    fprintf(stderr, "]");
    return;
  } else if (n->type == kTypeAttrIdent) {
    fputc('`', stderr);
    PrintTokenStrToFile(n->left, stderr);
    fputc('`', stderr);
    fprintf(stderr, " has a type: ");
    PrintASTNodeSub(n->right, depth);
    return;
  } else if (n->type == kASTFuncDef) {
    fprintf(stderr, "FuncDef ");
    PrintASTNodeSub(n->func_name_token, depth);
    fprintf(stderr, " : ");
    PrintASTNodeSub(n->func_type, depth);
    fprintf(stderr, "{\n");
    PrintPadding(depth + 1);
    PrintASTNodeSub(n->func_body, depth + 1);
    fprintf(stderr, "\n");
    PrintPadding(depth);
    fprintf(stderr, "}");
    return;
  } else if (n->type == kASTExprStmt) {
    PrintASTNodeSub(n->left, depth);
    fprintf(stderr, ";");
    return;
  } else if (n->type == kASTExprFuncCall) {
    fprintf(stderr, "FuncCall<");
    PrintASTNodeSub(n->func_expr, depth);
    fprintf(stderr, ">(");
    PrintASTNodeSub(n->arg_expr_list, depth);
    fprintf(stderr, ")");
    return;
  }
  fprintf(stderr, "(op=");
  if (n->op) PrintTokenBrief(n->op);
  if (n->expr_type) {
    fprintf(stderr, ":");
    PrintASTNodeSub(n->expr_type, depth + 1);
  }
  if (n->reg) fprintf(stderr, " reg: %d", n->reg);
  if (n->cond) {
    fprintf(stderr, " cond=");
    PrintASTNodeSub(n->cond, depth + 1);
  }
  if (n->left) {
    fprintf(stderr, " L=");
    PrintASTNodeSub(n->left, depth + 1);
  }
  if (n->right) {
    fprintf(stderr, " R=");
    PrintASTNodeSub(n->right, depth + 1);
  }
  fprintf(stderr, ")");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
leaq 0x6eb2(%rip), %r12      # 0xb2f4
movq 0xcbaf(%rip), %r15      # 0x10ff8
leaq 0x70ba(%rip), %r13      # 0xb50a
movq %rsp, %rbp
testq %r14, %r14
je 0x461b
movq %r14, %rdi
callq 0x9130
testb %al, %al
jne 0x458a
movl (%r14), %eax
addl $-0x2, %eax
cmpl $0x18, %eax
ja 0x4600
movslq (%r12,%rax,4), %rax
addq %r12, %rax
jmpq *%rax
movq (%r15), %rdi
movl 0x80(%r14), %edx
leaq 0x7082(%rip), %rsi      # 0xb517
xorl %eax, %eax
callq 0x2110
movq 0x70(%r14), %r14
jmp 0x4453
movq %r14, %rdi
movq %rbp, %rsi
callq 0x23f0
movq (%rsp), %r14
jmp 0x4453
movq (%r15), %rdi
movq 0x98(%r14), %rdx
leaq 0x81c4(%rip), %rsi      # 0xc688
xorl %eax, %eax
callq 0x2110
movq 0xa0(%r14), %r14
jmp 0x4453
movq (%r15), %rcx
movl $0xc, %esi
movl $0x1, %edx
movq %r13, %rdi
callq 0x21b0
movq 0x68(%r14), %r14
jmp 0x4453
movq 0x18(%r14), %rdi
movl %ebx, %esi
callq 0x442b
movq (%r15), %rsi
movl $0x3b, %edi
jmp 0x455d
movq (%r15), %rsi
movl $0x5b, %edi
callq 0x20d0
movq %r14, %rdi
callq 0x4922
testl %eax, %eax
je 0x4555
movq %r14, %rdi
callq 0x4922
testl %eax, %eax
jg 0x460c
movq (%r15), %rsi
movl $0xa, %edi
callq 0x20d0
testl %ebx, %ebx
jle 0x4555
movq (%r15), %rsi
movl $0x20, %edi
callq 0x20d0
decl %ebx
jne 0x4544
movq (%r15), %rsi
movl $0x5d, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x20d0
movq 0x10(%r14), %rdi
movq (%r15), %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x939d
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9378
movq %r14, %rdi
movl %ebx, %esi
callq 0x252a
jmp 0x4620
movq %r14, %rdi
movl %ebx, %esi
callq 0x230e
jmp 0x4620
movq %r14, %rdi
movl %ebx, %esi
callq 0x2297
jmp 0x4620
movq %r14, %rdi
movl %ebx, %esi
callq 0x25dc
jmp 0x4620
movq %r14, %rdi
movl %ebx, %esi
callq 0x261d
jmp 0x4620
movq %r14, %rdi
movl %ebx, %esi
callq 0x244e
jmp 0x4620
movq %r14, %rdi
movl %ebx, %esi
callq 0x259b
jmp 0x4620
movq %r14, %rdi
movl %ebx, %esi
callq 0x24c5
jmp 0x4620
movq %r14, %rdi
movl %ebx, %esi
callq 0x2729
jmp 0x4620
movl %ebx, %edi
movq %r14, %rsi
callq 0x2692
jmp 0x4533
callq 0x2828
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop