// File: /workspace/github_c_makefile_star2_O0/42Bastian[P]lyxass/label.c
// Function: writeSymbols
void writeSymbols(char *fn, int hex)
{
  label_t * next;
  int i;
  FILE *fh;
  char *help = fn + strlen(fn);

  while ( *help != '.' )
    --help;

  ++help;
  *help = 0;

  help = my_malloc((long)strlen(fn)+4UL);
  strcpy(help,fn);
  strcat(help,"equ");
  if ( (fh = fopen(help,"w")) == NULL ){
    Error(-WRITE_ERR,fn);
    return;
  }

  for (i = 0; i < 256; ++i){
    for( next = hash[i] ; next ; next = next->next ){
      if ( !(next->type & UNSOLVED) && (next->type & GLOBAL)){
        if ( Global.mainMode == JAGUAR_DSP || Global.mainMode == JAGUAR_GPU ){
          if ( hex ){
            fprintf(fh,"%-24s EQU $%016"PRIx64"\n",next->name,next->value);
          } else {
            fprintf(fh,"%-24s EQU %"PRIi64"\n",next->name,next->value);
          }
        } else {
          if ( hex ){
            fprintf(fh,"%-24s EQU $%08x\n",next->name,(uint32_t)next->value);
          } else {
            fprintf(fh,"%-24s EQU %d\n",next->name,(uint32_t)next->value);
          }
        }
      }
    }
  }
  fclose(fh);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
callq 0x30a0
movq %rax, %rcx
movq -0x38(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2e, %eax
je 0x72a8
movq -0x30(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x728e
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movb $0x0, (%rax)
movq -0x8(%rbp), %rdi
callq 0x30a0
movq %rax, %rdi
addq $0x4, %rdi
callq 0x32e0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x3060
movq -0x30(%rbp), %rdi
leaq 0x9ede(%rip), %rsi      # 0x111ca
callq 0x3190
movq -0x30(%rbp), %rdi
leaq 0x9ed2(%rip), %rsi      # 0x111ce
callq 0x3180
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
jne 0x731e
movq -0x8(%rbp), %rsi
movl $0xffffffd7, %edi       # imm = 0xFFFFFFD7
callq 0xd130
jmp 0x7460
movl $0x0, -0x1c(%rbp)
cmpl $0x100, -0x1c(%rbp)     # imm = 0x100
jge 0x7457
movslq -0x1c(%rbp), %rcx
leaq 0x19c23(%rip), %rax     # 0x20f60
movq (%rax,%rcx,8), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x7447
movq -0x18(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x80, %eax
cmpl $0x0, %eax
jne 0x7434
movq -0x18(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x7434
leaq 0x11021(%rip), %rax     # 0x183a0
cmpl $0x3, 0x1c(%rax)
je 0x7392
leaq 0x11014(%rip), %rax     # 0x183a0
cmpl $0x2, 0x1c(%rax)
jne 0x73e0
cmpl $0x0, -0xc(%rbp)
je 0x73bc
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rdx
addq $0x38, %rdx
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rcx
leaq 0x9e1d(%rip), %rsi      # 0x111d0
movb $0x0, %al
callq 0x3120
jmp 0x73de
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rdx
addq $0x38, %rdx
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rcx
leaq 0x9e0c(%rip), %rsi      # 0x111e3
movb $0x0, %al
callq 0x3120
jmp 0x7432
cmpl $0x0, -0xc(%rbp)
je 0x740c
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rdx
addq $0x38, %rdx
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movl %eax, %ecx
leaq 0x9def(%rip), %rsi      # 0x111f2
movb $0x0, %al
callq 0x3120
jmp 0x7430
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rdx
addq $0x38, %rdx
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movl %eax, %ecx
leaq 0x9dda(%rip), %rsi      # 0x11203
movb $0x0, %al
callq 0x3120
jmp 0x7432
jmp 0x7434
jmp 0x7436
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x7345
jmp 0x7449
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x7325
movq -0x28(%rbp), %rdi
callq 0x3090
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)