#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;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ sin;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ connect(int, struct sockaddr *, int);
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, int);
int /*<<< orphan*/ recv(int, char *, size_t, int /*<<< orphan*/);
int /*<<< orphan*/ server_send(char *);
int /*<<< orphan*/ sleep(int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int strlen(char *);
int execute_recv() {
  char *message = "Message to be received.";
  size_t messagelen = strlen(message) + 1;
  server_send(message);
  int sfd = socket(AF_INET, SOCK_STREAM, 0);
  struct sockaddr_in sin;
  memset((void *)&sin, 0, sizeof(sin));
  sin.sin_family = AF_INET;
  sin.sin_addr.s_addr = htonl(INADDR_ANY);
  sin.sin_port = htons(25588);
  socklen_t sin_len = sizeof(struct sockaddr);
  connect(sfd, (struct sockaddr *)&sin, sin_len);
  char line[messagelen];
  recv(sfd, line, messagelen, 0);
  sleep(3);
  return 0;
}


x86 assembly (clang, -O0):
<execute_recv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    0xe61(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1090 <server_send@plt>
mov    0x2e23(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    (%rax),%edi
mov    0x2dfe(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
mov    %edx,-0x4c(%rbp)
call   10b0 <socket@plt>
mov    -0x4c(%rbp),%esi
mov    %eax,-0x14(%rbp)
lea    -0x20(%rbp),%rdi
mov    %rdi,-0x40(%rbp)
mov    $0xc,%edx
call   1070 <memset@plt>
mov    -0x48(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    0x2dda(%rip),%rax
mov    (%rax),%edi
call   1060 <htonl@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x63f4,%edi
call   1050 <htons@plt>
mov    -0x40(%rbp),%rsi
mov    %eax,-0x20(%rbp)
movl   $0x4,-0x24(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x24(%rbp),%edx
call   1080 <connect@plt>
mov    -0x10(%rbp),%rax
mov    %rsp,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rsi
sub    %rcx,%rsi
mov    %rsi,%rsp
mov    %rax,-0x38(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rdx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    $0x3,%edi
call   10a0 <sleep@plt>
mov    -0x30(%rbp),%rax
mov    %rax,%rsp
xor    %eax,%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<execute_recv>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xe58(%rip),%r15
mov    %r15,%rdi
call   1040 <strlen@plt>
movslq %eax,%rbx
lea    0x1(%rbx),%r14
mov    %r15,%rdi
call   1090 <server_send@plt>
mov    0x2e22(%rip),%r13
mov    0x0(%r13),%edi
mov    0x2dff(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10b0 <socket@plt>
mov    %eax,%r12d
lea    -0x38(%rbp),%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1070 <memset@plt>
mov    0x0(%r13),%eax
mov    %eax,-0x30(%rbp)
mov    0x2de2(%rip),%rax
mov    (%rax),%edi
call   1060 <htonl@plt>
mov    %eax,-0x34(%rbp)
mov    $0x63f4,%edi
call   1050 <htons@plt>
mov    %eax,-0x38(%rbp)
mov    %r12d,%edi
mov    %r15,%rsi
mov    $0x4,%edx
call   1080 <connect@plt>
mov    %rsp,%r15
mov    %rsp,%rsi
add    $0x10,%rbx
and    $0xfffffffffffffff0,%rbx
sub    %rbx,%rsi
mov    %rsi,%rsp
mov    %r12d,%edi
mov    %r14,%rdx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    $0x3,%edi
call   10a0 <sleep@plt>
mov    %r15,%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [24 x i8] c"Message to be received.\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@INADDR_ANY = global i32 0
define i32 @execute_recv() {
%1 = alloca i8*
%2 = alloca i64
%3 = alloca i32
%4 = alloca %struct.sockaddr_in
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
store i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8** %1
%8 = load i8*, i8** %1
%9 = call i32 @strlen(i8* %8)
%10 = add nsw i32 %9, 1
%11 = sext i32 %10 to i64
store i64 %11, i64* %2
%12 = load i8*, i8** %1
%13 = call i32 @server_send(i8* %12)
%14 = load i32, i32* @AF_INET
%15 = load i32, i32* @SOCK_STREAM
%16 = call i32 @socket(i32 %14, i32 %15, i32 0)
store i32 %16, i32* %3
%17 = bitcast %struct.sockaddr_in* %4 to i8*
%18 = call i32 @memset(i8* %17, i32 0, i32 12)
%19 = load i32, i32* @AF_INET
%20 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 2
store i32 %19, i32* %20
%21 = load i32, i32* @INADDR_ANY
%22 = call i32 @htonl(i32 %21)
%23 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 1
%24 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %23, i32 0, i32 0
store i32 %22, i32* %24
%25 = call i32 @htons(i32 25588)
%26 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 0
store i32 %25, i32* %26
store i32 4, i32* %5
%27 = load i32, i32* %3
%28 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%29 = load i32, i32* %5
%30 = call i32 @connect(i32 %27, %struct.sockaddr* %28, i32 %29)
%31 = load i64, i64* %2
%32 = call i8* @llvm.stacksave()
store i8* %32, i8** %6
%33 = alloca i8, i64 %31
store i64 %31, i64* %7
%34 = load i32, i32* %3
%35 = load i64, i64* %2
%36 = call i32 @recv(i32 %34, i8* %33, i64 %35, i32 0)
%37 = call i32 @sleep(i32 3)
%38 = load i8*, i8** %6
ret i32 0
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [24 x i8] c"Message to be received.\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@INADDR_ANY = global i32 0
define i32 @execute_recv() {
%1 = alloca %struct.sockaddr_in
%2 = tail call i32 @strlen(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%3 = add nsw i32 %2, 1
%4 = sext i32 %3 to i64
%5 = tail call i32 @server_send(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @AF_INET
%7 = load i32, i32* @SOCK_STREAM
%8 = tail call i32 @socket(i32 %6, i32 %7, i32 0)
%9 = bitcast %struct.sockaddr_in* %1 to i8*
%10 = call i32 @memset(i8* %9, i32 0, i32 12)
%11 = load i32, i32* @AF_INET
%12 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 2
store i32 %11, i32* %12
%13 = load i32, i32* @INADDR_ANY
%14 = call i32 @htonl(i32 %13)
%15 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 1, i32 0
store i32 %14, i32* %15
%16 = call i32 @htons(i32 25588)
%17 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 0
store i32 %16, i32* %17
%18 = bitcast %struct.sockaddr_in* %1 to %struct.sockaddr*
%19 = call i32 @connect(i32 %8, %struct.sockaddr* %18, i32 4)
%20 = call i8* @llvm.stacksave()
%21 = alloca i8, i64 %4
%22 = call i32 @recv(i32 %8, i8* %21, i64 %4, i32 0)
%23 = call i32 @sleep(i32 3)
ret i32 0
}