#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 sockaddr_in {
  int /*<<< orphan*/ sin_addr;
};
struct TYPE_2__ {
  struct sockaddr_in *nsaddr_list;
};

/* Variables and functions */
TYPE_1__ _res;
int /*<<< orphan*/ gethostbyaddr_wrapper(char *);
int /*<<< orphan*/ hostent_fprint(int /*<<< orphan*/, int);
char *inet_ntoa(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void server_print(void) {
  struct sockaddr_in def = _res.nsaddr_list[0];
  char *ip = inet_ntoa(def.sin_addr);
  hostent_fprint(gethostbyaddr_wrapper(ip), 1);
  printf("\n");
}


x86 assembly (clang, -O0):
<server_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e99(%rip),%rax
mov    (%rax),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <inet_ntoa@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <gethostbyaddr_wrapper@plt>
mov    %eax,%edi
mov    $0x1,%esi
call   1050 <hostent_fprint@plt>
lea    0xe81(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<server_print>:
push   %rax
mov    0x2ea0(%rip),%rax
mov    (%rax),%rax
mov    (%rax),%edi
call   1040 <inet_ntoa@plt>
mov    %rax,%rdi
call   1060 <gethostbyaddr_wrapper@plt>
mov    %eax,%edi
mov    $0x1,%esi
call   1050 <hostent_fprint@plt>
mov    $0xa,%edi
pop    %rax
jmp    1030 <putchar@plt>

LLVM IR (-O0):
%struct.TYPE_2__ = type { %struct.sockaddr_in* }
%struct.sockaddr_in = type { i32 }
@_res = global %struct.TYPE_2__ zeroinitializer
@.str = [2 x i8] c"\0A\00"
define void @server_print() {
%1 = alloca %struct.sockaddr_in
%2 = alloca i8*
%3 = load %struct.sockaddr_in*, %struct.sockaddr_in** getelementptr inbounds (%struct.TYPE_2__, %struct.TYPE_2__* @_res, i32 0, i32 0)
%4 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0
%5 = bitcast %struct.sockaddr_in* %1 to i8*
%6 = bitcast %struct.sockaddr_in* %4 to i8*
%7 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i32 0, i32 0
%8 = load i32, i32* %7
%9 = call i8* @inet_ntoa(i32 %8)
store i8* %9, i8** %2
%10 = load i8*, i8** %2
%11 = call i32 @gethostbyaddr_wrapper(i8* %10)
%12 = call i32 @hostent_fprint(i32 %11, i32 1)
%13 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.TYPE_2__ = type { %struct.sockaddr_in* }
%struct.sockaddr_in = type { i32 }
@_res = global %struct.TYPE_2__ zeroinitializer
define void @server_print() {
%1 = load %struct.sockaddr_in*, %struct.sockaddr_in** getelementptr inbounds (%struct.TYPE_2__, %struct.TYPE_2__* @_res, i64 0, i32 0)
%2 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 0
%3 = load i32, i32* %2
%4 = tail call i8* @inet_ntoa(i32 %3)
%5 = tail call i32 @gethostbyaddr_wrapper(i8* %4)
%6 = tail call i32 @hostent_fprint(i32 %5, i32 1)
%7 = tail call i32 @putchar(i32 10)
ret void
}