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

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int receive_data(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ send_data(int, char *, int);
int receive(int fd) {
  char buf[64];
  int ret, i;
  while (1) {
    ret = receive_data(fd, buf, sizeof(buf), 0);
    if (ret > 0) {
      if (ret < 64)
        for (i = 1; i < 64; i++)
          buf[i] = buf[i] + 1;
      send_data(fd, buf, ret);
    } else {
      printf("No data\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<receive>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x50(%rbp),%rsi
mov    $0x40,%edx
xor    %ecx,%ecx
call   1030 <receive_data@plt>
mov    %eax,-0x54(%rbp)
cmpl   $0x0,-0x54(%rbp)
jle    11b3 <receive+0x83>
cmpl   $0x40,-0x54(%rbp)
jge    119f <receive+0x6f>
movl   $0x1,-0x58(%rbp)
cmpl   $0x40,-0x58(%rbp)
jge    119a <receive+0x6a>
movslq -0x58(%rbp),%rax
movsbl -0x50(%rbp,%rax,1),%eax
add    $0x1,%eax
mov    %al,%cl
movslq -0x58(%rbp),%rax
mov    %cl,-0x50(%rbp,%rax,1)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    116c <receive+0x3c>
jmp    119f <receive+0x6f>
mov    -0x4(%rbp),%edi
lea    -0x50(%rbp),%rsi
mov    -0x54(%rbp),%edx
call   1050 <send_data@plt>
jmp    11bf <receive+0x8f>
lea    0xe46(%rip),%rdi
call   1040 <printf@plt>
jmp    113b <receive+0xb>

x86 assembly (clang, -O2):
<receive>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
mov    %edi,%ebx
mov    %rsp,%r14
lea    0xebb(%rip),%r15
jmp    115c <receive+0x2c>
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edi
mov    %r14,%rsi
mov    %eax,%edx
call   1050 <send_data@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x40,%edx
xor    %ecx,%ecx
call   1030 <receive_data@plt>
test   %eax,%eax
jle    11f0 <receive+0xc0>
cmp    $0x3f,%eax
ja     1150 <receive+0x20>
movdqu 0x1(%rsp),%xmm0
movdqu 0x11(%rsp),%xmm1
movdqu 0x21(%rsp),%xmm2
pcmpeqd %xmm3,%xmm3
psubb  %xmm3,%xmm0
movdqu %xmm0,0x1(%rsp)
psubb  %xmm3,%xmm1
movdqu %xmm1,0x11(%rsp)
psubb  %xmm3,%xmm2
movdqu %xmm2,0x21(%rsp)
movq   0x31(%rsp),%xmm0
psubb  %xmm3,%xmm0
movq   %xmm0,0x31(%rsp)
addb   $0x1,0x39(%rsp)
addb   $0x1,0x3a(%rsp)
addb   $0x1,0x3b(%rsp)
addb   $0x1,0x3c(%rsp)
addb   $0x1,0x3d(%rsp)
addb   $0x1,0x3e(%rsp)
addb   $0x1,0x3f(%rsp)
jmp    1150 <receive+0x20>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r15,%rdi
call   1040 <puts@plt>
jmp    115c <receive+0x2c>

LLVM IR (-O0):
@.str = [9 x i8] c"No data\0A\00"
define i32 @receive(i32 %0) {
%2 = alloca i32
%3 = alloca [64 x i8]
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
br label %6
6: ; preds = %1, %41
%7 = load i32, i32* %2
%8 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%9 = call i32 @receive_data(i32 %7, i8* %8, i32 64, i32 0)
store i32 %9, i32* %4
%10 = load i32, i32* %4
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %39
12: ; preds = %6
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 64
br i1 %14, label %15, label %34
15: ; preds = %12
store i32 1, i32* %5
br label %16
16: ; preds = %30, %15
%17 = load i32, i32* %5
%18 = icmp slt i32 %17, 64
br i1 %18, label %19, label %33
19: ; preds = %16
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = add nsw i32 %24, 1
%26 = trunc i32 %25 to i8
%27 = load i32, i32* %5
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 %28
store i8 %26, i8* %29
br label %30
30: ; preds = %19
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 1
store i32 %32, i32* %5
br label %16
33: ; preds = %16
br label %34
34: ; preds = %33, %12
%35 = load i32, i32* %2
%36 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%37 = load i32, i32* %4
%38 = call i32 @send_data(i32 %35, i8* %36, i32 %37)
br label %41
39: ; preds = %6
%40 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %41
41: ; preds = %39, %34
br label %6
}

LLVM IR (-O2):
@str = [8 x i8] c"No data\00"
define i32 @receive(i32 %0) {
%2 = alloca [64 x i8]
%3 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 1
%5 = bitcast i8* %4 to <16 x i8>*
%6 = bitcast i8* %4 to <16 x i8>*
%7 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 17
%8 = bitcast i8* %7 to <16 x i8>*
%9 = bitcast i8* %7 to <16 x i8>*
%10 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 33
%11 = bitcast i8* %10 to <16 x i8>*
%12 = bitcast i8* %10 to <16 x i8>*
%13 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 49
%14 = bitcast i8* %13 to <8 x i8>*
%15 = bitcast i8* %13 to <8 x i8>*
%16 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 57
%17 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 58
%18 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 59
%19 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 60
%20 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 61
%21 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 62
%22 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 63
br label %23
23: ; preds = %55, %1
%24 = call i32 @receive_data(i32 %0, i8* %3, i32 64, i32 0)
%25 = icmp sgt i32 %24, 0
br i1 %25, label %26, label %53
26: ; preds = %23
%27 = icmp ult i32 %24, 64
br i1 %27, label %28, label %51
28: ; preds = %26
%29 = load <16 x i8>, <16 x i8>* %5
%30 = add <16 x i8> %29, <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>
store <16 x i8> %30, <16 x i8>* %6
%31 = load <16 x i8>, <16 x i8>* %8
%32 = add <16 x i8> %31, <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>
store <16 x i8> %32, <16 x i8>* %9
%33 = load <16 x i8>, <16 x i8>* %11
%34 = add <16 x i8> %33, <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>
store <16 x i8> %34, <16 x i8>* %12
%35 = load <8 x i8>, <8 x i8>* %14
%36 = add <8 x i8> %35, <i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1, i8 1>
store <8 x i8> %36, <8 x i8>* %15
%37 = load i8, i8* %16
%38 = add i8 %37, 1
store i8 %38, i8* %16
%39 = load i8, i8* %17
%40 = add i8 %39, 1
store i8 %40, i8* %17
%41 = load i8, i8* %18
%42 = add i8 %41, 1
store i8 %42, i8* %18
%43 = load i8, i8* %19
%44 = add i8 %43, 1
store i8 %44, i8* %19
%45 = load i8, i8* %20
%46 = add i8 %45, 1
store i8 %46, i8* %20
%47 = load i8, i8* %21
%48 = add i8 %47, 1
store i8 %48, i8* %21
%49 = load i8, i8* %22
%50 = add i8 %49, 1
store i8 %50, i8* %22
br label %51
51: ; preds = %28, %26
%52 = call i32 @send_data(i32 %0, i8* %3, i32 %24)
br label %55
53: ; preds = %23
%54 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
br label %55
55: ; preds = %53, %51
br label %23
}