// File: /workspace/github_c_makefile_star2_O2/antirez[P]stonky/stonky.c
// Function: sdsCatPriceRequest
sds sdsCatPriceRequest(sds s, sds symbol, ydata *yd, int flags) {
    if (yd == NULL) {
        s = sdscatprintf(s,
            (flags & STONKY_SHORT) ? "Can't find data for '%s'" :
                                     "%s: no data avaiable",
        symbol);
        return s;
    }

    /* Select the emoji according to the price change. */
    double change = strtod(yd->regchange,NULL);
    const char *emoji = priceChangeToEmoji(change);

    if (flags & STONKY_VERY_SHORT) {
        s = sdscatprintf(s,
            "%s[%s](https://google.com/search?q=%s+stock) %s%s",
            emoji,
            yd->symbol,
            yd->symbol,
            (yd->regchange && yd->regchange[0] == '-') ? "" : "+",
            yd->regchange);
    } else if (flags & STONKY_SHORT) {
        s = sdscatprintf(s,
            "%s[%s](https://google.com/search?q=%s+stock): %.02f%s (%s%s)",
            emoji,
            yd->symbol,
            yd->symbol,
            yd->reg,
            yd->csym,
            (yd->regchange && yd->regchange[0] == '-') ? "" : "+",
            yd->regchange);
    } else {
        s = sdscatprintf(s,
            "%s%s ([%s](https://google.com/search?q=%s+stock)) "
            "price is %.02f%s (%s%s)",
            emoji,
            yd->name,
            yd->symbol,
            yd->symbol,
            yd->reg,
            yd->csym,
            (yd->regchange && yd->regchange[0] == '-') ? "" : "+",
            yd->regchange);
    }
    if (DebugMode >= 2) {
        printf("%s pretime:%d regtime:%d posttime:%d\n",
            yd->symbol,
            (int)yd->pretime, (int)yd->regtime, (int)yd->posttime);
    }

    /* Add premarket / afterhours info. */
    if (!(flags & STONKY_VERY_SHORT)) {
        if (yd->pretime > yd->regtime) {
            s = sdscatprintf(s," | %s: %.02f%s (%s%s)",
                (flags & STONKY_SHORT) ? "pre" : "pre-market",
                yd->pre, yd->csym, yd->prechange[0] == '-' ? "" : "+",
                yd->prechange);
        } else if (yd->posttime > yd->regtime) {
            s = sdscatprintf(s," | %s: %.02f%s (%s%s)",
                (flags & STONKY_SHORT) ? "post" : "after-hours",
                yd->post, yd->csym, yd->postchange[0] == '-' ? "" : "+",
                yd->postchange);
        }
    }
    return s;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %ecx, %ebp
movq %rdx, %rbx
movq %rdi, %r14
testq %rdx, %rdx
je 0x894b
movq 0x58(%rbx), %rdi
xorl %esi, %esi
callq 0x21c0
callq 0x684e
testb $0x2, %bpl
jne 0x8978
testb $0x1, %bpl
jne 0x899d
movq 0x8(%rbx), %r8
cvtss2sd 0x20(%rbx), %xmm0
movq 0x10(%rbx), %rcx
movq 0x70(%rbx), %r10
movq 0x58(%rbx), %r11
testq %r11, %r11
je 0x89f1
cmpb $0x2d, (%r11)
leaq 0x5092(%rip), %rdx      # 0xd9cd
leaq 0x4692(%rip), %r15      # 0xcfd4
cmoveq %rdx, %r15
jmp 0x89f8
movq %rsi, %rdx
testb $0x1, %bpl
leaq 0x4634(%rip), %rax      # 0xcf8d
leaq 0x4614(%rip), %rsi      # 0xcf74
cmoveq %rax, %rsi
movq %r14, %rdi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5814
movq 0x8(%rbx), %rcx
movq 0x58(%rbx), %r10
testq %r10, %r10
je 0x89cb
cmpb $0x2d, (%r10)
leaq 0x503d(%rip), %rdx      # 0xd9cd
leaq 0x463d(%rip), %r9       # 0xcfd4
cmoveq %rdx, %r9
jmp 0x89d2
movq 0x8(%rbx), %rcx
movq 0x58(%rbx), %r10
cvtss2sd 0x20(%rbx), %xmm0
movq 0x70(%rbx), %r9
testq %r10, %r10
je 0x8a1f
cmpb $0x2d, (%r10)
leaq 0x500f(%rip), %rdx      # 0xd9cd
leaq 0x460f(%rip), %r11      # 0xcfd4
cmoveq %rdx, %r11
jmp 0x8a26
leaq 0x4602(%rip), %r9       # 0xcfd4
subq $0x8, %rsp
leaq 0x45c5(%rip), %rsi      # 0xcfa2
movq %r14, %rdi
movq %rax, %rdx
movq %rcx, %r8
xorl %eax, %eax
pushq %r10
callq 0x5814
jmp 0x8a41
leaq 0x45dc(%rip), %r15      # 0xcfd4
subq $0x8, %rsp
leaq 0x4610(%rip), %rsi      # 0xd013
movq %r14, %rdi
movq %rax, %rdx
movq %r8, %r9
movb $0x1, %al
pushq %r11
pushq %r15
pushq %r10
callq 0x5814
addq $0x20, %rsp
jmp 0x8a43
leaq 0x45ae(%rip), %r11      # 0xcfd4
leaq 0x45a9(%rip), %rsi      # 0xcfd6
movq %r14, %rdi
movq %rax, %rdx
movq %rcx, %r8
movb $0x1, %al
pushq %r10
pushq %r11
callq 0x5814
popq %rcx
popq %rdx
movq %rax, %r14
cmpl $0x2, 0xa863(%rip)      # 0x132b0
jl 0x8a6b
movq 0x8(%rbx), %rsi
movl 0x28(%rbx), %edx
movl 0x38(%rbx), %ecx
movl 0x30(%rbx), %r8d
leaq 0x45f9(%rip), %rdi      # 0xd05d
xorl %eax, %eax
callq 0x2030
testb $0x2, %bpl
jne 0x8afa
movq 0x38(%rbx), %rax
cmpq %rax, 0x28(%rbx)
jle 0x8aa0
testb $0x1, %bpl
leaq 0x4613(%rip), %rax      # 0xd09d
leaq 0x4608(%rip), %rdx      # 0xd099
cmoveq %rax, %rdx
cvtss2sd 0x18(%rbx), %xmm0
movq 0x48(%rbx), %r9
jmp 0x8ac5
cmpq %rax, 0x30(%rbx)
jle 0x8afa
testb $0x1, %bpl
leaq 0x45f7(%rip), %rax      # 0xd0a8
leaq 0x5975(%rip), %rdx      # 0xe42d
cmoveq %rax, %rdx
cvtss2sd 0x1c(%rbx), %xmm0
movq 0x50(%rbx), %r9
movq 0x70(%rbx), %rcx
cmpb $0x2d, (%r9)
leaq 0x4ef9(%rip), %rax      # 0xd9cd
leaq 0x44f9(%rip), %r8       # 0xcfd4
cmoveq %rax, %r8
leaq 0x459d(%rip), %rsi      # 0xd083
movq %r14, %rdi
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5814
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq