#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 */
struct sockaddr_un {
  int /*<<< orphan*/ *sun_path;
  int /*<<< orphan*/ sun_family;
};

/* Variables and functions */
int /*<<< orphan*/ AF_UNIX;
int /*<<< orphan*/ memset(struct sockaddr_un *, int /*<<< orphan*/, int);
int /*<<< orphan*/ strncpy(int /*<<< orphan*/ *, char const *const, int);
void init_memtrack_server_addr(struct sockaddr_un *addr) {
  const char *const kAbstractSocketName = "chrome_tracing_memtrack_helper";
  memset(addr, 0, sizeof(*addr));
  addr->sun_family = AF_UNIX;
  strncpy(&addr->sun_path[1], kAbstractSocketName, sizeof(addr->sun_path) - 2);
}


x86 assembly (clang, -O0):
<init_memtrack_server_addr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
mov    0x2e9a(%rip),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
add    $0x4,%rdi
lea    0xe97(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncpy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_memtrack_server_addr>:
push   %rbx
mov    %rdi,%rbx
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
mov    0x2eb1(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x8(%rbx)
mov    (%rbx),%rdi
add    $0x4,%rdi
lea    0xeb6(%rip),%rsi
mov    $0x6,%edx
pop    %rbx
jmp    1030 <strncpy@plt>

LLVM IR (-O0):
%struct.sockaddr_un = type { i32*, i32 }
@.str = [31 x i8] c"chrome_tracing_memtrack_helper\00"
@AF_UNIX = global i32 0
define void @init_memtrack_server_addr(%struct.sockaddr_un* %0) {
%2 = alloca %struct.sockaddr_un*
%3 = alloca i8*
store %struct.sockaddr_un* %0, %struct.sockaddr_un** %2
store i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8** %3
%4 = load %struct.sockaddr_un*, %struct.sockaddr_un** %2
%5 = call i32 @memset(%struct.sockaddr_un* %4, i32 0, i32 16)
%6 = load i32, i32* @AF_UNIX
%7 = load %struct.sockaddr_un*, %struct.sockaddr_un** %2
%8 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %7, i32 0, i32 1
store i32 %6, i32* %8
%9 = load %struct.sockaddr_un*, %struct.sockaddr_un** %2
%10 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %9, i32 0, i32 0
%11 = load i32*, i32** %10
%12 = getelementptr inbounds i32, i32* %11, i64 1
%13 = call i32 @strncpy(i32* %12, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i32 0, i32 0), i32 6)
ret void
}

LLVM IR (-O2):
%struct.sockaddr_un = type { i32*, i32 }
@.str = [31 x i8] c"chrome_tracing_memtrack_helper\00"
@AF_UNIX = global i32 0
define void @init_memtrack_server_addr(%struct.sockaddr_un* %0) {
%2 = tail call i32 @memset(%struct.sockaddr_un* %0, i32 0, i32 16)
%3 = load i32, i32* @AF_UNIX
%4 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %0, i64 0, i32 1
store i32 %3, i32* %4
%5 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %0, i64 0, i32 0
%6 = load i32*, i32** %5
%7 = getelementptr inbounds i32, i32* %6, i64 1
%8 = tail call i32 @strncpy(i32* %7, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 6)
ret void
}