// File: /workspace/github_cpp_makefile_star2_O1/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 $0x188, %rsp            # imm = 0x188
movl %ecx, %ebp
movl %edx, %r14d
testl %edx, %edx
setle %al
testl %esi, %esi
setle %cl
orb %al, %cl
movq %r8, 0x78(%rsp)
testq %r8, %r8
sete %dl
xorl %eax, %eax
orb %cl, %dl
jne 0x270fa
movl %esi, %r15d
movq %rdi, %r12
leal (,%r15,4), %edi
callq 0x64c0
movq %rax, %r13
leaq 0x195ed(%rip), %rsi     # 0x401e0
leaq 0xb0(%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 0x194f9(%rip), %rsi     # 0x4011d
leaq 0x100(%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, 0x44(%rsp)
movl %r15d, %eax
shrl $0x8, %eax
movl %eax, 0x40(%rsp)
leal -0x8000(%r15), %eax
movl %eax, 0x3c(%rsp)
leal (%r15,%r15), %eax
leal (%r15,%r15,2), %ecx
movslq %ebp, %rdx
addl $-0x3, %ebp
movq %r15, 0x30(%rsp)
movl %r15d, %esi
movq %r13, %r15
movq %rsi, %r13
addq $-0x3, %rsi
movq %rsi, 0x60(%rsp)
shlq $0x2, %rdx
movq %rdx, 0x58(%rsp)
movq %r13, %rdx
negq %rdx
movq %rdx, 0x90(%rsp)
addq %r15, %rcx
movq %rcx, 0x98(%rsp)
addq %r15, %rax
movq %rax, 0xa0(%rsp)
leaq (%r15,%r13), %rax
movq %rax, 0x88(%rsp)
leaq 0x2(%r15), %rax
movq %rax, 0x70(%rsp)
movl %ebp, 0x4c(%rsp)
movl %r14d, 0x48(%rsp)
movq %r15, 0xa8(%rsp)
movq %r13, 0x68(%rsp)
movl %ebx, %eax
notl %eax
addl %r14d, %eax
cmpl $0x0, 0x28806(%rip)     # 0x4f4fc
movq %rbx, 0x80(%rsp)
cmovel %ebx, %eax
imull 0x44(%rsp), %eax
cltq
movq 0x78(%rsp), %rcx
leaq (%rcx,%rax,4), %r14
movl $0x202, 0xc(%rsp)       # imm = 0x202
movl 0x40(%rsp), %eax
movb %al, 0xe(%rsp)
movq 0x30(%rsp), %rax
movb %al, 0xf(%rsp)
cmpl $0xffff8008, 0x3c(%rsp) # imm = 0xFFFF8008
jae 0x26e1d
movq %r13, %rbx
cmpl $0x1, %ebp
ja 0x26d53
movss 0x8(%r14), %xmm1
movss (%r14), %xmm3
movss 0x4(%r14), %xmm2
jmp 0x26d5e
movss (%r14), %xmm1
movaps %xmm1, %xmm2
movaps %xmm1, %xmm3
movaps %xmm2, %xmm0
maxss %xmm1, %xmm0
movaps %xmm3, %xmm4
maxss %xmm0, %xmm4
movss 0x16500(%rip), %xmm0    # 0x3d274
ucomiss %xmm4, %xmm0
jbe 0x26d83
movl $0x0, 0x4(%rsp)
jmp 0x26df7
movaps %xmm4, %xmm0
leaq 0x50(%rsp), %rdi
movss %xmm1, 0x18(%rsp)
movss %xmm2, 0x28(%rsp)
movss %xmm3, 0x10(%rsp)
movss %xmm4, 0x20(%rsp)
callq 0x6090
mulss 0x164c8(%rip), %xmm0    # 0x3d278
divss 0x20(%rsp), %xmm0
movss 0x10(%rsp), %xmm1
mulss %xmm0, %xmm1
cvttss2si %xmm1, %eax
movb 0x50(%rsp), %cl
movss 0x28(%rsp), %xmm1
mulss %xmm0, %xmm1
cvttss2si %xmm1, %edx
movb %al, 0x4(%rsp)
movss 0x18(%rsp), %xmm1
mulss %xmm0, %xmm1
cvttss2si %xmm1, %eax
movb %dl, 0x5(%rsp)
movb %al, 0x6(%rsp)
addb $-0x80, %cl
movb %cl, 0x7(%rsp)
movq 0x8(%r12), %rdi
leaq 0x4(%rsp), %rsi
movl $0x4, %edx
callq *(%r12)
addq 0x58(%rsp), %r14
decq %rbx
jne 0x26d3b
jmp 0x270d5
xorl %ebx, %ebx
cmpl $0x1, %ebp
ja 0x26e37
movss 0x8(%r14), %xmm1
movss (%r14), %xmm3
movss 0x4(%r14), %xmm2
jmp 0x26e42
movss (%r14), %xmm1
movaps %xmm1, %xmm2
movaps %xmm1, %xmm3
movaps %xmm2, %xmm0
maxss %xmm1, %xmm0
movaps %xmm3, %xmm4
maxss %xmm0, %xmm4
movss 0x1641c(%rip), %xmm0    # 0x3d274
ucomiss %xmm4, %xmm0
jbe 0x26e67
movl $0x0, 0x4(%rsp)
jmp 0x26edb
movaps %xmm4, %xmm0
leaq 0x54(%rsp), %rdi
movss %xmm1, 0x18(%rsp)
movss %xmm2, 0x28(%rsp)
movss %xmm3, 0x10(%rsp)
movss %xmm4, 0x20(%rsp)
callq 0x6090
mulss 0x163e4(%rip), %xmm0    # 0x3d278
divss 0x20(%rsp), %xmm0
movss 0x10(%rsp), %xmm1
mulss %xmm0, %xmm1
cvttss2si %xmm1, %eax
movb 0x54(%rsp), %cl
movss 0x28(%rsp), %xmm1
mulss %xmm0, %xmm1
cvttss2si %xmm1, %edx
movb %al, 0x4(%rsp)
movss 0x18(%rsp), %xmm1
mulss %xmm0, %xmm1
cvttss2si %xmm1, %eax
movb %dl, 0x5(%rsp)
movb %al, 0x6(%rsp)
addb $-0x80, %cl
movb %cl, 0x7(%rsp)
movb 0x4(%rsp), %al
movb %al, (%r15,%rbx)
movb 0x5(%rsp), %al
movq 0x88(%rsp), %rcx
movb %al, (%rcx,%rbx)
movb 0x6(%rsp), %al
movq 0xa0(%rsp), %rcx
movb %al, (%rcx,%rbx)
movb 0x7(%rsp), %al
movq 0x98(%rsp), %rcx
movb %al, (%rcx,%rbx)
incq %rbx
addq 0x58(%rsp), %r14
movq 0x90(%rsp), %rax
addq %rbx, %rax
jne 0x26e1f
movq 0x8(%r12), %rdi
leaq 0xc(%rsp), %rsi
movl $0x4, %edx
callq *(%r12)
movq %r15, 0x10(%rsp)
movq 0x70(%rsp), %rsi
xorl %eax, %eax
movq 0x60(%rsp), %rdx
movq %rax, 0x20(%rsp)
movq %rax, %rdi
imulq %r13, %rdi
addq %r15, %rdi
xorl %r15d, %r15d
movq 0x30(%rsp), %r8
movq %rsi, 0x28(%rsp)
movq %rdi, 0x18(%rsp)
leal 0x2(%r15), %eax
movl %r8d, %ebx
cmpl %r8d, %eax
jge 0x26f9f
movslq %r15d, %rax
decq %rax
movl %r15d, %ebx
movb -0x1(%rsi,%rax), %cl
cmpb (%rsi,%rax), %cl
jne 0x26f92
cmpb 0x1(%rsi,%rax), %cl
je 0x26f9f
incl %ebx
incq %rax
cmpq %rdx, %rax
jl 0x26f83
movl %r8d, %ebx
cmpl %ebx, %r15d
jge 0x26ff0
movl $0x80, %r14d
movl %ebx, %ebp
subl %r15d, %ebp
cmpl %r14d, %ebp
cmovgel %r14d, %ebp
movslq %r15d, %r15
leaq (%rdi,%r15), %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, %r15d
cmpl %ebx, %r15d
jl 0x26faa
leal 0x2(%rbx), %eax
movq 0x30(%rsp), %r8
cmpl %r8d, %eax
jge 0x27092
movslq %r15d, %rax
movb (%rdi,%rax), %cl
movslq %ebx, %rax
incl %ebx
cmpl %ebx, %r8d
cmovgl %r8d, %ebx
movq 0x68(%rsp), %rdx
leaq 0x3(%rsp), %rbp
movq 0x10(%rsp), %rsi
cmpb %cl, (%rsi,%rax)
jne 0x27031
incq %rax
cmpq %rdx, %rax
jl 0x27022
jmp 0x27033
movl %eax, %ebx
cmpl %ebx, %r15d
jge 0x27092
leaq 0xb(%rsp), %r14
movl %ebx, %r13d
subl %r15d, %r13d
cmpl $0x7f, %r13d
movl $0x7f, %eax
cmovgel %eax, %r13d
movslq %r15d, %r15
movb (%rdi,%r15), %al
movb %al, 0x3(%rsp)
leal -0x80(%r13), %eax
movb %al, 0xb(%rsp)
movq 0x8(%r12), %rdi
movq %r14, %rsi
movl $0x1, %edx
callq *(%r12)
movq 0x8(%r12), %rdi
movq %rbp, %rsi
movl $0x1, %edx
callq *(%r12)
movq 0x18(%rsp), %rdi
addl %r13d, %r15d
cmpl %ebx, %r15d
jl 0x2703d
movq 0x30(%rsp), %r8
cmpl %r8d, %r15d
movq 0x68(%rsp), %r13
movq 0x60(%rsp), %rdx
movq 0x28(%rsp), %rsi
jl 0x26f6e
movq 0x20(%rsp), %rax
incq %rax
addq %r13, %rsi
addq %r13, 0x10(%rsp)
cmpq $0x4, %rax
movl 0x4c(%rsp), %ebp
movq 0xa8(%rsp), %r15
jne 0x26f4d
movq 0x80(%rsp), %rbx
incl %ebx
movl 0x48(%rsp), %r14d
cmpl %r14d, %ebx
jne 0x26ce8
movq %r15, %rdi
callq 0x6490
movl $0x1, %eax
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq