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

/* Type definitions */
struct hostent {
  int /*<<< orphan*/ *h_addr_list;
};

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int INET_ADDRSTRLEN;
int /*<<< orphan*/ bzero(char *, int);
int /*<<< orphan*/ inet_ntop(int /*<<< orphan*/, int /*<<< orphan*/, char *,
                             int);
int /*<<< orphan*/ printf(char *, char *);
void show_ip(struct hostent *hst) {
  char ip[INET_ADDRSTRLEN];
  bzero(ip, INET_ADDRSTRLEN);
  inet_ntop(AF_INET, hst->h_addr_list[0], ip, INET_ADDRSTRLEN);
  printf("IP: %s\n", ip);
}


x86 assembly (clang, -O0):
<show_ip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e95(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x20(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x18(%rbp)
mov    0x2e69(%rip),%rax
mov    (%rax),%esi
call   1050 <bzero@plt>
mov    -0x20(%rbp),%rdx
mov    0x2e67(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%esi
mov    0x2e45(%rip),%rax
mov    (%rax),%ecx
call   1030 <inet_ntop@plt>
mov    -0x20(%rbp),%rsi
lea    0xe5b(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_ip>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    0x2e94(%rip),%rax
mov    (%rax),%r15d
mov    %rsp,%rbx
mov    %r15,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %rbx,%rdi
mov    %r15d,%esi
call   1050 <bzero@plt>
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rax
mov    (%rax),%esi
mov    %rbx,%rdx
mov    %r15d,%ecx
call   1030 <inet_ntop@plt>
lea    0xe7a(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.hostent = type { i32* }
@INET_ADDRSTRLEN = global i32 0
@AF_INET = global i32 0
@.str = [8 x i8] c"IP: %s\0A\00"
define void @show_ip(%struct.hostent* %0) {
%2 = alloca %struct.hostent*
%3 = alloca i8*
%4 = alloca i64
store %struct.hostent* %0, %struct.hostent** %2
%5 = load i32, i32* @INET_ADDRSTRLEN
%6 = zext i32 %5 to i64
%7 = call i8* @llvm.stacksave()
store i8* %7, i8** %3
%8 = alloca i8, i64 %6
store i64 %6, i64* %4
%9 = load i32, i32* @INET_ADDRSTRLEN
%10 = call i32 @bzero(i8* %8, i32 %9)
%11 = load i32, i32* @AF_INET
%12 = load %struct.hostent*, %struct.hostent** %2
%13 = getelementptr inbounds %struct.hostent, %struct.hostent* %12, i32 0, i32 0
%14 = load i32*, i32** %13
%15 = getelementptr inbounds i32, i32* %14, i64 0
%16 = load i32, i32* %15
%17 = load i32, i32* @INET_ADDRSTRLEN
%18 = call i32 @inet_ntop(i32 %11, i32 %16, i8* %8, i32 %17)
%19 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %8)
%20 = load i8*, i8** %3
ret void
}

LLVM IR (-O2):
%struct.hostent = type { i32* }
@INET_ADDRSTRLEN = global i32 0
@AF_INET = global i32 0
@.str = [8 x i8] c"IP: %s\0A\00"
define void @show_ip(%struct.hostent* nocapture %0) {
%2 = load i32, i32* @INET_ADDRSTRLEN
%3 = zext i32 %2 to i64
%4 = alloca i8, i64 %3
%5 = call i32 @bzero(i8* %4, i32 %2)
%6 = load i32, i32* @AF_INET
%7 = getelementptr inbounds %struct.hostent, %struct.hostent* %0, i64 0, i32 0
%8 = load i32*, i32** %7
%9 = load i32, i32* %8
%10 = call i32 @inet_ntop(i32 %6, i32 %9, i8* %4, i32 %2)
%11 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}