// File: /workspace/github_cpp_makefile_star2_O3/alan0201tw[P]RayTracer/include/stb_image_write.h
// Function: stbi_write_hdr_core(stbi__write_context*, int, int, int, float*)
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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x178, %rsp            # imm = 0x178
movl %ecx, %ebp
movl %edx, %r14d
testl %edx, %edx
setle %al
testl %esi, %esi
setle %cl
orb %al, %cl
movq %r8, 0x70(%rsp)
testq %r8, %r8
sete %dl
xorl %eax, %eax
orb %cl, %dl
jne 0x26752
movl %esi, %r15d
movq %rdi, %r12
leal (,%r15,4), %edi
callq 0x64c0
movq %rax, %r13
leaq 0x1a1b9(%rip), %rsi     # 0x40440
leaq 0xa0(%rsp), %rax
movl $0x8, %ecx
movq %rax, %rdi
rep  movsq (%rsi), %es:(%rdi)
movw $0xa, 0x40(%rax)
movq 0x8(%r12), %rdi
movq %rax, %rsi
movl $0x41, %edx
callq *(%r12)
leaq 0x1a0c9(%rip), %rsi     # 0x40381
leaq 0xf0(%rsp), %rbx
movq %rbx, %rdi
movl %r14d, %edx
movl %r15d, %ecx
xorl %eax, %eax
callq 0x6080
movq 0x8(%r12), %rdi
movq %rbx, %rsi
xorl %ebx, %ebx
movl %eax, %edx
callq *(%r12)
movl %ebp, %eax
imull %r15d, %eax
movl %eax, 0x4c(%rsp)
movl %r15d, %eax
shrl $0x8, %eax
movl %eax, 0x48(%rsp)
leal -0x8000(%r15), %eax
movl %eax, 0x44(%rsp)
leal (%r15,%r15), %eax
leal (%r15,%r15,2), %ecx
movslq %ebp, %rdx
addl $-0x3, %ebp
movq %r15, 0x38(%rsp)
movl %r15d, %esi
leaq (%rsi,%r13), %rdi
movq %rdi, 0x88(%rsp)
addq %r13, %rax
movq %rax, 0x68(%rsp)
movq %r13, 0x28(%rsp)
addq %r13, %rcx
movq %rcx, 0x90(%rsp)
leaq -0x3(%rsi), %r13
movq %rsi, 0x30(%rsp)
negq %rsi
movq %rsi, 0x80(%rsp)
shlq $0x2, %rdx
movq %rdx, 0x60(%rsp)
movl %ebp, 0x54(%rsp)
movl %r14d, 0x50(%rsp)
movq %r13, 0x98(%rsp)
movl %ebx, %eax
notl %eax
addl %r14d, %eax
cmpl $0x0, 0x29167(%rip)     # 0x4f4dc
movq %rbx, 0x78(%rsp)
cmovel %ebx, %eax
imull 0x4c(%rsp), %eax
cltq
movq 0x70(%rsp), %rcx
leaq (%rcx,%rax,4), %r15
movl $0x202, 0xc(%rsp)       # imm = 0x202
movl 0x48(%rsp), %eax
movb %al, 0xe(%rsp)
movq 0x38(%rsp), %rax
movb %al, 0xf(%rsp)
cmpl $0xffff8008, 0x44(%rsp) # imm = 0xFFFF8008
jae 0x2649f
movq 0x30(%rsp), %rbx
cmpl $0x1, %ebp
leaq 0x3(%rsp), %r14
ja 0x263d6
movss 0x8(%r15), %xmm1
movss (%r15), %xmm3
movss 0x4(%r15), %xmm2
jmp 0x263e1
movss (%r15), %xmm1
movaps %xmm1, %xmm2
movaps %xmm1, %xmm3
movaps %xmm2, %xmm0
maxss %xmm1, %xmm0
movaps %xmm3, %xmm4
maxss %xmm0, %xmm4
movss 0x17035(%rip), %xmm0    # 0x3d42c
ucomiss %xmm4, %xmm0
jbe 0x26406
xorl %edx, %edx
xorl %eax, %eax
xorl %ecx, %ecx
xorl %esi, %esi
jmp 0x2646a
movaps %xmm4, %xmm0
leaq 0x58(%rsp), %rdi
movss %xmm1, 0x18(%rsp)
movss %xmm2, 0x10(%rsp)
movss %xmm3, 0x20(%rsp)
movss %xmm4, 0x8(%rsp)
callq 0x6090
mulss 0x16ffd(%rip), %xmm0    # 0x3d430
divss 0x8(%rsp), %xmm0
movss 0x20(%rsp), %xmm1
mulss %xmm0, %xmm1
cvttss2si %xmm1, %eax
movb 0x58(%rsp), %cl
movss 0x10(%rsp), %xmm1
mulss %xmm0, %xmm1
cvttss2si %xmm1, %edx
movss 0x18(%rsp), %xmm1
mulss %xmm0, %xmm1
cvttss2si %xmm1, %esi
addb $-0x80, %cl
movb %dl, 0x4(%rsp)
movb %al, 0x3(%rsp)
movb %cl, 0x6(%rsp)
movb %sil, 0x5(%rsp)
movq 0x8(%r12), %rdi
movq %r14, %rsi
movl $0x4, %edx
callq *(%r12)
addq 0x60(%rsp), %r15
decq %rbx
jne 0x263b9
jmp 0x2672e
xorl %ebx, %ebx
movq 0x68(%rsp), %r14
cmpl $0x1, %ebp
ja 0x264be
movss 0x8(%r15), %xmm1
movss (%r15), %xmm3
movss 0x4(%r15), %xmm2
jmp 0x264c9
movss (%r15), %xmm1
movaps %xmm1, %xmm2
movaps %xmm1, %xmm3
movaps %xmm2, %xmm0
maxss %xmm1, %xmm0
movaps %xmm3, %xmm4
maxss %xmm0, %xmm4
movss 0x16f4d(%rip), %xmm0    # 0x3d42c
ucomiss %xmm4, %xmm0
jbe 0x264ee
xorl %edx, %edx
xorl %ecx, %ecx
xorl %eax, %eax
xorl %esi, %esi
jmp 0x26551
movaps %xmm4, %xmm0
leaq 0x5c(%rsp), %rdi
movss %xmm1, 0x18(%rsp)
movss %xmm2, 0x10(%rsp)
movss %xmm3, 0x20(%rsp)
movss %xmm4, 0x8(%rsp)
callq 0x6090
mulss 0x16f15(%rip), %xmm0    # 0x3d430
divss 0x8(%rsp), %xmm0
movss 0x20(%rsp), %xmm1
mulss %xmm0, %xmm1
cvttss2si %xmm1, %ecx
movb 0x5c(%rsp), %al
movss 0x10(%rsp), %xmm1
mulss %xmm0, %xmm1
cvttss2si %xmm1, %edx
movss 0x18(%rsp), %xmm1
mulss %xmm0, %xmm1
cvttss2si %xmm1, %esi
addb $-0x80, %al
movq 0x28(%rsp), %rdi
movb %cl, (%rdi,%rbx)
movq 0x88(%rsp), %rcx
movb %dl, (%rcx,%rbx)
movb %sil, (%r14,%rbx)
movq 0x90(%rsp), %rcx
movb %al, (%rcx,%rbx)
incq %rbx
addq 0x60(%rsp), %r15
movq 0x80(%rsp), %rax
addq %rbx, %rax
jne 0x264a6
movq 0x8(%r12), %rdi
leaq 0xc(%rsp), %rsi
movl $0x4, %edx
callq *(%r12)
movq 0x28(%rsp), %rsi
xorl %ecx, %ecx
movq 0x30(%rsp), %rax
movq %rcx, 0x20(%rsp)
movq %rcx, %rdi
imulq %rax, %rdi
addq 0x28(%rsp), %rdi
xorl %r14d, %r14d
movq 0x38(%rsp), %r8
movq %rdi, 0x18(%rsp)
movq %rsi, 0x10(%rsp)
leal 0x2(%r14), %eax
movl %r8d, %r15d
cmpl %r8d, %eax
jge 0x26604
movslq %r14d, %rax
movb (%rdi,%rax), %cl
decq %rax
movl %r14d, %r15d
movb 0x2(%rsi,%rax), %dl
cmpb %dl, %cl
jne 0x265f4
cmpb 0x3(%rsi,%rax), %cl
je 0x26604
incl %r15d
incq %rax
movl %edx, %ecx
cmpq %r13, %rax
jl 0x265e6
movl %r8d, %r15d
cmpl %r15d, %r14d
jge 0x26653
movl $0x80, %ebx
movl %r15d, %ebp
subl %r14d, %ebp
cmpl %ebx, %ebp
cmovgel %ebx, %ebp
movslq %r14d, %r14
leaq (%rdi,%r14), %r13
movb %bpl, 0x3(%rsp)
movq 0x8(%r12), %rdi
leaq 0x3(%rsp), %rsi
movl $0x1, %edx
callq *(%r12)
movq 0x8(%r12), %rdi
movq %r13, %rsi
movl %ebp, %edx
callq *(%r12)
movq 0x18(%rsp), %rdi
addl %ebp, %r14d
cmpl %r15d, %r14d
jl 0x2660e
leal 0x2(%r15), %eax
movq 0x38(%rsp), %r8
cmpl %r8d, %eax
jge 0x266f5
movslq %r14d, %rax
movb (%rdi,%rax), %cl
movslq %r15d, %rax
incl %r15d
cmpl %r15d, %r8d
cmovgl %r8d, %r15d
movq 0x30(%rsp), %rdx
movl $0x7f, %ebx
movq 0x10(%rsp), %rsi
cmpb %cl, (%rsi,%rax)
jne 0x26696
incq %rax
cmpq %rdx, %rax
jl 0x26687
jmp 0x26699
movl %eax, %r15d
cmpl %r15d, %r14d
jge 0x266f5
leaq 0x3(%rsp), %rbp
movl %r15d, %r13d
subl %r14d, %r13d
cmpl $0x7f, %r13d
cmovgel %ebx, %r13d
movslq %r14d, %r14
movb (%rdi,%r14), %al
movb %al, 0x3(%rsp)
leal -0x80(%r13), %eax
movb %al, 0x7(%rsp)
movq 0x8(%r12), %rdi
leaq 0x7(%rsp), %rsi
movl $0x1, %edx
callq *(%r12)
movq 0x8(%r12), %rdi
movq %rbp, %rsi
movl $0x1, %edx
callq *(%r12)
movq 0x18(%rsp), %rdi
addl %r13d, %r14d
cmpl %r15d, %r14d
jl 0x266a3
movq 0x38(%rsp), %r8
cmpl %r8d, %r14d
movq 0x98(%rsp), %r13
movq 0x10(%rsp), %rsi
jl 0x265ce
movq 0x20(%rsp), %rcx
incq %rcx
movq 0x30(%rsp), %rax
addq %rax, %rsi
cmpq $0x4, %rcx
movl 0x54(%rsp), %ebp
jne 0x265ab
movq 0x78(%rsp), %rbx
incl %ebx
movl 0x50(%rsp), %r14d
cmpl %r14d, %ebx
jne 0x26367
movq 0x28(%rsp), %rdi
callq 0x6490
movl $0x1, %eax
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq