#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_7__ TYPE_2__;
typedef struct TYPE_6__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ xdrproc_t;
struct TYPE_6__ {
  int /*<<< orphan*/ ypbind_binding_port;
  int /*<<< orphan*/ ypbind_binding_addr;
};
struct ypbind_setdom {
  char *ypsetdom_domain;
  int /*<<< orphan*/ ypsetdom_vers;
  TYPE_1__ ypsetdom_binding;
};
struct timeval {
  int tv_sec;
  scalar_t__ tv_usec;
};
struct sockaddr_in {
  int dummy;
};
struct in_addr {
  int s_addr;
};
struct hostent {
  int /*<<< orphan*/ h_addr;
};
struct TYPE_7__ {
  int /*<<< orphan*/ cl_auth;
};
typedef TYPE_2__ CLIENT;

/* Variables and functions */
int /*<<< orphan*/ IPPROTO_UDP;
int RPC_ANYSOCK;
int /*<<< orphan*/ YPBINDPROC_SETDOM;
int /*<<< orphan*/ YPBINDPROG;
int /*<<< orphan*/ YPBINDVERS;
int YPERR_YPBIND;
int /*<<< orphan*/ YPPROC_NULL;
int /*<<< orphan*/ YPPROG;
int /*<<< orphan*/ YPVERS;
int /*<<< orphan*/ authunix_create_default();
int /*<<< orphan*/ bcopy(int *, int /*<<< orphan*/ *, int);
int clnt_call(TYPE_2__ *, int /*<<< orphan*/, int /*<<< orphan*/,
              struct ypbind_setdom *, int /*<<< orphan*/, int /*<<< orphan*/ *,
              struct timeval);
int /*<<< orphan*/ clnt_destroy(TYPE_2__ *);
int /*<<< orphan*/ clnt_sperrno(int);
TYPE_2__ *clntudp_create(struct sockaddr_in *, int /*<<< orphan*/,
                         int /*<<< orphan*/, struct timeval, int *);
int /*<<< orphan*/ errx(int, char *, char *);
struct hostent *gethostbyname(char *);
int getrpcport(char *, int /*<<< orphan*/, int /*<<< orphan*/,
               int /*<<< orphan*/);
