#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_in {
  int /*<<< orphan*/ sin_addr;
  int /*<<< orphan*/ member_0;
  int /*<<< orphan*/ member_1;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ server_addr;
typedef int /*<<< orphan*/ client_addr;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, struct sockaddr *, int *);
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
int fork();
int /*<<< orphan*/ htons(int);
int listen(int, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int read(int, char *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ unlink(int /*<<< orphan*/);
int /*<<< orphan*/ write(int, char *, int);
int main() {
  int sd, ns, k, pid;
  struct sockaddr_in server_addr = {AF_INET, htons(7777)};
  struct sockaddr_in client_addr = {AF_INET};
  int client_len = sizeof(client_addr);
  char buf[1024], *host;
  if ((sd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
    perror("server: socket failed");
    exit(1);
  }
  if (bind(sd, (struct sockaddr *)&server_addr, sizeof(server_addr)) == -1) {
    perror("server: bind failed");
    exit(1);
  }
  if (listen(sd, 1) == -1) {
    perror("server: listen failed");
    exit(1);
  }
  printf("SERVER is listening for clients to establish a connection\n");
  if ((pid = fork()) == 0) {
    if ((ns = accept(sd, (struct sockaddr *)&client_addr, &client_len)) == -1) {
      perror("server: accept failed");
      exit(1);
    }
    printf("Child accept() successful.. a client has connected to child ! "
           "waiting for a message\n");
    while ((k = read(ns, buf, sizeof(buf))) != 0) {
      printf("SERVER(Child) RECEIVED: %s\n", buf);
      write(ns, buf, k);
    }
    close(ns);
    close(sd);
  } else {
    if ((ns = accept(sd, (struct sockaddr *)&client_addr, &client_len)) == -1) {
      perror("server: accept failed");
      exit(1);
    }
    printf("Parent accept() successful.. a client has connected to Parent! "
           "waiting for a message\n");
    while ((k = read(ns, buf, sizeof(buf))) != 0) {
      printf("SERVER(Parent) RECEIVED: %s\n", buf);
      write(ns, buf, k);
    }
    close(ns);
    close(sd);
  }
  unlink(server_addr.sin_addr);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x450,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2dff(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    $0x1e61,%edi
call   1050 <htons@plt>
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
mov    0x2ddf(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0xc,-0x34(%rbp)
mov    0x2dbe(%rip),%rax
mov    (%rax),%edi
mov    0x2da5(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10f0 <socket@plt>
mov    %eax,-0x8(%rbp)
cmp    $0xffffffff,%eax
jne    125e <main+0x8e>
lea    0xdb1(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x8(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0xc,%edx
call   10a0 <bind@plt>
cmp    $0xffffffff,%eax
jne    128e <main+0xbe>
lea    0xd97(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x8(%rbp),%edi
mov    $0x1,%esi
call   1090 <listen@plt>
cmp    $0xffffffff,%eax
jne    12ba <main+0xea>
lea    0xd7f(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
lea    0xd7f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   10e0 <fork@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jne    137c <main+0x1ac>
mov    -0x8(%rbp),%edi
lea    -0x30(%rbp),%rsi
lea    -0x34(%rbp),%rdx
call   10c0 <accept@plt>
mov    %eax,-0xc(%rbp)
cmp    $0xffffffff,%eax
jne    130d <main+0x13d>
lea    0xd7d(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
lea    0xd7d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0xc(%rbp),%edi
lea    -0x440(%rbp),%rsi
mov    $0x400,%edx
call   1080 <read@plt>
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
je     1367 <main+0x197>
lea    -0x440(%rbp),%rsi
lea    0xd9d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0xc(%rbp),%edi
lea    -0x440(%rbp),%rsi
mov    -0x10(%rbp),%edx
call   1040 <write@plt>
jmp    131b <main+0x14b>
mov    -0xc(%rbp),%edi
call   1070 <close@plt>
mov    -0x8(%rbp),%edi
call   1070 <close@plt>
jmp    1418 <main+0x248>
mov    -0x8(%rbp),%edi
lea    -0x30(%rbp),%rsi
lea    -0x34(%rbp),%rdx
call   10c0 <accept@plt>
mov    %eax,-0xc(%rbp)
cmp    $0xffffffff,%eax
jne    13ae <main+0x1de>
lea    0xcdc(%rip),%rdi
call   10b0 <perror@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
lea    0xd4d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0xc(%rbp),%edi
lea    -0x440(%rbp),%rsi
mov    $0x400,%edx
call   1080 <read@plt>
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
je     1408 <main+0x238>
lea    -0x440(%rbp),%rsi
lea    0xd6e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0xc(%rbp),%edi
lea    -0x440(%rbp),%rsi
mov    -0x10(%rbp),%edx
call   1040 <write@plt>
jmp    13bc <main+0x1ec>
mov    -0xc(%rbp),%edi
call   1070 <close@plt>
mov    -0x8(%rbp),%edi
call   1070 <close@plt>
mov    -0x20(%rbp),%edi
call   1030 <unlink@plt>
xor    %eax,%eax
add    $0x450,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x438,%rsp
mov    0x2df0(%rip),%rbx
mov    (%rbx),%eax
mov    %eax,0x10(%rsp)
mov    $0x1e61,%edi
call   1060 <htons@plt>
mov    %eax,0x14(%rsp)
movl   $0x0,0x18(%rsp)
mov    (%rbx),%edi
mov    %edi,0x20(%rsp)
movq   $0x0,0x24(%rsp)
movl   $0xc,0xc(%rsp)
mov    0x2da6(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1100 <socket@plt>
cmp    $0xffffffff,%eax
je     13bd <main+0x1dd>
mov    %eax,%r14d
lea    0x10(%rsp),%rsi
mov    %eax,%edi
mov    $0xc,%edx
call   10b0 <bind@plt>
cmp    $0xffffffff,%eax
je     13c6 <main+0x1e6>
mov    %r14d,%edi
mov    $0x1,%esi
call   10a0 <listen@plt>
cmp    $0xffffffff,%eax
je     13cf <main+0x1ef>
lea    0xe11(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   10f0 <fork@plt>
mov    %eax,%ebx
lea    0x20(%rsp),%rsi
lea    0xc(%rsp),%rdx
mov    %r14d,%edi
call   10d0 <accept@plt>
mov    %eax,%r13d
test   %ebx,%ebx
je     1322 <main+0x142>
cmp    $0xffffffff,%r13d
je     13d8 <main+0x1f8>
lea    0xe13(%rip),%rdi
call   1040 <puts@plt>
lea    0x30(%rsp),%rsi
mov    %r13d,%edi
mov    $0x400,%edx
call   1090 <read@plt>
test   %eax,%eax
je     1390 <main+0x1b0>
mov    %eax,%ebp
lea    0xd94(%rip),%r15
lea    0x30(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r13d,%edi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1050 <write@plt>
mov    %r13d,%edi
mov    %rbx,%rsi
mov    $0x400,%edx
call   1090 <read@plt>
mov    %eax,%ebp
test   %eax,%eax
jne    12f0 <main+0x110>
jmp    1390 <main+0x1b0>
cmp    $0xffffffff,%r13d
je     13d8 <main+0x1f8>
lea    0xdeb(%rip),%rdi
call   1040 <puts@plt>
lea    0x30(%rsp),%rsi
mov    %r13d,%edi
mov    $0x400,%edx
call   1090 <read@plt>
test   %eax,%eax
je     1390 <main+0x1b0>
mov    %eax,%ebx
lea    0xcff(%rip),%r15
lea    0x30(%rsp),%r12
nopl   0x0(%rax)
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r13d,%edi
mov    %r12,%rsi
mov    %ebx,%edx
call   1050 <write@plt>
mov    %r13d,%edi
mov    %r12,%rsi
mov    $0x400,%edx
call   1090 <read@plt>
mov    %eax,%ebx
test   %eax,%eax
jne    1360 <main+0x180>
mov    %r13d,%edi
call   1080 <close@plt>
mov    %r14d,%edi
call   1080 <close@plt>
mov    0x10(%rsp),%edi
call   1030 <unlink@plt>
xor    %eax,%eax
add    $0x438,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc3c(%rip),%rdi
jmp    13df <main+0x1ff>
lea    0xc49(%rip),%rdi
jmp    13df <main+0x1ff>
lea    0xc54(%rip),%rdi
jmp    13df <main+0x1ff>
lea    0xc61(%rip),%rdi
call   10c0 <perror@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [22 x i8] c"server: socket failed\00"
@.str.1 = [20 x i8] c"server: bind failed\00"
@.str.2 = [22 x i8] c"server: listen failed\00"
@.str.3 = [59 x i8] c"SERVER is listening for clients to establish a connection\0A\00"
@.str.4 = [22 x i8] c"server: accept failed\00"
@.str.5 = [85 x i8] c"Child accept() successful.. a client has connected to child ! waiting for a message\0A\00"
@.str.6 = [28 x i8] c"SERVER(Child) RECEIVED: %s\0A\00"
@.str.7 = [86 x i8] c"Parent accept() successful.. a client has connected to Parent! waiting for a message\0A\00"
@.str.8 = [29 x i8] c"SERVER(Parent) RECEIVED: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.sockaddr_in
%7 = alloca %struct.sockaddr_in
%8 = alloca i32
%9 = alloca [1024 x i8]
%10 = alloca i8*
store i32 0, i32* %1
%11 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 0
%12 = load i32, i32* @AF_INET
store i32 %12, i32* %11
%13 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 1
%14 = call i32 @htons(i32 7777)
store i32 %14, i32* %13
%15 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 2
store i32 0, i32* %15
%16 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 0
%17 = load i32, i32* @AF_INET
store i32 %17, i32* %16
%18 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 1
store i32 0, i32* %18
%19 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 2
store i32 0, i32* %19
store i32 12, i32* %8
%20 = load i32, i32* @AF_INET
%21 = load i32, i32* @SOCK_STREAM
%22 = call i32 @socket(i32 %20, i32 %21, i32 0)
store i32 %22, i32* %2
%23 = icmp eq i32 %22, -1
br i1 %23, label %24, label %27
24: ; preds = %0
%25 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%26 = call i32 @exit(i32 1)
unreachable
27: ; preds = %0
%28 = load i32, i32* %2
%29 = bitcast %struct.sockaddr_in* %6 to %struct.sockaddr*
%30 = call i32 @bind(i32 %28, %struct.sockaddr* %29, i32 12)
%31 = icmp eq i32 %30, -1
br i1 %31, label %32, label %35
32: ; preds = %27
%33 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%34 = call i32 @exit(i32 1)
unreachable
35: ; preds = %27
%36 = load i32, i32* %2
%37 = call i32 @listen(i32 %36, i32 1)
%38 = icmp eq i32 %37, -1
br i1 %38, label %39, label %42
39: ; preds = %35
%40 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%41 = call i32 @exit(i32 1)
unreachable
42: ; preds = %35
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0))
%44 = call i32 (...) @fork()
store i32 %44, i32* %5
%45 = icmp eq i32 %44, 0
br i1 %45, label %46, label %73
46: ; preds = %42
%47 = load i32, i32* %2
%48 = bitcast %struct.sockaddr_in* %7 to %struct.sockaddr*
%49 = call i32 @accept(i32 %47, %struct.sockaddr* %48, i32* %8)
store i32 %49, i32* %3
%50 = icmp eq i32 %49, -1
br i1 %50, label %51, label %54
51: ; preds = %46
%52 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
%53 = call i32 @exit(i32 1)
unreachable
54: ; preds = %46
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str.5, i64 0, i64 0))
br label %56
56: ; preds = %61, %54
%57 = load i32, i32* %3
%58 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%59 = call i32 @read(i32 %57, i8* %58, i32 1024)
store i32 %59, i32* %4
%60 = icmp ne i32 %59, 0
br i1 %60, label %61, label %68
61: ; preds = %56
%62 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i8* %62)
%64 = load i32, i32* %3
%65 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%66 = load i32, i32* %4
%67 = call i32 @write(i32 %64, i8* %65, i32 %66)
br label %56
68: ; preds = %56
%69 = load i32, i32* %3
%70 = call i32 @close(i32 %69)
%71 = load i32, i32* %2
%72 = call i32 @close(i32 %71)
br label %100
73: ; preds = %42
%74 = load i32, i32* %2
%75 = bitcast %struct.sockaddr_in* %7 to %struct.sockaddr*
%76 = call i32 @accept(i32 %74, %struct.sockaddr* %75, i32* %8)
store i32 %76, i32* %3
%77 = icmp eq i32 %76, -1
br i1 %77, label %78, label %81
78: ; preds = %73
%79 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
%80 = call i32 @exit(i32 1)
unreachable
81: ; preds = %73
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str.7, i64 0, i64 0))
br label %83
83: ; preds = %88, %81
%84 = load i32, i32* %3
%85 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%86 = call i32 @read(i32 %84, i8* %85, i32 1024)
store i32 %86, i32* %4
%87 = icmp ne i32 %86, 0
br i1 %87, label %88, label %95
88: ; preds = %83
%89 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0), i8* %89)
%91 = load i32, i32* %3
%92 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%93 = load i32, i32* %4
%94 = call i32 @write(i32 %91, i8* %92, i32 %93)
br label %83
95: ; preds = %83
%96 = load i32, i32* %3
%97 = call i32 @close(i32 %96)
%98 = load i32, i32* %2
%99 = call i32 @close(i32 %98)
br label %100
100: ; preds = %95, %68
%101 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 0
%102 = load i32, i32* %101
%103 = call i32 @unlink(i32 %102)
ret i32 0
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [22 x i8] c"server: socket failed\00"
@.str.1 = [20 x i8] c"server: bind failed\00"
@.str.2 = [22 x i8] c"server: listen failed\00"
@.str.4 = [22 x i8] c"server: accept failed\00"
@.str.6 = [28 x i8] c"SERVER(Child) RECEIVED: %s\0A\00"
@.str.8 = [29 x i8] c"SERVER(Parent) RECEIVED: %s\0A\00"
@str = [58 x i8] c"SERVER is listening for clients to establish a connection\00"
@str.9 = [85 x i8] c"Parent accept() successful.. a client has connected to Parent! waiting for a message\00"
@str.10 = [84 x i8] c"Child accept() successful.. a client has connected to child ! waiting for a message\00"
define i32 @main() {
%1 = alloca %struct.sockaddr_in
%2 = alloca %struct.sockaddr_in
%3 = alloca i32
%4 = alloca [1024 x i8]
%5 = bitcast %struct.sockaddr_in* %1 to i8*
%6 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 0
%7 = load i32, i32* @AF_INET
store i32 %7, i32* %6
%8 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 1
%9 = tail call i32 @htons(i32 7777)
store i32 %9, i32* %8
%10 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 2
store i32 0, i32* %10
%11 = bitcast %struct.sockaddr_in* %2 to i8*
%12 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 0
%13 = load i32, i32* @AF_INET
store i32 %13, i32* %12
%14 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 1
store i32 0, i32* %14
%15 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 2
store i32 0, i32* %15
%16 = bitcast i32* %3 to i8*
store i32 12, i32* %3
%17 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%18 = load i32, i32* @SOCK_STREAM
%19 = tail call i32 @socket(i32 %13, i32 %18, i32 0)
%20 = icmp eq i32 %19, -1
br i1 %20, label %21, label %24
21: ; preds = %0
%22 = tail call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%23 = tail call i32 @exit(i32 1)
unreachable
24: ; preds = %0
%25 = bitcast %struct.sockaddr_in* %1 to %struct.sockaddr*
%26 = call i32 @bind(i32 %19, %struct.sockaddr* %25, i32 12)
%27 = icmp eq i32 %26, -1
br i1 %27, label %28, label %31
28: ; preds = %24
%29 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%30 = call i32 @exit(i32 1)
unreachable
31: ; preds = %24
%32 = call i32 @listen(i32 %19, i32 1)
%33 = icmp eq i32 %32, -1
br i1 %33, label %34, label %37
34: ; preds = %31
%35 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%36 = call i32 @exit(i32 1)
unreachable
37: ; preds = %31
%38 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @str, i64 0, i64 0))
%39 = call i32 (...) @fork()
%40 = icmp eq i32 %39, 0
%41 = bitcast %struct.sockaddr_in* %2 to %struct.sockaddr*
%42 = call i32 @accept(i32 %19, %struct.sockaddr* %41, i32* %3)
%43 = icmp eq i32 %42, -1
br i1 %40, label %44, label %58
44: ; preds = %37
br i1 %43, label %45, label %48
45: ; preds = %44
%46 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
%47 = call i32 @exit(i32 1)
unreachable
48: ; preds = %44
%49 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([84 x i8], [84 x i8]* @str.10, i64 0, i64 0))
%50 = call i32 @read(i32 %42, i8* %17, i32 1024)
%51 = icmp eq i32 %50, 0
br i1 %51, label %72, label %52
52: ; preds = %48, %52
%53 = phi i32 [ %56, %52 ], [ %50, %48 ]
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i8* %17)
%55 = call i32 @write(i32 %42, i8* %17, i32 %53)
%56 = call i32 @read(i32 %42, i8* %17, i32 1024)
%57 = icmp eq i32 %56, 0
br i1 %57, label %72, label %52
58: ; preds = %37
br i1 %43, label %59, label %62
59: ; preds = %58
%60 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
%61 = call i32 @exit(i32 1)
unreachable
62: ; preds = %58
%63 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([85 x i8], [85 x i8]* @str.9, i64 0, i64 0))
%64 = call i32 @read(i32 %42, i8* %17, i32 1024)
%65 = icmp eq i32 %64, 0
br i1 %65, label %72, label %66
66: ; preds = %62, %66
%67 = phi i32 [ %70, %66 ], [ %64, %62 ]
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0), i8* %17)
%69 = call i32 @write(i32 %42, i8* %17, i32 %67)
%70 = call i32 @read(i32 %42, i8* %17, i32 1024)
%71 = icmp eq i32 %70, 0
br i1 %71, label %72, label %66
72: ; preds = %66, %52, %62, %48
%73 = call i32 @close(i32 %42)
%74 = call i32 @close(i32 %19)
%75 = load i32, i32* %6
%76 = call i32 @unlink(i32 %75)
ret i32 0
}