#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 */
struct sockaddr_un {
  int /*<<< orphan*/ sun_path;
  int /*<<< orphan*/ sun_family;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ response;

/* Variables and functions */
int /*<<< orphan*/ AF_UNIX;
int /*<<< orphan*/ SOCK_STREAM;
int atoi(char *);
int /*<<< orphan*/ close(int);
scalar_t__ connect(int, struct sockaddr *, int);
int /*<<< orphan*/ exit(int);
char *getenv(char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int read(int, char *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ strcpy(int /*<<< orphan*/, char *);
int strlen(char *);
char *strstr(char *, char *);
int write(int, char *, int);
int main(int argc, char *argv[]) {
  int sock, rval;
  struct sockaddr_un server;
  char request[128] = {0};
  char response[512] = {0};
  if (argc != 2) {
    printf("Usage: docker-wait CONTAINER\n            Block until a container "
           "stops, then returns its exit code.\n");
    exit(1);
  }
  char *docker_socket_path = getenv("DOCKER_SOCKET_PATH");
  if (docker_socket_path == NULL) {
    docker_socket_path = "/var/run/docker.sock";
  }
  if (strlen(docker_socket_path) >= sizeof(server.sun_path)) {
    printf("DOCKER_SOCKET_PATH is too long: %s\n", docker_socket_path);
    exit(1);
  }
  if ((sock = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
    perror("fail to open stream socket");
    exit(1);
  }
  server.sun_family = AF_UNIX;
  strcpy(server.sun_path, docker_socket_path);
  if (connect(sock, (struct sockaddr *)&server, sizeof(struct sockaddr_un)) <
      0) {
    perror("socket");
    exit(1);
  }
  sprintf(request, "POST /containers/%s/wait HTTP/1.0\r\n\r\n", argv[1]);
  int request_len = strlen(request);
  if ((rval = write(sock, request, request_len)) != request_len) {
    perror("write");
    exit(1);
  }
  if ((rval = read(sock, response, sizeof(response))) < 0) {
    perror("read");
    exit(1);
  }
  close(sock);
  char *msg = strstr(response, "\r\n\r\n") + 4;
  printf("docker wait response:\n%s\n", msg);
  if (strstr(msg, "no such id")) {
    exit(1);
  }
  char *status_code_str = strstr(msg, "{\"StatusCode\":");
  if (status_code_str == NULL) {
    exit(1);
  }
  status_code_str += 14;
  char *status_code_end = strstr(status_code_str, "}");
  *status_code_end = 0;
  int status_code = atoi(status_code_str);
  exit(status_code);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2d0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0xa0(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1080 <memset@plt>
lea    -0x2a0(%rbp),%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   1080 <memset@plt>
cmpl   $0x2,-0x8(%rbp)
je     1251 <main+0x61>
lea    0xdc0(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
lea    0xe0d(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x2a8(%rbp)
cmpq   $0x0,-0x2a8(%rbp)
jne    1280 <main+0x90>
lea    0xdff(%rip),%rax
mov    %rax,-0x2a8(%rbp)
mov    -0x2a8(%rbp),%rdi
call   1060 <strlen@plt>
cltq
cmp    $0x4,%rax
jb     12b7 <main+0xc7>
mov    -0x2a8(%rbp),%rsi
lea    0xde7(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    0x2d2a(%rip),%rax
mov    (%rax),%edi
mov    0x2d11(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    12f2 <main+0x102>
lea    0xdce(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    0x2cef(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x20(%rbp),%edi
mov    -0x2a8(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x14(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0x8,%edx
call   10f0 <connect@plt>
cmp    $0x0,%rax
jge    133e <main+0x14e>
lea    0xd96(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
lea    -0xa0(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xd78(%rip),%rsi
call   10d0 <sprintf@plt>
lea    -0xa0(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x2ac(%rbp)
mov    -0x14(%rbp),%edi
lea    -0xa0(%rbp),%rsi
mov    -0x2ac(%rbp),%edx
call   1050 <write@plt>
mov    %eax,-0x18(%rbp)
cmp    -0x2ac(%rbp),%eax
je     13a5 <main+0x1b5>
lea    0xd5c(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x14(%rbp),%edi
lea    -0x2a0(%rbp),%rsi
mov    $0x200,%edx
call   10a0 <read@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jge    13db <main+0x1eb>
lea    0xd2c(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x14(%rbp),%edi
call   1090 <close@plt>
lea    -0x2a0(%rbp),%rdi
lea    0xcfc(%rip),%rsi
call   1100 <strstr@plt>
add    $0x4,%rax
mov    %rax,-0x2b8(%rbp)
mov    -0x2b8(%rbp),%rsi
lea    0xcee(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x2b8(%rbp),%rdi
lea    0xcf3(%rip),%rsi
call   1100 <strstr@plt>
cmp    $0x0,%rax
je     143d <main+0x24d>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x2b8(%rbp),%rdi
lea    0xcd7(%rip),%rsi
call   1100 <strstr@plt>
mov    %rax,-0x2c0(%rbp)
cmpq   $0x0,-0x2c0(%rbp)
jne    146f <main+0x27f>
mov    $0x1,%edi
call   10e0 <exit@plt>
mov    -0x2c0(%rbp),%rax
add    $0xe,%rax
mov    %rax,-0x2c0(%rbp)
mov    -0x2c0(%rbp),%rdi
lea    0xca2(%rip),%rsi
call   1100 <strstr@plt>
mov    %rax,-0x2c8(%rbp)
mov    -0x2c8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x2c0(%rbp),%rdi
call   10c0 <atoi@plt>
mov    %eax,-0x2cc(%rbp)
mov    -0x2cc(%rbp),%edi
call   10e0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x298,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
xorps  %xmm0,%xmm0
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
lea    0x90(%rsp),%rdi
mov    $0x200,%edx
xor    %esi,%esi
call   10a0 <memset@plt>
cmp    $0x2,%ebp
jne    12ab <main+0x9b>
lea    0xd90(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
lea    0xd94(%rip),%rbp
cmovne %rax,%rbp
mov    %rbp,%rdi
call   1070 <strlen@plt>
cmp    $0x4,%eax
jb     12c1 <main+0xb1>
lea    0xd91(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
lea    0xe1a(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    0x2d20(%rip),%r15
mov    (%r15),%edi
mov    0x2d06(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1130 <socket@plt>
test   %eax,%eax
jns    12eb <main+0xdb>
lea    0xd66(%rip),%rdi
jmp    1379 <main+0x169>
mov    %eax,%r14d
mov    (%r15),%eax
mov    %eax,0xc(%rsp)
mov    %rbp,%rsi
call   1040 <strcpy@plt>
lea    0x8(%rsp),%rsi
mov    %r14d,%edi
mov    $0x8,%edx
call   1110 <connect@plt>
test   %rax,%rax
jns    131d <main+0x10d>
lea    0xd45(%rip),%rdi
jmp    1379 <main+0x169>
mov    0x8(%rbx),%rdx
lea    0xd3f(%rip),%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   10f0 <sprintf@plt>
mov    %rbx,%rdi
call   1070 <strlen@plt>
mov    %eax,%ebp
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1060 <write@plt>
cmp    %ebp,%eax
jne    1372 <main+0x162>
lea    0x90(%rsp),%rsi
mov    %r14d,%edi
mov    $0x200,%edx
call   10c0 <read@plt>
test   %eax,%eax
jns    1388 <main+0x178>
lea    0xd23(%rip),%rdi
jmp    1379 <main+0x169>
lea    0xd14(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    %r14d,%edi
call   10b0 <close@plt>
lea    0xcf1(%rip),%rsi
lea    0x90(%rsp),%rdi
call   1120 <strstr@plt>
mov    %rax,%rbx
add    $0x4,%rbx
lea    0xce6(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
lea    0xcef(%rip),%rsi
mov    %rbx,%rdi
call   1120 <strstr@plt>
test   %rax,%rax
jne    12a1 <main+0x91>
lea    0xce2(%rip),%rsi
mov    %rbx,%rdi
call   1120 <strstr@plt>
test   %rax,%rax
je     12a1 <main+0x91>
mov    %rax,%rbx
add    $0xe,%rbx
mov    %rbx,%rdi
mov    $0x7d,%esi
call   1080 <strchr@plt>
movb   $0x0,(%rax)
mov    %rbx,%rdi
call   10e0 <atoi@plt>
mov    %eax,%edi
call   1100 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_un = type { i32, i32 }
%struct.sockaddr = type { i32 }
@.str = [101 x i8] c"Usage: docker-wait CONTAINER\0A Block until a container stops, then returns its exit code.\0A\00"
@.str.1 = [19 x i8] c"DOCKER_SOCKET_PATH\00"
@.str.2 = [21 x i8] c"/var/run/docker.sock\00"
@.str.3 = [36 x i8] c"DOCKER_SOCKET_PATH is too long: %s\0A\00"
@AF_UNIX = global i32 0
@SOCK_STREAM = global i32 0
@.str.4 = [27 x i8] c"fail to open stream socket\00"
@.str.5 = [7 x i8] c"socket\00"
@.str.6 = [38 x i8] c"POST /containers/%s/wait HTTP/1.0\0D\0A\0D\0A\00"
@.str.7 = [6 x i8] c"write\00"
@.str.8 = [5 x i8] c"read\00"
@.str.9 = [5 x i8] c"\0D\0A\0D\0A\00"
@.str.10 = [26 x i8] c"docker wait response:\0A%s\0A\00"
@.str.11 = [11 x i8] c"no such id\00"
@.str.12 = [15 x i8] c"{\22StatusCode\22:\00"
@.str.13 = [2 x i8] c"}\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.sockaddr_un
%9 = alloca [128 x i8]
%10 = alloca [512 x i8]
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = bitcast [128 x i8]* %9 to i8*
%18 = bitcast [512 x i8]* %10 to i8*
%19 = load i32, i32* %4
%20 = icmp ne i32 %19, 2
br i1 %20, label %21, label %24
21: ; preds = %2
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([101 x i8], [101 x i8]* @.str, i64 0, i64 0))
%23 = call i32 @exit(i32 1)
unreachable
24: ; preds = %2
%25 = call i8* @getenv(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
store i8* %25, i8** %11
%26 = load i8*, i8** %11
%27 = icmp eq i8* %26, null
br i1 %27, label %28, label %29
28: ; preds = %24
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8** %11
br label %29
29: ; preds = %28, %24
%30 = load i8*, i8** %11
%31 = call i32 @strlen(i8* %30)
%32 = sext i32 %31 to i64
%33 = icmp uge i64 %32, 4
br i1 %33, label %34, label %38
34: ; preds = %29
%35 = load i8*, i8** %11
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i8* %35)
%37 = call i32 @exit(i32 1)
unreachable
38: ; preds = %29
%39 = load i32, i32* @AF_UNIX
%40 = load i32, i32* @SOCK_STREAM
%41 = call i32 @socket(i32 %39, i32 %40, i32 0)
store i32 %41, i32* %6
%42 = icmp slt i32 %41, 0
br i1 %42, label %43, label %46
43: ; preds = %38
%44 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%45 = call i32 @exit(i32 1)
unreachable
46: ; preds = %38
%47 = load i32, i32* @AF_UNIX
%48 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %8, i32 0, i32 1
store i32 %47, i32* %48
%49 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %8, i32 0, i32 0
%50 = load i32, i32* %49
%51 = load i8*, i8** %11
%52 = call i32 @strcpy(i32 %50, i8* %51)
%53 = load i32, i32* %6
%54 = bitcast %struct.sockaddr_un* %8 to %struct.sockaddr*
%55 = call i64 @connect(i32 %53, %struct.sockaddr* %54, i32 8)
%56 = icmp slt i64 %55, 0
br i1 %56, label %57, label %60
57: ; preds = %46
%58 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%59 = call i32 @exit(i32 1)
unreachable
60: ; preds = %46
%61 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%62 = load i8**, i8*** %5
%63 = getelementptr inbounds i8*, i8** %62, i64 1
%64 = load i8*, i8** %63
%65 = call i32 @sprintf(i8* %61, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0), i8* %64)
%66 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%67 = call i32 @strlen(i8* %66)
store i32 %67, i32* %12
%68 = load i32, i32* %6
%69 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%70 = load i32, i32* %12
%71 = call i32 @write(i32 %68, i8* %69, i32 %70)
store i32 %71, i32* %7
%72 = load i32, i32* %12
%73 = icmp ne i32 %71, %72
br i1 %73, label %74, label %77
74: ; preds = %60
%75 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%76 = call i32 @exit(i32 1)
unreachable
77: ; preds = %60
%78 = load i32, i32* %6
%79 = getelementptr inbounds [512 x i8], [512 x i8]* %10, i64 0, i64 0
%80 = call i32 @read(i32 %78, i8* %79, i32 512)
store i32 %80, i32* %7
%81 = icmp slt i32 %80, 0
br i1 %81, label %82, label %85
82: ; preds = %77
%83 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%84 = call i32 @exit(i32 1)
unreachable
85: ; preds = %77
%86 = load i32, i32* %6
%87 = call i32 @close(i32 %86)
%88 = getelementptr inbounds [512 x i8], [512 x i8]* %10, i64 0, i64 0
%89 = call i8* @strstr(i8* %88, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%90 = getelementptr inbounds i8, i8* %89, i64 4
store i8* %90, i8** %13
%91 = load i8*, i8** %13
%92 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0), i8* %91)
%93 = load i8*, i8** %13
%94 = call i8* @strstr(i8* %93, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0))
%95 = icmp ne i8* %94, null
br i1 %95, label %96, label %98
96: ; preds = %85
%97 = call i32 @exit(i32 1)
unreachable
98: ; preds = %85
%99 = load i8*, i8** %13
%100 = call i8* @strstr(i8* %99, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.12, i64 0, i64 0))
store i8* %100, i8** %14
%101 = load i8*, i8** %14
%102 = icmp eq i8* %101, null
br i1 %102, label %103, label %105
103: ; preds = %98
%104 = call i32 @exit(i32 1)
unreachable
105: ; preds = %98
%106 = load i8*, i8** %14
%107 = getelementptr inbounds i8, i8* %106, i64 14
store i8* %107, i8** %14
%108 = load i8*, i8** %14
%109 = call i8* @strstr(i8* %108, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0))
store i8* %109, i8** %15
%110 = load i8*, i8** %15
store i8 0, i8* %110
%111 = load i8*, i8** %14
%112 = call i32 @atoi(i8* %111)
store i32 %112, i32* %16
%113 = load i32, i32* %16
%114 = call i32 @exit(i32 %113)
unreachable
}

LLVM IR (-O2):
%struct.sockaddr_un = type { i32, i32 }
%struct.sockaddr = type { i32 }
@.str.1 = [19 x i8] c"DOCKER_SOCKET_PATH\00"
@.str.2 = [21 x i8] c"/var/run/docker.sock\00"
@.str.3 = [36 x i8] c"DOCKER_SOCKET_PATH is too long: %s\0A\00"
@AF_UNIX = global i32 0
@SOCK_STREAM = global i32 0
@.str.4 = [27 x i8] c"fail to open stream socket\00"
@.str.5 = [7 x i8] c"socket\00"
@.str.6 = [38 x i8] c"POST /containers/%s/wait HTTP/1.0\0D\0A\0D\0A\00"
@.str.7 = [6 x i8] c"write\00"
@.str.8 = [5 x i8] c"read\00"
@.str.9 = [5 x i8] c"\0D\0A\0D\0A\00"
@.str.10 = [26 x i8] c"docker wait response:\0A%s\0A\00"
@.str.11 = [11 x i8] c"no such id\00"
@.str.12 = [15 x i8] c"{\22StatusCode\22:\00"
@str = [100 x i8] c"Usage: docker-wait CONTAINER\0A Block until a container stops, then returns its exit code.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_un
%4 = alloca [128 x i8]
%5 = alloca [512 x i8]
%6 = bitcast %struct.sockaddr_un* %3 to i8*
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [512 x i8], [512 x i8]* %5, i64 0, i64 0
%9 = icmp eq i32 %0, 2
br i1 %9, label %13, label %10
10: ; preds = %2
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([100 x i8], [100 x i8]* @str, i64 0, i64 0))
%12 = tail call i32 @exit(i32 1)
unreachable
13: ; preds = %2
%14 = tail call i8* @getenv(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i8* %14, null
%16 = select i1 %15, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %14
%17 = tail call i32 @strlen(i8* %16)
%18 = icmp ugt i32 %17, 3
br i1 %18, label %19, label %22
19: ; preds = %13
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i8* %16)
%21 = tail call i32 @exit(i32 1)
unreachable
22: ; preds = %13
%23 = load i32, i32* @AF_UNIX
%24 = load i32, i32* @SOCK_STREAM
%25 = tail call i32 @socket(i32 %23, i32 %24, i32 0)
%26 = icmp slt i32 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %22
%28 = tail call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%29 = tail call i32 @exit(i32 1)
unreachable
30: ; preds = %22
%31 = load i32, i32* @AF_UNIX
%32 = getelementptr inbounds %struct.sockaddr_un, %struct.sockaddr_un* %3, i64 0, i32 1
store i32 %31, i32* %32
%33 = tail call i32 @strcpy(i32 undef, i8* %16)
%34 = bitcast %struct.sockaddr_un* %3 to %struct.sockaddr*
%35 = call i64 @connect(i32 %25, %struct.sockaddr* %34, i32 8)
%36 = icmp slt i64 %35, 0
br i1 %36, label %37, label %40
37: ; preds = %30
%38 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%39 = call i32 @exit(i32 1)
unreachable
40: ; preds = %30
%41 = getelementptr inbounds i8*, i8** %1, i64 1
%42 = load i8*, i8** %41
%43 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0), i8* %42)
%44 = call i32 @strlen(i8* %7)
%45 = call i32 @write(i32 %25, i8* %7, i32 %44)
%46 = icmp eq i32 %45, %44
br i1 %46, label %50, label %47
47: ; preds = %40
%48 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
%49 = call i32 @exit(i32 1)
unreachable
50: ; preds = %40
%51 = call i32 @read(i32 %25, i8* %8, i32 512)
%52 = icmp slt i32 %51, 0
br i1 %52, label %53, label %56
53: ; preds = %50
%54 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%55 = call i32 @exit(i32 1)
unreachable
56: ; preds = %50
%57 = call i32 @close(i32 %25)
%58 = call i8* @strstr(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%59 = getelementptr inbounds i8, i8* %58, i64 4
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0), i8* %59)
%61 = call i8* @strstr(i8* %59, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0))
%62 = icmp eq i8* %61, null
br i1 %62, label %65, label %63
63: ; preds = %56
%64 = call i32 @exit(i32 1)
unreachable
65: ; preds = %56
%66 = call i8* @strstr(i8* %59, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.12, i64 0, i64 0))
%67 = icmp eq i8* %66, null
br i1 %67, label %68, label %70
68: ; preds = %65
%69 = call i32 @exit(i32 1)
unreachable
70: ; preds = %65
%71 = getelementptr inbounds i8, i8* %66, i64 14
%72 = call i8* @strchr(i8* %71, i32 125)
store i8 0, i8* %72
%73 = call i32 @atoi(i8* %71)
%74 = call i32 @exit(i32 %73)
unreachable
}