#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 */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_zero;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
struct dogType {
  int dummy;
};
typedef int /*<<< orphan*/ socklen_t;
typedef int /*<<< orphan*/ log_msg;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_REUSEADDR;
int accept(int, struct sockaddr *, int /*<<< orphan*/ *);
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ bzero(int /*<<< orphan*/, int);
int /*<<< orphan*/ close(int);
char *create(struct dogType *);
char *erase();
int /*<<< orphan*/ exit(int);
size_t fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
size_t fwrite(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ htons(int);
char *inet_ntoa(TYPE_1__);
char *list();
int listen(int, int);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int recv(int, char *, int, int /*<<< orphan*/);
char *search();
int send(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/,
                              char const *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int serverfd, clientfd, r, opt = 1;
  struct sockaddr_in server, client;
  socklen_t tamano;
  char buffer[1];
  serverfd = socket(AF_INET, SOCK_STREAM, 0);
  if (serverfd < 0) {
    perror("Couldn't socket()");
    exit(-1);
  }
  server.sin_family = AF_INET;
  server.sin_port = htons(3535);
  server.sin_addr.s_addr = INADDR_ANY;
  bzero(server.sin_zero, 8);
  setsockopt(serverfd, SOL_SOCKET, SO_REUSEADDR, (const char *)&opt,
             sizeof(int));
  r = bind(serverfd, (struct sockaddr *)&server, sizeof(struct sockaddr));
  if (r < 0) {
    perror("Couldn't bind()");
    exit(-1);
  }
  r = listen(serverfd, 2);
  if (r < 0) {
    perror("Couldn't Listen()");
    exit(-1);
  }
  clientfd = accept(serverfd, (struct sockaddr *)&client, &tamano);
  if (clientfd < 0) {
    perror("Couldn't accept");
    exit(-1);
  }
  r = send(clientfd, "exitosa", 8, 0);
  if (r < 0) {
    perror("Couldn't send()");
    exit(-1);
  }
  printf("Connected\n");
  char *addr = inet_ntoa(client.sin_addr);
  size_t err;
  FILE *pa = fopen("serverDogs.log", "a");
  if (pa == NULL) {
    perror("Couldn't open the file");
    exit(-1);
  }
  char log_msg[80];
  time_t rawtime;
  struct tm *timeinfo;
  struct dogType *dog;
  char *ans_id;
  do {
    r = recv(clientfd, buffer, 1, 0);
    switch (buffer[0]) {
    case 'i':
      time(&rawtime);
      timeinfo = localtime(&rawtime);
      strftime(log_msg, 80, "%F-%T Cliente ", timeinfo);
      strcat(log_msg, addr);
      strcat(log_msg, " insercion ");
      strcat(log_msg, create(dog));
      strcat(log_msg, "\n");
      printf("%s\n", log_msg);
      err = fwrite(log_msg, sizeof(log_msg), 1, pa);
      if (err == -1) {
        perror("Couldn't write in the file");
        exit(-1);
      }
      break;
    case 'v':
      time(&rawtime);
      timeinfo = localtime(&rawtime);
      strftime(log_msg, 80, "%F-%T Cliente ", timeinfo);
      strcat(log_msg, addr);
      strcat(log_msg, " lectura ");
      strcat(log_msg, list());
      strcat(log_msg, "\n");
      printf("%s\n", log_msg);
      err = fwrite(log_msg, sizeof(log_msg), 1, pa);
      if (err == -1) {
        perror("Couldn't write in the file");
        exit(-1);
      }
      break;
    case 'o':
      time(&rawtime);
      timeinfo = localtime(&rawtime);
      strftime(log_msg, 80, "%F-%T Cliente ", timeinfo);
      strcat(log_msg, addr);
      strcat(log_msg, " borrado ");
      strcat(log_msg, erase());
      strcat(log_msg, "\n");
      printf("%s\n", log_msg);
      err = fwrite(log_msg, sizeof(log_msg), 1, pa);
      if (err == -1) {
        perror("Couldn't write in the file");
        exit(-1);
      }
      break;
    case 'u':
      time(&rawtime);
      timeinfo = localtime(&rawtime);
      strftime(log_msg, 80, "%F-%T Cliente ", timeinfo);
      strcat(log_msg, addr);
      strcat(log_msg, " busqueda ");
      strcat(log_msg, search());
      strcat(log_msg, "\n");
      printf("%s\n", log_msg);
      err = fwrite(log_msg, sizeof(log_msg), 1, pa);
      if (err == -1) {
        perror("Couldn't write in the file");
        exit(-1);
      }
      break;
    }
  } while (buffer[0] != 'c');
  err = fclose(pa);
  if (err != 0) {
    perror("Couldn't close the file");
    exit(-1);
  }
  close(clientfd);
  close(serverfd);
  printf("Closed\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x14(%rbp)
mov    0x2d30(%rip),%rax
mov    (%rax),%edi
mov    0x2d0f(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   11b0 <socket@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    12e5 <main+0x55>
lea    0xd62(%rip),%rdi
call   1150 <perror@plt>
mov    $0xffffffff,%edi
call   1190 <exit@plt>
mov    0x2cf4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    $0xdcf,%edi
call   1080 <htons@plt>
mov    %eax,-0x20(%rbp)
mov    0x2cd3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%edi
mov    $0x8,%esi
call   1160 <bzero@plt>
mov    -0x8(%rbp),%edi
mov    0x2cc7(%rip),%rax
mov    (%rax),%esi
mov    0x2c96(%rip),%rax
mov    (%rax),%edx
lea    -0x14(%rbp),%rcx
mov    $0x4,%r8d
call   1050 <setsockopt@plt>
mov    -0x8(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0x4,%edx
call   1120 <bind@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jge    136f <main+0xdf>
lea    0xcea(%rip),%rdi
call   1150 <perror@plt>
mov    $0xffffffff,%edi
call   1190 <exit@plt>
mov    -0x8(%rbp),%edi
mov    $0x2,%esi
call   1110 <listen@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jge    139f <main+0x10f>
lea    0xcca(%rip),%rdi
call   1150 <perror@plt>
mov    $0xffffffff,%edi
call   1190 <exit@plt>
mov    -0x8(%rbp),%edi
lea    -0x38(%rbp),%rsi
lea    -0x3c(%rbp),%rdx
call   1170 <accept@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    13d2 <main+0x142>
lea    0xca9(%rip),%rdi
call   1150 <perror@plt>
mov    $0xffffffff,%edi
call   1190 <exit@plt>
mov    -0xc(%rbp),%edi
lea    0xca0(%rip),%rsi
mov    $0x8,%edx
xor    %ecx,%ecx
call   1090 <send@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jge    140b <main+0x17b>
lea    0xc88(%rip),%rdi
call   1150 <perror@plt>
mov    $0xffffffff,%edi
call   1190 <exit@plt>
lea    0xc82(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    -0x38(%rbp),%edi
call   1060 <inet_ntoa@plt>
mov    %rax,-0x48(%rbp)
lea    0xc73(%rip),%rdi
lea    0xc4f(%rip),%rsi
call   1140 <fopen@plt>
mov    %rax,-0x58(%rbp)
cmpq   $0x0,-0x58(%rbp)
jne    145d <main+0x1cd>
lea    0xc60(%rip),%rdi
call   1150 <perror@plt>
mov    $0xffffffff,%edi
call   1190 <exit@plt>
jmp    1462 <main+0x1d2>
mov    -0xc(%rbp),%edi
lea    -0x3d(%rbp),%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x10(%rbp)
movsbl -0x3d(%rbp),%eax
add    $0xffffff97,%eax
mov    %eax,%ecx
mov    %rcx,-0xd8(%rbp)
sub    $0xd,%eax
ja     1871 <main+0x5e1>
mov    -0xd8(%rbp),%rax
lea    0xb61(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    -0xb4(%rbp),%rdi
call   1100 <time@plt>
lea    -0xb4(%rbp),%rdi
call   1040 <localtime@plt>
mov    %rax,-0xc0(%rbp)
lea    -0xb0(%rbp),%rdi
mov    -0xc0(%rbp),%rcx
mov    $0x50,%esi
lea    0xbe4(%rip),%rdx
call   1130 <strftime@plt>
lea    -0xb0(%rbp),%rdi
mov    -0x48(%rbp),%rsi
call   1180 <strcat@plt>
lea    -0xb0(%rbp),%rdi
lea    0xbd0(%rip),%rsi
call   1180 <strcat@plt>
lea    -0xb0(%rbp),%rax
mov    %rax,-0xe0(%rbp)
mov    -0xc8(%rbp),%rdi
call   10e0 <create@plt>
mov    -0xe0(%rbp),%rdi
mov    %rax,%rsi
call   1180 <strcat@plt>
lea    -0xb0(%rbp),%rdi
lea    0xbfc(%rip),%rsi
call   1180 <strcat@plt>
lea    -0xb0(%rbp),%rsi
lea    0xb8d(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
lea    -0xb0(%rbp),%rdi
mov    -0x58(%rbp),%rcx
mov    $0x50,%esi
mov    $0x1,%edx
call   11a0 <fwrite@plt>
mov    %rax,-0x50(%rbp)
cmpq   $0xffffffffffffffff,-0x50(%rbp)
jne    1599 <main+0x309>
lea    0xb5a(%rip),%rdi
call   1150 <perror@plt>
mov    $0xffffffff,%edi
call   1190 <exit@plt>
jmp    1871 <main+0x5e1>
lea    -0xb4(%rbp),%rdi
call   1100 <time@plt>
lea    -0xb4(%rbp),%rdi
call   1040 <localtime@plt>
mov    %rax,-0xc0(%rbp)
lea    -0xb0(%rbp),%rdi
mov    -0xc0(%rbp),%rcx
mov    $0x50,%esi
lea    0xaee(%rip),%rdx
call   1130 <strftime@plt>
lea    -0xb0(%rbp),%rdi
mov    -0x48(%rbp),%rsi
call   1180 <strcat@plt>
lea    -0xb0(%rbp),%rdi
lea    0xb05(%rip),%rsi
call   1180 <strcat@plt>
lea    -0xb0(%rbp),%rax
mov    %rax,-0xe8(%rbp)
mov    $0x0,%al
call   10f0 <list@plt>
mov    -0xe8(%rbp),%rdi
mov    %rax,%rsi
call   1180 <strcat@plt>
lea    -0xb0(%rbp),%rdi
lea    0xb0b(%rip),%rsi
call   1180 <strcat@plt>
lea    -0xb0(%rbp),%rsi
lea    0xa9c(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
lea    -0xb0(%rbp),%rdi
mov    -0x58(%rbp),%rcx
mov    $0x50,%esi
mov    $0x1,%edx
call   11a0 <fwrite@plt>
mov    %rax,-0x50(%rbp)
cmpq   $0xffffffffffffffff,-0x50(%rbp)
jne    168a <main+0x3fa>
lea    0xa69(%rip),%rdi
call   1150 <perror@plt>
mov    $0xffffffff,%edi
call   1190 <exit@plt>
jmp    1871 <main+0x5e1>
lea    -0xb4(%rbp),%rdi
call   1100 <time@plt>
lea    -0xb4(%rbp),%rdi
call   1040 <localtime@plt>
mov    %rax,-0xc0(%rbp)
lea    -0xb0(%rbp),%rdi
mov    -0xc0(%rbp),%rcx
mov    $0x50,%esi
lea    0x9fd(%rip),%rdx
call   1130 <strftime@plt>
lea    -0xb0(%rbp),%rdi
mov    -0x48(%rbp),%rsi
call   1180 <strcat@plt>
lea    -0xb0(%rbp),%rdi
lea    0xa1e(%rip),%rsi
call   1180 <strcat@plt>
lea    -0xb0(%rbp),%rax
mov    %rax,-0xf0(%rbp)
mov    $0x0,%al
call   10b0 <erase@plt>
mov    -0xf0(%rbp),%rdi
mov    %rax,%rsi
call   1180 <strcat@plt>
lea    -0xb0(%rbp),%rdi
lea    0xa1a(%rip),%rsi
call   1180 <strcat@plt>
lea    -0xb0(%rbp),%rsi
lea    0x9ab(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
lea    -0xb0(%rbp),%rdi
mov    -0x58(%rbp),%rcx
mov    $0x50,%esi
mov    $0x1,%edx
call   11a0 <fwrite@plt>
mov    %rax,-0x50(%rbp)
cmpq   $0xffffffffffffffff,-0x50(%rbp)
jne    177b <main+0x4eb>
lea    0x978(%rip),%rdi
call   1150 <perror@plt>
mov    $0xffffffff,%edi
call   1190 <exit@plt>
jmp    1871 <main+0x5e1>
lea    -0xb4(%rbp),%rdi
call   1100 <time@plt>
lea    -0xb4(%rbp),%rdi
call   1040 <localtime@plt>
mov    %rax,-0xc0(%rbp)
lea    -0xb0(%rbp),%rdi
mov    -0xc0(%rbp),%rcx
mov    $0x50,%esi
lea    0x90c(%rip),%rdx
call   1130 <strftime@plt>
lea    -0xb0(%rbp),%rdi
mov    -0x48(%rbp),%rsi
call   1180 <strcat@plt>
lea    -0xb0(%rbp),%rdi
lea    0x937(%rip),%rsi
call   1180 <strcat@plt>
lea    -0xb0(%rbp),%rax
mov    %rax,-0xf8(%rbp)
mov    $0x0,%al
call   10c0 <search@plt>
mov    -0xf8(%rbp),%rdi
mov    %rax,%rsi
call   1180 <strcat@plt>
lea    -0xb0(%rbp),%rdi
lea    0x929(%rip),%rsi
call   1180 <strcat@plt>
lea    -0xb0(%rbp),%rsi
lea    0x8ba(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
lea    -0xb0(%rbp),%rdi
mov    -0x58(%rbp),%rcx
mov    $0x50,%esi
mov    $0x1,%edx
call   11a0 <fwrite@plt>
mov    %rax,-0x50(%rbp)
cmpq   $0xffffffffffffffff,-0x50(%rbp)
jne    186c <main+0x5dc>
lea    0x887(%rip),%rdi
call   1150 <perror@plt>
mov    $0xffffffff,%edi
call   1190 <exit@plt>
jmp    1871 <main+0x5e1>
jmp    1876 <main+0x5e6>
movsbl -0x3d(%rbp),%eax
cmp    $0x63,%eax
jne    1462 <main+0x1d2>
mov    -0x58(%rbp),%rdi
call   1070 <fclose@plt>
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x50(%rbp)
je     18b1 <main+0x621>
lea    0x87c(%rip),%rdi
call   1150 <perror@plt>
mov    $0xffffffff,%edi
call   1190 <exit@plt>
mov    -0xc(%rbp),%edi
call   10d0 <close@plt>
mov    -0x8(%rbp),%edi
call   10d0 <close@plt>
lea    0x86e(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
movl   $0x1,0x14(%rsp)
mov    0x2d30(%rip),%rbp
mov    0x0(%rbp),%edi
mov    0x2d0e(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   11b0 <socket@plt>
test   %eax,%eax
js     15e0 <main+0x350>
mov    %eax,%ebx
mov    0x0(%rbp),%eax
mov    %eax,0x24(%rsp)
mov    $0xdcf,%edi
call   1090 <htons@plt>
mov    %eax,0x20(%rsp)
mov    0x2cef(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x18(%rsp)
mov    $0x8,%esi
call   1160 <bzero@plt>
mov    0x2ce8(%rip),%rax
mov    (%rax),%esi
mov    0x2cb7(%rip),%rax
mov    (%rax),%edx
lea    0x14(%rsp),%rcx
mov    %ebx,%edi
mov    $0x4,%r8d
call   1060 <setsockopt@plt>
lea    0x18(%rsp),%rsi
mov    %ebx,%edi
mov    $0x4,%edx
call   1120 <bind@plt>
test   %eax,%eax
js     15e9 <main+0x359>
mov    %ebx,%edi
mov    $0x2,%esi
call   1110 <listen@plt>
test   %eax,%eax
js     15f2 <main+0x362>
lea    0x30(%rsp),%rsi
lea    0x2c(%rsp),%rdx
mov    %ebx,%edi
call   1170 <accept@plt>
test   %eax,%eax
js     15fb <main+0x36b>
mov    %eax,%ebp
lea    0xd10(%rip),%rsi
mov    %eax,%edi
mov    $0x8,%edx
xor    %ecx,%ecx
call   10a0 <send@plt>
test   %eax,%eax
js     1604 <main+0x374>
mov    %ebx,0x10(%rsp)
lea    0xd9c(%rip),%rdi
call   1050 <puts@plt>
mov    0x30(%rsp),%edi
call   1070 <inet_ntoa@plt>
mov    %rax,%r15
lea    0xcef(%rip),%rdi
lea    0xcd6(%rip),%rsi
call   1140 <fopen@plt>
test   %rax,%rax
je     160d <main+0x37d>
mov    %rax,%rbx
lea    0xc3c(%rip),%r12
lea    0x28(%rsp),%r13
lea    0x40(%rsp),%r14
jmp    1474 <main+0x1e4>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r13,%rdi
call   1100 <time@plt>
mov    %r13,%rdi
call   1040 <localtime@plt>
mov    %r14,%rdi
mov    $0x50,%esi
lea    0xcbb(%rip),%rdx
mov    %rax,%rcx
call   1130 <strftime@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1180 <strcat@plt>
mov    %r14,%rdi
lea    0xcad(%rip),%rsi
call   1180 <strcat@plt>
call   10e0 <create@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   1180 <strcat@plt>
mov    %r14,%rdi
lea    0xc9a(%rip),%rsi
call   1180 <strcat@plt>
mov    %r14,%rdi
call   1050 <puts@plt>
mov    %r14,%rdi
mov    $0x50,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   11a0 <fwrite@plt>
cmp    $0xffffffffffffffff,%rax
je     15ca <main+0x33a>
movzbl 0xf(%rsp),%eax
cmp    $0x63,%al
je     158d <main+0x2fd>
mov    %ebp,%edi
lea    0xf(%rsp),%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
movsbl 0xf(%rsp),%eax
mov    %eax,%ecx
add    $0xffffff97,%ecx
cmp    $0xd,%ecx
ja     146c <main+0x1dc>
movslq (%r12,%rcx,4),%rcx
add    %r12,%rcx
jmp    *%rcx
mov    %r13,%rdi
call   1100 <time@plt>
mov    %r13,%rdi
call   1040 <localtime@plt>
mov    %r14,%rdi
mov    $0x50,%esi
lea    0xbfc(%rip),%rdx
mov    %rax,%rcx
call   1130 <strftime@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1180 <strcat@plt>
mov    %r14,%rdi
lea    0xc21(%rip),%rsi
call   1180 <strcat@plt>
xor    %eax,%eax
call   10b0 <erase@plt>
jmp    1426 <main+0x196>
nopl   0x0(%rax)
mov    %r13,%rdi
call   1100 <time@plt>
mov    %r13,%rdi
call   1040 <localtime@plt>
mov    %r14,%rdi
mov    $0x50,%esi
lea    0xbab(%rip),%rdx
mov    %rax,%rcx
call   1130 <strftime@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1180 <strcat@plt>
mov    %r14,%rdi
lea    0xbda(%rip),%rsi
call   1180 <strcat@plt>
xor    %eax,%eax
call   10c0 <search@plt>
jmp    1426 <main+0x196>
nopl   (%rax)
mov    %r13,%rdi
call   1100 <time@plt>
mov    %r13,%rdi
call   1040 <localtime@plt>
mov    %r14,%rdi
mov    $0x50,%esi
lea    0xb5b(%rip),%rdx
mov    %rax,%rcx
call   1130 <strftime@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1180 <strcat@plt>
mov    %r14,%rdi
lea    0xb76(%rip),%rsi
call   1180 <strcat@plt>
xor    %eax,%eax
call   10f0 <list@plt>
jmp    1426 <main+0x196>
mov    %rbx,%rdi
call   1080 <fclose@plt>
test   %rax,%rax
jne    1616 <main+0x386>
mov    %ebp,%edi
call   10d0 <close@plt>
mov    0x10(%rsp),%edi
call   10d0 <close@plt>
lea    0xb82(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xb06(%rip),%rdi
call   1150 <perror@plt>
mov    $0xffffffff,%edi
call   1190 <exit@plt>
lea    0xa51(%rip),%rdi
jmp    15d1 <main+0x341>
lea    0xa5a(%rip),%rdi
jmp    15d1 <main+0x341>
lea    0xa61(%rip),%rdi
jmp    15d1 <main+0x341>
lea    0xa6a(%rip),%rdi
jmp    15d1 <main+0x341>
lea    0xa79(%rip),%rdi
jmp    15d1 <main+0x341>
lea    0xa8f(%rip),%rdi
jmp    15d1 <main+0x341>
lea    0xaf4(%rip),%rdi
jmp    15d1 <main+0x341>

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.tm = type { i32 }
%struct.dogType = type { i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [18 x i8] c"Couldn't socket()\00"
@INADDR_ANY = global i32 0
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str.1 = [16 x i8] c"Couldn't bind()\00"
@.str.2 = [18 x i8] c"Couldn't Listen()\00"
@.str.3 = [16 x i8] c"Couldn't accept\00"
@.str.4 = [8 x i8] c"exitosa\00"
@.str.5 = [16 x i8] c"Couldn't send()\00"
@.str.6 = [11 x i8] c"Connected\0A\00"
@.str.7 = [15 x i8] c"serverDogs.log\00"
@.str.8 = [2 x i8] c"a\00"
@.str.9 = [23 x i8] c"Couldn't open the file\00"
@.str.10 = [15 x i8] c"%F-%T Cliente \00"
@.str.11 = [12 x i8] c" insercion \00"
@.str.12 = [2 x i8] c"\0A\00"
@.str.13 = [4 x i8] c"%s\0A\00"
@.str.14 = [27 x i8] c"Couldn't write in the file\00"
@.str.15 = [10 x i8] c" lectura \00"
@.str.16 = [10 x i8] c" borrado \00"
@.str.17 = [11 x i8] c" busqueda \00"
@.str.18 = [24 x i8] c"Couldn't close the file\00"
@.str.19 = [8 x i8] c"Closed\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.sockaddr_in
%7 = alloca %struct.sockaddr_in
%8 = alloca i32
%9 = alloca [1 x i8]
%10 = alloca i8*
%11 = alloca i64
%12 = alloca i32*
%13 = alloca [80 x i8]
%14 = alloca i32
%15 = alloca %struct.tm*
%16 = alloca %struct.dogType*
%17 = alloca i8*
store i32 0, i32* %1
store i32 1, i32* %5
%18 = load i32, i32* @AF_INET
%19 = load i32, i32* @SOCK_STREAM
%20 = call i32 @socket(i32 %18, i32 %19, i32 0)
store i32 %20, i32* %2
%21 = load i32, i32* %2
%22 = icmp slt i32 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %0
%24 = call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%25 = call i32 @exit(i32 -1)
unreachable
26: ; preds = %0
%27 = load i32, i32* @AF_INET
%28 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 3
store i32 %27, i32* %28
%29 = call i32 @htons(i32 3535)
%30 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 2
store i32 %29, i32* %30
%31 = load i32, i32* @INADDR_ANY
%32 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 0
%33 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %32, i32 0, i32 0
store i32 %31, i32* %33
%34 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 1
%35 = load i32, i32* %34
%36 = call i32 @bzero(i32 %35, i32 8)
%37 = load i32, i32* %2
%38 = load i32, i32* @SOL_SOCKET
%39 = load i32, i32* @SO_REUSEADDR
%40 = bitcast i32* %5 to i8*
%41 = call i32 @setsockopt(i32 %37, i32 %38, i32 %39, i8* %40, i32 4)
%42 = load i32, i32* %2
%43 = bitcast %struct.sockaddr_in* %6 to %struct.sockaddr*
%44 = call i32 @bind(i32 %42, %struct.sockaddr* %43, i32 4)
store i32 %44, i32* %4
%45 = load i32, i32* %4
%46 = icmp slt i32 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %26
%48 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%49 = call i32 @exit(i32 -1)
unreachable
50: ; preds = %26
%51 = load i32, i32* %2
%52 = call i32 @listen(i32 %51, i32 2)
store i32 %52, i32* %4
%53 = load i32, i32* %4
%54 = icmp slt i32 %53, 0
br i1 %54, label %55, label %58
55: ; preds = %50
%56 = call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%57 = call i32 @exit(i32 -1)
unreachable
58: ; preds = %50
%59 = load i32, i32* %2
%60 = bitcast %struct.sockaddr_in* %7 to %struct.sockaddr*
%61 = call i32 @accept(i32 %59, %struct.sockaddr* %60, i32* %8)
store i32 %61, i32* %3
%62 = load i32, i32* %3
%63 = icmp slt i32 %62, 0
br i1 %63, label %64, label %67
64: ; preds = %58
%65 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%66 = call i32 @exit(i32 -1)
unreachable
67: ; preds = %58
%68 = load i32, i32* %3
%69 = call i32 @send(i32 %68, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 8, i32 0)
store i32 %69, i32* %4
%70 = load i32, i32* %4
%71 = icmp slt i32 %70, 0
br i1 %71, label %72, label %75
72: ; preds = %67
%73 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
%74 = call i32 @exit(i32 -1)
unreachable
75: ; preds = %67
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%77 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 0
%78 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %77, i32 0, i32 0
%79 = load i32, i32* %78
%80 = call i8* @inet_ntoa(i32 %79)
store i8* %80, i8** %10
%81 = call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
store i32* %81, i32** %12
%82 = load i32*, i32** %12
%83 = icmp eq i32* %82, null
br i1 %83, label %84, label %87
84: ; preds = %75
%85 = call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0))
%86 = call i32 @exit(i32 -1)
unreachable
87: ; preds = %75
br label %88
88: ; preds = %205, %87
%89 = load i32, i32* %3
%90 = getelementptr inbounds [1 x i8], [1 x i8]* %9, i64 0, i64 0
%91 = call i32 @recv(i32 %89, i8* %90, i32 1, i32 0)
store i32 %91, i32* %4
%92 = getelementptr inbounds [1 x i8], [1 x i8]* %9, i64 0, i64 0
%93 = load i8, i8* %92
%94 = sext i8 %93 to i32
switch i32 %94, label %204 [
i32 105, label %95
i32 118, label %123
i32 111, label %150
i32 117, label %177
]
95: ; preds = %88
%96 = call i32 @time(i32* %14)
%97 = call %struct.tm* @localtime(i32* %14)
store %struct.tm* %97, %struct.tm** %15
%98 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 0, i64 0
%99 = load %struct.tm*, %struct.tm** %15
%100 = call i32 @strftime(i8* %98, i32 80, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0), %struct.tm* %99)
%101 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 0, i64 0
%102 = load i8*, i8** %10
%103 = call i32 @strcat(i8* %101, i8* %102)
%104 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 0, i64 0
%105 = call i32 @strcat(i8* %104, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0))
%106 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 0, i64 0
%107 = load %struct.dogType*, %struct.dogType** %16
%108 = call i8* @create(%struct.dogType* %107)
%109 = call i32 @strcat(i8* %106, i8* %108)
%110 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 0, i64 0
%111 = call i32 @strcat(i8* %110, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
%112 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 0, i64 0
%113 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0), i8* %112)
%114 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 0, i64 0
%115 = load i32*, i32** %12
%116 = call i64 @fwrite(i8* %114, i32 80, i32 1, i32* %115)
store i64 %116, i64* %11
%117 = load i64, i64* %11
%118 = icmp eq i64 %117, -1
br i1 %118, label %119, label %122
119: ; preds = %95
%120 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.14, i64 0, i64 0))
%121 = call i32 @exit(i32 -1)
unreachable
122: ; preds = %95
br label %204
123: ; preds = %88
%124 = call i32 @time(i32* %14)
%125 = call %struct.tm* @localtime(i32* %14)
store %struct.tm* %125, %struct.tm** %15
%126 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 0, i64 0
%127 = load %struct.tm*, %struct.tm** %15
%128 = call i32 @strftime(i8* %126, i32 80, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0), %struct.tm* %127)
%129 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 0, i64 0
%130 = load i8*, i8** %10
%131 = call i32 @strcat(i8* %129, i8* %130)
%132 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 0, i64 0
%133 = call i32 @strcat(i8* %132, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.15, i64 0, i64 0))
%134 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 0, i64 0
%135 = call i8* (...) @list()
%136 = call i32 @strcat(i8* %134, i8* %135)
%137 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 0, i64 0
%138 = call i32 @strcat(i8* %137, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
%139 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 0, i64 0
%140 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0), i8* %139)
%141 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 0, i64 0
%142 = load i32*, i32** %12
%143 = call i64 @fwrite(i8* %141, i32 80, i32 1, i32* %142)
store i64 %143, i64* %11
%144 = load i64, i64* %11
%145 = icmp eq i64 %144, -1
br i1 %145, label %146, label %149
146: ; preds = %123
%147 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.14, i64 0, i64 0))
%148 = call i32 @exit(i32 -1)
unreachable
149: ; preds = %123
br label %204
150: ; preds = %88
%151 = call i32 @time(i32* %14)
%152 = call %struct.tm* @localtime(i32* %14)
store %struct.tm* %152, %struct.tm** %15
%153 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 0, i64 0
%154 = load %struct.tm*, %struct.tm** %15
%155 = call i32 @strftime(i8* %153, i32 80, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0), %struct.tm* %154)
%156 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 0, i64 0
%157 = load i8*, i8** %10
%158 = call i32 @strcat(i8* %156, i8* %157)
%159 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 0, i64 0
%160 = call i32 @strcat(i8* %159, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.16, i64 0, i64 0))
%161 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 0, i64 0
%162 = call i8* (...) @erase()
%163 = call i32 @strcat(i8* %161, i8* %162)
%164 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 0, i64 0
%165 = call i32 @strcat(i8* %164, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
%166 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 0, i64 0
%167 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0), i8* %166)
%168 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 0, i64 0
%169 = load i32*, i32** %12
%170 = call i64 @fwrite(i8* %168, i32 80, i32 1, i32* %169)
store i64 %170, i64* %11
%171 = load i64, i64* %11
%172 = icmp eq i64 %171, -1
br i1 %172, label %173, label %176
173: ; preds = %150
%174 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.14, i64 0, i64 0))
%175 = call i32 @exit(i32 -1)
unreachable
176: ; preds = %150
br label %204
177: ; preds = %88
%178 = call i32 @time(i32* %14)
%179 = call %struct.tm* @localtime(i32* %14)
store %struct.tm* %179, %struct.tm** %15
%180 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 0, i64 0
%181 = load %struct.tm*, %struct.tm** %15
%182 = call i32 @strftime(i8* %180, i32 80, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0), %struct.tm* %181)
%183 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 0, i64 0
%184 = load i8*, i8** %10
%185 = call i32 @strcat(i8* %183, i8* %184)
%186 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 0, i64 0
%187 = call i32 @strcat(i8* %186, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.17, i64 0, i64 0))
%188 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 0, i64 0
%189 = call i8* (...) @search()
%190 = call i32 @strcat(i8* %188, i8* %189)
%191 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 0, i64 0
%192 = call i32 @strcat(i8* %191, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
%193 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 0, i64 0
%194 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0), i8* %193)
%195 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 0, i64 0
%196 = load i32*, i32** %12
%197 = call i64 @fwrite(i8* %195, i32 80, i32 1, i32* %196)
store i64 %197, i64* %11
%198 = load i64, i64* %11
%199 = icmp eq i64 %198, -1
br i1 %199, label %200, label %203
200: ; preds = %177
%201 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.14, i64 0, i64 0))
%202 = call i32 @exit(i32 -1)
unreachable
203: ; preds = %177
br label %204
204: ; preds = %88, %203, %176, %149, %122
br label %205
205: ; preds = %204
%206 = getelementptr inbounds [1 x i8], [1 x i8]* %9, i64 0, i64 0
%207 = load i8, i8* %206
%208 = sext i8 %207 to i32
%209 = icmp ne i32 %208, 99
br i1 %209, label %88, label %210
210: ; preds = %205
%211 = load i32*, i32** %12
%212 = call i64 @fclose(i32* %211)
store i64 %212, i64* %11
%213 = load i64, i64* %11
%214 = icmp ne i64 %213, 0
br i1 %214, label %215, label %218
215: ; preds = %210
%216 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.18, i64 0, i64 0))
%217 = call i32 @exit(i32 -1)
unreachable
218: ; preds = %210
%219 = load i32, i32* %3
%220 = call i32 @close(i32 %219)
%221 = load i32, i32* %2
%222 = call i32 @close(i32 %221)
%223 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.19, i64 0, i64 0))
%224 = load i32, i32* %1
ret i32 %224
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
%struct.tm = type { i32 }
%struct.dogType = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [18 x i8] c"Couldn't socket()\00"
@INADDR_ANY = global i32 0
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str.1 = [16 x i8] c"Couldn't bind()\00"
@.str.2 = [18 x i8] c"Couldn't Listen()\00"
@.str.3 = [16 x i8] c"Couldn't accept\00"
@.str.4 = [8 x i8] c"exitosa\00"
@.str.5 = [16 x i8] c"Couldn't send()\00"
@.str.7 = [15 x i8] c"serverDogs.log\00"
@.str.8 = [2 x i8] c"a\00"
@.str.9 = [23 x i8] c"Couldn't open the file\00"
@.str.10 = [15 x i8] c"%F-%T Cliente \00"
@.str.11 = [12 x i8] c" insercion \00"
@.str.12 = [2 x i8] c"\0A\00"
@.str.14 = [27 x i8] c"Couldn't write in the file\00"
@.str.15 = [10 x i8] c" lectura \00"
@.str.16 = [10 x i8] c" borrado \00"
@.str.17 = [11 x i8] c" busqueda \00"
@.str.18 = [24 x i8] c"Couldn't close the file\00"
@str = [10 x i8] c"Connected\00"
@str.20 = [7 x i8] c"Closed\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.sockaddr_in
%3 = alloca %struct.sockaddr_in
%4 = alloca i32
%5 = alloca [1 x i8]
%6 = alloca [80 x i8]
%7 = alloca i32
%8 = bitcast i32* %1 to i8*
store i32 1, i32* %1
%9 = bitcast %struct.sockaddr_in* %2 to i8*
%10 = bitcast %struct.sockaddr_in* %3 to i8*
%11 = bitcast i32* %4 to i8*
%12 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 0
%13 = load i32, i32* @AF_INET
%14 = load i32, i32* @SOCK_STREAM
%15 = tail call i32 @socket(i32 %13, i32 %14, i32 0)
%16 = icmp slt i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %0
%18 = tail call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%19 = tail call i32 @exit(i32 -1)
unreachable
20: ; preds = %0
%21 = load i32, i32* @AF_INET
%22 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 3
store i32 %21, i32* %22
%23 = tail call i32 @htons(i32 3535)
%24 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 2
store i32 %23, i32* %24
%25 = load i32, i32* @INADDR_ANY
%26 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 0, i32 0
store i32 %25, i32* %26
%27 = tail call i32 @bzero(i32 undef, i32 8)
%28 = load i32, i32* @SOL_SOCKET
%29 = load i32, i32* @SO_REUSEADDR
%30 = call i32 @setsockopt(i32 %15, i32 %28, i32 %29, i8* %8, i32 4)
%31 = bitcast %struct.sockaddr_in* %2 to %struct.sockaddr*
%32 = call i32 @bind(i32 %15, %struct.sockaddr* %31, i32 4)
%33 = icmp slt i32 %32, 0
br i1 %33, label %34, label %37
34: ; preds = %20
%35 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%36 = call i32 @exit(i32 -1)
unreachable
37: ; preds = %20
%38 = call i32 @listen(i32 %15, i32 2)
%39 = icmp slt i32 %38, 0
br i1 %39, label %40, label %43
40: ; preds = %37
%41 = call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%42 = call i32 @exit(i32 -1)
unreachable
43: ; preds = %37
%44 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%45 = call i32 @accept(i32 %15, %struct.sockaddr* %44, i32* %4)
%46 = icmp slt i32 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %43
%48 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%49 = call i32 @exit(i32 -1)
unreachable
50: ; preds = %43
%51 = call i32 @send(i32 %45, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 8, i32 0)
%52 = icmp slt i32 %51, 0
br i1 %52, label %53, label %56
53: ; preds = %50
%54 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
%55 = call i32 @exit(i32 -1)
unreachable
56: ; preds = %50
%57 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%58 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0, i32 0
%59 = load i32, i32* %58
%60 = call i8* @inet_ntoa(i32 %59)
%61 = call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%62 = icmp eq i32* %61, null
br i1 %62, label %63, label %66
63: ; preds = %56
%64 = call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0))
%65 = call i32 @exit(i32 -1)
unreachable
66: ; preds = %56
%67 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%68 = bitcast i32* %7 to i8*
br label %69
69: ; preds = %135, %66
%70 = call i32 @recv(i32 %45, i8* %12, i32 1, i32 0)
%71 = load i8, i8* %12
%72 = sext i8 %71 to i32
switch i32 %72, label %135 [
i32 105, label %73
i32 118, label %88
i32 111, label %103
i32 117, label %118
]
73: ; preds = %69
%74 = call i32 @time(i32* %7)
%75 = call %struct.tm* @localtime(i32* %7)
%76 = call i32 @strftime(i8* %67, i32 80, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0), %struct.tm* %75)
%77 = call i32 @strcat(i8* %67, i8* %60)
%78 = call i32 @strcat(i8* %67, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0))
%79 = call i8* @create(%struct.dogType* undef)
%80 = call i32 @strcat(i8* %67, i8* %79)
%81 = call i32 @strcat(i8* %67, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
%82 = call i32 @puts(i8* %67)
%83 = call i64 @fwrite(i8* %67, i32 80, i32 1, i32* %61)
%84 = icmp eq i64 %83, -1
br i1 %84, label %85, label %133
85: ; preds = %73
%86 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.14, i64 0, i64 0))
%87 = call i32 @exit(i32 -1)
unreachable
88: ; preds = %69
%89 = call i32 @time(i32* %7)
%90 = call %struct.tm* @localtime(i32* %7)
%91 = call i32 @strftime(i8* %67, i32 80, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0), %struct.tm* %90)
%92 = call i32 @strcat(i8* %67, i8* %60)
%93 = call i32 @strcat(i8* %67, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.15, i64 0, i64 0))
%94 = call i8* (...) @list()
%95 = call i32 @strcat(i8* %67, i8* %94)
%96 = call i32 @strcat(i8* %67, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
%97 = call i32 @puts(i8* %67)
%98 = call i64 @fwrite(i8* %67, i32 80, i32 1, i32* %61)
%99 = icmp eq i64 %98, -1
br i1 %99, label %100, label %133
100: ; preds = %88
%101 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.14, i64 0, i64 0))
%102 = call i32 @exit(i32 -1)
unreachable
103: ; preds = %69
%104 = call i32 @time(i32* %7)
%105 = call %struct.tm* @localtime(i32* %7)
%106 = call i32 @strftime(i8* %67, i32 80, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0), %struct.tm* %105)
%107 = call i32 @strcat(i8* %67, i8* %60)
%108 = call i32 @strcat(i8* %67, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.16, i64 0, i64 0))
%109 = call i8* (...) @erase()
%110 = call i32 @strcat(i8* %67, i8* %109)
%111 = call i32 @strcat(i8* %67, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
%112 = call i32 @puts(i8* %67)
%113 = call i64 @fwrite(i8* %67, i32 80, i32 1, i32* %61)
%114 = icmp eq i64 %113, -1
br i1 %114, label %115, label %133
115: ; preds = %103
%116 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.14, i64 0, i64 0))
%117 = call i32 @exit(i32 -1)
unreachable
118: ; preds = %69
%119 = call i32 @time(i32* %7)
%120 = call %struct.tm* @localtime(i32* %7)
%121 = call i32 @strftime(i8* %67, i32 80, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0), %struct.tm* %120)
%122 = call i32 @strcat(i8* %67, i8* %60)
%123 = call i32 @strcat(i8* %67, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.17, i64 0, i64 0))
%124 = call i8* (...) @search()
%125 = call i32 @strcat(i8* %67, i8* %124)
%126 = call i32 @strcat(i8* %67, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
%127 = call i32 @puts(i8* %67)
%128 = call i64 @fwrite(i8* %67, i32 80, i32 1, i32* %61)
%129 = icmp eq i64 %128, -1
br i1 %129, label %130, label %133
130: ; preds = %118
%131 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.14, i64 0, i64 0))
%132 = call i32 @exit(i32 -1)
unreachable
133: ; preds = %118, %103, %88, %73
%134 = load i8, i8* %12
br label %135
135: ; preds = %133, %69
%136 = phi i8 [ %134, %133 ], [ %71, %69 ]
%137 = icmp eq i8 %136, 99
br i1 %137, label %138, label %69
138: ; preds = %135
%139 = call i64 @fclose(i32* %61)
%140 = icmp eq i64 %139, 0
br i1 %140, label %144, label %141
141: ; preds = %138
%142 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.18, i64 0, i64 0))
%143 = call i32 @exit(i32 -1)
unreachable
144: ; preds = %138
%145 = call i32 @close(i32 %45)
%146 = call i32 @close(i32 %15)
%147 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.20, i64 0, i64 0))
ret i32 0
}