user: Converte this assembly snippet into its equivalent C code:

```asm
<bytemapmag>:
  endbr64
  push   %r15
  push   %r14
  mov    %rdi,%r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xd8,%rsp
  mov    %esi,0x7c(%rsp)
  mov    %edx,0xc8(%rsp)
  test   %rdi,%rdi
  je     L1470
  mov    %esi,%ebp
  test   %esi,%esi
  jle    L1470
  mov    %edx,%edi
  test   %edx,%edx
  jle    L1470
  mov    %esi,%eax
  imul   %edx,%eax
  cmp    $0x186a0,%eax
  jg     L1470
  lea    -0x1(%rcx),%eax
  mov    %ecx,%r13d
  cmp    $0x9,%eax
  ja     L1470
  mov    %esi,%r15d
  imul   %ecx,%r15d
  mov    %r15d,%ebx
  mov    %r15d,0xbc(%rsp)
  imul   %ecx,%ebx
  imul   %ebx,%edi
  call   <malloc@plt>
  mov    %rax,0x80(%rsp)
  test   %rax,%rax
  je     L1470
  mov    %rax,0xa8(%rsp)
  movslq %ebx,%rax
  mov    $0xffffffff,%ecx
  mov    %rax,0xc0(%rsp)
  movslq %ebp,%rax
  mov    %rax,0xb0(%rsp)
  movslq %r13d,%rax
  mov    %rax,%rsi
  mov    %rax,0x88(%rsp)
  lea    0x1(%rax),%eax
  mov    %eax,0x90(%rsp)
  movslq %r15d,%rax
  mov    %r14,%r15
  mov    %esi,%r14d
  mov    %rax,0x58(%rsp)
  mov    $0x1,%eax
  sub    %ebp,%eax
  movl   $0x0,0x8(%rsp)
  mov    %eax,0x98(%rsp)
  mov    $0x2,%eax
  movq   $0x0,0xa0(%rsp)
  sub    %ebp,%eax
  test   %ebp,%ebp
  mov    %eax,0x94(%rsp)
  mov    $0x1,%eax
  movl   $0x0,0x9c(%rsp)
  cmovg  %ebp,%eax
  sub    $0x1,%eax
  mov    %eax,0xcc(%rsp)
L861:
  movslq %ecx,%rax
  mov    0x94(%rsp),%edi
  movl   $0x1,0x30(%rsp)
  lea    (%r15,%rax,1),%rsi
  add    0xb0(%rsp),%rax
  movl   $0x0,0x50(%rsp)
  lea    (%r15,%rax,1),%r10
  mov    0x98(%rsp),%eax
  lea    (%rdi,%rcx,1),%edx
  movzbl 0x1(%rsi),%r11d
  mov    %rsi,0x10(%rsp)
  add    %ecx,%eax
  add    $0x1,%ecx
  mov    %r11d,%r12d
  mov    %ecx,0xb8(%rsp)
  mov    0x80(%rsp),%rcx
  cltq
  add    0xa0(%rsp),%rcx
  mov    %rax,0x18(%rsp)
  movslq %edx,%rax
  mov    %rcx,0x28(%rsp)
  mov    0x90(%rsp),%ecx
  mov    %rax,0x20(%rsp)
  mov    %ecx,0xc(%rsp)
  nopl   0x0(%rax)
L1072:
  mov    0x30(%rsp),%eax
  mov    0x28(%rsp),%rcx
  jmp    L267
  cs nopw 0x0(%rax,%rax,1)
L782:
  mov    0x18(%rsp),%rdi
  mov    0x20(%rsp),%rbx
  movzbl (%r15,%rdi,1),%edi
  movzbl (%r15,%rbx,1),%r13d
  movzbl 0x2(%r10),%ebx
  mov    %edi,%ebp
  cmp    $0x2,%r14d
  je     L709
L995:
  cmp    $0x3,%r14d
  jne    L1478
  cmp    $0x1,%eax
  je     L1238
  cmp    $0x2,%eax
  je     L771
  cmp    $0x3,%eax
  jne    L176
L1085:
  mov    %edi,%ebx
  sub    %edx,%ebx
  mov    %ebx,%r9d
  neg    %r9d
  cmovs  %ebx,%r9d
  cmp    $0x40,%r9d
  jg     L1478
  sub    %r11d,%edi
  mov    %edi,%r9d
  neg    %r9d
  cmovs  %edi,%r9d
  cmp    $0x40,%r9d
  jle    L1478
  sub    %esi,%edx
  mov    %edx,%esi
  neg    %esi
  cmovns %esi,%edx
  cmp    $0x40,%edx
  jle    L1478
L594:
  mov    %r8b,(%rcx)
  xchg   %ax,%ax
L1478:
  add    $0x1,%rcx
  add    $0x1,%eax
  cmp    0xc(%rsp),%eax
  je     L116
L267:
  mov    0x10(%rsp),%rdi
  mov    %r12b,(%rcx)
  movzbl 0x1(%r10),%esi
  movzbl 0x2(%rdi),%edx
  mov    0x8(%rsp),%edi
  mov    %esi,%r9d
  mov    %edx,%r8d
  test   %edi,%edi
  jne    L782
  movzbl 0x2(%r10),%ebx
  mov    %r12d,%ebp
  mov    %r11d,%edi
  mov    %r11d,%r13d
  cmp    $0x2,%r14d
  jne    L995
L709:
  cmp    $0x1,%eax
  je     L71
  cmp    $0x2,%eax
  je     L1085
  cmp    $0x4,%eax
  jne    L1008
  mov    %edx,%ebx
  sub    %esi,%ebx
  mov    %ebx,%r8d
  neg    %r8d
  cmovs  %ebx,%r8d
  cmp    $0x40,%r8d
  jg     L1478
  sub    %edi,%edx
  mov    %edx,%edi
  neg    %edi
  cmovs  %edx,%edi
  sub    %r11d,%esi
  cmp    $0x40,%edi
  jle    L1478
L784:
  mov    %esi,%edx
  neg    %edx
  cmovs  %esi,%edx
  cmp    $0x40,%edx
  jle    L1478
  mov    %r9b,(%rcx)
  add    $0x1,%eax
  add    $0x1,%rcx
  cmp    0xc(%rsp),%eax
  jne    L267
  nopl   0x0(%rax)
L116:
  mov    0x50(%rsp),%eax
  mov    0x58(%rsp),%rcx
  add    %r14d,0xc(%rsp)
  lea    0x1(%rax),%r13d
  add    %rcx,0x28(%rsp)
  add    %r14d,0x30(%rsp)
  cmp    %r13d,%r14d
  je     L678
  mov    %r13d,0x50(%rsp)
  jmp    L1072
L1470:
  movq   $0x0,0xa8(%rsp)
L1060:
  mov    0xa8(%rsp),%rax
  add    $0xd8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L176:
  cmp    $0x4,%eax
  je     L1478
  cmp    $0x6,%eax
  jne    L154
  mov    %edi,%ebp
  sub    %edx,%ebp
  mov    %ebp,%r9d
  neg    %r9d
  cmovs  %ebp,%r9d
  cmp    $0x40,%r9d
  jg     L1421
  mov    %edi,%ebp
  sub    %r11d,%ebp
  mov    %ebp,%r9d
  neg    %r9d
  cmovs  %ebp,%r9d
  cmp    $0x40,%r9d
  jle    L1421
  mov    %edx,%ebp
  sub    %esi,%ebp
  mov    %ebp,%r9d
  neg    %r9d
  cmovs  %ebp,%r9d
  cmp    $0x40,%r9d
  jle    L516
  mov    %r11d,%esi
  sub    %ebx,%esi
L285:
  mov    %esi,%edx
  neg    %edx
  cmovs  %esi,%edx
  cmp    $0x40,%edx
  jle    L1478
  jmp    L594
  nopw   0x0(%rax,%rax,1)
L771:
  mov    %edi,%r9d
  sub    %edx,%r9d
  mov    %r11d,%edx
  mov    %r9d,%r8d
  neg    %r8d
  cmovs  %r9d,%r8d
  sub    %edi,%edx
  mov    %edx,%edi
  neg    %edi
  cmovs  %edx,%edi
  cmp    $0x40,%edi
  jg     L1478
  mov    %r11d,%edx
  sub    %esi,%edx
  mov    %edx,%esi
  neg    %esi
  cmovs  %edx,%esi
  cmp    $0x40,%esi
  jle    L1478
  cmp    $0x40,%r8d
  jle    L1478
  mov    %r11d,%esi
  sub    %r13d,%esi
  mov    %esi,%edx
  neg    %edx
  cmovs  %esi,%edx
  cmp    $0x40,%edx
  jle    L1478
L1411:
  mov    %bpl,(%rcx)
  jmp    L1478
L1008:
  cmp    $0x3,%eax
  jne    L1478
L620:
  mov    %esi,%r9d
  sub    %r11d,%r9d
  mov    %r9d,%r8d
  neg    %r8d
  cmovs  %r9d,%r8d
  cmp    $0x40,%r8d
  jg     L1478
  sub    %edx,%esi
  mov    %esi,%edx
  neg    %edx
  cmovs  %esi,%edx
  cmp    $0x40,%edx
  jle    L1478
  mov    %r11d,%esi
  sub    %edi,%esi
  mov    %esi,%edx
  neg    %edx
  cmovs  %esi,%edx
  cmp    $0x40,%edx
  jle    L1478
L832:
  mov    %r12b,(%rcx)
  jmp    L1478
  nopl   0x0(%rax)
L71:
  mov    %r11d,%r9d
  sub    %edi,%r9d
  mov    %r9d,%r8d
  neg    %r8d
  cmovs  %r9d,%r8d
  cmp    $0x40,%r8d
  jg     L1478
  mov    %r11d,%r8d
  sub    %esi,%r8d
  mov    %r8d,%esi
  neg    %esi
  cmovs  %r8d,%esi
  cmp    $0x40,%esi
  jle    L1478
  sub    %edx,%edi
  mov    %edi,%edx
  neg    %edx
  cmovs  %edi,%edx
  cmp    $0x40,%edx
  jle    L1478
  jmp    L1411
  nopl   0x0(%rax)
L1238:
  mov    %r11d,%r9d
  sub    %edi,%r9d
  mov    %r9d,%r8d
  neg    %r8d
  cmovs  %r9d,%r8d
  cmp    $0x40,%r8d
  jg     L1478
  mov    %r11d,%r8d
  sub    %esi,%r8d
  mov    %r8d,%esi
  neg    %esi
  cmovs  %r8d,%esi
  cmp    $0x40,%esi
  jle    L1478
  sub    %edx,%edi
  mov    %edi,%edx
  neg    %edx
  cmovs  %edi,%edx
  cmp    $0x40,%edx
  jle    L1478
  jmp    L832
L154:
  cmp    $0x7,%eax
  je     L620
  cmp    $0x8,%eax
  jne    L629
  mov    %esi,%ebp
  sub    %r11d,%ebp
  mov    %ebp,%r8d
  neg    %r8d
  cmovs  %ebp,%r8d
  cmp    $0x40,%r8d
  jg     L1478
  sub    %edx,%esi
  mov    %esi,%edx
  neg    %edx
  cmovs  %esi,%edx
  cmp    $0x40,%edx
  jle    L1478
  mov    %r11d,%edx
  sub    %edi,%edx
  mov    %edx,%esi
  neg    %esi
  cmovs  %edx,%esi
  cmp    $0x40,%esi
  jle    L1478
  mov    %r11d,%esi
  sub    %ebx,%esi
  jmp    L784
L629:
  cmp    $0x9,%eax
  jne    L1478
  mov    %edx,%ebx
  sub    %esi,%ebx
  mov    %ebx,%r9d
  neg    %r9d
  cmovs  %ebx,%r9d
  cmp    $0x40,%r9d
  jg     L1478
  sub    %edi,%edx
  mov    %edx,%edi
  neg    %edi
  cmovs  %edx,%edi
  cmp    $0x40,%edi
  jle    L1478
  sub    %r11d,%esi
  jmp    L285
  nopl   0x0(%rax)
L1421:
  mov    %edx,%ebx
  sub    %esi,%ebx
  mov    %ebx,%r9d
  neg    %r9d
  cmovs  %ebx,%r9d
  cmp    $0x40,%r9d
  jg     L1478
L516:
  sub    %edi,%edx
  mov    %edx,%edi
  neg    %edi
  cmovs  %edx,%edi
  cmp    $0x40,%edi
  jle    L1478
  sub    %r11d,%esi
  mov    %esi,%edx
  neg    %edx
  cmovs  %esi,%edx
  cmp    $0x40,%edx
  jle    L1478
  mov    %r11d,%esi
  sub    %r13d,%esi
  jmp    L285
  nopl   0x0(%rax,%rax,1)
L678:
  cmpl   $0x1,0x7c(%rsp)
  je     L298
  movslq 0xb8(%rsp),%rax
  movl   $0x1,0x68(%rsp)
  mov    %r14d,0x64(%rsp)
  mov    %rax,%rcx
  lea    (%r15,%rax,1),%rbp
  add    0xb0(%rsp),%rax
  lea    (%r15,%rax,1),%r12
  mov    %ecx,%eax
  add    0x94(%rsp),%eax
  add    0x98(%rsp),%ecx
  mov    %eax,0x78(%rsp)
  mov    0x9c(%rsp),%eax
  mov    %ecx,0x6c(%rsp)
  add    $0x1,%eax
  imul   %r14d,%eax
  mov    %r13d,%r14d
  mov    %r15,%r13
  mov    %rbp,%r15
  cltq
  mov    %rax,0x70(%rsp)
  nopl   0x0(%rax)
L1426:
  movzbl 0x1(%r15),%eax
  movl   $0x1,0x54(%rsp)
  movl   $0x0,0x60(%rsp)
  mov    %al,0xc(%rsp)
  mov    %eax,0x40(%rsp)
  mov    0x70(%rsp),%rax
  add    0x80(%rsp),%rax
  mov    %rax,0x48(%rsp)
  mov    0x90(%rsp),%eax
  mov    %eax,0x10(%rsp)
  movslq 0x6c(%rsp),%rax
  mov    %rax,0x30(%rsp)
  movslq 0x78(%rsp),%rax
  mov    %rax,0x38(%rsp)
  mov    %r13,%rax
  mov    %r15,%r13
  mov    %rax,%r15
  nopw   0x0(%rax,%rax,1)
L193:
  mov    0x54(%rsp),%eax
  mov    0x48(%rsp),%r8
  jmp    L924
  xchg   %ax,%ax
L1042:
  mov    0x30(%rsp),%rbx
  movzbl (%r15,%rbx,1),%edi
  movzbl -0x1(%r15,%rbx,1),%ebx
  mov    %ebx,0x20(%rsp)
  mov    0x38(%rsp),%rbx
  mov    %edi,%ebp
  movzbl (%r15,%rbx,1),%ebx
  mov    %ebx,0x28(%rsp)
L1365:
  movzbl (%r12),%ebx
  mov    %ebx,0x18(%rsp)
  movzbl 0x2(%r12),%ebx
  cmp    $0x2,%r14d
  je     L1080
  cmp    $0x3,%r14d
  jne    L390
  mov    %ebx,0x44(%rsp)
  cmp    $0x1,%eax
  je     L1154
  cmp    $0x2,%eax
  je     L770
  cmp    $0x3,%eax
  jne    L1166
L287:
  mov    %edi,%r11d
  sub    %ecx,%r11d
  mov    %r11d,%r10d
  neg    %r10d
  cmovs  %r11d,%r10d
  cmp    $0x40,%r10d
  jg     L390
  sub    %esi,%edi
  mov    %edi,%esi
  neg    %esi
  cmovs  %edi,%esi
  sub    %edx,%ecx
  cmp    $0x40,%esi
  jle    L390
L88:
  mov    %ecx,%edx
  neg    %edx
  cmovs  %ecx,%edx
  cmp    $0x40,%edx
  jle    L390
L1083:
  mov    %r9b,(%r8)
  nopw   0x0(%rax,%rax,1)
L390:
  add    $0x1,%r8
  add    $0x1,%eax
  cmp    0x10(%rsp),%eax
  je     L39
L924:
  movzbl 0xc(%rsp),%ebx
  mov    0x8(%rsp),%ebp
  mov    %bl,(%r8)
  movzbl 0x0(%r13),%esi
  movzbl 0x2(%r13),%ecx
  movzbl 0x1(%r12),%edx
  mov    %esi,%r10d
  mov    %ecx,%r9d
  mov    %edx,%r11d
  test   %ebp,%ebp
  jne    L1042
  mov    %ebx,%ebp
  mov    0x40(%rsp),%ebx
  mov    %ebx,0x20(%rsp)
  mov    %ebx,%edi
  mov    %ebx,0x28(%rsp)
  jmp    L1365
  nopl   0x0(%rax,%rax,1)
L1080:
  cmp    $0x1,%eax
  je     L915
  cmp    $0x2,%eax
  je     L287
  cmp    $0x4,%eax
  jne    L881
  mov    %ecx,%r10d
  sub    %edx,%r10d
  mov    %r10d,%r9d
  neg    %r9d
  cmovs  %r10d,%r9d
  cmp    $0x40,%r9d
  jg     L390
  sub    %edi,%ecx
  mov    %ecx,%edi
  neg    %edi
  cmovs  %ecx,%edi
  cmp    $0x40,%edi
  jle    L390
  sub    %esi,%edx
  mov    %edx,%ecx
  neg    %ecx
  cmovns %ecx,%edx
  cmp    $0x40,%edx
  jle    L390
L628:
  mov    %r11b,(%r8)
  add    $0x1,%eax
  add    $0x1,%r8
  cmp    0x10(%rsp),%eax
  jne    L924
  nopl   (%rax)
L39:
  mov    0x64(%rsp),%esi
  mov    0x60(%rsp),%ecx
  mov    0x58(%rsp),%rdi
  add    %esi,0x54(%rsp)
  add    %esi,%eax
  add    %rdi,0x48(%rsp)
  lea    0x1(%rcx),%edx
  mov    %eax,0x10(%rsp)
  cmp    0x50(%rsp),%ecx
  je     L87
  mov    %edx,0x60(%rsp)
  jmp    L193
L881:
  cmp    $0x3,%eax
  jne    L390
L964:
  mov    %edx,%r11d
  sub    %esi,%r11d
  mov    %r11d,%r9d
  neg    %r9d
  cmovs  %r11d,%r9d
  cmp    $0x40,%r9d
  jg     L390
  sub    %ecx,%edx
  mov    %edx,%ecx
  neg    %ecx
  cmovs  %edx,%ecx
  cmp    $0x40,%ecx
  jle    L390
  sub    %edi,%esi
  mov    %esi,%edx
  neg    %edx
  cmovs  %esi,%edx
  cmp    $0x40,%edx
  jle    L390
L937:
  mov    %r10b,(%r8)
  jmp    L390
  nopl   0x0(%rax)
L915:
  mov    %esi,%r10d
  sub    %edi,%r10d
  mov    %r10d,%r9d
  neg    %r9d
  cmovs  %r10d,%r9d
  cmp    $0x40,%r9d
  jg     L390
  sub    %edx,%esi
  mov    %esi,%edx
  neg    %edx
  cmovs  %esi,%edx
  cmp    $0x40,%edx
  jle    L390
  sub    %ecx,%edi
  mov    %edi,%edx
  neg    %edx
  cmovs  %edi,%edx
  cmp    $0x40,%edx
  jle    L390
L303:
  mov    %bpl,(%r8)
  jmp    L390
L1166:
  cmp    $0x4,%eax
  jne    L597
  mov    %esi,%r11d
  mov    %edx,%ebx
  sub    %edi,%r11d
  mov    %r11d,%r9d
  neg    %r9d
  cmovs  %r11d,%r9d
  sub    %esi,%ebx
  mov    %ebx,%r11d
  neg    %r11d
  cmovs  %ebx,%r11d
  cmp    $0x40,%r11d
  jg     L488
  mov    %edx,%ebx
  sub    %ecx,%ebx
  mov    %ebx,%r11d
  neg    %r11d
  cmovs  %ebx,%r11d
  cmp    $0x40,%r11d
  jle    L488
  cmp    $0x40,%r9d
  jle    L431
  mov    0x40(%rsp),%ecx
  sub    0x20(%rsp),%ecx
L892:
  mov    %ecx,%edx
  neg    %edx
  cmovs  %ecx,%edx
  cmp    $0x40,%edx
  jle    L390
  jmp    L937
  cs nopw 0x0(%rax,%rax,1)
L770:
  mov    %edi,%r10d
  mov    %esi,%r11d
  sub    %ecx,%r10d
  mov    %r10d,%r9d
  neg    %r9d
  cmovs  %r10d,%r9d
  sub    %edi,%r11d
  mov    %r11d,%r10d
  neg    %r10d
  cmovs  %r11d,%r10d
  cmp    $0x40,%r10d
  jg     L706
  mov    %esi,%r11d
  sub    %edx,%r11d
  mov    %r11d,%r10d
  neg    %r10d
  cmovs  %r11d,%r10d
  cmp    $0x40,%r10d
  jle    L706
  cmp    $0x40,%r9d
  jle    L60
  mov    0x40(%rsp),%ecx
  sub    0x28(%rsp),%ecx
L124:
  mov    %ecx,%edx
  neg    %edx
  cmovs  %ecx,%edx
  cmp    $0x40,%edx
  jle    L390
  jmp    L303
  nopl   0x0(%rax,%rax,1)
L1154:
  mov    %esi,%r11d
  sub    %edi,%r11d
  mov    %r11d,%r9d
  neg    %r9d
  cmovs  %r11d,%r9d
  cmp    $0x40,%r9d
  jg     L390
  sub    %edx,%esi
  mov    %esi,%edx
  neg    %edx
  cmovs  %esi,%edx
  cmp    $0x40,%edx
  jle    L390
  sub    %ecx,%edi
  mov    %edi,%edx
  neg    %edx
  cmovs  %edi,%edx
  cmp    $0x40,%edx
  jle    L390
  jmp    L937
L597:
  cmp    $0x6,%eax
  jne    L825
  mov    %edi,%r11d
  sub    %ecx,%r11d
  mov    %r11d,%r10d
  neg    %r10d
  cmovs  %r11d,%r10d
  cmp    $0x40,%r10d
  jg     L931
  mov    %edi,%r11d
  sub    %esi,%r11d
  mov    %r11d,%r10d
  neg    %r10d
  cmovs  %r11d,%r10d
  cmp    $0x40,%r10d
  jle    L931
  mov    %ecx,%r11d
  sub    %edx,%r11d
  mov    %r11d,%r10d
  neg    %r10d
  cmovs  %r11d,%r10d
  cmp    $0x40,%r10d
  jle    L194
  mov    0x40(%rsp),%ecx
  sub    0x44(%rsp),%ecx
  jmp    L88
L825:
  cmp    $0x7,%eax
  je     L964
  cmp    $0x8,%eax
  jne    L1285
  mov    %edx,%r10d
  mov    %ecx,%ebx
  sub    %esi,%r10d
  mov    %r10d,%r9d
  neg    %r9d
  cmovs  %r10d,%r9d
  sub    %edx,%ebx
  mov    %ebx,%r10d
  neg    %r10d
  cmovs  %ebx,%r10d
  cmp    $0x40,%r10d
  jg     L534
  mov    %ecx,%ebx
  sub    %edi,%ebx
  mov    %ebx,%r10d
  neg    %r10d
  cmovs  %ebx,%r10d
  cmp    $0x40,%r10d
  jle    L534
  cmp    $0x40,%r9d
  jle    L1386
  mov    0x40(%rsp),%ecx
  sub    0x18(%rsp),%ecx
L1122:
  mov    %ecx,%edx
  neg    %edx
  cmovs  %ecx,%edx
  cmp    $0x40,%edx
  jle    L390
  jmp    L628
L1285:
  cmp    $0x9,%eax
  jne    L390
  mov    %ecx,%r11d
  sub    %edx,%r11d
  mov    %r11d,%r10d
  neg    %r10d
  cmovs  %r11d,%r10d
  cmp    $0x40,%r10d
  jg     L390
  sub    %edi,%ecx
  mov    %ecx,%edi
  neg    %edi
  cmovs  %ecx,%edi
  cmp    $0x40,%edi
  jle    L390
  sub    %esi,%edx
  mov    %edx,%ecx
  neg    %ecx
  cmovns %ecx,%edx
  cmp    $0x40,%edx
  jle    L390
  jmp    L1083
  nopl   0x0(%rax)
L534:
  cmp    $0x40,%r9d
  jg     L390
L1386:
  sub    %ecx,%edx
  mov    %edx,%ecx
  neg    %ecx
  cmovs  %edx,%ecx
  cmp    $0x40,%ecx
  jle    L390
  sub    %edi,%esi
  mov    %esi,%edx
  neg    %edx
  cmovs  %esi,%edx
  cmp    $0x40,%edx
  jle    L390
  mov    0x40(%rsp),%ecx
  sub    0x44(%rsp),%ecx
  jmp    L1122
  nopl   0x0(%rax,%rax,1)
L488:
  cmp    $0x40,%r9d
  jg     L390
L431:
  sub    %edx,%esi
  mov    %esi,%edx
  neg    %edx
  cmovs  %esi,%edx
  cmp    $0x40,%edx
  jle    L390
  sub    %ecx,%edi
  mov    %edi,%edx
  neg    %edx
  cmovs  %edi,%edx
  cmp    $0x40,%edx
  jle    L390
  mov    0x40(%rsp),%ecx
  sub    0x18(%rsp),%ecx
  jmp    L892
  nopl   0x0(%rax,%rax,1)
L706:
  cmp    $0x40,%r9d
  jg     L390
L60:
  sub    %esi,%edi
  mov    %edi,%esi
  neg    %esi
  cmovs  %edi,%esi
  cmp    $0x40,%esi
  jle    L390
  sub    %edx,%ecx
  mov    %ecx,%edx
  neg    %edx
  cmovs  %ecx,%edx
  cmp    $0x40,%edx
  jle    L390
  mov    0x40(%rsp),%ecx
  sub    0x20(%rsp),%ecx
  jmp    L124
  nopl   0x0(%rax,%rax,1)
L931:
  mov    %ecx,%r11d
  sub    %edx,%r11d
  mov    %r11d,%r10d
  neg    %r10d
  cmovs  %r11d,%r10d
  cmp    $0x40,%r10d
  jg     L390
L194:
  sub    %edi,%ecx
  mov    %ecx,%edi
  neg    %edi
  cmovs  %ecx,%edi
  cmp    $0x40,%edi
  jle    L390
  sub    %esi,%edx
  mov    %edx,%ecx
  neg    %ecx
  cmovs  %edx,%ecx
  cmp    $0x40,%ecx
  jle    L390
  mov    0x40(%rsp),%ecx
  sub    0x28(%rsp),%ecx
  jmp    L88
  nopl   0x0(%rax,%rax,1)
L87:
  mov    %r15,%rax
  mov    %r13,%r15
  addl   $0x1,0x68(%rsp)
  mov    0x88(%rsp),%rsi
  mov    %rax,%r13
  addl   $0x1,0x6c(%rsp)
  mov    0x68(%rsp),%eax
  add    $0x1,%r15
  addl   $0x1,0x78(%rsp)
  add    $0x1,%r12
  add    %rsi,0x70(%rsp)
  cmp    %eax,0x7c(%rsp)
  jne    L1426
  mov    0x64(%rsp),%r14d
  mov    %r13,%r15
L298:
  mov    0xbc(%rsp),%edi
  addl   $0x1,0x8(%rsp)
  add    %edi,0x9c(%rsp)
  mov    0xb8(%rsp),%ecx
  mov    0xc0(%rsp),%rdi
  mov    0x8(%rsp),%eax
  add    %rdi,0xa0(%rsp)
  add    0xcc(%rsp),%ecx
  cmp    %eax,0xc8(%rsp)
  jg     L861
  jmp    L1060
```

assistant: ```c
unsigned char *bytemapmag(unsigned char *bytemap, int width, int height, int magstep) {
  unsigned char *magnified = NULL;
  int irow, icol, mrow = 0, mcol = 0;
  int imap = (-1), byteval = 0;
  int isAdvMAME = 1;
  int icell[10], bmmdiff = 64;
  if (bytemap == NULL)
    goto end_of_job;
  if (width < 1 || height < 1)
    goto end_of_job;
  if (width * height > 100000)
    goto end_of_job;
  if (magstep < 1 || magstep > 10)
    goto end_of_job;
  if ((magnified = (unsigned char *)(malloc(magstep * width * magstep * height))) != NULL)
    for (irow = 0; irow < height; irow++)
      for (icol = 0; icol < width; icol++) {
        int imag1 = (icol + irow * (width * magstep)) * magstep;
        imap++;
        byteval = (int)(bytemap[imap]);
        for (mrow = 0; mrow < magstep; mrow++)
          for (mcol = 0; mcol < magstep; mcol++) {
            int idup = mcol + mrow * (width * magstep);
            int imag = imag1 + idup;
            magnified[imag] = (unsigned char)(byteval);
            if (isAdvMAME) {
              int mcell = 1 + mcol + magstep * mrow;
              icell[5] = byteval, icell[4] = (icol > 0 ? (int)(bytemap[imap - 1]) : byteval), icell[6] = (icol < width ? (int)(bytemap[imap + 1]) : byteval), icell[2] = (irow > 0 ? (int)(bytemap[imap - width]) : byteval), icell[8] = (irow < height ? (int)(bytemap[imap + width]) : byteval), icell[1] = (irow > 0 && icol > 0 ? (int)(bytemap[imap - width - 1]) : byteval), icell[3] = (irow > 0 && icol < width ? (int)(bytemap[imap - width + 1]) : byteval), icell[7] = (irow < height && icol > 0 ? (int)(bytemap[imap + width - 1]) : byteval), icell[9] = (irow < height && icol < width ? (int)(bytemap[imap + width + 1]) : byteval);
              switch (magstep) {
              default:
                break;
              case 2:
                if (mcell == 1)
                  if ((((((icell[4] - icell[2])) >= 0 ? ((icell[4] - icell[2])) : (-((icell[4] - icell[2])))) <= bmmdiff)) && !(((((icell[4] - icell[8])) >= 0 ? ((icell[4] - icell[8])) : (-((icell[4] - icell[8])))) <= bmmdiff)) && !(((((icell[2] - icell[6])) >= 0 ? ((icell[2] - icell[6])) : (-((icell[2] - icell[6])))) <= bmmdiff)))
                    magnified[imag] = icell[2];
                if (mcell == 2)
                  if ((((((icell[2] - icell[6])) >= 0 ? ((icell[2] - icell[6])) : (-((icell[2] - icell[6])))) <= bmmdiff)) && !(((((icell[2] - icell[4])) >= 0 ? ((icell[2] - icell[4])) : (-((icell[2] - icell[4])))) <= bmmdiff)) && !(((((icell[6] - icell[8])) >= 0 ? ((icell[6] - icell[8])) : (-((icell[6] - icell[8])))) <= bmmdiff)))
                    magnified[imag] = icell[6];
                if (mcell == 4)
                  if ((((((icell[6] - icell[8])) >= 0 ? ((icell[6] - icell[8])) : (-((icell[6] - icell[8])))) <= bmmdiff)) && !(((((icell[6] - icell[2])) >= 0 ? ((icell[6] - icell[2])) : (-((icell[6] - icell[2])))) <= bmmdiff)) && !(((((icell[8] - icell[4])) >= 0 ? ((icell[8] - icell[4])) : (-((icell[8] - icell[4])))) <= bmmdiff)))
                    magnified[imag] = icell[8];
                if (mcell == 3)
                  if ((((((icell[8] - icell[4])) >= 0 ? ((icell[8] - icell[4])) : (-((icell[8] - icell[4])))) <= bmmdiff)) && !(((((icell[8] - icell[6])) >= 0 ? ((icell[8] - icell[6])) : (-((icell[8] - icell[6])))) <= bmmdiff)) && !(((((icell[4] - icell[2])) >= 0 ? ((icell[4] - icell[2])) : (-((icell[4] - icell[2])))) <= bmmdiff)))
                    magnified[imag] = icell[4];
                break;
              case 3:
                if (mcell == 1)
                  if ((((((icell[4] - icell[2])) >= 0 ? ((icell[4] - icell[2])) : (-((icell[4] - icell[2])))) <= bmmdiff)) && !(((((icell[4] - icell[8])) >= 0 ? ((icell[4] - icell[8])) : (-((icell[4] - icell[8])))) <= bmmdiff)) && !(((((icell[2] - icell[6])) >= 0 ? ((icell[2] - icell[6])) : (-((icell[2] - icell[6])))) <= bmmdiff)))
                    magnified[imag] = icell[4];
                if (mcell == 2)
                  if (((((((icell[4] - icell[2])) >= 0 ? ((icell[4] - icell[2])) : (-((icell[4] - icell[2])))) <= bmmdiff)) && !(((((icell[4] - icell[8])) >= 0 ? ((icell[4] - icell[8])) : (-((icell[4] - icell[8])))) <= bmmdiff)) && !(((((icell[2] - icell[6])) >= 0 ? ((icell[2] - icell[6])) : (-((icell[2] - icell[6])))) <= bmmdiff)) && !(((((icell[5] - icell[3])) >= 0 ? ((icell[5] - icell[3])) : (-((icell[5] - icell[3])))) <= bmmdiff))) || ((((((icell[2] - icell[6])) >= 0 ? ((icell[2] - icell[6])) : (-((icell[2] - icell[6])))) <= bmmdiff)) && !(((((icell[2] - icell[4])) >= 0 ? ((icell[2] - icell[4])) : (-((icell[2] - icell[4])))) <= bmmdiff)) && !(((((icell[6] - icell[8])) >= 0 ? ((icell[6] - icell[8])) : (-((icell[6] - icell[8])))) <= bmmdiff)) && !(((((icell[5] - icell[1])) >= 0 ? ((icell[5] - icell[1])) : (-((icell[5] - icell[1])))) <= bmmdiff))))
                    magnified[imag] = icell[2];
                if (mcell == 3)
                  if ((((((icell[2] - icell[6])) >= 0 ? ((icell[2] - icell[6])) : (-((icell[2] - icell[6])))) <= bmmdiff)) && !(((((icell[2] - icell[4])) >= 0 ? ((icell[2] - icell[4])) : (-((icell[2] - icell[4])))) <= bmmdiff)) && !(((((icell[6] - icell[8])) >= 0 ? ((icell[6] - icell[8])) : (-((icell[6] - icell[8])))) <= bmmdiff)))
                    magnified[imag] = icell[6];
                if (mcell == 4)
                  if (((((((icell[8] - icell[4])) >= 0 ? ((icell[8] - icell[4])) : (-((icell[8] - icell[4])))) <= bmmdiff)) && !(((((icell[8] - icell[6])) >= 0 ? ((icell[8] - icell[6])) : (-((icell[8] - icell[6])))) <= bmmdiff)) && !(((((icell[4] - icell[2])) >= 0 ? ((icell[4] - icell[2])) : (-((icell[4] - icell[2])))) <= bmmdiff)) && !(((((icell[5] - icell[1])) >= 0 ? ((icell[5] - icell[1])) : (-((icell[5] - icell[1])))) <= bmmdiff))) || ((((((icell[4] - icell[2])) >= 0 ? ((icell[4] - icell[2])) : (-((icell[4] - icell[2])))) <= bmmdiff)) && !(((((icell[4] - icell[8])) >= 0 ? ((icell[4] - icell[8])) : (-((icell[4] - icell[8])))) <= bmmdiff)) && !(((((icell[2] - icell[6])) >= 0 ? ((icell[2] - icell[6])) : (-((icell[2] - icell[6])))) <= bmmdiff)) && !(((((icell[5] - icell[7])) >= 0 ? ((icell[5] - icell[7])) : (-((icell[5] - icell[7])))) <= bmmdiff))))
                    magnified[imag] = icell[4];
                if (mcell == 6)
                  if (((((((icell[2] - icell[6])) >= 0 ? ((icell[2] - icell[6])) : (-((icell[2] - icell[6])))) <= bmmdiff)) && !(((((icell[2] - icell[4])) >= 0 ? ((icell[2] - icell[4])) : (-((icell[2] - icell[4])))) <= bmmdiff)) && !(((((icell[6] - icell[8])) >= 0 ? ((icell[6] - icell[8])) : (-((icell[6] - icell[8])))) <= bmmdiff)) && !(((((icell[5] - icell[9])) >= 0 ? ((icell[5] - icell[9])) : (-((icell[5] - icell[9])))) <= bmmdiff))) || ((((((icell[6] - icell[8])) >= 0 ? ((icell[6] - icell[8])) : (-((icell[6] - icell[8])))) <= bmmdiff)) && !(((((icell[6] - icell[2])) >= 0 ? ((icell[6] - icell[2])) : (-((icell[6] - icell[2])))) <= bmmdiff)) && !(((((icell[8] - icell[4])) >= 0 ? ((icell[8] - icell[4])) : (-((icell[8] - icell[4])))) <= bmmdiff)) && !(((((icell[5] - icell[3])) >= 0 ? ((icell[5] - icell[3])) : (-((icell[5] - icell[3])))) <= bmmdiff))))
                    magnified[imag] = icell[6];
                if (mcell == 7)
                  if ((((((icell[8] - icell[4])) >= 0 ? ((icell[8] - icell[4])) : (-((icell[8] - icell[4])))) <= bmmdiff)) && !(((((icell[8] - icell[6])) >= 0 ? ((icell[8] - icell[6])) : (-((icell[8] - icell[6])))) <= bmmdiff)) && !(((((icell[4] - icell[2])) >= 0 ? ((icell[4] - icell[2])) : (-((icell[4] - icell[2])))) <= bmmdiff)))
                    magnified[imag] = icell[4];
                if (mcell == 8)
                  if (((((((icell[6] - icell[8])) >= 0 ? ((icell[6] - icell[8])) : (-((icell[6] - icell[8])))) <= bmmdiff)) && !(((((icell[6] - icell[2])) >= 0 ? ((icell[6] - icell[2])) : (-((icell[6] - icell[2])))) <= bmmdiff)) && !(((((icell[8] - icell[4])) >= 0 ? ((icell[8] - icell[4])) : (-((icell[8] - icell[4])))) <= bmmdiff)) && !(((((icell[5] - icell[7])) >= 0 ? ((icell[5] - icell[7])) : (-((icell[5] - icell[7])))) <= bmmdiff))) || ((((((icell[8] - icell[4])) >= 0 ? ((icell[8] - icell[4])) : (-((icell[8] - icell[4])))) <= bmmdiff)) && !(((((icell[8] - icell[6])) >= 0 ? ((icell[8] - icell[6])) : (-((icell[8] - icell[6])))) <= bmmdiff)) && !(((((icell[4] - icell[2])) >= 0 ? ((icell[4] - icell[2])) : (-((icell[4] - icell[2])))) <= bmmdiff)) && !(((((icell[5] - icell[9])) >= 0 ? ((icell[5] - icell[9])) : (-((icell[5] - icell[9])))) <= bmmdiff))))
                    magnified[imag] = icell[8];
                if (mcell == 9)
                  if ((((((icell[6] - icell[8])) >= 0 ? ((icell[6] - icell[8])) : (-((icell[6] - icell[8])))) <= bmmdiff)) && !(((((icell[6] - icell[2])) >= 0 ? ((icell[6] - icell[2])) : (-((icell[6] - icell[2])))) <= bmmdiff)) && !(((((icell[8] - icell[4])) >= 0 ? ((icell[8] - icell[4])) : (-((icell[8] - icell[4])))) <= bmmdiff)))
                    magnified[imag] = icell[6];
                break;
              }
            }
          }
      }
end_of_job:
  return (magnified);
}
```