// File: /workspace/github_c_makefile_star2_O0/OpenKMIP[P]libkmip/src/kmip.c
// Function: kmip_encode_request_header
int
kmip_encode_request_header(KMIP *ctx, const RequestHeader *value)
{
    int result = 0;
    result = kmip_encode_int32_be(ctx, TAG_TYPE(KMIP_TAG_REQUEST_HEADER, KMIP_TYPE_STRUCTURE));
    CHECK_RESULT(ctx, result);
    
    uint8 *length_index = ctx->index;
    uint8 *value_index = ctx->index += 4;
    
    result = kmip_encode_protocol_version(ctx, value->protocol_version);
    CHECK_RESULT(ctx, result);
    
    /* HERE (ph) Stopped working here after bug with 0 vs KMIP_UNSET */
    if(value->maximum_response_size != KMIP_UNSET)
    {
        result = kmip_encode_integer(ctx, KMIP_TAG_MAXIMUM_RESPONSE_SIZE, value->maximum_response_size);
        CHECK_RESULT(ctx, result);
    }
    
    if(ctx->version >= KMIP_1_4)
    {
        if(value->client_correlation_value != NULL)
        {
            result = kmip_encode_text_string(ctx, KMIP_TAG_CLIENT_CORRELATION_VALUE, value->client_correlation_value);
            CHECK_RESULT(ctx, result);
        }
        
        if(value->server_correlation_value != NULL)
        {
            result = kmip_encode_text_string(ctx, KMIP_TAG_SERVER_CORRELATION_VALUE, value->server_correlation_value);
            CHECK_RESULT(ctx, result);
        }
    }
    
    if(value->asynchronous_indicator != KMIP_UNSET)
    {
        result = kmip_encode_bool(ctx, KMIP_TAG_ASYNCHRONOUS_INDICATOR, value->asynchronous_indicator);
        CHECK_RESULT(ctx, result);
    }
    
    if(ctx->version >= KMIP_1_2)
    {
        if(value->attestation_capable_indicator != KMIP_UNSET)
        {
            result = kmip_encode_bool(ctx, KMIP_TAG_ATTESTATION_CAPABLE_INDICATOR, value->attestation_capable_indicator);
            CHECK_RESULT(ctx, result);
        }
        
        for(size_t i = 0; i < value->attestation_type_count; i++)
        {
            result = kmip_encode_enum(ctx, KMIP_TAG_ATTESTATION_TYPE, value->attestation_types[i]);
            CHECK_RESULT(ctx, result);
        }
    }
    
    if(value->authentication != NULL)
    {
        result = kmip_encode_authentication(ctx, value->authentication);
        CHECK_RESULT(ctx, result);
    }
    
    if(value->batch_error_continuation_option != 0)
    {
        result = kmip_encode_enum(ctx, KMIP_TAG_BATCH_ERROR_CONTINUATION_OPTION, value->batch_error_continuation_option);
        CHECK_RESULT(ctx, result);
    }
    
    if(value->batch_order_option != KMIP_UNSET)
    {
        result = kmip_encode_bool(ctx, KMIP_TAG_BATCH_ORDER_OPTION, value->batch_order_option);
        CHECK_RESULT(ctx, result);
    }
    
    if(value->time_stamp != 0)
    {
        result = kmip_encode_date_time(ctx, KMIP_TAG_TIME_STAMP, value->time_stamp);
        CHECK_RESULT(ctx, result);
    }
    
    result = kmip_encode_integer(ctx, KMIP_TAG_BATCH_COUNT, value->batch_count);
    CHECK_RESULT(ctx, result);
    
    uint8 *curr_index = ctx->index;
    ctx->index = length_index;

    result = kmip_encode_length(ctx, curr_index - value_index);
    CHECK_RESULT(ctx, result);

    ctx->index = curr_index;
    
    return(KMIP_OK);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
movl $0x42007701, %esi       # imm = 0x42007701
callq 0x60b0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x1548e
movq -0x10(%rbp), %rdi
leaq 0xfd5f(%rip), %rsi      # 0x251d8
movl $0x1f60, %edx           # imm = 0x1F60
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x158cc
jmp 0x15490
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rcx
movq 0x8(%rcx), %rax
addq $0x4, %rax
movq %rax, 0x8(%rcx)
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
callq 0x6be0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x154e9
movq -0x10(%rbp), %rdi
leaq 0xfd04(%rip), %rsi      # 0x251d8
movl $0x1f66, %edx           # imm = 0x1F66
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x158cc
jmp 0x154eb
movq -0x18(%rbp), %rax
cmpl $-0x1, 0x8(%rax)
je 0x15537
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x8(%rax), %edx
movl $0x420050, %esi         # imm = 0x420050
callq 0x6420
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x15533
movq -0x10(%rbp), %rdi
leaq 0xfcba(%rip), %rsi      # 0x251d8
movl $0x1f6c, %edx           # imm = 0x1F6C
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x158cc
jmp 0x15535
jmp 0x15537
movq -0x10(%rbp), %rax
cmpl $0x4, 0x18(%rax)
jb 0x155e3
movq -0x18(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x15593
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x40(%rax), %rdx
movl $0x420105, %esi         # imm = 0x420105
callq 0x66f0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x1558f
movq -0x10(%rbp), %rdi
leaq 0xfc5e(%rip), %rsi      # 0x251d8
movl $0x1f74, %edx           # imm = 0x1F74
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x158cc
jmp 0x15591
jmp 0x15593
movq -0x18(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x155e1
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rdx
movl $0x420106, %esi         # imm = 0x420106
callq 0x66f0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x155dd
movq -0x10(%rbp), %rdi
leaq 0xfc10(%rip), %rsi      # 0x251d8
movl $0x1f7a, %edx           # imm = 0x1F7A
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x158cc
jmp 0x155df
jmp 0x155e1
jmp 0x155e3
movq -0x18(%rbp), %rax
cmpl $-0x1, 0xc(%rax)
je 0x1562f
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0xc(%rax), %edx
movl $0x420007, %esi         # imm = 0x420007
callq 0x65e0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x1562b
movq -0x10(%rbp), %rdi
leaq 0xfbc2(%rip), %rsi      # 0x251d8
movl $0x1f81, %edx           # imm = 0x1F81
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x158cc
jmp 0x1562d
jmp 0x1562f
movq -0x10(%rbp), %rax
cmpl $0x2, 0x18(%rax)
jb 0x156f9
movq -0x18(%rbp), %rax
cmpl $-0x1, 0x2c(%rax)
je 0x15689
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x2c(%rax), %edx
movl $0x4200d3, %esi         # imm = 0x4200D3
callq 0x65e0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x15685
movq -0x10(%rbp), %rdi
leaq 0xfb68(%rip), %rsi      # 0x251d8
movl $0x1f89, %edx           # imm = 0x1F89
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x158cc
jmp 0x15687
jmp 0x15689
movq $0x0, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq 0x38(%rcx), %rax
jae 0x156f7
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x30(%rax), %rax
movq -0x38(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movl $0x4200c7, %esi         # imm = 0x4200C7
callq 0x6770
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x156e5
movq -0x10(%rbp), %rdi
leaq 0xfb08(%rip), %rsi      # 0x251d8
movl $0x1f8f, %edx           # imm = 0x1F8F
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x158cc
jmp 0x156e7
jmp 0x156e9
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x15691
jmp 0x156f9
movq -0x18(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x15742
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0x65f0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x1573e
movq -0x10(%rbp), %rdi
leaq 0xfaaf(%rip), %rsi      # 0x251d8
movl $0x1f96, %edx           # imm = 0x1F96
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x158cc
jmp 0x15740
jmp 0x15742
movq -0x18(%rbp), %rax
cmpl $0x0, 0x18(%rax)
je 0x1578e
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x18(%rax), %edx
movl $0x42000e, %esi         # imm = 0x42000E
callq 0x6770
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x1578a
movq -0x10(%rbp), %rdi
leaq 0xfa63(%rip), %rsi      # 0x251d8
movl $0x1f9c, %edx           # imm = 0x1F9C
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x158cc
jmp 0x1578c
jmp 0x1578e
movq -0x18(%rbp), %rax
cmpl $-0x1, 0x1c(%rax)
je 0x157da
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x1c(%rax), %edx
movl $0x420010, %esi         # imm = 0x420010
callq 0x65e0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x157d6
movq -0x10(%rbp), %rdi
leaq 0xfa17(%rip), %rsi      # 0x251d8
movl $0x1fa2, %edx           # imm = 0x1FA2
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x158cc
jmp 0x157d8
jmp 0x157da
movq -0x18(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x15828
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rdx
movl $0x420092, %esi         # imm = 0x420092
callq 0x6250
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x15824
movq -0x10(%rbp), %rdi
leaq 0xf9c9(%rip), %rsi      # 0x251d8
movl $0x1fa8, %edx           # imm = 0x1FA8
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x158cc
jmp 0x15826
jmp 0x15828
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x28(%rax), %edx
movl $0x42000d, %esi         # imm = 0x42000D
callq 0x6420
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x15863
movq -0x10(%rbp), %rdi
leaq 0xf987(%rip), %rsi      # 0x251d8
movl $0x1fac, %edx           # imm = 0x1FAC
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x158cc
jmp 0x15865
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x30(%rbp), %rax
subq %rax, %rsi
callq 0x6ba0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x158b7
movq -0x10(%rbp), %rdi
leaq 0xf933(%rip), %rsi      # 0x251d8
movl $0x1fb2, %edx           # imm = 0x1FB2
callq 0x6f20
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x158cc
jmp 0x158b9
movq -0x40(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)