// File: /workspace/github_c_makefile_star2_O0/OpenKMIP[P]libkmip/demos/demo_create.c
// Function: use_low_level_api
int
use_low_level_api(const char *server_address,
                  const char *server_port,
                  const char *client_certificate,
                  const char *client_key,
                  const char *ca_certificate)
{
    /* Set up the TLS connection to the KMIP server. */
    SSL_CTX *ctx = NULL;
    SSL *ssl = NULL;
    OPENSSL_init_ssl(0, NULL);
    ctx = SSL_CTX_new(TLS_client_method());
    
    printf("\n");
    printf("Loading the client certificate: %s\n", client_certificate);
    if(SSL_CTX_use_certificate_file(ctx, client_certificate, SSL_FILETYPE_PEM) != 1)
    {
        fprintf(stderr, "Loading the client certificate failed\n");
        ERR_print_errors_fp(stderr);
        SSL_CTX_free(ctx);
        return(-1);
    }
    
    printf("Loading the client key: %s\n", client_key);
    if(SSL_CTX_use_PrivateKey_file(ctx, client_key, SSL_FILETYPE_PEM) != 1)
    {
        fprintf(stderr, "Loading the client key failed\n");
        ERR_print_errors_fp(stderr);
        SSL_CTX_free(ctx);
        return(-1);
    }
    
    printf("Loading the CA certificate: %s\n", ca_certificate);
    if(SSL_CTX_load_verify_locations(ctx, ca_certificate, NULL) != 1)
    {
        fprintf(stderr, "Loading the CA certificate failed\n");
        ERR_print_errors_fp(stderr);
        SSL_CTX_free(ctx);
        return(-1);
    }
    
    BIO *bio = NULL;
    bio = BIO_new_ssl_connect(ctx);
    if(bio == NULL)
    {
        fprintf(stderr, "BIO_new_ssl_connect failed\n");
        ERR_print_errors_fp(stderr);
        SSL_CTX_free(ctx);
        return(-1);
    }
    
    BIO_get_ssl(bio, &ssl);
    SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY);
    BIO_set_conn_hostname(bio, server_address);
    BIO_set_conn_port(bio, server_port);
    if(BIO_do_connect(bio) != 1)
    {
        fprintf(stderr, "BIO_do_connect failed\n");
        ERR_print_errors_fp(stderr);
        BIO_free_all(bio);
        SSL_CTX_free(ctx);
        return(-1);
    }
    
    printf("\n");
    
    /* Set up the KMIP context and the initial encoding buffer. */
    KMIP kmip_context = {0};
    kmip_init(&kmip_context, NULL, 0, KMIP_1_0);
    
    size_t buffer_blocks = 1;
    size_t buffer_block_size = 1024;
    size_t buffer_total_size = buffer_blocks * buffer_block_size;
    
    uint8 *encoding = kmip_context.calloc_func(kmip_context.state, buffer_blocks, buffer_block_size);
    if(encoding == NULL)
    {
        kmip_destroy(&kmip_context);
        BIO_free_all(bio);
        SSL_CTX_free(ctx);
        return(KMIP_MEMORY_ALLOC_FAILED);
    }
    kmip_set_buffer(&kmip_context, encoding, buffer_total_size);
    
    /* Build the request message. */
    Attribute a[3] = {0};
    for(int i = 0; i < 3; i++)
        kmip_init_attribute(&a[i]);
    
    enum cryptographic_algorithm algorithm = KMIP_CRYPTOALG_AES;
    a[0].type = KMIP_ATTR_CRYPTOGRAPHIC_ALGORITHM;
    a[0].value = &algorithm;
    
    int32 length = 256;
    a[1].type = KMIP_ATTR_CRYPTOGRAPHIC_LENGTH;
    a[1].value = &length;
    
    int32 mask = KMIP_CRYPTOMASK_ENCRYPT | KMIP_CRYPTOMASK_DECRYPT;
    a[2].type = KMIP_ATTR_CRYPTOGRAPHIC_USAGE_MASK;
    a[2].value = &mask;
    
    TemplateAttribute ta = {0};
    ta.attributes = a;
    ta.attribute_count = ARRAY_LENGTH(a);
    
    ProtocolVersion pv = {0};
    kmip_init_protocol_version(&pv, kmip_context.version);
    
    RequestHeader rh = {0};
    kmip_init_request_header(&rh);
    
    rh.protocol_version = &pv;
    rh.maximum_response_size = kmip_context.max_message_size;
    rh.time_stamp = time(NULL);
    rh.batch_count = 1;
    
    CreateRequestPayload crp = {0};
    crp.object_type = KMIP_OBJTYPE_SYMMETRIC_KEY;
    crp.template_attribute = &ta;

    RequestBatchItem rbi = {0};
    kmip_init_request_batch_item(&rbi);
    rbi.operation = KMIP_OP_CREATE;
    rbi.request_payload = &crp;
    
    RequestMessage rm = {0};
    rm.request_header = &rh;
    rm.batch_items = &rbi;
    rm.batch_count = 1;

    /* Encode the request message. Dynamically resize the encoding buffer */
    /* if it's not big enough. Once encoding succeeds, send the request   */
    /* message.                                                           */
    int encode_result = kmip_encode_request_message(&kmip_context, &rm);
    while(encode_result == KMIP_ERROR_BUFFER_FULL)
    {
        kmip_reset(&kmip_context);
        kmip_context.free_func(kmip_context.state, encoding);
        
        buffer_blocks += 1;
        buffer_total_size = buffer_blocks * buffer_block_size;
        
        encoding = kmip_context.calloc_func(kmip_context.state, buffer_blocks, buffer_block_size);
        if(encoding == NULL)
        {
            printf("Failure: Could not automatically enlarge the encoding ");
            printf("buffer for the Create request.\n");

            kmip_destroy(&kmip_context);
            BIO_free_all(bio);
            SSL_CTX_free(ctx);
            return(KMIP_MEMORY_ALLOC_FAILED);
        }
        
        kmip_set_buffer(&kmip_context, encoding, buffer_total_size);
        encode_result = kmip_encode_request_message(&kmip_context, &rm);
    }
    
    if(encode_result != KMIP_OK)
    {
        printf("An error occurred while encoding the Create request.\n");
        printf("Error Code: %d\n", encode_result);
        printf("Error Name: ");
        kmip_print_error_string(stderr, encode_result);
        printf("\n");
        printf("Context Error: %s\n", kmip_context.error_message);
        printf("Stack trace:\n");
        kmip_print_stack_trace(stderr, &kmip_context);

        kmip_free_buffer(&kmip_context, encoding, buffer_total_size);
        encoding = NULL;
        kmip_set_buffer(&kmip_context, NULL, 0);
        kmip_destroy(&kmip_context);
        BIO_free_all(bio);
        SSL_CTX_free(ctx);
        return(encode_result);
    }
    
    kmip_print_request_message(stdout, &rm);
    printf("\n");
    
    char *response = NULL;
    int response_size = 0;
    
    int result = kmip_bio_send_request_encoding(&kmip_context, bio, (char *)encoding, kmip_context.index - kmip_context.buffer, &response, &response_size);
    
    BIO_free_all(bio);
    SSL_CTX_free(ctx);
    
    printf("\n");
    if(result < 0)
    {
        printf("An error occurred while creating the symmetric key.\n");
        printf("Error Code: %d\n", result);
        printf("Error Name: ");
        kmip_print_error_string(stderr, result);
        printf("\n");
        printf("Context Error: %s\n", kmip_context.error_message);
        printf("Stack trace:\n");
        kmip_print_stack_trace(stderr, &kmip_context);
        
        kmip_free_buffer(&kmip_context, encoding, buffer_total_size);
        kmip_free_buffer(&kmip_context, response, response_size);
        encoding = NULL;
        response = NULL;
        kmip_set_buffer(&kmip_context, NULL, 0);
        kmip_destroy(&kmip_context);
        return(result);
    }
    
    kmip_free_buffer(&kmip_context, encoding, buffer_total_size);
    encoding = NULL;
    kmip_set_buffer(&kmip_context, response, response_size);
    
    /* Decode the response message and retrieve the operation results. */
    ResponseMessage resp_m = {0};
    int decode_result = kmip_decode_response_message(&kmip_context, &resp_m);
    if(decode_result != KMIP_OK)
    {
        printf("An error occurred while decoding the Create response.\n");
        printf("Error Code: %d\n", decode_result);
        printf("Error Name: ");
        kmip_print_error_string(stderr, decode_result);
        printf("\n");
        printf("Context Error: %s\n", kmip_context.error_message);
        printf("Stack trace:\n");
        kmip_print_stack_trace(stderr, &kmip_context);

        kmip_free_response_message(&kmip_context, &resp_m);
        kmip_free_buffer(&kmip_context, response, response_size);
        response = NULL;
        kmip_set_buffer(&kmip_context, NULL, 0);
        kmip_destroy(&kmip_context);
        return(decode_result);
    }
    
    kmip_print_response_message(stdout, &resp_m);
    printf("\n");

    if(resp_m.batch_count != 1 || resp_m.batch_items == NULL)
    {
        printf("Expected to find one batch item in the Create response.\n");
        kmip_free_response_message(&kmip_context, &resp_m);
        kmip_free_buffer(&kmip_context, response, response_size);
        response = NULL;
        kmip_set_buffer(&kmip_context, NULL, 0);
        kmip_destroy(&kmip_context);
        return(KMIP_MALFORMED_RESPONSE);
    }
    
    ResponseBatchItem req = resp_m.batch_items[0];
    enum result_status result_status = req.result_status;
    
    printf("The KMIP operation was executed with no errors.\n");
    printf("Result: ");
    kmip_print_result_status_enum(stdout, result);
    printf(" (%d)\n\n", result);
    
    if(result == KMIP_STATUS_SUCCESS)
    {
        CreateResponsePayload *pld = (CreateResponsePayload *)req.response_payload;
        if(pld != NULL)
        {
            TextString *uuid = pld->unique_identifier;
            
            if(uuid != NULL)
                printf("Symmetric Key ID: %.*s\n", (int)uuid->size, uuid->value);
        }
    }
    
    /* Clean up the response message, the response buffer, and the KMIP */
    /* context.                                                         */
    kmip_free_response_message(&kmip_context, &resp_m);
    kmip_free_buffer(&kmip_context, response, response_size);
    response = NULL;
    kmip_set_buffer(&kmip_context, NULL, 0);
    kmip_destroy(&kmip_context);
    
    return(result_status);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa90, %rsp            # imm = 0xA90
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
xorl %eax, %eax
movl %eax, %esi
movq %rsi, %rdi
callq 0x2120
callq 0x20b0
movq %rax, %rdi
callq 0x21c0
movq %rax, -0x38(%rbp)
leaq 0x28dd1(%rip), %rdi     # 0x2b3f4
movb $0x0, %al
callq 0x2040
movq -0x20(%rbp), %rsi
leaq 0x28b13(%rip), %rdi     # 0x2b148
movb $0x0, %al
callq 0x2040
movq -0x38(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl $0x1, %edx
callq 0x21b0
cmpl $0x1, %eax
je 0x268f
movq 0x32986(%rip), %rax     # 0x34fe0
movq (%rax), %rdi
leaq 0x28b08(%rip), %rsi     # 0x2b16c
movb $0x0, %al
callq 0x21d0
movq 0x3296e(%rip), %rax     # 0x34fe0
movq (%rax), %rdi
callq 0x20d0
movq -0x38(%rbp), %rdi
callq 0x2050
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3227
movq -0x28(%rbp), %rsi
leaq 0x28af9(%rip), %rdi     # 0x2b193
movb $0x0, %al
callq 0x2040
movq -0x38(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl $0x1, %edx
callq 0x2030
cmpl $0x1, %eax
je 0x26f4
movq 0x32921(%rip), %rax     # 0x34fe0
movq (%rax), %rdi
leaq 0x28ae6(%rip), %rsi     # 0x2b1af
movb $0x0, %al
callq 0x21d0
movq 0x32909(%rip), %rax     # 0x34fe0
movq (%rax), %rdi
callq 0x20d0
movq -0x38(%rbp), %rdi
callq 0x2050
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3227
movq -0x30(%rbp), %rsi
leaq 0x28acf(%rip), %rdi     # 0x2b1ce
movb $0x0, %al
callq 0x2040
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x21a0
cmpl $0x1, %eax
je 0x2758
movq 0x328bd(%rip), %rax     # 0x34fe0
movq (%rax), %rdi
leaq 0x28ac1(%rip), %rsi     # 0x2b1ee
movb $0x0, %al
callq 0x21d0
movq 0x328a5(%rip), %rax     # 0x34fe0
movq (%rax), %rdi
callq 0x20d0
movq -0x38(%rbp), %rdi
callq 0x2050
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3227
movq $0x0, -0x48(%rbp)
movq -0x38(%rbp), %rdi
callq 0x2160
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
jne 0x27b0
movq 0x32865(%rip), %rax     # 0x34fe0
movq (%rax), %rdi
leaq 0x28a8c(%rip), %rsi     # 0x2b211
movb $0x0, %al
callq 0x21d0
movq 0x3284d(%rip), %rax     # 0x34fe0
movq (%rax), %rdi
callq 0x20d0
movq -0x38(%rbp), %rdi
callq 0x2050
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3227
movq -0x48(%rbp), %rdi
movl $0x6e, %esi
xorl %eax, %eax
movl %eax, %edx
leaq -0x40(%rbp), %rcx
callq 0x2060
movq -0x40(%rbp), %rdi
movl $0x21, %esi
movl $0x4, %edx
xorl %eax, %eax
movl %eax, %ecx
callq 0x2070
movq -0x48(%rbp), %rdi
movq -0x10(%rbp), %rcx
movl $0x64, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x2060
movq -0x48(%rbp), %rdi
movq -0x18(%rbp), %rcx
movl $0x64, %esi
movl $0x1, %edx
callq 0x2060
movq -0x48(%rbp), %rdi
movl $0x65, %esi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0x2060
cmpq $0x1, %rax
je 0x286a
movq 0x327b4(%rip), %rax     # 0x34fe0
movq (%rax), %rdi
leaq 0x289f7(%rip), %rsi     # 0x2b22d
movb $0x0, %al
callq 0x21d0
movq 0x3279c(%rip), %rax     # 0x34fe0
movq (%rax), %rdi
callq 0x20d0
movq -0x48(%rbp), %rdi
callq 0x2080
movq -0x38(%rbp), %rdi
callq 0x2050
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3227
leaq 0x28b83(%rip), %rdi     # 0x2b3f4
movb $0x0, %al
callq 0x2040
leaq -0x8e0(%rbp), %rdi
xorl %esi, %esi
movl $0x898, %edx            # imm = 0x898
callq 0x20e0
leaq -0x8e0(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
xorl %ecx, %ecx
movq %rdx, %rsi
callq 0x4570
movq $0x1, -0x8e8(%rbp)
movq $0x400, -0x8f0(%rbp) # imm = 0x400
movq -0x8e8(%rbp), %rax
imulq -0x8f0(%rbp), %rax
movq %rax, -0x8f8(%rbp)
movq -0x78(%rbp), %rax
movq -0x50(%rbp), %rdi
movq -0x8e8(%rbp), %rsi
movq -0x8f0(%rbp), %rdx
callq *%rax
movq %rax, -0x900(%rbp)
cmpq $0x0, -0x900(%rbp)
jne 0x291f
leaq -0x8e0(%rbp), %rdi
callq 0x4940
movq -0x48(%rbp), %rdi
callq 0x2080
movq -0x38(%rbp), %rdi
callq 0x2050
movl $0xfffffff4, -0x4(%rbp) # imm = 0xFFFFFFF4
jmp 0x3227
movq -0x900(%rbp), %rsi
movq -0x8f8(%rbp), %rdx
leaq -0x8e0(%rbp), %rdi
callq 0x48f0
leaq -0x930(%rbp), %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0x20e0
movl $0x0, -0x934(%rbp)
cmpl $0x3, -0x934(%rbp)
jge 0x298a
movslq -0x934(%rbp), %rax
leaq -0x930(%rbp), %rdi
shlq $0x4, %rax
addq %rax, %rdi
callq 0x51c0
movl -0x934(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x934(%rbp)
jmp 0x2956
movl $0x3, -0x938(%rbp)
movl $0x3, -0x930(%rbp)
leaq -0x938(%rbp), %rax
movq %rax, -0x928(%rbp)
movl $0x100, -0x93c(%rbp)    # imm = 0x100
movl $0x4, -0x920(%rbp)
leaq -0x93c(%rbp), %rax
movq %rax, -0x918(%rbp)
movl $0xc, -0x940(%rbp)
movl $0x6, -0x910(%rbp)
leaq -0x940(%rbp), %rax
movq %rax, -0x908(%rbp)
leaq -0x960(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x20e0
leaq -0x930(%rbp), %rax
movq %rax, -0x950(%rbp)
movq $0x3, -0x948(%rbp)
leaq -0x968(%rbp), %rdi
xorl %esi, %esi
movl $0x8, %edx
callq 0x20e0
movl -0x8c8(%rbp), %esi
leaq -0x968(%rbp), %rdi
callq 0x50f0
leaq -0x9b8(%rbp), %rdi
xorl %esi, %esi
movl $0x50, %edx
callq 0x20e0
leaq -0x9b8(%rbp), %rdi
callq 0x5350
leaq -0x968(%rbp), %rax
movq %rax, -0x9b8(%rbp)
movl -0x8c4(%rbp), %eax
movl %eax, -0x9b0(%rbp)
xorl %eax, %eax
movl %eax, %edi
callq 0x2130
movq %rax, -0x998(%rbp)
movl $0x1, -0x990(%rbp)
leaq -0x9d8(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x20e0
movl $0x2, -0x9d8(%rbp)
leaq -0x960(%rbp), %rax
movq %rax, -0x9d0(%rbp)
leaq -0x9f8(%rbp), %rdi
xorl %esi, %esi
movl $0x20, %edx
callq 0x20e0
leaq -0x9f8(%rbp), %rdi
callq 0x5480
movl $0x1, -0x9f8(%rbp)
leaq -0x9d8(%rbp), %rax
movq %rax, -0x9e8(%rbp)
leaq -0xa10(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x20e0
leaq -0x9b8(%rbp), %rax
movq %rax, -0xa10(%rbp)
leaq -0x9f8(%rbp), %rax
movq %rax, -0xa08(%rbp)
movq $0x1, -0xa00(%rbp)
leaq -0x8e0(%rbp), %rdi
leaq -0xa10(%rbp), %rsi
callq 0x12680
movl %eax, -0xa14(%rbp)
cmpl $-0x2, -0xa14(%rbp)
jne 0x2c42
leaq -0x8e0(%rbp), %rdi
callq 0x4850
movq -0x68(%rbp), %rax
movq -0x50(%rbp), %rdi
movq -0x900(%rbp), %rsi
callq *%rax
movq -0x8e8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8e8(%rbp)
movq -0x8e8(%rbp), %rax
imulq -0x8f0(%rbp), %rax
movq %rax, -0x8f8(%rbp)
movq -0x78(%rbp), %rax
movq -0x50(%rbp), %rdi
movq -0x8e8(%rbp), %rsi
movq -0x8f0(%rbp), %rdx
callq *%rax
movq %rax, -0x900(%rbp)
cmpq $0x0, -0x900(%rbp)
jne 0x2c0a
leaq 0x28679(%rip), %rdi     # 0x2b244
movb $0x0, %al
callq 0x2040
leaq 0x286a2(%rip), %rdi     # 0x2b27b
movb $0x0, %al
callq 0x2040
leaq -0x8e0(%rbp), %rdi
callq 0x4940
movq -0x48(%rbp), %rdi
callq 0x2080
movq -0x38(%rbp), %rdi
callq 0x2050
movl $0xfffffff4, -0x4(%rbp) # imm = 0xFFFFFFF4
jmp 0x3227
movq -0x900(%rbp), %rsi
movq -0x8f8(%rbp), %rdx
leaq -0x8e0(%rbp), %rdi
callq 0x48f0
leaq -0x8e0(%rbp), %rdi
leaq -0xa10(%rbp), %rsi
callq 0x12680
movl %eax, -0xa14(%rbp)
jmp 0x2b49
cmpl $0x0, -0xa14(%rbp)
je 0x2d3f
leaq 0x28645(%rip), %rdi     # 0x2b29b
movb $0x0, %al
callq 0x2040
movl -0xa14(%rbp), %esi
leaq 0x28667(%rip), %rdi     # 0x2b2d1
movb $0x0, %al
callq 0x2040
leaq 0x28669(%rip), %rdi     # 0x2b2e1
movb $0x0, %al
callq 0x2040
movq 0x3235a(%rip), %rax     # 0x34fe0
movq (%rax), %rdi
movl -0xa14(%rbp), %esi
callq 0x20200
leaq 0x28759(%rip), %rdi     # 0x2b3f4
movb $0x0, %al
callq 0x2040
movq -0x8b8(%rbp), %rsi
leaq 0x2863e(%rip), %rdi     # 0x2b2ee
movb $0x0, %al
callq 0x2040
leaq 0x28643(%rip), %rdi     # 0x2b301
movb $0x0, %al
callq 0x2040
movq 0x32314(%rip), %rax     # 0x34fe0
movq (%rax), %rdi
leaq -0x8e0(%rbp), %rsi
callq 0x20190
movq -0x900(%rbp), %rsi
movq -0x8f8(%rbp), %rdx
leaq -0x8e0(%rbp), %rdi
callq 0x54c0
movq $0x0, -0x900(%rbp)
leaq -0x8e0(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rsi
callq 0x48f0
leaq -0x8e0(%rbp), %rdi
callq 0x4940
movq -0x48(%rbp), %rdi
callq 0x2080
movq -0x38(%rbp), %rdi
callq 0x2050
movl -0xa14(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x3227
movq 0x32282(%rip), %rax     # 0x34fc8
movq (%rax), %rdi
leaq -0xa10(%rbp), %rsi
callq 0x25a10
leaq 0x28698(%rip), %rdi     # 0x2b3f4
movb $0x0, %al
callq 0x2040
movq $0x0, -0xa20(%rbp)
movl $0x0, -0xa24(%rbp)
movq -0x48(%rbp), %rsi
movq -0x900(%rbp), %rdx
movq -0x8d8(%rbp), %rax
movq -0x8e0(%rbp), %rcx
subq %rcx, %rax
movl %eax, %ecx
leaq -0x8e0(%rbp), %rdi
leaq -0xa20(%rbp), %r8
leaq -0xa24(%rbp), %r9
callq 0x29840
movl %eax, -0xa28(%rbp)
movq -0x48(%rbp), %rdi
callq 0x2080
movq -0x38(%rbp), %rdi
callq 0x2050
leaq 0x28625(%rip), %rdi     # 0x2b3f4
movb $0x0, %al
callq 0x2040
cmpl $0x0, -0xa28(%rbp)
jge 0x2ee6
leaq 0x28525(%rip), %rdi     # 0x2b30f
movb $0x0, %al
callq 0x2040
movl -0xa28(%rbp), %esi
leaq 0x284d3(%rip), %rdi     # 0x2b2d1
movb $0x0, %al
callq 0x2040
leaq 0x284d5(%rip), %rdi     # 0x2b2e1
movb $0x0, %al
callq 0x2040
movq 0x321c6(%rip), %rax     # 0x34fe0
movq (%rax), %rdi
movl -0xa28(%rbp), %esi
callq 0x20200
leaq 0x285c5(%rip), %rdi     # 0x2b3f4
movb $0x0, %al
callq 0x2040
movq -0x8b8(%rbp), %rsi
leaq 0x284aa(%rip), %rdi     # 0x2b2ee
movb $0x0, %al
callq 0x2040
leaq 0x284af(%rip), %rdi     # 0x2b301
movb $0x0, %al
callq 0x2040
movq 0x32180(%rip), %rax     # 0x34fe0
movq (%rax), %rdi
leaq -0x8e0(%rbp), %rsi
callq 0x20190
movq -0x900(%rbp), %rsi
movq -0x8f8(%rbp), %rdx
leaq -0x8e0(%rbp), %rdi
callq 0x54c0
movq -0xa20(%rbp), %rsi
movslq -0xa24(%rbp), %rdx
leaq -0x8e0(%rbp), %rdi
callq 0x54c0
movq $0x0, -0x900(%rbp)
movq $0x0, -0xa20(%rbp)
leaq -0x8e0(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rsi
callq 0x48f0
leaq -0x8e0(%rbp), %rdi
callq 0x4940
movl -0xa28(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x3227
movq -0x900(%rbp), %rsi
movq -0x8f8(%rbp), %rdx
leaq -0x8e0(%rbp), %rdi
callq 0x54c0
movq $0x0, -0x900(%rbp)
movq -0xa20(%rbp), %rsi
movslq -0xa24(%rbp), %rdx
leaq -0x8e0(%rbp), %rdi
callq 0x48f0
leaq -0xa40(%rbp), %rdi
xorl %esi, %esi
movl $0x18, %edx
callq 0x20e0
leaq -0x8e0(%rbp), %rdi
leaq -0xa40(%rbp), %rsi
callq 0x1ed90
movl %eax, -0xa44(%rbp)
cmpl $0x0, -0xa44(%rbp)
je 0x304f
leaq 0x283df(%rip), %rdi     # 0x2b344
movb $0x0, %al
callq 0x2040
movl -0xa44(%rbp), %esi
leaq 0x28358(%rip), %rdi     # 0x2b2d1
movb $0x0, %al
callq 0x2040
leaq 0x2835a(%rip), %rdi     # 0x2b2e1
movb $0x0, %al
callq 0x2040
movq 0x3204b(%rip), %rax     # 0x34fe0
movq (%rax), %rdi
movl -0xa44(%rbp), %esi
callq 0x20200
leaq 0x2844a(%rip), %rdi     # 0x2b3f4
movb $0x0, %al
callq 0x2040
movq -0x8b8(%rbp), %rsi
leaq 0x2832f(%rip), %rdi     # 0x2b2ee
movb $0x0, %al
callq 0x2040
leaq 0x28334(%rip), %rdi     # 0x2b301
movb $0x0, %al
callq 0x2040
movq 0x32005(%rip), %rax     # 0x34fe0
movq (%rax), %rdi
leaq -0x8e0(%rbp), %rsi
callq 0x20190
leaq -0x8e0(%rbp), %rdi
leaq -0xa40(%rbp), %rsi
callq 0x7820
movq -0xa20(%rbp), %rsi
movslq -0xa24(%rbp), %rdx
leaq -0x8e0(%rbp), %rdi
callq 0x54c0
movq $0x0, -0xa20(%rbp)
leaq -0x8e0(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rsi
callq 0x48f0
leaq -0x8e0(%rbp), %rdi
callq 0x4940
movl -0xa44(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x3227
movq 0x31f72(%rip), %rax     # 0x34fc8
movq (%rax), %rdi
leaq -0xa40(%rbp), %rsi
callq 0x25ad0
leaq 0x28388(%rip), %rdi     # 0x2b3f4
movb $0x0, %al
callq 0x2040
cmpq $0x1, -0xa30(%rbp)
jne 0x3087
cmpq $0x0, -0xa38(%rbp)
jne 0x30f8
leaq 0x282ed(%rip), %rdi     # 0x2b37b
movb $0x0, %al
callq 0x2040
leaq -0x8e0(%rbp), %rdi
leaq -0xa40(%rbp), %rsi
callq 0x7820
movq -0xa20(%rbp), %rsi
movslq -0xa24(%rbp), %rdx
leaq -0x8e0(%rbp), %rdi
callq 0x54c0
movq $0x0, -0xa20(%rbp)
leaq -0x8e0(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rsi
callq 0x48f0
leaq -0x8e0(%rbp), %rdi
callq 0x4940
movl $0xfffffff1, -0x4(%rbp) # imm = 0xFFFFFFF1
jmp 0x3227
movq -0xa38(%rbp), %rsi
leaq -0xa78(%rbp), %rdi
movl $0x30, %edx
callq 0x2100
movl -0xa68(%rbp), %eax
movl %eax, -0xa7c(%rbp)
leaq 0x28291(%rip), %rdi     # 0x2b3b4
movb $0x0, %al
callq 0x2040
leaq 0x282b4(%rip), %rdi     # 0x2b3e5
movb $0x0, %al
callq 0x2040
movq 0x31e89(%rip), %rax     # 0x34fc8
movq (%rax), %rdi
movl -0xa28(%rbp), %esi
callq 0x20a60
movl -0xa28(%rbp), %esi
leaq 0x28294(%rip), %rdi     # 0x2b3ee
movb $0x0, %al
callq 0x2040
cmpl $0x0, -0xa28(%rbp)
jne 0x31c7
movq -0xa50(%rbp), %rax
movq %rax, -0xa88(%rbp)
cmpq $0x0, -0xa88(%rbp)
je 0x31c5
movq -0xa88(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xa90(%rbp)
cmpq $0x0, -0xa90(%rbp)
je 0x31c3
movq -0xa90(%rbp), %rax
movq 0x8(%rax), %rax
movl %eax, %esi
movq -0xa90(%rbp), %rax
movq (%rax), %rdx
leaq 0x2823a(%rip), %rdi     # 0x2b3f6
movb $0x0, %al
callq 0x2040
jmp 0x31c5
jmp 0x31c7
leaq -0x8e0(%rbp), %rdi
leaq -0xa40(%rbp), %rsi
callq 0x7820
movq -0xa20(%rbp), %rsi
movslq -0xa24(%rbp), %rdx
leaq -0x8e0(%rbp), %rdi
callq 0x54c0
movq $0x0, -0xa20(%rbp)
leaq -0x8e0(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rsi
callq 0x48f0
leaq -0x8e0(%rbp), %rdi
callq 0x4940
movl -0xa7c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xa90, %rsp            # imm = 0xA90
popq %rbp
retq
nopw %cs:(%rax,%rax)