// File: /workspace/github_c_makefile_star2_O0/snow1eo[P]IPsec_IKEv2/./transforms.c
// Function: char2ts
uint32_t char2ts (uint8_t *buf, traffic_selector *ts)
{
    uint32_t offset = 0;
    CPY (buf, offset, ts->TS_type);
    CPY (buf, offset, ts->IP_protocol_ID);
    CPY (buf, offset, ts->selector_length);
    CPY (buf, offset, ts->start_port);
    CPY (buf, offset, ts->end_port);
    uint16_t tmp_l = (ts->selector_length - offset)/2;
    ts->starting_address = calloc (tmp_l, 1);
    memcpy (ts->starting_address, buf+offset, tmp_l);
    offset += tmp_l;
    ts->ending_address = calloc (tmp_l, 1);
    memcpy (ts->ending_address, buf+offset, tmp_l);
    return ts->selector_length;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %eax
addq %rax, %rdi
movl $0x1, %esi
callq 0x3050
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
movl -0x14(%rbp), %edx
movb (%rcx,%rdx), %cl
movb %cl, (%rax)
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %eax
addq %rax, %rdi
movl $0x1, %esi
callq 0x3050
movl -0x14(%rbp), %eax
addq $0x1, %rax
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %eax
addq %rax, %rdi
movl $0x1, %esi
callq 0x3050
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
movl -0x14(%rbp), %edx
movb (%rcx,%rdx), %cl
movb %cl, 0x1(%rax)
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %eax
addq %rax, %rdi
movl $0x1, %esi
callq 0x3050
movl -0x14(%rbp), %eax
addq $0x1, %rax
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %eax
addq %rax, %rdi
movl $0x2, %esi
callq 0x3050
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
movl -0x14(%rbp), %edx
movw (%rcx,%rdx), %cx
movw %cx, 0x2(%rax)
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %eax
addq %rax, %rdi
movl $0x2, %esi
callq 0x3050
movl -0x14(%rbp), %eax
addq $0x2, %rax
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %eax
addq %rax, %rdi
movl $0x2, %esi
callq 0x3050
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
movl -0x14(%rbp), %edx
movw (%rcx,%rdx), %cx
movw %cx, 0x4(%rax)
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %eax
addq %rax, %rdi
movl $0x2, %esi
callq 0x3050
movl -0x14(%rbp), %eax
addq $0x2, %rax
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %eax
addq %rax, %rdi
movl $0x2, %esi
callq 0x3050
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
movl -0x14(%rbp), %edx
movw (%rcx,%rdx), %cx
movw %cx, 0x6(%rax)
movq -0x8(%rbp), %rdi
movl -0x14(%rbp), %eax
addq %rax, %rdi
movl $0x2, %esi
callq 0x3050
movl -0x14(%rbp), %eax
addq $0x2, %rax
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rax
movzwl 0x2(%rax), %eax
subl -0x14(%rbp), %eax
shrl %eax
movw %ax, -0x16(%rbp)
movzwl -0x16(%rbp), %eax
movl %eax, %edi
movl $0x1, %esi
callq 0x3250
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rsi
movl -0x14(%rbp), %eax
addq %rax, %rsi
movzwl -0x16(%rbp), %eax
movl %eax, %edx
callq 0x32c0
movzwl -0x16(%rbp), %eax
addl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
movzwl -0x16(%rbp), %eax
movl %eax, %edi
movl $0x1, %esi
callq 0x3250
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x8(%rbp), %rsi
movl -0x14(%rbp), %eax
addq %rax, %rsi
movzwl -0x16(%rbp), %eax
movl %eax, %edx
callq 0x32c0
movq -0x10(%rbp), %rax
movzwl 0x2(%rax), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)