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

/* Variables and functions */
int /*<<< orphan*/ host_ip(char *, unsigned char *);
int init_client_ip(int *, unsigned char *, int, int);
int init_client(int *sock, char *host, int port, int type) {
  unsigned char ip[4];
  short p = 0;
  if (!host_ip(host, &(ip[0]))) {
    return (0);
  }
  if (p != 0)
    port = p;
  return (init_client_ip(sock, ip, port, type));
}


x86 assembly (clang, -O0):
<init_client>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
movw   $0x0,-0x26(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x24(%rbp),%rsi
call   1030 <host_ip@plt>
cmp    $0x0,%eax
jne    115e <init_client+0x3e>
movl   $0x0,-0x4(%rbp)
jmp    1188 <init_client+0x68>
movswl -0x26(%rbp),%eax
cmp    $0x0,%eax
je     1172 <init_client+0x52>
movswl -0x26(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x24(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
call   1040 <init_client_ip@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_client>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %ecx,%r14d
mov    %edx,%ebp
mov    %rsi,%rax
mov    %rdi,%rbx
lea    0xc(%rsp),%rsi
mov    %rax,%rdi
call   1030 <host_ip@plt>
test   %eax,%eax
je     1158 <init_client+0x38>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
mov    %ebp,%edx
mov    %r14d,%ecx
call   1040 <init_client_ip@plt>
jmp    115a <init_client+0x3a>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @init_client(i32* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca [4 x i8]
%11 = alloca i16
store i32* %0, i32** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i16 0, i16* %11
%12 = load i8*, i8** %7
%13 = getelementptr inbounds [4 x i8], [4 x i8]* %10, i64 0, i64 0
%14 = call i32 @host_ip(i8* %12, i8* %13)
%15 = icmp ne i32 %14, 0
br i1 %15, label %17, label %16
16: ; preds = %4
store i32 0, i32* %5
br label %30
17: ; preds = %4
%18 = load i16, i16* %11
%19 = sext i16 %18 to i32
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = load i16, i16* %11
%23 = sext i16 %22 to i32
store i32 %23, i32* %8
br label %24
24: ; preds = %21, %17
%25 = load i32*, i32** %6
%26 = getelementptr inbounds [4 x i8], [4 x i8]* %10, i64 0, i64 0
%27 = load i32, i32* %8
%28 = load i32, i32* %9
%29 = call i32 @init_client_ip(i32* %25, i8* %26, i32 %27, i32 %28)
store i32 %29, i32* %5
br label %30
30: ; preds = %24, %16
%31 = load i32, i32* %5
ret i32 %31
}

LLVM IR (-O2):
define i32 @init_client(i32* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca [4 x i8]
%6 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
%7 = call i32 @host_ip(i8* %1, i8* %6)
%8 = icmp eq i32 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %4
%10 = call i32 @init_client_ip(i32* %0, i8* %6, i32 %2, i32 %3)
br label %11
11: ; preds = %4, %9
%12 = phi i32 [ %10, %9 ], [ 0, %4 ]
ret i32 %12
}