// File: /workspace/github_c_makefile_star2_O2/ggerganov[P]font-rasterizer/./stb_image_write.h
// Function: stbi_write_hdr_core
static int stbi_write_hdr_core(stbi__write_context *s, int x, int y, int comp, float *data)
{
   if (y <= 0 || x <= 0 || data == NULL)
      return 0;
   else {
      // Each component is stored separately. Allocate scratch space for full output scanline.
      unsigned char *scratch = (unsigned char *) STBIW_MALLOC(x*4);
      int i, len;
      char buffer[128];
      char header[] = "#?RADIANCE\n# Written by stb_image_write.h\nFORMAT=32-bit_rle_rgbe\n";
      s->func(s->context, header, sizeof(header)-1);

#ifdef __STDC_WANT_SECURE_LIB__
      len = sprintf_s(buffer, sizeof(buffer), "EXPOSURE=          1.0000000000000\n\n-Y %d +X %d\n", y, x);
#else
      len = sprintf(buffer, "EXPOSURE=          1.0000000000000\n\n-Y %d +X %d\n", y, x);
#endif
      s->func(s->context, buffer, len);

      for(i=0; i < y; i++)
         stbiw__write_hdr_scanline(s, x, comp, scratch, data + comp*x*(stbi__flip_vertically_on_write ? y-1-i : i));
      STBIW_FREE(scratch);
      return 1;
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movl %ecx, %r15d
movl %edx, %r14d
testl %edx, %edx
setle %al
testl %esi, %esi
setle %cl
orb %al, %cl
movq %r8, -0x98(%rbp)
testq %r8, %r8
sete %dl
xorl %eax, %eax
orb %cl, %dl
jne 0x1d1d
movl %esi, %r12d
movq %rdi, %r13
leal (,%r12,4), %edi
callq 0x1170
movq %rax, %rbx
leaq 0xce2b(%rip), %rsi      # 0xe7c0
pushq $0x42
popq %rcx
leaq -0x190(%rbp), %rax
movq %rax, %rdi
rep  movsb (%rsi), %es:(%rdi)
movq 0x8(%r13), %rdi
pushq $0x41
popq %rdx
movq %rax, %rsi
callq *(%r13)
leaq 0xc5a0(%rip), %rsi      # 0xdf59
leaq -0x140(%rbp), %rdi
movl %r14d, %edx
movl %r12d, %ecx
xorl %eax, %eax
callq 0x11f0
movq 0x8(%r13), %rdi
leaq -0x140(%rbp), %rsi
movl %eax, %edx
callq *(%r13)
movl %r15d, %eax
imull %r12d, %eax
movl %eax, -0x7c(%rbp)
movl %r12d, %eax
shrl $0x8, %eax
movl %eax, -0x78(%rbp)
leal -0x8000(%r12), %eax
movl %eax, -0x74(%rbp)
leal (%r12,%r12), %eax
leal (%r12,%r12,2), %ecx
movslq %r15d, %rdx
addl $-0x3, %r15d
movl %r12d, %esi
leaq (%rbx,%rsi), %rdi
movq %rdi, -0xa8(%rbp)
addq %rbx, %rax
movq %rax, -0xb8(%rbp)
movq %rbx, -0x58(%rbp)
addq %rbx, %rcx
movq %rcx, -0xb0(%rbp)
xorl %ecx, %ecx
shlq $0x2, %rdx
movq %rdx, -0x90(%rbp)
movq %r12, -0x60(%rbp)
movq %rsi, -0x40(%rbp)
movl %r15d, -0x84(%rbp)
movl %r14d, -0x80(%rbp)
cmpl %r14d, %ecx
je 0x1d11
movl %ecx, %eax
notl %eax
addl %r14d, %eax
cmpl $0x0, 0x106c8(%rip)     # 0x12130
movq %rcx, -0xa0(%rbp)
cmovel %ecx, %eax
imull -0x7c(%rbp), %eax
cltq
movq -0x98(%rbp), %rcx
leaq (%rcx,%rax,4), %rbx
movl $0x202, -0x34(%rbp)     # imm = 0x202
movl -0x78(%rbp), %eax
movb %al, -0x32(%rbp)
movq -0x60(%rbp), %rax
movb %al, -0x31(%rbp)
cmpl $0xffff8008, -0x74(%rbp) # imm = 0xFFFF8008
jae 0x1b07
movq %rsi, %r14
subq $0x1, %r14
jb 0x1cff
cmpl $0x1, %r15d
ja 0x1ac3
movss 0x8(%rbx), %xmm0
movss (%rbx), %xmm1
movss 0x4(%rbx), %xmm2
jmp 0x1acd
movss (%rbx), %xmm0
movaps %xmm0, %xmm2
movaps %xmm0, %xmm1
movss %xmm0, -0x44(%rbp)
movss %xmm2, -0x48(%rbp)
movss %xmm1, -0x4c(%rbp)
leaq -0x2e(%rbp), %r12
movq %r12, %rdi
leaq -0x4c(%rbp), %rsi
callq 0x9794
movq 0x8(%r13), %rdi
movq %r12, %rsi
pushq $0x4
popq %rdx
callq *(%r13)
addq -0x90(%rbp), %rbx
movq -0x40(%rbp), %rsi
jmp 0x1aa3
xorl %r14d, %r14d
cmpq %r14, %rsi
je 0x1b97
cmpl $0x1, %r15d
ja 0x1b29
movss 0x8(%rbx), %xmm0
movss (%rbx), %xmm1
movss 0x4(%rbx), %xmm2
jmp 0x1b33
movss (%rbx), %xmm0
movaps %xmm0, %xmm2
movaps %xmm0, %xmm1
movss %xmm0, -0x44(%rbp)
movss %xmm2, -0x48(%rbp)
movss %xmm1, -0x4c(%rbp)
leaq -0x2e(%rbp), %rdi
leaq -0x4c(%rbp), %rsi
callq 0x9794
movb -0x2e(%rbp), %al
movq -0x58(%rbp), %rcx
movb %al, (%rcx,%r14)
movb -0x2d(%rbp), %al
movq -0xa8(%rbp), %rcx
movb %al, (%rcx,%r14)
movb -0x2c(%rbp), %al
movq -0xb8(%rbp), %rcx
movb %al, (%rcx,%r14)
movb -0x2b(%rbp), %al
movq -0xb0(%rbp), %rcx
movb %al, (%rcx,%r14)
incq %r14
addq -0x90(%rbp), %rbx
movq -0x40(%rbp), %rsi
jmp 0x1b0a
movq 0x8(%r13), %rdi
leaq -0x34(%rbp), %rsi
pushq $0x4
popq %rdx
callq *(%r13)
movq -0x40(%rbp), %rsi
movq -0x58(%rbp), %rax
xorl %ecx, %ecx
cmpq $0x4, %rcx
je 0x1cff
movq %rax, -0x68(%rbp)
movq %rcx, -0xc0(%rbp)
imulq %rsi, %rcx
addq -0x58(%rbp), %rcx
movq %rcx, -0x70(%rbp)
xorl %ebx, %ebx
movq -0x60(%rbp), %rdx
cmpl %edx, %ebx
jge 0x1ce2
movslq %ebx, %rax
addq $0x2, %rax
movl %ebx, %r15d
movq -0x68(%rbp), %rdi
cmpq %rsi, %rax
jge 0x1c09
movb -0x2(%rdi,%rax), %cl
cmpb -0x1(%rdi,%rax), %cl
jne 0x1c01
cmpb (%rdi,%rax), %cl
je 0x1c49
incl %r15d
incq %rax
jmp 0x1bed
movl %edx, %r15d
jmp 0x1c49
movl $0x80, %eax
cmpl %eax, %r12d
cmovgel %eax, %r12d
movq -0x70(%rbp), %rax
leaq (%rax,%r14), %rbx
movb %r12b, -0x29(%rbp)
movq 0x8(%r13), %rdi
leaq -0x29(%rbp), %rsi
pushq $0x1
popq %rdx
callq *(%r13)
movq 0x8(%r13), %rdi
movq %rbx, %rsi
movl %r12d, %edx
callq *(%r13)
addl %r12d, %r14d
movl %r14d, %ebx
movl %r15d, %r12d
movslq %ebx, %r14
subl %ebx, %r12d
jg 0x1c0e
leal 0x2(%r15), %eax
cmpl -0x60(%rbp), %eax
movq -0x40(%rbp), %rsi
jge 0x1bd3
movslq %r15d, %r15
cmpq %rsi, %r15
jge 0x1c84
movq -0x68(%rbp), %rax
movb (%rax,%r15), %al
movq -0x70(%rbp), %rcx
cmpb (%rcx,%r14), %al
jne 0x1cd1
incq %r15
jmp 0x1c68
movq -0x60(%rbp), %r15
jmp 0x1cd1
cmpl $0x7f, %r14d
pushq $0x7f
popq %rax
cmovgel %eax, %r14d
movslq %ebx, %rax
movq -0x70(%rbp), %rcx
movb (%rcx,%rax), %al
movb %al, -0x29(%rbp)
leal -0x80(%r14), %eax
movb %al, -0x2a(%rbp)
movq 0x8(%r13), %rdi
leaq -0x2a(%rbp), %rsi
pushq $0x1
popq %r12
movl %r12d, %edx
callq *(%r13)
movq 0x8(%r13), %rdi
leaq -0x29(%rbp), %rsi
movl %r12d, %edx
callq *(%r13)
addl %ebx, %r14d
movl %r14d, %ebx
movl %r15d, %r14d
subl %ebx, %r14d
jg 0x1c8a
movq -0x40(%rbp), %rsi
jmp 0x1bd3
movq -0xc0(%rbp), %rcx
incq %rcx
movq -0x68(%rbp), %rax
addq %rsi, %rax
movl -0x84(%rbp), %r15d
jmp 0x1bb0
movq -0xa0(%rbp), %rcx
incl %ecx
movl -0x80(%rbp), %r14d
jmp 0x1a51
movq -0x58(%rbp), %rdi
callq 0x1030
pushq $0x1
popq %rax
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq