// File: /workspace/github_c_makefile_star2_O0/simh[P]simtools/converters/cosy/cosy.c
// Function: compressCard
int compressCard(
  FILE *dest
)
{
  int i, spcount = 0, len = strlen(card);

  for (i = 0; i < len; i++) {
    if (!VALID(card[i]))
      return 4;

    if (card[i] != ' ') {
      if (spcount != 0) {
        size_t l = strlen(compr[spcount]);

        if (fwrite(compr[spcount], sizeof(char), l, dest) != l)
          return 3;
        outcount += l;
        spcount = 0;
      }
      if (fputc(card[i], dest) == EOF)
        return 3;
      outcount++;
    } else {
      if (++spcount == MAXSPACES) {
        size_t l = strlen(compr[spcount]);

        if (fwrite(compr[spcount], sizeof(char), l, dest) != l)
          return 3;
        outcount += l;
        spcount = 0;
      }
    }
  }
  /*
   * Terminate the card image.
   */
  fwrite("\x5F\x5E", sizeof(char), 2, dest);
  outcount += 2;
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl $0x0, -0x18(%rbp)
leaq 0x3096(%rip), %rdi      # 0x42d0
callq 0x1070
movl %eax, -0x1c(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x13de
movslq -0x14(%rbp), %rcx
leaq 0x3070(%rip), %rax      # 0x42d0
movsbl (%rax,%rcx), %eax
cmpl $0x20, %eax
jl 0x1291
movslq -0x14(%rbp), %rcx
leaq 0x305c(%rip), %rax      # 0x42d0
movsbl (%rax,%rcx), %eax
cmpl $0x5e, %eax
jg 0x1291
movslq -0x14(%rbp), %rcx
leaq 0x3048(%rip), %rax      # 0x42d0
movsbl (%rax,%rcx), %eax
cmpl $0x26, %eax
jne 0x129d
movl $0x4, -0x4(%rbp)
jmp 0x140e
movslq -0x14(%rbp), %rcx
leaq 0x3028(%rip), %rax      # 0x42d0
movsbl (%rax,%rcx), %eax
cmpl $0x20, %eax
je 0x135b
cmpl $0x0, -0x18(%rbp)
je 0x1321
movslq -0x18(%rbp), %rcx
leaq 0x2dea(%rip), %rax      # 0x40b0
movq (%rax,%rcx,8), %rdi
callq 0x1070
movq %rax, -0x28(%rbp)
movslq -0x18(%rbp), %rcx
leaq 0x2dd2(%rip), %rax      # 0x40b0
movq (%rax,%rcx,8), %rdi
movq -0x28(%rbp), %rdx
movq -0x10(%rbp), %rcx
movl $0x1, %esi
callq 0x1110
cmpq -0x28(%rbp), %rax
je 0x1306
movl $0x3, -0x4(%rbp)
jmp 0x140e
movq -0x28(%rbp), %rcx
movslq 0x2fb3(%rip), %rax      # 0x42c4
addq %rcx, %rax
movl %eax, 0x2faa(%rip)      # 0x42c4
movl $0x0, -0x18(%rbp)
movslq -0x14(%rbp), %rcx
leaq 0x2fa4(%rip), %rax      # 0x42d0
movsbl (%rax,%rcx), %edi
movq -0x10(%rbp), %rsi
callq 0x10a0
cmpl $-0x1, %eax
jne 0x134a
movl $0x3, -0x4(%rbp)
jmp 0x140e
movl 0x2f74(%rip), %eax      # 0x42c4
addl $0x1, %eax
movl %eax, 0x2f6b(%rip)      # 0x42c4
jmp 0x13ce
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
cmpl $0x3e, %eax
jne 0x13cc
movslq -0x18(%rbp), %rcx
leaq 0x2d3c(%rip), %rax      # 0x40b0
movq (%rax,%rcx,8), %rdi
callq 0x1070
movq %rax, -0x30(%rbp)
movslq -0x18(%rbp), %rcx
leaq 0x2d24(%rip), %rax      # 0x40b0
movq (%rax,%rcx,8), %rdi
movq -0x30(%rbp), %rdx
movq -0x10(%rbp), %rcx
movl $0x1, %esi
callq 0x1110
cmpq -0x30(%rbp), %rax
je 0x13b1
movl $0x3, -0x4(%rbp)
jmp 0x140e
movq -0x30(%rbp), %rcx
movslq 0x2f08(%rip), %rax      # 0x42c4
addq %rcx, %rax
movl %eax, 0x2eff(%rip)      # 0x42c4
movl $0x0, -0x18(%rbp)
jmp 0x13ce
jmp 0x13d0
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x1249
movq -0x10(%rbp), %rcx
leaq 0xdfa(%rip), %rdi       # 0x21e3
movl $0x1, %esi
movl $0x2, %edx
callq 0x1110
movl 0x2ec6(%rip), %eax      # 0x42c4
addl $0x2, %eax
movl %eax, 0x2ebd(%rip)      # 0x42c4
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)