// File: /workspace/github_c_makefile_star2_O0/vlenhart[P]q3bsp/./stb_image_write.h
// Function: write_pixels(_IO_FILE*, int, int, int, int, int, void*, int, int, int)
static void write_pixels(FILE *f, int rgb_dir, int vdir, int x, int y, int comp, void *data, int write_alpha, int scanline_pad, int expand_mono)
{
   unsigned char bg[3] = { 255, 0, 255}, px[3];
   stbiw_uint32 zero = 0;
   int i,j,k, j_end;

   if (y <= 0)
      return;

   if (vdir < 0)
      j_end = -1, j = y-1;
   else
      j_end =  y, j = 0;

   for (; j != j_end; j += vdir) {
      for (i=0; i < x; ++i) {
         unsigned char *d = (unsigned char *) data + (j*x+i)*comp;
         if (write_alpha < 0)
            fwrite(&d[comp-1], 1, 1, f);
         switch (comp) {
            case 1: fwrite(d, 1, 1, f);
                    break;
            case 2: if (expand_mono)
                       write3(f, d[0],d[0],d[0]); // monochrome bmp
                    else
                       fwrite(d, 1, 1, f);  // monochrome TGA
                    break;
            case 4:
               if (!write_alpha) {
                  // composite against pink background
                  for (k=0; k < 3; ++k)
                     px[k] = bg[k] + ((d[k] - bg[k]) * d[3])/255;
                  write3(f, px[1-rgb_dir],px[1],px[1+rgb_dir]);
                  break;
               }
               /* FALLTHROUGH */
            case 3:
               write3(f, d[1-rgb_dir],d[1],d[1+rgb_dir]);
               break;
         }
         if (write_alpha > 0)
            fwrite(&d[comp-1], 1, 1, f);
      }
      fwrite(&zero,scanline_pad,1,f);
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl 0x28(%rbp), %eax
movl 0x20(%rbp), %eax
movl 0x18(%rbp), %eax
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movl %r8d, -0x18(%rbp)
movl %r9d, -0x1c(%rbp)
movw 0x203a3(%rip), %ax      # 0x29154
movw %ax, -0x1f(%rbp)
movb 0x2039b(%rip), %al      # 0x29156
movb %al, -0x1d(%rbp)
movl $0x0, -0x28(%rbp)
cmpl $0x0, -0x18(%rbp)
jg 0x8dd0
jmp 0x900d
cmpl $0x0, -0x10(%rbp)
jge 0x8de8
movl $0xffffffff, -0x38(%rbp) # imm = 0xFFFFFFFF
movl -0x18(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x30(%rbp)
jmp 0x8df5
movl -0x18(%rbp), %eax
movl %eax, -0x38(%rbp)
movl $0x0, -0x30(%rbp)
jmp 0x8df7
movl -0x30(%rbp), %eax
cmpl -0x38(%rbp), %eax
je 0x900d
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x8fe9
movq 0x10(%rbp), %rax
movl -0x30(%rbp), %ecx
imull -0x14(%rbp), %ecx
addl -0x2c(%rbp), %ecx
imull -0x1c(%rbp), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
cmpl $0x0, 0x18(%rbp)
jge 0x8e58
movq -0x40(%rbp), %rdi
movl -0x1c(%rbp), %eax
subl $0x1, %eax
cltq
addq %rax, %rdi
movq -0x8(%rbp), %rcx
movl $0x1, %edx
movq %rdx, %rsi
callq 0x3560
movl -0x1c(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x48(%rbp)
subl $0x3, %eax
ja 0x8fb3
movq -0x48(%rbp), %rax
leaq 0x202ad(%rip), %rcx     # 0x29124
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x40(%rbp), %rdi
movq -0x8(%rbp), %rcx
movl $0x1, %edx
movq %rdx, %rsi
callq 0x3560
jmp 0x8fb3
cmpl $0x0, 0x28(%rbp)
je 0x8ec4
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rax
movb (%rax), %dl
movq -0x40(%rbp), %rax
movb (%rax), %cl
movq -0x40(%rbp), %rax
movzbl %dl, %esi
movzbl %cl, %edx
movzbl (%rax), %ecx
callq 0x9020
jmp 0x8ed9
movq -0x40(%rbp), %rdi
movq -0x8(%rbp), %rcx
movl $0x1, %edx
movq %rdx, %rsi
callq 0x3560
jmp 0x8fb3
cmpl $0x0, 0x18(%rbp)
jne 0x8f76
movl $0x0, -0x34(%rbp)
cmpl $0x3, -0x34(%rbp)
jge 0x8f47
movslq -0x34(%rbp), %rax
movzbl -0x1f(%rbp,%rax), %eax
movl %eax, -0x4c(%rbp)
movq -0x40(%rbp), %rax
movslq -0x34(%rbp), %rcx
movzbl (%rax,%rcx), %eax
movslq -0x34(%rbp), %rcx
movzbl -0x1f(%rbp,%rcx), %ecx
subl %ecx, %eax
movq -0x40(%rbp), %rcx
movzbl 0x3(%rcx), %ecx
imull %ecx, %eax
movl $0xff, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x4c(%rbp), %eax
addl %ecx, %eax
movb %al, %cl
movslq -0x34(%rbp), %rax
movb %cl, -0x22(%rbp,%rax)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x8eef
movq -0x8(%rbp), %rdi
movl $0x1, %eax
subl -0xc(%rbp), %eax
cltq
movb -0x22(%rbp,%rax), %dl
movb -0x21(%rbp), %cl
movl -0xc(%rbp), %eax
addl $0x1, %eax
cltq
movzbl %dl, %esi
movzbl %cl, %edx
movzbl -0x22(%rbp,%rax), %ecx
callq 0x9020
jmp 0x8fb3
jmp 0x8f78
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rax
movl $0x1, %ecx
subl -0xc(%rbp), %ecx
movslq %ecx, %rcx
movb (%rax,%rcx), %sil
movq -0x40(%rbp), %rax
movb 0x1(%rax), %dl
movq -0x40(%rbp), %rax
movl -0xc(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movzbl %sil, %esi
movzbl %dl, %edx
movzbl (%rax,%rcx), %ecx
callq 0x9020
cmpl $0x0, 0x18(%rbp)
jle 0x8fd9
movq -0x40(%rbp), %rdi
movl -0x1c(%rbp), %eax
subl $0x1, %eax
cltq
addq %rax, %rdi
movq -0x8(%rbp), %rcx
movl $0x1, %edx
movq %rdx, %rsi
callq 0x3560
jmp 0x8fdb
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x8e0a
movslq 0x20(%rbp), %rsi
movq -0x8(%rbp), %rcx
leaq -0x28(%rbp), %rdi
movl $0x1, %edx
callq 0x3560
movl -0x10(%rbp), %eax
addl -0x30(%rbp), %eax
movl %eax, -0x30(%rbp)
jmp 0x8df7
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)