// File: /workspace/github_c_makefile_star2_O0/TimeToogo[P]ff-proxy/client/c/client.c
// Function: ff_client_make_request
int ff_client_make_request(struct ff_client_config *config, FILE *fd)
{
    ff_log(FF_DEBUG, "Initialising OpenSSL");
    ff_init_openssl();
    ff_log(FF_DEBUG, "Initialised OpenSSL");

    int ret_val = 0;

    struct ff_request *request = ff_request_alloc();
    request->options = malloc(sizeof(struct ff_request_option_node *) * FF_REQUEST_MAX_OPTIONS);

    uint16_t packet_count = 0;
    struct ff_client_packet *packets = NULL;

    uint8_t options_in_payload = ff_client_create_payload_options(request, config);

    ff_client_read_payload_from_file(request, fd);

    ff_request_vectorise_payload(request);

    if (config->encryption.key != NULL)
    {
        if (!ff_client_encrypt_request(request, &config->encryption))
        {
            ff_log(FF_ERROR, "Failed to encrypt payload");
            goto error;
        }
        ff_log(FF_DEBUG, "Encrypted payload using pre-shared key (ciphertext length: %u)", request->payload_length);
    }

    request->options[request->options_length] = ff_request_option_node_alloc();
    request->options[request->options_length]->type = options_in_payload == 0 ? FF_REQUEST_OPTION_TYPE_EOL : FF_REQUEST_OPTION_TYPE_BREAK;
    request->options_length++;

    packets = ff_client_packetise_request(request, &packet_count);

    if (!ff_client_send_request(config, packets, packet_count))
    {
        goto done;
    }
    else
    {
        goto error;
    }

done:
    ret_val = 0;
    goto cleanup;

error:
    ret_val = 1;
    goto cleanup;

cleanup:
    ff_request_free(request);

    for (uint16_t i = 0; i < packet_count; i++)
    {
        FREE(packets[i].value);
    }

    FREE(packets);

    return ret_val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x1, %edi
leaq 0x3ba8(%rip), %rsi      # 0x6004
movb $0x0, %al
callq 0x4480
movb $0x0, %al
callq 0x52f0
movl $0x1, %edi
leaq 0x3ba3(%rip), %rsi      # 0x6019
movb $0x0, %al
callq 0x4480
movl $0x0, -0x14(%rbp)
callq 0x47f0
movq %rax, -0x20(%rbp)
movl $0xa0, %edi
callq 0x2250
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x30(%rax)
movw $0x0, -0x22(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x20(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x2630
movb %al, -0x31(%rbp)
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x28f0
movq -0x20(%rbp), %rdi
callq 0x48e0
movq -0x8(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x2529
movq -0x20(%rbp), %rdi
movq -0x8(%rbp), %rsi
addq $0x18, %rsi
callq 0x36e0
testb $0x1, %al
jne 0x250e
movl $0x4, %edi
leaq 0x3b2b(%rip), %rsi      # 0x602d
movb $0x0, %al
callq 0x4480
jmp 0x25ac
movq -0x20(%rbp), %rax
movq 0x40(%rax), %rdx
movl $0x1, %edi
leaq 0x3b25(%rip), %rsi      # 0x6047
movb $0x0, %al
callq 0x4480
callq 0x4620
movq %rax, %rdx
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rax
movq -0x20(%rbp), %rcx
movzbl 0x28(%rcx), %ecx
movq %rdx, (%rax,%rcx,8)
movzbl -0x31(%rbp), %edx
movl $0x7, %ecx
xorl %eax, %eax
cmpl $0x0, %edx
cmovel %eax, %ecx
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rax
movq -0x20(%rbp), %rdx
movzbl 0x28(%rdx), %edx
movq (%rax,%rdx,8), %rax
movl %ecx, (%rax)
movq -0x20(%rbp), %rax
movb 0x28(%rax), %cl
addb $0x1, %cl
movb %cl, 0x28(%rax)
movq -0x20(%rbp), %rdi
leaq -0x22(%rbp), %rsi
callq 0x2a40
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
movzwl -0x22(%rbp), %edx
callq 0x2ce0
cmpb $0x0, %al
jne 0x25a1
jmp 0x25a3
jmp 0x25ac
movl $0x0, -0x14(%rbp)
jmp 0x25b3
movl $0x1, -0x14(%rbp)
movq -0x20(%rbp), %rdi
callq 0x4820
movw $0x0, -0x34(%rbp)
movzwl -0x34(%rbp), %eax
movzwl -0x22(%rbp), %ecx
cmpl %ecx, %eax
jge 0x260d
jmp 0x25d0
movq -0x30(%rbp), %rax
movzwl -0x34(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rdi
callq 0x2200
movq -0x30(%rbp), %rax
movzwl -0x34(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq $0x0, (%rax)
jmp 0x25ff
movw -0x34(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x34(%rbp)
jmp 0x25c2
jmp 0x260f
movq -0x30(%rbp), %rdi
callq 0x2200
movq $0x0, -0x30(%rbp)
movl -0x14(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)