#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 /*<<< orphan*/ fd_set;

/* Variables and functions */
int /*<<< orphan*/ FD_CLR(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ close(int);
char *gettext(char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, int);
int recv(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ send_to_all(int, int, int, int, char *, int /*<<< orphan*/ *,
                               char *);
void send_recv(int i, fd_set *master, int sockfd, int fdmax, char *client) {
  int nbytes_recvd, j;
  char recv_buf[1024], buf[1024];
  if ((nbytes_recvd = recv(i, recv_buf, 1024, 0)) <= 0) {
    if (nbytes_recvd == 0) {
      printf(gettext("Socket %d desconectado\n"), i);
    } else {
      perror(gettext("Recibir"));
    }
    close(i);
    FD_CLR(i, master);
  } else {
    for (j = 0; j <= fdmax; j++) {
      send_to_all(j, i, sockfd, nbytes_recvd, recv_buf, master, client);
    }
  }
}


x86 assembly (clang, -O0):
<send_recv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x840,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x430(%rbp),%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x24(%rbp)
cmp    $0x0,%eax
jg     1201 <send_recv+0x91>
cmpl   $0x0,-0x24(%rbp)
jne    11d4 <send_recv+0x64>
lea    0xe41(%rip),%rdi
call   1050 <gettext@plt>
mov    %rax,%rdi
mov    -0x4(%rbp),%esi
call   1060 <printf@plt>
jmp    11e8 <send_recv+0x78>
lea    0xe3d(%rip),%rdi
call   1050 <gettext@plt>
mov    %rax,%rdi
call   1080 <perror@plt>
mov    -0x4(%rbp),%edi
call   1070 <close@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1090 <FD_CLR@plt>
jmp    124b <send_recv+0xdb>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     1246 <send_recv+0xd6>
mov    -0x28(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x24(%rbp),%ecx
lea    -0x430(%rbp),%r8
mov    -0x10(%rbp),%r9
mov    -0x20(%rbp),%rax
mov    %rax,(%rsp)
call   1040 <send_to_all@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1208 <send_recv+0x98>
jmp    124b <send_recv+0xdb>
add    $0x840,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_recv>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x418,%rsp
mov    %r8,%r12
mov    %ecx,0xc(%rsp)
mov    %edx,%ebp
mov    %rsi,%r14
mov    %edi,%r13d
lea    0x10(%rsp),%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %eax,%eax
jle    11e8 <send_recv+0x78>
cmpl   $0x0,0xc(%rsp)
js     1214 <send_recv+0xa4>
mov    %eax,%ebx
mov    %r14,%r15
addl   $0x1,0xc(%rsp)
xor    %r14d,%r14d
nopl   0x0(%rax)
mov    %r12,(%rsp)
mov    %r14d,%edi
mov    %r13d,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
lea    0x10(%rsp),%r8
mov    %r15,%r9
call   1040 <send_to_all@plt>
add    $0x1,%r14d
cmp    %r14d,0xc(%rsp)
jne    11c0 <send_recv+0x50>
jmp    1214 <send_recv+0xa4>
jne    1226 <send_recv+0xb6>
lea    0xe0f(%rip),%rdi
call   1050 <gettext@plt>
mov    %rax,%rdi
mov    %r13d,%esi
call   1060 <printf@plt>
mov    %r13d,%edi
call   1070 <close@plt>
mov    %r13d,%edi
mov    %r14,%rsi
call   1090 <FD_CLR@plt>
add    $0x418,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xdeb(%rip),%rdi
call   1050 <gettext@plt>
mov    %rax,%rdi
call   1080 <perror@plt>
jmp    1201 <send_recv+0x91>

LLVM IR (-O0):
@.str = [24 x i8] c"Socket %d desconectado\0A\00"
@.str.1 = [8 x i8] c"Recibir\00"
define void @send_recv(i32 %0, i32* %1, i32 %2, i32 %3, i8* %4) {
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca [1024 x i8]
%14 = alloca [1024 x i8]
store i32 %0, i32* %6
store i32* %1, i32** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i8* %4, i8** %10
%15 = load i32, i32* %6
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%17 = call i32 @recv(i32 %15, i8* %16, i32 1024, i32 0)
store i32 %17, i32* %11
%18 = icmp sle i32 %17, 0
br i1 %18, label %19, label %35
19: ; preds = %5
%20 = load i32, i32* %11
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %19
%23 = call i8* @gettext(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%24 = load i32, i32* %6
%25 = call i32 @printf(i8* %23, i32 %24)
br label %29
26: ; preds = %19
%27 = call i8* @gettext(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%28 = call i32 @perror(i8* %27)
br label %29
29: ; preds = %26, %22
%30 = load i32, i32* %6
%31 = call i32 @close(i32 %30)
%32 = load i32, i32* %6
%33 = load i32*, i32** %7
%34 = call i32 @FD_CLR(i32 %32, i32* %33)
br label %53
35: ; preds = %5
store i32 0, i32* %12
br label %36
36: ; preds = %49, %35
%37 = load i32, i32* %12
%38 = load i32, i32* %9
%39 = icmp sle i32 %37, %38
br i1 %39, label %40, label %52
40: ; preds = %36
%41 = load i32, i32* %12
%42 = load i32, i32* %6
%43 = load i32, i32* %8
%44 = load i32, i32* %11
%45 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%46 = load i32*, i32** %7
%47 = load i8*, i8** %10
%48 = call i32 @send_to_all(i32 %41, i32 %42, i32 %43, i32 %44, i8* %45, i32* %46, i8* %47)
br label %49
49: ; preds = %40
%50 = load i32, i32* %12
%51 = add nsw i32 %50, 1
store i32 %51, i32* %12
br label %36
52: ; preds = %36
br label %53
53: ; preds = %52, %29
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"Socket %d desconectado\0A\00"
@.str.1 = [8 x i8] c"Recibir\00"
define void @send_recv(i32 %0, i32* %1, i32 %2, i32 %3, i8* %4) {
%6 = alloca [1024 x i8]
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%8 = call i32 @recv(i32 %0, i8* %7, i32 1024, i32 0)
%9 = icmp slt i32 %8, 1
br i1 %9, label %12, label %10
10: ; preds = %5
%11 = icmp slt i32 %3, 0
br i1 %11, label %28, label %23
12: ; preds = %5
%13 = icmp eq i32 %8, 0
br i1 %13, label %14, label %17
14: ; preds = %12
%15 = call i8* @gettext(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @printf(i8* %15, i32 %0)
br label %20
17: ; preds = %12
%18 = call i8* @gettext(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%19 = call i32 @perror(i8* %18)
br label %20
20: ; preds = %17, %14
%21 = call i32 @close(i32 %0)
%22 = call i32 @FD_CLR(i32 %0, i32* %1)
br label %28
23: ; preds = %10, %23
%24 = phi i32 [ %26, %23 ], [ 0, %10 ]
%25 = call i32 @send_to_all(i32 %24, i32 %0, i32 %2, i32 %8, i8* %7, i32* %1, i8* %4)
%26 = add nuw i32 %24, 1
%27 = icmp eq i32 %24, %3
br i1 %27, label %28, label %23
28: ; preds = %23, %10, %20
ret void
}