#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 {
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ recv_buf;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_REUSEADDR;
int accept(int, struct sockaddr *, int *);
int atoi(char *);
scalar_t__ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ htons(int);
scalar_t__ listen(int, int);
int /*<<< orphan*/ memset(struct sockaddr_in *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *);
int recv(int, char *, int, int /*<<< orphan*/);
scalar_t__ send(int, char *, int, int /*<<< orphan*/);
scalar_t__ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, void *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
char toupper(char);
int main(int argc, char *argv[]) {
  struct sockaddr_in serv_addr;
  char recv_buf[1024];
  int sock_fd, conn_fd, ret, i, port, optval = 1;
  if (argc != 2) {
    printf("Usage: %s portnumber\n", argv[0]);
    return -1;
  }
  port = atoi(argv[1]);
  memset(&serv_addr, 0, sizeof(struct sockaddr_in));
  serv_addr.sin_family = AF_INET;
  serv_addr.sin_port = htons(port);
  serv_addr.sin_addr.s_addr = htonl(INADDR_ANY);
  if ((sock_fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
    perror("socket");
    return -1;
  }
  if ((setsockopt(sock_fd, SOL_SOCKET, SO_REUSEADDR, (void *)&optval,
                  sizeof(int))) < 0) {
    perror("setsockopt");
    goto err;
  }
  if ((bind(sock_fd, (struct sockaddr *)&serv_addr,
            sizeof(struct sockaddr_in))) < 0) {
    perror("bind");
    goto err;
  }
  if ((listen(sock_fd, 1)) < 0) {
    perror("listen");
    goto err;
  }
  socklen_t cli_len = sizeof(struct sockaddr_in);
  while (1) {
    if ((conn_fd = accept(sock_fd, (struct sockaddr *)&serv_addr, &cli_len)) <
        0) {
      perror("accept");
      return -1;
    }
    if ((ret = recv(conn_fd, recv_buf, 1024, 0)) < 0) {
      perror("recv");
      return -1;
    }
    printf("Receive data from client: %s\n", recv_buf);
    for (i = 0; i < ret; i++) {
      recv_buf[i] = toupper(recv_buf[i]);
    }
    if ((send(conn_fd, recv_buf, sizeof(recv_buf), 0)) < 0) {
      perror("send");
      return -1;
    }
    close(conn_fd);
  }
  close(conn_fd);
  close(sock_fd);
  return 0;
err:
  close(sock_fd);
  return -1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x440,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x438(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     123c <main+0x4c>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xdd5(%rip),%rdi
call   1080 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14b4 <main+0x2c4>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1100 <atoi@plt>
mov    %eax,-0x434(%rbp)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   10a0 <memset@plt>
mov    0x2d7a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x434(%rbp),%edi
call   1060 <htons@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2d58(%rip),%rax
mov    (%rax),%edi
call   1090 <htonl@plt>
mov    %eax,-0x20(%rbp)
mov    0x2d4f(%rip),%rax
mov    (%rax),%edi
mov    0x2d2e(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
mov    %eax,-0x424(%rbp)
cmp    $0x0,%eax
jge    12ca <main+0xda>
lea    0xd5d(%rip),%rdi
call   10e0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14b4 <main+0x2c4>
mov    -0x424(%rbp),%edi
mov    0x2d11(%rip),%rax
mov    (%rax),%esi
mov    0x2ce0(%rip),%rax
mov    (%rax),%edx
lea    -0x438(%rbp),%rcx
mov    $0x4,%r8d
call   1050 <setsockopt@plt>
cmp    $0x0,%rax
jge    130f <main+0x11f>
lea    0xd18(%rip),%rdi
call   10e0 <perror@plt>
jmp    14a2 <main+0x2b2>
mov    -0x424(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0xc,%edx
call   10d0 <bind@plt>
cmp    $0x0,%rax
jge    133e <main+0x14e>
lea    0xcf4(%rip),%rdi
call   10e0 <perror@plt>
jmp    14a2 <main+0x2b2>
mov    -0x424(%rbp),%edi
mov    $0x1,%esi
call   10c0 <listen@plt>
cmp    $0x0,%rax
jge    1369 <main+0x179>
lea    0xcce(%rip),%rdi
call   10e0 <perror@plt>
jmp    14a2 <main+0x2b2>
movl   $0xc,-0x43c(%rbp)
mov    -0x424(%rbp),%edi
lea    -0x20(%rbp),%rsi
lea    -0x43c(%rbp),%rdx
call   10f0 <accept@plt>
mov    %eax,-0x428(%rbp)
cmp    $0x0,%eax
jge    13b0 <main+0x1c0>
lea    0xc95(%rip),%rdi
call   10e0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14b4 <main+0x2c4>
mov    -0x428(%rbp),%edi
lea    -0x420(%rbp),%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x42c(%rbp)
cmp    $0x0,%eax
jge    13f0 <main+0x200>
lea    0xc5c(%rip),%rdi
call   10e0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14b4 <main+0x2c4>
lea    -0x420(%rbp),%rsi
lea    0xc42(%rip),%rdi
call   1080 <printf@plt>
movl   $0x0,-0x430(%rbp)
mov    -0x430(%rbp),%eax
cmp    -0x42c(%rbp),%eax
jge    1457 <main+0x267>
movslq -0x430(%rbp),%rax
movsbl -0x420(%rbp,%rax,1),%edi
ff
call   1040 <toupper@plt>
mov    %al,%cl
movslq -0x430(%rbp),%rax
mov    %cl,-0x420(%rbp,%rax,1)
mov    -0x430(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x430(%rbp)
jmp    140d <main+0x21d>
mov    -0x428(%rbp),%edi
lea    -0x420(%rbp),%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1070 <send@plt>
cmp    $0x0,%rax
jge    1492 <main+0x2a2>
lea    0xbdd(%rip),%rdi
call   10e0 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    14b4 <main+0x2c4>
mov    -0x428(%rbp),%edi
call   10b0 <close@plt>
jmp    1373 <main+0x183>
mov    -0x424(%rbp),%edi
call   10b0 <close@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x440,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x428,%rsp
movl   $0x1,0x1c(%rsp)
cmp    $0x2,%edi
je     1234 <main+0x44>
mov    (%rsi),%rsi
lea    0xde8(%rip),%rdi
call   1080 <printf@plt>
mov    $0xffffffff,%eax
add    $0x428,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x8(%rsi),%rdi
call   1100 <atoi@plt>
mov    %eax,%ebx
lea    0x10(%rsp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   10a0 <memset@plt>
mov    0x2d89(%rip),%rbp
mov    0x0(%rbp),%eax
mov    %eax,0x18(%rsp)
mov    %ebx,%edi
call   1060 <htons@plt>
mov    %eax,0x14(%rsp)
mov    0x2d68(%rip),%rax
mov    (%rax),%edi
call   1090 <htonl@plt>
mov    %eax,0x10(%rsp)
mov    0x0(%rbp),%edi
mov    0x2d43(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
test   %eax,%eax
jns    12a3 <main+0xb3>
lea    0xd7d(%rip),%rdi
call   10e0 <perror@plt>
jmp    121d <main+0x2d>
mov    %eax,%r15d
mov    0x2d3b(%rip),%rax
mov    (%rax),%esi
mov    0x2d0a(%rip),%rax
mov    (%rax),%edx
lea    0x1c(%rsp),%rcx
mov    %r15d,%edi
mov    $0x4,%r8d
call   1050 <setsockopt@plt>
test   %rax,%rax
jns    12d9 <main+0xe9>
lea    0xd46(%rip),%rdi
jmp    1312 <main+0x122>
lea    0x10(%rsp),%rsi
mov    %r15d,%edi
mov    $0xc,%edx
call   10d0 <bind@plt>
test   %rax,%rax
jns    12f9 <main+0x109>
lea    0xd31(%rip),%rdi
jmp    1312 <main+0x122>
mov    %r15d,%edi
mov    $0x1,%esi
call   10c0 <listen@plt>
test   %rax,%rax
jns    1324 <main+0x134>
lea    0xd1b(%rip),%rdi
call   10e0 <perror@plt>
mov    %r15d,%edi
call   10b0 <close@plt>
jmp    121d <main+0x2d>
movl   $0xc,0xc(%rsp)
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
mov    %r15d,%edi
call   10f0 <accept@plt>
test   %eax,%eax
js     13e3 <main+0x1f3>
mov    %eax,%r13d
lea    0x20(%rsp),%r12
xchg   %ax,%ax
mov    %r13d,%edi
mov    %r12,%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %eax,%eax
js     13ef <main+0x1ff>
mov    %eax,%r14d
lea    0xccc(%rip),%rdi
mov    %r12,%rsi
call   1080 <printf@plt>
test   %r14d,%r14d
je     13a7 <main+0x1b7>
mov    %r14d,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
movsbl 0x20(%rsp,%rbp,1),%edi
call   1040 <toupper@plt>
mov    %al,0x20(%rsp,%rbp,1)
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1390 <main+0x1a0>
mov    %r13d,%edi
mov    %r12,%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1070 <send@plt>
test   %rax,%rax
js     13fb <main+0x20b>
mov    %r13d,%edi
call   10b0 <close@plt>
mov    %r15d,%edi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   10f0 <accept@plt>
mov    %eax,%r13d
test   %eax,%eax
jns    1350 <main+0x160>
lea    0xc4a(%rip),%rdi
jmp    1299 <main+0xa9>
lea    0xc45(%rip),%rdi
jmp    1299 <main+0xa9>
lea    0xc5c(%rip),%rdi
jmp    1299 <main+0xa9>

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [22 x i8] c"Usage: %s portnumber\0A\00"
@AF_INET = global i32 0
@INADDR_ANY = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [7 x i8] c"socket\00"
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str.2 = [11 x i8] c"setsockopt\00"
@.str.3 = [5 x i8] c"bind\00"
@.str.4 = [7 x i8] c"listen\00"
@.str.5 = [7 x i8] c"accept\00"
@.str.6 = [5 x i8] c"recv\00"
@.str.7 = [30 x i8] c"Receive data from client: %s\0A\00"
@.str.8 = [5 x i8] c"send\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.sockaddr_in
%7 = alloca [1024 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %13
%15 = load i32, i32* %4
%16 = icmp ne i32 %15, 2
br i1 %16, label %17, label %22
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 0
%20 = load i8*, i8** %19
%21 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %20)
store i32 -1, i32* %3
br label %112
22: ; preds = %2
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i32 @atoi(i8* %25)
store i32 %26, i32* %12
%27 = call i32 @memset(%struct.sockaddr_in* %6, i32 0, i32 12)
%28 = load i32, i32* @AF_INET
%29 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 2
store i32 %28, i32* %29
%30 = load i32, i32* %12
%31 = call i32 @htons(i32 %30)
%32 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 1
store i32 %31, i32* %32
%33 = load i32, i32* @INADDR_ANY
%34 = call i32 @htonl(i32 %33)
%35 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 0
%36 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %35, i32 0, i32 0
store i32 %34, i32* %36
%37 = load i32, i32* @AF_INET
%38 = load i32, i32* @SOCK_STREAM
%39 = call i32 @socket(i32 %37, i32 %38, i32 0)
store i32 %39, i32* %8
%40 = icmp slt i32 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %22
%42 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %112
43: ; preds = %22
%44 = load i32, i32* %8
%45 = load i32, i32* @SOL_SOCKET
%46 = load i32, i32* @SO_REUSEADDR
%47 = bitcast i32* %13 to i8*
%48 = call i64 @setsockopt(i32 %44, i32 %45, i32 %46, i8* %47, i32 4)
%49 = icmp slt i64 %48, 0
br i1 %49, label %50, label %52
50: ; preds = %43
%51 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
br label %109
52: ; preds = %43
%53 = load i32, i32* %8
%54 = bitcast %struct.sockaddr_in* %6 to %struct.sockaddr*
%55 = call i64 @bind(i32 %53, %struct.sockaddr* %54, i32 12)
%56 = icmp slt i64 %55, 0
br i1 %56, label %57, label %59
57: ; preds = %52
%58 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %109
59: ; preds = %52
%60 = load i32, i32* %8
%61 = call i64 @listen(i32 %60, i32 1)
%62 = icmp slt i64 %61, 0
br i1 %62, label %63, label %65
63: ; preds = %59
%64 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %109
65: ; preds = %59
store i32 12, i32* %14
br label %66
66: ; preds = %65, %106
%67 = load i32, i32* %8
%68 = bitcast %struct.sockaddr_in* %6 to %struct.sockaddr*
%69 = call i32 @accept(i32 %67, %struct.sockaddr* %68, i32* %14)
store i32 %69, i32* %9
%70 = icmp slt i32 %69, 0
br i1 %70, label %71, label %73
71: ; preds = %66
%72 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
store i32 -1, i32* %3
br label %112
73: ; preds = %66
%74 = load i32, i32* %9
%75 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%76 = call i32 @recv(i32 %74, i8* %75, i32 1024, i32 0)
store i32 %76, i32* %10
%77 = icmp slt i32 %76, 0
br i1 %77, label %78, label %80
78: ; preds = %73
%79 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
store i32 -1, i32* %3
br label %112
80: ; preds = %73
%81 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%82 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), i8* %81)
store i32 0, i32* %11
br label %83
83: ; preds = %96, %80
%84 = load i32, i32* %11
%85 = load i32, i32* %10
%86 = icmp slt i32 %84, %85
br i1 %86, label %87, label %99
87: ; preds = %83
%88 = load i32, i32* %11
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 %89
%91 = load i8, i8* %90
%92 = call signext i8 @toupper(i8 signext %91)
%93 = load i32, i32* %11
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 %94
store i8 %92, i8* %95
br label %96
96: ; preds = %87
%97 = load i32, i32* %11
%98 = add nsw i32 %97, 1
store i32 %98, i32* %11
br label %83
99: ; preds = %83
%100 = load i32, i32* %9
%101 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%102 = call i64 @send(i32 %100, i8* %101, i32 1024, i32 0)
%103 = icmp slt i64 %102, 0
br i1 %103, label %104, label %106
104: ; preds = %99
%105 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
store i32 -1, i32* %3
br label %112
106: ; preds = %99
%107 = load i32, i32* %9
%108 = call i32 @close(i32 %107)
br label %66
109: ; preds = %63, %57, %50
%110 = load i32, i32* %8
%111 = call i32 @close(i32 %110)
store i32 -1, i32* %3
br label %112
112: ; preds = %109, %104, %78, %71, %41, %17
%113 = load i32, i32* %3
ret i32 %113
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [22 x i8] c"Usage: %s portnumber\0A\00"
@AF_INET = global i32 0
@INADDR_ANY = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [7 x i8] c"socket\00"
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str.2 = [11 x i8] c"setsockopt\00"
@.str.3 = [5 x i8] c"bind\00"
@.str.4 = [7 x i8] c"listen\00"
@.str.5 = [7 x i8] c"accept\00"
@.str.6 = [5 x i8] c"recv\00"
@.str.7 = [30 x i8] c"Receive data from client: %s\0A\00"
@.str.8 = [5 x i8] c"send\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca [1024 x i8]
%5 = alloca i32
%6 = alloca i32
%7 = bitcast %struct.sockaddr_in* %3 to i8*
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%9 = bitcast i32* %5 to i8*
store i32 1, i32* %5
%10 = icmp eq i32 %0, 2
br i1 %10, label %14, label %11
11: ; preds = %2
%12 = load i8*, i8** %1
%13 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %12)
br label %80
14: ; preds = %2
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = tail call i32 @atoi(i8* %16)
%18 = call i32 @memset(%struct.sockaddr_in* %3, i32 0, i32 12)
%19 = load i32, i32* @AF_INET
%20 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %19, i32* %20
%21 = call i32 @htons(i32 %17)
%22 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
store i32 %21, i32* %22
%23 = load i32, i32* @INADDR_ANY
%24 = call i32 @htonl(i32 %23)
%25 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0, i32 0
store i32 %24, i32* %25
%26 = load i32, i32* @AF_INET
%27 = load i32, i32* @SOCK_STREAM
%28 = call i32 @socket(i32 %26, i32 %27, i32 0)
%29 = icmp slt i32 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %14
%31 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %80
32: ; preds = %14
%33 = load i32, i32* @SOL_SOCKET
%34 = load i32, i32* @SO_REUSEADDR
%35 = call i64 @setsockopt(i32 %28, i32 %33, i32 %34, i8* %9, i32 4)
%36 = icmp slt i64 %35, 0
br i1 %36, label %76, label %37
37: ; preds = %32
%38 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%39 = call i64 @bind(i32 %28, %struct.sockaddr* %38, i32 12)
%40 = icmp slt i64 %39, 0
br i1 %40, label %76, label %41
41: ; preds = %37
%42 = call i64 @listen(i32 %28, i32 1)
%43 = icmp slt i64 %42, 0
br i1 %43, label %76, label %44
44: ; preds = %41
store i32 12, i32* %6
%45 = call i32 @accept(i32 %28, %struct.sockaddr* %38, i32* %6)
%46 = icmp slt i32 %45, 0
br i1 %46, label %47, label %49
47: ; preds = %72, %44
%48 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
br label %80
49: ; preds = %44, %72
%50 = phi i32 [ %74, %72 ], [ %45, %44 ]
%51 = call i32 @recv(i32 %50, i8* %8, i32 1024, i32 0)
%52 = icmp slt i32 %51, 0
br i1 %52, label %53, label %55
53: ; preds = %49
%54 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
br label %80
55: ; preds = %49
%56 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), i8* %8)
%57 = icmp eq i32 %51, 0
br i1 %57, label %67, label %58
58: ; preds = %55
%59 = zext i32 %51 to i64
br label %60
60: ; preds = %58, %60
%61 = phi i64 [ 0, %58 ], [ %65, %60 ]
%62 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 %61
%63 = load i8, i8* %62
%64 = call signext i8 @toupper(i8 signext %63)
store i8 %64, i8* %62
%65 = add nuw nsw i64 %61, 1
%66 = icmp eq i64 %65, %59
br i1 %66, label %67, label %60
67: ; preds = %60, %55
%68 = call i64 @send(i32 %50, i8* %8, i32 1024, i32 0)
%69 = icmp slt i64 %68, 0
br i1 %69, label %70, label %72
70: ; preds = %67
%71 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
br label %80
72: ; preds = %67
%73 = call i32 @close(i32 %50)
%74 = call i32 @accept(i32 %28, %struct.sockaddr* %38, i32* %6)
%75 = icmp slt i32 %74, 0
br i1 %75, label %47, label %49
76: ; preds = %41, %37, %32
%77 = phi i8* [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), %32 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), %37 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), %41 ]
%78 = call i32 @perror(i8* %77)
%79 = call i32 @close(i32 %28)
br label %80
80: ; preds = %76, %70, %53, %47, %30, %11
ret i32 -1
}