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

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ IPPROTO_TCP;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ exit(int);
struct hostent *gethostbyname(char *);
char *inet_ntoa(int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int main() {
  int lsock;
  struct sockaddr_in sin;
  struct hostent *he;
  char *e;
  e = inet_ntoa(sin.sin_addr);
  lsock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
  he = gethostbyname("www.freenet6.org");
  exit(0x0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <inet_ntoa@plt>
mov    %rax,-0x20(%rbp)
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
mov    0x2e65(%rip),%rax
mov    (%rax),%esi
mov    0x2e6c(%rip),%rax
mov    (%rax),%edx
call   1060 <socket@plt>
mov    %eax,-0x8(%rbp)
lea    0xe7b(%rip),%rdi
call   1040 <gethostbyname@plt>
mov    %rax,-0x18(%rbp)
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
call   1030 <inet_ntoa@plt>
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
mov    0x2e7a(%rip),%rax
mov    (%rax),%esi
mov    0x2e81(%rip),%rax
mov    (%rax),%edx
call   1060 <socket@plt>
lea    0xe93(%rip),%rdi
call   1040 <gethostbyname@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32 }
%struct.hostent = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@IPPROTO_TCP = global i32 0
@.str = [17 x i8] c"www.freenet6.org\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.sockaddr_in
%4 = alloca %struct.hostent*
%5 = alloca i8*
store i32 0, i32* %1
%6 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i32 0, i32 0
%7 = load i32, i32* %6
%8 = call i8* @inet_ntoa(i32 %7)
store i8* %8, i8** %5
%9 = load i32, i32* @AF_INET
%10 = load i32, i32* @SOCK_STREAM
%11 = load i32, i32* @IPPROTO_TCP
%12 = call i32 @socket(i32 %9, i32 %10, i32 %11)
store i32 %12, i32* %2
%13 = call %struct.hostent* @gethostbyname(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
store %struct.hostent* %13, %struct.hostent** %4
%14 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.hostent = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@IPPROTO_TCP = global i32 0
@.str = [17 x i8] c"www.freenet6.org\00"
define i32 @main() {
%1 = tail call i8* @inet_ntoa(i32 undef)
%2 = load i32, i32* @AF_INET
%3 = load i32, i32* @SOCK_STREAM
%4 = load i32, i32* @IPPROTO_TCP
%5 = tail call i32 @socket(i32 %2, i32 %3, i32 %4)
%6 = tail call %struct.hostent* @gethostbyname(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 0)
unreachable
}