// File: /workspace/github_c_makefile_star2_O1/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 $0x28, %rsp
movq %rsi, %r12
movq %rdi, -0x48(%rbp)
xorl %r14d, %r14d
xorl %edi, %edi
callq 0x2170
bswapq %rax
movq %rax, -0x30(%rbp)
movl $0xa0, %edi
callq 0x2220
cmpb $0x1, 0x10(%r12)
movq %rax, -0x38(%rbp)
jne 0x2621
movq %rax, %rbx
callq 0x3d84
movq %rax, %r12
movq %rax, (%rbx)
movl $0x4, (%rax)
movw $0x1, 0x4(%rax)
movl $0x1, %edi
callq 0x2220
movq %rax, 0x8(%r12)
movb $0x1, (%rax)
movw $0xa, %r15w
movb $0x1, %r12b
jmp 0x2629
movw $0x6, %r15w
xorl %r12d, %r12d
callq 0x3d84
movq %rax, %r13
movzbl %r12b, %r12d
movq -0x38(%rbp), %rbx
movq %rax, (%rbx,%r12,8)
movl $0x8, (%rax)
movw $0x8, 0x4(%rax)
movl $0x8, %edi
callq 0x2220
movq %rax, 0x8(%r13)
movq -0x30(%rbp), %rcx
movq %rcx, (%rax)
addw 0x4(%r13), %r15w
callq 0x3d84
movq %rax, 0x8(%rbx,%r12,8)
movl $0x0, (%rax)
addw 0x4(%rax), %r15w
movq %r12, -0x30(%rbp)
addl $0x2, %r12d
callq 0x3e15
movq %rax, %rbx
movzwl %r15w, %r15d
movq %r15, %rdi
callq 0x2220
movq %rax, %r13
movq %rax, 0x8(%rbx)
movq %rbx, -0x40(%rbp)
movw %r15w, 0x2(%rbx)
movzbl %r12b, %ecx
xorl %r12d, %r12d
movl %r14d, %eax
movq -0x38(%rbp), %rdx
movq (%rdx,%r12,8), %r15
movq %rcx, %rbx
movb (%r15), %cl
movb %cl, (%r13,%rax)
movzwl 0x4(%r15), %edx
movl %edx, %ecx
rolw $0x8, %cx
movw %cx, 0x1(%r13,%rax)
leal 0x3(%r14), %edi
addq %r13, %rdi
movq 0x8(%r15), %rsi
callq 0x2150
movq %rbx, %rcx
movzwl 0x4(%r15), %eax
addl %eax, %r14d
addl $0x3, %r14d
incq %r12
cmpq %r12, %rbx
jne 0x26ab
movq -0x38(%rbp), %r12
movq -0x48(%rbp), %rdx
movq 0x50(%rdx), %rax
testq %rax, %rax
je 0x271e
movq -0x40(%rbp), %rsi
movq %rsi, 0x10(%rax)
movzwl 0x2(%rax), %ecx
addw (%rax), %cx
movw %cx, (%rsi)
jmp 0x2726
movq -0x40(%rbp), %rsi
movq %rsi, 0x50(%rdx)
movq -0x30(%rbp), %r15
movzwl 0x2(%rsi), %eax
addq %rax, 0x40(%rdx)
orq $0x2, %r15
xorl %r14d, %r14d
movq (%r12,%r14,8), %rdi
callq 0x3de7
incq %r14
cmpq %r14, %r15
jne 0x2739
movq %r12, %rdi
callq 0x21d0
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq