#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_family;
};
typedef int /*<<< orphan*/ hints;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ htonl(long);
int /*<<< orphan*/ htons(short);
int /*<<< orphan*/ memset(struct sockaddr_in *, int /*<<< orphan*/, int);
struct sockaddr_in sock_hint(long addr, short port) {
  struct sockaddr_in hints;
  memset(&hints, 0, sizeof(hints));
  hints.sin_family = AF_INET;
  hints.sin_addr.s_addr = htonl(addr);
  hints.sin_port = htons(port);
  return hints;
}


x86 assembly (clang, -O0):
<sock_hint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %si,%ax
mov    %rdi,-0x18(%rbp)
mov    %ax,-0x1a(%rbp)
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1050 <memset@plt>
mov    0x2e8e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <htonl@plt>
mov    %eax,-0xc(%rbp)
movswl -0x1a(%rbp),%edi
call   1030 <htons@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    -0x28(%rbp),%edx
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sock_hint>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0x8(%rsp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1050 <memset@plt>
mov    0x2e95(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x10(%rsp)
mov    %rbx,%rdi
call   1040 <htonl@plt>
mov    %eax,0xc(%rsp)
mov    %ebp,%edi
call   1030 <htons@plt>
mov    %eax,0x8(%rsp)
mov    0x8(%rsp),%rax
mov    0x10(%rsp),%edx
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
@AF_INET = global i32 0
define { i64, i32 } @sock_hint(i64 %0, i16 signext %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca i64
%5 = alloca i16
%6 = alloca { i64, i32 }
store i64 %0, i64* %4
store i16 %1, i16* %5
%7 = call i32 @memset(%struct.sockaddr_in* %3, i32 0, i32 12)
%8 = load i32, i32* @AF_INET
%9 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i32 0, i32 2
store i32 %8, i32* %9
%10 = load i64, i64* %4
%11 = call i32 @htonl(i64 %10)
%12 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i32 0, i32 1
%13 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %12, i32 0, i32 0
store i32 %11, i32* %13
%14 = load i16, i16* %5
%15 = call i32 @htons(i16 signext %14)
%16 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i32 0, i32 0
store i32 %15, i32* %16
%17 = bitcast { i64, i32 }* %6 to i8*
%18 = bitcast %struct.sockaddr_in* %3 to i8*
%19 = load { i64, i32 }, { i64, i32 }* %6
ret { i64, i32 } %19
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
@AF_INET = global i32 0
define { i64, i32 } @sock_hint(i64 %0, i16 signext %1) {
%3 = alloca %struct.sockaddr_in
%4 = call i32 @memset(%struct.sockaddr_in* %3, i32 0, i32 12)
%5 = load i32, i32* @AF_INET
%6 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %5, i32* %6
%7 = call i32 @htonl(i64 %0)
%8 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1, i32 0
store i32 %7, i32* %8
%9 = call i32 @htons(i16 signext %1)
%10 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
store i32 %9, i32* %10
%11 = bitcast %struct.sockaddr_in* %3 to i64*
%12 = load i64, i64* %11
%13 = load i32, i32* %6
%14 = insertvalue { i64, i32 } poison, i64 %12, 0
%15 = insertvalue { i64, i32 } %14, i32 %13, 1
ret { i64, i32 } %15
}