// File: /workspace/github_c_makefile_star2_O0/ggerganov[P]font-rasterizer/./stb_image_write.h
// Function: stbiw__jpg_processDU
static int stbiw__jpg_processDU(stbi__write_context *s, int *bitBuf, int *bitCnt, float *CDU, float *fdtbl, int DC, const unsigned short HTDC[256][2], const unsigned short HTAC[256][2]) {
   const unsigned short EOB[2] = { HTAC[0x00][0], HTAC[0x00][1] };
   const unsigned short M16zeroes[2] = { HTAC[0xF0][0], HTAC[0xF0][1] };
   int dataOff, i, diff, end0pos;
   int DU[64];

   // DCT rows
   for(dataOff=0; dataOff<64; dataOff+=8) {
      stbiw__jpg_DCT(&CDU[dataOff], &CDU[dataOff+1], &CDU[dataOff+2], &CDU[dataOff+3], &CDU[dataOff+4], &CDU[dataOff+5], &CDU[dataOff+6], &CDU[dataOff+7]);
   }
   // DCT columns
   for(dataOff=0; dataOff<8; ++dataOff) {
      stbiw__jpg_DCT(&CDU[dataOff], &CDU[dataOff+8], &CDU[dataOff+16], &CDU[dataOff+24], &CDU[dataOff+32], &CDU[dataOff+40], &CDU[dataOff+48], &CDU[dataOff+56]);
   }
   // Quantize/descale/zigzag the coefficients
   for(i=0; i<64; ++i) {
      float v = CDU[i]*fdtbl[i];
      // DU[stbiw__jpg_ZigZag[i]] = (int)(v < 0 ? ceilf(v - 0.5f) : floorf(v + 0.5f));
      // ceilf() and floorf() are C99, not C89, but I /think/ they're not needed here anyway?
      DU[stbiw__jpg_ZigZag[i]] = (int)(v < 0 ? v - 0.5f : v + 0.5f);
   }

   // Encode DC
   diff = DU[0] - DC;
   if (diff == 0) {
      stbiw__jpg_writeBits(s, bitBuf, bitCnt, HTDC[0]);
   } else {
      unsigned short bits[2];
      stbiw__jpg_calcBits(diff, bits);
      stbiw__jpg_writeBits(s, bitBuf, bitCnt, HTDC[bits[1]]);
      stbiw__jpg_writeBits(s, bitBuf, bitCnt, bits);
   }
   // Encode ACs
   end0pos = 63;
   for(; (end0pos>0)&&(DU[end0pos]==0); --end0pos) {
   }
   // end0pos = first element in reverse order !=0
   if(end0pos == 0) {
      stbiw__jpg_writeBits(s, bitBuf, bitCnt, EOB);
      return DU[0];
   }
   for(i = 1; i <= end0pos; ++i) {
      int startpos = i;
      int nrzeroes;
      unsigned short bits[2];
      for (; DU[i]==0 && i<=end0pos; ++i) {
      }
      nrzeroes = i-startpos;
      if ( nrzeroes >= 16 ) {
         int lng = nrzeroes>>4;
         int nrmarker;
         for (nrmarker=1; nrmarker <= lng; ++nrmarker)
            stbiw__jpg_writeBits(s, bitBuf, bitCnt, M16zeroes);
         nrzeroes &= 15;
      }
      stbiw__jpg_calcBits(DU[i], bits);
      stbiw__jpg_writeBits(s, bitBuf, bitCnt, HTAC[(nrzeroes<<4)+bits[1]]);
      stbiw__jpg_writeBits(s, bitBuf, bitCnt, bits);
   }
   if(end0pos != 63) {
      stbiw__jpg_writeBits(s, bitBuf, bitCnt, EOB);
   }
   return DU[0];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x190, %rsp            # imm = 0x190
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movl %r9d, -0x34(%rbp)
movq 0x18(%rbp), %rax
movw (%rax), %ax
movw %ax, -0x38(%rbp)
movq 0x18(%rbp), %rax
movw 0x2(%rax), %ax
movw %ax, -0x36(%rbp)
movq 0x18(%rbp), %rax
movw 0x3c0(%rax), %ax
movw %ax, -0x3c(%rbp)
movq 0x18(%rbp), %rax
movw 0x3c2(%rax), %ax
movw %ax, -0x3a(%rbp)
movl $0x0, -0x40(%rbp)
cmpl $0x40, -0x40(%rbp)
jge 0xe514
movq -0x28(%rbp), %rdi
movslq -0x40(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rdi
movq -0x28(%rbp), %rsi
movl -0x40(%rbp), %eax
addl $0x1, %eax
cltq
shlq $0x2, %rax
addq %rax, %rsi
movq -0x28(%rbp), %rdx
movl -0x40(%rbp), %eax
addl $0x2, %eax
cltq
shlq $0x2, %rax
addq %rax, %rdx
movq -0x28(%rbp), %rcx
movl -0x40(%rbp), %eax
addl $0x3, %eax
cltq
shlq $0x2, %rax
addq %rax, %rcx
movq -0x28(%rbp), %r8
movl -0x40(%rbp), %eax
addl $0x4, %eax
cltq
shlq $0x2, %rax
addq %rax, %r8
movq -0x28(%rbp), %r9
movl -0x40(%rbp), %eax
addl $0x5, %eax
cltq
shlq $0x2, %rax
addq %rax, %r9
movq -0x28(%rbp), %r10
movl -0x40(%rbp), %eax
addl $0x6, %eax
cltq
shlq $0x2, %rax
addq %rax, %r10
movq -0x28(%rbp), %rax
movl -0x40(%rbp), %r11d
addl $0x7, %r11d
movslq %r11d, %r11
shlq $0x2, %r11
addq %r11, %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0xe990
movl -0x40(%rbp), %eax
addl $0x8, %eax
movl %eax, -0x40(%rbp)
jmp 0xe457
movl $0x0, -0x40(%rbp)
cmpl $0x8, -0x40(%rbp)
jge 0xe5d8
movq -0x28(%rbp), %rdi
movslq -0x40(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rdi
movq -0x28(%rbp), %rsi
movl -0x40(%rbp), %eax
addl $0x8, %eax
cltq
shlq $0x2, %rax
addq %rax, %rsi
movq -0x28(%rbp), %rdx
movl -0x40(%rbp), %eax
addl $0x10, %eax
cltq
shlq $0x2, %rax
addq %rax, %rdx
movq -0x28(%rbp), %rcx
movl -0x40(%rbp), %eax
addl $0x18, %eax
cltq
shlq $0x2, %rax
addq %rax, %rcx
movq -0x28(%rbp), %r8
movl -0x40(%rbp), %eax
addl $0x20, %eax
cltq
shlq $0x2, %rax
addq %rax, %r8
movq -0x28(%rbp), %r9
movl -0x40(%rbp), %eax
addl $0x28, %eax
cltq
shlq $0x2, %rax
addq %rax, %r9
movq -0x28(%rbp), %r10
movl -0x40(%rbp), %eax
addl $0x30, %eax
cltq
shlq $0x2, %rax
addq %rax, %r10
movq -0x28(%rbp), %rax
movl -0x40(%rbp), %r11d
addl $0x38, %r11d
movslq %r11d, %r11
shlq $0x2, %r11
addq %r11, %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0xe990
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0xe51b
movl $0x0, -0x44(%rbp)
cmpl $0x40, -0x44(%rbp)
jge 0xe67d
movq -0x28(%rbp), %rax
movslq -0x44(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
movq -0x30(%rbp), %rax
movslq -0x44(%rbp), %rcx
mulss (%rax,%rcx,4), %xmm0
movss %xmm0, -0x154(%rbp)
xorps %xmm0, %xmm0
ucomiss -0x154(%rbp), %xmm0
jbe 0xe635
movss -0x154(%rbp), %xmm0
movss 0x7fd5(%rip), %xmm1     # 0x165fc
subss %xmm1, %xmm0
movss %xmm0, -0x170(%rbp)
jmp 0xe64d
movss 0x7fbf(%rip), %xmm0     # 0x165fc
addss -0x154(%rbp), %xmm0
movss %xmm0, -0x170(%rbp)
movss -0x170(%rbp), %xmm0
cvttss2si %xmm0, %ecx
movslq -0x44(%rbp), %rdx
leaq 0x7f0c(%rip), %rax      # 0x16570
movzbl (%rax,%rdx), %eax
movl %ecx, -0x150(%rbp,%rax,4)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0xe5df
movl -0x150(%rbp), %eax
subl -0x34(%rbp), %eax
movl %eax, -0x48(%rbp)
cmpl $0x0, -0x48(%rbp)
jne 0xe6a6
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq 0x10(%rbp), %rcx
callq 0xe8d0
jmp 0xe6f0
movl -0x48(%rbp), %edi
leaq -0x158(%rbp), %rsi
callq 0xecc0
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq 0x10(%rbp), %rcx
movzwl -0x156(%rbp), %eax
shlq $0x2, %rax
addq %rax, %rcx
callq 0xe8d0
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq -0x158(%rbp), %rcx
callq 0xe8d0
movl $0x3f, -0x4c(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x4c(%rbp)
movb %al, -0x171(%rbp)
jle 0xe71a
movslq -0x4c(%rbp), %rax
cmpl $0x0, -0x150(%rbp,%rax,4)
sete %al
movb %al, -0x171(%rbp)
movb -0x171(%rbp), %al
testb $0x1, %al
jne 0xe726
jmp 0xe733
jmp 0xe728
movl -0x4c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0xe6f7
cmpl $0x0, -0x4c(%rbp)
jne 0xe75c
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq -0x38(%rbp), %rcx
callq 0xe8d0
movl -0x150(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xe8bd
movl $0x1, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x4c(%rbp), %eax
jg 0xe899
movl -0x44(%rbp), %eax
movl %eax, -0x15c(%rbp)
movslq -0x44(%rbp), %rcx
xorl %eax, %eax
cmpl $0x0, -0x150(%rbp,%rcx,4)
movb %al, -0x172(%rbp)
jne 0xe79d
movl -0x44(%rbp), %eax
cmpl -0x4c(%rbp), %eax
setle %al
movb %al, -0x172(%rbp)
movb -0x172(%rbp), %al
testb $0x1, %al
jne 0xe7a9
jmp 0xe7b6
jmp 0xe7ab
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0xe778
movl -0x44(%rbp), %eax
subl -0x15c(%rbp), %eax
movl %eax, -0x160(%rbp)
cmpl $0x10, -0x160(%rbp)
jl 0xe82a
movl -0x160(%rbp), %eax
sarl $0x4, %eax
movl %eax, -0x168(%rbp)
movl $0x1, -0x16c(%rbp)
movl -0x16c(%rbp), %eax
cmpl -0x168(%rbp), %eax
jg 0xe81b
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq -0x3c(%rbp), %rcx
callq 0xe8d0
movl -0x16c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x16c(%rbp)
jmp 0xe7e7
movl -0x160(%rbp), %eax
andl $0xf, %eax
movl %eax, -0x160(%rbp)
movslq -0x44(%rbp), %rax
movl -0x150(%rbp,%rax,4), %edi
leaq -0x164(%rbp), %rsi
callq 0xecc0
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq 0x18(%rbp), %rcx
movl -0x160(%rbp), %eax
shll $0x4, %eax
movzwl -0x162(%rbp), %r8d
addl %r8d, %eax
cltq
shlq $0x2, %rax
addq %rax, %rcx
callq 0xe8d0
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq -0x164(%rbp), %rcx
callq 0xe8d0
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0xe763
cmpl $0x3f, -0x4c(%rbp)
je 0xe8b4
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq -0x38(%rbp), %rcx
callq 0xe8d0
movl -0x150(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x190, %rsp            # imm = 0x190
popq %rbp
retq
nopl (%rax)