#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_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
struct hostent {
  int /*<<< orphan*/ h_length;
  scalar_t__ h_addr;
};
typedef int /*<<< orphan*/ serv_addr;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ bcopy(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ bzero(char *, int);
int /*<<< orphan*/ close(int);
scalar_t__ connect(int, struct sockaddr *, int);
int /*<<< orphan*/ error(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
struct hostent *gethostbyname(char *);
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ printf(char *, ...);
int read(int, char *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
scalar_t__ strcmp(char *, char *);
int strlen(char *);
int write(int, char *, int);
int main(int argc, char *argv[]) {
  int sockfd, n;
  struct sockaddr_in serv_addr;
  struct hostent *server;
  char consulta[256];
  char respuesta[256];
  if (argc < 2) {
    fprintf(stderr, "ejecutar %s nombre_servidor_o_IP \n", argv[0]);
    exit(0);
  }
  sockfd = socket(AF_INET, SOCK_STREAM, 0);
  if (sockfd < 0)
    error("ERROR opening socket");
  server = gethostbyname(argv[1]);
  if (server == NULL) {
    fprintf(
        stderr,
        "ERROR, no encuentro el nombre del servidor, use su IP directamente\n");
    exit(0);
  }
  bzero((char *)&serv_addr, sizeof(serv_addr));
  serv_addr.sin_family = AF_INET;
  bcopy((char *)server->h_addr, (char *)&serv_addr.sin_addr.s_addr,
        server->h_length);
  serv_addr.sin_port = htons(2006);
  if (connect(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) {
    error("ERROR no puede conectar");
    exit(0);
  }
  printf("Bienvenido a cliente unoDb\n");
  printf("Conectado a servidor %s\n", argv[1]);
  printf("Server version: 2.0.0\n\n");
  while ((strcmp(consulta, "salir")) && (strcmp(consulta, "bajarservidor"))) {
    printf("unoDb>");
    gets(consulta);
    fflush(stdin);
    if (strcmp(consulta, "salir")) {
      if (strlen(consulta)) {
        n = write(sockfd, consulta, strlen(consulta));
        if (n < 0)
          error("ERROR de escritura en el servidor");
        bzero(respuesta, 256);
        n = read(sockfd, respuesta, 255);
        if (n < 0)
          error("ERROR leyendo del servidor");
        printf("%s\n", respuesta);
      }
    } else {
      n = write(sockfd, "saliocliente", 12);
      printf("Chau\n");
    }
  }
  close(sockfd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x250,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1258 <main+0x48>
mov    0x2d96(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdb6(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
xor    %edi,%edi
call   1110 <exit@plt>
mov    0x2d89(%rip),%rax
mov    (%rax),%edi
mov    0x2d60(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1130 <socket@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    128a <main+0x7a>
lea    0xd9e(%rip),%rdi
call   10f0 <error@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10a0 <gethostbyname@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    12c4 <main+0xb4>
mov    0x2d23(%rip),%rax
mov    (%rax),%edi
lea    0xd82(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
xor    %edi,%edi
call   1110 <exit@plt>
lea    -0x28(%rbp),%rdi
mov    $0xc,%esi
call   1100 <bzero@plt>
mov    0x2d0f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x30(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x28(%rbp),%rsi
add    $0x4,%rsi
mov    -0x30(%rbp),%rax
mov    (%rax),%edx
call   10e0 <bcopy@plt>
mov    $0x7d6,%edi
call   1050 <htons@plt>
mov    %eax,-0x28(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0xc,%edx
call   1120 <connect@plt>
cmp    $0x0,%rax
jge    1334 <main+0x124>
lea    0xd54(%rip),%rdi
call   10f0 <error@plt>
xor    %edi,%edi
call   1110 <exit@plt>
lea    0xd59(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xd5f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd6a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x130(%rbp),%rdi
lea    0xd6d(%rip),%rsi
call   1090 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x231(%rbp)
je     13ae <main+0x19e>
lea    -0x130(%rbp),%rdi
lea    0xd4b(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x231(%rbp)
mov    -0x231(%rbp),%al
test   $0x1,%al
jne    13c1 <main+0x1b1>
jmp    14ed <main+0x2dd>
lea    0xd2d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x130(%rbp),%rdi
call   10c0 <gets@plt>
mov    0x2bfe(%rip),%rax
mov    (%rax),%edi
call   10d0 <fflush@plt>
lea    -0x130(%rbp),%rdi
lea    0xcea(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
je     14c3 <main+0x2b3>
lea    -0x130(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x0,%eax
je     14be <main+0x2ae>
mov    -0x14(%rbp),%eax
mov    %eax,-0x244(%rbp)
lea    -0x130(%rbp),%rax
mov    %rax,-0x240(%rbp)
lea    -0x130(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x244(%rbp),%edi
mov    -0x240(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    146b <main+0x25b>
lea    0xc96(%rip),%rdi
call   10f0 <error@plt>
lea    -0x230(%rbp),%rdi
mov    $0x100,%esi
call   1100 <bzero@plt>
mov    -0x14(%rbp),%edi
lea    -0x230(%rbp),%rsi
mov    $0xff,%edx
call   1080 <read@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    14a9 <main+0x299>
lea    0xc7a(%rip),%rdi
call   10f0 <error@plt>
lea    -0x230(%rbp),%rsi
lea    0xc0e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    14e8 <main+0x2d8>
mov    -0x14(%rbp),%edi
lea    0xc6c(%rip),%rsi
mov    $0xc,%edx
call   1030 <write@plt>
mov    %eax,-0x18(%rbp)
lea    0xc65(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1366 <main+0x156>
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
xor    %eax,%eax
add    $0x250,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x218,%rsp
mov    %rsi,%r14
cmp    $0x1,%edi
jle    1438 <main+0x218>
mov    0x2da4(%rip),%r15
mov    (%r15),%edi
mov    0x2d7a(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1140 <socket@plt>
mov    %eax,%r12d
test   %eax,%eax
jns    126a <main+0x4a>
lea    0xdbe(%rip),%rdi
call   1100 <error@plt>
mov    0x8(%r14),%rdi
call   10b0 <gethostbyname@plt>
test   %rax,%rax
je     1459 <main+0x239>
mov    %rax,%rbp
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xc,%esi
call   1110 <bzero@plt>
mov    (%r15),%eax
mov    %eax,0x8(%rsp)
mov    0x8(%rbp),%rsi
lea    0x4(%rsp),%rdi
mov    0x0(%rbp),%edx
call   10f0 <memmove@plt>
mov    $0x7d6,%edi
call   1060 <htons@plt>
mov    %eax,(%rsp)
mov    %r12d,%edi
mov    %rbx,%rsi
mov    $0xc,%edx
call   1130 <connect@plt>
test   %rax,%rax
js     1477 <main+0x257>
lea    0xe3e(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%r14),%rsi
lea    0xdb0(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xe3b(%rip),%rdi
call   1030 <puts@plt>
lea    0xdaf(%rip),%rsi
lea    0x10(%rsp),%rdi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     141c <main+0x1fc>
lea    0xd9b(%rip),%r14
lea    0x10(%rsp),%rbx
mov    0x2cbc(%rip),%r15
lea    0xd82(%rip),%rbp
lea    0x110(%rsp),%r13
jmp    1374 <main+0x154>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r12d,%edi
lea    0xdbb(%rip),%rsi
mov    $0xc,%edx
call   1040 <write@plt>
lea    0xde9(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     141c <main+0x1fc>
mov    %rbx,%rdi
mov    %r14,%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     141c <main+0x1fc>
lea    0xd32(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
call   10d0 <gets@plt>
mov    (%r15),%edi
call   10e0 <fflush@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     1340 <main+0x120>
mov    %rbx,%rdi
call   1050 <strlen@plt>
test   %eax,%eax
je     1360 <main+0x140>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %r12d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
test   %eax,%eax
jns    13e7 <main+0x1c7>
lea    0xce6(%rip),%rdi
call   1100 <error@plt>
mov    %r13,%rdi
mov    $0x100,%esi
call   1110 <bzero@plt>
mov    %r12d,%edi
mov    %r13,%rsi
mov    $0xff,%edx
call   1090 <read@plt>
test   %eax,%eax
jns    1414 <main+0x1f4>
lea    0xcdb(%rip),%rdi
call   1100 <error@plt>
mov    %r13,%rdi
jmp    135b <main+0x13b>
mov    %r12d,%edi
call   1080 <close@plt>
xor    %eax,%eax
add    $0x218,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2b91(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xbb5(%rip),%rsi
xor    %eax,%eax
call   10c0 <fprintf@plt>
xor    %edi,%edi
call   1120 <exit@plt>
mov    0x2b70(%rip),%rax
mov    (%rax),%edi
lea    0xbcf(%rip),%rsi
xor    %eax,%eax
call   10c0 <fprintf@plt>
xor    %edi,%edi
call   1120 <exit@plt>
lea    0xbfe(%rip),%rdi
call   1100 <error@plt>
xor    %edi,%edi
call   1120 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.hostent = type { i32, i64 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [35 x i8] c"ejecutar %s nombre_servidor_o_IP \0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [21 x i8] c"ERROR opening socket\00"
@.str.2 = [68 x i8] c"ERROR, no encuentro el nombre del servidor, use su IP directamente\0A\00"
@.str.3 = [24 x i8] c"ERROR no puede conectar\00"
@.str.4 = [28 x i8] c"Bienvenido a cliente unoDb\0A\00"
@.str.5 = [25 x i8] c"Conectado a servidor %s\0A\00"
@.str.6 = [24 x i8] c"Server version: 2.0.0\0A\0A\00"
@.str.7 = [6 x i8] c"salir\00"
@.str.8 = [14 x i8] c"bajarservidor\00"
@.str.9 = [7 x i8] c"unoDb>\00"
@stdin = global i32 0
@.str.10 = [34 x i8] c"ERROR de escritura en el servidor\00"
@.str.11 = [27 x i8] c"ERROR leyendo del servidor\00"
@.str.12 = [4 x i8] c"%s\0A\00"
@.str.13 = [13 x i8] c"saliocliente\00"
@.str.14 = [6 x i8] c"Chau\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.sockaddr_in
%9 = alloca %struct.hostent*
%10 = alloca [256 x i8]
%11 = alloca [256 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 2
br i1 %13, label %14, label %21
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 0
%18 = load i8*, i8** %17
%19 = call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %18)
%20 = call i32 @exit(i32 0)
unreachable
21: ; preds = %2
%22 = load i32, i32* @AF_INET
%23 = load i32, i32* @SOCK_STREAM
%24 = call i32 @socket(i32 %22, i32 %23, i32 0)
store i32 %24, i32* %6
%25 = load i32, i32* %6
%26 = icmp slt i32 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %21
%28 = call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %29
29: ; preds = %27, %21
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 1
%32 = load i8*, i8** %31
%33 = call %struct.hostent* @gethostbyname(i8* %32)
store %struct.hostent* %33, %struct.hostent** %9
%34 = load %struct.hostent*, %struct.hostent** %9
%35 = icmp eq %struct.hostent* %34, null
br i1 %35, label %36, label %40
36: ; preds = %29
%37 = load i32, i32* @stderr
%38 = call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.2, i64 0, i64 0))
%39 = call i32 @exit(i32 0)
unreachable
40: ; preds = %29
%41 = bitcast %struct.sockaddr_in* %8 to i8*
%42 = call i32 @bzero(i8* %41, i32 12)
%43 = load i32, i32* @AF_INET
%44 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 2
store i32 %43, i32* %44
%45 = load %struct.hostent*, %struct.hostent** %9
%46 = getelementptr inbounds %struct.hostent, %struct.hostent* %45, i32 0, i32 1
%47 = load i64, i64* %46
%48 = inttoptr i64 %47 to i8*
%49 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 1
%50 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %49, i32 0, i32 0
%51 = bitcast i32* %50 to i8*
%52 = load %struct.hostent*, %struct.hostent** %9
%53 = getelementptr inbounds %struct.hostent, %struct.hostent* %52, i32 0, i32 0
%54 = load i32, i32* %53
%55 = call i32 @bcopy(i8* %48, i8* %51, i32 %54)
%56 = call i32 @htons(i32 2006)
%57 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 0
store i32 %56, i32* %57
%58 = load i32, i32* %6
%59 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
%60 = call i64 @connect(i32 %58, %struct.sockaddr* %59, i32 12)
%61 = icmp slt i64 %60, 0
br i1 %61, label %62, label %65
62: ; preds = %40
%63 = call i32 @error(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%64 = call i32 @exit(i32 0)
unreachable
65: ; preds = %40
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
%67 = load i8**, i8*** %5
%68 = getelementptr inbounds i8*, i8** %67, i64 1
%69 = load i8*, i8** %68
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i8* %69)
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
br label %72
72: ; preds = %123, %65
%73 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%74 = call i64 @strcmp(i8* %73, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%75 = icmp ne i64 %74, 0
br i1 %75, label %76, label %80
76: ; preds = %72
%77 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%78 = call i64 @strcmp(i8* %77, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
%79 = icmp ne i64 %78, 0
br label %80
80: ; preds = %76, %72
%81 = phi i1 [ false, %72 ], [ %79, %76 ]
br i1 %81, label %82, label %124
82: ; preds = %80
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
%84 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%85 = call i32 @gets(i8* %84)
%86 = load i32, i32* @stdin
%87 = call i32 @fflush(i32 %86)
%88 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%89 = call i64 @strcmp(i8* %88, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%90 = icmp ne i64 %89, 0
br i1 %90, label %91, label %119
91: ; preds = %82
%92 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%93 = call i32 @strlen(i8* %92)
%94 = icmp ne i32 %93, 0
br i1 %94, label %95, label %118
95: ; preds = %91
%96 = load i32, i32* %6
%97 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%98 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%99 = call i32 @strlen(i8* %98)
%100 = call i32 @write(i32 %96, i8* %97, i32 %99)
store i32 %100, i32* %7
%101 = load i32, i32* %7
%102 = icmp slt i32 %101, 0
br i1 %102, label %103, label %105
103: ; preds = %95
%104 = call i32 @error(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.10, i64 0, i64 0))
br label %105
105: ; preds = %103, %95
%106 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%107 = call i32 @bzero(i8* %106, i32 256)
%108 = load i32, i32* %6
%109 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%110 = call i32 @read(i32 %108, i8* %109, i32 255)
store i32 %110, i32* %7
%111 = load i32, i32* %7
%112 = icmp slt i32 %111, 0
br i1 %112, label %113, label %115
113: ; preds = %105
%114 = call i32 @error(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.11, i64 0, i64 0))
br label %115
115: ; preds = %113, %105
%116 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* %116)
br label %118
118: ; preds = %115, %91
br label %123
119: ; preds = %82
%120 = load i32, i32* %6
%121 = call i32 @write(i32 %120, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0), i32 12)
store i32 %121, i32* %7
%122 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0))
br label %123
123: ; preds = %119, %118
br label %72
124: ; preds = %80
%125 = load i32, i32* %6
%126 = call i32 @close(i32 %125)
ret i32 0
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.hostent = type { i32, i64 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [35 x i8] c"ejecutar %s nombre_servidor_o_IP \0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [21 x i8] c"ERROR opening socket\00"
@.str.2 = [68 x i8] c"ERROR, no encuentro el nombre del servidor, use su IP directamente\0A\00"
@.str.3 = [24 x i8] c"ERROR no puede conectar\00"
@.str.5 = [25 x i8] c"Conectado a servidor %s\0A\00"
@.str.7 = [6 x i8] c"salir\00"
@.str.8 = [14 x i8] c"bajarservidor\00"
@.str.9 = [7 x i8] c"unoDb>\00"
@stdin = global i32 0
@.str.10 = [34 x i8] c"ERROR de escritura en el servidor\00"
@.str.11 = [27 x i8] c"ERROR leyendo del servidor\00"
@.str.13 = [13 x i8] c"saliocliente\00"
@str = [27 x i8] c"Bienvenido a cliente unoDb\00"
@str.15 = [23 x i8] c"Server version: 2.0.0\0A\00"
@str.16 = [5 x i8] c"Chau\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca [256 x i8]
%5 = alloca [256 x i8]
%6 = bitcast %struct.sockaddr_in* %3 to i8*
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%9 = icmp slt i32 %0, 2
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i8*, i8** %1
%13 = tail call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = tail call i32 @exit(i32 0)
unreachable
15: ; preds = %2
%16 = load i32, i32* @AF_INET
%17 = load i32, i32* @SOCK_STREAM
%18 = tail call i32 @socket(i32 %16, i32 %17, i32 0)
%19 = icmp slt i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %15
%21 = tail call i32 @error(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %22
22: ; preds = %20, %15
%23 = getelementptr inbounds i8*, i8** %1, i64 1
%24 = load i8*, i8** %23
%25 = tail call %struct.hostent* @gethostbyname(i8* %24)
%26 = icmp eq %struct.hostent* %25, null
br i1 %26, label %27, label %31
27: ; preds = %22
%28 = load i32, i32* @stderr
%29 = tail call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.2, i64 0, i64 0))
%30 = tail call i32 @exit(i32 0)
unreachable
31: ; preds = %22
%32 = call i32 @bzero(i8* %6, i32 12)
%33 = load i32, i32* @AF_INET
%34 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %33, i32* %34
%35 = getelementptr inbounds %struct.hostent, %struct.hostent* %25, i64 0, i32 1
%36 = load i64, i64* %35
%37 = inttoptr i64 %36 to i8*
%38 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1, i32 0
%39 = bitcast i32* %38 to i8*
%40 = getelementptr inbounds %struct.hostent, %struct.hostent* %25, i64 0, i32 0
%41 = load i32, i32* %40
%42 = tail call i32 @htons(i32 2006)
%43 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
store i32 %42, i32* %43
%44 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%45 = call i64 @connect(i32 %18, %struct.sockaddr* %44, i32 12)
%46 = icmp slt i64 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %31
%48 = call i32 @error(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%49 = call i32 @exit(i32 0)
unreachable
50: ; preds = %31
%51 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%52 = load i8*, i8** %23
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i8* %52)
%54 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.15, i64 0, i64 0))
%55 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%56 = icmp eq i64 %55, 0
br i1 %56, label %90, label %57
57: ; preds = %50, %87
%58 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
%59 = icmp eq i64 %58, 0
br i1 %59, label %90, label %60
60: ; preds = %57
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
%62 = call i32 @gets(i8* %7)
%63 = load i32, i32* @stdin
%64 = call i32 @fflush(i32 %63)
%65 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%66 = icmp eq i64 %65, 0
br i1 %66, label %84, label %67
67: ; preds = %60
%68 = call i32 @strlen(i8* %7)
%69 = icmp eq i32 %68, 0
br i1 %69, label %87, label %70
70: ; preds = %67
%71 = call i32 @strlen(i8* %7)
%72 = call i32 @write(i32 %18, i8* %7, i32 %71)
%73 = icmp slt i32 %72, 0
br i1 %73, label %74, label %76
74: ; preds = %70
%75 = call i32 @error(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.10, i64 0, i64 0))
br label %76
76: ; preds = %74, %70
%77 = call i32 @bzero(i8* %8, i32 256)
%78 = call i32 @read(i32 %18, i8* %8, i32 255)
%79 = icmp slt i32 %78, 0
br i1 %79, label %80, label %82
80: ; preds = %76
%81 = call i32 @error(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.11, i64 0, i64 0))
br label %82
82: ; preds = %80, %76
%83 = call i32 @puts(i8* %8)
br label %87
84: ; preds = %60
%85 = call i32 @write(i32 %18, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0), i32 12)
%86 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.16, i64 0, i64 0))
br label %87
87: ; preds = %67, %82, %84
%88 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%89 = icmp eq i64 %88, 0
br i1 %89, label %90, label %57
90: ; preds = %57, %87, %50
%91 = call i32 @close(i32 %18)
ret i32 0
}