#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__ {
  scalar_t__ s_addr;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ host_addr;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ AF_UNIX;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SIGCHLD;
int /*<<< orphan*/ SIGPIPE;
int /*<<< orphan*/ SIG_IGN;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_REUSEADDR;
int accept(int, struct sockaddr *, int *);
int atoi(char *);
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ chdir(char *);
int /*<<< orphan*/ chroot(char *);
int /*<<< orphan*/ close(int);
int execv(char *, char **);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int, char *);
int /*<<< orphan*/ htons(int);
char *inet_ntoa(TYPE_1__);
int listen(int, int);
int /*<<< orphan*/ memset(struct sockaddr_in *, char, int);
int ntohs(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int sendfd(int, char *, scalar_t__, int);
int /*<<< orphan*/ setresgid(int, int, int);
int /*<<< orphan*/ setresuid(int, int, int);
int setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, int *, int);
int /*<<< orphan*/ signal(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
scalar_t__ socketpair(int /*<<< orphan*/, int /*<<< orphan*/,
                      int /*<<< orphan*/, int *);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ stderr;
scalar_t__ strlen(char *);
int main(int argc, char **argv) {
  int sockfd, client_sockfd;
  int host_port;
  int yes;
  char buffer[1024];
  struct sockaddr_in host_addr, client_addr;
  host_port = 80;
  if (argc > 1)
    host_port = atoi(argv[1]);
  if ((sockfd = socket(PF_INET, SOCK_STREAM, 0)) == -1) {
    do {
      fprintf(stderr, "Error: %s:%d: %s\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/insertion/SEED_LAB/refs/heads/master/"
              "lab4/server.c",
              38, "creating a socket");
      exit(0);
    } while (0);
  }
  if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) == -1)
    do {
      fprintf(stderr, "Error: %s:%d: %s\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/insertion/SEED_LAB/refs/heads/master/"
              "lab4/server.c",
              42, "setting socket option SO_REUSEADDR");
      exit(0);
    } while (0);
  memset(&(host_addr), '\0', sizeof(host_addr));
  host_addr.sin_family = AF_INET;
  host_addr.sin_port = htons(host_port);
  host_addr.sin_addr.s_addr = 0;
  if (bind(sockfd, (struct sockaddr *)&host_addr, sizeof(struct sockaddr)) ==
      -1)
    do {
      fprintf(stderr, "Error: %s:%d: %s\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/insertion/SEED_LAB/refs/heads/master/"
              "lab4/server.c",
              51, "binding to socket");
      exit(0);
    } while (0);
  if (listen(sockfd, 1000) == -1)
    do {
      fprintf(stderr, "Error: %s:%d: %s\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/insertion/SEED_LAB/refs/heads/master/"
              "lab4/server.c",
              54, "listening on socket");
      exit(0);
    } while (0);
  signal(SIGCHLD, SIG_IGN);
  signal(SIGPIPE, SIG_IGN);
  chroot("/jail");
  chdir("/");
  int pid;
  int file_fds[2];
  if (socketpair(AF_UNIX, SOCK_STREAM, 0, file_fds))
    do {
      fprintf(stderr, "Error: %s:%d: %s\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/insertion/SEED_LAB/refs/heads/master/"
              "lab4/server.c",
              74, "socketpair");
      exit(0);
    } while (0);
  if ((pid = fork()) == 0) {
    setresgid(1100, 1100, 1100);
    setresuid(1100, 1100, 1100);
    close(file_fds[1]);
    char pipe_fd_str[32] = {'\0'};
    char *child_name = "./filesv";
    sprintf(pipe_fd_str, "%d", file_fds[0]);
    char *child_argv[] = {child_name, pipe_fd_str, 0};
    if (1)
      printf("file fd = %s\n", pipe_fd_str);
    if (execv(child_name, child_argv) == -1)
      do {
        fprintf(stderr, "Error: %s:%d: %s\n",
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/insertion/SEED_LAB/refs/"
                "heads/master/lab4/server.c",
                97, "execve");
        exit(0);
      } while (0);
  }
  sleep(1);
  close(file_fds[0]);
  if (1)
    printf("the first web service launched (filesv)...\n");
  int bank_fds[2];
  if (socketpair(AF_UNIX, SOCK_STREAM, 0, bank_fds))
    do {
      fprintf(stderr, "Error: %s:%d: %s\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/insertion/SEED_LAB/refs/heads/master/"
              "lab4/server.c",
              107, "socketpair");
      exit(0);
    } while (0);
  if ((pid = fork()) == 0) {
    setresgid(1200, 1200, 1200);
    setresuid(1200, 1200, 1200);
    close(bank_fds[1]);
    char pipe_fd_str[32] = {'\0'};
    char *child_name = "./banksv";
    sprintf(pipe_fd_str, "%d", bank_fds[0]);
    char *child_argv[] = {child_name, pipe_fd_str, 0};
    if (1)
      printf("bank fd = %s\n", pipe_fd_str);
    if (execv(child_name, child_argv) == -1)
      do {
        fprintf(stderr, "Error: %s:%d: %s\n",
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/insertion/SEED_LAB/refs/"
                "heads/master/lab4/server.c",
                125, "execve");
        exit(0);
      } while (0);
  }
  sleep(1);
  close(bank_fds[0]);
  if (1)
    printf("the second web service launched (banksv)...\n");
  int disp_fds[2];
  if (socketpair(AF_UNIX, SOCK_STREAM, 0, disp_fds))
    do {
      fprintf(stderr, "Error: %s:%d: %s\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/insertion/SEED_LAB/refs/heads/master/"
              "lab4/server.c",
              135, "socketpair");
      exit(0);
    } while (0);
  if ((pid = fork()) == 0) {
    setresgid(1300, 1300, 1300);
    setresuid(1300, 1300, 1300);
    close(disp_fds[1]);
    char pipe_fd_str[32] = {'\0'};
    char *child_name = "./httpd";
    sprintf(pipe_fd_str, "%d", disp_fds[0]);
    char *child_argv[] = {child_name, pipe_fd_str, 0};
    if (1)
      printf("%s\n", pipe_fd_str);
    if (execv(child_name, child_argv) == -1)
      do {
        fprintf(stderr, "Error: %s:%d: %s\n",
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/insertion/SEED_LAB/refs/"
                "heads/master/lab4/server.c",
                153, "execve");
        exit(0);
      } while (0);
  }
  sleep(1);
  close(disp_fds[0]);
  if (1)
    printf("the http dispatcher service launched...\n");
  char temp[32] = {'\0'};
  sprintf(temp, "%d", file_fds[1]);
  if (-1 == sendfd(disp_fds[1], temp, strlen(temp) + 1, file_fds[1]))
    do {
      fprintf(stderr, "Error: %s:%d: %s\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/insertion/SEED_LAB/refs/heads/master/"
              "lab4/server.c",
              164, "send fd");
      exit(0);
    } while (0);
  if (1)
    printf("sending %s...\n", temp);
  char temp2[32] = {'\0'};
  sprintf(temp2, "%d", bank_fds[1]);
  if (-1 == sendfd(disp_fds[1], temp2, strlen(temp2) + 1, bank_fds[1]))
    do {
      fprintf(stderr, "Error: %s:%d: %s\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/insertion/SEED_LAB/refs/heads/master/"
              "lab4/server.c",
              170, "send fd");
      exit(0);
    } while (0);
  if (1)
    printf("sending %s...\n", temp2);
  close(file_fds[1]);
  close(bank_fds[1]);
  while (1) {
    int size;
    if ((client_sockfd =
             accept(sockfd, (struct sockaddr *)&client_addr, &size)) == -1)
      do {
        fprintf(stderr, "Error: %s:%d: %s\n",
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/insertion/SEED_LAB/refs/"
                "heads/master/lab4/server.c",
                182, "accepting client connection");
        exit(0);
      } while (0);
    printf("Parent process client_sockfd = %d\n", client_sockfd);
    if (1)
      printf("server: accepting a client from %s port %d\n",
             inet_ntoa(client_addr.sin_addr), ntohs(client_addr.sin_port));
    char *sock_fd_str = "hello, world\n";
    if (1) {
      printf("sending a socket to the client:\n");
    }
    if (-1 == sendfd(disp_fds[1], sock_fd_str, strlen(sock_fd_str) + 1,
                     client_sockfd))
      do {
        fprintf(stderr, "Error: %s:%d: %s\n",
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/insertion/SEED_LAB/refs/"
                "heads/master/lab4/server.c",
                197, "send sock fd");
        exit(0);
      } while (0);
    close(client_sockfd);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x5d0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x50,-0x1c(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    12da <main+0x3a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1160 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2cbf(%rip),%rax
mov    (%rax),%edi
mov    0x2cc6(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   11c0 <socket@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
jne    1333 <main+0x93>
jmp    1304 <main+0x64>
mov    0x2cad(%rip),%rax
mov    (%rax),%edi
lea    0xcec(%rip),%rsi
lea    0xcf7(%rip),%rdx
mov    $0x26,%ecx
lea    0xd78(%rip),%r8
call   10f0 <fprintf@plt>
xor    %edi,%edi
call   1180 <exit@plt>
mov    -0x14(%rbp),%edi
mov    0x2cab(%rip),%rax
mov    (%rax),%esi
mov    0x2c52(%rip),%rax
mov    (%rax),%edx
lea    -0x20(%rbp),%rcx
mov    $0x4,%r8d
call   1040 <setsockopt@plt>
cmp    $0xffffffff,%eax
jne    1394 <main+0xf4>
jmp    1365 <main+0xc5>
mov    0x2c4c(%rip),%rax
mov    (%rax),%edi
lea    0xc8b(%rip),%rsi
lea    0xc96(%rip),%rdx
mov    $0x2a,%ecx
lea    0xd29(%rip),%r8
call   10f0 <fprintf@plt>
xor    %edi,%edi
call   1180 <exit@plt>
lea    -0x438(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   10c0 <memset@plt>
mov    0x2c32(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x428(%rbp)
mov    -0x1c(%rbp),%edi
call   10a0 <htons@plt>
mov    %eax,-0x438(%rbp)
movq   $0x0,-0x430(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x438(%rbp),%rsi
mov    $0x4,%edx
call   1140 <bind@plt>
cmp    $0xffffffff,%eax
jne    1420 <main+0x180>
jmp    13f1 <main+0x151>
mov    0x2bc0(%rip),%rax
mov    (%rax),%edi
lea    0xbff(%rip),%rsi
lea    0xc0a(%rip),%rdx
mov    $0x33,%ecx
lea    0xcc0(%rip),%r8
call   10f0 <fprintf@plt>
xor    %edi,%edi
call   1180 <exit@plt>
mov    -0x14(%rbp),%edi
mov    $0x3e8,%esi
call   1120 <listen@plt>
cmp    $0xffffffff,%eax
jne    146a <main+0x1ca>
jmp    143b <main+0x19b>
mov    0x2b76(%rip),%rax
mov    (%rax),%edi
lea    0xbb5(%rip),%rsi
lea    0xbc0(%rip),%rdx
mov    $0x36,%ecx
lea    0xc88(%rip),%r8
call   10f0 <fprintf@plt>
xor    %edi,%edi
call   1180 <exit@plt>
mov    0x2b5f(%rip),%rax
mov    (%rax),%edi
mov    0x2b4e(%rip),%rax
mov    (%rax),%esi
call   10e0 <signal@plt>
mov    0x2b20(%rip),%rax
mov    (%rax),%edi
mov    0x2b37(%rip),%rax
mov    (%rax),%esi
call   10e0 <signal@plt>
lea    0xc5b(%rip),%rdi
call   1030 <chroot@plt>
lea    0xc55(%rip),%rdi
call   1080 <chdir@plt>
mov    0x2b21(%rip),%rax
mov    (%rax),%edi
mov    0x2af0(%rip),%rax
mov    (%rax),%esi
lea    -0x45c(%rbp),%rcx
xor    %edx,%edx
call   1100 <socketpair@plt>
cmp    $0x0,%rax
je     150e <main+0x26e>
jmp    14df <main+0x23f>
mov    0x2ad2(%rip),%rax
mov    (%rax),%edi
lea    0xb11(%rip),%rsi
lea    0xb1c(%rip),%rdx
mov    $0x4a,%ecx
lea    0xc00(%rip),%r8
call   10f0 <fprintf@plt>
xor    %edi,%edi
call   1180 <exit@plt>
mov    $0x0,%al
call   11b0 <fork@plt>
mov    %eax,-0x454(%rbp)
cmp    $0x0,%eax
jne    1616 <main+0x376>
mov    $0x44c,%edx
mov    %edx,%edi
mov    %edx,%esi
call   1090 <setresgid@plt>
mov    $0x44c,%edx
mov    %edx,%edi
mov    %edx,%esi
call   1050 <setresuid@plt>
mov    -0x458(%rbp),%edi
call   10d0 <close@plt>
lea    -0x480(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   10c0 <memset@plt>
lea    0xba8(%rip),%rax
mov    %rax,-0x488(%rbp)
lea    -0x480(%rbp),%rdi
mov    -0x45c(%rbp),%edx
lea    0xb96(%rip),%rsi
call   1170 <sprintf@plt>
mov    -0x488(%rbp),%rax
mov    %rax,-0x4a0(%rbp)
lea    -0x480(%rbp),%rax
mov    %rax,-0x498(%rbp)
movq   $0x0,-0x490(%rbp)
lea    -0x480(%rbp),%rsi
lea    0xb5f(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    -0x488(%rbp),%rdi
lea    -0x4a0(%rbp),%rsi
call   11a0 <execv@plt>
cmp    $0xffffffff,%eax
jne    1611 <main+0x371>
jmp    15e2 <main+0x342>
mov    0x29cf(%rip),%rax
mov    (%rax),%edi
lea    0xa0e(%rip),%rsi
lea    0xa19(%rip),%rdx
mov    $0x61,%ecx
lea    0xb22(%rip),%r8
call   10f0 <fprintf@plt>
xor    %edi,%edi
call   1180 <exit@plt>
jmp    1616 <main+0x376>
mov    $0x1,%edi
call   1190 <sleep@plt>
mov    -0x45c(%rbp),%edi
call   10d0 <close@plt>
lea    0xafc(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    0x2998(%rip),%rax
mov    (%rax),%edi
mov    0x2967(%rip),%rax
mov    (%rax),%esi
lea    -0x4a8(%rbp),%rcx
xor    %edx,%edx
call   1100 <socketpair@plt>
cmp    $0x0,%rax
je     1697 <main+0x3f7>
jmp    1668 <main+0x3c8>
mov    0x2949(%rip),%rax
mov    (%rax),%edi
lea    0x988(%rip),%rsi
lea    0x993(%rip),%rdx
mov    $0x6b,%ecx
lea    0xa77(%rip),%r8
call   10f0 <fprintf@plt>
xor    %edi,%edi
call   1180 <exit@plt>
mov    $0x0,%al
call   11b0 <fork@plt>
mov    %eax,-0x454(%rbp)
cmp    $0x0,%eax
jne    179f <main+0x4ff>
mov    $0x4b0,%edx
mov    %edx,%edi
mov    %edx,%esi
call   1090 <setresgid@plt>
mov    $0x4b0,%edx
mov    %edx,%edi
mov    %edx,%esi
call   1050 <setresuid@plt>
mov    -0x4a4(%rbp),%edi
call   10d0 <close@plt>
lea    -0x4d0(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   10c0 <memset@plt>
lea    0xa6c(%rip),%rax
mov    %rax,-0x4d8(%rbp)
lea    -0x4d0(%rbp),%rdi
mov    -0x4a8(%rbp),%edx
lea    0xa0d(%rip),%rsi
call   1170 <sprintf@plt>
mov    -0x4d8(%rbp),%rax
mov    %rax,-0x4f0(%rbp)
lea    -0x4d0(%rbp),%rax
mov    %rax,-0x4e8(%rbp)
movq   $0x0,-0x4e0(%rbp)
lea    -0x4d0(%rbp),%rsi
lea    0xa20(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    -0x4d8(%rbp),%rdi
lea    -0x4f0(%rbp),%rsi
call   11a0 <execv@plt>
cmp    $0xffffffff,%eax
jne    179a <main+0x4fa>
jmp    176b <main+0x4cb>
mov    0x2846(%rip),%rax
mov    (%rax),%edi
lea    0x885(%rip),%rsi
lea    0x890(%rip),%rdx
mov    $0x7d,%ecx
lea    0x999(%rip),%r8
call   10f0 <fprintf@plt>
xor    %edi,%edi
call   1180 <exit@plt>
jmp    179f <main+0x4ff>
mov    $0x1,%edi
call   1190 <sleep@plt>
mov    -0x4a8(%rbp),%edi
call   10d0 <close@plt>
lea    0x9b6(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    0x280f(%rip),%rax
mov    (%rax),%edi
mov    0x27de(%rip),%rax
mov    (%rax),%esi
lea    -0x4f8(%rbp),%rcx
xor    %edx,%edx
call   1100 <socketpair@plt>
cmp    $0x0,%rax
je     1820 <main+0x580>
jmp    17f1 <main+0x551>
mov    0x27c0(%rip),%rax
mov    (%rax),%edi
lea    0x7ff(%rip),%rsi
lea    0x80a(%rip),%rdx
mov    $0x87,%ecx
lea    0x8ee(%rip),%r8
call   10f0 <fprintf@plt>
xor    %edi,%edi
call   1180 <exit@plt>
mov    $0x0,%al
call   11b0 <fork@plt>
mov    %eax,-0x454(%rbp)
cmp    $0x0,%eax
jne    1928 <main+0x688>
mov    $0x514,%edx
mov    %edx,%edi
mov    %edx,%esi
call   1090 <setresgid@plt>
mov    $0x514,%edx
mov    %edx,%edi
mov    %edx,%esi
call   1050 <setresuid@plt>
mov    -0x4f4(%rbp),%edi
call   10d0 <close@plt>
lea    -0x520(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   10c0 <memset@plt>
lea    0x927(%rip),%rax
mov    %rax,-0x528(%rbp)
lea    -0x520(%rbp),%rdi
mov    -0x4f8(%rbp),%edx
lea    0x884(%rip),%rsi
call   1170 <sprintf@plt>
mov    -0x528(%rbp),%rax
mov    %rax,-0x540(%rbp)
lea    -0x520(%rbp),%rax
mov    %rax,-0x538(%rbp)
movq   $0x0,-0x530(%rbp)
lea    -0x520(%rbp),%rsi
lea    0x742(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    -0x528(%rbp),%rdi
lea    -0x540(%rbp),%rsi
call   11a0 <execv@plt>
cmp    $0xffffffff,%eax
jne    1923 <main+0x683>
jmp    18f4 <main+0x654>
mov    0x26bd(%rip),%rax
mov    (%rax),%edi
lea    0x6fc(%rip),%rsi
lea    0x707(%rip),%rdx
mov    $0x99,%ecx
lea    0x810(%rip),%r8
call   10f0 <fprintf@plt>
xor    %edi,%edi
call   1180 <exit@plt>
jmp    1928 <main+0x688>
mov    $0x1,%edi
call   1190 <sleep@plt>
mov    -0x4f8(%rbp),%edi
call   10d0 <close@plt>
lea    0x862(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
lea    -0x560(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   10c0 <memset@plt>
lea    -0x560(%rbp),%rdi
mov    -0x458(%rbp),%edx
lea    0x7a4(%rip),%rsi
call   1170 <sprintf@plt>
mov    -0x4f4(%rbp),%eax
mov    %eax,-0x59c(%rbp)
lea    -0x560(%rbp),%rax
mov    %rax,-0x598(%rbp)
lea    -0x560(%rbp),%rdi
call   1070 <strlen@plt>
mov    -0x59c(%rbp),%edi
mov    -0x598(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
mov    -0x458(%rbp),%ecx
call   1110 <sendfd@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    19ff <main+0x75f>
jmp    19d0 <main+0x730>
mov    0x25e1(%rip),%rax
mov    (%rax),%edi
lea    0x620(%rip),%rsi
lea    0x62b(%rip),%rdx
mov    $0xa4,%ecx
lea    0x7dc(%rip),%r8
call   10f0 <fprintf@plt>
xor    %edi,%edi
call   1180 <exit@plt>
lea    -0x560(%rbp),%rsi
lea    0x7ca(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
lea    -0x580(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   10c0 <memset@plt>
lea    -0x580(%rbp),%rdi
mov    -0x4a4(%rbp),%edx
lea    0x6db(%rip),%rsi
call   1170 <sprintf@plt>
mov    -0x4f4(%rbp),%eax
mov    %eax,-0x5ac(%rbp)
lea    -0x580(%rbp),%rax
mov    %rax,-0x5a8(%rbp)
lea    -0x580(%rbp),%rdi
call   1070 <strlen@plt>
mov    -0x5ac(%rbp),%edi
mov    -0x5a8(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
mov    -0x4a4(%rbp),%ecx
call   1110 <sendfd@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    1ac8 <main+0x828>
jmp    1a99 <main+0x7f9>
mov    0x2518(%rip),%rax
mov    (%rax),%edi
lea    0x557(%rip),%rsi
lea    0x562(%rip),%rdx
mov    $0xaa,%ecx
lea    0x713(%rip),%r8
call   10f0 <fprintf@plt>
xor    %edi,%edi
call   1180 <exit@plt>
lea    -0x580(%rbp),%rsi
lea    0x701(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    -0x458(%rbp),%edi
call   10d0 <close@plt>
mov    -0x4a4(%rbp),%edi
call   10d0 <close@plt>
mov    -0x14(%rbp),%edi
lea    -0x450(%rbp),%rsi
lea    -0x584(%rbp),%rdx
call   1150 <accept@plt>
mov    %eax,-0x18(%rbp)
cmp    $0xffffffff,%eax
jne    1b49 <main+0x8a9>
jmp    1b1a <main+0x87a>
mov    0x2497(%rip),%rax
mov    (%rax),%edi
lea    0x4d6(%rip),%rsi
lea    0x4e1(%rip),%rdx
mov    $0xb6,%ecx
lea    0x6a9(%rip),%r8
call   10f0 <fprintf@plt>
xor    %edi,%edi
call   1180 <exit@plt>
mov    -0x18(%rbp),%esi
lea    0x6af(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    -0x448(%rbp),%rdi
call   1060 <inet_ntoa@plt>
mov    %rax,-0x5c8(%rbp)
mov    -0x450(%rbp),%edi
call   1130 <ntohs@plt>
mov    -0x5c8(%rbp),%rsi
mov    %eax,%edx
lea    0x69d(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
lea    0x6bb(%rip),%rax
mov    %rax,-0x590(%rbp)
lea    0x6bb(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    -0x4f4(%rbp),%eax
mov    %eax,-0x5bc(%rbp)
mov    -0x590(%rbp),%rax
mov    %rax,-0x5b8(%rbp)
mov    -0x590(%rbp),%rdi
call   1070 <strlen@plt>
mov    -0x5bc(%rbp),%edi
mov    -0x5b8(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
mov    -0x18(%rbp),%ecx
call   1110 <sendfd@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    1c30 <main+0x990>
jmp    1c01 <main+0x961>
mov    0x23b0(%rip),%rax
mov    (%rax),%edi
lea    0x3ef(%rip),%rsi
lea    0x3fa(%rip),%rdx
mov    $0xc5,%ecx
lea    0x65c(%rip),%r8
call   10f0 <fprintf@plt>
xor    %edi,%edi
call   1180 <exit@plt>
mov    -0x18(%rbp),%edi
call   10d0 <close@plt>
jmp    1af3 <main+0x853>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
mov    $0x50,%ebx
cmp    $0x2,%edi
jl     12d6 <main+0x26>
mov    0x8(%rsi),%rdi
call   1170 <atoi@plt>
mov    %eax,%ebx
mov    0x2cc3(%rip),%rax
mov    (%rax),%edi
mov    0x2cca(%rip),%r14
mov    (%r14),%esi
xor    %edx,%edx
call   11d0 <socket@plt>
cmp    $0xffffffff,%eax
jne    131d <main+0x6d>
mov    0x2cbc(%rip),%rax
mov    (%rax),%edi
lea    0xcfb(%rip),%rsi
lea    0xd06(%rip),%rdx
lea    0xd8c(%rip),%r8
mov    $0x26,%ecx
jmp    19f3 <main+0x743>
mov    %eax,%ebp
mov    0x2cc2(%rip),%rax
mov    (%rax),%esi
mov    0x2c69(%rip),%rax
mov    (%rax),%edx
lea    0x74(%rsp),%rcx
mov    %ebp,%edi
mov    $0x4,%r8d
call   1050 <setsockopt@plt>
cmp    $0xffffffff,%eax
jne    1370 <main+0xc0>
mov    0x2c69(%rip),%rax
mov    (%rax),%edi
lea    0xca8(%rip),%rsi
lea    0xcb3(%rip),%rdx
lea    0xd4b(%rip),%r8
mov    $0x2a,%ecx
jmp    19f3 <main+0x743>
lea    0x90(%rsp),%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   10d0 <memset@plt>
mov    0x2c52(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xa0(%rsp)
mov    %ebx,%edi
call   10b0 <htons@plt>
mov    %eax,0x90(%rsp)
movq   $0x0,0x98(%rsp)
mov    %ebp,%edi
mov    %r15,%rsi
mov    $0x4,%edx
call   1150 <bind@plt>
cmp    $0xffffffff,%eax
jne    13ed <main+0x13d>
mov    0x2bec(%rip),%rax
mov    (%rax),%edi
lea    0xc2b(%rip),%rsi
lea    0xc36(%rip),%rdx
lea    0xcf1(%rip),%r8
mov    $0x33,%ecx
jmp    19f3 <main+0x743>
mov    %ebp,%edi
mov    $0x3e8,%esi
call   1130 <listen@plt>
cmp    $0xffffffff,%eax
jne    1426 <main+0x176>
mov    0x2bb3(%rip),%rax
mov    (%rax),%edi
lea    0xbf2(%rip),%rsi
lea    0xbfd(%rip),%rdx
lea    0xcca(%rip),%r8
mov    $0x36,%ecx
jmp    19f3 <main+0x743>
mov    0x2ba3(%rip),%rax
mov    (%rax),%edi
mov    0x2b92(%rip),%rbx
mov    (%rbx),%esi
call   10f0 <signal@plt>
mov    0x2b64(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%esi
call   10f0 <signal@plt>
lea    0xca6(%rip),%rdi
call   1030 <chroot@plt>
lea    0xca0(%rip),%rdi
call   1090 <chdir@plt>
mov    0x2b6c(%rip),%r15
mov    (%r15),%edi
mov    (%r14),%esi
lea    0x18(%rsp),%rcx
xor    %edx,%edx
call   1110 <socketpair@plt>
test   %rax,%rax
jne    1551 <main+0x2a1>
xor    %eax,%eax
call   11c0 <fork@plt>
test   %eax,%eax
jne    1579 <main+0x2c9>
mov    $0x44c,%edi
mov    $0x44c,%esi
mov    $0x44c,%edx
call   10a0 <setresgid@plt>
mov    $0x44c,%edi
mov    $0x44c,%esi
mov    $0x44c,%edx
call   1060 <setresuid@plt>
mov    0x1c(%rsp),%edi
call   10e0 <close@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
mov    0x18(%rsp),%edx
lea    0xc37(%rip),%rsi
lea    0x50(%rsp),%rbx
mov    %rbx,%rdi
call   1180 <sprintf@plt>
lea    0xc1a(%rip),%r12
mov    %r12,0x20(%rsp)
mov    %rbx,0x28(%rsp)
movq   $0x0,0x30(%rsp)
lea    0xc0c(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   10c0 <printf@plt>
lea    0x20(%rsp),%rsi
mov    %r12,%rdi
call   11b0 <execv@plt>
cmp    $0xffffffff,%eax
jne    1579 <main+0x2c9>
mov    0x2a88(%rip),%rax
mov    (%rax),%edi
lea    0xac7(%rip),%rsi
lea    0xad2(%rip),%rdx
lea    0xbe0(%rip),%r8
mov    $0x61,%ecx
jmp    19f3 <main+0x743>
mov    0x2a60(%rip),%rax
mov    (%rax),%edi
lea    0xa9f(%rip),%rsi
lea    0xaaa(%rip),%rdx
lea    0xb93(%rip),%r8
mov    $0x4a,%ecx
jmp    19f3 <main+0x743>
mov    $0x1,%edi
call   11a0 <sleep@plt>
mov    0x18(%rsp),%edi
call   10e0 <close@plt>
lea    0xc57(%rip),%rdi
call   1040 <puts@plt>
mov    (%r15),%edi
mov    (%r14),%esi
lea    0x10(%rsp),%rcx
xor    %edx,%edx
call   1110 <socketpair@plt>
test   %rax,%rax
jne    167d <main+0x3cd>
xor    %eax,%eax
call   11c0 <fork@plt>
test   %eax,%eax
jne    16a5 <main+0x3f5>
mov    $0x4b0,%edi
mov    $0x4b0,%esi
mov    $0x4b0,%edx
call   10a0 <setresgid@plt>
mov    $0x4b0,%edi
mov    $0x4b0,%esi
mov    $0x4b0,%edx
call   1060 <setresuid@plt>
mov    0x14(%rsp),%edi
call   10e0 <close@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
mov    0x10(%rsp),%edx
lea    0xb0b(%rip),%rsi
lea    0x50(%rsp),%rbx
mov    %rbx,%rdi
call   1180 <sprintf@plt>
lea    0xb0f(%rip),%r12
mov    %r12,0x20(%rsp)
mov    %rbx,0x28(%rsp)
movq   $0x0,0x30(%rsp)
lea    0xafe(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   10c0 <printf@plt>
lea    0x20(%rsp),%rsi
mov    %r12,%rdi
call   11b0 <execv@plt>
cmp    $0xffffffff,%eax
jne    16a5 <main+0x3f5>
mov    0x295c(%rip),%rax
mov    (%rax),%edi
lea    0x99b(%rip),%rsi
lea    0x9a6(%rip),%rdx
lea    0xab4(%rip),%r8
mov    $0x7d,%ecx
jmp    19f3 <main+0x743>
mov    0x2934(%rip),%rax
mov    (%rax),%edi
lea    0x973(%rip),%rsi
lea    0x97e(%rip),%rdx
lea    0xa67(%rip),%r8
mov    $0x6b,%ecx
jmp    19f3 <main+0x743>
mov    $0x1,%edi
call   11a0 <sleep@plt>
mov    0x10(%rsp),%edi
call   10e0 <close@plt>
lea    0xb56(%rip),%rdi
call   1040 <puts@plt>
mov    (%r15),%edi
mov    (%r14),%esi
lea    0x8(%rsp),%rcx
xor    %edx,%edx
call   1110 <socketpair@plt>
test   %rax,%rax
jne    17a0 <main+0x4f0>
xor    %eax,%eax
call   11c0 <fork@plt>
test   %eax,%eax
jne    17c8 <main+0x518>
mov    $0x514,%edi
mov    $0x514,%esi
mov    $0x514,%edx
call   10a0 <setresgid@plt>
mov    $0x514,%edi
mov    $0x514,%esi
mov    $0x514,%edx
call   1060 <setresuid@plt>
mov    0xc(%rsp),%edi
call   10e0 <close@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
mov    0x8(%rsp),%edx
lea    0x9df(%rip),%rsi
lea    0x50(%rsp),%rbx
mov    %rbx,%rdi
call   1180 <sprintf@plt>
lea    0x9fa(%rip),%r14
mov    %r14,0x20(%rsp)
mov    %rbx,0x28(%rsp)
movq   $0x0,0x30(%rsp)
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0x20(%rsp),%rsi
mov    %r14,%rdi
call   11b0 <execv@plt>
cmp    $0xffffffff,%eax
jne    17c8 <main+0x518>
mov    0x2839(%rip),%rax
mov    (%rax),%edi
lea    0x878(%rip),%rsi
lea    0x883(%rip),%rdx
lea    0x991(%rip),%r8
mov    $0x99,%ecx
jmp    19f3 <main+0x743>
mov    0x2811(%rip),%rax
mov    (%rax),%edi
lea    0x850(%rip),%rsi
lea    0x85b(%rip),%rdx
lea    0x944(%rip),%r8
mov    $0x87,%ecx
jmp    19f3 <main+0x743>
mov    $0x1,%edi
call   11a0 <sleep@plt>
mov    0x8(%rsp),%edi
call   10e0 <close@plt>
lea    0xa5f(%rip),%rdi
call   1040 <puts@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
mov    0x1c(%rsp),%edx
lea    0x917(%rip),%rsi
lea    0x50(%rsp),%r14
mov    %r14,%rdi
call   1180 <sprintf@plt>
mov    0xc(%rsp),%ebx
mov    %r14,%rdi
call   1080 <strlen@plt>
lea    0x1(%rax),%rdx
mov    0x1c(%rsp),%ecx
mov    %ebx,%edi
mov    %r14,%rsi
call   1120 <sendfd@plt>
cmp    $0xffffffff,%eax
jne    1857 <main+0x5a7>
mov    0x2782(%rip),%rax
mov    (%rax),%edi
lea    0x7c1(%rip),%rsi
lea    0x7cc(%rip),%rdx
lea    0x900(%rip),%r8
mov    $0xa4,%ecx
jmp    19f3 <main+0x743>
lea    0x8f7(%rip),%rdi
lea    0x50(%rsp),%rsi
xor    %eax,%eax
call   10c0 <printf@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
mov    0x14(%rsp),%edx
lea    0x894(%rip),%rsi
lea    0x20(%rsp),%r14
mov    %r14,%rdi
call   1180 <sprintf@plt>
mov    0xc(%rsp),%ebx
mov    %r14,%rdi
call   1080 <strlen@plt>
lea    0x1(%rax),%rdx
mov    0x14(%rsp),%ecx
mov    %ebx,%edi
mov    %r14,%rsi
call   1120 <sendfd@plt>
cmp    $0xffffffff,%eax
jne    18da <main+0x62a>
mov    0x26ff(%rip),%rax
mov    (%rax),%edi
lea    0x73e(%rip),%rsi
lea    0x749(%rip),%rdx
lea    0x87d(%rip),%r8
mov    $0xaa,%ecx
jmp    19f3 <main+0x743>
lea    0x874(%rip),%rdi
lea    0x20(%rsp),%rsi
xor    %eax,%eax
call   10c0 <printf@plt>
mov    0x1c(%rsp),%edi
call   10e0 <close@plt>
mov    0x14(%rsp),%edi
call   10e0 <close@plt>
lea    0x78(%rsp),%rsi
lea    0x4c(%rsp),%rdx
mov    %ebp,%edi
call   1160 <accept@plt>
cmp    $0xffffffff,%eax
je     19ab <main+0x6fb>
mov    %eax,%ebx
lea    0x8ad(%rip),%r13
lea    0x78(%rsp),%r14
lea    0x4c(%rsp),%r15
nopl   0x0(%rax)
lea    0x849(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   10c0 <printf@plt>
mov    0x80(%rsp),%rdi
call   1070 <inet_ntoa@plt>
mov    %rax,%r12
mov    0x78(%rsp),%edi
call   1140 <ntohs@plt>
lea    0x843(%rip),%rdi
mov    %r12,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   10c0 <printf@plt>
lea    0x8f6(%rip),%rdi
call   1040 <puts@plt>
mov    0xc(%rsp),%edi
mov    $0xe,%edx
mov    %r13,%rsi
mov    %ebx,%ecx
call   1120 <sendfd@plt>
cmp    $0xffffffff,%eax
je     19d0 <main+0x720>
mov    %ebx,%edi
call   10e0 <close@plt>
mov    %ebp,%edi
mov    %r14,%rsi
mov    %r15,%rdx
call   1160 <accept@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
jne    1930 <main+0x680>
mov    0x2606(%rip),%rax
mov    (%rax),%edi
lea    0x645(%rip),%rsi
lea    0x650(%rip),%rdx
lea    0x79b(%rip),%r8
mov    $0xb6,%ecx
jmp    19f3 <main+0x743>
mov    0x25e1(%rip),%rax
mov    (%rax),%edi
lea    0x620(%rip),%rsi
lea    0x62b(%rip),%rdx
lea    0x7ef(%rip),%r8
mov    $0xc5,%ecx
call   1100 <fprintf@plt>
xor    %edi,%edi
call   1190 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i64 }
%struct.sockaddr = type { i32 }
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@stderr = global i32 0
@.str = [18 x i8] c"Error: %s:%d: %s\0A\00"
@.str.1 = [141 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/insertion/SEED_LAB/refs/heads/master/lab4/server.c\00"
@.str.2 = [18 x i8] c"creating a socket\00"
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str.3 = [35 x i8] c"setting socket option SO_REUSEADDR\00"
@AF_INET = global i32 0
@.str.4 = [18 x i8] c"binding to socket\00"
@.str.5 = [20 x i8] c"listening on socket\00"
@SIGCHLD = global i32 0
@SIG_IGN = global i32 0
@SIGPIPE = global i32 0
@.str.6 = [6 x i8] c"/jail\00"
@.str.7 = [2 x i8] c"/\00"
@AF_UNIX = global i32 0
@.str.8 = [11 x i8] c"socketpair\00"
@.str.9 = [9 x i8] c"./filesv\00"
@.str.10 = [3 x i8] c"%d\00"
@.str.11 = [14 x i8] c"file fd = %s\0A\00"
@.str.12 = [7 x i8] c"execve\00"
@.str.13 = [44 x i8] c"the first web service launched (filesv)...\0A\00"
@.str.14 = [9 x i8] c"./banksv\00"
@.str.15 = [14 x i8] c"bank fd = %s\0A\00"
@.str.16 = [45 x i8] c"the second web service launched (banksv)...\0A\00"
@.str.17 = [8 x i8] c"./httpd\00"
@.str.18 = [4 x i8] c"%s\0A\00"
@.str.19 = [41 x i8] c"the http dispatcher service launched...\0A\00"
@.str.20 = [8 x i8] c"send fd\00"
@.str.21 = [15 x i8] c"sending %s...\0A\00"
@.str.22 = [28 x i8] c"accepting client connection\00"
@.str.23 = [35 x i8] c"Parent process client_sockfd = %d\0A\00"
@.str.24 = [44 x i8] c"server: accepting a client from %s port %d\0A\00"
@.str.25 = [14 x i8] c"hello, world\0A\00"
@.str.26 = [33 x i8] c"sending a socket to the client:\0A\00"
@.str.27 = [13 x i8] c"send sock fd\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 i32
%9 = alloca i32
%10 = alloca [1024 x i8]
%11 = alloca %struct.sockaddr_in
%12 = alloca %struct.sockaddr_in
%13 = alloca i32
%14 = alloca [2 x i32]
%15 = alloca [32 x i8]
%16 = alloca i8*
%17 = alloca [3 x i8*]
%18 = alloca [2 x i32]
%19 = alloca [32 x i8]
%20 = alloca i8*
%21 = alloca [3 x i8*]
%22 = alloca [2 x i32]
%23 = alloca [32 x i8]
%24 = alloca i8*
%25 = alloca [3 x i8*]
%26 = alloca [32 x i8]
%27 = alloca [32 x i8]
%28 = alloca i32
%29 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 80, i32* %8
%30 = load i32, i32* %4
%31 = icmp sgt i32 %30, 1
br i1 %31, label %32, label %37
32: ; preds = %2
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 1
%35 = load i8*, i8** %34
%36 = call i32 @atoi(i8* %35)
store i32 %36, i32* %8
br label %37
37: ; preds = %32, %2
%38 = load i32, i32* @PF_INET
%39 = load i32, i32* @SOCK_STREAM
%40 = call i32 @socket(i32 %38, i32 %39, i32 0)
store i32 %40, i32* %6
%41 = icmp eq i32 %40, -1
br i1 %41, label %42, label %48
42: ; preds = %37
br label %43
43: ; preds = %42
%44 = load i32, i32* @stderr
%45 = call i32 @fprintf(i32 %44, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 38, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%46 = call i32 @exit(i32 0)
unreachable
47: ; No predecessors!
br label %48
48: ; preds = %47, %37
%49 = load i32, i32* %6
%50 = load i32, i32* @SOL_SOCKET
%51 = load i32, i32* @SO_REUSEADDR
%52 = call i32 @setsockopt(i32 %49, i32 %50, i32 %51, i32* %9, i32 4)
%53 = icmp eq i32 %52, -1
br i1 %53, label %54, label %60
54: ; preds = %48
br label %55
55: ; preds = %54
%56 = load i32, i32* @stderr
%57 = call i32 @fprintf(i32 %56, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 42, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
%58 = call i32 @exit(i32 0)
unreachable
59: ; No predecessors!
br label %60
60: ; preds = %59, %48
%61 = call i32 @memset(%struct.sockaddr_in* %11, i8 signext 0, i32 24)
%62 = load i32, i32* @AF_INET
%63 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 2
store i32 %62, i32* %63
%64 = load i32, i32* %8
%65 = call i32 @htons(i32 %64)
%66 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 0
store i32 %65, i32* %66
%67 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 1
%68 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %67, i32 0, i32 0
store i64 0, i64* %68
%69 = load i32, i32* %6
%70 = bitcast %struct.sockaddr_in* %11 to %struct.sockaddr*
%71 = call i32 @bind(i32 %69, %struct.sockaddr* %70, i32 4)
%72 = icmp eq i32 %71, -1
br i1 %72, label %73, label %79
73: ; preds = %60
br label %74
74: ; preds = %73
%75 = load i32, i32* @stderr
%76 = call i32 @fprintf(i32 %75, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 51, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%77 = call i32 @exit(i32 0)
unreachable
78: ; No predecessors!
br label %79
79: ; preds = %78, %60
%80 = load i32, i32* %6
%81 = call i32 @listen(i32 %80, i32 1000)
%82 = icmp eq i32 %81, -1
br i1 %82, label %83, label %89
83: ; preds = %79
br label %84
84: ; preds = %83
%85 = load i32, i32* @stderr
%86 = call i32 @fprintf(i32 %85, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 54, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
%87 = call i32 @exit(i32 0)
unreachable
88: ; No predecessors!
br label %89
89: ; preds = %88, %79
%90 = load i32, i32* @SIGCHLD
%91 = load i32, i32* @SIG_IGN
%92 = call i32 @signal(i32 %90, i32 %91)
%93 = load i32, i32* @SIGPIPE
%94 = load i32, i32* @SIG_IGN
%95 = call i32 @signal(i32 %93, i32 %94)
%96 = call i32 @chroot(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%97 = call i32 @chdir(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%98 = load i32, i32* @AF_UNIX
%99 = load i32, i32* @SOCK_STREAM
%100 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 0
%101 = call i64 @socketpair(i32 %98, i32 %99, i32 0, i32* %100)
%102 = icmp ne i64 %101, 0
br i1 %102, label %103, label %109
103: ; preds = %89
br label %104
104: ; preds = %103
%105 = load i32, i32* @stderr
%106 = call i32 @fprintf(i32 %105, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 74, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
%107 = call i32 @exit(i32 0)
unreachable
108: ; No predecessors!
br label %109
109: ; preds = %108, %89
%110 = call i32 (...) @fork()
store i32 %110, i32* %13
%111 = icmp eq i32 %110, 0
br i1 %111, label %112, label %141
112: ; preds = %109
%113 = call i32 @setresgid(i32 1100, i32 1100, i32 1100)
%114 = call i32 @setresuid(i32 1100, i32 1100, i32 1100)
%115 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 1
%116 = load i32, i32* %115
%117 = call i32 @close(i32 %116)
%118 = bitcast [32 x i8]* %15 to i8*
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), i8** %16
%119 = getelementptr inbounds [32 x i8], [32 x i8]* %15, i64 0, i64 0
%120 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 0
%121 = load i32, i32* %120
%122 = call i32 @sprintf(i8* %119, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32 %121)
%123 = getelementptr inbounds [3 x i8*], [3 x i8*]* %17, i64 0, i64 0
%124 = load i8*, i8** %16
store i8* %124, i8** %123
%125 = getelementptr inbounds i8*, i8** %123, i64 1
%126 = getelementptr inbounds [32 x i8], [32 x i8]* %15, i64 0, i64 0
store i8* %126, i8** %125
%127 = getelementptr inbounds i8*, i8** %125, i64 1
store i8* null, i8** %127
%128 = getelementptr inbounds [32 x i8], [32 x i8]* %15, i64 0, i64 0
%129 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i8* %128)
%130 = load i8*, i8** %16
%131 = getelementptr inbounds [3 x i8*], [3 x i8*]* %17, i64 0, i64 0
%132 = call i32 @execv(i8* %130, i8** %131)
%133 = icmp eq i32 %132, -1
br i1 %133, label %134, label %140
134: ; preds = %112
br label %135
135: ; preds = %134
%136 = load i32, i32* @stderr
%137 = call i32 @fprintf(i32 %136, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 97, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0))
%138 = call i32 @exit(i32 0)
unreachable
139: ; No predecessors!
br label %140
140: ; preds = %139, %112
br label %141
141: ; preds = %140, %109
%142 = call i32 @sleep(i32 1)
%143 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 0
%144 = load i32, i32* %143
%145 = call i32 @close(i32 %144)
%146 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.13, i64 0, i64 0))
%147 = load i32, i32* @AF_UNIX
%148 = load i32, i32* @SOCK_STREAM
%149 = getelementptr inbounds [2 x i32], [2 x i32]* %18, i64 0, i64 0
%150 = call i64 @socketpair(i32 %147, i32 %148, i32 0, i32* %149)
%151 = icmp ne i64 %150, 0
br i1 %151, label %152, label %158
152: ; preds = %141
br label %153
153: ; preds = %152
%154 = load i32, i32* @stderr
%155 = call i32 @fprintf(i32 %154, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 107, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
%156 = call i32 @exit(i32 0)
unreachable
157: ; No predecessors!
br label %158
158: ; preds = %157, %141
%159 = call i32 (...) @fork()
store i32 %159, i32* %13
%160 = icmp eq i32 %159, 0
br i1 %160, label %161, label %190
161: ; preds = %158
%162 = call i32 @setresgid(i32 1200, i32 1200, i32 1200)
%163 = call i32 @setresuid(i32 1200, i32 1200, i32 1200)
%164 = getelementptr inbounds [2 x i32], [2 x i32]* %18, i64 0, i64 1
%165 = load i32, i32* %164
%166 = call i32 @close(i32 %165)
%167 = bitcast [32 x i8]* %19 to i8*
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.14, i64 0, i64 0), i8** %20
%168 = getelementptr inbounds [32 x i8], [32 x i8]* %19, i64 0, i64 0
%169 = getelementptr inbounds [2 x i32], [2 x i32]* %18, i64 0, i64 0
%170 = load i32, i32* %169
%171 = call i32 @sprintf(i8* %168, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32 %170)
%172 = getelementptr inbounds [3 x i8*], [3 x i8*]* %21, i64 0, i64 0
%173 = load i8*, i8** %20
store i8* %173, i8** %172
%174 = getelementptr inbounds i8*, i8** %172, i64 1
%175 = getelementptr inbounds [32 x i8], [32 x i8]* %19, i64 0, i64 0
store i8* %175, i8** %174
%176 = getelementptr inbounds i8*, i8** %174, i64 1
store i8* null, i8** %176
%177 = getelementptr inbounds [32 x i8], [32 x i8]* %19, i64 0, i64 0
%178 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.15, i64 0, i64 0), i8* %177)
%179 = load i8*, i8** %20
%180 = getelementptr inbounds [3 x i8*], [3 x i8*]* %21, i64 0, i64 0
%181 = call i32 @execv(i8* %179, i8** %180)
%182 = icmp eq i32 %181, -1
br i1 %182, label %183, label %189
183: ; preds = %161
br label %184
184: ; preds = %183
%185 = load i32, i32* @stderr
%186 = call i32 @fprintf(i32 %185, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 125, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0))
%187 = call i32 @exit(i32 0)
unreachable
188: ; No predecessors!
br label %189
189: ; preds = %188, %161
br label %190
190: ; preds = %189, %158
%191 = call i32 @sleep(i32 1)
%192 = getelementptr inbounds [2 x i32], [2 x i32]* %18, i64 0, i64 0
%193 = load i32, i32* %192
%194 = call i32 @close(i32 %193)
%195 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.16, i64 0, i64 0))
%196 = load i32, i32* @AF_UNIX
%197 = load i32, i32* @SOCK_STREAM
%198 = getelementptr inbounds [2 x i32], [2 x i32]* %22, i64 0, i64 0
%199 = call i64 @socketpair(i32 %196, i32 %197, i32 0, i32* %198)
%200 = icmp ne i64 %199, 0
br i1 %200, label %201, label %207
201: ; preds = %190
br label %202
202: ; preds = %201
%203 = load i32, i32* @stderr
%204 = call i32 @fprintf(i32 %203, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 135, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
%205 = call i32 @exit(i32 0)
unreachable
206: ; No predecessors!
br label %207
207: ; preds = %206, %190
%208 = call i32 (...) @fork()
store i32 %208, i32* %13
%209 = icmp eq i32 %208, 0
br i1 %209, label %210, label %239
210: ; preds = %207
%211 = call i32 @setresgid(i32 1300, i32 1300, i32 1300)
%212 = call i32 @setresuid(i32 1300, i32 1300, i32 1300)
%213 = getelementptr inbounds [2 x i32], [2 x i32]* %22, i64 0, i64 1
%214 = load i32, i32* %213
%215 = call i32 @close(i32 %214)
%216 = bitcast [32 x i8]* %23 to i8*
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i64 0, i64 0), i8** %24
%217 = getelementptr inbounds [32 x i8], [32 x i8]* %23, i64 0, i64 0
%218 = getelementptr inbounds [2 x i32], [2 x i32]* %22, i64 0, i64 0
%219 = load i32, i32* %218
%220 = call i32 @sprintf(i8* %217, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32 %219)
%221 = getelementptr inbounds [3 x i8*], [3 x i8*]* %25, i64 0, i64 0
%222 = load i8*, i8** %24
store i8* %222, i8** %221
%223 = getelementptr inbounds i8*, i8** %221, i64 1
%224 = getelementptr inbounds [32 x i8], [32 x i8]* %23, i64 0, i64 0
store i8* %224, i8** %223
%225 = getelementptr inbounds i8*, i8** %223, i64 1
store i8* null, i8** %225
%226 = getelementptr inbounds [32 x i8], [32 x i8]* %23, i64 0, i64 0
%227 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0), i8* %226)
%228 = load i8*, i8** %24
%229 = getelementptr inbounds [3 x i8*], [3 x i8*]* %25, i64 0, i64 0
%230 = call i32 @execv(i8* %228, i8** %229)
%231 = icmp eq i32 %230, -1
br i1 %231, label %232, label %238
232: ; preds = %210
br label %233
233: ; preds = %232
%234 = load i32, i32* @stderr
%235 = call i32 @fprintf(i32 %234, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 153, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0))
%236 = call i32 @exit(i32 0)
unreachable
237: ; No predecessors!
br label %238
238: ; preds = %237, %210
br label %239
239: ; preds = %238, %207
%240 = call i32 @sleep(i32 1)
%241 = getelementptr inbounds [2 x i32], [2 x i32]* %22, i64 0, i64 0
%242 = load i32, i32* %241
%243 = call i32 @close(i32 %242)
%244 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.19, i64 0, i64 0))
%245 = bitcast [32 x i8]* %26 to i8*
%246 = getelementptr inbounds [32 x i8], [32 x i8]* %26, i64 0, i64 0
%247 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 1
%248 = load i32, i32* %247
%249 = call i32 @sprintf(i8* %246, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32 %248)
%250 = getelementptr inbounds [2 x i32], [2 x i32]* %22, i64 0, i64 1
%251 = load i32, i32* %250
%252 = getelementptr inbounds [32 x i8], [32 x i8]* %26, i64 0, i64 0
%253 = getelementptr inbounds [32 x i8], [32 x i8]* %26, i64 0, i64 0
%254 = call i64 @strlen(i8* %253)
%255 = add nsw i64 %254, 1
%256 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 1
%257 = load i32, i32* %256
%258 = call i32 @sendfd(i32 %251, i8* %252, i64 %255, i32 %257)
%259 = icmp eq i32 -1, %258
br i1 %259, label %260, label %266
260: ; preds = %239
br label %261
261: ; preds = %260
%262 = load i32, i32* @stderr
%263 = call i32 @fprintf(i32 %262, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 164, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.20, i64 0, i64 0))
%264 = call i32 @exit(i32 0)
unreachable
265: ; No predecessors!
br label %266
266: ; preds = %265, %239
%267 = getelementptr inbounds [32 x i8], [32 x i8]* %26, i64 0, i64 0
%268 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.21, i64 0, i64 0), i8* %267)
%269 = bitcast [32 x i8]* %27 to i8*
%270 = getelementptr inbounds [32 x i8], [32 x i8]* %27, i64 0, i64 0
%271 = getelementptr inbounds [2 x i32], [2 x i32]* %18, i64 0, i64 1
%272 = load i32, i32* %271
%273 = call i32 @sprintf(i8* %270, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32 %272)
%274 = getelementptr inbounds [2 x i32], [2 x i32]* %22, i64 0, i64 1
%275 = load i32, i32* %274
%276 = getelementptr inbounds [32 x i8], [32 x i8]* %27, i64 0, i64 0
%277 = getelementptr inbounds [32 x i8], [32 x i8]* %27, i64 0, i64 0
%278 = call i64 @strlen(i8* %277)
%279 = add nsw i64 %278, 1
%280 = getelementptr inbounds [2 x i32], [2 x i32]* %18, i64 0, i64 1
%281 = load i32, i32* %280
%282 = call i32 @sendfd(i32 %275, i8* %276, i64 %279, i32 %281)
%283 = icmp eq i32 -1, %282
br i1 %283, label %284, label %290
284: ; preds = %266
br label %285
285: ; preds = %284
%286 = load i32, i32* @stderr
%287 = call i32 @fprintf(i32 %286, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 170, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.20, i64 0, i64 0))
%288 = call i32 @exit(i32 0)
unreachable
289: ; No predecessors!
br label %290
290: ; preds = %289, %266
%291 = getelementptr inbounds [32 x i8], [32 x i8]* %27, i64 0, i64 0
%292 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.21, i64 0, i64 0), i8* %291)
%293 = getelementptr inbounds [2 x i32], [2 x i32]* %14, i64 0, i64 1
%294 = load i32, i32* %293
%295 = call i32 @close(i32 %294)
%296 = getelementptr inbounds [2 x i32], [2 x i32]* %18, i64 0, i64 1
%297 = load i32, i32* %296
%298 = call i32 @close(i32 %297)
br label %299
299: ; preds = %290, %337
%300 = load i32, i32* %6
%301 = bitcast %struct.sockaddr_in* %12 to %struct.sockaddr*
%302 = call i32 @accept(i32 %300, %struct.sockaddr* %301, i32* %28)
store i32 %302, i32* %7
%303 = icmp eq i32 %302, -1
br i1 %303, label %304, label %310
304: ; preds = %299
br label %305
305: ; preds = %304
%306 = load i32, i32* @stderr
%307 = call i32 @fprintf(i32 %306, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 182, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.22, i64 0, i64 0))
%308 = call i32 @exit(i32 0)
unreachable
309: ; No predecessors!
br label %310
310: ; preds = %309, %299
%311 = load i32, i32* %7
%312 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.23, i64 0, i64 0), i32 %311)
%313 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %12, i32 0, i32 1
%314 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %313, i32 0, i32 0
%315 = load i64, i64* %314
%316 = call i8* @inet_ntoa(i64 %315)
%317 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %12, i32 0, i32 0
%318 = load i32, i32* %317
%319 = call i32 @ntohs(i32 %318)
%320 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.24, i64 0, i64 0), i8* %316, i32 %319)
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.25, i64 0, i64 0), i8** %29
%321 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.26, i64 0, i64 0))
%322 = getelementptr inbounds [2 x i32], [2 x i32]* %22, i64 0, i64 1
%323 = load i32, i32* %322
%324 = load i8*, i8** %29
%325 = load i8*, i8** %29
%326 = call i64 @strlen(i8* %325)
%327 = add nsw i64 %326, 1
%328 = load i32, i32* %7
%329 = call i32 @sendfd(i32 %323, i8* %324, i64 %327, i32 %328)
%330 = icmp eq i32 -1, %329
br i1 %330, label %331, label %337
331: ; preds = %310
br label %332
332: ; preds = %331
%333 = load i32, i32* @stderr
%334 = call i32 @fprintf(i32 %333, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 197, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.27, i64 0, i64 0))
%335 = call i32 @exit(i32 0)
unreachable
336: ; No predecessors!
br label %337
337: ; preds = %336, %310
%338 = load i32, i32* %7
%339 = call i32 @close(i32 %338)
br label %299
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i64 }
%struct.sockaddr = type { i32 }
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@stderr = global i32 0
@.str = [18 x i8] c"Error: %s:%d: %s\0A\00"
@.str.1 = [141 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/insertion/SEED_LAB/refs/heads/master/lab4/server.c\00"
@.str.2 = [18 x i8] c"creating a socket\00"
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str.3 = [35 x i8] c"setting socket option SO_REUSEADDR\00"
@AF_INET = global i32 0
@.str.4 = [18 x i8] c"binding to socket\00"
@.str.5 = [20 x i8] c"listening on socket\00"
@SIGCHLD = global i32 0
@SIG_IGN = global i32 0
@SIGPIPE = global i32 0
@.str.6 = [6 x i8] c"/jail\00"
@.str.7 = [2 x i8] c"/\00"
@AF_UNIX = global i32 0
@.str.8 = [11 x i8] c"socketpair\00"
@.str.9 = [9 x i8] c"./filesv\00"
@.str.10 = [3 x i8] c"%d\00"
@.str.11 = [14 x i8] c"file fd = %s\0A\00"
@.str.12 = [7 x i8] c"execve\00"
@.str.14 = [9 x i8] c"./banksv\00"
@.str.15 = [14 x i8] c"bank fd = %s\0A\00"
@.str.17 = [8 x i8] c"./httpd\00"
@.str.20 = [8 x i8] c"send fd\00"
@.str.21 = [15 x i8] c"sending %s...\0A\00"
@.str.22 = [28 x i8] c"accepting client connection\00"
@.str.23 = [35 x i8] c"Parent process client_sockfd = %d\0A\00"
@.str.24 = [44 x i8] c"server: accepting a client from %s port %d\0A\00"
@.str.25 = [14 x i8] c"hello, world\0A\00"
@.str.27 = [13 x i8] c"send sock fd\00"
@str = [43 x i8] c"the first web service launched (filesv)...\00"
@str.28 = [44 x i8] c"the second web service launched (banksv)...\00"
@str.29 = [40 x i8] c"the http dispatcher service launched...\00"
@str.30 = [32 x i8] c"sending a socket to the client:\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca %struct.sockaddr_in
%5 = alloca %struct.sockaddr_in
%6 = alloca [2 x i32]
%7 = alloca [32 x i8]
%8 = alloca [3 x i8*]
%9 = alloca [2 x i32]
%10 = alloca [32 x i8]
%11 = alloca [3 x i8*]
%12 = alloca [2 x i32]
%13 = alloca [32 x i8]
%14 = alloca [3 x i8*]
%15 = alloca [32 x i8]
%16 = alloca [32 x i8]
%17 = alloca i32
%18 = bitcast i32* %3 to i8*
%19 = bitcast %struct.sockaddr_in* %4 to i8*
%20 = bitcast %struct.sockaddr_in* %5 to i8*
%21 = icmp sgt i32 %0, 1
br i1 %21, label %22, label %26
22: ; preds = %2
%23 = getelementptr inbounds i8*, i8** %1, i64 1
%24 = load i8*, i8** %23
%25 = tail call i32 @atoi(i8* %24)
br label %26
26: ; preds = %22, %2
%27 = phi i32 [ %25, %22 ], [ 80, %2 ]
%28 = load i32, i32* @PF_INET
%29 = load i32, i32* @SOCK_STREAM
%30 = tail call i32 @socket(i32 %28, i32 %29, i32 0)
%31 = icmp eq i32 %30, -1
br i1 %31, label %32, label %36
32: ; preds = %26
%33 = load i32, i32* @stderr
%34 = tail call i32 @fprintf(i32 %33, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 38, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%35 = tail call i32 @exit(i32 0)
unreachable
36: ; preds = %26
%37 = load i32, i32* @SOL_SOCKET
%38 = load i32, i32* @SO_REUSEADDR
%39 = call i32 @setsockopt(i32 %30, i32 %37, i32 %38, i32* %3, i32 4)
%40 = icmp eq i32 %39, -1
br i1 %40, label %41, label %45
41: ; preds = %36
%42 = load i32, i32* @stderr
%43 = call i32 @fprintf(i32 %42, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 42, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
%44 = call i32 @exit(i32 0)
unreachable
45: ; preds = %36
%46 = call i32 @memset(%struct.sockaddr_in* %4, i8 signext 0, i32 24)
%47 = load i32, i32* @AF_INET
%48 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 2
store i32 %47, i32* %48
%49 = call i32 @htons(i32 %27)
%50 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 0
store i32 %49, i32* %50
%51 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 1, i32 0
store i64 0, i64* %51
%52 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%53 = call i32 @bind(i32 %30, %struct.sockaddr* %52, i32 4)
%54 = icmp eq i32 %53, -1
br i1 %54, label %55, label %59
55: ; preds = %45
%56 = load i32, i32* @stderr
%57 = call i32 @fprintf(i32 %56, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 51, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%58 = call i32 @exit(i32 0)
unreachable
59: ; preds = %45
%60 = call i32 @listen(i32 %30, i32 1000)
%61 = icmp eq i32 %60, -1
br i1 %61, label %62, label %66
62: ; preds = %59
%63 = load i32, i32* @stderr
%64 = call i32 @fprintf(i32 %63, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 54, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
%65 = call i32 @exit(i32 0)
unreachable
66: ; preds = %59
%67 = load i32, i32* @SIGCHLD
%68 = load i32, i32* @SIG_IGN
%69 = call i32 @signal(i32 %67, i32 %68)
%70 = load i32, i32* @SIGPIPE
%71 = load i32, i32* @SIG_IGN
%72 = call i32 @signal(i32 %70, i32 %71)
%73 = call i32 @chroot(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
%74 = call i32 @chdir(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%75 = bitcast [2 x i32]* %6 to i8*
%76 = load i32, i32* @AF_UNIX
%77 = load i32, i32* @SOCK_STREAM
%78 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%79 = call i64 @socketpair(i32 %76, i32 %77, i32 0, i32* %78)
%80 = icmp eq i64 %79, 0
br i1 %80, label %85, label %81
81: ; preds = %66
%82 = load i32, i32* @stderr
%83 = call i32 @fprintf(i32 %82, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 74, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
%84 = call i32 @exit(i32 0)
unreachable
85: ; preds = %66
%86 = call i32 (...) @fork()
%87 = icmp eq i32 %86, 0
br i1 %87, label %88, label %109
88: ; preds = %85
%89 = call i32 @setresgid(i32 1100, i32 1100, i32 1100)
%90 = call i32 @setresuid(i32 1100, i32 1100, i32 1100)
%91 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%92 = load i32, i32* %91
%93 = call i32 @close(i32 %92)
%94 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%95 = load i32, i32* %78
%96 = call i32 @sprintf(i8* %94, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32 %95)
%97 = bitcast [3 x i8*]* %8 to i8*
%98 = getelementptr inbounds [3 x i8*], [3 x i8*]* %8, i64 0, i64 0
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), i8** %98
%99 = getelementptr inbounds [3 x i8*], [3 x i8*]* %8, i64 0, i64 1
store i8* %94, i8** %99
%100 = getelementptr inbounds [3 x i8*], [3 x i8*]* %8, i64 0, i64 2
store i8* null, i8** %100
%101 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.11, i64 0, i64 0), i8* %94)
%102 = call i32 @execv(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), i8** %98)
%103 = icmp eq i32 %102, -1
br i1 %103, label %104, label %108
104: ; preds = %88
%105 = load i32, i32* @stderr
%106 = call i32 @fprintf(i32 %105, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 97, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0))
%107 = call i32 @exit(i32 0)
unreachable
108: ; preds = %88
br label %109
109: ; preds = %108, %85
%110 = call i32 @sleep(i32 1)
%111 = load i32, i32* %78
%112 = call i32 @close(i32 %111)
%113 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str, i64 0, i64 0))
%114 = bitcast [2 x i32]* %9 to i8*
%115 = load i32, i32* @AF_UNIX
%116 = load i32, i32* @SOCK_STREAM
%117 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
%118 = call i64 @socketpair(i32 %115, i32 %116, i32 0, i32* %117)
%119 = icmp eq i64 %118, 0
br i1 %119, label %124, label %120
120: ; preds = %109
%121 = load i32, i32* @stderr
%122 = call i32 @fprintf(i32 %121, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 107, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
%123 = call i32 @exit(i32 0)
unreachable
124: ; preds = %109
%125 = call i32 (...) @fork()
%126 = icmp eq i32 %125, 0
br i1 %126, label %127, label %148
127: ; preds = %124
%128 = call i32 @setresgid(i32 1200, i32 1200, i32 1200)
%129 = call i32 @setresuid(i32 1200, i32 1200, i32 1200)
%130 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 1
%131 = load i32, i32* %130
%132 = call i32 @close(i32 %131)
%133 = getelementptr inbounds [32 x i8], [32 x i8]* %10, i64 0, i64 0
%134 = load i32, i32* %117
%135 = call i32 @sprintf(i8* %133, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32 %134)
%136 = bitcast [3 x i8*]* %11 to i8*
%137 = getelementptr inbounds [3 x i8*], [3 x i8*]* %11, i64 0, i64 0
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.14, i64 0, i64 0), i8** %137
%138 = getelementptr inbounds [3 x i8*], [3 x i8*]* %11, i64 0, i64 1
store i8* %133, i8** %138
%139 = getelementptr inbounds [3 x i8*], [3 x i8*]* %11, i64 0, i64 2
store i8* null, i8** %139
%140 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.15, i64 0, i64 0), i8* %133)
%141 = call i32 @execv(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.14, i64 0, i64 0), i8** %137)
%142 = icmp eq i32 %141, -1
br i1 %142, label %143, label %147
143: ; preds = %127
%144 = load i32, i32* @stderr
%145 = call i32 @fprintf(i32 %144, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 125, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0))
%146 = call i32 @exit(i32 0)
unreachable
147: ; preds = %127
br label %148
148: ; preds = %147, %124
%149 = call i32 @sleep(i32 1)
%150 = load i32, i32* %117
%151 = call i32 @close(i32 %150)
%152 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.28, i64 0, i64 0))
%153 = bitcast [2 x i32]* %12 to i8*
%154 = load i32, i32* @AF_UNIX
%155 = load i32, i32* @SOCK_STREAM
%156 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 0
%157 = call i64 @socketpair(i32 %154, i32 %155, i32 0, i32* %156)
%158 = icmp eq i64 %157, 0
br i1 %158, label %163, label %159
159: ; preds = %148
%160 = load i32, i32* @stderr
%161 = call i32 @fprintf(i32 %160, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 135, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
%162 = call i32 @exit(i32 0)
unreachable
163: ; preds = %148
%164 = call i32 (...) @fork()
%165 = icmp eq i32 %164, 0
br i1 %165, label %166, label %187
166: ; preds = %163
%167 = call i32 @setresgid(i32 1300, i32 1300, i32 1300)
%168 = call i32 @setresuid(i32 1300, i32 1300, i32 1300)
%169 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 1
%170 = load i32, i32* %169
%171 = call i32 @close(i32 %170)
%172 = getelementptr inbounds [32 x i8], [32 x i8]* %13, i64 0, i64 0
%173 = load i32, i32* %156
%174 = call i32 @sprintf(i8* %172, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32 %173)
%175 = bitcast [3 x i8*]* %14 to i8*
%176 = getelementptr inbounds [3 x i8*], [3 x i8*]* %14, i64 0, i64 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i64 0, i64 0), i8** %176
%177 = getelementptr inbounds [3 x i8*], [3 x i8*]* %14, i64 0, i64 1
store i8* %172, i8** %177
%178 = getelementptr inbounds [3 x i8*], [3 x i8*]* %14, i64 0, i64 2
store i8* null, i8** %178
%179 = call i32 @puts(i8* %172)
%180 = call i32 @execv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i64 0, i64 0), i8** %176)
%181 = icmp eq i32 %180, -1
br i1 %181, label %182, label %186
182: ; preds = %166
%183 = load i32, i32* @stderr
%184 = call i32 @fprintf(i32 %183, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 153, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0))
%185 = call i32 @exit(i32 0)
unreachable
186: ; preds = %166
br label %187
187: ; preds = %186, %163
%188 = call i32 @sleep(i32 1)
%189 = load i32, i32* %156
%190 = call i32 @close(i32 %189)
%191 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.29, i64 0, i64 0))
%192 = getelementptr inbounds [32 x i8], [32 x i8]* %15, i64 0, i64 0
%193 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%194 = load i32, i32* %193
%195 = call i32 @sprintf(i8* %192, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32 %194)
%196 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 1
%197 = load i32, i32* %196
%198 = call i64 @strlen(i8* %192)
%199 = add nsw i64 %198, 1
%200 = load i32, i32* %193
%201 = call i32 @sendfd(i32 %197, i8* %192, i64 %199, i32 %200)
%202 = icmp eq i32 %201, -1
br i1 %202, label %203, label %207
203: ; preds = %187
%204 = load i32, i32* @stderr
%205 = call i32 @fprintf(i32 %204, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 164, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.20, i64 0, i64 0))
%206 = call i32 @exit(i32 0)
unreachable
207: ; preds = %187
%208 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.21, i64 0, i64 0), i8* %192)
%209 = getelementptr inbounds [32 x i8], [32 x i8]* %16, i64 0, i64 0
%210 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 1
%211 = load i32, i32* %210
%212 = call i32 @sprintf(i8* %209, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i32 %211)
%213 = load i32, i32* %196
%214 = call i64 @strlen(i8* %209)
%215 = add nsw i64 %214, 1
%216 = load i32, i32* %210
%217 = call i32 @sendfd(i32 %213, i8* %209, i64 %215, i32 %216)
%218 = icmp eq i32 %217, -1
br i1 %218, label %219, label %223
219: ; preds = %207
%220 = load i32, i32* @stderr
%221 = call i32 @fprintf(i32 %220, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 170, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.20, i64 0, i64 0))
%222 = call i32 @exit(i32 0)
unreachable
223: ; preds = %207
%224 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.21, i64 0, i64 0), i8* %209)
%225 = load i32, i32* %193
%226 = call i32 @close(i32 %225)
%227 = load i32, i32* %210
%228 = call i32 @close(i32 %227)
%229 = bitcast i32* %17 to i8*
%230 = bitcast %struct.sockaddr_in* %5 to %struct.sockaddr*
%231 = call i32 @accept(i32 %30, %struct.sockaddr* %230, i32* %17)
%232 = icmp eq i32 %231, -1
br i1 %232, label %236, label %233
233: ; preds = %223
%234 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 1, i32 0
%235 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 0
br label %240
236: ; preds = %256, %223
%237 = load i32, i32* @stderr
%238 = call i32 @fprintf(i32 %237, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 182, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.22, i64 0, i64 0))
%239 = call i32 @exit(i32 0)
unreachable
240: ; preds = %233, %256
%241 = phi i32 [ %231, %233 ], [ %258, %256 ]
%242 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.23, i64 0, i64 0), i32 %241)
%243 = load i64, i64* %234
%244 = call i8* @inet_ntoa(i64 %243)
%245 = load i32, i32* %235
%246 = call i32 @ntohs(i32 %245)
%247 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.24, i64 0, i64 0), i8* %244, i32 %246)
%248 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.30, i64 0, i64 0))
%249 = load i32, i32* %196
%250 = call i32 @sendfd(i32 %249, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.25, i64 0, i64 0), i64 14, i32 %241)
%251 = icmp eq i32 %250, -1
br i1 %251, label %252, label %256
252: ; preds = %240
%253 = load i32, i32* @stderr
%254 = call i32 @fprintf(i32 %253, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([141 x i8], [141 x i8]* @.str.1, i64 0, i64 0), i32 197, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.27, i64 0, i64 0))
%255 = call i32 @exit(i32 0)
unreachable
256: ; preds = %240
%257 = call i32 @close(i32 %241)
%258 = call i32 @accept(i32 %30, %struct.sockaddr* %230, i32* %17)
%259 = icmp eq i32 %258, -1
br i1 %259, label %236, label %240
}