#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_in6 {
  int /*<<< orphan*/ sin6_port;
  int /*<<< orphan*/ sin6_addr;
  int /*<<< orphan*/ sin6_family;
};

/* Variables and functions */
int /*<<< orphan*/ AF_INET6;
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ in6addr_any;
int /*<<< orphan*/ memset(struct sockaddr_in6 *, int /*<<< orphan*/, int);
void ls_sockaddr_v6_any(struct sockaddr_in6 *sa, int port) {
  memset(sa, 0, sizeof(*sa));
  sa->sin6_family = AF_INET6;
  sa->sin6_addr = in6addr_any;
  sa->sin6_port = htons(port);
}


x86 assembly (clang, -O0):
<ls_sockaddr_v6_any>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1040 <memset@plt>
mov    0x2e9a(%rip),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    0x2e9a(%rip),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0xc(%rbp),%edi
call   1030 <htons@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ls_sockaddr_v6_any>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
xor    %esi,%esi
mov    $0xc,%edx
call   1040 <memset@plt>
mov    0x2ea5(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x8(%rbx)
mov    0x2ea9(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x4(%rbx)
mov    %ebp,%edi
call   1030 <htons@plt>
mov    %eax,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr_in6 = type { i32, i32, i32 }
@AF_INET6 = global i32 0
@in6addr_any = global i32 0
define void @ls_sockaddr_v6_any(%struct.sockaddr_in6* %0, i32 %1) {
%3 = alloca %struct.sockaddr_in6*
%4 = alloca i32
store %struct.sockaddr_in6* %0, %struct.sockaddr_in6** %3
store i32 %1, i32* %4
%5 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %3
%6 = call i32 @memset(%struct.sockaddr_in6* %5, i32 0, i32 12)
%7 = load i32, i32* @AF_INET6
%8 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %3
%9 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %8, i32 0, i32 2
store i32 %7, i32* %9
%10 = load i32, i32* @in6addr_any
%11 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %3
%12 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %11, i32 0, i32 1
store i32 %10, i32* %12
%13 = load i32, i32* %4
%14 = call i32 @htons(i32 %13)
%15 = load %struct.sockaddr_in6*, %struct.sockaddr_in6** %3
%16 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %15, i32 0, i32 0
store i32 %14, i32* %16
ret void
}

LLVM IR (-O2):
%struct.sockaddr_in6 = type { i32, i32, i32 }
@AF_INET6 = global i32 0
@in6addr_any = global i32 0
define void @ls_sockaddr_v6_any(%struct.sockaddr_in6* %0, i32 %1) {
%3 = tail call i32 @memset(%struct.sockaddr_in6* %0, i32 0, i32 12)
%4 = load i32, i32* @AF_INET6
%5 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %0, i64 0, i32 2
store i32 %4, i32* %5
%6 = load i32, i32* @in6addr_any
%7 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %0, i64 0, i32 1
store i32 %6, i32* %7
%8 = tail call i32 @htons(i32 %1)
%9 = getelementptr inbounds %struct.sockaddr_in6, %struct.sockaddr_in6* %0, i64 0, i32 0
store i32 %8, i32* %9
ret void
}