#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ tmo;
typedef int pid_t;
typedef int /*<<< orphan*/ pid_file;
typedef scalar_t__ int32_t;
typedef scalar_t__ in_port_t;
typedef int /*<<< orphan*/ environment;
typedef int /*<<< orphan*/ engine;
typedef int /*<<< orphan*/ buffer;
typedef int /*<<< orphan*/ blackhole;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ F_OK;
int access(char *, int /*<<< orphan*/);
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ errno;
int execv(char *, char **);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int getcwd(char *, int);
scalar_t__ getpid();
scalar_t__ getuid();
int /*<<< orphan*/ putenv(char *);
scalar_t__ remove(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcat(char *, char *);
char *strerror(int /*<<< orphan*/);
int strlen(char *);
scalar_t__ strncmp(char *, char *, int);
scalar_t__ strtol(char *, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ usleep(int);
pid_t start_server(in_port_t *port_out, bool daemon, int timeout) {
  char environment[80];
  snprintf(environment, sizeof(environment),
           "MEMCACHED_PORT_FILENAME=/tmp/ports.%lu", (long)getpid());
  char *filename = environment + strlen("MEMCACHED_PORT_FILENAME=");
  char pid_file[80];
  snprintf(pid_file, sizeof(pid_file), "/tmp/pid.%lu", (long)getpid());
  remove(filename);
  remove(pid_file);
  char engine[1024];
  assert(getcwd(engine, sizeof(engine)));
  strcat(engine, "/.libs/default_engine.so");
  assert(strlen(engine) < sizeof(engine));
  char blackhole[1024];
  assert(getcwd(blackhole, sizeof(blackhole)));
  strcat(blackhole, "/.libs/blackhole_logger.so");
  pid_t pid = fork();
  assert(pid != -1);
  if (pid == 0) {
    char *argv[20];
    int arg = 0;
    char tmo[24];
    snprintf(tmo, sizeof(tmo), "%u", timeout);
    putenv(environment);
    argv[arg++] = "/usr/local/bin/memcached";
    argv[arg++] = "-p";
    argv[arg++] = "-1";
    argv[arg++] = "-U";
    argv[arg++] = "0";
    if (getuid() == 0) {
      argv[arg++] = "-u";
      argv[arg++] = "root";
    }
    if (daemon) {
      argv[arg++] = "-d";
      argv[arg++] = "-P";
      argv[arg++] = pid_file;
    }
    argv[arg++] = NULL;
    assert(execv(argv[0], argv) != -1);
  }
  while (access(filename, F_OK) == -1) {
    usleep(10);
  }
  FILE *fp = fopen(filename, "r");
  if (fp == NULL) {
    fprintf(stderr, "Failed to open the file containing port numbers: %s\n",
            strerror(errno));
    assert(false);
  }
  *port_out = (in_port_t)-1;
  char buffer[80];
  while ((fgets(buffer, sizeof(buffer), fp)) != NULL) {
    if (strncmp(buffer, "TCP INET: ", 10) == 0) {
      int32_t val;
      val = strtol(buffer + 10, NULL, 10);
      *port_out = (in_port_t)val;
    }
  }
  fclose(fp);
  assert(remove(filename) == 0);
  if (daemon) {
    while (access(pid_file, F_OK) == -1) {
      usleep(10);
    }
    fp = fopen(pid_file, "r");
    if (fp == NULL) {
      fprintf(stderr, "Failed to open pid file: %s\n", strerror(errno));
      assert(false);
    }
    assert(fgets(buffer, sizeof(buffer), fp) != NULL);
    fclose(fp);
    int32_t val;
    val = strtol(buffer, NULL, 10);
    pid = (pid_t)val;
  }
  return pid;
}


x86 assembly (clang, -O0):
<start_server>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
lea    -0x60(%rbp),%rax
mov    %rax,-0xa18(%rbp)
mov    $0x0,%al
call   1050 <getpid@plt>
mov    -0xa18(%rbp),%rdi
mov    %eax,%ecx
mov    $0x50,%esi
lea    0xd84(%rip),%rdx
call   1090 <snprintf@plt>
lea    -0x60(%rbp),%rax
mov    %rax,-0xa10(%rbp)
lea    0xd94(%rip),%rdi
call   1070 <strlen@plt>
mov    %eax,%ecx
mov    -0xa10(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x68(%rbp)
lea    -0xc0(%rbp),%rax
mov    %rax,-0xa08(%rbp)
mov    $0x0,%al
call   1050 <getpid@plt>
mov    -0xa08(%rbp),%rdi
mov    %eax,%ecx
mov    $0x50,%esi
lea    0xd6b(%rip),%rdx
call   1090 <snprintf@plt>
mov    -0x68(%rbp),%rdi
call   1030 <remove@plt>
lea    -0xc0(%rbp),%rdi
call   1030 <remove@plt>
lea    -0x4c0(%rbp),%rdi
mov    $0x400,%esi
call   10a0 <getcwd@plt>
mov    %eax,%edi
call   10d0 <assert@plt>
lea    -0x4c0(%rbp),%rdi
lea    0xd38(%rip),%rsi
call   1120 <strcat@plt>
lea    -0x4c0(%rbp),%rdi
call   1070 <strlen@plt>
cltq
cmp    $0x400,%rax
setb   %al
and    $0x1,%al
movzbl %al,%edi
call   10d0 <assert@plt>
lea    -0x8c0(%rbp),%rdi
mov    $0x400,%esi
call   10a0 <getcwd@plt>
mov    %eax,%edi
call   10d0 <assert@plt>
lea    -0x8c0(%rbp),%rdi
lea    0xd05(%rip),%rsi
call   1120 <strcat@plt>
mov    $0x0,%al
call   1150 <fork@plt>
mov    %eax,-0x8c4(%rbp)
cmpl   $0xffffffff,-0x8c4(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   10d0 <assert@plt>
cmpl   $0x0,-0x8c4(%rbp)
jne    1573 <start_server+0x333>
movl   $0x0,-0x974(%rbp)
lea    -0x990(%rbp),%rdi
mov    -0x10(%rbp),%ecx
mov    $0x18,%esi
lea    0xccd(%rip),%rdx
call   1090 <snprintf@plt>
lea    -0x60(%rbp),%rdi
call   10c0 <putenv@plt>
mov    -0x974(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x974(%rbp)
cltq
lea    0xca8(%rip),%rcx
mov    %rcx,-0x970(%rbp,%rax,8)
ff
mov    -0x974(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x974(%rbp)
cltq
lea    0xc9f(%rip),%rcx
mov    %rcx,-0x970(%rbp,%rax,8)
ff
mov    -0x974(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x974(%rbp)
cltq
lea    0xc80(%rip),%rcx
mov    %rcx,-0x970(%rbp,%rax,8)
ff
mov    -0x974(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x974(%rbp)
cltq
lea    0xc61(%rip),%rcx
mov    %rcx,-0x970(%rbp,%rax,8)
ff
mov    -0x974(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x974(%rbp)
cltq
lea    0xc42(%rip),%rcx
mov    %rcx,-0x970(%rbp,%rax,8)
ff
mov    $0x0,%al
call   1080 <getuid@plt>
cmp    $0x0,%rax
jne    14c1 <start_server+0x281>
mov    -0x974(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x974(%rbp)
cltq
lea    0xc11(%rip),%rcx
mov    %rcx,-0x970(%rbp,%rax,8)
ff
mov    -0x974(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x974(%rbp)
cltq
lea    0xbf2(%rip),%rcx
mov    %rcx,-0x970(%rbp,%rax,8)
ff
cmpl   $0x0,-0xc(%rbp)
je     1531 <start_server+0x2f1>
mov    -0x974(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x974(%rbp)
cltq
lea    0xbcb(%rip),%rcx
mov    %rcx,-0x970(%rbp,%rax,8)
ff
mov    -0x974(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x974(%rbp)
cltq
lea    0xbac(%rip),%rcx
mov    %rcx,-0x970(%rbp,%rax,8)
ff
lea    -0xc0(%rbp),%rcx
mov    -0x974(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x974(%rbp)
cltq
mov    %rcx,-0x970(%rbp,%rax,8)
ff
mov    -0x974(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x974(%rbp)
cltq
movq   $0x0,-0x970(%rbp,%rax,8)
mov    -0x970(%rbp),%rdi
lea    -0x970(%rbp),%rsi
call   1140 <execv@plt>
cmp    $0xffffffff,%eax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   10d0 <assert@plt>
jmp    1578 <start_server+0x338>
mov    -0x68(%rbp),%rdi
mov    0x2a45(%rip),%rax
mov    (%rax),%esi
call   1100 <access@plt>
cmp    $0xffffffff,%eax
jne    15a2 <start_server+0x362>
mov    $0xa,%edi
call   1160 <usleep@plt>
jmp    1578 <start_server+0x338>
mov    -0x68(%rbp),%rdi
lea    0xb09(%rip),%rsi
call   1110 <fopen@plt>
mov    %rax,-0x998(%rbp)
cmpq   $0x0,-0x998(%rbp)
jne    1600 <start_server+0x3c0>
mov    0x2a12(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xa1c(%rbp)
mov    0x29fb(%rip),%rax
mov    (%rax),%edi
call   1130 <strerror@plt>
mov    -0xa1c(%rbp),%edi
mov    %rax,%rdx
lea    0xac4(%rip),%rsi
call   10e0 <fprintf@plt>
xor    %edi,%edi
call   10d0 <assert@plt>
mov    -0x8(%rbp),%rax
movq   $0xffffffffffffffff,(%rax)
lea    -0x9f0(%rbp),%rdi
mov    -0x998(%rbp),%rdx
mov    $0x50,%esi
call   10b0 <fgets@plt>
cmp    $0x0,%rax
je     1682 <start_server+0x442>
lea    -0x9f0(%rbp),%rdi
lea    0xab2(%rip),%rsi
mov    $0xa,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    167d <start_server+0x43d>
lea    -0x9f0(%rbp),%rdi
add    $0xa,%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   10f0 <strtol@plt>
mov    %rax,-0x9f8(%rbp)
mov    -0x9f8(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
jmp    160b <start_server+0x3cb>
mov    -0x998(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x68(%rbp),%rdi
call   1030 <remove@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   10d0 <assert@plt>
cmpl   $0x0,-0xc(%rbp)
je     17a3 <start_server+0x563>
jmp    16b7 <start_server+0x477>
lea    -0xc0(%rbp),%rdi
mov    0x2903(%rip),%rax
mov    (%rax),%esi
call   1100 <access@plt>
cmp    $0xffffffff,%eax
jne    16e4 <start_server+0x4a4>
mov    $0xa,%edi
call   1160 <usleep@plt>
jmp    16b7 <start_server+0x477>
lea    -0xc0(%rbp),%rdi
lea    0x9c4(%rip),%rsi
call   1110 <fopen@plt>
mov    %rax,-0x998(%rbp)
cmpq   $0x0,-0x998(%rbp)
jne    1745 <start_server+0x505>
mov    0x28cd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xa20(%rbp)
mov    0x28b6(%rip),%rax
mov    (%rax),%edi
call   1130 <strerror@plt>
mov    -0xa20(%rbp),%edi
mov    %rax,%rdx
lea    0x9bf(%rip),%rsi
call   10e0 <fprintf@plt>
xor    %edi,%edi
call   10d0 <assert@plt>
lea    -0x9f0(%rbp),%rdi
mov    -0x998(%rbp),%rdx
mov    $0x50,%esi
call   10b0 <fgets@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   10d0 <assert@plt>
mov    -0x998(%rbp),%rdi
call   1060 <fclose@plt>
lea    -0x9f0(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   10f0 <strtol@plt>
mov    %rax,-0xa00(%rbp)
mov    -0xa00(%rbp),%rax
mov    %eax,-0x8c4(%rbp)
mov    -0x8c4(%rbp),%eax
add    $0xa20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<start_server>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x988,%rsp
mov    %edx,%r14d
mov    %esi,%ebx
mov    %rdi,0x10(%rsp)
xor    %eax,%eax
call   1050 <getpid@plt>
lea    0xd97(%rip),%rdx
lea    0x130(%rsp),%rdi
mov    $0x50,%esi
mov    %eax,%ecx
call   1090 <snprintf@plt>
lea    0xda3(%rip),%rdi
call   1070 <strlen@plt>
cltq
lea    (%rsp,%rax,1),%r13
add    $0x130,%r13
xor    %eax,%eax
call   1050 <getpid@plt>
lea    0xd9c(%rip),%rdx
lea    0xc0(%rsp),%r12
mov    %r12,%rdi
mov    $0x50,%esi
mov    %eax,%ecx
call   1090 <snprintf@plt>
mov    %r13,%rdi
call   1030 <remove@plt>
mov    %r12,%rdi
call   1030 <remove@plt>
lea    0x580(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x400,%esi
call   10a0 <getcwd@plt>
mov    %eax,%edi
call   10d0 <assert@plt>
lea    0xd5f(%rip),%rsi
mov    %rbp,%rdi
call   1120 <strcat@plt>
mov    %rbp,%rdi
call   1070 <strlen@plt>
xor    %edi,%edi
cmp    $0x400,%eax
setb   %dil
call   10d0 <assert@plt>
lea    0x180(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x400,%esi
call   10a0 <getcwd@plt>
mov    %eax,%edi
call   10d0 <assert@plt>
lea    0xd35(%rip),%rsi
mov    %rbp,%rdi
call   1120 <strcat@plt>
xor    %eax,%eax
call   1150 <fork@plt>
mov    %eax,%ebp
xor    %edi,%edi
cmp    $0xffffffff,%eax
setne  %dil
call   10d0 <assert@plt>
mov    %rbp,0x18(%rsp)
test   %ebp,%ebp
jne    143e <start_server+0x1fe>
lea    0xd1d(%rip),%rdx
lea    0x110(%rsp),%rdi
mov    $0x18,%esi
mov    %r14d,%ecx
call   1090 <snprintf@plt>
lea    0x130(%rsp),%rdi
call   10c0 <putenv@plt>
lea    0xcf7(%rip),%rax
mov    %rax,0x20(%rsp)
lea    0xd04(%rip),%rax
mov    %rax,0x28(%rsp)
lea    0xcfb(%rip),%rax
mov    %rax,0x30(%rsp)
lea    0xcf2(%rip),%rax
mov    %rax,0x38(%rsp)
lea    0xce9(%rip),%rax
mov    %rax,0x40(%rsp)
xor    %eax,%eax
call   1080 <getuid@plt>
mov    $0x5,%ecx
test   %rax,%rax
jne    13f0 <start_server+0x1b0>
lea    0xcce(%rip),%rax
mov    %rax,0x48(%rsp)
lea    0xcc5(%rip),%rax
mov    %rax,0x50(%rsp)
mov    $0x7,%ecx
test   %ebx,%ebx
je     1416 <start_server+0x1d6>
mov    %ecx,%eax
lea    0xcb3(%rip),%rdx
mov    %rdx,0x20(%rsp,%rax,8)
lea    0xcaa(%rip),%rdx
mov    %rdx,0x28(%rsp,%rax,8)
add    $0x3,%ecx
mov    %r12,0x30(%rsp,%rax,8)
mov    %ecx,%eax
movq   $0x0,0x20(%rsp,%rax,8)
mov    0x20(%rsp),%rdi
lea    0x20(%rsp),%rsi
call   1140 <execv@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
setne  %dil
call   10d0 <assert@plt>
mov    %ebx,0xc(%rsp)
mov    0x2b7f(%rip),%r14
nopl   0x0(%rax)
mov    (%r14),%esi
mov    %r13,%rdi
call   1100 <access@plt>
cmp    $0xffffffff,%eax
jne    146c <start_server+0x22c>
mov    $0xa,%edi
call   1160 <usleep@plt>
jmp    1450 <start_server+0x210>
lea    0xc43(%rip),%rsi
mov    %r13,%rdi
call   1110 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    14b2 <start_server+0x272>
mov    0x2b56(%rip),%rax
mov    (%rax),%ebp
mov    0x2b45(%rip),%rax
mov    (%rax),%edi
call   1130 <strerror@plt>
lea    0xc17(%rip),%rsi
mov    %ebp,%edi
mov    %rax,%rdx
call   10e0 <fprintf@plt>
xor    %edi,%edi
call   10d0 <assert@plt>
mov    0x10(%rsp),%rax
movq   $0xffffffffffffffff,(%rax)
lea    0x20(%rsp),%rdi
mov    $0x50,%esi
mov    %rbx,%rdx
call   10b0 <fgets@plt>
test   %rax,%rax
je     1533 <start_server+0x2f3>
lea    0x2a(%rsp),%r12
lea    0xc0c(%rip),%rbp
lea    0x20(%rsp),%r15
jmp    1505 <start_server+0x2c5>
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    $0x50,%esi
mov    %rbx,%rdx
call   10b0 <fgets@plt>
test   %rax,%rax
je     1533 <start_server+0x2f3>
mov    %r15,%rdi
mov    %rbp,%rsi
mov    $0xa,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
jne    14f0 <start_server+0x2b0>
mov    %r12,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   10f0 <strtol@plt>
mov    0x10(%rsp),%rcx
mov    %rax,(%rcx)
jmp    14f0 <start_server+0x2b0>
mov    %rbx,%rdi
call   1060 <fclose@plt>
mov    %r13,%rdi
call   1030 <remove@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   10d0 <assert@plt>
cmpl   $0x0,0xc(%rsp)
je     1621 <start_server+0x3e1>
mov    (%r14),%esi
lea    0xc0(%rsp),%rdi
call   1100 <access@plt>
cmp    $0xffffffff,%eax
jne    159a <start_server+0x35a>
lea    0xc0(%rsp),%rbx
nopl   0x0(%rax)
mov    $0xa,%edi
call   1160 <usleep@plt>
mov    (%r14),%esi
mov    %rbx,%rdi
call   1100 <access@plt>
cmp    $0xffffffff,%eax
je     1580 <start_server+0x340>
lea    0xb15(%rip),%rsi
lea    0xc0(%rsp),%rdi
call   1110 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    15e5 <start_server+0x3a5>
mov    0x2a23(%rip),%rax
mov    (%rax),%ebp
mov    0x2a12(%rip),%rax
mov    (%rax),%edi
call   1130 <strerror@plt>
lea    0xb24(%rip),%rsi
mov    %ebp,%edi
mov    %rax,%rdx
call   10e0 <fprintf@plt>
xor    %edi,%edi
call   10d0 <assert@plt>
lea    0x20(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x50,%esi
mov    %rbx,%rdx
call   10b0 <fgets@plt>
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   10d0 <assert@plt>
mov    %rbx,%rdi
call   1060 <fclose@plt>
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   10f0 <strtol@plt>
jmp    1626 <start_server+0x3e6>
mov    0x18(%rsp),%rax
add    $0x988,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [39 x i8] c"MEMCACHED_PORT_FILENAME=/tmp/ports.%lu\00"
@.str.1 = [25 x i8] c"MEMCACHED_PORT_FILENAME=\00"
@.str.2 = [13 x i8] c"/tmp/pid.%lu\00"
@.str.3 = [25 x i8] c"/.libs/default_engine.so\00"
@.str.4 = [27 x i8] c"/.libs/blackhole_logger.so\00"
@.str.5 = [3 x i8] c"%u\00"
@.str.6 = [25 x i8] c"/usr/local/bin/memcached\00"
@.str.7 = [3 x i8] c"-p\00"
@.str.8 = [3 x i8] c"-1\00"
@.str.9 = [3 x i8] c"-U\00"
@.str.10 = [2 x i8] c"0\00"
@.str.11 = [3 x i8] c"-u\00"
@.str.12 = [5 x i8] c"root\00"
@.str.13 = [3 x i8] c"-d\00"
@.str.14 = [3 x i8] c"-P\00"
@F_OK = global i32 0
@.str.15 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.16 = [53 x i8] c"Failed to open the file containing port numbers: %s\0A\00"
@errno = global i32 0
@.str.17 = [11 x i8] c"TCP INET: \00"
@.str.18 = [29 x i8] c"Failed to open pid file: %s\0A\00"
define i32 @start_server(i64* %0, i32 %1, i32 %2) {
%4 = alloca i64*
%5 = alloca i32
%6 = alloca i32
%7 = alloca [80 x i8]
%8 = alloca i8*
%9 = alloca [80 x i8]
%10 = alloca [1024 x i8]
%11 = alloca [1024 x i8]
%12 = alloca i32
%13 = alloca [20 x i8*]
%14 = alloca i32
%15 = alloca [24 x i8]
%16 = alloca i32*
%17 = alloca [80 x i8]
%18 = alloca i64
%19 = alloca i64
store i64* %0, i64** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%20 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%21 = call i64 (...) @getpid()
%22 = trunc i64 %21 to i32
%23 = call i32 @snprintf(i8* %20, i32 80, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %22)
%24 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%25 = call i32 @strlen(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %24, i64 %26
store i8* %27, i8** %8
%28 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%29 = call i64 (...) @getpid()
%30 = trunc i64 %29 to i32
%31 = call i32 @snprintf(i8* %28, i32 80, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %30)
%32 = load i8*, i8** %8
%33 = call i64 @remove(i8* %32)
%34 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%35 = call i64 @remove(i8* %34)
%36 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%37 = call i32 @getcwd(i8* %36, i32 1024)
%38 = call i32 @assert(i32 %37)
%39 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%40 = call i32 @strcat(i8* %39, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
%41 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%42 = call i32 @strlen(i8* %41)
%43 = sext i32 %42 to i64
%44 = icmp ult i64 %43, 1024
%45 = zext i1 %44 to i32
%46 = call i32 @assert(i32 %45)
%47 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%48 = call i32 @getcwd(i8* %47, i32 1024)
%49 = call i32 @assert(i32 %48)
%50 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%51 = call i32 @strcat(i8* %50, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%52 = call i32 (...) @fork()
store i32 %52, i32* %12
%53 = load i32, i32* %12
%54 = icmp ne i32 %53, -1
%55 = zext i1 %54 to i32
%56 = call i32 @assert(i32 %55)
%57 = load i32, i32* %12
%58 = icmp eq i32 %57, 0
br i1 %58, label %59, label %125
59: ; preds = %3
store i32 0, i32* %14
%60 = getelementptr inbounds [24 x i8], [24 x i8]* %15, i64 0, i64 0
%61 = load i32, i32* %6
%62 = call i32 @snprintf(i8* %60, i32 24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 %61)
%63 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%64 = call i32 @putenv(i8* %63)
%65 = load i32, i32* %14
%66 = add nsw i32 %65, 1
store i32 %66, i32* %14
%67 = sext i32 %65 to i64
%68 = getelementptr inbounds [20 x i8*], [20 x i8*]* %13, i64 0, i64 %67
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), i8** %68
%69 = load i32, i32* %14
%70 = add nsw i32 %69, 1
store i32 %70, i32* %14
%71 = sext i32 %69 to i64
%72 = getelementptr inbounds [20 x i8*], [20 x i8*]* %13, i64 0, i64 %71
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8** %72
%73 = load i32, i32* %14
%74 = add nsw i32 %73, 1
store i32 %74, i32* %14
%75 = sext i32 %73 to i64
%76 = getelementptr inbounds [20 x i8*], [20 x i8*]* %13, i64 0, i64 %75
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8** %76
%77 = load i32, i32* %14
%78 = add nsw i32 %77, 1
store i32 %78, i32* %14
%79 = sext i32 %77 to i64
%80 = getelementptr inbounds [20 x i8*], [20 x i8*]* %13, i64 0, i64 %79
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8** %80
%81 = load i32, i32* %14
%82 = add nsw i32 %81, 1
store i32 %82, i32* %14
%83 = sext i32 %81 to i64
%84 = getelementptr inbounds [20 x i8*], [20 x i8*]* %13, i64 0, i64 %83
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0), i8** %84
%85 = call i64 (...) @getuid()
%86 = icmp eq i64 %85, 0
br i1 %86, label %87, label %96
87: ; preds = %59
%88 = load i32, i32* %14
%89 = add nsw i32 %88, 1
store i32 %89, i32* %14
%90 = sext i32 %88 to i64
%91 = getelementptr inbounds [20 x i8*], [20 x i8*]* %13, i64 0, i64 %90
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i8** %91
%92 = load i32, i32* %14
%93 = add nsw i32 %92, 1
store i32 %93, i32* %14
%94 = sext i32 %92 to i64
%95 = getelementptr inbounds [20 x i8*], [20 x i8*]* %13, i64 0, i64 %94
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0), i8** %95
br label %96
96: ; preds = %87, %59
%97 = load i32, i32* %5
%98 = icmp ne i32 %97, 0
br i1 %98, label %99, label %113
99: ; preds = %96
%100 = load i32, i32* %14
%101 = add nsw i32 %100, 1
store i32 %101, i32* %14
%102 = sext i32 %100 to i64
%103 = getelementptr inbounds [20 x i8*], [20 x i8*]* %13, i64 0, i64 %102
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i8** %103
%104 = load i32, i32* %14
%105 = add nsw i32 %104, 1
store i32 %105, i32* %14
%106 = sext i32 %104 to i64
%107 = getelementptr inbounds [20 x i8*], [20 x i8*]* %13, i64 0, i64 %106
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i64 0, i64 0), i8** %107
%108 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%109 = load i32, i32* %14
%110 = add nsw i32 %109, 1
store i32 %110, i32* %14
%111 = sext i32 %109 to i64
%112 = getelementptr inbounds [20 x i8*], [20 x i8*]* %13, i64 0, i64 %111
store i8* %108, i8** %112
br label %113
113: ; preds = %99, %96
%114 = load i32, i32* %14
%115 = add nsw i32 %114, 1
store i32 %115, i32* %14
%116 = sext i32 %114 to i64
%117 = getelementptr inbounds [20 x i8*], [20 x i8*]* %13, i64 0, i64 %116
store i8* null, i8** %117
%118 = getelementptr inbounds [20 x i8*], [20 x i8*]* %13, i64 0, i64 0
%119 = load i8*, i8** %118
%120 = getelementptr inbounds [20 x i8*], [20 x i8*]* %13, i64 0, i64 0
%121 = call i32 @execv(i8* %119, i8** %120)
%122 = icmp ne i32 %121, -1
%123 = zext i1 %122 to i32
%124 = call i32 @assert(i32 %123)
br label %125
125: ; preds = %113, %3
br label %126
126: ; preds = %131, %125
%127 = load i8*, i8** %8
%128 = load i32, i32* @F_OK
%129 = call i32 @access(i8* %127, i32 %128)
%130 = icmp eq i32 %129, -1
br i1 %130, label %131, label %133
131: ; preds = %126
%132 = call i32 @usleep(i32 10)
br label %126
133: ; preds = %126
%134 = load i8*, i8** %8
%135 = call i32* @fopen(i8* %134, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0))
store i32* %135, i32** %16
%136 = load i32*, i32** %16
%137 = icmp eq i32* %136, null
br i1 %137, label %138, label %144
138: ; preds = %133
%139 = load i32, i32* @stderr
%140 = load i32, i32* @errno
%141 = call i8* @strerror(i32 %140)
%142 = call i32 @fprintf(i32 %139, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.16, i64 0, i64 0), i8* %141)
%143 = call i32 @assert(i32 0)
br label %144
144: ; preds = %138, %133
%145 = load i64*, i64** %4
store i64 -1, i64* %145
br label %146
146: ; preds = %161, %144
%147 = getelementptr inbounds [80 x i8], [80 x i8]* %17, i64 0, i64 0
%148 = load i32*, i32** %16
%149 = call i32* @fgets(i8* %147, i32 80, i32* %148)
%150 = icmp ne i32* %149, null
br i1 %150, label %151, label %162
151: ; preds = %146
%152 = getelementptr inbounds [80 x i8], [80 x i8]* %17, i64 0, i64 0
%153 = call i64 @strncmp(i8* %152, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.17, i64 0, i64 0), i32 10)
%154 = icmp eq i64 %153, 0
br i1 %154, label %155, label %161
155: ; preds = %151
%156 = getelementptr inbounds [80 x i8], [80 x i8]* %17, i64 0, i64 0
%157 = getelementptr inbounds i8, i8* %156, i64 10
%158 = call i64 @strtol(i8* %157, i32* null, i32 10)
store i64 %158, i64* %18
%159 = load i64, i64* %18
%160 = load i64*, i64** %4
store i64 %159, i64* %160
br label %161
161: ; preds = %155, %151
br label %146
162: ; preds = %146
%163 = load i32*, i32** %16
%164 = call i32 @fclose(i32* %163)
%165 = load i8*, i8** %8
%166 = call i64 @remove(i8* %165)
%167 = icmp eq i64 %166, 0
%168 = zext i1 %167 to i32
%169 = call i32 @assert(i32 %168)
%170 = load i32, i32* %5
%171 = icmp ne i32 %170, 0
br i1 %171, label %172, label %204
172: ; preds = %162
br label %173
173: ; preds = %178, %172
%174 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%175 = load i32, i32* @F_OK
%176 = call i32 @access(i8* %174, i32 %175)
%177 = icmp eq i32 %176, -1
br i1 %177, label %178, label %180
178: ; preds = %173
%179 = call i32 @usleep(i32 10)
br label %173
180: ; preds = %173
%181 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%182 = call i32* @fopen(i8* %181, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0))
store i32* %182, i32** %16
%183 = load i32*, i32** %16
%184 = icmp eq i32* %183, null
br i1 %184, label %185, label %191
185: ; preds = %180
%186 = load i32, i32* @stderr
%187 = load i32, i32* @errno
%188 = call i8* @strerror(i32 %187)
%189 = call i32 @fprintf(i32 %186, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.18, i64 0, i64 0), i8* %188)
%190 = call i32 @assert(i32 0)
br label %191
191: ; preds = %185, %180
%192 = getelementptr inbounds [80 x i8], [80 x i8]* %17, i64 0, i64 0
%193 = load i32*, i32** %16
%194 = call i32* @fgets(i8* %192, i32 80, i32* %193)
%195 = icmp ne i32* %194, null
%196 = zext i1 %195 to i32
%197 = call i32 @assert(i32 %196)
%198 = load i32*, i32** %16
%199 = call i32 @fclose(i32* %198)
%200 = getelementptr inbounds [80 x i8], [80 x i8]* %17, i64 0, i64 0
%201 = call i64 @strtol(i8* %200, i32* null, i32 10)
store i64 %201, i64* %19
%202 = load i64, i64* %19
%203 = trunc i64 %202 to i32
store i32 %203, i32* %12
br label %204
204: ; preds = %191, %162
%205 = load i32, i32* %12
ret i32 %205
}

LLVM IR (-O2):
@.str = [39 x i8] c"MEMCACHED_PORT_FILENAME=/tmp/ports.%lu\00"
@.str.1 = [25 x i8] c"MEMCACHED_PORT_FILENAME=\00"
@.str.2 = [13 x i8] c"/tmp/pid.%lu\00"
@.str.3 = [25 x i8] c"/.libs/default_engine.so\00"
@.str.4 = [27 x i8] c"/.libs/blackhole_logger.so\00"
@.str.5 = [3 x i8] c"%u\00"
@.str.6 = [25 x i8] c"/usr/local/bin/memcached\00"
@.str.7 = [3 x i8] c"-p\00"
@.str.8 = [3 x i8] c"-1\00"
@.str.9 = [3 x i8] c"-U\00"
@.str.10 = [2 x i8] c"0\00"
@.str.11 = [3 x i8] c"-u\00"
@.str.12 = [5 x i8] c"root\00"
@.str.13 = [3 x i8] c"-d\00"
@.str.14 = [3 x i8] c"-P\00"
@F_OK = global i32 0
@.str.15 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.16 = [53 x i8] c"Failed to open the file containing port numbers: %s\0A\00"
@errno = global i32 0
@.str.17 = [11 x i8] c"TCP INET: \00"
@.str.18 = [29 x i8] c"Failed to open pid file: %s\0A\00"
define i32 @start_server(i64* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = alloca [80 x i8]
%5 = alloca [80 x i8]
%6 = alloca [1024 x i8]
%7 = alloca [1024 x i8]
%8 = alloca [20 x i8*]
%9 = alloca [24 x i8]
%10 = alloca [80 x i8]
%11 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%12 = tail call i64 (...) @getpid()
%13 = trunc i64 %12 to i32
%14 = call i32 @snprintf(i8* %11, i32 80, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = call i32 @strlen(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 %16
%18 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%19 = call i64 (...) @getpid()
%20 = trunc i64 %19 to i32
%21 = call i32 @snprintf(i8* %18, i32 80, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %20)
%22 = call i64 @remove(i8* %17)
%23 = call i64 @remove(i8* %18)
%24 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%25 = call i32 @getcwd(i8* %24, i32 1024)
%26 = call i32 @assert(i32 %25)
%27 = call i32 @strcat(i8* %24, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
%28 = call i32 @strlen(i8* %24)
%29 = icmp ult i32 %28, 1024
%30 = zext i1 %29 to i32
%31 = call i32 @assert(i32 %30)
%32 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%33 = call i32 @getcwd(i8* %32, i32 1024)
%34 = call i32 @assert(i32 %33)
%35 = call i32 @strcat(i8* %32, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%36 = call i32 (...) @fork()
%37 = icmp ne i32 %36, -1
%38 = zext i1 %37 to i32
%39 = call i32 @assert(i32 %38)
%40 = icmp eq i32 %36, 0
br i1 %40, label %41, label %78
41: ; preds = %3
%42 = bitcast [20 x i8*]* %8 to i8*
%43 = getelementptr inbounds [24 x i8], [24 x i8]* %9, i64 0, i64 0
%44 = call i32 @snprintf(i8* %43, i32 24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 %2)
%45 = call i32 @putenv(i8* %11)
%46 = getelementptr inbounds [20 x i8*], [20 x i8*]* %8, i64 0, i64 0
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), i8** %46
%47 = getelementptr inbounds [20 x i8*], [20 x i8*]* %8, i64 0, i64 1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8** %47
%48 = getelementptr inbounds [20 x i8*], [20 x i8*]* %8, i64 0, i64 2
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8** %48
%49 = getelementptr inbounds [20 x i8*], [20 x i8*]* %8, i64 0, i64 3
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8** %49
%50 = getelementptr inbounds [20 x i8*], [20 x i8*]* %8, i64 0, i64 4
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0), i8** %50
%51 = call i64 (...) @getuid()
%52 = icmp eq i64 %51, 0
br i1 %52, label %53, label %56
53: ; preds = %41
%54 = getelementptr inbounds [20 x i8*], [20 x i8*]* %8, i64 0, i64 5
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i8** %54
%55 = getelementptr inbounds [20 x i8*], [20 x i8*]* %8, i64 0, i64 6
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0), i8** %55
br label %56
56: ; preds = %53, %41
%57 = phi i32 [ 7, %53 ], [ 5, %41 ]
%58 = icmp eq i32 %1, 0
br i1 %58, label %69, label %59
59: ; preds = %56
%60 = add nuw nsw i32 %57, 1
%61 = zext i32 %57 to i64
%62 = getelementptr inbounds [20 x i8*], [20 x i8*]* %8, i64 0, i64 %61
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i8** %62
%63 = add nuw nsw i32 %57, 2
%64 = zext i32 %60 to i64
%65 = getelementptr inbounds [20 x i8*], [20 x i8*]* %8, i64 0, i64 %64
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i64 0, i64 0), i8** %65
%66 = add nuw nsw i32 %57, 3
%67 = zext i32 %63 to i64
%68 = getelementptr inbounds [20 x i8*], [20 x i8*]* %8, i64 0, i64 %67
store i8* %18, i8** %68
br label %69
69: ; preds = %59, %56
%70 = phi i32 [ %66, %59 ], [ %57, %56 ]
%71 = zext i32 %70 to i64
%72 = getelementptr inbounds [20 x i8*], [20 x i8*]* %8, i64 0, i64 %71
store i8* null, i8** %72
%73 = load i8*, i8** %46
%74 = call i32 @execv(i8* %73, i8** %46)
%75 = icmp ne i32 %74, -1
%76 = zext i1 %75 to i32
%77 = call i32 @assert(i32 %76)
br label %78
78: ; preds = %69, %3
%79 = load i32, i32* @F_OK
%80 = call i32 @access(i8* %17, i32 %79)
%81 = icmp eq i32 %80, -1
br i1 %81, label %82, label %87
82: ; preds = %78, %82
%83 = call i32 @usleep(i32 10)
%84 = load i32, i32* @F_OK
%85 = call i32 @access(i8* %17, i32 %84)
%86 = icmp eq i32 %85, -1
br i1 %86, label %82, label %87
87: ; preds = %82, %78
%88 = call i32* @fopen(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0))
%89 = icmp eq i32* %88, null
br i1 %89, label %90, label %96
90: ; preds = %87
%91 = load i32, i32* @stderr
%92 = load i32, i32* @errno
%93 = call i8* @strerror(i32 %92)
%94 = call i32 @fprintf(i32 %91, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.16, i64 0, i64 0), i8* %93)
%95 = call i32 @assert(i32 0)
br label %96
96: ; preds = %90, %87
store i64 -1, i64* %0
%97 = getelementptr inbounds [80 x i8], [80 x i8]* %10, i64 0, i64 0
%98 = call i32* @fgets(i8* %97, i32 80, i32* %88)
%99 = icmp eq i32* %98, null
br i1 %99, label %110, label %100
100: ; preds = %96
%101 = getelementptr inbounds [80 x i8], [80 x i8]* %10, i64 0, i64 10
br label %102
102: ; preds = %100, %107
%103 = call i64 @strncmp(i8* %97, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.17, i64 0, i64 0), i32 10)
%104 = icmp eq i64 %103, 0
br i1 %104, label %105, label %107
105: ; preds = %102
%106 = call i64 @strtol(i8* nocapture %101, i32* null, i32 10)
store i64 %106, i64* %0
br label %107
107: ; preds = %105, %102
%108 = call i32* @fgets(i8* %97, i32 80, i32* %88)
%109 = icmp eq i32* %108, null
br i1 %109, label %110, label %102
110: ; preds = %107, %96
%111 = call i32 @fclose(i32* %88)
%112 = call i64 @remove(i8* %17)
%113 = icmp eq i64 %112, 0
%114 = zext i1 %113 to i32
%115 = call i32 @assert(i32 %114)
%116 = icmp eq i32 %1, 0
br i1 %116, label %143, label %117
117: ; preds = %110
%118 = load i32, i32* @F_OK
%119 = call i32 @access(i8* %18, i32 %118)
%120 = icmp eq i32 %119, -1
br i1 %120, label %121, label %126
121: ; preds = %117, %121
%122 = call i32 @usleep(i32 10)
%123 = load i32, i32* @F_OK
%124 = call i32 @access(i8* %18, i32 %123)
%125 = icmp eq i32 %124, -1
br i1 %125, label %121, label %126
126: ; preds = %121, %117
%127 = call i32* @fopen(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0))
%128 = icmp eq i32* %127, null
br i1 %128, label %129, label %135
129: ; preds = %126
%130 = load i32, i32* @stderr
%131 = load i32, i32* @errno
%132 = call i8* @strerror(i32 %131)
%133 = call i32 @fprintf(i32 %130, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.18, i64 0, i64 0), i8* %132)
%134 = call i32 @assert(i32 0)
br label %135
135: ; preds = %129, %126
%136 = call i32* @fgets(i8* %97, i32 80, i32* %127)
%137 = icmp ne i32* %136, null
%138 = zext i1 %137 to i32
%139 = call i32 @assert(i32 %138)
%140 = call i32 @fclose(i32* %127)
%141 = call i64 @strtol(i8* nocapture %97, i32* null, i32 10)
%142 = trunc i64 %141 to i32
br label %143
143: ; preds = %135, %110
%144 = phi i32 [ %142, %135 ], [ %36, %110 ]
ret i32 %144
}