int htons(int);
scalar_t__ inet_aton(char *, struct in_addr *);
int /*<<< orphan*/ memmove(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ memset(struct ypbind_setdom *, int /*<<< orphan*/, int);
int /*<<< orphan*/ warnx(char *, char *, ...);
scalar_t__ xdr_void;
scalar_t__ xdr_ypbind_setdom;
int /*<<< orphan*/ yperr_string(int);
int bind_tohost(struct sockaddr_in *sin, char *dom, char *server) {
  struct ypbind_setdom ypsd;
  struct in_addr iaddr;
  struct hostent *hp;
  struct timeval tv;
  CLIENT *client;
  int sock, port, r;
  port = getrpcport(server, YPPROG, YPPROC_NULL, IPPROTO_UDP);
  if (port == 0)
    errx(1, "%s not running ypserv", server);
  port = htons(port);
  memset(&ypsd, 0, sizeof ypsd);
  if (inet_aton(server, &iaddr) == 0) {
    hp = gethostbyname(server);
    if (hp == NULL)
      errx(1, "can't find address for %s", server);
    memmove(&iaddr.s_addr, hp->h_addr, sizeof(iaddr.s_addr));
  }
  ypsd.ypsetdom_domain = dom;
  bcopy(&iaddr.s_addr, &ypsd.ypsetdom_binding.ypbind_binding_addr,
        sizeof(ypsd.ypsetdom_binding.ypbind_binding_addr));
  bcopy(&port, &ypsd.ypsetdom_binding.ypbind_binding_port,
        sizeof(ypsd.ypsetdom_binding.ypbind_binding_port));
  ypsd.ypsetdom_vers = YPVERS;
  tv.tv_sec = 15;
  tv.tv_usec = 0;
  sock = RPC_ANYSOCK;
  client = clntudp_create(sin, YPBINDPROG, YPBINDVERS, tv, &sock);
  if (client == NULL) {
    warnx("can't yp_bind, reason: %s", yperr_string(YPERR_YPBIND));
    return (YPERR_YPBIND);
  }
  client->cl_auth = authunix_create_default();
  r = clnt_call(client, YPBINDPROC_SETDOM, (xdrproc_t)xdr_ypbind_setdom, &ypsd,
                (xdrproc_t)xdr_void, NULL, tv);
  if (r) {
    warnx("cannot ypset for domain %s on host %s: %s"
          " - make sure ypbind was started with -ypset or -ypsetme",
          dom, server, clnt_sperrno(r));
    clnt_destroy(client);
    return (YPERR_YPBIND);
  }
  clnt_destroy(client);
  return (0);
}


x86 assembly (clang, -O0):
<bind_tohost>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    0x2dc6(%rip),%rax
mov    (%rax),%esi
mov    0x2d8d(%rip),%rax
mov    (%rax),%edx
mov    0x2d64(%rip),%rax
mov    (%rax),%ecx
call   1030 <getrpcport@plt>
mov    %eax,-0x68(%rbp)
cmpl   $0x0,-0x68(%rbp)
jne    124d <bind_tohost+0x5d>
mov    -0x20(%rbp),%rdx
mov    $0x1,%edi
lea    0xdb8(%rip),%rsi
call   1040 <errx@plt>
mov    -0x68(%rbp),%edi
call   1050 <htons@plt>
mov    %eax,-0x68(%rbp)
lea    -0x38(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1070 <memset@plt>
mov    -0x20(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   10a0 <inet_aton@plt>
cmp    $0x0,%rax
jne    12c0 <bind_tohost+0xd0>
mov    -0x20(%rbp),%rdi
call   1080 <gethostbyname@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    12ac <bind_tohost+0xbc>
mov    -0x20(%rbp),%rdx
mov    $0x1,%edi
lea    0xd6f(%rip),%rsi
call   1040 <errx@plt>
lea    -0x40(%rbp),%rdi
mov    -0x48(%rbp),%rax
mov    (%rax),%esi
mov    $0x4,%edx
call   10e0 <memmove@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0x40(%rbp),%rdi
lea    -0x38(%rbp),%rsi
add    $0xc,%rsi
add    $0x4,%rsi
mov    $0x4,%edx
call   10c0 <bcopy@plt>
lea    -0x38(%rbp),%rsi
add    $0xc,%rsi
lea    -0x68(%rbp),%rdi
mov    $0x4,%edx
call   10c0 <bcopy@plt>
mov    0x2cc9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
movl   $0xf,-0x58(%rbp)
movq   $0x0,-0x50(%rbp)
mov    0x2cc6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x64(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2c86(%rip),%rax
mov    (%rax),%esi
mov    0x2c85(%rip),%rax
mov    (%rax),%edx
mov    -0x58(%rbp),%ecx
mov    -0x50(%rbp),%r8
lea    -0x64(%rbp),%r9
call   1110 <clntudp_create@plt>
mov    %rax,-0x60(%rbp)
cmpq   $0x0,-0x60(%rbp)
jne    1384 <bind_tohost+0x194>
mov    0x2c3d(%rip),%rax
mov    (%rax),%edi
call   10b0 <yperr_string@plt>
movslq %eax,%rsi
lea    0xcc4(%rip),%rdi
mov    $0x0,%al
call   1060 <warnx@plt>
mov    0x2c1e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1442 <bind_tohost+0x252>
mov    $0x0,%al
call   1090 <authunix_create_default@plt>
mov    %eax,%ecx
mov    -0x60(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x60(%rbp),%rdi
mov    0x2c02(%rip),%rax
mov    (%rax),%esi
mov    0x2c41(%rip),%rax
mov    (%rax),%rax
mov    %eax,%edx
mov    0x2c1d(%rip),%rax
mov    (%rax),%rax
mov    %eax,%r8d
lea    -0x38(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%r9d
lea    -0x58(%rbp),%rax
mov    (%rax),%r10
mov    %r10,(%rsp)
mov    0x8(%rax),%rax
mov    %rax,0x8(%rsp)
call   10d0 <clnt_call@plt>
mov    %eax,-0x6c(%rbp)
cmpl   $0x0,-0x6c(%rbp)
je     1432 <bind_tohost+0x242>
mov    -0x18(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x6c(%rbp),%edi
call   10f0 <clnt_sperrno@plt>
mov    -0x80(%rbp),%rsi
mov    -0x78(%rbp),%rdx
mov    %eax,%ecx
lea    0xc39(%rip),%rdi
mov    $0x0,%al
call   1060 <warnx@plt>
mov    -0x60(%rbp),%rdi
call   1100 <clnt_destroy@plt>
mov    0x2b70(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1442 <bind_tohost+0x252>
mov    -0x60(%rbp),%rdi
call   1100 <clnt_destroy@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bind_tohost>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x40,%rsp
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,%r15
mov    0x2ddc(%rip),%rax
mov    (%rax),%esi
mov    0x2da3(%rip),%rax
mov    (%rax),%edx
mov    0x2d7a(%rip),%rax
mov    (%rax),%ecx
mov    %r12,%rdi
call   1030 <getrpcport@plt>
mov    %eax,%ebx
test   %eax,%eax
jne    1232 <bind_tohost+0x52>
lea    0xddb(%rip),%rsi
mov    $0x1,%edi
mov    %r12,%rdx
call   1040 <errx@plt>
mov    %ebx,%edi
call   1050 <htons@plt>
mov    %eax,%ebp
lea    0x18(%rsp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1070 <memset@plt>
lea    0x10(%rsp),%rsi
mov    %r12,%rdi
call   10a0 <inet_aton@plt>
test   %rax,%rax
jne    1293 <bind_tohost+0xb3>
mov    %r12,%rdi
call   1080 <gethostbyname@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1282 <bind_tohost+0xa2>
lea    0xda1(%rip),%rsi
mov    $0x1,%edi
mov    %r12,%rdx
call   1040 <errx@plt>
mov    (%rbx),%esi
lea    0x10(%rsp),%rdi
mov    $0x4,%edx
call   10d0 <memmove@plt>
mov    %r14,0x18(%rsp)
mov    0x10(%rsp),%eax
mov    %eax,0x28(%rsp)
mov    %ebp,0x24(%rsp)
mov    0x2d1d(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x20(%rsp)
movl   $0xf,0x30(%rsp)
movq   $0x0,0x38(%rsp)
mov    0x2d17(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x14(%rsp)
mov    0x2cda(%rip),%rax
mov    (%rax),%esi
mov    0x2cd9(%rip),%rax
mov    (%rax),%edx
lea    0x14(%rsp),%r9
mov    %r15,%rdi
mov    $0xf,%ecx
xor    %r8d,%r8d
call   1100 <clntudp_create@plt>
test   %rax,%rax
je     1374 <bind_tohost+0x194>
mov    %rax,%rbx
xor    %r15d,%r15d
xor    %eax,%eax
call   1090 <authunix_create_default@plt>
mov    %eax,(%rbx)
mov    0x2c8f(%rip),%rax
mov    (%rax),%esi
mov    0x2cce(%rip),%rax
mov    (%rax),%edx
mov    0x2cad(%rip),%rax
mov    (%rax),%r8d
movups 0x30(%rsp),%xmm0
movups %xmm0,(%rsp)
lea    0x18(%rsp),%rcx
mov    %rbx,%rdi
xor    %r9d,%r9d
call   10c0 <clnt_call@plt>
test   %eax,%eax
je     1398 <bind_tohost+0x1b8>
mov    %eax,%edi
call   10e0 <clnt_sperrno@plt>
lea    0xcf9(%rip),%rdi
mov    %r14,%rsi
mov    %r12,%rdx
mov    %eax,%ecx
xor    %eax,%eax
call   1060 <warnx@plt>
mov    %rbx,%rdi
call   10f0 <clnt_destroy@plt>
mov    0x2c29(%rip),%rax
mov    (%rax),%r15d
jmp    13a0 <bind_tohost+0x1c0>
mov    0x2c1d(%rip),%rbx
mov    (%rbx),%edi
call   10b0 <yperr_string@plt>
movslq %eax,%rsi
lea    0xca4(%rip),%rdi
xor    %eax,%eax
call   1060 <warnx@plt>
mov    (%rbx),%r15d
jmp    13a0 <bind_tohost+0x1c0>
mov    %rbx,%rdi
call   10f0 <clnt_destroy@plt>
mov    %r15d,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i32 }
%struct.ypbind_setdom = type { i8*, i32, %struct.TYPE_6__ }
%struct.TYPE_6__ = type { i32, i32 }
%struct.in_addr = type { i32 }
%struct.hostent = type { i32 }
%struct.timeval = type { i32, i64 }
%struct.TYPE_7__ = type { i32 }
@YPPROG = global i32 0
@YPPROC_NULL = global i32 0
@IPPROTO_UDP = global i32 0
@.str = [22 x i8] c"%s not running ypserv\00"
@.str.1 = [26 x i8] c"can't find address for %s\00"
@YPVERS = global i32 0
@RPC_ANYSOCK = global i32 0
@YPBINDPROG = global i32 0
@YPBINDVERS = global i32 0
@.str.2 = [26 x i8] c"can't yp_bind, reason: %s\00"
@YPERR_YPBIND = global i32 0
@YPBINDPROC_SETDOM = global i32 0
@xdr_ypbind_setdom = global i64 0
@xdr_void = global i64 0
@.str.3 = [97 x i8] c"cannot ypset for domain %s on host %s: %s - make sure ypbind was started with -ypset or -ypsetme\00"
define i32 @bind_tohost(%struct.sockaddr_in* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca %struct.sockaddr_in*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca %struct.ypbind_setdom
%9 = alloca %struct.in_addr
%10 = alloca %struct.hostent*
%11 = alloca %struct.timeval
%12 = alloca %struct.TYPE_7__*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store %struct.sockaddr_in* %0, %struct.sockaddr_in** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%16 = load i8*, i8** %7
%17 = load i32, i32* @YPPROG
%18 = load i32, i32* @YPPROC_NULL
%19 = load i32, i32* @IPPROTO_UDP
%20 = call i32 @getrpcport(i8* %16, i32 %17, i32 %18, i32 %19)
store i32 %20, i32* %14
%21 = load i32, i32* %14
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %3
%24 = load i8*, i8** %7
%25 = call i32 @errx(i32 1, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %24)
br label %26
26: ; preds = %23, %3
%27 = load i32, i32* %14
%28 = call i32 @htons(i32 %27)
store i32 %28, i32* %14
%29 = call i32 @memset(%struct.ypbind_setdom* %8, i32 0, i32 24)
%30 = load i8*, i8** %7
%31 = call i64 @inet_aton(i8* %30, %struct.in_addr* %9)
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %47
33: ; preds = %26
%34 = load i8*, i8** %7
%35 = call %struct.hostent* @gethostbyname(i8* %34)
store %struct.hostent* %35, %struct.hostent** %10
%36 = load %struct.hostent*, %struct.hostent** %10
%37 = icmp eq %struct.hostent* %36, null
br i1 %37, label %38, label %41
38: ; preds = %33
%39 = load i8*, i8** %7
%40 = call i32 @errx(i32 1, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %39)
br label %41
41: ; preds = %38, %33
%42 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %9, i32 0, i32 0
%43 = load %struct.hostent*, %struct.hostent** %10
%44 = getelementptr inbounds %struct.hostent, %struct.hostent* %43, i32 0, i32 0
%45 = load i32, i32* %44
%46 = call i32 @memmove(i32* %42, i32 %45, i32 4)
br label %47
47: ; preds = %41, %26
%48 = load i8*, i8** %6
%49 = getelementptr inbounds %struct.ypbind_setdom, %struct.ypbind_setdom* %8, i32 0, i32 0
store i8* %48, i8** %49
%50 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %9, i32 0, i32 0
%51 = getelementptr inbounds %struct.ypbind_setdom, %struct.ypbind_setdom* %8, i32 0, i32 2
%52 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %51, i32 0, i32 1
%53 = call i32 @bcopy(i32* %50, i32* %52, i32 4)
%54 = getelementptr inbounds %struct.ypbind_setdom, %struct.ypbind_setdom* %8, i32 0, i32 2
%55 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %54, i32 0, i32 0
%56 = call i32 @bcopy(i32* %14, i32* %55, i32 4)
%57 = load i32, i32* @YPVERS
%58 = getelementptr inbounds %struct.ypbind_setdom, %struct.ypbind_setdom* %8, i32 0, i32 1
store i32 %57, i32* %58
%59 = getelementptr inbounds %struct.timeval, %struct.timeval* %11, i32 0, i32 0
store i32 15, i32* %59
%60 = getelementptr inbounds %struct.timeval, %struct.timeval* %11, i32 0, i32 1
store i64 0, i64* %60
%61 = load i32, i32* @RPC_ANYSOCK
store i32 %61, i32* %13
%62 = load %struct.sockaddr_in*, %struct.sockaddr_in** %5
%63 = load i32, i32* @YPBINDPROG
%64 = load i32, i32* @YPBINDVERS
%65 = bitcast %struct.timeval* %11 to { i32, i64 }*
%66 = getelementptr inbounds { i32, i64 }, { i32, i64 }* %65, i32 0, i32 0
%67 = load i32, i32* %66
%68 = getelementptr inbounds { i32, i64 }, { i32, i64 }* %65, i32 0, i32 1
%69 = load i64, i64* %68
%70 = call %struct.TYPE_7__* @clntudp_create(%struct.sockaddr_in* %62, i32 %63, i32 %64, i32 %67, i64 %69, i32* %13)
store %struct.TYPE_7__* %70, %struct.TYPE_7__** %12
%71 = load %struct.TYPE_7__*, %struct.TYPE_7__** %12
%72 = icmp eq %struct.TYPE_7__* %71, null
br i1 %72, label %73, label %80
73: ; preds = %47
%74 = load i32, i32* @YPERR_YPBIND
%75 = call i32 @yperr_string(i32 %74)
%76 = sext i32 %75 to i64
%77 = inttoptr i64 %76 to i8*
%78 = call i32 (i8*, i8*, ...) @warnx(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* %77)
%79 = load i32, i32* @YPERR_YPBIND
store i32 %79, i32* %4
br label %105
80: ; preds = %47
%81 = call i32 (...) @authunix_create_default()
%82 = load %struct.TYPE_7__*, %struct.TYPE_7__** %12
%83 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %82, i32 0, i32 0
store i32 %81, i32* %83
%84 = load %struct.TYPE_7__*, %struct.TYPE_7__** %12
%85 = load i32, i32* @YPBINDPROC_SETDOM
%86 = load i64, i64* @xdr_ypbind_setdom
%87 = trunc i64 %86 to i32
%88 = load i64, i64* @xdr_void
%89 = trunc i64 %88 to i32
%90 = call i32 @clnt_call(%struct.TYPE_7__* %84, i32 %85, i32 %87, %struct.ypbind_setdom* %8, i32 %89, i32* null, %struct.timeval* byval(%struct.timeval) align 8 %11)
store i32 %90, i32* %15
%91 = load i32, i32* %15
%92 = icmp ne i32 %91, 0
br i1 %92, label %93, label %102
93: ; preds = %80
%94 = load i8*, i8** %6
%95 = load i8*, i8** %7
%96 = load i32, i32* %15
%97 = call i32 @clnt_sperrno(i32 %96)
%98 = call i32 (i8*, i8*, ...) @warnx(i8* getelementptr inbounds ([97 x i8], [97 x i8]* @.str.3, i64 0, i64 0), i8* %94, i8* %95, i32 %97)
%99 = load %struct.TYPE_7__*, %struct.TYPE_7__** %12
%100 = call i32 @clnt_destroy(%struct.TYPE_7__* %99)
%101 = load i32, i32* @YPERR_YPBIND
store i32 %101, i32* %4
br label %105
102: ; preds = %80
%103 = load %struct.TYPE_7__*, %struct.TYPE_7__** %12
%104 = call i32 @clnt_destroy(%struct.TYPE_7__* %103)
store i32 0, i32* %4
br label %105
105: ; preds = %102, %93, %73
%106 = load i32, i32* %4
ret i32 %106
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32 }
%struct.ypbind_setdom = type { i8*, i32, %struct.TYPE_6__ }
%struct.TYPE_6__ = type { i32, i32 }
%struct.in_addr = type { i32 }
%struct.timeval = type { i32, i64 }
%struct.hostent = type { i32 }
%struct.TYPE_7__ = type { i32 }
@YPPROG = global i32 0
@YPPROC_NULL = global i32 0
@IPPROTO_UDP = global i32 0
@.str = [22 x i8] c"%s not running ypserv\00"
@.str.1 = [26 x i8] c"can't find address for %s\00"
@YPVERS = global i32 0
@RPC_ANYSOCK = global i32 0
@YPBINDPROG = global i32 0
@YPBINDVERS = global i32 0
@.str.2 = [26 x i8] c"can't yp_bind, reason: %s\00"
@YPERR_YPBIND = global i32 0
@YPBINDPROC_SETDOM = global i32 0
@xdr_ypbind_setdom = global i64 0
@xdr_void = global i64 0
@.str.3 = [97 x i8] c"cannot ypset for domain %s on host %s: %s - make sure ypbind was started with -ypset or -ypsetme\00"
define i32 @bind_tohost(%struct.sockaddr_in* %0, i8* %1, i8* %2) {
%4 = alloca %struct.ypbind_setdom
%5 = alloca %struct.in_addr
%6 = alloca %struct.timeval
%7 = alloca i32
%8 = bitcast %struct.ypbind_setdom* %4 to i8*
%9 = bitcast %struct.in_addr* %5 to i8*
%10 = bitcast %struct.timeval* %6 to i8*
%11 = bitcast i32* %7 to i8*
%12 = load i32, i32* @YPPROG
%13 = load i32, i32* @YPPROC_NULL
%14 = load i32, i32* @IPPROTO_UDP
%15 = tail call i32 @getrpcport(i8* %2, i32 %12, i32 %13, i32 %14)
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %3
%18 = tail call i32 @errx(i32 1, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %2)
br label %19
19: ; preds = %17, %3
%20 = tail call i32 @htons(i32 %15)
%21 = call i32 @memset(%struct.ypbind_setdom* %4, i32 0, i32 24)
%22 = call i64 @inet_aton(i8* %2, %struct.in_addr* %5)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %34
24: ; preds = %19
%25 = call %struct.hostent* @gethostbyname(i8* %2)
%26 = icmp eq %struct.hostent* %25, null
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = call i32 @errx(i32 1, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* %2)
br label %29
29: ; preds = %27, %24
%30 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %5, i64 0, i32 0
%31 = getelementptr inbounds %struct.hostent, %struct.hostent* %25, i64 0, i32 0
%32 = load i32, i32* %31
%33 = call i32 @memmove(i32* %30, i32 %32, i32 4)
br label %34
34: ; preds = %29, %19
%35 = getelementptr inbounds %struct.ypbind_setdom, %struct.ypbind_setdom* %4, i64 0, i32 0
store i8* %1, i8** %35
%36 = getelementptr inbounds %struct.ypbind_setdom, %struct.ypbind_setdom* %4, i64 0, i32 2, i32 1
%37 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %5, i64 0, i32 0
%38 = load i32, i32* %37
store i32 %38, i32* %36
%39 = getelementptr inbounds %struct.ypbind_setdom, %struct.ypbind_setdom* %4, i64 0, i32 2, i32 0
store i32 %20, i32* %39
%40 = load i32, i32* @YPVERS
%41 = getelementptr inbounds %struct.ypbind_setdom, %struct.ypbind_setdom* %4, i64 0, i32 1
store i32 %40, i32* %41
%42 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i64 0, i32 0
store i32 15, i32* %42
%43 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i64 0, i32 1
store i64 0, i64* %43
%44 = load i32, i32* @RPC_ANYSOCK
store i32 %44, i32* %7
%45 = load i32, i32* @YPBINDPROG
%46 = load i32, i32* @YPBINDVERS
%47 = call %struct.TYPE_7__* @clntudp_create(%struct.sockaddr_in* %0, i32 %45, i32 %46, i32 15, i64 0, i32* %7)
%48 = icmp eq %struct.TYPE_7__* %47, null
br i1 %48, label %49, label %56
49: ; preds = %34
%50 = load i32, i32* @YPERR_YPBIND
%51 = call i32 @yperr_string(i32 %50)
%52 = sext i32 %51 to i64
%53 = inttoptr i64 %52 to i8*
%54 = call i32 (i8*, i8*, ...) @warnx(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* %53)
%55 = load i32, i32* @YPERR_YPBIND
br label %73
56: ; preds = %34
%57 = call i32 (...) @authunix_create_default()
%58 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %47, i64 0, i32 0
store i32 %57, i32* %58
%59 = load i32, i32* @YPBINDPROC_SETDOM
%60 = load i64, i64* @xdr_ypbind_setdom
%61 = trunc i64 %60 to i32
%62 = load i64, i64* @xdr_void
%63 = trunc i64 %62 to i32
%64 = call i32 @clnt_call(%struct.TYPE_7__* %47, i32 %59, i32 %61, %struct.ypbind_setdom* %4, i32 %63, i32* null, %struct.timeval* byval(%struct.timeval) align 8 %6)
%65 = icmp eq i32 %64, 0
br i1 %65, label %71, label %66
66: ; preds = %56
%67 = call i32 @clnt_sperrno(i32 %64)
%68 = call i32 (i8*, i8*, ...) @warnx(i8* getelementptr inbounds ([97 x i8], [97 x i8]* @.str.3, i64 0, i64 0), i8* %1, i8* %2, i32 %67)
%69 = call i32 @clnt_destroy(%struct.TYPE_7__* %47)
%70 = load i32, i32* @YPERR_YPBIND
br label %73
71: ; preds = %56
%72 = call i32 @clnt_destroy(%struct.TYPE_7__* %47)
br label %73
73: ; preds = %71, %66, %49
%74 = phi i32 [ %55, %49 ], [ %70, %66 ], [ 0, %71 ]
ret i32 %74
}