// File: /workspace/github_c_makefile_star2_O3/TimeToogo[P]ff-proxy/client/c/client.c
// Function: ff_client_create_payload_options
uint8_t ff_client_create_payload_options(struct ff_request *request, struct ff_client_config *config)
{
    uint64_t now = (uint64_t)time(NULL);
    now = htonll(now);

    struct ff_request_payload_node *payload = NULL;
    struct ff_request_option_node **options = malloc(sizeof(struct ff_request_option_node *) * FF_REQUEST_MAX_OPTIONS);
    uint8_t option_i = 0;
    uint16_t length = 0;

    if (config->https)
    {
        options[option_i] = ff_request_option_node_alloc();
        options[option_i]->type = FF_REQUEST_OPTION_TYPE_HTTPS;
        options[option_i]->length = 1;
        options[option_i]->value = malloc(1);
        options[option_i]->value[0] = 1;
        length += sizeof(struct __raw_ff_request_option_header) + options[option_i]->length;
        option_i++;
    }

    options[option_i] = ff_request_option_node_alloc();
    options[option_i]->type = FF_REQUEST_OPTION_TYPE_TIMESTAMP;
    options[option_i]->length = 8;
    options[option_i]->value = malloc(8);
    memcpy(options[option_i]->value, &now, 8);
    length += sizeof(struct __raw_ff_request_option_header) + options[option_i]->length;
    option_i++;

    options[option_i] = ff_request_option_node_alloc();
    options[option_i]->type = FF_REQUEST_OPTION_TYPE_EOL;
    length += sizeof(struct __raw_ff_request_option_header) + options[option_i]->length;
    option_i++;

    payload = ff_request_payload_node_alloc();
    payload->value = malloc(length);
    payload->length = length;

    ff_client_write_options(payload->value, options, option_i);

    ff_client_request_add_payload(request, payload);

    for (uint8_t i = 0; i < option_i; i++)
    {
        ff_request_option_node_free(options[i]);
    }

    FREE(options);

    return option_i;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r14
movq %rdi, -0x58(%rbp)
xorl %r12d, %r12d
xorl %edi, %edi
callq 0x2170
bswapq %rax
movq %rax, -0x30(%rbp)
movl $0xa0, %edi
callq 0x2220
cmpb $0x1, 0x10(%r14)
movq %rax, -0x38(%rbp)
jne 0x2628
movq %rax, %rbx
callq 0x3b40
movq %rax, %r14
movq %rax, (%rbx)
movl $0x4, (%rax)
movw $0x1, 0x4(%rax)
movl $0x1, %edi
callq 0x2220
movq %rax, 0x8(%r14)
movb $0x1, (%rax)
movw $0x12, %r15w
movb $0x1, %r13b
jmp 0x2630
movw $0xe, %r15w
xorl %r13d, %r13d
callq 0x3b40
movq %rax, %r14
movzbl %r13b, %r13d
movq -0x38(%rbp), %rbx
movq %rax, (%rbx,%r13,8)
movl $0x8, (%rax)
movw $0x8, 0x4(%rax)
movl $0x8, %edi
callq 0x2220
movq %rax, 0x8(%r14)
movq -0x30(%rbp), %rcx
movq %rcx, (%rax)
callq 0x3b40
movq %rax, 0x8(%rbx,%r13,8)
movl $0x0, (%rax)
addw 0x4(%rax), %r15w
movq %r13, -0x30(%rbp)
leal 0x2(%r13), %eax
movl %eax, -0x3c(%rbp)
callq 0x3bc9
movq %rax, %r13
movzwl %r15w, %ebx
movq %rbx, %rdi
callq 0x2220
movq %rax, %r14
movq %rax, 0x8(%r13)
movq %rbx, -0x50(%rbp)
movq %r13, -0x48(%rbp)
movw %bx, 0x2(%r13)
movzbl -0x3c(%rbp), %ecx
xorl %r13d, %r13d
movl %r12d, %eax
movq -0x38(%rbp), %rdx
movq (%rdx,%r13,8), %r15
movq %rcx, %rbx
movb (%r15), %cl
movb %cl, (%r14,%rax)
movzwl 0x4(%r15), %edx
movl %edx, %ecx
rolw $0x8, %cx
movw %cx, 0x1(%r14,%rax)
leal 0x3(%r12), %edi
addq %r14, %rdi
movq 0x8(%r15), %rsi
callq 0x2150
movq %rbx, %rcx
movzwl 0x4(%r15), %eax
addl %eax, %r12d
addl $0x3, %r12d
incq %r13
cmpq %r13, %rbx
jne 0x26b4
movq -0x38(%rbp), %r12
movq -0x58(%rbp), %rdx
movq 0x50(%rdx), %rax
testq %rax, %rax
je 0x2727
movq -0x48(%rbp), %rsi
movq %rsi, 0x10(%rax)
movzwl 0x2(%rax), %ecx
addw (%rax), %cx
movw %cx, (%rsi)
jmp 0x272f
movq -0x48(%rbp), %rax
movq %rax, 0x50(%rdx)
movq -0x30(%rbp), %r15
movq -0x50(%rbp), %rax
addq %rax, 0x40(%rdx)
orq $0x2, %r15
xorl %r14d, %r14d
movq (%r12,%r14,8), %rdi
callq 0x3ba3
incq %r14
cmpq %r14, %r15
jne 0x2742
movq %r12, %rdi
callq 0x21d0
movl %ebx, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq