#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*/ serverAddress;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ bzero(char *, int);
int /*<<< orphan*/ htons(size_t);
struct sockaddr_in _getServerAddress(size_t _portNumber) {
  struct sockaddr_in serverAddress = {};
  bzero((char *)&serverAddress, sizeof(serverAddress));
  serverAddress.sin_family = AF_INET;
  serverAddress.sin_addr.s_addr = INADDR_ANY;
  serverAddress.sin_port = htons(_portNumber);
  return serverAddress;
}


x86 assembly (clang, -O0):
<_getServerAddress>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x18(%rbp)
movl   $0x0,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
mov    $0xc,%esi
call   1040 <bzero@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    0x2e84(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <htons@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x20(%rbp),%edx
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_getServerAddress>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
lea    0x8(%rsp),%rdi
mov    $0xc,%esi
call   1040 <bzero@plt>
mov    0x2ea9(%rip),%rax
mov    (%rax),%ebp
mov    0x2e98(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
mov    %rbx,%rdi
call   1030 <htons@plt>
mov    %eax,0x8(%rsp)
mov    0x8(%rsp),%rax
mov    %ebp,%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
@INADDR_ANY = global i32 0
define { i64, i32 } @_getServerAddress(i64 %0) {
%2 = alloca %struct.sockaddr_in
%3 = alloca i64
%4 = alloca { i64, i32 }
store i64 %0, i64* %3
%5 = bitcast %struct.sockaddr_in* %2 to i8*
%6 = bitcast %struct.sockaddr_in* %2 to i8*
%7 = call i32 @bzero(i8* %6, i32 12)
%8 = load i32, i32* @AF_INET
%9 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i32 0, i32 2
store i32 %8, i32* %9
%10 = load i32, i32* @INADDR_ANY
%11 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i32 0, i32 1
%12 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %11, i32 0, i32 0
store i32 %10, i32* %12
%13 = load i64, i64* %3
%14 = call i32 @htons(i64 %13)
%15 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i32 0, i32 0
store i32 %14, i32* %15
%16 = bitcast { i64, i32 }* %4 to i8*
%17 = bitcast %struct.sockaddr_in* %2 to i8*
%18 = load { i64, i32 }, { i64, i32 }* %4
ret { i64, i32 } %18
}

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