#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 in_addr {
  int dummy;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_zero;
  struct in_addr sin_addr;
  int /*<<< orphan*/ sin_family;
};
struct hostent {
  scalar_t__ h_addr;
  int /*<<< orphan*/ h_addrtype;
};

/* Variables and functions */
int /*<<< orphan*/ memset(int /*<<< orphan*/ *, char, int);
void *retr(struct sockaddr_in *end, struct hostent *host) {
  end->sin_family = host->h_addrtype;
  end->sin_addr = (*(struct in_addr *)host->h_addr);
  memset(&(end->sin_zero), '\0', sizeof(end->sin_zero));
  return (void *)0;
}


x86 assembly (clang, -O0):
<retr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%rcx
mov    (%rcx),%ecx
mov    %ecx,0x4(%rax)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <memset@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<retr>:
push   %rax
mov    0x8(%rsi),%eax
mov    %eax,0x8(%rdi)
mov    (%rsi),%rax
mov    (%rax),%eax
mov    %eax,0x4(%rdi)
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <memset@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.in_addr, i32 }
%struct.in_addr = type { i32 }
%struct.hostent = type { i64, i32 }
define i8* @retr(%struct.sockaddr_in* %0, %struct.hostent* %1) {
%3 = alloca %struct.sockaddr_in*
%4 = alloca %struct.hostent*
store %struct.sockaddr_in* %0, %struct.sockaddr_in** %3
store %struct.hostent* %1, %struct.hostent** %4
%5 = load %struct.hostent*, %struct.hostent** %4
%6 = getelementptr inbounds %struct.hostent, %struct.hostent* %5, i32 0, i32 1
%7 = load i32, i32* %6
%8 = load %struct.sockaddr_in*, %struct.sockaddr_in** %3
%9 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 2
store i32 %7, i32* %9
%10 = load %struct.sockaddr_in*, %struct.sockaddr_in** %3
%11 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 1
%12 = load %struct.hostent*, %struct.hostent** %4
%13 = getelementptr inbounds %struct.hostent, %struct.hostent* %12, i32 0, i32 0
%14 = load i64, i64* %13
%15 = inttoptr i64 %14 to %struct.in_addr*
%16 = bitcast %struct.in_addr* %11 to i8*
%17 = bitcast %struct.in_addr* %15 to i8*
%18 = load %struct.sockaddr_in*, %struct.sockaddr_in** %3
%19 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %18, i32 0, i32 0
%20 = call i32 @memset(i32* %19, i8 signext 0, i32 4)
ret i8* null
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.in_addr, i32 }
%struct.in_addr = type { i32 }
%struct.hostent = type { i64, i32 }
define noalias i8* @retr(%struct.sockaddr_in* %0, %struct.hostent* nocapture %1) {
%3 = getelementptr inbounds %struct.hostent, %struct.hostent* %1, i64 0, i32 1
%4 = load i32, i32* %3
%5 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %0, i64 0, i32 2
store i32 %4, i32* %5
%6 = getelementptr inbounds %struct.hostent, %struct.hostent* %1, i64 0, i32 0
%7 = load i64, i64* %6
%8 = inttoptr i64 %7 to i32*
%9 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %0, i64 0, i32 1, i32 0
%10 = load i32, i32* %8
store i32 %10, i32* %9
%11 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %0, i64 0, i32 0
%12 = tail call i32 @memset(i32* %11, i8 signext 0, i32 4)
ret i8* null
}