#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 */
typedef int /*<<< orphan*/ uint32_t;
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_family;
  int /*<<< orphan*/ member_0;
};

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ htons(int /*<<< orphan*/ const);
struct sockaddr_in create_server(const uint32_t port) {
  struct sockaddr_in server = {0};
  server.sin_family = AF_INET;
  server.sin_addr.s_addr = htonl(INADDR_ANY);
  server.sin_port = htons(port);
  return server;
}


x86 assembly (clang, -O0):
<create_server>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x14(%rbp)
xorps  %xmm0,%xmm0
movaps %xmm0,-0x10(%rbp)
mov    0x2eaf(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
call   1040 <htonl@plt>
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <htons@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_server>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebp
mov    0x2ebb(%rip),%rax
mov    (%rax),%r14d
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
call   1040 <htonl@plt>
mov    %eax,%ebx
mov    %ebp,%edi
call   1030 <htons@plt>
shl    $0x20,%rbx
mov    %eax,%eax
or     %rbx,%rax
mov    %r14,%rdx
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@AF_INET = global i32 0
@INADDR_ANY = global i32 0
define { i64, i64 } @create_server(i32 %0) {
%2 = load i32, i32* @AF_INET
%3 = zext i32 %2 to i64
%4 = load i32, i32* @INADDR_ANY
%5 = tail call i32 @htonl(i32 %4)
%6 = tail call i32 @htons(i32 %0)
%7 = zext i32 %5 to i64
%8 = shl nuw i64 %7, 32
%9 = zext i32 %6 to i64
%10 = or i64 %8, %9
%11 = insertvalue { i64, i64 } poison, i64 %10, 0
%12 = insertvalue { i64, i64 } %11, i64 %3, 1
ret { i64, i64 } %12
}