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

/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

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

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
float RAND_MAX;
int /*<<< orphan*/ SOCK_STREAM;
int atoi(char *);
int /*<<< orphan*/ bcopy(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ bzero(char *, int);
int /*<<< orphan*/ close(int);
scalar_t__ connect(int, struct sockaddr *, int);
int /*<<< orphan*/ error(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, unsigned int, int);
struct hostent *gethostbyname(char *);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ printf(char *);
unsigned int rand();
int read(int, char *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ srand(scalar_t__);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ strlen(char *);
scalar_t__ time(int /*<<< orphan*/ *);
int /*<<< orphan*/ usleep(unsigned int);
int write(int, char *, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  FILE *pFile;
  unsigned int i, retry, slptime;
  int sockfd, portn, n, msg, id;
  double random;
  struct sockaddr_in server_addr;
  struct hostent *server;
  char buffer[16];
  if (argc == 2 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h"))) {
    printf("Usage: ./app_client <server> <port> <id>\n");
    return 0;
  }
  if (argc != 4) {
    printf("Arguments specified wrongly. See --help for usage.\n");
    exit(1);
  } else {
    server = gethostbyname(argv[1]);
    if (server == NULL) {
      printf("Error, no such host\n");
      exit(0);
    }
    portn = atoi(argv[2]);
    id = atoi(argv[3]);
  }
  srand(time(NULL) + id);
  if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
    printf("Error opening socket\n");
    exit(1);
  }
  bzero((char *)&server_addr, sizeof(server_addr));
  server_addr.sin_family = AF_INET;
  bcopy((char *)server->h_addr, (char *)&server_addr.sin_addr.s_addr,
        server->h_length);
  server_addr.sin_port = htons(portn);
  retry = 0;
  while (true) {
    if (connect(sockfd, (struct sockaddr *)&server_addr, sizeof(server_addr)) <
        0) {
      retry++;
    } else {
      break;
    }
    if (retry > 10) {
      printf("Error connecting to host\n");
      exit(1);
    }
    slptime = rand();
    random = (1000000.0f * slptime) / RAND_MAX;
    slptime = (unsigned int)random;
    usleep(slptime);
  }
  for (i = 0; i < 100; i++) {
    bzero(buffer, 16);
    sprintf(buffer, "%i", 0);
    n = write(sockfd, buffer, strlen(buffer));
    if (n < 0) {
      printf("Error writing to socket\n");
      exit(1);
    }
    printf("Waiting reply...\n");
    bzero(buffer, 16);
    n = read(sockfd, buffer, 15);
    if (n < 0) {
      printf("Error reading from socket\n");
      exit(1);
    }
    msg = atoi(buffer);
    printf("Received reply!\n");
    if (msg == 2) {
      pFile = fopen("mutex-write.txt", "a");
      fprintf(pFile, "Hello #%u from process %i!\n", i, id);
      fclose(pFile);
    } else {
      printf("Message received not understood\n");
      exit(1);
    }
    printf("Wrote to file!\n");
    bzero(buffer, 16);
    sprintf(buffer, "%i", 1);
    n = write(sockfd, buffer, strlen(buffer));
    if (n < 0) {
      printf("Error writing to socket\n");
      exit(1);
    }
    printf("Sending release...\n");
    slptime = rand();
    random = (1000000.0f * slptime) / RAND_MAX;
    slptime = (unsigned int)random;
    usleep(slptime);
  }
  printf("hi\n");
  bzero(buffer, 16);
  sprintf(buffer, "%i", 9);
  n = write(sockfd, buffer, strlen(buffer));
  if (n < 0) {
    error("Error writing to socket");
  }
  close(sockfd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    12e5 <main+0x75>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd62(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%eax
je     12cd <main+0x5d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd4c(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%eax
jne    12e5 <main+0x75>
lea    0xd3a(%rip),%rdi
call   1070 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    172e <main+0x4be>
cmpl   $0x4,-0x8(%rbp)
je     1305 <main+0x95>
lea    0xd42(%rip),%rdi
call   1070 <printf@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10c0 <gethostbyname@plt>
mov    %rax,-0x58(%rbp)
cmpq   $0x0,-0x58(%rbp)
jne    1334 <main+0xc4>
lea    0xd44(%rip),%rdi
call   1070 <printf@plt>
xor    %edi,%edi
call   1150 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1130 <atoi@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1130 <atoi@plt>
mov    %eax,-0x38(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   10e0 <time@plt>
mov    %rax,%rdi
movslq -0x38(%rbp),%rax
add    %rax,%rdi
call   10a0 <srand@plt>
mov    0x2c75(%rip),%rax
mov    (%rax),%edi
mov    0x2c54(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1190 <socket@plt>
mov    %eax,-0x28(%rbp)
cmp    $0x0,%eax
jge    13a7 <main+0x137>
lea    0xce9(%rip),%rdi
call   1070 <printf@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
lea    -0x50(%rbp),%rdi
mov    $0xc,%esi
call   1120 <bzero@plt>
mov    0x2c2c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    -0x58(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x50(%rbp),%rsi
add    $0x4,%rsi
mov    -0x58(%rbp),%rax
mov    (%rax),%edx
call   10f0 <bcopy@plt>
mov    -0x2c(%rbp),%edi
call   1060 <htons@plt>
mov    %eax,-0x50(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x28(%rbp),%edi
lea    -0x50(%rbp),%rsi
mov    $0xc,%edx
call   1160 <connect@plt>
cmp    $0x0,%rax
jge    1417 <main+0x1a7>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    141c <main+0x1ac>
jmp    1488 <main+0x218>
cmpl   $0xa,-0x20(%rbp)
jbe    143c <main+0x1cc>
lea    0xc6a(%rip),%rdi
call   1070 <printf@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
xor    %eax,%eax
call   1170 <rand@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cvtsi2ss %rax,%xmm0
movss  0xbaa(%rip),%xmm1
mulss  %xmm1,%xmm0
mov    0x2b7f(%rip),%rax
movss  (%rax),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
cvttsd2si -0x40(%rbp),%rax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
call   1180 <usleep@plt>
jmp    13ee <main+0x17e>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x64,-0x1c(%rbp)
jae    16a6 <main+0x436>
lea    -0x70(%rbp),%rdi
mov    $0x10,%esi
call   1120 <bzero@plt>
lea    -0x70(%rbp),%rdi
lea    0xbff(%rip),%rsi
xor    %edx,%edx
call   1140 <sprintf@plt>
mov    -0x28(%rbp),%eax
mov    %eax,-0x7c(%rbp)
lea    -0x70(%rbp),%rax
mov    %rax,-0x78(%rbp)
lea    -0x70(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x7c(%rbp),%edi
mov    -0x78(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
jge    1501 <main+0x291>
lea    0xbc2(%rip),%rdi
call   1070 <printf@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
lea    0xbc5(%rip),%rdi
call   1070 <printf@plt>
lea    -0x70(%rbp),%rdi
mov    $0x10,%esi
call   1120 <bzero@plt>
mov    -0x28(%rbp),%edi
lea    -0x70(%rbp),%rsi
mov    $0xf,%edx
call   1090 <read@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
jge    154f <main+0x2df>
lea    0xb9f(%rip),%rdi
call   1070 <printf@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
lea    -0x70(%rbp),%rdi
call   1130 <atoi@plt>
mov    %eax,-0x34(%rbp)
lea    0xb98(%rip),%rdi
call   1070 <printf@plt>
cmpl   $0x2,-0x34(%rbp)
jne    15ac <main+0x33c>
lea    0xb93(%rip),%rdi
lea    0xb9c(%rip),%rsi
call   1110 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%edx
mov    -0x38(%rbp),%ecx
lea    0xb84(%rip),%rsi
call   10d0 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
jmp    15c2 <main+0x352>
lea    0xb86(%rip),%rdi
call   1070 <printf@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
lea    0xb91(%rip),%rdi
call   1070 <printf@plt>
lea    -0x70(%rbp),%rdi
mov    $0x10,%esi
call   1120 <bzero@plt>
lea    -0x70(%rbp),%rdi
lea    0xaca(%rip),%rsi
mov    $0x1,%edx
call   1140 <sprintf@plt>
mov    -0x28(%rbp),%eax
mov    %eax,-0x8c(%rbp)
lea    -0x70(%rbp),%rax
mov    %rax,-0x88(%rbp)
lea    -0x70(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x8c(%rbp),%edi
mov    -0x88(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
jge    1645 <main+0x3d5>
lea    0xa7e(%rip),%rdi
call   1070 <printf@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
lea    0xb1e(%rip),%rdi
call   1070 <printf@plt>
xor    %eax,%eax
call   1170 <rand@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cvtsi2ss %rax,%xmm0
movss  0x995(%rip),%xmm1
mulss  %xmm1,%xmm0
mov    0x296a(%rip),%rax
movss  (%rax),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
cvttsd2si -0x40(%rbp),%rax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
call   1180 <usleep@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    148f <main+0x21f>
lea    0xad1(%rip),%rdi
call   1070 <printf@plt>
lea    -0x70(%rbp),%rdi
mov    $0x10,%esi
call   1120 <bzero@plt>
lea    -0x70(%rbp),%rdi
lea    0x9e6(%rip),%rsi
mov    $0x9,%edx
call   1140 <sprintf@plt>
mov    -0x28(%rbp),%eax
mov    %eax,-0x9c(%rbp)
lea    -0x70(%rbp),%rax
mov    %rax,-0x98(%rbp)
lea    -0x70(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x9c(%rbp),%edi
mov    -0x98(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0x30(%rbp)
jge    171f <main+0x4af>
lea    0xa68(%rip),%rdi
call   1100 <error@plt>
mov    -0x28(%rbp),%edi
call   1080 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%rbx
cmp    $0x4,%edi
je     12ce <main+0x5e>
cmp    $0x2,%edi
jne    15d9 <main+0x369>
mov    0x8(%rbx),%rbx
lea    0xd6a(%rip),%rsi
mov    %rbx,%rdi
call   10b0 <strcmp@plt>
test   %eax,%eax
je     12bd <main+0x4d>
lea    0xd5e(%rip),%rsi
mov    %rbx,%rdi
call   10b0 <strcmp@plt>
test   %eax,%eax
jne    15d9 <main+0x369>
lea    0xe88(%rip),%rdi
call   1030 <puts@plt>
jmp    1597 <main+0x327>
mov    0x8(%rbx),%rdi
call   10c0 <gethostbyname@plt>
test   %rax,%rax
je     15e2 <main+0x372>
mov    %rax,%rbp
mov    0x10(%rbx),%rdi
call   1130 <atoi@plt>
mov    %eax,%r15d
mov    0x18(%rbx),%rdi
call   1130 <atoi@plt>
mov    %eax,%ebx
xor    %edi,%edi
call   10e0 <time@plt>
mov    %ebx,0xc(%rsp)
movslq %ebx,%rdi
add    %rax,%rdi
call   10a0 <srand@plt>
mov    0x2cd1(%rip),%rbx
mov    (%rbx),%edi
mov    0x2cb0(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1190 <socket@plt>
test   %eax,%eax
js     15f5 <main+0x385>
mov    %eax,%r14d
lea    0x10(%rsp),%r12
mov    %r12,%rdi
mov    $0xc,%esi
call   1120 <bzero@plt>
mov    (%rbx),%eax
mov    %eax,0x18(%rsp)
mov    0x8(%rbp),%rsi
lea    0x14(%rsp),%rdi
mov    0x0(%rbp),%edx
call   10f0 <memmove@plt>
mov    %r15d,%edi
call   1070 <htons@plt>
mov    %eax,0x10(%rsp)
mov    %r14d,%edi
mov    %r12,%rsi
mov    $0xc,%edx
call   1160 <connect@plt>
test   %rax,%rax
jns    13d6 <main+0x166>
mov    $0xb,%ebx
mov    0x2c56(%rip),%r15
lea    0x10(%rsp),%rbp
nop
add    $0xffffffff,%ebx
je     15c3 <main+0x353>
xor    %eax,%eax
call   1170 <rand@plt>
mov    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
mulss  0xc4e(%rip),%xmm0
divss  (%r15),%xmm0
cvttss2si %xmm0,%rdi
call   1180 <usleep@plt>
mov    %r14d,%edi
mov    %rbp,%rsi
mov    $0xc,%edx
call   1160 <connect@plt>
test   %rax,%rax
js     1390 <main+0x120>
lea    0x20(%rsp),%rbp
lea    0xc2c(%rip),%r15
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbp,%rdi
mov    $0x10,%esi
call   1120 <bzero@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
xor    %edx,%edx
call   1140 <sprintf@plt>
mov    %rbp,%rdi
call   1060 <strlen@plt>
mov    %r14d,%edi
mov    %rbp,%rsi
mov    %eax,%edx
call   1040 <write@plt>
test   %eax,%eax
js     15a8 <main+0x338>
lea    0xc14(%rip),%rdi
call   1030 <puts@plt>
mov    %rbp,%rdi
mov    $0x10,%esi
call   1120 <bzero@plt>
mov    %r14d,%edi
mov    %rbp,%rsi
mov    $0xf,%edx
call   1090 <read@plt>
test   %eax,%eax
js     15b1 <main+0x341>
mov    %rbp,%rdi
call   1130 <atoi@plt>
mov    %eax,%r12d
lea    0xbe9(%rip),%rdi
call   1030 <puts@plt>
cmp    $0x2,%r12d
jne    15ba <main+0x34a>
lea    0xb91(%rip),%rdi
lea    0xb9a(%rip),%rsi
call   1110 <fopen@plt>
mov    %rax,%rbx
mov    %rax,%rdi
lea    0xb8a(%rip),%rsi
mov    %r13d,%edx
mov    0xc(%rsp),%ecx
call   10d0 <fprintf@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
lea    0xbcf(%rip),%rdi
call   1030 <puts@plt>
mov    %rbp,%rdi
mov    $0x10,%esi
call   1120 <bzero@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
mov    $0x1,%edx
call   1140 <sprintf@plt>
mov    %rbp,%rdi
call   1060 <strlen@plt>
mov    %r14d,%edi
mov    %rbp,%rsi
mov    %eax,%edx
call   1040 <write@plt>
test   %eax,%eax
js     15a8 <main+0x338>
lea    0xb98(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1170 <rand@plt>
mov    %eax,%eax
cvtsi2ss %rax,%xmm0
mulss  0xaeb(%rip),%xmm0
mov    0x2ac4(%rip),%rax
divss  (%rax),%xmm0
cvttss2si %xmm0,%rdi
call   1180 <usleep@plt>
add    $0x1,%r13d
cmp    $0x64,%r13d
jne    13f0 <main+0x180>
lea    0xb00(%rip),%rdi
call   1030 <puts@plt>
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x10,%esi
call   1120 <bzero@plt>
lea    0xab1(%rip),%rsi
mov    %rbx,%rdi
mov    $0x9,%edx
call   1140 <sprintf@plt>
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
test   %eax,%eax
jns    158f <main+0x31f>
lea    0xb35(%rip),%rdi
call   1100 <error@plt>
mov    %r14d,%edi
call   1080 <close@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xb10(%rip),%rdi
jmp    15ca <main+0x35a>
lea    0xaed(%rip),%rdi
jmp    15ca <main+0x35a>
lea    0xaa2(%rip),%rdi
jmp    15ca <main+0x35a>
lea    0xb0d(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
lea    0xb39(%rip),%rdi
jmp    15ca <main+0x35a>
lea    0xb1c(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1150 <exit@plt>
lea    0xaf4(%rip),%rdi
jmp    15ca <main+0x35a>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.hostent = type { i32, i64 }
%struct.sockaddr = type { i32 }
@.str = [7 x i8] c"--help\00"
@.str.1 = [3 x i8] c"-h\00"
@.str.2 = [42 x i8] c"Usage: ./app_client <server> <port> <id>\0A\00"
@.str.3 = [52 x i8] c"Arguments specified wrongly. See --help for usage.\0A\00"
@.str.4 = [21 x i8] c"Error, no such host\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.5 = [22 x i8] c"Error opening socket\0A\00"
@.str.6 = [26 x i8] c"Error connecting to host\0A\00"
@RAND_MAX = global float 0.000000e+00
@.str.7 = [3 x i8] c"%i\00"
@.str.8 = [25 x i8] c"Error writing to socket\0A\00"
@.str.9 = [18 x i8] c"Waiting reply...\0A\00"
@.str.10 = [27 x i8] c"Error reading from socket\0A\00"
@.str.11 = [17 x i8] c"Received reply!\0A\00"
@.str.12 = [16 x i8] c"mutex-write.txt\00"
@.str.13 = [2 x i8] c"a\00"
@.str.14 = [28 x i8] c"Hello #%u from process %i!\0A\00"
@.str.15 = [33 x i8] c"Message received not understood\0A\00"
@.str.16 = [16 x i8] c"Wrote to file!\0A\00"
@.str.17 = [20 x i8] c"Sending release...\0A\00"
@.str.18 = [4 x i8] c"hi\0A\00"
@.str.19 = [24 x i8] c"Error writing to socket\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 i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca double
%16 = alloca %struct.sockaddr_in
%17 = alloca %struct.hostent*
%18 = alloca [16 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%19 = load i32, i32* %4
%20 = icmp eq i32 %19, 2
br i1 %20, label %21, label %35
21: ; preds = %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i32 @strcmp(i8* %24, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %33
27: ; preds = %21
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = call i32 @strcmp(i8* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%32 = icmp ne i32 %31, 0
br i1 %32, label %35, label %33
33: ; preds = %27, %21
%34 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %217
35: ; preds = %27, %2
%36 = load i32, i32* %4
%37 = icmp ne i32 %36, 4
br i1 %37, label %38, label %41
38: ; preds = %35
%39 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0))
%40 = call i32 @exit(i32 1)
unreachable
41: ; preds = %35
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 1
%44 = load i8*, i8** %43
%45 = call %struct.hostent* @gethostbyname(i8* %44)
store %struct.hostent* %45, %struct.hostent** %17
%46 = load %struct.hostent*, %struct.hostent** %17
%47 = icmp eq %struct.hostent* %46, null
br i1 %47, label %48, label %51
48: ; preds = %41
%49 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%50 = call i32 @exit(i32 0)
unreachable
51: ; preds = %41
%52 = load i8**, i8*** %5
%53 = getelementptr inbounds i8*, i8** %52, i64 2
%54 = load i8*, i8** %53
%55 = call i32 @atoi(i8* %54)
store i32 %55, i32* %11
%56 = load i8**, i8*** %5
%57 = getelementptr inbounds i8*, i8** %56, i64 3
%58 = load i8*, i8** %57
%59 = call i32 @atoi(i8* %58)
store i32 %59, i32* %14
br label %60
60: ; preds = %51
%61 = call i64 @time(i32* null)
%62 = load i32, i32* %14
%63 = sext i32 %62 to i64
%64 = add nsw i64 %61, %63
%65 = call i32 @srand(i64 %64)
%66 = load i32, i32* @AF_INET
%67 = load i32, i32* @SOCK_STREAM
%68 = call i32 @socket(i32 %66, i32 %67, i32 0)
store i32 %68, i32* %10
%69 = icmp slt i32 %68, 0
br i1 %69, label %70, label %73
70: ; preds = %60
%71 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%72 = call i32 @exit(i32 1)
unreachable
73: ; preds = %60
%74 = bitcast %struct.sockaddr_in* %16 to i8*
%75 = call i32 @bzero(i8* %74, i32 12)
%76 = load i32, i32* @AF_INET
%77 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %16, i32 0, i32 2
store i32 %76, i32* %77
%78 = load %struct.hostent*, %struct.hostent** %17
%79 = getelementptr inbounds %struct.hostent, %struct.hostent* %78, i32 0, i32 1
%80 = load i64, i64* %79
%81 = inttoptr i64 %80 to i8*
%82 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %16, i32 0, i32 1
%83 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %82, i32 0, i32 0
%84 = bitcast i32* %83 to i8*
%85 = load %struct.hostent*, %struct.hostent** %17
%86 = getelementptr inbounds %struct.hostent, %struct.hostent* %85, i32 0, i32 0
%87 = load i32, i32* %86
%88 = call i32 @bcopy(i8* %81, i8* %84, i32 %87)
%89 = load i32, i32* %11
%90 = call i32 @htons(i32 %89)
%91 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %16, i32 0, i32 0
store i32 %90, i32* %91
store i32 0, i32* %8
br label %92
92: ; preds = %73, %107
%93 = load i32, i32* %10
%94 = bitcast %struct.sockaddr_in* %16 to %struct.sockaddr*
%95 = call i64 @connect(i32 %93, %struct.sockaddr* %94, i32 12)
%96 = icmp slt i64 %95, 0
br i1 %96, label %97, label %100
97: ; preds = %92
%98 = load i32, i32* %8
%99 = add i32 %98, 1
store i32 %99, i32* %8
br label %101
100: ; preds = %92
br label %119
101: ; preds = %97
%102 = load i32, i32* %8
%103 = icmp ugt i32 %102, 10
br i1 %103, label %104, label %107
104: ; preds = %101
%105 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0))
%106 = call i32 @exit(i32 1)
unreachable
107: ; preds = %101
%108 = call i32 (...) @rand()
store i32 %108, i32* %9
%109 = load i32, i32* %9
%110 = uitofp i32 %109 to float
%111 = fmul float 1.000000e+06, %110
%112 = load float, float* @RAND_MAX
%113 = fdiv float %111, %112
%114 = fpext float %113 to double
store double %114, double* %15
%115 = load double, double* %15
%116 = fptoui double %115 to i32
store i32 %116, i32* %9
%117 = load i32, i32* %9
%118 = call i32 @usleep(i32 %117)
br label %92
119: ; preds = %100
store i32 0, i32* %7
br label %120
120: ; preds = %196, %119
%121 = load i32, i32* %7
%122 = icmp ult i32 %121, 100
br i1 %122, label %123, label %199
123: ; preds = %120
%124 = getelementptr inbounds [16 x i8], [16 x i8]* %18, i64 0, i64 0
%125 = call i32 @bzero(i8* %124, i32 16)
%126 = getelementptr inbounds [16 x i8], [16 x i8]* %18, i64 0, i64 0
%127 = call i32 @sprintf(i8* %126, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32 0)
%128 = load i32, i32* %10
%129 = getelementptr inbounds [16 x i8], [16 x i8]* %18, i64 0, i64 0
%130 = getelementptr inbounds [16 x i8], [16 x i8]* %18, i64 0, i64 0
%131 = call i32 @strlen(i8* %130)
%132 = call i32 @write(i32 %128, i8* %129, i32 %131)
store i32 %132, i32* %12
%133 = load i32, i32* %12
%134 = icmp slt i32 %133, 0
br i1 %134, label %135, label %138
135: ; preds = %123
%136 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0))
%137 = call i32 @exit(i32 1)
unreachable
138: ; preds = %123
%139 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0))
%140 = getelementptr inbounds [16 x i8], [16 x i8]* %18, i64 0, i64 0
%141 = call i32 @bzero(i8* %140, i32 16)
%142 = load i32, i32* %10
%143 = getelementptr inbounds [16 x i8], [16 x i8]* %18, i64 0, i64 0
%144 = call i32 @read(i32 %142, i8* %143, i32 15)
store i32 %144, i32* %12
%145 = load i32, i32* %12
%146 = icmp slt i32 %145, 0
br i1 %146, label %147, label %150
147: ; preds = %138
%148 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0))
%149 = call i32 @exit(i32 1)
unreachable
150: ; preds = %138
%151 = getelementptr inbounds [16 x i8], [16 x i8]* %18, i64 0, i64 0
%152 = call i32 @atoi(i8* %151)
store i32 %152, i32* %13
%153 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0))
%154 = load i32, i32* %13
%155 = icmp eq i32 %154, 2
br i1 %155, label %156, label %164
156: ; preds = %150
%157 = call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0))
store i32* %157, i32** %6
%158 = load i32*, i32** %6
%159 = load i32, i32* %7
%160 = load i32, i32* %14
%161 = call i32 @fprintf(i32* %158, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.14, i64 0, i64 0), i32 %159, i32 %160)
%162 = load i32*, i32** %6
%163 = call i32 @fclose(i32* %162)
br label %167
164: ; preds = %150
%165 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.15, i64 0, i64 0))
%166 = call i32 @exit(i32 1)
unreachable
167: ; preds = %156
%168 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.16, i64 0, i64 0))
%169 = getelementptr inbounds [16 x i8], [16 x i8]* %18, i64 0, i64 0
%170 = call i32 @bzero(i8* %169, i32 16)
%171 = getelementptr inbounds [16 x i8], [16 x i8]* %18, i64 0, i64 0
%172 = call i32 @sprintf(i8* %171, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32 1)
%173 = load i32, i32* %10
%174 = getelementptr inbounds [16 x i8], [16 x i8]* %18, i64 0, i64 0
%175 = getelementptr inbounds [16 x i8], [16 x i8]* %18, i64 0, i64 0
%176 = call i32 @strlen(i8* %175)
%177 = call i32 @write(i32 %173, i8* %174, i32 %176)
store i32 %177, i32* %12
%178 = load i32, i32* %12
%179 = icmp slt i32 %178, 0
br i1 %179, label %180, label %183
180: ; preds = %167
%181 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0))
%182 = call i32 @exit(i32 1)
unreachable
183: ; preds = %167
%184 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.17, i64 0, i64 0))
%185 = call i32 (...) @rand()
store i32 %185, i32* %9
%186 = load i32, i32* %9
%187 = uitofp i32 %186 to float
%188 = fmul float 1.000000e+06, %187
%189 = load float, float* @RAND_MAX
%190 = fdiv float %188, %189
%191 = fpext float %190 to double
store double %191, double* %15
%192 = load double, double* %15
%193 = fptoui double %192 to i32
store i32 %193, i32* %9
%194 = load i32, i32* %9
%195 = call i32 @usleep(i32 %194)
br label %196
196: ; preds = %183
%197 = load i32, i32* %7
%198 = add i32 %197, 1
store i32 %198, i32* %7
br label %120
199: ; preds = %120
%200 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0))
%201 = getelementptr inbounds [16 x i8], [16 x i8]* %18, i64 0, i64 0
%202 = call i32 @bzero(i8* %201, i32 16)
%203 = getelementptr inbounds [16 x i8], [16 x i8]* %18, i64 0, i64 0
%204 = call i32 @sprintf(i8* %203, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32 9)
%205 = load i32, i32* %10
%206 = getelementptr inbounds [16 x i8], [16 x i8]* %18, i64 0, i64 0
%207 = getelementptr inbounds [16 x i8], [16 x i8]* %18, i64 0, i64 0
%208 = call i32 @strlen(i8* %207)
%209 = call i32 @write(i32 %205, i8* %206, i32 %208)
store i32 %209, i32* %12
%210 = load i32, i32* %12
%211 = icmp slt i32 %210, 0
br i1 %211, label %212, label %214
212: ; preds = %199
%213 = call i32 @error(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.19, i64 0, i64 0))
br label %214
214: ; preds = %212, %199
%215 = load i32, i32* %10
%216 = call i32 @close(i32 %215)
store i32 0, i32* %3
br label %217
217: ; preds = %214, %33
%218 = load i32, i32* %3
ret i32 %218
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.hostent = type { i32, i64 }
%struct.sockaddr = type { i32 }
@.str = [7 x i8] c"--help\00"
@.str.1 = [3 x i8] c"-h\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@RAND_MAX = global float 0.000000e+00
@.str.7 = [3 x i8] c"%i\00"
@.str.12 = [16 x i8] c"mutex-write.txt\00"
@.str.13 = [2 x i8] c"a\00"
@.str.14 = [28 x i8] c"Hello #%u from process %i!\0A\00"
@str = [3 x i8] c"hi\00"
@str.20 = [17 x i8] c"Waiting reply...\00"
@str.21 = [16 x i8] c"Received reply!\00"
@str.22 = [32 x i8] c"Message received not understood\00"
@str.23 = [15 x i8] c"Wrote to file!\00"
@str.24 = [19 x i8] c"Sending release...\00"
@str.26 = [26 x i8] c"Error reading from socket\00"
@str.27 = [24 x i8] c"Error writing to socket\00"
@str.28 = [25 x i8] c"Error connecting to host\00"
@str.29 = [21 x i8] c"Error opening socket\00"
@str.30 = [20 x i8] c"Error, no such host\00"
@str.31 = [51 x i8] c"Arguments specified wrongly. See --help for usage.\00"
@str.32 = [41 x i8] c"Usage: ./app_client <server> <port> <id>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca [16 x i8]
%5 = bitcast %struct.sockaddr_in* %3 to i8*
%6 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
switch i32 %0, label %17 [
i32 2, label %7
i32 4, label %20
]
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @strcmp(i8* dereferenceable(1) %9, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i32 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %7
%13 = tail call i32 @strcmp(i8* dereferenceable(1) %9, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %12, %7
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.32, i64 0, i64 0))
br label %140
17: ; preds = %12, %2
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.31, i64 0, i64 0))
%19 = tail call i32 @exit(i32 1)
unreachable
20: ; preds = %2
%21 = getelementptr inbounds i8*, i8** %1, i64 1
%22 = load i8*, i8** %21
%23 = tail call %struct.hostent* @gethostbyname(i8* %22)
%24 = icmp eq %struct.hostent* %23, null
br i1 %24, label %25, label %28
25: ; preds = %20
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.30, i64 0, i64 0))
%27 = tail call i32 @exit(i32 0)
unreachable
28: ; preds = %20
%29 = getelementptr inbounds i8*, i8** %1, i64 2
%30 = load i8*, i8** %29
%31 = tail call i32 @atoi(i8* %30)
%32 = getelementptr inbounds i8*, i8** %1, i64 3
%33 = load i8*, i8** %32
%34 = tail call i32 @atoi(i8* %33)
%35 = tail call i64 @time(i32* null)
%36 = sext i32 %34 to i64
%37 = add nsw i64 %35, %36
%38 = tail call i32 @srand(i64 %37)
%39 = load i32, i32* @AF_INET
%40 = load i32, i32* @SOCK_STREAM
%41 = tail call i32 @socket(i32 %39, i32 %40, i32 0)
%42 = icmp slt i32 %41, 0
br i1 %42, label %43, label %46
43: ; preds = %28
%44 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.29, i64 0, i64 0))
%45 = tail call i32 @exit(i32 1)
unreachable
46: ; preds = %28
%47 = call i32 @bzero(i8* %5, i32 12)
%48 = load i32, i32* @AF_INET
%49 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %48, i32* %49
%50 = getelementptr inbounds %struct.hostent, %struct.hostent* %23, i64 0, i32 1
%51 = load i64, i64* %50
%52 = inttoptr i64 %51 to i8*
%53 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1, i32 0
%54 = bitcast i32* %53 to i8*
%55 = getelementptr inbounds %struct.hostent, %struct.hostent* %23, i64 0, i32 0
%56 = load i32, i32* %55
%57 = tail call i32 @htons(i32 %31)
%58 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
store i32 %57, i32* %58
%59 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%60 = call i64 @connect(i32 %41, %struct.sockaddr* %59, i32 12)
%61 = icmp slt i64 %60, 0
br i1 %61, label %62, label %79
62: ; preds = %46, %68
%63 = phi i32 [ %69, %68 ], [ 0, %46 ]
%64 = icmp eq i32 %63, 10
br i1 %64, label %65, label %68
65: ; preds = %62
%66 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.28, i64 0, i64 0))
%67 = call i32 @exit(i32 1)
unreachable
68: ; preds = %62
%69 = add nuw nsw i32 %63, 1
%70 = call i32 (...) @rand()
%71 = uitofp i32 %70 to float
%72 = fmul float %71, 1.000000e+06
%73 = load float, float* @RAND_MAX
%74 = fdiv float %72, %73
%75 = fptoui float %74 to i32
%76 = call i32 @usleep(i32 %75)
%77 = call i64 @connect(i32 %41, %struct.sockaddr* %59, i32 12)
%78 = icmp slt i64 %77, 0
br i1 %78, label %62, label %79
79: ; preds = %68, %46
br label %80
80: ; preds = %79, %118
%81 = phi i32 [ %127, %118 ], [ 0, %79 ]
%82 = call i32 @bzero(i8* %6, i32 16)
%83 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32 0)
%84 = call i32 @strlen(i8* %6)
%85 = call i32 @write(i32 %41, i8* %6, i32 %84)
%86 = icmp slt i32 %85, 0
br i1 %86, label %87, label %90
87: ; preds = %80
%88 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.27, i64 0, i64 0))
%89 = call i32 @exit(i32 1)
unreachable
90: ; preds = %80
%91 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.20, i64 0, i64 0))
%92 = call i32 @bzero(i8* %6, i32 16)
%93 = call i32 @read(i32 %41, i8* %6, i32 15)
%94 = icmp slt i32 %93, 0
br i1 %94, label %95, label %98
95: ; preds = %90
%96 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.26, i64 0, i64 0))
%97 = call i32 @exit(i32 1)
unreachable
98: ; preds = %90
%99 = call i32 @atoi(i8* %6)
%100 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.21, i64 0, i64 0))
%101 = icmp eq i32 %99, 2
br i1 %101, label %102, label %112
102: ; preds = %98
%103 = call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0))
%104 = call i32 @fprintf(i32* %103, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.14, i64 0, i64 0), i32 %81, i32 %34)
%105 = call i32 @fclose(i32* %103)
%106 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.23, i64 0, i64 0))
%107 = call i32 @bzero(i8* %6, i32 16)
%108 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32 1)
%109 = call i32 @strlen(i8* %6)
%110 = call i32 @write(i32 %41, i8* %6, i32 %109)
%111 = icmp slt i32 %110, 0
br i1 %111, label %115, label %118
112: ; preds = %98
%113 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.22, i64 0, i64 0))
%114 = call i32 @exit(i32 1)
unreachable
115: ; preds = %102
%116 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.27, i64 0, i64 0))
%117 = call i32 @exit(i32 1)
unreachable
118: ; preds = %102
%119 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.24, i64 0, i64 0))
%120 = call i32 (...) @rand()
%121 = uitofp i32 %120 to float
%122 = fmul float %121, 1.000000e+06
%123 = load float, float* @RAND_MAX
%124 = fdiv float %122, %123
%125 = fptoui float %124 to i32
%126 = call i32 @usleep(i32 %125)
%127 = add nuw nsw i32 %81, 1
%128 = icmp eq i32 %127, 100
br i1 %128, label %129, label %80
129: ; preds = %118
%130 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
%131 = call i32 @bzero(i8* %6, i32 16)
%132 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32 9)
%133 = call i32 @strlen(i8* %6)
%134 = call i32 @write(i32 %41, i8* %6, i32 %133)
%135 = icmp slt i32 %134, 0
br i1 %135, label %136, label %138
136: ; preds = %129
%137 = call i32 @error(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @str.27, i64 0, i64 0))
br label %138
138: ; preds = %136, %129
%139 = call i32 @close(i32 %41)
br label %140
140: ; preds = %138, %15
ret i32 0
}