#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 */
typedef int ssize_t;

/* Variables and functions */
int /*<<< orphan*/ BUFSIZ;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
char *malloc(int /*<<< orphan*/);
int recv(int, char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
char *recvMsg(int tracker_socket) {
  ssize_t recv_len;
  char *buffer = malloc(BUFSIZ);
  if ((recv_len = recv(tracker_socket, buffer, BUFSIZ, 0)) == -1) {
    fprintf(stderr, "[Error %s] ", strerror(errno));
    fprintf(stderr, "Error receiving data socket. Please try again later.\n");
  }
  return buffer;
}


x86 assembly (clang, -O0):
<recvMsg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    0x2e6d(%rip),%rax
mov    (%rax),%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x8(%rbp)
cmp    $0xffffffff,%eax
jne    11c5 <recvMsg+0x85>
mov    0x2e59(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    0x2e3d(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
mov    -0x14(%rbp),%edi
mov    %rax,%rdx
lea    0xe59(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e2b(%rip),%rax
mov    (%rax),%edi
lea    0xe4e(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<recvMsg>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebp
mov    0x2e8b(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%edi
call   1050 <malloc@plt>
mov    %rax,%r14
mov    %ebp,%edi
mov    %rax,%rsi
mov    %ebx,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
cmp    $0xffffffff,%eax
jne    11a8 <recvMsg+0x68>
mov    0x2e6d(%rip),%rbp
mov    0x0(%rbp),%ebx
mov    0x2e53(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
lea    0xe75(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x0(%rbp),%edi
lea    0xe6b(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@BUFSIZ = global i32 0
@stderr = global i32 0
@.str = [12 x i8] c"[Error %s] \00"
@errno = global i32 0
@.str.1 = [54 x i8] c"Error receiving data socket. Please try again later.\0A\00"
define i8* @recvMsg(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %2
%5 = load i32, i32* @BUFSIZ
%6 = call i8* @malloc(i32 %5)
store i8* %6, i8** %4
%7 = load i32, i32* %2
%8 = load i8*, i8** %4
%9 = load i32, i32* @BUFSIZ
%10 = call i32 @recv(i32 %7, i8* %8, i32 %9, i32 0)
store i32 %10, i32* %3
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %19
12: ; preds = %1
%13 = load i32, i32* @stderr
%14 = load i32, i32* @errno
%15 = call i8* @strerror(i32 %14)
%16 = call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = load i32, i32* @stderr
%18 = call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0))
br label %19
19: ; preds = %12, %1
%20 = load i8*, i8** %4
ret i8* %20
}

LLVM IR (-O2):
@BUFSIZ = global i32 0
@stderr = global i32 0
@.str = [12 x i8] c"[Error %s] \00"
@errno = global i32 0
@.str.1 = [54 x i8] c"Error receiving data socket. Please try again later.\0A\00"
define i8* @recvMsg(i32 %0) {
%2 = load i32, i32* @BUFSIZ
%3 = tail call i8* @malloc(i32 %2)
%4 = tail call i32 @recv(i32 %0, i8* %3, i32 %2, i32 0)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %13
6: ; preds = %1
%7 = load i32, i32* @stderr
%8 = load i32, i32* @errno
%9 = tail call i8* @strerror(i32 %8)
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = load i32, i32* @stderr
%12 = tail call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %6, %1
ret i8* %3
}