#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ u_char;

/* Variables and functions */
int NS_INADDRSZ;
int /*<<< orphan*/ memcpy(void *, char const *, int);
void _map_v4v6_address(const char *src, char *dst) {
  u_char *p = (u_char *)dst;
  char tmp[NS_INADDRSZ];
  int i;
  memcpy(tmp, src, NS_INADDRSZ);
  for (i = 0; i < 10; i++)
    *p++ = 0x00;
  *p++ = 0xff;
  *p++ = 0xff;
  memcpy((void *)p, tmp, NS_INADDRSZ);
}


x86 assembly (clang, -O0):
<_map_v4v6_address>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    0x2ea9(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x38(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rsi
mov    0x2e79(%rip),%rax
mov    (%rax),%edx
call   1030 <memcpy@plt>
movl   $0x0,-0x2c(%rbp)
cmpl   $0xa,-0x2c(%rbp)
jge    119a <_map_v4v6_address+0x8a>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x18(%rbp)
movl   $0x0,(%rax)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    116d <_map_v4v6_address+0x5d>
mov    -0x38(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x18(%rbp)
movl   $0xff,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x18(%rbp)
movl   $0xff,(%rax)
mov    -0x18(%rbp),%rdi
mov    0x2e05(%rip),%rax
mov    (%rax),%edx
call   1030 <memcpy@plt>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_map_v4v6_address>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%rsi
mov    0x2eb1(%rip),%r15
mov    (%r15),%edx
mov    %rsp,%r14
mov    %rdx,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
mov    %r14,%rdi
call   1030 <memcpy@plt>
xorps  %xmm0,%xmm0
movups %xmm0,(%rbx)
movups %xmm0,0x10(%rbx)
movq   $0x0,0x20(%rbx)
movabs $0xff000000ff,%rax
mov    %rax,0x28(%rbx)
add    $0x30,%rbx
mov    (%r15),%edx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <memcpy@plt>
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@NS_INADDRSZ = global i32 0
define void @_map_v4v6_address(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to i32*
store i32* %10, i32** %5
%11 = load i32, i32* @NS_INADDRSZ
%12 = zext i32 %11 to i64
%13 = call i8* @llvm.stacksave()
store i8* %13, i8** %6
%14 = alloca i8, i64 %12
store i64 %12, i64* %7
%15 = load i8*, i8** %3
%16 = load i32, i32* @NS_INADDRSZ
%17 = call i32 @memcpy(i8* %14, i8* %15, i32 %16)
store i32 0, i32* %8
br label %18
18: ; preds = %24, %2
%19 = load i32, i32* %8
%20 = icmp slt i32 %19, 10
br i1 %20, label %21, label %27
21: ; preds = %18
%22 = load i32*, i32** %5
%23 = getelementptr inbounds i32, i32* %22, i32 1
store i32* %23, i32** %5
store i32 0, i32* %22
br label %24
24: ; preds = %21
%25 = load i32, i32* %8
%26 = add nsw i32 %25, 1
store i32 %26, i32* %8
br label %18
27: ; preds = %18
%28 = load i32*, i32** %5
%29 = getelementptr inbounds i32, i32* %28, i32 1
store i32* %29, i32** %5
store i32 255, i32* %28
%30 = load i32*, i32** %5
%31 = getelementptr inbounds i32, i32* %30, i32 1
store i32* %31, i32** %5
store i32 255, i32* %30
%32 = load i32*, i32** %5
%33 = bitcast i32* %32 to i8*
%34 = load i32, i32* @NS_INADDRSZ
%35 = call i32 @memcpy(i8* %33, i8* %14, i32 %34)
%36 = load i8*, i8** %6
ret void
}

LLVM IR (-O2):
@NS_INADDRSZ = global i32 0
define void @_map_v4v6_address(i8* %0, i8* %1) {
%3 = load i32, i32* @NS_INADDRSZ
%4 = zext i32 %3 to i64
%5 = alloca i8, i64 %4
%6 = call i32 @memcpy(i8* %5, i8* %0, i32 %3)
%7 = getelementptr i8, i8* %1, i64 40
%8 = bitcast i8* %7 to i32*
%9 = getelementptr i8, i8* %1, i64 44
%10 = bitcast i8* %9 to i32*
store i32 255, i32* %8
%11 = getelementptr i8, i8* %1, i64 48
store i32 255, i32* %10
%12 = load i32, i32* @NS_INADDRSZ
%13 = call i32 @memcpy(i8* %11, i8* %5, i32 %12)
ret void
}