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

/* Variables and functions */
int /*<<< orphan*/ SHUT_RDWR;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int recv(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ shutdown(int, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void read_data_and_drop(int source_sock) {
  fprintf(stderr, "READ DATA AND DROP \n");
  char buffer[1024];
  int n;
  while ((n = recv(source_sock, buffer, 1024, 0)) > 0)
    ;
  shutdown(source_sock, SHUT_RDWR);
  close(source_sock);
}


x86 assembly (clang, -O0):
<read_data_and_drop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2e83(%rip),%rax
mov    (%rax),%edi
lea    0xea2(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x4(%rbp),%edi
lea    -0x410(%rbp),%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x414(%rbp)
cmp    $0x0,%eax
jle    118d <read_data_and_drop+0x4d>
jmp    1163 <read_data_and_drop+0x23>
mov    -0x4(%rbp),%edi
mov    0x2e59(%rip),%rax
mov    (%rax),%esi
call   1040 <shutdown@plt>
mov    -0x4(%rbp),%edi
call   1050 <close@plt>
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_data_and_drop>:
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    %edi,%ebx
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
lea    0xea4(%rip),%rsi
call   1060 <fprintf@plt>
mov    %rsp,%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %eax,%eax
jg     1170 <read_data_and_drop+0x30>
mov    0x2e64(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
call   1040 <shutdown@plt>
mov    %ebx,%edi
call   1050 <close@plt>
add    $0x408,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [21 x i8] c"READ DATA AND DROP \0A\00"
@SHUT_RDWR = global i32 0
define void @read_data_and_drop(i32 %0) {
%2 = alloca i32
%3 = alloca [1024 x i8]
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* @stderr
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %12, %1
%8 = load i32, i32* %2
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%10 = call i32 @recv(i32 %8, i8* %9, i32 1024, i32 0)
store i32 %10, i32* %4
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %7
br label %7
13: ; preds = %7
%14 = load i32, i32* %2
%15 = load i32, i32* @SHUT_RDWR
%16 = call i32 @shutdown(i32 %14, i32 %15)
%17 = load i32, i32* %2
%18 = call i32 @close(i32 %17)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [21 x i8] c"READ DATA AND DROP \0A\00"
@SHUT_RDWR = global i32 0
define void @read_data_and_drop(i32 %0) {
%2 = alloca [1024 x i8]
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
br label %6
6: ; preds = %6, %1
%7 = call i32 @recv(i32 %0, i8* %5, i32 1024, i32 0)
%8 = icmp sgt i32 %7, 0
br i1 %8, label %6, label %9
9: ; preds = %6
%10 = load i32, i32* @SHUT_RDWR
%11 = call i32 @shutdown(i32 %0, i32 %10)
%12 = call i32 @close(i32 %0)
ret void
}