#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;
};

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ inet_addr(char *);
void defineServerIp(struct sockaddr_in *sad) {
  sad->sin_family = AF_INET;
  (*sad).sin_addr.s_addr = inet_addr("127.0.0.1");
  sad->sin_port = htons(18000);
  return;
}


x86 assembly (clang, -O0):
<defineServerIp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2eb5(%rip),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x8(%rax)
lea    0xebd(%rip),%rdi
call   1040 <inet_addr@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    $0x4650,%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):
<defineServerIp>:
push   %rbx
mov    %rdi,%rbx
mov    0x2ebd(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x8(%rdi)
lea    0xec9(%rip),%rdi
call   1040 <inet_addr@plt>
mov    %eax,0x4(%rbx)
mov    $0x4650,%edi
call   1030 <htons@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
@AF_INET = global i32 0
@.str = [10 x i8] c"127.0.0.1\00"
define void @defineServerIp(%struct.sockaddr_in* %0) {
%2 = alloca %struct.sockaddr_in*
store %struct.sockaddr_in* %0, %struct.sockaddr_in** %2
%3 = load i32, i32* @AF_INET
%4 = load %struct.sockaddr_in*, %struct.sockaddr_in** %2
%5 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 2
store i32 %3, i32* %5
%6 = call i32 @inet_addr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%7 = load %struct.sockaddr_in*, %struct.sockaddr_in** %2
%8 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 1
%9 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %8, i32 0, i32 0
store i32 %6, i32* %9
%10 = call i32 @htons(i32 18000)
%11 = load %struct.sockaddr_in*, %struct.sockaddr_in** %2
%12 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 0
store i32 %10, i32* %12
ret void
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
@AF_INET = global i32 0
@.str = [10 x i8] c"127.0.0.1\00"
define void @defineServerIp(%struct.sockaddr_in* nocapture writeonly %0) {
%2 = load i32, i32* @AF_INET
%3 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %0, i64 0, i32 2
store i32 %2, i32* %3
%4 = tail call i32 @inet_addr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %0, i64 0, i32 1, i32 0
store i32 %4, i32* %5
%6 = tail call i32 @htons(i32 18000)
%7 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %0, i64 0, i32 0
store i32 %6, i32* %7
ret void
}